SYNERGY-786 The system does not update server name in Server configuration (#6953)
* SYNERGY-786 The system does not update server name in Server configuration * SYNERGY-768 Remove unused header * SYNERGY-786 Update ChangeLog and version * SYNERGY-786 Fix code smells * SYNERGY-786 Save screen name after update
This commit is contained in:
parent
450c741cd6
commit
22c77b4e8b
15 changed files with 139 additions and 44 deletions
|
|
@ -1,3 +1,9 @@
|
||||||
|
v1.13.2-snapshot
|
||||||
|
===========
|
||||||
|
Bug fixes:
|
||||||
|
- #6953 The system does not update server name in Server configuration
|
||||||
|
===========
|
||||||
|
|
||||||
v1.13.1-snapshot
|
v1.13.1-snapshot
|
||||||
===========
|
===========
|
||||||
Bug fixes:
|
Bug fixes:
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ cmake_minimum_required (VERSION 3.4)
|
||||||
|
|
||||||
set (SYNERGY_VERSION_MAJOR 1)
|
set (SYNERGY_VERSION_MAJOR 1)
|
||||||
set (SYNERGY_VERSION_MINOR 13)
|
set (SYNERGY_VERSION_MINOR 13)
|
||||||
set (SYNERGY_VERSION_PATCH 1)
|
set (SYNERGY_VERSION_PATCH 2)
|
||||||
set (SYNERGY_VERSION_BUILD 1)
|
set (SYNERGY_VERSION_BUILD 1)
|
||||||
set (SYNERGY_VERSION_STAGE "snapshot")
|
set (SYNERGY_VERSION_STAGE "snapshot")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -200,6 +200,10 @@ QString AppConfig::autoConfigServer() const { return m_AutoConfigServer; }
|
||||||
void AppConfig::loadSettings()
|
void AppConfig::loadSettings()
|
||||||
{
|
{
|
||||||
m_ScreenName = loadSetting(kScreenName, QHostInfo::localHostName()).toString();
|
m_ScreenName = loadSetting(kScreenName, QHostInfo::localHostName()).toString();
|
||||||
|
if (m_ScreenName.isEmpty()) {
|
||||||
|
m_ScreenName = QHostInfo::localHostName();
|
||||||
|
}
|
||||||
|
|
||||||
m_Port = loadSetting(kPort, 24800).toInt();
|
m_Port = loadSetting(kPort, 24800).toInt();
|
||||||
m_Interface = loadSetting(kInterfaceSetting).toString();
|
m_Interface = loadSetting(kInterfaceSetting).toString();
|
||||||
m_LogLevel = loadSetting(kLogLevel, 0).toInt();
|
m_LogLevel = loadSetting(kLogLevel, 0).toInt();
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ const int kWizardVersion = 8;
|
||||||
|
|
||||||
class QSettings;
|
class QSettings;
|
||||||
class SettingsDialog;
|
class SettingsDialog;
|
||||||
|
class ServerConfig;
|
||||||
|
|
||||||
enum ProcessMode {
|
enum ProcessMode {
|
||||||
Service,
|
Service,
|
||||||
|
|
@ -62,6 +63,7 @@ class AppConfig: public QObject, public GUI::Config::ConfigBase
|
||||||
friend class SettingsDialog;
|
friend class SettingsDialog;
|
||||||
friend class MainWindow;
|
friend class MainWindow;
|
||||||
friend class SetupWizard;
|
friend class SetupWizard;
|
||||||
|
friend class ServerConfig;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AppConfig();
|
AppConfig();
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ MainWindow::MainWindow (AppConfig& appConfig,
|
||||||
m_AppConfig(&appConfig),
|
m_AppConfig(&appConfig),
|
||||||
m_pSynergy(NULL),
|
m_pSynergy(NULL),
|
||||||
m_SynergyState(synergyDisconnected),
|
m_SynergyState(synergyDisconnected),
|
||||||
m_ServerConfig(5, 3, m_AppConfig->screenName(), this),
|
m_ServerConfig(5, 3, m_AppConfig, this),
|
||||||
m_AlreadyHidden(false),
|
m_AlreadyHidden(false),
|
||||||
m_pMenuBar(NULL),
|
m_pMenuBar(NULL),
|
||||||
m_pMenuFile(NULL),
|
m_pMenuFile(NULL),
|
||||||
|
|
@ -135,7 +135,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(getScreenName());
|
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());
|
||||||
|
|
||||||
|
|
@ -617,7 +617,7 @@ void MainWindow::startSynergy()
|
||||||
args << "-f" << "--no-tray" << "--debug" << appConfig().logLevelText();
|
args << "-f" << "--no-tray" << "--debug" << appConfig().logLevelText();
|
||||||
|
|
||||||
|
|
||||||
args << "--name" << getScreenName();
|
args << "--name" << appConfig().screenName();
|
||||||
|
|
||||||
if (desktopMode)
|
if (desktopMode)
|
||||||
{
|
{
|
||||||
|
|
@ -1074,16 +1074,6 @@ QString MainWindow::getIPAddresses()
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MainWindow::getScreenName()
|
|
||||||
{
|
|
||||||
if (appConfig().screenName() == "") {
|
|
||||||
return QHostInfo::localHostName();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return appConfig().screenName();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::changeEvent(QEvent* event)
|
void MainWindow::changeEvent(QEvent* event)
|
||||||
{
|
{
|
||||||
if (event != 0)
|
if (event != 0)
|
||||||
|
|
@ -1301,7 +1291,7 @@ void MainWindow::autoAddScreen(const QString name)
|
||||||
|
|
||||||
void MainWindow::showConfigureServer(const QString& message)
|
void MainWindow::showConfigureServer(const QString& message)
|
||||||
{
|
{
|
||||||
ServerConfigDialog dlg(this, serverConfig(), appConfig().screenName());
|
ServerConfigDialog dlg(this, serverConfig());
|
||||||
dlg.message(message);
|
dlg.message(message);
|
||||||
dlg.exec();
|
dlg.exec();
|
||||||
}
|
}
|
||||||
|
|
@ -1391,7 +1381,8 @@ void MainWindow::windowStateChanged()
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateScreenName()
|
void MainWindow::updateScreenName()
|
||||||
{
|
{
|
||||||
m_pLabelScreenName->setText(getScreenName());
|
m_pLabelScreenName->setText(appConfig().screenName());
|
||||||
|
serverConfig().updateServerName();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,6 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||||
void open();
|
void open();
|
||||||
void clearLog();
|
void clearLog();
|
||||||
VersionChecker& versionChecker() { return m_VersionChecker; }
|
VersionChecker& versionChecker() { return m_VersionChecker; }
|
||||||
QString getScreenName();
|
|
||||||
ServerConfig& serverConfig() { return m_ServerConfig; }
|
ServerConfig& serverConfig() { return m_ServerConfig; }
|
||||||
void showConfigureServer(const QString& message);
|
void showConfigureServer(const QString& message);
|
||||||
void showConfigureServer() { showConfigureServer(""); }
|
void showConfigureServer() { showConfigureServer(""); }
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,8 @@ class Screen : public BaseConfig
|
||||||
bool swapped() const { return m_Swapped; }
|
bool swapped() const { return m_Swapped; }
|
||||||
QString& name() { return m_Name; }
|
QString& name() { return m_Name; }
|
||||||
void setName(const QString& name) { m_Name = name; }
|
void setName(const QString& name) { m_Name = name; }
|
||||||
|
bool isServer() const { return m_isServer;}
|
||||||
|
void markAsServer() { m_isServer = true; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void init();
|
void init();
|
||||||
|
|
@ -94,6 +96,7 @@ class Screen : public BaseConfig
|
||||||
QList<bool> m_Fixes;
|
QList<bool> m_Fixes;
|
||||||
|
|
||||||
bool m_Swapped;
|
bool m_Swapped;
|
||||||
|
bool m_isServer = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef QList<Screen> ScreenList;
|
typedef QList<Screen> ScreenList;
|
||||||
|
|
|
||||||
24
src/gui/src/ScreenNameValidator.cpp
Normal file
24
src/gui/src/ScreenNameValidator.cpp
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* synergy -- mouse and keyboard sharing utility
|
||||||
|
* Copyright (C) 2012-2016 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 "ScreenNameValidator.h"
|
||||||
|
|
||||||
|
ScreenNameValidator::ScreenNameValidator(QObject *parent) :
|
||||||
|
QRegExpValidator(QRegExp("[a-z0-9\\._-]{,255}", Qt::CaseInsensitive), parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
29
src/gui/src/ScreenNameValidator.h
Normal file
29
src/gui/src/ScreenNameValidator.h
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* synergy -- mouse and keyboard sharing utility
|
||||||
|
* Copyright (C) 2012-2016 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 SCREENNAMEVALIDATOR_H
|
||||||
|
#define SCREENNAMEVALIDATOR_H
|
||||||
|
|
||||||
|
#include <qvalidator.h>
|
||||||
|
|
||||||
|
class ScreenNameValidator : public QRegExpValidator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit ScreenNameValidator(QObject *parent = nullptr);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SCREENNAMEVALIDATOR_H
|
||||||
|
|
@ -22,6 +22,7 @@
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <ScreenNameValidator.h>
|
||||||
|
|
||||||
ScreenSettingsDialog::ScreenSettingsDialog(QWidget* parent, Screen* pScreen) :
|
ScreenSettingsDialog::ScreenSettingsDialog(QWidget* parent, Screen* pScreen) :
|
||||||
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
|
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
|
||||||
|
|
@ -30,13 +31,11 @@ ScreenSettingsDialog::ScreenSettingsDialog(QWidget* parent, Screen* pScreen) :
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
QRegExp validScreenName("[a-z0-9\\._-]{,255}", Qt::CaseInsensitive);
|
|
||||||
|
|
||||||
m_pLineEditName->setText(m_pScreen->name());
|
m_pLineEditName->setText(m_pScreen->name());
|
||||||
m_pLineEditName->setValidator(new QRegExpValidator(validScreenName, m_pLineEditName));
|
m_pLineEditName->setValidator(new ScreenNameValidator(m_pLineEditName));
|
||||||
m_pLineEditName->selectAll();
|
m_pLineEditName->selectAll();
|
||||||
|
|
||||||
m_pLineEditAlias->setValidator(new QRegExpValidator(validScreenName, m_pLineEditName));
|
m_pLineEditAlias->setValidator(new ScreenNameValidator(m_pLineEditName));
|
||||||
|
|
||||||
for (int i = 0; i < m_pScreen->aliases().count(); i++)
|
for (int i = 0; i < m_pScreen->aliases().count(); i++)
|
||||||
new QListWidgetItem(m_pScreen->aliases()[i], m_pListAliases);
|
new QListWidgetItem(m_pScreen->aliases()[i], m_pListAliases);
|
||||||
|
|
|
||||||
|
|
@ -42,13 +42,12 @@ static const struct
|
||||||
|
|
||||||
const int serverDefaultIndex = 7;
|
const int serverDefaultIndex = 7;
|
||||||
|
|
||||||
ServerConfig::ServerConfig(int numColumns, int numRows ,
|
ServerConfig::ServerConfig(int numColumns, int numRows, AppConfig* appConfig, MainWindow* mainWindow) :
|
||||||
QString serverName, MainWindow* mainWindow) :
|
|
||||||
|
|
||||||
m_Screens(),
|
m_Screens(),
|
||||||
m_NumColumns(numColumns),
|
m_NumColumns(numColumns),
|
||||||
m_NumRows(numRows),
|
m_NumRows(numRows),
|
||||||
m_ServerName(serverName),
|
m_pAppConfig(appConfig),
|
||||||
m_IgnoreAutoConfigClient(false),
|
m_IgnoreAutoConfigClient(false),
|
||||||
m_EnableDragAndDrop(false),
|
m_EnableDragAndDrop(false),
|
||||||
m_DisableLockToScreen(false),
|
m_DisableLockToScreen(false),
|
||||||
|
|
@ -119,8 +118,8 @@ void ServerConfig::saveSettings()
|
||||||
settings().setValue("ignoreAutoConfigClient", ignoreAutoConfigClient());
|
settings().setValue("ignoreAutoConfigClient", ignoreAutoConfigClient());
|
||||||
settings().setValue("disableLockToScreen", disableLockToScreen());
|
settings().setValue("disableLockToScreen", disableLockToScreen());
|
||||||
settings().setValue("enableDragAndDrop", enableDragAndDrop());
|
settings().setValue("enableDragAndDrop", enableDragAndDrop());
|
||||||
settings().setValue("clipboardSharing", clipboardSharing());
|
settings().setValue("clipboardSharing", clipboardSharing());
|
||||||
settings().setValue("clipboardSharingSize", QVariant::fromValue(clipboardSharingSize()));
|
settings().setValue("clipboardSharingSize", QVariant::fromValue(clipboardSharingSize()));
|
||||||
|
|
||||||
writeSettings(settings(), switchCorners(), "switchCorner");
|
writeSettings(settings(), switchCorners(), "switchCorner");
|
||||||
|
|
||||||
|
|
@ -128,7 +127,11 @@ void ServerConfig::saveSettings()
|
||||||
for (int i = 0; i < screens().size(); i++)
|
for (int i = 0; i < screens().size(); i++)
|
||||||
{
|
{
|
||||||
settings().setArrayIndex(i);
|
settings().setArrayIndex(i);
|
||||||
screens()[i].saveSettings(settings());
|
auto& screen = screens()[i];
|
||||||
|
screen.saveSettings(settings());
|
||||||
|
if (screen.isServer() && m_pAppConfig->screenName() != screen.name()){
|
||||||
|
m_pAppConfig->setScreenName(screen.name());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
settings().endArray();
|
settings().endArray();
|
||||||
|
|
||||||
|
|
@ -181,6 +184,9 @@ void ServerConfig::loadSettings()
|
||||||
{
|
{
|
||||||
settings().setArrayIndex(i);
|
settings().setArrayIndex(i);
|
||||||
screens()[i].loadSettings(settings());
|
screens()[i].loadSettings(settings());
|
||||||
|
if (getServerName() == screens()[i].name()) {
|
||||||
|
screens()[i].markAsServer();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
settings().endArray();
|
settings().endArray();
|
||||||
|
|
||||||
|
|
@ -299,11 +305,12 @@ int ServerConfig::autoAddScreen(const QString name)
|
||||||
{
|
{
|
||||||
int serverIndex = -1;
|
int serverIndex = -1;
|
||||||
int targetIndex = -1;
|
int targetIndex = -1;
|
||||||
if (!findScreenName(m_ServerName, serverIndex)) {
|
if (!findScreenName(m_pAppConfig->screenName(), serverIndex) &&
|
||||||
if (!fixNoServer(m_ServerName, serverIndex)) {
|
!fixNoServer(m_pAppConfig->screenName(), serverIndex))
|
||||||
return kAutoAddScreenManualServer;
|
{
|
||||||
}
|
return kAutoAddScreenManualServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (findScreenName(name, targetIndex)) {
|
if (findScreenName(name, targetIndex)) {
|
||||||
m_pMainWindow->appendLogDebug(QString("ignoring screen already in config: %1").arg(name));
|
m_pMainWindow->appendLogDebug(QString("ignoring screen already in config: %1").arg(name));
|
||||||
return kAutoAddScreenIgnore;
|
return kAutoAddScreenIgnore;
|
||||||
|
|
@ -362,6 +369,22 @@ int ServerConfig::autoAddScreen(const QString name)
|
||||||
return kAutoAddScreenOk;
|
return kAutoAddScreenOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString& ServerConfig::getServerName() const
|
||||||
|
{
|
||||||
|
return m_pAppConfig->screenName();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerConfig::updateServerName()
|
||||||
|
{
|
||||||
|
for (auto& screen : screens()) {
|
||||||
|
if (screen.isServer()) {
|
||||||
|
screen.setName(m_pAppConfig->screenName());
|
||||||
|
screen.saveSettings(settings());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool ServerConfig::findScreenName(const QString& name, int& index)
|
bool ServerConfig::findScreenName(const QString& name, int& index)
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,7 @@ class ServerConfig : public BaseConfig, public GUI::Config::ConfigBase
|
||||||
friend QTextStream& operator<<(QTextStream& outStream, const ServerConfig& config);
|
friend QTextStream& operator<<(QTextStream& outStream, const ServerConfig& config);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ServerConfig(int numColumns, int numRows,
|
ServerConfig(int numColumns, int numRows, AppConfig* appConfig, MainWindow* mainWindow);
|
||||||
QString serverName, MainWindow* mainWindow);
|
|
||||||
|
|
||||||
ServerConfig(const ServerConfig &src) =default;
|
ServerConfig(const ServerConfig &src) =default;
|
||||||
ServerConfig(ServerConfig &&) =default;
|
ServerConfig(ServerConfig &&) =default;
|
||||||
|
|
@ -80,6 +79,8 @@ class ServerConfig : public BaseConfig, public GUI::Config::ConfigBase
|
||||||
void save(QFile& file) const;
|
void save(QFile& file) const;
|
||||||
int numScreens() const;
|
int numScreens() const;
|
||||||
int autoAddScreen(const QString name);
|
int autoAddScreen(const QString name);
|
||||||
|
const QString& getServerName() const;
|
||||||
|
void updateServerName();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QSettings& settings();
|
QSettings& settings();
|
||||||
|
|
@ -132,7 +133,7 @@ class ServerConfig : public BaseConfig, public GUI::Config::ConfigBase
|
||||||
int m_SwitchCornerSize;
|
int m_SwitchCornerSize;
|
||||||
QList<bool> m_SwitchCorners;
|
QList<bool> m_SwitchCorners;
|
||||||
HotkeyList m_Hotkeys;
|
HotkeyList m_Hotkeys;
|
||||||
QString m_ServerName;
|
AppConfig* m_pAppConfig;
|
||||||
bool m_IgnoreAutoConfigClient;
|
bool m_IgnoreAutoConfigClient;
|
||||||
bool m_EnableDragAndDrop;
|
bool m_EnableDragAndDrop;
|
||||||
bool m_DisableLockToScreen;
|
bool m_DisableLockToScreen;
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
ServerConfigDialog::ServerConfigDialog(QWidget* parent, ServerConfig& config, const QString& defaultScreenName) :
|
ServerConfigDialog::ServerConfigDialog(QWidget* parent, ServerConfig& config) :
|
||||||
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
|
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
|
||||||
Ui::ServerConfigDialogBase(),
|
Ui::ServerConfigDialogBase(),
|
||||||
m_OrigServerConfig(config),
|
m_OrigServerConfig(config),
|
||||||
|
|
@ -66,8 +66,19 @@ ServerConfigDialog::ServerConfigDialog(QWidget* parent, ServerConfig& config, co
|
||||||
|
|
||||||
m_pScreenSetupView->setModel(&m_ScreenSetupModel);
|
m_pScreenSetupView->setModel(&m_ScreenSetupModel);
|
||||||
|
|
||||||
if (serverConfig().numScreens() == 0)
|
if (serverConfig().numScreens() == 0) {
|
||||||
model().screen(serverConfig().numColumns() / 2, serverConfig().numRows() / 2) = Screen(defaultScreenName);
|
Screen serverScreen(serverConfig().getServerName());
|
||||||
|
serverScreen.markAsServer();
|
||||||
|
model().screen(serverConfig().numColumns() / 2, serverConfig().numRows() / 2) = serverScreen;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (auto& screen : serverConfig().screens()) {
|
||||||
|
if (screen.name() == serverConfig().getServerName()) {
|
||||||
|
screen.markAsServer();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerConfigDialog::showEvent(QShowEvent* event)
|
void ServerConfigDialog::showEvent(QShowEvent* event)
|
||||||
|
|
@ -103,8 +114,8 @@ void ServerConfigDialog::accept()
|
||||||
serverConfig().setIgnoreAutoConfigClient(m_pCheckBoxIgnoreAutoConfigClient->isChecked());
|
serverConfig().setIgnoreAutoConfigClient(m_pCheckBoxIgnoreAutoConfigClient->isChecked());
|
||||||
serverConfig().setDisableLockToScreen(m_pCheckBoxDisableLockToScreen->isChecked());
|
serverConfig().setDisableLockToScreen(m_pCheckBoxDisableLockToScreen->isChecked());
|
||||||
serverConfig().setClipboardSharingSize(m_pSpinBoxClipboardSizeLimit->value() * 1024);
|
serverConfig().setClipboardSharingSize(m_pSpinBoxClipboardSizeLimit->value() * 1024);
|
||||||
serverConfig().setClipboardSharing(m_pCheckBoxEnableClipboard->isChecked()
|
serverConfig().setClipboardSharing(m_pCheckBoxEnableClipboard->isChecked()
|
||||||
&& m_pSpinBoxClipboardSizeLimit->value());
|
&& m_pSpinBoxClipboardSizeLimit->value());
|
||||||
|
|
||||||
// now that the dialog has been accepted, copy the new server config to the original one,
|
// now that the dialog has been accepted, copy the new server config to the original one,
|
||||||
// which is a reference to the one in MainWindow.
|
// which is a reference to the one in MainWindow.
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ class ServerConfigDialog : public QDialog, public Ui::ServerConfigDialogBase
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ServerConfigDialog(QWidget* parent, ServerConfig& config, const QString& defaultScreenName);
|
ServerConfigDialog(QWidget* parent, ServerConfig& config);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void accept();
|
void accept();
|
||||||
|
|
@ -50,7 +50,7 @@ class ServerConfigDialog : public QDialog, public Ui::ServerConfigDialogBase
|
||||||
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);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ServerConfig& serverConfig() { return m_ServerConfig; }
|
ServerConfig& serverConfig() { return m_ServerConfig; }
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "BonjourWindows.h"
|
#include "BonjourWindows.h"
|
||||||
#include "Zeroconf.h"
|
#include "Zeroconf.h"
|
||||||
|
#include "ScreenNameValidator.h"
|
||||||
|
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
|
|
@ -50,6 +51,7 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
|
||||||
m_isSystemAtStart = appConfig().isSystemScoped();
|
m_isSystemAtStart = appConfig().isSystemScoped();
|
||||||
buttonBox->button(QDialogButtonBox::Save)->setEnabled(false);
|
buttonBox->button(QDialogButtonBox::Save)->setEnabled(false);
|
||||||
enableControls(appConfig().isWritable());
|
enableControls(appConfig().isWritable());
|
||||||
|
m_pLineEditScreenName->setValidator(new ScreenNameValidator(m_pLineEditScreenName));
|
||||||
|
|
||||||
connect(m_pLineEditLogFilename, SIGNAL(textChanged(const QString&)), this, SLOT(onChange()));
|
connect(m_pLineEditLogFilename, SIGNAL(textChanged(const QString&)), this, SLOT(onChange()));
|
||||||
connect(m_pComboLogLevel, SIGNAL(currentIndexChanged(int)), this, SLOT(onChange()));
|
connect(m_pComboLogLevel, SIGNAL(currentIndexChanged(int)), this, SLOT(onChange()));
|
||||||
|
|
@ -305,8 +307,8 @@ void SettingsDialog::updateKeyLengthOnFile(const QString &path) {
|
||||||
|
|
||||||
bool SettingsDialog::isModified()
|
bool SettingsDialog::isModified()
|
||||||
{
|
{
|
||||||
return (
|
return (!m_pLineEditScreenName->text().isEmpty() &&
|
||||||
appConfig().screenName() != m_pLineEditScreenName->text()
|
(appConfig().screenName() != m_pLineEditScreenName->text()
|
||||||
|| appConfig().port() != m_pSpinBoxPort->value()
|
|| appConfig().port() != m_pSpinBoxPort->value()
|
||||||
|| appConfig().networkInterface() != m_pLineEditInterface->text()
|
|| appConfig().networkInterface() != m_pLineEditInterface->text()
|
||||||
|| appConfig().logLevel() != m_pComboLogLevel->currentIndex()
|
|| appConfig().logLevel() != m_pComboLogLevel->currentIndex()
|
||||||
|
|
@ -320,6 +322,7 @@ bool SettingsDialog::isModified()
|
||||||
|| appConfig().getTLSCertPath() != m_pLineEditCertificatePath->text()
|
|| appConfig().getTLSCertPath() != m_pLineEditCertificatePath->text()
|
||||||
|| appConfig().getTLSKeyLength() != m_pComboBoxKeyLength->currentText()
|
|| appConfig().getTLSKeyLength() != m_pComboBoxKeyLength->currentText()
|
||||||
|| appConfig().getCryptoEnabled() != m_pCheckBoxEnableCrypto->isChecked()
|
|| appConfig().getCryptoEnabled() != m_pCheckBoxEnableCrypto->isChecked()
|
||||||
|
|| appConfig().isSystemScoped() != m_isSystemAtStart)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue