diff --git a/src/apps/deskflow-gui/MainWindow.cpp b/src/apps/deskflow-gui/MainWindow.cpp index fbebcb780..cc3e04818 100644 --- a/src/apps/deskflow-gui/MainWindow.cpp +++ b/src/apps/deskflow-gui/MainWindow.cpp @@ -71,6 +71,7 @@ MainWindow::MainWindow(ConfigScopes &configScopes, AppConfig &appConfig) m_guiDupeChecker{new QLocalServer(this)}, m_lblSecurityStatus{new QLabel(this)}, m_lblStatus{new QLabel(this)}, + m_btnUpdate{new QPushButton(this)}, m_btnFingerprint{new QToolButton(this)}, m_actionAbout{new QAction(this)}, m_actionClearSettings{new QAction(tr("Clear settings"), this)}, @@ -216,9 +217,6 @@ void MainWindow::setupControls() secureSocket(false); - ui->lblUpdate->setStyleSheet(kStyleNoticeLabel); - ui->lblUpdate->hide(); - ui->lblIpAddresses->setText(tr("This computer's IP addresses: %1").arg(getIPAddresses())); if (m_appConfig.lastVersion() != kVersion) { @@ -232,19 +230,29 @@ void MainWindow::setupControls() #endif + const auto trayItemSize = QSize(24, 24); m_btnFingerprint->setIcon(QIcon::fromTheme(QStringLiteral("fingerprint"))); - m_btnFingerprint->setFixedSize(QSize(24, 24)); - m_btnFingerprint->setIconSize(QSize(24, 24)); + m_btnFingerprint->setFixedSize(trayItemSize); + m_btnFingerprint->setIconSize(trayItemSize); m_btnFingerprint->setAutoRaise(true); m_btnFingerprint->setToolTip(tr("View local fingerprint")); ui->statusBar->insertPermanentWidget(0, m_btnFingerprint); m_lblSecurityStatus->setVisible(false); - m_lblSecurityStatus->setFixedSize(QSize(24, 24)); + m_lblSecurityStatus->setFixedSize(trayItemSize); m_lblSecurityStatus->setScaledContents(true); ui->statusBar->insertPermanentWidget(1, m_lblSecurityStatus); ui->statusBar->insertPermanentWidget(2, m_lblStatus, 1); + + m_btnUpdate->setVisible(false); + m_btnUpdate->setText(tr("Update available")); + m_btnUpdate->setLayoutDirection(Qt::RightToLeft); + m_btnUpdate->setIcon(QIcon::fromTheme(QStringLiteral("software-updates-release"))); + m_btnUpdate->setFixedHeight(24); + m_btnUpdate->setIconSize(trayItemSize); + m_btnUpdate->setFlat(true); + ui->statusBar->insertPermanentWidget(3, m_btnUpdate); } ////////////////////////////////////////////////////////////////////////////// @@ -320,6 +328,8 @@ void MainWindow::connectSlots() connect(ui->btnToggleLog, &QAbstractButton::toggled, this, &MainWindow::toggleLogVisible); + connect(m_btnUpdate, &QPushButton::clicked, this, &MainWindow::openGetNewVersionUrl); + connect(m_guiDupeChecker, &QLocalServer::newConnection, this, &MainWindow::showAndActivate); } @@ -374,11 +384,8 @@ void MainWindow::trayIconActivated(QSystemTrayIcon::ActivationReason reason) void MainWindow::versionCheckerUpdateFound(const QString &version) { - const auto link = QString(kLinkDownload).arg(kUrlDownload, kColorWhite); - const auto text = tr("A new version is available (v%1). %2").arg(version, link); - - ui->lblUpdate->show(); - ui->lblUpdate->setText(text); + m_btnUpdate->setVisible(true); + m_btnUpdate->setToolTip(tr("A new version v%1 is avilable").arg(version)); } void MainWindow::coreProcessError(CoreProcess::Error error) @@ -456,6 +463,11 @@ void MainWindow::openHelpUrl() const QDesktopServices::openUrl(QUrl(kUrlHelp)); } +void MainWindow::openGetNewVersionUrl() const +{ + QDesktopServices::openUrl(kUrlDownload); +} + void MainWindow::openSettings() { auto dialog = SettingsDialog(this, m_appConfig, m_serverConfig, m_coreProcess); diff --git a/src/apps/deskflow-gui/MainWindow.h b/src/apps/deskflow-gui/MainWindow.h index 496866f6f..8b4addae5 100644 --- a/src/apps/deskflow-gui/MainWindow.h +++ b/src/apps/deskflow-gui/MainWindow.h @@ -111,6 +111,7 @@ private: void clearSettings(); void openAboutDialog(); void openHelpUrl() const; + void openGetNewVersionUrl() const; void openSettings(); void startCore(); void stopCore(); @@ -207,6 +208,7 @@ private: QLabel *m_lblSecurityStatus = nullptr; QLabel *m_lblStatus = nullptr; QToolButton *m_btnFingerprint = nullptr; + QPushButton *m_btnUpdate = nullptr; // Window Actions QAction *m_actionAbout = nullptr; diff --git a/src/apps/deskflow-gui/MainWindow.ui b/src/apps/deskflow-gui/MainWindow.ui index 7f1e7544d..1ebfcc662 100644 --- a/src/apps/deskflow-gui/MainWindow.ui +++ b/src/apps/deskflow-gui/MainWindow.ui @@ -55,22 +55,6 @@ - - - - - 0 - 0 - - - - lblUpdate - - - true - - - diff --git a/src/apps/res/deskflow.qrc b/src/apps/res/deskflow.qrc index b738022ec..79dc38cdf 100644 --- a/src/apps/res/deskflow.qrc +++ b/src/apps/res/deskflow.qrc @@ -43,6 +43,7 @@ icons/deskflow-dark/apps/64/deskflow-symbolic.svg icons/deskflow-dark/devices/64/video-display.svg icons/deskflow-dark/places/64/user-trash.svg + icons/deskflow-dark/status/32/software-updates-release.svg icons/deskflow-dark/status/64/dialog-error.svg icons/deskflow-dark/status/64/dialog-information.svg icons/deskflow-dark/status/64/dialog-positive.svg @@ -96,6 +97,7 @@ icons/deskflow-light/apps/64/deskflow.svg icons/deskflow-light/apps/64/deskflow-symbolic.svg icons/deskflow-light/devices/64/video-display.svg + icons/deskflow-light/status/32/software-updates-release.svg icons/deskflow-light/status/64/dialog-error.svg icons/deskflow-light/status/64/dialog-information.svg icons/deskflow-light/status/64/dialog-positive.svg diff --git a/src/apps/res/icons/deskflow-dark/index.theme b/src/apps/res/icons/deskflow-dark/index.theme index 9846a28c5..39c5ad37c 100644 --- a/src/apps/res/icons/deskflow-dark/index.theme +++ b/src/apps/res/icons/deskflow-dark/index.theme @@ -29,7 +29,7 @@ KDE-Extensions=.svg ########## Directories ########## ordered by category and alphabetically -Directories=actions/16,actions/22,actions/24,actions/32,apps/64,devices/64,places/64,status/16,status/22,status,24,status/64 +Directories=actions/16,actions/22,actions/24,actions/32,apps/64,devices/64,places/64,status/16,status/22,status,24,status/32,status/64 ScaledDirectories=actions/16@2x,actions/16@3x,actions/22@2x,actions/22@3x,actions/24@2x,actions/24@3x,actions/32@2x,actions/32@3x [apps/64] @@ -156,6 +156,14 @@ Context=Places MinSize=48 MaxSize=256 +#32x32 - Fixed size - For dialog icons >!!!ONLY!!!< - DO_NOT_USE_ANYWHERE_ELSE - Color +[status/32] +Size=32 +Context=Status +Type=Scalable +MinSize=22 +MaxSize=256 + #64x64 - Fixed size - For dialog icons >!!!ONLY!!!< - DO_NOT_USE_ANYWHERE_ELSE - Color [status/64] Size=64 diff --git a/src/apps/res/icons/deskflow-dark/status/32/software-updates-release.svg b/src/apps/res/icons/deskflow-dark/status/32/software-updates-release.svg new file mode 100644 index 000000000..cec8a79f0 --- /dev/null +++ b/src/apps/res/icons/deskflow-dark/status/32/software-updates-release.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/apps/res/icons/deskflow-light/index.theme b/src/apps/res/icons/deskflow-light/index.theme index 54af1ce2b..4a1cf889d 100644 --- a/src/apps/res/icons/deskflow-light/index.theme +++ b/src/apps/res/icons/deskflow-light/index.theme @@ -29,7 +29,7 @@ KDE-Extensions=.svg ########## Directories ########## ordered by category and alphabetically -Directories=actions/16,actions/22,actions/24,actions/32,apps/64,devices/64,places/64,status/16,status/22,status,24,status/64 +Directories=actions/16,actions/22,actions/24,actions/32,apps/64,devices/64,places/64,status/16,status/22,status,24,status/32,status/64 ScaledDirectories=actions/16@2x,actions/16@3x,actions/22@2x,actions/22@3x,actions/24@2x,actions/24@3x,actions/32@2x,actions/32@3x [apps/64] @@ -157,6 +157,14 @@ Context=Places MinSize=48 MaxSize=256 +#32x32 - Fixed size - For dialog icons >!!!ONLY!!!< - DO_NOT_USE_ANYWHERE_ELSE - Color +[status/32] +Size=32 +Context=Status +Type=Scalable +MinSize=22 +MaxSize=256 + #64x64 - Fixed size - For dialog icons >!!!ONLY!!!< - DO_NOT_USE_ANYWHERE_ELSE - Color [status/64] Size=64 diff --git a/src/apps/res/icons/deskflow-light/status/32/software-updates-release.svg b/src/apps/res/icons/deskflow-light/status/32/software-updates-release.svg new file mode 100644 index 000000000..f588967ef --- /dev/null +++ b/src/apps/res/icons/deskflow-light/status/32/software-updates-release.svg @@ -0,0 +1,23 @@ + + + + + + + + + + diff --git a/src/lib/gui/constants.h b/src/lib/gui/constants.h index 7bc4481c6..5825dd373 100644 --- a/src/lib/gui/constants.h +++ b/src/lib/gui/constants.h @@ -15,8 +15,6 @@ namespace deskflow::gui { // notation (rdn), e.g. org.deskflow const auto kOrgDomain = QStringLiteral("deskflow.org"); -const auto kLinkDownload = R"(Download now)"; - const auto kUrlSourceQuery = "source=gui"; const auto kUrlApp = QStringLiteral("https://deskflow.org"); const auto kUrlHelp = QString("%1/help?%2").arg(kUrlApp, kUrlSourceQuery);