Merge branch 'master' into SYNERGY-799-Server-configuration-main-window

This commit is contained in:
Serhii Hadzhilov 2021-04-13 19:04:58 +03:00
commit 09947fb778
18 changed files with 1213 additions and 338 deletions

View file

@ -40,6 +40,7 @@ jobs:
-DCMAKE_CONFIGURATION_TYPES=Release .. -DCMAKE_CONFIGURATION_TYPES=Release ..
. ./version . ./version
make -j make -j
make install/strip
- name: Version Info - name: Version Info
id: version id: version

View file

@ -6,11 +6,13 @@ Bug fixes:
- #6968 System loses synchronisation between settings and configuration - #6968 System loses synchronisation between settings and configuration
- #6972 Fix SonarCloud security hotspots - #6972 Fix SonarCloud security hotspots
- #6971 Fix vulnerabilities from SonarCloud - #6971 Fix vulnerabilities from SonarCloud
- #6974 Fix macOS 10.13 application filess
Enhancements: Enhancements:
- #6954 Move language selection to advanced section - #6954 Move language selection to advanced section
- #6959 Update synergy UI. Setup wizard - #6959 Update synergy UI. Setup wizard
- #6969 Update synergy UI. Validation for aliases. - #6969 Update synergy UI. Validation for aliases.
- #6973 Update synergy UI. Main window
- #6962 | #6965 Add macOS 10.13 builder - #6962 | #6965 Add macOS 10.13 builder
=========== ===========

View file

