diff options
Diffstat (limited to 'src-qt5')
6 files changed, 61 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 diff --git a/src-qt5/src-cpp/framework-OSInterface_private.cpp b/src-qt5/src-cpp/framework-OSInterface_private.cpp index ad10ffe3..b0a22b1d 100644 --- a/src-qt5/src-cpp/framework-OSInterface_private.cpp +++ b/src-qt5/src-cpp/framework-OSInterface_private.cpp @@ -530,6 +530,7 @@ void OSInterface::syncUpdateInfo(OSInterface *os, QHash<QString, QVariant> *hash status="available"; icons << "state-warning" << "update-medium" << "security-medium"; } icons << "state-offline" << "update-none"; + //qDebug() << "Update Sync:" << status << icons; //Save the current info into the hash (if different) if(status != updateStatus()){ hash->insert("updates/status", status); |