refactor: mainwindow use status bar for status items
This commit is contained in:
parent
caee2b149a
commit
18cc8565f9
3 changed files with 56 additions and 124 deletions
|
|
@ -69,6 +69,8 @@ MainWindow::MainWindow(ConfigScopes &configScopes, AppConfig &appConfig)
|
||||||
m_tlsUtility(appConfig),
|
m_tlsUtility(appConfig),
|
||||||
m_trayIcon{new QSystemTrayIcon(this)},
|
m_trayIcon{new QSystemTrayIcon(this)},
|
||||||
m_guiDupeChecker{new QLocalServer(this)},
|
m_guiDupeChecker{new QLocalServer(this)},
|
||||||
|
m_lblSecurityStatus{new QLabel(this)},
|
||||||
|
m_lblStatus{new QLabel(this)},
|
||||||
m_actionAbout{new QAction(this)},
|
m_actionAbout{new QAction(this)},
|
||||||
m_actionClearSettings{new QAction(tr("Clear settings"), this)},
|
m_actionClearSettings{new QAction(tr("Clear settings"), this)},
|
||||||
m_actionReportBug{new QAction(tr("Report a Bug"), this)},
|
m_actionReportBug{new QAction(tr("Report a Bug"), this)},
|
||||||
|
|
@ -128,9 +130,6 @@ MainWindow::MainWindow(ConfigScopes &configScopes, AppConfig &appConfig)
|
||||||
ui->btnToggleLog->setFixedHeight(ui->lblLog->height() * 0.6);
|
ui->btnToggleLog->setFixedHeight(ui->lblLog->height() * 0.6);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Hide the security label
|
|
||||||
ui->lblConnectionSecurityStatus->setVisible(false);
|
|
||||||
|
|
||||||
ui->btnToggleLog->setStyleSheet(QStringLiteral("background:rgba(0,0,0,0);"));
|
ui->btnToggleLog->setStyleSheet(QStringLiteral("background:rgba(0,0,0,0);"));
|
||||||
|
|
||||||
// Setup the Instance Checking
|
// Setup the Instance Checking
|
||||||
|
|
@ -219,9 +218,6 @@ void MainWindow::setupControls()
|
||||||
ui->lblUpdate->setStyleSheet(kStyleNoticeLabel);
|
ui->lblUpdate->setStyleSheet(kStyleNoticeLabel);
|
||||||
ui->lblUpdate->hide();
|
ui->lblUpdate->hide();
|
||||||
|
|
||||||
ui->lblNotice->setStyleSheet(kStyleNoticeLabel);
|
|
||||||
ui->lblNotice->hide();
|
|
||||||
|
|
||||||
ui->lblIpAddresses->setText(tr("This computer's IP addresses: %1").arg(getIPAddresses()));
|
ui->lblIpAddresses->setText(tr("This computer's IP addresses: %1").arg(getIPAddresses()));
|
||||||
|
|
||||||
if (m_appConfig.lastVersion() != kVersion) {
|
if (m_appConfig.lastVersion() != kVersion) {
|
||||||
|
|
@ -234,6 +230,13 @@ void MainWindow::setupControls()
|
||||||
ui->rbModeClient->setAttribute(Qt::WA_MacShowFocusRect, 0);
|
ui->rbModeClient->setAttribute(Qt::WA_MacShowFocusRect, 0);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
m_lblSecurityStatus->setVisible(false);
|
||||||
|
m_lblSecurityStatus->setFixedSize(QSize(24, 24));
|
||||||
|
m_lblSecurityStatus->setScaledContents(true);
|
||||||
|
ui->statusBar->insertPermanentWidget(0, m_lblSecurityStatus);
|
||||||
|
|
||||||
|
ui->statusBar->insertPermanentWidget(1, m_lblStatus, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
@ -351,7 +354,7 @@ void MainWindow::appConfigTlsChanged()
|
||||||
if (m_tlsUtility.isEnabled() && !QFile::exists(m_appConfig.tlsCertPath())) {
|
if (m_tlsUtility.isEnabled() && !QFile::exists(m_appConfig.tlsCertPath())) {
|
||||||
m_tlsUtility.generateCertificate();
|
m_tlsUtility.generateCertificate();
|
||||||
}
|
}
|
||||||
updateSecurityIcon(ui->lblConnectionSecurityStatus->isVisible());
|
updateSecurityIcon(m_lblSecurityStatus->isVisible());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
|
void MainWindow::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
|
||||||
|
|
@ -520,17 +523,17 @@ void MainWindow::setModeClient()
|
||||||
|
|
||||||
void MainWindow::updateSecurityIcon(bool visible)
|
void MainWindow::updateSecurityIcon(bool visible)
|
||||||
{
|
{
|
||||||
ui->lblConnectionSecurityStatus->setVisible(visible);
|
m_lblSecurityStatus->setVisible(visible);
|
||||||
if (!visible)
|
if (!visible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool secureSocket = m_appConfig.tlsEnabled();
|
bool secureSocket = m_appConfig.tlsEnabled();
|
||||||
|
|
||||||
const auto txt = secureSocket ? tr("Encryption Enabled") : tr("Encryption Disabled");
|
const auto txt = secureSocket ? tr("Encryption Enabled") : tr("Encryption Disabled");
|
||||||
ui->lblConnectionSecurityStatus->setToolTip(txt);
|
m_lblSecurityStatus->setToolTip(txt);
|
||||||
|
|
||||||
const auto icon = QIcon::fromTheme(secureSocket ? QIcon::ThemeIcon::SecurityHigh : QIcon::ThemeIcon::SecurityLow);
|
const auto icon = QIcon::fromTheme(secureSocket ? QIcon::ThemeIcon::SecurityHigh : QIcon::ThemeIcon::SecurityLow);
|
||||||
ui->lblConnectionSecurityStatus->setPixmap(icon.pixmap(QSize(32, 32)));
|
m_lblSecurityStatus->setPixmap(icon.pixmap(QSize(32, 32)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::serverConnectionConfigureClient(const QString &clientName)
|
void MainWindow::serverConnectionConfigureClient(const QString &clientName)
|
||||||
|
|
@ -581,7 +584,7 @@ void MainWindow::coreProcessStarting()
|
||||||
|
|
||||||
void MainWindow::setStatus(const QString &status)
|
void MainWindow::setStatus(const QString &status)
|
||||||
{
|
{
|
||||||
ui->lblStatus->setText(status);
|
m_lblStatus->setText(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::createMenuBar()
|
void MainWindow::createMenuBar()
|
||||||
|
|
@ -993,7 +996,7 @@ void MainWindow::showConfigureServer(const QString &message)
|
||||||
void MainWindow::secureSocket(bool secureSocket)
|
void MainWindow::secureSocket(bool secureSocket)
|
||||||
{
|
{
|
||||||
m_secureSocket = secureSocket;
|
m_secureSocket = secureSocket;
|
||||||
updateSecurityIcon(ui->lblConnectionSecurityStatus->isVisible());
|
updateSecurityIcon(m_lblSecurityStatus->isVisible());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateScreenName()
|
void MainWindow::updateScreenName()
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
class QAction;
|
class QAction;
|
||||||
class QMenu;
|
class QMenu;
|
||||||
|
class QLabel;
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
class QGroupBox;
|
class QGroupBox;
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
|
|
@ -202,6 +203,9 @@ private:
|
||||||
QLocalServer *m_guiDupeChecker = nullptr;
|
QLocalServer *m_guiDupeChecker = nullptr;
|
||||||
inline static const auto m_guiSocketName = QStringLiteral("deskflow-gui");
|
inline static const auto m_guiSocketName = QStringLiteral("deskflow-gui");
|
||||||
|
|
||||||
|
QLabel *m_lblSecurityStatus = nullptr;
|
||||||
|
QLabel *m_lblStatus = nullptr;
|
||||||
|
|
||||||
// Window Actions
|
// Window Actions
|
||||||
QAction *m_actionAbout = nullptr;
|
QAction *m_actionAbout = nullptr;
|
||||||
QAction *m_actionClearSettings = nullptr;
|
QAction *m_actionClearSettings = nullptr;
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>883</width>
|
<width>883</width>
|
||||||
<height>690</height>
|
<height>650</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
|
@ -443,10 +443,10 @@
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::Shape::StyledPanel</enum>
|
<enum>QFrame::Shape::NoFrame</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Shadow::Raised</enum>
|
<enum>QFrame::Shadow::Plain</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="_3">
|
<layout class="QVBoxLayout" name="_3">
|
||||||
<item>
|
<item>
|
||||||
|
|
@ -477,6 +477,39 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="spacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnApplySettings">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Apply</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnToggleCore">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Start</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
@ -507,115 +540,9 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layoutActions">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="sizeConstraint">
|
|
||||||
<enum>QLayout::SizeConstraint::SetDefaultConstraint</enum>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="lblConnectionSecurityStatus">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>32</width>
|
|
||||||
<height>32</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>32</width>
|
|
||||||
<height>32</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="lblStatus">
|
|
||||||
<property name="text">
|
|
||||||
<string>Ready</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="spacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Orientation::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="lblNotice">
|
|
||||||
<property name="autoFillBackground">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">lblNotice</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="openExternalLinks">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Orientation::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Policy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="btnApplySettings">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>&Apply</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="btnToggleCore">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>&Start</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QStatusBar" name="statusBar"/>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
|
@ -639,8 +566,6 @@
|
||||||
<tabstop>btnConnect</tabstop>
|
<tabstop>btnConnect</tabstop>
|
||||||
<tabstop>btnToggleLog</tabstop>
|
<tabstop>btnToggleLog</tabstop>
|
||||||
<tabstop>textLog</tabstop>
|
<tabstop>textLog</tabstop>
|
||||||
<tabstop>btnApplySettings</tabstop>
|
|
||||||
<tabstop>btnToggleCore</tabstop>
|
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue