aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop-unified
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2018-05-16 06:14:39 -0400
committerKen Moore <ken@ixsystems.com>2018-05-16 06:14:39 -0400
commit091182c245c510fdada7557443fc3697cb3be1ff (patch)
tree04cd1090e8ed7f27e0ab86cad487663a09238508 /src-qt5/core/lumina-desktop-unified
parentGet the Clock plugin all finished up. (diff)
downloadlumina-091182c245c510fdada7557443fc3697cb3be1ff.tar.gz
lumina-091182c245c510fdada7557443fc3697cb3be1ff.tar.bz2
lumina-091182c245c510fdada7557443fc3697cb3be1ff.zip
Add another plugin:
StatusTray : combined system status indicators and system tray application area
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified')
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp4
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h1
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Panel.cpp3
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.cpp11
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.h8
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/BatteryButton.cpp28
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/BatteryButton.h22
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/CalendarMenu.h2
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/ClockPlugin.h7
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/NetworkButton.cpp35
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/NetworkButton.h23
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/SpacerPlugin.h2
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/StatusTrayPlugin.h51
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/SystemTrayMenu.cpp65
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/SystemTrayMenu.h49
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/VolumeButton.cpp28
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/VolumeButton.h22
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/plugins.pri12
18 files changed, 357 insertions, 16 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp
index 8e559819..06c41354 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp
@@ -256,6 +256,10 @@ void RootDesktopObject::launchApp(QString appOrPath){
//C++ Access Functions (simplifications for the QML ones)
QList<NativeWindowObject*> RootDesktopObject::windowObjects(){
return window_objects;
+
+}
+QList<NativeWindowObject*> RootDesktopObject::trayWindowObjects(){
+ return tray_window_objects;
}
QList<ScreenObject*> RootDesktopObject::screenObjects(){
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h
index f88a547c..760228b8 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h
@@ -58,6 +58,7 @@ public:
//C++ Access Functions (simplifications for the QML ones)
QList<NativeWindowObject*> windowObjects();
+ QList<NativeWindowObject*> trayWindowObjects();
QList<ScreenObject*> screenObjects();
QRegion* availableGeometry();
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Panel.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Panel.cpp
index 52642235..07456419 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Panel.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Panel.cpp
@@ -36,7 +36,8 @@ Plugin* Panel::findPlugin(QString id){
}
Plugin* Panel::createPlugin(QString id){
- return Plugin::createPlugin(this, id, true);
+ Plugin* tmp = Plugin::createPlugin(this, id, true, obj->isVertical());
+ return tmp;
}
// PRIVATE SLOTS
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.cpp
index 9ddceccc..3080c377 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.cpp
@@ -9,23 +9,26 @@
//Add includes for individual plugin files here
#include <ClockPlugin.h>
#include <SpacerPlugin.h>
+#include <StatusTrayPlugin.h>
QStringList Plugin::built_in_plugins(){
QStringList list;
- list << "clock" << "spacer";
+ list << "clock" << "spacer" << "statustray";
return list;
}
-Plugin* Plugin::createPlugin(QWidget *parent, QString id, bool panelplug){
+Plugin* Plugin::createPlugin(QWidget *parent, QString id, bool panelplug, bool vertical){
Plugin *plug = 0;
QString id_extra, id_primary;
if(id.contains("--")){ id_extra = id.section("--",1,-1); id_primary = id.section("--",0,0); }
else{ id_primary = id; } //no extra info on this one
id_primary = id_primary.toLower();
if(id_primary=="clock"){
- plug = new ClockPlugin(parent, id, panelplug);
+ plug = new ClockPlugin(parent, id, panelplug, vertical);
}else if(id_primary=="spacer"){
- plug = new SpacerPlugin(parent, id, panelplug);
+ plug = new SpacerPlugin(parent, id, panelplug, vertical);
+ }else if(id_primary=="statustray"){
+ plug = new StatusTrayPlugin(parent, id, panelplug, vertical);
}
return plug;
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.h
index a8dc8869..4620407f 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.h
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.h
@@ -27,11 +27,11 @@ public:
//These static functions are defined in "Plugin.cpp"
static QStringList built_in_plugins();
- static Plugin* createPlugin(QWidget *parent, QString id, bool panelplug = false);
+ static Plugin* createPlugin(QWidget *parent, QString id, bool panelplug = false, bool vertical = false);
- Plugin(QWidget *parent, QString id, bool panelplug = false) : QWidget(parent){
+ Plugin(QWidget *parent, QString id, bool panelplug = false, bool vertical = false) : QWidget(parent){
isPanelPlugin = panelplug;
- isVertical = false;
+ isVertical = vertical;
_id = id;
boxLayout = new QBoxLayout(QBoxLayout::LeftToRight);
this->setLayout( boxLayout );
@@ -69,7 +69,7 @@ class PluginButton : public Plugin{
public:
QToolButton *button;
- PluginButton(QWidget *parent, QString id, bool panelplug=false) : Plugin(parent, id, panelplug) {
+ PluginButton(QWidget *parent, QString id, bool panelplug=false, bool vertical = false) : Plugin(parent, id, panelplug, vertical) {
button = new QToolButton(this);
button->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
button->setAutoRaise(true);
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/BatteryButton.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/BatteryButton.cpp
new file mode 100644
index 00000000..656c19c1
--- /dev/null
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/BatteryButton.cpp
@@ -0,0 +1,28 @@
+//===========================================
+// Lumina-desktop source code
+// Copyright (c) 2018, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#include "BatteryButton.h"
+
+BatteryButton::BatteryButton(QWidget *parent) : QToolButton(parent){
+ this->setAutoRaise(true);
+ this->setPopupMode(QToolButton::InstantPopup);
+ this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
+ //Setup the menu
+
+ //Now start the initial update routine in a moment
+ connect(OSInterface::instance(), SIGNAL(batteryChanged()), this, SLOT(updateButton()) );
+ QTimer::singleShot(10, this, SLOT(updateButton()) );
+}
+
+BatteryButton::~BatteryButton(){
+
+}
+
+void BatteryButton::updateButton(){
+ this->setIcon( QIcon::fromTheme( OSInterface::instance()->batteryIcon() ) );
+ //Now get all the info about the battery for the tooltip
+ this->setToolTip( OSInterface::instance()->batteryStatus() );
+}
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/BatteryButton.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/BatteryButton.h
new file mode 100644
index 00000000..4ee6e9d8
--- /dev/null
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/BatteryButton.h
@@ -0,0 +1,22 @@
+//===========================================
+// Lumina-desktop source code
+// Copyright (c) 2018, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#ifndef _LUMINA_DESKTOP_PLUGIN_BUTTON_BATTERY_H
+#define _LUMINA_DESKTOP_PLUGIN_BUTTON_BATTERY_H
+
+#include <global-includes.h>
+
+class BatteryButton : public QToolButton{
+ Q_OBJECT
+private slots:
+ void updateButton();
+
+public:
+ BatteryButton(QWidget *parent = 0);
+ ~BatteryButton();
+
+};
+#endif
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/CalendarMenu.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/CalendarMenu.h
index 6bf3fefe..38521c97 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/CalendarMenu.h
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/CalendarMenu.h
@@ -20,7 +20,7 @@ private:
QCalendarWidget *cal;
QWidgetAction *WA;
public:
- CalendarMenu(){
+ CalendarMenu() : QMenu(){
cal = new QCalendarWidget();
WA = new QWidgetAction(this);
WA->setDefaultWidget(cal);
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/ClockPlugin.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/ClockPlugin.h
index 7bf48cc2..d028de8f 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/ClockPlugin.h
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/ClockPlugin.h
@@ -41,7 +41,8 @@ private slots:
else{ break; }
}else{
//Need to get a lot more complicated - need to break up sections mid-word based on widget width
- for(int i=0; i<textL.length(); i++){
+ // NOT WORKING - can cause infinite loop somehow (perhaps max is 0 on init?)
+ /*for(int i=0; i<textL.length(); i++){
int tmp = button->fontMetrics().width(textL[i]);
if(tmp>max){
//qDebug() << "CLOCK:" << i << tmp << max << textL[i];
@@ -49,7 +50,7 @@ private slots:
QString rem = textL[i].remove(tmps);
textL[i] = tmps; textL.insert(i+1, rem);
}
- }
+ }*/
//Now go ahead and break the main loop - text all fits width-wise now
break;
}
@@ -61,7 +62,7 @@ private slots:
}
public:
- ClockPlugin(QWidget *parent, QString id, bool panelplug) : PluginButton(parent, id, panelplug){
+ ClockPlugin(QWidget *parent, QString id, bool panelplug, bool vertical) : PluginButton(parent, id, panelplug, vertical){
connect(RootDesktopObject::instance(), SIGNAL(currentTimeChanged()), this, SLOT(updateTime()) );
QFont tmp = button->font();
tmp.setBold(true);
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/NetworkButton.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/NetworkButton.cpp
new file mode 100644
index 00000000..a3b0e38f
--- /dev/null
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/NetworkButton.cpp
@@ -0,0 +1,35 @@
+//===========================================
+// Lumina-desktop source code
+// Copyright (c) 2018, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#include "NetworkButton.h"
+#include <global-objects.h>
+
+NetworkButton::NetworkButton(QWidget *parent) : QToolButton(parent){
+ this->setAutoRaise(true);
+ this->setPopupMode(QToolButton::InstantPopup);
+ this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
+ //Setup the menu
+
+ //Now start the initial update routine in a moment
+ connect(OSInterface::instance(), SIGNAL(batteryChanged()), this, SLOT(updateButton()) );
+ QTimer::singleShot(10, this, SLOT(updateButton()) );
+}
+
+NetworkButton::~NetworkButton(){
+
+}
+
+void NetworkButton::updateButton(){
+ this->setIcon( QIcon::fromTheme( OSInterface::instance()->networkIcon() ) );
+ //Now get all the info about the battery for the tooltip
+ this->setToolTip( OSInterface::instance()->networkStatus() );
+}
+
+void NetworkButton::buttonClicked(){
+ if(OSInterface::instance()->hasNetworkManager()){
+ LSession::instance()->LaunchStandardApplication( OSInterface::instance()->networkManagerUtility() );
+ }
+}
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/NetworkButton.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/NetworkButton.h
new file mode 100644
index 00000000..deb6f939
--- /dev/null
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/NetworkButton.h
@@ -0,0 +1,23 @@
+//===========================================
+// Lumina-desktop source code
+// Copyright (c) 2018, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#ifndef _LUMINA_DESKTOP_PLUGIN_BUTTON_NETWORK_H
+#define _LUMINA_DESKTOP_PLUGIN_BUTTON_NETWORK_H
+
+#include <global-includes.h>
+
+class NetworkButton : public QToolButton{
+ Q_OBJECT
+private slots:
+ void updateButton();
+ void buttonClicked();
+
+public:
+ NetworkButton(QWidget *parent = 0);
+ ~NetworkButton();
+
+};
+#endif
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/SpacerPlugin.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/SpacerPlugin.h
index 0f8d8809..b3f25450 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/SpacerPlugin.h
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/SpacerPlugin.h
@@ -12,7 +12,7 @@ class SpacerPlugin : public Plugin{
Q_OBJECT
public:
- SpacerPlugin(QWidget *parent, QString id, bool panelplug) : Plugin(parent, id, panelplug){}
+ SpacerPlugin(QWidget *parent, QString id, bool panelplug, bool vertical) : Plugin(parent, id, panelplug, vertical){}
~SpacerPlugin(){ }
//Replace the virtual sizing function
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/StatusTrayPlugin.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/StatusTrayPlugin.h
new file mode 100644
index 00000000..f3c41205
--- /dev/null
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/StatusTrayPlugin.h
@@ -0,0 +1,51 @@
+//===========================================
+// Lumina-desktop source code
+// Copyright (c) 2018, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#ifndef _LUMINA_DESKTOP_PLUGIN_STATUSTRAY_H
+#define _LUMINA_DESKTOP_PLUGIN_STATUSTRAY_H
+
+#include <Plugin.h>
+#include <SystemTrayMenu.h>
+#include <VolumeButton.h>
+#include <BatteryButton.h>
+#include <NetworkButton.h>
+
+#include <global-includes.h>
+
+class StatusTrayPlugin : public PluginButton{
+ Q_OBJECT
+
+private:
+
+private slots:
+ void updateIcons(){
+ QStringList icons; icons << "open-menu" << "show-menu" << "view-grid" << "up" << "arrow-up";
+ for(int i=0; i<icons.length(); i++){
+ if(QIcon::hasThemeIcon(icons[i])){ button->setIcon( QIcon::fromTheme(icons[i])); break; }
+ }
+ }
+
+public:
+ StatusTrayPlugin(QWidget *parent, QString id, bool panelplug, bool vertical) : PluginButton(parent, id, panelplug, vertical){
+ //Setup the popup menu for the system tray
+ static QMenu *systrayMenu = 0;
+ if(systrayMenu == 0){
+ systrayMenu = new SystemTrayMenu();
+ }
+ button->setMenu(systrayMenu);
+ connect(systrayMenu, SIGNAL(hasTrayIcons(bool)), button, SLOT(setVisible(bool)) );
+ updateIcons();
+ //Now create/add all the other buttons
+ if(OSInterface::instance()->OS_volumeSupported()){ boxLayout->addWidget( new VolumeButton(this) ); }
+ boxLayout->addWidget( new NetworkButton(this) );
+ if(OSInterface::instance()->batteryAvailable()){ boxLayout->addWidget( new BatteryButton(this) ); }
+ //boxLayout->addWidget( new UpdateButton(this) );
+ }
+ ~StatusTrayPlugin(){ }
+
+};
+
+#endif
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/SystemTrayMenu.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/SystemTrayMenu.cpp
new file mode 100644
index 00000000..f746b460
--- /dev/null
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/SystemTrayMenu.cpp
@@ -0,0 +1,65 @@
+//===========================================
+// Lumina-desktop source code
+// Copyright (c) 2018, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#include "SystemTrayMenu.h"
+
+#include <global-objects.h>
+
+SystemTrayMenu::SystemTrayMenu() : QMenu() {
+ this->setWindowFlags(Qt::Popup | Qt::WindowTransparentForInput);
+ widget = new QWidget();
+ layout = new QGridLayout(widget);
+ WA = new QWidgetAction(this);
+ WA->setDefaultWidget(widget);
+ this->addAction(WA);
+ connect(RootDesktopObject::instance(), SIGNAL(trayWindowsChanged()), this, SLOT(trayWindowsChanged()) );
+ QTimer::singleShot(50, this, SLOT(trayWindowsChanged()) ); //first-time load of tray windows
+}
+
+SystemTrayMenu::~SystemTrayMenu(){
+ widget->deleteLater();
+}
+
+int SystemTrayMenu::numTrayIcons(){
+ return TIcons.count();
+}
+
+void SystemTrayMenu::trayWindowsChanged(){
+ //Clear all the tray icons
+ for(int i=0; i<TIcons.length(); i++){ layout->removeWidget(TIcons[i]); TIcons[i]->deleteLater(); }
+ TIcons.clear();
+ //Now generate all the tray icons
+ QList<NativeWindowObject*> wins = RootDesktopObject::instance()->trayWindowObjects();
+ for(int i=0; i<wins.length(); i++){
+ TrayIcon *tmp = new TrayIcon(this, wins[i]);
+ connect(this, SIGNAL(aboutToShow()), tmp, SLOT(aboutToShow()) );
+ TIcons << tmp;
+ layout->addWidget(tmp, i/3, i%3); //3 columns of icons
+ }
+ emit hasTrayIcons( numTrayIcons()>0 );
+}
+
+// ================
+// TrayIcon
+// ================
+TrayIcon::TrayIcon(QWidget *parent, NativeWindowObject *win) : QLabel(parent){
+ WIN = win;
+ connect(win, SIGNAL(iconChanged()), this, SLOT(updateIcon()) );
+}
+
+TrayIcon::~TrayIcon(){
+
+}
+
+void TrayIcon::updateIcon(){
+ //Just set a hard 48x48 pixel size for now
+ // It is small enough that most apps support it, but large enough to be visible on high-DPI screens
+ this->setPixmap( WIN->property(NativeWindowObject::Icon).value<QIcon>().pixmap(QSize(48,48)) );
+}
+
+void TrayIcon::aboutToShow(){
+ WIN->setGeometryNow( QRect(this->mapToGlobal(this->geometry().topLeft()), QSize(48,48)) );
+}
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/SystemTrayMenu.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/SystemTrayMenu.h
new file mode 100644
index 00000000..a546331a
--- /dev/null
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/SystemTrayMenu.h
@@ -0,0 +1,49 @@
+//===========================================
+// Lumina-desktop source code
+// Copyright (c) 2018, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+// Simple menu which shows icons for all the system tray apps
+//===========================================
+#ifndef _LUMINA_DESKTOP_WIDGET_MENU_SYSTEMTRAY_H
+#define _LUMINA_DESKTOP_WIDGET_MENU_SYSTEMTRAY_H
+
+#include <global-includes.h>
+class TrayIcon : public QLabel {
+ Q_OBJECT
+private:
+ NativeWindowObject *WIN;
+
+public:
+ TrayIcon(QWidget *parent, NativeWindowObject *win);
+ ~TrayIcon();
+
+private slots:
+ void updateIcon();
+ void aboutToShow();
+
+};
+
+class SystemTrayMenu : public QMenu {
+ Q_OBJECT
+private:
+ QWidget *widget;
+ QWidgetAction *WA;
+ QGridLayout *layout;
+ QList<TrayIcon*> TIcons;
+
+public:
+ SystemTrayMenu();
+ ~SystemTrayMenu();
+
+ int numTrayIcons();
+
+private slots:
+ void trayWindowsChanged();
+
+signals:
+ void hasTrayIcons(bool);
+
+};
+#endif
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/VolumeButton.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/VolumeButton.cpp
new file mode 100644
index 00000000..bc0d2d89
--- /dev/null
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/VolumeButton.cpp
@@ -0,0 +1,28 @@
+//===========================================
+// Lumina-desktop source code
+// Copyright (c) 2018, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#include "VolumeButton.h"
+
+VolumeButton::VolumeButton(QWidget *parent) : QToolButton(parent){
+ this->setAutoRaise(true);
+ this->setPopupMode(QToolButton::InstantPopup);
+ this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
+ //Setup the menu
+
+ //Now start the initial update routine in a moment
+ connect(OSInterface::instance(), SIGNAL(volumeChanged()), this, SLOT(updateButton()) );
+ QTimer::singleShot(10, this, SLOT(updateButton()) );
+}
+
+VolumeButton::~VolumeButton(){
+
+}
+
+void VolumeButton::updateButton(){
+ this->setIcon( QIcon::fromTheme( OSInterface::instance()->volumeIcon() ) );
+ int vol = OSInterface::instance()->volume();
+ this->setToolTip( QString("%1%").arg(QString::number(vol)) );
+}
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/VolumeButton.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/VolumeButton.h
new file mode 100644
index 00000000..44adc7ad
--- /dev/null
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/VolumeButton.h
@@ -0,0 +1,22 @@
+//===========================================
+// Lumina-desktop source code
+// Copyright (c) 2018, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#ifndef _LUMINA_DESKTOP_PLUGIN_BUTTON_VOLUME_H
+#define _LUMINA_DESKTOP_PLUGIN_BUTTON_VOLUME_H
+
+#include <global-includes.h>
+
+class VolumeButton : public QToolButton{
+ Q_OBJECT
+private slots:
+ void updateButton();
+
+public:
+ VolumeButton(QWidget *parent = 0);
+ ~VolumeButton();
+
+};
+#endif
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/plugins.pri b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/plugins.pri
index 8931d413..b2366540 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/plugins.pri
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/plugins.pri
@@ -1,8 +1,16 @@
#update the includepath so we can just #include as needed without paths
INCLUDEPATH *= $${PWD}
-#SOURCES *=
+SOURCES *= $${PWD}/SystemTrayMenu.cpp \
+ $${PWD}/VolumeButton.cpp \
+ $${PWD}/BatteryButton.cpp \
+ $${PWD}/NetworkButton.cpp
HEADERS *= $${PWD}/ClockPlugin.h \
$${PWD}/CalendarMenu.h \
- $${PWD}/SpacerPlugin.h
+ $${PWD}/SpacerPlugin.h \
+ $${PWD}/StatusTrayPlugin.h \
+ $${PWD}/SystemTrayMenu.h \
+ $${PWD}/VolumeButton.h \
+ $${PWD}/BatteryButton.h \
+ $${PWD}/NetworkButton.h
bgstack15