refactor: mainwindow use status bar for status items
This commit is contained in:
@ -69,6 +69,8 @@ MainWindow::MainWindow(ConfigScopes &configScopes, AppConfig &appConfig)
|
||||
m_tlsUtility(appConfig),
|
||||
m_trayIcon{new QSystemTrayIcon(this)},
|
||||
m_guiDupeChecker{new QLocalServer(this)},
|
||||
m_lblSecurityStatus{new QLabel(this)},
|
||||
m_lblStatus{new QLabel(this)},
|
||||
m_actionAbout{new QAction(this)},
|
||||
m_actionClearSettings{new QAction(tr("Clear settings"), 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);
|
||||
#endif
|
||||
|
||||
// Hide the security label
|
||||
ui->lblConnectionSecurityStatus->setVisible(false);
|
||||
|
||||
ui->btnToggleLog->setStyleSheet(QStringLiteral("background:rgba(0,0,0,0);"));
|
||||
|
||||
// Setup the Instance Checking
|
||||
@ -219,9 +218,6 @@ void MainWindow::setupControls()
|
||||
ui->lblUpdate->setStyleSheet(kStyleNoticeLabel);
|
||||
ui->lblUpdate->hide();
|
||||
|
||||
ui->lblNotice->setStyleSheet(kStyleNoticeLabel);
|
||||
ui->lblNotice->hide();
|
||||
|
||||
ui->lblIpAddresses->setText(tr("This computer's IP addresses: %1").arg(getIPAddresses()));
|
||||
|
||||
if (m_appConfig.lastVersion() != kVersion) {
|
||||
@ -234,6 +230,13 @@ void MainWindow::setupControls()
|
||||
ui->rbModeClient->setAttribute(Qt::WA_MacShowFocusRect, 0);
|
||||
|
||||
#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())) {
|
||||
m_tlsUtility.generateCertificate();
|
||||
}
|
||||
updateSecurityIcon(ui->lblConnectionSecurityStatus->isVisible());
|
||||
updateSecurityIcon(m_lblSecurityStatus->isVisible());
|
||||
}
|
||||
|
||||
void MainWindow::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
|
||||
@ -520,17 +523,17 @@ void MainWindow::setModeClient()
|
||||
|
||||
void MainWindow::updateSecurityIcon(bool visible)
|
||||
{
|
||||
ui->lblConnectionSecurityStatus->setVisible(visible);
|
||||
m_lblSecurityStatus->setVisible(visible);
|
||||
if (!visible)
|
||||
return;
|
||||
|
||||
bool secureSocket = m_appConfig.tlsEnabled();
|
||||
|
||||
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);
|
||||
ui->lblConnectionSecurityStatus->setPixmap(icon.pixmap(QSize(32, 32)));
|
||||
m_lblSecurityStatus->setPixmap(icon.pixmap(QSize(32, 32)));
|
||||
}
|
||||
|
||||
void MainWindow::serverConnectionConfigureClient(const QString &clientName)
|
||||
@ -581,7 +584,7 @@ void MainWindow::coreProcessStarting()
|
||||
|
||||
void MainWindow::setStatus(const QString &status)
|
||||
{
|
||||
ui->lblStatus->setText(status);
|
||||
m_lblStatus->setText(status);
|
||||
}
|
||||
|
||||
void MainWindow::createMenuBar()
|
||||
@ -993,7 +996,7 @@ void MainWindow::showConfigureServer(const QString &message)
|
||||
void MainWindow::secureSocket(bool secureSocket)
|
||||
{
|
||||
m_secureSocket = secureSocket;
|
||||
updateSecurityIcon(ui->lblConnectionSecurityStatus->isVisible());
|
||||
updateSecurityIcon(m_lblSecurityStatus->isVisible());
|
||||
}
|
||||
|
||||
void MainWindow::updateScreenName()
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
|
||||
class QAction;
|
||||
class QMenu;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QGroupBox;
|
||||
class QPushButton;
|
||||
@ -202,6 +203,9 @@ private:
|
||||
QLocalServer *m_guiDupeChecker = nullptr;
|
||||
inline static const auto m_guiSocketName = QStringLiteral("deskflow-gui");
|
||||
|
||||
QLabel *m_lblSecurityStatus = nullptr;
|
||||
QLabel *m_lblStatus = nullptr;
|
||||
|
||||
// Window Actions
|
||||
QAction *m_actionAbout = nullptr;
|
||||
QAction *m_actionClearSettings = nullptr;
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>883</width>
|
||||
<height>690</height>
|
||||
<height>650</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -443,10 +443,10 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Shape::StyledPanel</enum>
|
||||
<enum>QFrame::Shape::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Shadow::Raised</enum>
|
||||
<enum>QFrame::Shadow::Plain</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="_3">
|
||||
<item>
|
||||
@ -477,6 +477,39 @@
|
||||
</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="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>
|
||||
<item>
|
||||
@ -507,115 +540,9 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</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>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusBar"/>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
@ -639,8 +566,6 @@
|
||||
<tabstop>btnConnect</tabstop>
|
||||
<tabstop>btnToggleLog</tabstop>
|
||||
<tabstop>textLog</tabstop>
|
||||
<tabstop>btnApplySettings</tabstop>
|
||||
<tabstop>btnToggleCore</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
Reference in New Issue
Block a user