Merge pull request #6978 from symless/SYNERGY-799-Update-Synergy-UI.-Settings-window
SYNERGY-799 Update Synergy UI. Settings window
This commit is contained in:
commit
f767aa3a53
11 changed files with 842 additions and 563 deletions
|
|
@ -16,6 +16,7 @@ Enhancements:
|
|||
- #6969 Update synergy UI. Validation for aliases.
|
||||
- #6973 Update synergy UI. Main window
|
||||
- #6977 Update synergy UI. Configure server
|
||||
- #6978 Update synergy UI. Settings window
|
||||
- #6962 | #6965 Add macOS 10.13 builder
|
||||
===========
|
||||
|
||||
|
|
|
|||
|
|
@ -20,5 +20,6 @@
|
|||
<file>icons/64x64/synergy-light-disconnected.png</file>
|
||||
<file>icons/64x64/synergy-light-connected.png</file>
|
||||
<file>image/welcome.png</file>
|
||||
<file>icons/64x64/folder.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
|||
BIN
src/gui/res/icons/64x64/folder.png
Normal file
BIN
src/gui/res/icons/64x64/folder.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 919 B |
|
|
@ -237,7 +237,7 @@ void AppConfig::loadSettings()
|
|||
m_UseExternalConfig = loadSetting(kUseExternalConfig, false).toBool();
|
||||
m_ConfigFile = loadSetting(kConfigFile, QDir::homePath() + "/" + synergyConfigName).toString();
|
||||
m_UseInternalConfig = loadSetting(kUseInternalConfig, false).toBool();
|
||||
m_ClientGroupChecked = loadSetting(kGroupClientCheck, true).toBool();
|
||||
m_ClientGroupChecked = loadSetting(kGroupClientCheck, false).toBool();
|
||||
m_ServerHostname = loadSetting(kServerHostname).toString();
|
||||
|
||||
//only change the serial key if the settings being loaded contains a key
|
||||
|
|
|
|||
|
|
@ -298,10 +298,8 @@ void MainWindow::createMenuBar()
|
|||
|
||||
void MainWindow::loadSettings()
|
||||
{
|
||||
on_m_pRadioGroupServer_clicked(appConfig().getServerGroupChecked());
|
||||
on_m_pRadioGroupClient_clicked(appConfig().getClientGroupChecked());
|
||||
m_pRadioGroupServer->setChecked(appConfig().getServerGroupChecked());
|
||||
m_pRadioGroupClient->setChecked(appConfig().getClientGroupChecked());
|
||||
enableServer(appConfig().getServerGroupChecked());
|
||||
enableClient(appConfig().getClientGroupChecked());
|
||||
|
||||
m_pLineEditHostname->setText(appConfig().getServerHostname());
|
||||
}
|
||||
|
|
@ -1043,38 +1041,34 @@ void MainWindow::setVisible(bool visible)
|
|||
|
||||
QString MainWindow::getIPAddresses()
|
||||
{
|
||||
QList<QHostAddress> addresses = QNetworkInterface::allAddresses();
|
||||
|
||||
QStringList result;
|
||||
bool hinted = false;
|
||||
QString result;
|
||||
for (int i = 0; i < addresses.size(); i++) {
|
||||
if (addresses[i].protocol() == QAbstractSocket::IPv4Protocol &&
|
||||
addresses[i] != QHostAddress(QHostAddress::LocalHost)) {
|
||||
const auto localnet = QHostAddress::parseSubnet("192.168.0.0/16");
|
||||
const QList<QHostAddress> addresses = QNetworkInterface::allAddresses();
|
||||
|
||||
QString address = addresses[i].toString();
|
||||
QString format = "%1, ";
|
||||
for (const auto& address : addresses) {
|
||||
if (address.protocol() == QAbstractSocket::IPv4Protocol &&
|
||||
address != QHostAddress(QHostAddress::LocalHost) &&
|
||||
!address.isLinkLocal()) {
|
||||
|
||||
// usually 192.168.x.x is a useful ip for the user, so indicate
|
||||
// this by making it bold.
|
||||
if (!hinted && address.startsWith("192.168")) {
|
||||
if (!hinted && address.isInSubnet(localnet)) {
|
||||
QString format = "<b>%1</b>";
|
||||
result.append(format.arg(address.toString()));
|
||||
hinted = true;
|
||||
format = "<b>%1</b>, ";
|
||||
}
|
||||
//Prevent self assigned IPs being displayed
|
||||
if (!address.startsWith("169.254")) {
|
||||
result += format.arg(address);
|
||||
else {
|
||||
result.append(address.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (result == "") {
|
||||
return tr("Unknown");
|
||||
if (result.isEmpty()) {
|
||||
result.append(tr("Unknown"));
|
||||
}
|
||||
|
||||
// remove trailing comma.
|
||||
result.chop(2);
|
||||
|
||||
return result;
|
||||
return result.join(", ");
|
||||
}
|
||||
|
||||
void MainWindow::changeEvent(QEvent* event)
|
||||
|
|
@ -1365,18 +1359,38 @@ void MainWindow::updateScreenName()
|
|||
serverConfig().updateServerName();
|
||||
}
|
||||
|
||||
void MainWindow::on_m_pRadioGroupServer_clicked(bool on)
|
||||
void MainWindow::enableServer(bool enable)
|
||||
{
|
||||
m_pRadioGroupServer->setChecked(true);
|
||||
if (on)
|
||||
m_pRadioGroupServer->setChecked(enable);
|
||||
|
||||
if (enable)
|
||||
{
|
||||
//show server controls
|
||||
m_pButtonConfigureServer->show();
|
||||
m_pLabelServerState->show();
|
||||
updateLocalFingerprint();
|
||||
m_pButtonToggleStart->setEnabled(enable);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pLabelFingerprint->hide();
|
||||
m_pButtonConfigureServer->hide();
|
||||
m_pLabelServerState->hide();
|
||||
}
|
||||
}
|
||||
|
||||
//hide client controls
|
||||
m_pRadioGroupClient->setChecked(false);
|
||||
void MainWindow::enableClient(bool enable)
|
||||
{
|
||||
m_pRadioGroupClient->setChecked(enable);
|
||||
|
||||
if (enable)
|
||||
{
|
||||
m_pLabelServerName->show();
|
||||
m_pLineEditHostname->show();
|
||||
m_pButtonConnect->show();
|
||||
m_pButtonToggleStart->setEnabled(enable);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pLabelClientState->hide();
|
||||
m_pLabelServerName->hide();
|
||||
m_pLineEditHostname->hide();
|
||||
|
|
@ -1384,25 +1398,21 @@ void MainWindow::on_m_pRadioGroupServer_clicked(bool on)
|
|||
}
|
||||
}
|
||||
|
||||
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_pRadioGroupServer_clicked(bool)
|
||||
{
|
||||
enableServer(true);
|
||||
enableClient(false);
|
||||
}
|
||||
|
||||
void MainWindow::on_m_pRadioGroupClient_clicked(bool)
|
||||
{
|
||||
enableClient(true);
|
||||
enableServer(false);
|
||||
}
|
||||
|
||||
void MainWindow::on_m_pButtonConnect_clicked()
|
||||
{
|
||||
restartSynergy();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -143,8 +143,8 @@ public slots:
|
|||
protected slots:
|
||||
void updateLocalFingerprint();
|
||||
void updateScreenName();
|
||||
void on_m_pRadioGroupServer_clicked(bool on);
|
||||
void on_m_pRadioGroupClient_clicked(bool on);
|
||||
void on_m_pRadioGroupServer_clicked(bool);
|
||||
void on_m_pRadioGroupClient_clicked(bool);
|
||||
void on_m_pButtonConfigureServer_clicked();
|
||||
bool on_m_pActionSave_triggered();
|
||||
void on_m_pActionAbout_triggered();
|
||||
|
|
@ -187,6 +187,8 @@ public slots:
|
|||
void stopDesktop();
|
||||
void changeEvent(QEvent* event);
|
||||
void retranslateMenuBar();
|
||||
void enableServer(bool enable);
|
||||
void enableClient(bool enable);
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
bool isServiceRunning(QString name);
|
||||
|
|
|
|||
|
|
@ -866,6 +866,9 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_pButtonToggleStart">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Start</string>
|
||||
</property>
|
||||
|
|
|
|||
|
|
@ -1028,7 +1028,7 @@
|
|||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>95</number>
|
||||
<number>40</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
|
|
@ -1071,6 +1071,22 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="m_pEditConfigFile">
|
||||
<property name="enabled">
|
||||
|
|
@ -1103,12 +1119,31 @@
|
|||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">margin: 0px; padding: 0px;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Browse...</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../res/Synergy.qrc">
|
||||
<normaloff>:/res/icons/64x64/folder.png</normaloff>:/res/icons/64x64/folder.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>13</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
|||
|
|
@ -65,6 +65,8 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
|
|||
connect(m_pSpinBoxPort, SIGNAL(valueChanged(int)), this, SLOT(onChange()));
|
||||
connect(m_pLineEditScreenName, SIGNAL(textEdited(QString)), this, SLOT(onChange()));
|
||||
connect(m_pComboElevate, SIGNAL(currentIndexChanged(int)), this, SLOT(onChange()));
|
||||
|
||||
resize(400, 620);
|
||||
}
|
||||
|
||||
void SettingsDialog::accept()
|
||||
|
|
@ -174,17 +176,14 @@ void SettingsDialog::loadFromConfig() {
|
|||
#endif
|
||||
|
||||
m_pCheckBoxEnableCrypto->setChecked(m_appConfig.getCryptoEnabled());
|
||||
m_pGroupBoxTLS->setVisible(m_appConfig.getCryptoEnabled());
|
||||
|
||||
#ifdef SYNERGY_ENTERPRISE
|
||||
|
||||
m_pCheckBoxEnableCrypto->setEnabled(true);
|
||||
m_pLabelProUpgrade->hide();
|
||||
|
||||
#else
|
||||
|
||||
m_pCheckBoxEnableCrypto->setEnabled(m_appConfig.isCryptoAvailable());
|
||||
m_pLabelProUpgrade->setVisible(!m_appConfig.isCryptoAvailable());
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -209,6 +208,7 @@ void SettingsDialog::on_m_pCheckBoxLogToFile_stateChanged(int i)
|
|||
{
|
||||
bool checked = i == 2;
|
||||
|
||||
m_pLabelLogPath->setEnabled(checked);
|
||||
m_pLineEditLogFilename->setEnabled(checked);
|
||||
m_pButtonBrowseLog->setEnabled(checked);
|
||||
buttonBox->button(QDialogButtonBox::Save)->setEnabled(isModified());
|
||||
|
|
@ -236,13 +236,14 @@ void SettingsDialog::on_m_pComboLanguage_currentIndexChanged(int index)
|
|||
|
||||
void SettingsDialog::on_m_pCheckBoxEnableCrypto_toggled(bool checked)
|
||||
{
|
||||
m_pLabelKeyLength->setEnabled(checked);
|
||||
m_pComboBoxKeyLength->setEnabled(checked);
|
||||
m_pLabelCertificate->setEnabled(checked);
|
||||
m_pLineEditCertificatePath->setEnabled(checked);
|
||||
m_pPushButtonBrowseCert->setEnabled(checked);
|
||||
m_pPushButtonRegenCert->setEnabled(checked);
|
||||
|
||||
buttonBox->button(QDialogButtonBox::Save)->setEnabled(isModified());
|
||||
if (checked) {
|
||||
verticalSpacer_4->changeSize(10, 10, QSizePolicy::Minimum);
|
||||
} else {
|
||||
verticalSpacer_4->changeSize(10, 0, QSizePolicy::Ignored);
|
||||
}
|
||||
adjustSize();
|
||||
}
|
||||
|
||||
void SettingsDialog::on_m_pLabelInstallBonjour_linkActivated(const QString&)
|
||||
|
|
@ -288,10 +289,9 @@ void SettingsDialog::updateRegenButton() {
|
|||
// Disable the Regenerate cert button if the key length is different to saved
|
||||
auto keyChanged = appConfig().getTLSKeyLength() != m_pComboBoxKeyLength->currentText();
|
||||
auto pathChanged = appConfig().getTLSCertPath() != m_pLineEditCertificatePath->text();
|
||||
auto cryptoChanged = appConfig().getCryptoEnabled() != m_pCheckBoxEnableCrypto->isChecked();
|
||||
//NOR the above bools, if any have changed regen should be disabled as it will be done on save
|
||||
auto nor = !(keyChanged || pathChanged || cryptoChanged);
|
||||
m_pPushButtonRegenCert->setEnabled(nor);
|
||||
auto nor = !(keyChanged || pathChanged);
|
||||
m_pPushButtonRegenCert->setEnabled(nor && m_pCheckBoxEnableCrypto->isChecked());
|
||||
}
|
||||
|
||||
void SettingsDialog::on_m_pPushButtonRegenCert_clicked() {
|
||||
|
|
@ -346,18 +346,29 @@ void SettingsDialog::enableControls(bool enable) {
|
|||
m_labelAdminRightsMessage->setVisible(!enable);
|
||||
|
||||
if (enable) {
|
||||
m_pLabelLogPath->setEnabled(m_pCheckBoxLogToFile->isChecked());
|
||||
m_pLineEditLogFilename->setEnabled(m_pCheckBoxLogToFile->isChecked());
|
||||
m_pButtonBrowseLog->setEnabled(m_pCheckBoxLogToFile->isChecked());
|
||||
m_pCheckBoxEnableCrypto->setEnabled(m_appConfig.isCryptoAvailable());
|
||||
m_pLabelKeyLength->setEnabled(m_pCheckBoxEnableCrypto->isChecked());
|
||||
m_pComboBoxKeyLength->setEnabled(m_pCheckBoxEnableCrypto->isChecked());
|
||||
m_pLabelCertificate->setEnabled(m_pCheckBoxEnableCrypto->isChecked());
|
||||
m_pLineEditCertificatePath->setEnabled(m_pCheckBoxEnableCrypto->isChecked());
|
||||
m_pPushButtonBrowseCert->setEnabled(m_pCheckBoxEnableCrypto->isChecked());
|
||||
updateRegenButton();
|
||||
}
|
||||
else {
|
||||
m_pLabelLogPath->setEnabled(enable);
|
||||
m_pLineEditLogFilename->setEnabled(enable);
|
||||
m_pButtonBrowseLog->setEnabled(enable);
|
||||
m_pCheckBoxEnableCrypto->setEnabled(enable);
|
||||
m_pLabelKeyLength->setEnabled(enable);
|
||||
m_pComboBoxKeyLength->setEnabled(enable);
|
||||
m_pLabelCertificate->setEnabled(enable);
|
||||
m_pLineEditCertificatePath->setEnabled(enable);
|
||||
m_pPushButtonBrowseCert->setEnabled(enable);
|
||||
m_pPushButtonRegenCert->setEnabled(enable);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SettingsDialog::onChange()
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -36,9 +36,8 @@ bool ScreenDuplicationsValidator::validate(const QString& input) const
|
|||
{
|
||||
for (const auto& screen : (*m_pScreenList))
|
||||
{
|
||||
if (!screen.isNull() &&
|
||||
input != m_defaultName &&
|
||||
input == screen.name())
|
||||
if (!screen.isNull() && !screen.isServer() &&
|
||||
input != m_defaultName && input == screen.name())
|
||||
{
|
||||
result = false;
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in a new issue