diff options
author | Ken Moore <ken@ixsystems.com> | 2018-05-16 08:01:56 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2018-05-16 08:01:56 -0400 |
commit | 4237f6153cad063a27148099e8b788bb814b5017 (patch) | |
tree | badaab6868751869aba77e1f97e660b5d883390f /src-qt5/core/lumina-desktop-unified/src-desktop | |
parent | Update a bunch of other icon routines in OSInterface to accomodate probing th... (diff) | |
download | lumina-4237f6153cad063a27148099e8b788bb814b5017.tar.gz lumina-4237f6153cad063a27148099e8b788bb814b5017.tar.bz2 lumina-4237f6153cad063a27148099e8b788bb814b5017.zip |
Get more of the system status indicators up and running properly.
Add a new button for system update status.
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified/src-desktop')
5 files changed, 60 insertions, 4 deletions
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 index a3b0e38f..1108878d 100644 --- 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 @@ -14,7 +14,7 @@ NetworkButton::NetworkButton(QWidget *parent) : QToolButton(parent){ //Setup the menu //Now start the initial update routine in a moment - connect(OSInterface::instance(), SIGNAL(batteryChanged()), this, SLOT(updateButton()) ); + connect(OSInterface::instance(), SIGNAL(networkStatusChanged()), this, SLOT(updateButton()) ); QTimer::singleShot(10, this, SLOT(updateButton()) ); } @@ -26,6 +26,7 @@ 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() ); + //qDebug() << "Network Button Sync:" << OSInterface::instance()->networkIcon(); } void NetworkButton::buttonClicked(){ 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 index f3c41205..7752a7a7 100644 --- 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 @@ -12,6 +12,7 @@ #include <VolumeButton.h> #include <BatteryButton.h> #include <NetworkButton.h> +#include <UpdatesButton.h> #include <global-includes.h> @@ -42,7 +43,7 @@ public: 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) ); + if(OSInterface::instance()->updatesSupported()){ boxLayout->addWidget( new UpdatesButton(this) ); } } ~StatusTrayPlugin(){ } diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/UpdatesButton.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/UpdatesButton.cpp new file mode 100644 index 00000000..4f5c8ee2 --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/UpdatesButton.cpp @@ -0,0 +1,30 @@ +//=========================================== +// Lumina-desktop source code +// Copyright (c) 2018, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "UpdatesButton.h" + +UpdatesButton::UpdatesButton(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(updateStatusChanged()), this, SLOT(updateButton()) ); + QTimer::singleShot(10, this, SLOT(updateButton()) ); +} + +UpdatesButton::~UpdatesButton(){ + +} + +void UpdatesButton::updateButton(){ + this->setIcon( QIcon::fromTheme( OSInterface::instance()->updateIcon() ) ); + //Now get all the info about the battery for the tooltip + this->setToolTip( OSInterface::instance()->updateStatusInfo() ); + //qDebug() << "Update Button sync:" << OSInterface::instance()->updateIcon() << OSInterface::instance()->updateStatus() << OSInterface::instance()->updateStatusInfo(); + this->setVisible( !OSInterface::instance()->updateStatus().isEmpty() ); +} diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/UpdatesButton.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/UpdatesButton.h new file mode 100644 index 00000000..30185852 --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/UpdatesButton.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_UPDATES_H +#define _LUMINA_DESKTOP_PLUGIN_BUTTON_UPDATES_H + +#include <global-includes.h> + +class UpdatesButton : public QToolButton{ + Q_OBJECT +private slots: + void updateButton(); + +public: + UpdatesButton(QWidget *parent = 0); + ~UpdatesButton(); + +}; +#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 b2366540..f45e8c09 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 @@ -4,7 +4,8 @@ INCLUDEPATH *= $${PWD} SOURCES *= $${PWD}/SystemTrayMenu.cpp \ $${PWD}/VolumeButton.cpp \ $${PWD}/BatteryButton.cpp \ - $${PWD}/NetworkButton.cpp + $${PWD}/NetworkButton.cpp \ + $${PWD}/UpdatesButton.cpp HEADERS *= $${PWD}/ClockPlugin.h \ $${PWD}/CalendarMenu.h \ @@ -13,4 +14,5 @@ HEADERS *= $${PWD}/ClockPlugin.h \ $${PWD}/SystemTrayMenu.h \ $${PWD}/VolumeButton.h \ $${PWD}/BatteryButton.h \ - $${PWD}/NetworkButton.h + $${PWD}/NetworkButton.h \ + $${PWD}/UpdatesButton.h |