diff --git a/ChangeLog b/ChangeLog index b62958482..0f403a340 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,7 @@ Enhancements: - #6954 Move language selection to advanced section - #6959 Update synergy UI. Setup wizard - #6969 Update synergy UI. Validation for aliases. +- #6973 Update synergy UI. Main window - #6962 | #6965 Add macOS 10.13 builder =========== diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index f26ca7c9c..09d2d9f44 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -10,7 +10,7 @@ file (GLOB LEGACY_GUI_SOURCE_FILES src/*.cpp src/*.h src/validators/* - src/validators/*.h + src/widgets/* ) file (GLOB LEGACY_GUI_UI_FILES src/*.ui) file (GLOB LEGACY_ACTIVATION_FILES src/*Activation* src/*License*) diff --git a/src/gui/src/AppConfig.cpp b/src/gui/src/AppConfig.cpp index a53b1b15a..e0f4fd3a3 100644 --- a/src/gui/src/AppConfig.cpp +++ b/src/gui/src/AppConfig.cpp @@ -533,7 +533,7 @@ bool AppConfig::getUseExternalConfig() const { return m_UseExternalConfig; } -QString AppConfig::getConfigFile() const { +const QString& AppConfig::getConfigFile() const { return m_ConfigFile; } diff --git a/src/gui/src/AppConfig.h b/src/gui/src/AppConfig.h index 3e40330c3..8bee519e0 100644 --- a/src/gui/src/AppConfig.h +++ b/src/gui/src/AppConfig.h @@ -125,7 +125,7 @@ class AppConfig: public QObject, public GUI::Config::ConfigBase bool getServerGroupChecked() const; bool getUseExternalConfig() const; - QString getConfigFile() const; + const QString& getConfigFile() const; bool getUseInternalConfig() const; bool getClientGroupChecked() const; QString getServerHostname() const; diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index 5b486ae5b..e5a62363e 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -57,14 +57,6 @@ #include #endif -#if defined(Q_OS_WIN) -static const char synergyConfigName[] = "synergy.sgc"; -static const QString synergyConfigFilter(QObject::tr("Synergy Configurations (*.sgc);;All files (*.*)")); -#else -static const char synergyConfigName[] = "synergy.conf"; -static const QString synergyConfigFilter(QObject::tr("Synergy Configurations (*.conf);;All files (*.*)")); -#endif - static const char* tlsCheckString = "network encryption protocol: "; static const int debugLogLevel = 1; @@ -127,6 +119,7 @@ MainWindow::MainWindow (AppConfig& appConfig, #endif setupUi(this); + updateAutoConfigWidgets(); createMenuBar(); loadSettings(); @@ -134,7 +127,7 @@ MainWindow::MainWindow (AppConfig& appConfig, m_pWidgetUpdate->hide(); m_VersionChecker.setApp(appPath(appConfig.synergycName())); - + m_pLabelScreenName->setText(appConfig.screenName()); connect(m_AppConfig, SIGNAL(screenNameChanged()), this, SLOT(updateScreenName())); m_pLabelIpAddresses->setText(getIPAddresses()); @@ -161,7 +154,7 @@ MainWindow::MainWindow (AppConfig& appConfig, // hide padlock icon secureSocket(false); - updateLocalFingerprint(); + connect (this, SIGNAL(windowShown()), this, SLOT(on_windowShown()), Qt::QueuedConnection); @@ -206,9 +199,9 @@ MainWindow::MainWindow (AppConfig& appConfig, updateZeroconfService(); addZeroconfServer(m_AppConfig->autoConfigServer()); -#endif updateAutoConfigWidgets(); +#endif } MainWindow::~MainWindow() @@ -305,14 +298,11 @@ void MainWindow::createMenuBar() void MainWindow::loadSettings() { - // the next two must come BEFORE loading groupServerChecked and groupClientChecked or - // disabling and/or enabling the right widgets won't automatically work - m_pRadioExternalConfig->setChecked(appConfig().getUseExternalConfig()); - m_pRadioInternalConfig->setChecked(appConfig().getUseInternalConfig()); + on_m_pRadioGroupServer_clicked(appConfig().getServerGroupChecked()); + on_m_pRadioGroupClient_clicked(appConfig().getClientGroupChecked()); + m_pRadioGroupServer->setChecked(appConfig().getServerGroupChecked()); + m_pRadioGroupClient->setChecked(appConfig().getClientGroupChecked()); - m_pGroupServer->setChecked(appConfig().getServerGroupChecked()); - m_pLineEditConfigFile->setText(appConfig().getConfigFile()); - m_pGroupClient->setChecked(appConfig().getClientGroupChecked()); m_pLineEditHostname->setText(appConfig().getServerHostname()); } @@ -329,11 +319,8 @@ void MainWindow::initConnections() void MainWindow::saveSettings() { // program settings - appConfig().setServerGroupChecked(m_pGroupServer->isChecked()); - appConfig().setClientGroupChecked(m_pGroupClient->isChecked()); - appConfig().setUseExternalConfig(m_pRadioExternalConfig->isChecked()); - appConfig().setUseInternalConfig(m_pRadioInternalConfig->isChecked()); - appConfig().setConfigFile(m_pLineEditConfigFile->text()); + appConfig().setServerGroupChecked(m_pRadioGroupServer->isChecked()); + appConfig().setClientGroupChecked(m_pRadioGroupClient->isChecked()); appConfig().setServerHostname(m_pLineEditHostname->text()); /* Save everything */ @@ -463,6 +450,15 @@ void MainWindow::updateFromLogLine(const QString &line) void MainWindow::checkConnected(const QString& line) { // TODO: implement ipc connection state messages to replace this hack. + if (m_pRadioGroupServer->isChecked()) + { + m_pLabelServerState->updateServerState(line); + } + else + { + m_pLabelClientState->updateClientState(line); + } + if (line.contains("connected to server") || line.contains("accepted client connection")) { @@ -798,37 +794,29 @@ bool MainWindow::clientArgs(QStringList& args, QString& app) QString MainWindow::configFilename() { QString filename; - if (m_pRadioInternalConfig->isChecked()) + if (appConfig().getUseExternalConfig()) { - // TODO: no need to use a temporary file, since we need it to - // be permenant (since it'll be used for Windows services, etc). - QTemporaryFile tempConfigFile; - tempConfigFile.setAutoRemove(false); - - if (!tempConfigFile.open()) - { - QMessageBox::critical(this, tr("Cannot write configuration file"), tr("The temporary configuration file required to start synergy can not be written.")); - return ""; - } - - serverConfig().save(tempConfigFile); - filename = tempConfigFile.fileName(); - - tempConfigFile.close(); + filename = appConfig().getConfigFile(); } else { - if (!QFile::exists(m_pLineEditConfigFile->text())) - { - if (QMessageBox::warning(this, tr("Configuration filename invalid"), - tr("You have not filled in a valid configuration file for the synergy server. " - "Do you want to browse for the configuration file now?"), QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes - || !on_m_pButtonBrowseConfigFile_clicked()) - return ""; - } + // TODO: no need to use a temporary file, since we need it to + // be permenant (since it'll be used for Windows services, etc). + QTemporaryFile tempConfigFile; + tempConfigFile.setAutoRemove(false); - filename = m_pLineEditConfigFile->text(); + if (!tempConfigFile.open()) + { + QMessageBox::critical(this, tr("Cannot write configuration file"), tr("The temporary configuration file required to start synergy can not be written.")); + return ""; + } + + serverConfig().save(tempConfigFile); + filename = tempConfigFile.fileName(); + + tempConfigFile.close(); } + return filename; } @@ -1138,14 +1126,15 @@ void MainWindow::showLicenseNotice(const QString& notice) void MainWindow::updateLocalFingerprint() { - if (m_AppConfig->getCryptoEnabled() && Fingerprint::local().fileExists()) { + if (m_AppConfig->getCryptoEnabled() && + Fingerprint::local().fileExists() && + m_pRadioGroupServer->isChecked()) + { m_pLabelFingerprint->setVisible(true); - m_pLabelLocalFingerprint->setVisible(true); - m_pLabelLocalFingerprint->setText(Fingerprint::local().readFirst()); } - else { + else + { m_pLabelFingerprint->setVisible(false); - m_pLabelLocalFingerprint->setVisible(false); } } @@ -1157,33 +1146,6 @@ MainWindow::licenseManager() const } #endif -void MainWindow::on_m_pGroupClient_toggled(bool on) -{ - m_pGroupServer->setChecked(!on); - - // only call in either client or server toggle, but not both - // since the toggle functions call eachother indirectly. - updateZeroconfService(); -} - -void MainWindow::on_m_pGroupServer_toggled(bool on) -{ - m_pGroupClient->setChecked(!on); -} - -bool MainWindow::on_m_pButtonBrowseConfigFile_clicked() -{ - QString fileName = QFileDialog::getOpenFileName(this, tr("Browse for a synergys config file"), QString(), synergyConfigFilter); - - if (!fileName.isEmpty()) - { - m_pLineEditConfigFile->setText(fileName); - return true; - } - - return false; -} - bool MainWindow::on_m_pActionSave_triggered() { QString fileName = QFileDialog::getSaveFileName(this, tr("Save configuration as...")); @@ -1229,20 +1191,11 @@ void MainWindow::updateZeroconfService() void MainWindow::updateAutoConfigWidgets() { - if (appConfig().autoConfig()) { - m_pLabelAutoDetected->show(); - m_pComboServerList->show(); + m_pLabelServerName->show(); + m_pLineEditHostname->show(); - m_pLabelServerName->hide(); - m_pLineEditHostname->hide(); - } - else { - m_pLabelServerName->show(); - m_pLineEditHostname->show(); - - m_pLabelAutoDetected->hide(); - m_pComboServerList->hide(); - } + m_pLabelAutoDetected->hide(); + m_pComboServerList->hide(); } void MainWindow::on_m_pActionSettings_triggered() @@ -1367,6 +1320,16 @@ void MainWindow::secureSocket(bool secureSocket) } } +void MainWindow::on_m_pSettingsLink_linkActivated(const QString&) +{ + m_pActionSettings->trigger(); +} + +void MainWindow::on_m_pLabelFingerprint_linkActivated(const QString&) +{ + QMessageBox::information(this, "SSL/TLS fingerprint", Fingerprint::local().readFirst()); +} + void MainWindow::on_m_pComboServerList_currentIndexChanged(const QString &server) { appConfig().setAutoConfigServer(server); @@ -1383,3 +1346,45 @@ void MainWindow::updateScreenName() m_pLabelScreenName->setText(appConfig().screenName()); serverConfig().updateServerName(); } + +void MainWindow::on_m_pRadioGroupServer_clicked(bool on) +{ + m_pRadioGroupServer->setChecked(true); + if (on) + { + //show server controls + m_pButtonConfigureServer->show(); + m_pLabelServerState->show(); + updateLocalFingerprint(); + + //hide client controls + m_pRadioGroupClient->setChecked(false); + m_pLabelClientState->hide(); + m_pLabelServerName->hide(); + m_pLineEditHostname->hide(); + m_pButtonConnect->hide(); + } +} + +void MainWindow::on_m_pRadioGroupClient_clicked(bool on) +{ + m_pRadioGroupClient->setChecked(true); + if (on) + { + //show client controls + m_pLabelServerName->show(); + m_pLineEditHostname->show(); + m_pButtonConnect->show(); + + //hide server controls + m_pRadioGroupServer->setChecked(false); + m_pLabelFingerprint->hide(); + m_pButtonConfigureServer->hide(); + m_pLabelServerState->hide(); + } +} + +void MainWindow::on_m_pButtonConnect_clicked() +{ + restartSynergy(); +} diff --git a/src/gui/src/MainWindow.h b/src/gui/src/MainWindow.h index b885be168..dec656ab2 100644 --- a/src/gui/src/MainWindow.h +++ b/src/gui/src/MainWindow.h @@ -105,7 +105,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase public: void setVisible(bool visible); - int synergyType() const { return m_pGroupClient->isChecked() ? synergyClient : synergyServer; } + int synergyType() const { return m_pRadioGroupClient->isChecked() ? synergyClient : synergyServer; } int synergyState() const { return m_SynergyState; } QString hostname() const { return m_pLineEditHostname->text(); } QString configFilename(); @@ -143,9 +143,8 @@ public slots: protected slots: void updateLocalFingerprint(); void updateScreenName(); - void on_m_pGroupClient_toggled(bool on); - void on_m_pGroupServer_toggled(bool on); - bool on_m_pButtonBrowseConfigFile_clicked(); + void on_m_pRadioGroupServer_clicked(bool on); + void on_m_pRadioGroupClient_clicked(bool on); void on_m_pButtonConfigureServer_clicked(); bool on_m_pActionSave_triggered(); void on_m_pActionAbout_triggered(); @@ -244,8 +243,12 @@ private slots: void on_m_pButtonApply_clicked(); void on_windowShown(); + void on_m_pSettingsLink_linkActivated(const QString &link); + void on_m_pLabelFingerprint_linkActivated(const QString& link); void on_m_pComboServerList_currentIndexChanged(const QString &arg1); + void on_m_pButtonConnect_clicked(); + signals: void windowShown(); }; diff --git a/src/gui/src/MainWindowBase.ui b/src/gui/src/MainWindowBase.ui index 0b71dd6b9..f8aebf3a0 100644 --- a/src/gui/src/MainWindowBase.ui +++ b/src/gui/src/MainWindowBase.ui @@ -6,7 +6,7 @@ 0 0 - 600 + 720 797 @@ -18,7 +18,7 @@ - 600 + 720 0 @@ -81,6 +81,9 @@ + + 6 + 2 @@ -91,7 +94,7 @@ 0 - 8 + 2 @@ -130,257 +133,639 @@ - + 0 0 - - - true - + + + 582 + 15 + - - QGroupBox::title { - subcontrol-origin: padding; - left: 7px; -} - + + + 16777215 + 20 + - - Ser&ver (share this computer's mouse and keyboard): - - - true - - - true - - + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + - - - QFormLayout::AllNonFixedFieldsGrow + + + + 135 + 15 + + + + + 135 + 20 + + + + + Arial + true + - - - - IP addresses: - - - - - - - - - - - - - - - - - - - 0 - 0 - - - - SSL Fingerprint: - - - - - - - - - - - - - - - Configure interactively: - - - true + This computers name: - - - - - &Configure Server... - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - + + + + 0 + 0 + + + + + 0 + 15 + + + + + 16777215 + 20 + + + + + Arial + + - Use existing configuration: + + + + Qt::AutoText - - - - - &Configuration file: - - - m_pLineEditConfigFile - - - - - - - false - - - - - - - false - - - &Browse... - - - - + + + + 0 + 15 + + + + + 16777215 + 20 + + + + + Arial + 50 + false + false + + + + + + + <html><head/><body><p style="margin-left: 5px;">(<a href="#"><span style=" text-decoration: none; font-size: 13px; color:#007af4;">Settings</span></a>)</p></body></html> + + + 0 + + - + 0 0 - - - true - + + + 0 + 20 + - - QGroupBox::title { - subcontrol-origin: padding; - left: 7px; -} - - - - &Client (use another computer's mouse and keyboard): - - - true - - - true - - - - QFormLayout::AllNonFixedFieldsGrow + + + 0 - - - - - true - + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 20 + + + + + 190 + 16777215 + - Client name: + This computers IP addresses: - - + + - - - - &Server: - - - m_pLineEditHostname - - - - - + + + + + + + + 0 + 0 + + + + + 0 + 270 + + + + + 16777215 + 270 + + + + + 16 + + + 0 + + + 22 + + + 0 + + + 0 + + + - + 0 0 - 200 - 0 + 340 + 248 - - Hostname or IP address of the server computer. + + + true + + + QGroupBox::title { + subcontrol-origin: padding; + left: 7px; +} + + + + + + + false + + + false + + + + 9 + + + 11 + + + 5 + + + 5 + + + + + + 0 + 0 + + + + + 300 + 30 + + + + + 65535 + 30 + + + + QRadioButton::indicator{ + top: -7px; +} + + + Use this computers keyboard and mouse +(Make this computer the server). + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 40 + + + + + + + + No clients connected + + + 20 + + + + + + + 6 + + + + + + 0 + 0 + + + + + 16777215 + 20 + + + + <html><head/><body><p>TLS/SSL active - <a href="#">view</a></p></body></html> + + + Qt::RichText + + + 20 + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + &Configure server + + + + + + - - + + - + 0 0 - 200 + 340 + 248 + + + + + 0 0 - - - - - - Server: + + + true + + + QGroupBox::title { + subcontrol-origin: padding; + left: 7px; +} + + + + + + + false + + + false + + + + 9 + + + 9 + + + 11 + + + + + + 0 + 0 + + + + + 0 + 30 + + + + + 300 + 30 + + + + QRadioButton::indicator{ + top: -7px; +} + + + Use another computer’s mouse and keyboard +(Make this computer the client). + + + + + + + Qt::Vertical + + + QSizePolicy::Minimum + + + + 20 + 40 + + + + + + + + 19 + + + 10 + + + + + + 0 + 0 + + + + &Server IP address or name: + + + m_pLineEditHostname + + + + + + + + 0 + 0 + + + + + 200 + 0 + + + + Hostname or IP address of the server computer. + + + + + + + Server: + + + + + + + + 0 + 0 + + + + + 200 + 0 + + + + + + + + + + Connected to the server + + + 20 + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 20 + 40 + + + + + + + + 0 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Connect + + + + + + @@ -603,58 +988,22 @@ + + + synergy_widgets::ServerStateLabel + QLabel +
widgets/ServerStateLabel.h
+
+ + synergy_widgets::ClientStateLabel + QLabel +
widgets/ClientStateLabel.h
+
+
- - m_pRadioExternalConfig - toggled(bool) - m_pLineEditConfigFile - setEnabled(bool) - - - 156 - 179 - - - 169 - 209 - - - - - m_pRadioExternalConfig - toggled(bool) - m_pButtonBrowseConfigFile - setEnabled(bool) - - - 353 - 182 - - - 356 - 211 - - - - - m_pRadioInternalConfig - toggled(bool) - m_pButtonConfigureServer - setEnabled(bool) - - - 204 - 244 - - - 212 - 274 - - - m_pButtonToggleStart clicked() diff --git a/src/gui/src/ServerConfig.cpp b/src/gui/src/ServerConfig.cpp index 26d6c8f09..f2b805df7 100644 --- a/src/gui/src/ServerConfig.cpp +++ b/src/gui/src/ServerConfig.cpp @@ -386,6 +386,26 @@ void ServerConfig::updateServerName() } } +const QString& ServerConfig::getConfigFile() const +{ + return m_pAppConfig->getConfigFile(); +} + +bool ServerConfig::getUseExternalConfig() const +{ + return m_pAppConfig->getUseExternalConfig(); +} + +void ServerConfig::setConfigFile(const QString& configFile) +{ + m_pAppConfig->setConfigFile(configFile); +} + +void ServerConfig::setUseExternalConfig(bool useExternalConfig) +{ + m_pAppConfig->setUseExternalConfig(useExternalConfig); +} + bool ServerConfig::findScreenName(const QString& name, int& index) { bool found = false; diff --git a/src/gui/src/ServerConfig.h b/src/gui/src/ServerConfig.h index f2f27b4b6..d0f4e8463 100644 --- a/src/gui/src/ServerConfig.h +++ b/src/gui/src/ServerConfig.h @@ -81,6 +81,8 @@ class ServerConfig : public BaseConfig, public GUI::Config::ConfigBase int autoAddScreen(const QString name); const QString& getServerName() const; void updateServerName(); + const QString& getConfigFile() const; + bool getUseExternalConfig() const; protected: QSettings& settings(); @@ -104,6 +106,8 @@ class ServerConfig : public BaseConfig, public GUI::Config::ConfigBase void setEnableDragAndDrop(bool on) { m_EnableDragAndDrop = on; } void setDisableLockToScreen(bool on) { m_DisableLockToScreen = on; } void setClipboardSharing(bool on) { m_ClipboardSharing = on; } + void setConfigFile(const QString& configFile); + void setUseExternalConfig(bool useExternalConfig); size_t setClipboardSharingSize(size_t size); QList& switchCorners() { return m_SwitchCorners; } HotkeyList& hotkeys() { return m_Hotkeys; } diff --git a/src/gui/src/ServerConfigDialog.cpp b/src/gui/src/ServerConfigDialog.cpp index 8ca5c058b..7b921f5fb 100644 --- a/src/gui/src/ServerConfigDialog.cpp +++ b/src/gui/src/ServerConfigDialog.cpp @@ -24,6 +24,7 @@ #include #include #include +#include ServerConfigDialog::ServerConfigDialog(QWidget* parent, ServerConfig& config) : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint), @@ -35,6 +36,8 @@ ServerConfigDialog::ServerConfigDialog(QWidget* parent, ServerConfig& config) : { setupUi(this); + m_pEditConfigFile->setText(serverConfig().getConfigFile()); + m_pCheckBoxUseExternalConfig->setChecked(serverConfig().getUseExternalConfig()); m_pCheckBoxHeartbeat->setChecked(serverConfig().hasHeartbeat()); m_pSpinBoxHeartbeat->setValue(serverConfig().heartbeat()); @@ -94,6 +97,25 @@ void ServerConfigDialog::showEvent(QShowEvent* event) void ServerConfigDialog::accept() { + if (m_pCheckBoxUseExternalConfig->isChecked() && + !QFile::exists(m_pEditConfigFile->text())) + { + auto title = tr("Configuration filename invalid"); + auto description = tr("You have not filled in a valid configuration file for the synergy server. " + "Do you want to browse for the configuration file now?"); + + auto selectedButton = QMessageBox::warning(this, title, description, QMessageBox::Yes | QMessageBox::No); + + if (selectedButton != QMessageBox::Yes || + !on_m_pButtonBrowseConfigFile_clicked()) + { + return; + } + } + + serverConfig().setConfigFile(m_pEditConfigFile->text()); + serverConfig().setUseExternalConfig(m_pCheckBoxUseExternalConfig->isChecked()); + serverConfig().haveHeartbeat(m_pCheckBoxHeartbeat->isChecked()); serverConfig().setHeartbeat(m_pSpinBoxHeartbeat->value()); @@ -239,3 +261,33 @@ void ServerConfigDialog::on_m_pListActions_itemSelectionChanged() m_pButtonEditAction->setEnabled(!m_pListActions->selectedItems().isEmpty()); m_pButtonRemoveAction->setEnabled(!m_pListActions->selectedItems().isEmpty()); } + +void ServerConfigDialog::on_m_pCheckBoxUseExternalConfig_toggled(bool checked) +{ + m_pLabelConfigFile->setEnabled(checked); + m_pEditConfigFile->setEnabled(checked); + m_pButtonBrowseConfigFile->setEnabled(checked); + + m_pTabWidget->setTabEnabled(0, !checked); + m_pTabWidget->setTabEnabled(1, !checked); + m_pTabWidget->setTabEnabled(2, !checked); +} + +bool ServerConfigDialog::on_m_pButtonBrowseConfigFile_clicked() +{ +#if defined(Q_OS_WIN) + const QString synergyConfigFilter(QObject::tr("Synergy Configurations (*.sgc);;All files (*.*)")); +#else + const QString synergyConfigFilter(QObject::tr("Synergy Configurations (*.conf);;All files (*.*)")); +#endif + + QString fileName = QFileDialog::getOpenFileName(this, tr("Browse for a synergys config file"), QString(), synergyConfigFilter); + + if (!fileName.isEmpty()) + { + m_pEditConfigFile->setText(fileName); + return true; + } + + return false; +} diff --git a/src/gui/src/ServerConfigDialog.h b/src/gui/src/ServerConfigDialog.h index 974dc0384..3d06187fd 100644 --- a/src/gui/src/ServerConfigDialog.h +++ b/src/gui/src/ServerConfigDialog.h @@ -49,8 +49,9 @@ class ServerConfigDialog : public QDialog, public Ui::ServerConfigDialogBase void on_m_pListActions_itemSelectionChanged(); void on_m_pButtonEditAction_clicked(); void on_m_pButtonRemoveAction_clicked(); - void on_m_pCheckBoxEnableClipboard_stateChanged(int state); + void on_m_pCheckBoxUseExternalConfig_toggled(bool checked = false); + bool on_m_pButtonBrowseConfigFile_clicked(); protected: ServerConfig& serverConfig() { return m_ServerConfig; } diff --git a/src/gui/src/ServerConfigDialogBase.ui b/src/gui/src/ServerConfigDialogBase.ui index 50ba35583..186a77782 100644 --- a/src/gui/src/ServerConfigDialogBase.ui +++ b/src/gui/src/ServerConfigDialogBase.ui @@ -681,6 +681,267 @@ Double click on a screen to edit its settings.
+ + + + 0 + 0 + + + + Advance config + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + <html><head/><body><p style="text-align: center; font-family: Arial; font-size: 18px; line-height: 25px;">Config override</p></body></html> + + + Qt::RichText + + + + + + + Qt::Vertical + + + QSizePolicy::Minimum + + + + 20 + 5 + + + + + + + + <html><head/><body><p style="text-align: center; font-size: 13px; font-family: Arial; line-hegiht: 18px;">If you have a config file and want to override all setttings with this file.</p></body></html> + + + Qt::RichText + + + + + + + Qt::Vertical + + + QSizePolicy::Maximum + + + + 20 + 30 + + + + + + + + 0 + + + 0 + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 300 + 0 + + + + Use configuration file + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + + + 95 + + + 0 + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + false + + + + 0 + 0 + + + + + 96 + 0 + + + + Config file path + + + + + + + false + + + + 0 + 0 + + + + + 180 + 0 + + + + + + + + false + + + + 0 + 0 + + + + + 40 + 0 + + + + &Browse... + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + +
diff --git a/src/gui/src/SetupWizardBase.ui b/src/gui/src/SetupWizardBase.ui index dc98f2263..2a69d792d 100644 --- a/src/gui/src/SetupWizardBase.ui +++ b/src/gui/src/SetupWizardBase.ui @@ -153,7 +153,7 @@ 193 380 311 - 81 + 91 diff --git a/src/gui/src/widgets/ClientStateLabel.cpp b/src/gui/src/widgets/ClientStateLabel.cpp new file mode 100644 index 000000000..3669e6aa4 --- /dev/null +++ b/src/gui/src/widgets/ClientStateLabel.cpp @@ -0,0 +1,41 @@ +/* + * synergy -- mouse and keyboard sharing utility + * Copyright (C) 2012-2021 Symless Ltd. + * Copyright (C) 2008 Volker Lanz (vl@fidra.de) + * + * This package is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * found in the file LICENSE that should have accompanied this file. + * + * This package is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include "ClientStateLabel.h" + +namespace synergy_widgets +{ + +ClientStateLabel::ClientStateLabel(QWidget* parent) : + QLabel(parent) +{ + hide(); +} + +void ClientStateLabel::updateClientState(const QString& line) +{ + if (line.contains("connected to server")) + { + show(); + } + else if (line.contains("disconnected from server") || line.contains("process exited")) + { + hide(); + } +} + +} diff --git a/src/gui/src/widgets/ClientStateLabel.h b/src/gui/src/widgets/ClientStateLabel.h new file mode 100644 index 000000000..373cb426d --- /dev/null +++ b/src/gui/src/widgets/ClientStateLabel.h @@ -0,0 +1,36 @@ +/* + * synergy -- mouse and keyboard sharing utility + * Copyright (C) 2012-2021 Symless Ltd. + * Copyright (C) 2008 Volker Lanz (vl@fidra.de) + * + * This package is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * found in the file LICENSE that should have accompanied this file. + * + * This package is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef CLIENTSTATELABEL_H +#define CLIENTSTATELABEL_H + +#include + +namespace synergy_widgets +{ + +class ClientStateLabel : public QLabel +{ +public: + explicit ClientStateLabel(QWidget* parent = nullptr); + void updateClientState(const QString& line); +}; + +} // namespace synergy_widgets + +#endif // CLIENTSTATELABEL_H diff --git a/src/gui/src/widgets/ServerStateLabel.cpp b/src/gui/src/widgets/ServerStateLabel.cpp new file mode 100644 index 000000000..26f39929d --- /dev/null +++ b/src/gui/src/widgets/ServerStateLabel.cpp @@ -0,0 +1,59 @@ +/* + * synergy -- mouse and keyboard sharing utility + * Copyright (C) 2012-2021 Symless Ltd. + * Copyright (C) 2008 Volker Lanz (vl@fidra.de) + * + * This package is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * found in the file LICENSE that should have accompanied this file. + * + * This package is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "ServerStateLabel.h" + +namespace synergy_widgets +{ + +ServerStateLabel::ServerStateLabel(QWidget* parent) : + QLabel(parent) +{ +} + +void ServerStateLabel::updateServerState(const QString& line) +{ + if (line.contains("process exited")) + { + m_clientsCounter = 0; + } + else if (line.contains("has connected")) + { + ++m_clientsCounter; + } + else if (line.contains("has disconnected") && m_clientsCounter) + { + --m_clientsCounter; + } + + updateState(); +} + +void ServerStateLabel::updateState() +{ + if (m_clientsCounter) + { + hide(); + } + else + { + show(); + } +} + +} //namespace synergy_widgets diff --git a/src/gui/src/widgets/ServerStateLabel.h b/src/gui/src/widgets/ServerStateLabel.h new file mode 100644 index 000000000..49ce40c4d --- /dev/null +++ b/src/gui/src/widgets/ServerStateLabel.h @@ -0,0 +1,41 @@ +/* + * synergy -- mouse and keyboard sharing utility + * Copyright (C) 2012-2021 Symless Ltd. + * Copyright (C) 2008 Volker Lanz (vl@fidra.de) + * + * This package is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * found in the file LICENSE that should have accompanied this file. + * + * This package is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef SERVERSTATELABEL_H +#define SERVERSTATELABEL_H + +#include + +namespace synergy_widgets +{ + +class ServerStateLabel : public QLabel +{ +public: + explicit ServerStateLabel(QWidget* parent = nullptr); + void updateServerState(const QString& line); + +private: + unsigned int m_clientsCounter = 0; + + void updateState(); +}; + +} //namespace synergy_widgets + +#endif // SERVERSTATELABEL_H