@ -10,7 +10,7 @@ file (GLOB LEGACY_GUI_SOURCE_FILES
src/*.cpp src/*.cpp
src/*.h src/*.h
src/validators/* src/validators/*
src/validators/*.h src/widgets/*
) )
file (GLOB LEGACY_GUI_UI_FILES src/*.ui) file (GLOB LEGACY_GUI_UI_FILES src/*.ui)
file (GLOB LEGACY_ACTIVATION_FILES src/*Activation* src/*License*) file (GLOB LEGACY_ACTIVATION_FILES src/*Activation* src/*License*)

View file

@ -533,7 +533,7 @@ bool AppConfig::getUseExternalConfig() const {
return m_UseExternalConfig; return m_UseExternalConfig;
} }
QString AppConfig::getConfigFile() const { const QString& AppConfig::getConfigFile() const {
return m_ConfigFile; return m_ConfigFile;
} }

View file

@ -125,7 +125,7 @@ class AppConfig: public QObject, public GUI::Config::ConfigBase
bool getServerGroupChecked() const; bool getServerGroupChecked() const;
bool getUseExternalConfig() const; bool getUseExternalConfig() const;
QString getConfigFile() const; const QString& getConfigFile() const;
bool getUseInternalConfig() const; bool getUseInternalConfig() const;
bool getClientGroupChecked() const; bool getClientGroupChecked() const;
QString getServerHostname() const; QString getServerHostname() const;

View file

@ -57,14 +57,6 @@
#include <ApplicationServices/ApplicationServices.h> #include <ApplicationServices/ApplicationServices.h>
#endif #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 char* tlsCheckString = "network encryption protocol: ";
static const int debugLogLevel = 1; static const int debugLogLevel = 1;
@ -127,6 +119,7 @@ MainWindow::MainWindow (AppConfig& appConfig,
#endif #endif
setupUi(this); setupUi(this);
updateAutoConfigWidgets();
createMenuBar(); createMenuBar();
loadSettings(); loadSettings();
@ -134,7 +127,7 @@ MainWindow::MainWindow (AppConfig& appConfig,
m_pWidgetUpdate->hide(); m_pWidgetUpdate->hide();
m_VersionChecker.setApp(appPath(appConfig.synergycName())); m_VersionChecker.setApp(appPath(appConfig.synergycName()));
m_pLabelScreenName->setText(appConfig.screenName()); m_pLabelScreenName->setText(appConfig.screenName());
connect(m_AppConfig, SIGNAL(screenNameChanged()), this, SLOT(updateScreenName())); connect(m_AppConfig, SIGNAL(screenNameChanged()), this, SLOT(updateScreenName()));
m_pLabelIpAddresses->setText(getIPAddresses()); m_pLabelIpAddresses->setText(getIPAddresses());
@ -161,7 +154,7 @@ MainWindow::MainWindow (AppConfig& appConfig,
// hide padlock icon // hide padlock icon
secureSocket(false); secureSocket(false);
updateLocalFingerprint();
connect (this, SIGNAL(windowShown()), connect (this, SIGNAL(windowShown()),
this, SLOT(on_windowShown()), Qt::QueuedConnection); this, SLOT(on_windowShown()), Qt::QueuedConnection);
@ -206,9 +199,9 @@ MainWindow::MainWindow (AppConfig& appConfig,
updateZeroconfService(); updateZeroconfService();
addZeroconfServer(m_AppConfig->autoConfigServer()); addZeroconfServer(m_AppConfig->autoConfigServer());
#endif
updateAutoConfigWidgets(); updateAutoConfigWidgets();
#endif
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
@ -305,14 +298,11 @@ void MainWindow::createMenuBar()
void MainWindow::loadSettings() void MainWindow::loadSettings()
{ {
// the next two must come BEFORE loading groupServerChecked and groupClientChecked or on_m_pRadioGroupServer_clicked(appConfig().getServerGroupChecked());
// disabling and/or enabling the right widgets won't automatically work on_m_pRadioGroupClient_clicked(appConfig().getClientGroupChecked());
m_pRadioExternalConfig->setChecked(appConfig().getUseExternalConfig()); m_pRadioGroupServer->setChecked(appConfig().getServerGroupChecked());
m_pRadioInternalConfig->setChecked(appConfig().getUseInternalConfig()); 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()); m_pLineEditHostname->setText(appConfig().getServerHostname());
} }
@ -329,11 +319,8 @@ void MainWindow::initConnections()
void MainWindow::saveSettings() void MainWindow::saveSettings()
{ {
// program settings // program settings
appConfig().setServerGroupChecked(m_pGroupServer->isChecked()); appConfig().setServerGroupChecked(m_pRadioGroupServer->isChecked());
appConfig().setClientGroupChecked(m_pGroupClient->isChecked()); appConfig().setClientGroupChecked(m_pRadioGroupClient->isChecked());
appConfig().setUseExternalConfig(m_pRadioExternalConfig->isChecked());
appConfig().setUseInternalConfig(m_pRadioInternalConfig->isChecked());
appConfig().setConfigFile(m_pLineEditConfigFile->text());
appConfig().setServerHostname(m_pLineEditHostname->text()); appConfig().setServerHostname(m_pLineEditHostname->text());
/* Save everything */ /* Save everything */
@ -463,6 +450,15 @@ void MainWindow::updateFromLogLine(const QString &line)
void MainWindow::checkConnected(const QString& line) void MainWindow::checkConnected(const QString& line)
{ {
// TODO: implement ipc connection state messages to replace this hack. // 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") || if (line.contains("connected to server") ||
line.contains("accepted client connection")) line.contains("accepted client connection"))
{ {
@ -798,37 +794,29 @@ bool MainWindow::clientArgs(QStringList& args, QString& app)
QString MainWindow::configFilename() QString MainWindow::configFilename()
{ {
QString filename; QString filename;
if (m_pRadioInternalConfig->isChecked()) if (appConfig().getUseExternalConfig())
{ {
// TODO: no need to use a temporary file, since we need it to filename = appConfig().getConfigFile();
// 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();
} }
else else
{ {
if (!QFile::exists(m_pLineEditConfigFile->text())) // TODO: no need to use a temporary file, since we need it to
{ // be permenant (since it'll be used for Windows services, etc).
if (QMessageBox::warning(this, tr("Configuration filename invalid"), QTemporaryFile tempConfigFile;
tr("You have not filled in a valid configuration file for the synergy server. " tempConfigFile.setAutoRemove(false);
"Do you want to browse for the configuration file now?"), QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes
|| !on_m_pButtonBrowseConfigFile_clicked())
return "";
}
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; return filename;
} }
@ -1138,14 +1126,15 @@ void MainWindow::showLicenseNotice(const QString& notice)
void MainWindow::updateLocalFingerprint() 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_pLabelFingerprint->setVisible(true);
m_pLabelLocalFingerprint->setVisible(true);
m_pLabelLocalFingerprint->setText(Fingerprint::local().readFirst());
} }
else { else
{
m_pLabelFingerprint->setVisible(false); m_pLabelFingerprint->setVisible(false);
m_pLabelLocalFingerprint->setVisible(false);
} }
} }
@ -1157,33 +1146,6 @@ MainWindow::licenseManager() const
} }
#endif #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() bool MainWindow::on_m_pActionSave_triggered()
{ {
QString fileName = QFileDialog::getSaveFileName(this, tr("Save configuration as...")); QString fileName = QFileDialog::getSaveFileName(this, tr("Save configuration as..."));
@ -1229,20 +1191,11 @@ void MainWindow::updateZeroconfService()
void MainWindow::updateAutoConfigWidgets() void MainWindow::updateAutoConfigWidgets()
{ {
if (appConfig().autoConfig()) { m_pLabelServerName->show();
m_pLabelAutoDetected->show(); m_pLineEditHostname->show();
m_pComboServerList->show();
m_pLabelServerName->hide(); m_pLabelAutoDetected->hide();
m_pLineEditHostname->hide(); m_pComboServerList->hide();
}
else {
m_pLabelServerName->show();
m_pLineEditHostname->show();
m_pLabelAutoDetected->hide();
m_pComboServerList->hide();
}
} }
void MainWindow::on_m_pActionSettings_triggered() 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) void MainWindow::on_m_pComboServerList_currentIndexChanged(const QString &server)
{ {
appConfig().setAutoConfigServer(server); appConfig().setAutoConfigServer(server);
@ -1383,3 +1346,45 @@ void MainWindow::updateScreenName()
m_pLabelScreenName->setText(appConfig().screenName()); m_pLabelScreenName->setText(appConfig().screenName());
serverConfig().updateServerName(); 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();
}

View file

@ -105,7 +105,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
public: public:
void setVisible(bool visible); 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; } int synergyState() const { return m_SynergyState; }
QString hostname() const { return m_pLineEditHostname->text(); } QString hostname() const { return m_pLineEditHostname->text(); }
QString configFilename(); QString configFilename();
@ -143,9 +143,8 @@ public slots:
protected slots: protected slots:
void updateLocalFingerprint(); void updateLocalFingerprint();
void updateScreenName(); void updateScreenName();
void on_m_pGroupClient_toggled(bool on); void on_m_pRadioGroupServer_clicked(bool on);
void on_m_pGroupServer_toggled(bool on); void on_m_pRadioGroupClient_clicked(bool on);
bool on_m_pButtonBrowseConfigFile_clicked();
void on_m_pButtonConfigureServer_clicked(); void on_m_pButtonConfigureServer_clicked();
bool on_m_pActionSave_triggered(); bool on_m_pActionSave_triggered();
void on_m_pActionAbout_triggered(); void on_m_pActionAbout_triggered();
@ -244,8 +243,12 @@ private slots:
void on_m_pButtonApply_clicked(); void on_m_pButtonApply_clicked();
void on_windowShown(); 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_pComboServerList_currentIndexChanged(const QString &arg1);
void on_m_pButtonConnect_clicked();
signals: signals:
void windowShown(); void windowShown();
}; };

