refactor: MainWindow move update info to status tray
This commit is contained in:
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -55,22 +55,6 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblUpdate">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">lblUpdate</string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
||||
@ -43,6 +43,7 @@
|
||||
<file>icons/deskflow-dark/apps/64/deskflow-symbolic.svg</file>
|
||||
<file>icons/deskflow-dark/devices/64/video-display.svg</file>
|
||||
<file>icons/deskflow-dark/places/64/user-trash.svg</file>
|
||||
<file>icons/deskflow-dark/status/32/software-updates-release.svg</file>
|
||||
<file>icons/deskflow-dark/status/64/dialog-error.svg</file>
|
||||
<file>icons/deskflow-dark/status/64/dialog-information.svg</file>
|
||||
<file>icons/deskflow-dark/status/64/dialog-positive.svg</file>
|
||||
@ -96,6 +97,7 @@
|
||||
<file>icons/deskflow-light/apps/64/deskflow.svg</file>
|
||||
<file>icons/deskflow-light/apps/64/deskflow-symbolic.svg</file>
|
||||
<file>icons/deskflow-light/devices/64/video-display.svg</file>
|
||||
<file>icons/deskflow-light/status/32/software-updates-release.svg</file>
|
||||
<file>icons/deskflow-light/status/64/dialog-error.svg</file>
|
||||
<file>icons/deskflow-light/status/64/dialog-information.svg</file>
|
||||
<file>icons/deskflow-light/status/64/dialog-positive.svg</file>
|
||||
|
||||
@ -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
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" width="22" height="22">
|
||||
<style type="text/css" id="current-color-scheme">.ColorScheme-Accent { color: #3daee9; } .ColorScheme-Background { color: #2a2e32; } .ColorScheme-ButtonText { color: #31363b; } .ColorScheme-Text { color: #fcfcfc; } </style>
|
||||
<g id="software-updates-release" transform="translate(0,22) translate(0,-22)">
|
||||
<path style="fill:#2ecc71;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="M 7,7 4,10 4,19 9.0996094,19 13,19 l 5.099609,0 0,-9 -3,-3 L 13,7 9.0996094,7 Z m 0.3,1 3.7,0 3.7,0 2,2 -11.4,0 z m 1.7,3 4,0 0,5 -1,-1 -1,1 -1,-1 -1,1 z" id="path4164" inkscape:connector-curvature="0" sodipodi:nodetypes="ccccccccccccccccccccccccc"/>
|
||||
<path style="opacity:1;fill:#2ecc71;fill-opacity:1;stroke:none" d="M 16,3 A 3,3 0 0 0 13,6 3,3 0 0 0 16,9 3,3 0 0 0 19,6 3,3 0 0 0 16,3 Z" id="path4166" inkscape:connector-curvature="0"/>
|
||||
<path style="opacity:1;fill:currentColor;fill-opacity:1;stroke:none" d="m 16,4 2,2 -1,0 0,2 -2,0 0,-2 -1,0 1,-1 1,-1 z" id="path4168" inkscape:connector-curvature="0" class="ColorScheme-Background"/>
|
||||
<rect y="-2.6645353e-15" x="0" height="22" width="22" id="rect4170" style="opacity:1;fill:none;fill-opacity:0.59905659;stroke:none"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
@ -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
|
||||
|
||||
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" width="22" height="22">
|
||||
<style type="text/css" id="current-color-scheme">
|
||||
.ColorScheme-Text {
|
||||
color:#31363b;
|
||||
}
|
||||
.ColorScheme-Background {
|
||||
color:#eff0f1;
|
||||
}
|
||||
.ColorScheme-Accent {
|
||||
color:#3daee9;
|
||||
}
|
||||
.ColorScheme-ButtonText {
|
||||
color:#31363b;
|
||||
}
|
||||
</style>
|
||||
<g id="software-updates-release" transform="translate(0,22) translate(0,-22)">
|
||||
<path style="fill:#2ecc71;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="M 7,7 4,10 4,19 9.0996094,19 13,19 l 5.099609,0 0,-9 -3,-3 L 13,7 9.0996094,7 Z m 0.3,1 3.7,0 3.7,0 2,2 -11.4,0 z m 1.7,3 4,0 0,5 -1,-1 -1,1 -1,-1 -1,1 z" id="path4164" inkscape:connector-curvature="0" sodipodi:nodetypes="ccccccccccccccccccccccccc"/>
|
||||
<path style="opacity:1;fill:#2ecc71;fill-opacity:1;stroke:none" d="M 16,3 A 3,3 0 0 0 13,6 3,3 0 0 0 16,9 3,3 0 0 0 19,6 3,3 0 0 0 16,3 Z" id="path4166" inkscape:connector-curvature="0"/>
|
||||
<path style="opacity:1;fill:currentColor;fill-opacity:1;stroke:none" d="m 16,4 2,2 -1,0 0,2 -2,0 0,-2 -1,0 1,-1 1,-1 z" id="path4168" inkscape:connector-curvature="0" class="ColorScheme-Background"/>
|
||||
<rect y="-2.6645353e-15" x="0" height="22" width="22" id="rect4170" style="opacity:1;fill:none;fill-opacity:0.59905659;stroke:none"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
@ -15,8 +15,6 @@ namespace deskflow::gui {
|
||||
// notation (rdn), e.g. org.deskflow
|
||||
const auto kOrgDomain = QStringLiteral("deskflow.org");
|
||||
|
||||
const auto kLinkDownload = R"(<a href="%1" style="color: %2">Download now</a>)";
|
||||
|
||||
const auto kUrlSourceQuery = "source=gui";
|
||||
const auto kUrlApp = QStringLiteral("https://deskflow.org");
|
||||
const auto kUrlHelp = QString("%1/help?%2").arg(kUrlApp, kUrlSourceQuery);
|
||||
|
||||
Reference in New Issue
Block a user