View file

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>600</width> <width>720</width>
<height>797</height> <height>797</height>
</rect> </rect>
</property> </property>
@ -18,7 +18,7 @@
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>600</width> <width>720</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
@ -81,6 +81,9 @@
<item> <item>
<widget class="QWidget" name="m_pWidgetUpdate" native="true"> <widget class="QWidget" name="m_pWidgetUpdate" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin"> <property name="leftMargin">
<number>2</number> <number>2</number>
</property> </property>
@ -91,7 +94,7 @@
<number>0</number> <number>0</number>
</property> </property>
<property name="bottomMargin"> <property name="bottomMargin">
<number>8</number> <number>2</number>
</property> </property>
<item> <item>
<widget class="QLabel" name="m_pIconUpdate"> <widget class="QLabel" name="m_pIconUpdate">
@ -130,257 +133,639 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="m_pGroupServer"> <widget class="QWidget" name="m_pWidgetComputerName" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="font"> <property name="minimumSize">
<font> <size>
<kerning>true</kerning> <width>582</width>
</font> <height>15</height>
</size>
</property> </property>
<property name="styleSheet"> <property name="maximumSize">
<string notr="true">QGroupBox::title { <size>
subcontrol-origin: padding; <width>16777215</width>
left: 7px; <height>20</height>
} </size>
</string>
</property> </property>
<property name="title"> <layout class="QHBoxLayout" name="horizontalLayout_7">
<string>Ser&amp;ver (share this computer's mouse and keyboard):</string> <property name="spacing">
</property> <number>0</number>
<property name="checkable"> </property>
<bool>true</bool> <property name="leftMargin">
</property> <number>0</number>
<property name="checked"> </property>
<bool>true</bool> <property name="topMargin">
</property> <number>0</number>
<layout class="QVBoxLayout"> </property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item> <item>
<layout class="QFormLayout" name="formLayout"> <widget class="QLabel" name="m_pLabelComputerName">
<property name="fieldGrowthPolicy"> <property name="minimumSize">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum> <size>
<width>135</width>
<height>15</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>135</width>
<height>20</height>
</size>
</property>
<property name="font">
<font>
<family>Arial</family>
<kerning>true</kerning>
</font>
</property> </property>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>IP addresses:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="m_pLabelIpAddresses">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="m_pLabelFingerprint">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>SSL Fingerprint:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_pLabelLocalFingerprint">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QRadioButton" name="m_pRadioInternalConfig">
<property name="text"> <property name="text">
<string>Configure interactively:</string> <string>This computers name:</string>
</property>
<property name="checked">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <widget class="QLabel" name="m_pLabelScreenName">
<item> <property name="sizePolicy">
<widget class="QPushButton" name="m_pButtonConfigureServer"> <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<property name="text"> <horstretch>0</horstretch>
<string>&amp;Configure Server...</string> <verstretch>0</verstretch>
</property> </sizepolicy>
</widget> </property>
</item> <property name="minimumSize">
<item> <size>
<spacer> <width>0</width>
<property name="orientation"> <height>15</height>
<enum>Qt::Horizontal</enum> </size>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="maximumSize">
<size> <size>
<width>40</width> <width>16777215</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>
</spacer> <property name="font">
</item> <font>
</layout> <family>Arial</family>
</item> </font>
<item> </property>
<widget class="QRadioButton" name="m_pRadioExternalConfig">
<property name="text"> <property name="text">
<string>Use existing configuration:</string> <string notr="true"/>
</property>
<property name="textFormat">
<enum>Qt::AutoText</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout"> <widget class="QLabel" name="m_pSettingsLink">
<item> <property name="minimumSize">
<widget class="QLabel" name="m_pLabelConfigurationFile"> <size>
<property name="text"> <width>0</width>
<string>&amp;Configuration file:</string> <height>15</height>
</property> </size>
<property name="buddy"> </property>
<cstring>m_pLineEditConfigFile</cstring> <property name="maximumSize">
</property> <size>
</widget> <width>16777215</width>
</item> <height>20</height>
<item> </size>
<widget class="QLineEdit" name="m_pLineEditConfigFile"> </property>
<property name="enabled"> <property name="font">
<bool>false</bool> <font>
</property> <family>Arial</family>
</widget> <weight>50</weight>
</item> <italic>false</italic>
<item> <bold>false</bold>
<widget class="QPushButton" name="m_pButtonBrowseConfigFile"> </font>
<property name="enabled"> </property>
<bool>false</bool> <property name="styleSheet">
</property> <string notr="true"/>
<property name="text"> </property>
<string>&amp;Browse...</string> <property name="text">
</property> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p style=&quot;margin-left: 5px;&quot;&gt;(&lt;a href=&quot;#&quot;&gt;&lt;span style=&quot; text-decoration: none; font-size: 13px; color:#007af4;&quot;&gt;Settings&lt;/span&gt;&lt;/a&gt;)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</widget> </property>
</item> <property name="margin">
</layout> <number>0</number>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="m_pGroupClient"> <widget class="QWidget" name="m_pWidgetIPAddress" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="font"> <property name="minimumSize">
<font> <size>
<kerning>true</kerning> <width>0</width>
</font> <height>20</height>
</size>
</property> </property>
<property name="styleSheet"> <layout class="QHBoxLayout" name="horizontalLayout_6">
<string notr="true">QGroupBox::title { <property name="spacing">
subcontrol-origin: padding; <number>0</number>
left: 7px;
}
</string>
</property>
<property name="title">
<string>&amp;Client (use another computer's mouse and keyboard):</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<layout class="QFormLayout" name="formLayout_3">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property> </property>
<item row="0" column="0"> <property name="leftMargin">
<widget class="QLabel" name="m_pLabelComputerName"> <number>0</number>
<property name="font"> </property>
<font> <property name="topMargin">
<kerning>true</kerning> <number>0</number>
</font> </property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>190</width>
<height>16777215</height>
</size>
</property> </property>
<property name="text"> <property name="text">
<string>Client name:</string> <string>This computers IP addresses:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item>
<widget class="QLabel" name="m_pLabelScreenName"> <widget class="QLabel" name="m_pLabelIpAddresses">
<property name="text"> <property name="text">
<string notr="true"/> <string notr="true"/>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> </layout>
<widget class="QLabel" name="m_pLabelServerName"> </widget>
<property name="text"> </item>
<string>&amp;Server:</string> <item>
</property> <widget class="QWidget" name="m_pMainWidgets" native="true">
<property name="buddy"> <property name="sizePolicy">
<cstring>m_pLineEditHostname</cstring> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
</property> <horstretch>0</horstretch>
</widget> <verstretch>0</verstretch>
</item> </sizepolicy>
<item row="2" column="1"> </property>
<widget class="QLineEdit" name="m_pLineEditHostname"> <property name="minimumSize">
<size>
<width>0</width>
<height>270</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>270</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<property name="spacing">
<number>16</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>22</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="m_pGroupServer">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>200</width> <width>340</width>
<height>0</height> <height>248</height>
</size> </size>
</property> </property>
<property name="toolTip"> <property name="font">
<string>Hostname or IP address of the server computer.</string> <font>
<kerning>true</kerning>
</font>
</property> </property>
<property name="styleSheet">
<string notr="true">QGroupBox::title {
subcontrol-origin: padding;
left: 7px;
}
</string>
</property>
<property name="title">
<string/>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="ServerLayout">
<property name="spacing">
<number>9</number>
</property>
<property name="topMargin">
<number>11</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<item>
<widget class="QRadioButton" name="m_pRadioGroupServer">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>65535</width>
<height>30</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QRadioButton::indicator{
top: -7px;
}</string>
</property>
<property name="text">
<string>Use this computers keyboard and mouse
(Make this computer the server).</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="synergy_widgets::ServerStateLabel" name="m_pLabelServerState">
<property name="text">
<string>No clients connected</string>
</property>
<property name="indent">
<number>20</number>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QLabel" name="m_pLabelFingerprint">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;TLS/SSL active - &lt;a href=&quot;#&quot;&gt;view&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="indent">
<number>20</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="m_pButtonConfigureServer">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>&amp;Configure server</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget> </widget>
</item> </item>
<item row="4" column="1"> <item>
<widget class="QComboBox" name="m_pComboServerList"> <widget class="QGroupBox" name="m_pGroupClient">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>200</width> <width>340</width>
<height>248</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
</widget> <property name="font">
</item> <font>
<item row="4" column="0"> <kerning>true</kerning>
<widget class="QLabel" name="m_pLabelAutoDetected"> </font>
<property name="text">
<string>Server:</string>
</property> </property>
<property name="styleSheet">
<string notr="true">QGroupBox::title {
subcontrol-origin: padding;
left: 7px;
}
</string>
</property>
<property name="title">
<string/>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="ClientLayout">
<property name="spacing">
<number>9</number>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>11</number>
</property>
<item>
<widget class="QRadioButton" name="m_pRadioGroupClient">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>30</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QRadioButton::indicator{
top: -7px;
}</string>
</property>
<property name="text">
<string>Use another computer’s mouse and keyboard
(Make this computer the client).</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="leftMargin">
<number>19</number>
</property>
<property name="topMargin">
<number>10</number>
</property>
<item>
<widget class="QLabel" name="m_pLabelServerName">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&amp;Server IP address or name:</string>
</property>
<property name="buddy">
<cstring>m_pLineEditHostname</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="m_pLineEditHostname">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Hostname or IP address of the server computer.</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_pLabelAutoDetected">
<property name="text">
<string>Server:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="m_pComboServerList">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="synergy_widgets::ClientStateLabel" name="m_pLabelClientState">
<property name="text">
<string>Connected to the server</string>
</property>
<property name="indent">
<number>20</number>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<property name="topMargin">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="m_pButtonConnect">
<property name="text">
<string>Connect</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -603,58 +988,22 @@
</property> </property>
</action> </action>
</widget> </widget>
<customwidgets>
<customwidget>
<class>synergy_widgets::ServerStateLabel</class>
<extends>QLabel</extends>
<header>widgets/ServerStateLabel.h</header>
</customwidget>
<customwidget>
<class>synergy_widgets::ClientStateLabel</class>
<extends>QLabel</extends>
<header>widgets/ClientStateLabel.h</header>
</customwidget>
</customwidgets>
<resources> <resources>
<include location="../res/Synergy.qrc"/> <include location="../res/Synergy.qrc"/>
</resources> </resources>
<connections> <connections>
<connection>
<sender>m_pRadioExternalConfig</sender>
<signal>toggled(bool)</signal>
<receiver>m_pLineEditConfigFile</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>156</x>
<y>179</y>
</hint>
<hint type="destinationlabel">
<x>169</x>
<y>209</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pRadioExternalConfig</sender>
<signal>toggled(bool)</signal>
<receiver>m_pButtonBrowseConfigFile</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>353</x>
<y>182</y>
</hint>
<hint type="destinationlabel">
<x>356</x>
<y>211</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pRadioInternalConfig</sender>
<signal>toggled(bool)</signal>
<receiver>m_pButtonConfigureServer</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>204</x>
<y>244</y>
</hint>
<hint type="destinationlabel">
<x>212</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection> <connection>
<sender>m_pButtonToggleStart</sender> <sender>m_pButtonToggleStart</sender>
<signal>clicked()</signal> <signal>clicked()</signal>

View file

@ -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 ServerConfig::findScreenName(const QString& name, int& index)
{ {
bool found = false; bool found = false;

View file

@ -81,6 +81,8 @@ class ServerConfig : public BaseConfig, public GUI::Config::ConfigBase
int autoAddScreen(const QString name); int autoAddScreen(const QString name);
const QString& getServerName() const; const QString& getServerName() const;
void updateServerName(); void updateServerName();
const QString& getConfigFile() const;
bool getUseExternalConfig() const;
protected: protected:
QSettings& settings(); QSettings& settings();
@ -104,6 +106,8 @@ class ServerConfig : public BaseConfig, public GUI::Config::ConfigBase
void setEnableDragAndDrop(bool on) { m_EnableDragAndDrop = on; } void setEnableDragAndDrop(bool on) { m_EnableDragAndDrop = on; }
void setDisableLockToScreen(bool on) { m_DisableLockToScreen = on; } void setDisableLockToScreen(bool on) { m_DisableLockToScreen = on; }
void setClipboardSharing(bool on) { m_ClipboardSharing = on; } void setClipboardSharing(bool on) { m_ClipboardSharing = on; }
void setConfigFile(const QString& configFile);
void setUseExternalConfig(bool useExternalConfig);
size_t setClipboardSharingSize(size_t size); size_t setClipboardSharingSize(size_t size);
QList<bool>& switchCorners() { return m_SwitchCorners; } QList<bool>& switchCorners() { return m_SwitchCorners; }
HotkeyList& hotkeys() { return m_Hotkeys; } HotkeyList& hotkeys() { return m_Hotkeys; }

View file

@ -25,6 +25,7 @@
#include <QtCore> #include <QtCore>
#include <QtGui> #include <QtGui>
#include <QMessageBox> #include <QMessageBox>
#include <QFileDialog>
ServerConfigDialog::ServerConfigDialog(QWidget* parent, ServerConfig& config) : ServerConfigDialog::ServerConfigDialog(QWidget* parent, ServerConfig& config) :
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint), QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
@ -36,6 +37,8 @@ ServerConfigDialog::ServerConfigDialog(QWidget* parent, ServerConfig& config) :
{ {
setupUi(this); setupUi(this);
m_pEditConfigFile->setText(serverConfig().getConfigFile());
m_pCheckBoxUseExternalConfig->setChecked(serverConfig().getUseExternalConfig());
m_pCheckBoxHeartbeat->setChecked(serverConfig().hasHeartbeat()); m_pCheckBoxHeartbeat->setChecked(serverConfig().hasHeartbeat());
m_pSpinBoxHeartbeat->setValue(serverConfig().heartbeat()); m_pSpinBoxHeartbeat->setValue(serverConfig().heartbeat());
@ -98,6 +101,25 @@ void ServerConfigDialog::showEvent(QShowEvent* event)
void ServerConfigDialog::accept() 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().haveHeartbeat(m_pCheckBoxHeartbeat->isChecked());
serverConfig().setHeartbeat(m_pSpinBoxHeartbeat->value()); serverConfig().setHeartbeat(m_pSpinBoxHeartbeat->value());
@ -261,3 +283,33 @@ void ServerConfigDialog::onScreenRemoved()
{ {
m_pButtonAddComputer->setEnabled(true); m_pButtonAddComputer->setEnabled(true);
} }
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;
}

View file

@ -49,10 +49,11 @@ class ServerConfigDialog : public QDialog, public Ui::ServerConfigDialogBase
void on_m_pListActions_itemSelectionChanged(); void on_m_pListActions_itemSelectionChanged();
void on_m_pButtonEditAction_clicked(); void on_m_pButtonEditAction_clicked();
void on_m_pButtonRemoveAction_clicked(); void on_m_pButtonRemoveAction_clicked();
void on_m_pCheckBoxEnableClipboard_stateChanged(int state); void on_m_pCheckBoxEnableClipboard_stateChanged(int state);
void on_m_pButtonAddComputer_clicked(); void on_m_pButtonAddComputer_clicked();
void onScreenRemoved(); void onScreenRemoved();
void on_m_pCheckBoxUseExternalConfig_toggled(bool checked = false);
bool on_m_pButtonBrowseConfigFile_clicked();
protected: protected:
ServerConfig& serverConfig() { return m_ServerConfig; } ServerConfig& serverConfig() { return m_ServerConfig; }

View file

@ -886,6 +886,267 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="m_pTabAdvancedConfig">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<attribute name="title">
<string>Advance config</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p style=&quot;text-align: center; font-family: Arial; font-size: 18px; line-height: 25px;&quot;&gt;Config override&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p style=&quot;text-align: center; font-size: 13px; font-family: Arial; line-hegiht: 18px;&quot;&gt;If you have a config file and want to override all setttings with this file.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Maximum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>30</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="m_pCheckBoxUseExternalConfig">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Use configuration file</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="leftMargin">
<number>95</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="m_pLabelConfigFile">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>96</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Config file path</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="m_pEditConfigFile">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>180</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="m_pButtonBrowseConfigFile">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>&amp;Browse...</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</widget> </widget>
</item> </item>
<item> <item>

View file

@ -153,7 +153,7 @@
<x>193</x> <x>193</x>
<y>380</y> <y>380</y>
<width>311</width> <width>311</width>
<height>81</height> <height>91</height>
</rect> </rect>
</property> </property>
<property name="font"> <property name="font">

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#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();
}
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef CLIENTSTATELABEL_H
#define CLIENTSTATELABEL_H
#include <QLabel>
namespace synergy_widgets
{
class ClientStateLabel : public QLabel
{
public:
explicit ClientStateLabel(QWidget* parent = nullptr);
void updateClientState(const QString& line);
};
} // namespace synergy_widgets
#endif // CLIENTSTATELABEL_H

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#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

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef SERVERSTATELABEL_H
#define SERVERSTATELABEL_H
#include <QLabel>
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