2012-06-10 16:50:54 +00:00
|
|
|
/*
|
|
|
|
|
* synergy -- mouse and keyboard sharing utility
|
2016-09-07 14:24:00 +00:00
|
|
|
* Copyright (C) 2012-2016 Symless Ltd.
|
2012-06-10 16:50:54 +00:00
|
|
|
* 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
|
2015-05-03 02:33:52 +00:00
|
|
|
* found in the file LICENSE that should have accompanied this file.
|
2012-06-10 16:50:54 +00:00
|
|
|
*
|
|
|
|
|
* 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/>.
|
|
|
|
|
*/
|
|
|
|
|
|
2021-04-09 14:53:27 +00:00
|
|
|
#include "ScreenSettingsDialog.h"
|
2012-06-10 16:50:54 +00:00
|
|
|
#include "ServerConfigDialog.h"
|
|
|
|
|
#include "ServerConfig.h"
|
|
|
|
|
#include "HotkeyDialog.h"
|
|
|
|
|
#include "ActionDialog.h"
|
2022-09-13 15:31:45 +00:00
|
|
|
#include "UpgradeDialog.h"
|
2012-06-10 16:50:54 +00:00
|
|
|
|
|
|
|
|
#include <QtCore>
|
|
|
|
|
#include <QtGui>
|
2014-08-21 17:32:40 +00:00
|
|
|
#include <QMessageBox>
|
2021-04-12 09:03:37 +00:00
|
|
|
#include <QFileDialog>
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2021-02-22 11:33:18 +00:00
|
|
|
ServerConfigDialog::ServerConfigDialog(QWidget* parent, ServerConfig& config) :
|
2016-12-28 11:50:32 +00:00
|
|
|
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
|
|
|
|
|
Ui::ServerConfigDialogBase(),
|
|
|
|
|
m_OrigServerConfig(config),
|
2021-08-20 12:22:07 +00:00
|
|
|
m_OrigServerAppConfigUseExternalConfig(config.getUseExternalConfig()),
|
|
|
|
|
m_OrigServerAppConfigExternalConfigFile(config.getConfigFile()),
|
2016-12-28 11:50:32 +00:00
|
|
|
m_ServerConfig(config),
|
|
|
|
|
m_ScreenSetupModel(serverConfig().screens(), serverConfig().numColumns(), serverConfig().numRows()),
|
|
|
|
|
m_Message("")
|
2012-06-10 16:50:54 +00:00
|
|
|
{
|
2016-12-28 11:50:32 +00:00
|
|
|
setupUi(this);
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2021-04-12 09:03:37 +00:00
|
|
|
m_pEditConfigFile->setText(serverConfig().getConfigFile());
|
|
|
|
|
m_pCheckBoxUseExternalConfig->setChecked(serverConfig().getUseExternalConfig());
|
2016-12-28 11:50:32 +00:00
|
|
|
m_pCheckBoxHeartbeat->setChecked(serverConfig().hasHeartbeat());
|
|
|
|
|
m_pSpinBoxHeartbeat->setValue(serverConfig().heartbeat());
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2016-12-28 11:50:32 +00:00
|
|
|
m_pCheckBoxRelativeMouseMoves->setChecked(serverConfig().relativeMouseMoves());
|
|
|
|
|
m_pCheckBoxWin32KeepForeground->setChecked(serverConfig().win32KeepForeground());
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2016-12-28 11:50:32 +00:00
|
|
|
m_pCheckBoxSwitchDelay->setChecked(serverConfig().hasSwitchDelay());
|
|
|
|
|
m_pSpinBoxSwitchDelay->setValue(serverConfig().switchDelay());
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2016-12-28 11:50:32 +00:00
|
|
|
m_pCheckBoxSwitchDoubleTap->setChecked(serverConfig().hasSwitchDoubleTap());
|
|
|
|
|
m_pSpinBoxSwitchDoubleTap->setValue(serverConfig().switchDoubleTap());
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2016-12-28 11:50:32 +00:00
|
|
|
m_pCheckBoxCornerTopLeft->setChecked(serverConfig().switchCorner(BaseConfig::TopLeft));
|
|
|
|
|
m_pCheckBoxCornerTopRight->setChecked(serverConfig().switchCorner(BaseConfig::TopRight));
|
|
|
|
|
m_pCheckBoxCornerBottomLeft->setChecked(serverConfig().switchCorner(BaseConfig::BottomLeft));
|
|
|
|
|
m_pCheckBoxCornerBottomRight->setChecked(serverConfig().switchCorner(BaseConfig::BottomRight));
|
|
|
|
|
m_pSpinBoxSwitchCornerSize->setValue(serverConfig().switchCornerSize());
|
2016-11-24 12:15:22 +00:00
|
|
|
m_pCheckBoxDisableLockToScreen->setChecked(serverConfig().disableLockToScreen());
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2016-12-28 11:50:32 +00:00
|
|
|
m_pCheckBoxIgnoreAutoConfigClient->setChecked(serverConfig().ignoreAutoConfigClient());
|
2014-11-18 14:16:29 +00:00
|
|
|
|
2016-12-28 11:50:32 +00:00
|
|
|
m_pCheckBoxEnableClipboard->setChecked(serverConfig().clipboardSharing());
|
2018-08-01 12:03:41 +00:00
|
|
|
int clipboardSharingSizeM = static_cast<int>(serverConfig().clipboardSharingSize() / 1024);
|
|
|
|
|
m_pSpinBoxClipboardSizeLimit->setValue(clipboardSharingSizeM);
|
2017-01-30 14:45:30 +00:00
|
|
|
m_pSpinBoxClipboardSizeLimit->setEnabled(serverConfig().clipboardSharing());
|
2016-09-15 16:42:58 +00:00
|
|
|
|
2016-12-28 11:50:32 +00:00
|
|
|
foreach(const Hotkey& hotkey, serverConfig().hotkeys())
|
|
|
|
|
m_pListHotkeys->addItem(hotkey.text());
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2016-12-28 11:50:32 +00:00
|
|
|
m_pScreenSetupView->setModel(&m_ScreenSetupModel);
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2021-04-28 07:06:56 +00:00
|
|
|
auto& screens = serverConfig().screens();
|
|
|
|
|
auto server = std::find_if(screens.begin(), screens.end(), [this](const Screen& screen){ return (screen.name() == serverConfig().getServerName());});
|
|
|
|
|
|
|
|
|
|
if (server == screens.end()) {
|
2021-02-22 11:33:18 +00:00
|
|
|
Screen serverScreen(serverConfig().getServerName());
|
|
|
|
|
serverScreen.markAsServer();
|
|
|
|
|
model().screen(serverConfig().numColumns() / 2, serverConfig().numRows() / 2) = serverScreen;
|
|
|
|
|
}
|
|
|
|
|
else {
|
2021-04-28 07:06:56 +00:00
|
|
|
server->markAsServer();
|
2021-02-22 11:33:18 +00:00
|
|
|
}
|
2021-04-09 14:53:27 +00:00
|
|
|
|
|
|
|
|
m_pButtonAddComputer->setEnabled(!model().isFull());
|
|
|
|
|
connect(m_pTrashScreenWidget, SIGNAL(screenRemoved()), this, SLOT(onScreenRemoved()));
|
2021-08-20 12:22:07 +00:00
|
|
|
|
|
|
|
|
onChange();
|
|
|
|
|
|
|
|
|
|
//computers
|
|
|
|
|
connect(&m_ScreenSetupModel, &ScreenSetupModel::screensChanged, this, &ServerConfigDialog::onChange);
|
|
|
|
|
|
|
|
|
|
//advanced
|
Synergy 1161 when clicking on save preferences on configure server window, automatically apply all the new settings (#7077)
* SYNERGY-1161 When clicking on "Save" preferences on "Configure server" window, automatically apply all the new settings
*Added comparison for all classes which used in server config
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Added server config changes checking logic
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
* Update ChangeLog
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Fix code style
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
* Fix Linux build
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Fix Sonar code smells
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Fix Ubuntu, CentOS and Debian build
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Fix merge conflicts
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Update ChangeLog
Co-authored-by: Andrii Batyiev <andrii-external@symless.com>
2021-08-25 09:15:55 +00:00
|
|
|
connect(m_pCheckBoxSwitchDelay, &QCheckBox::stateChanged,
|
|
|
|
|
this, [this]( const int& v ) { serverConfig().haveSwitchDelay(v); onChange();});
|
|
|
|
|
connect(m_pSpinBoxSwitchDelay, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
|
|
|
|
this, [this]( const int& v ) { serverConfig().setSwitchDelay(v); onChange();});
|
|
|
|
|
connect(m_pCheckBoxSwitchDoubleTap, &QCheckBox::stateChanged,
|
|
|
|
|
this, [this]( const int& v ) { serverConfig().haveSwitchDoubleTap(v); onChange();});
|
|
|
|
|
connect(m_pSpinBoxSwitchDoubleTap, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
|
|
|
|
this, [this]( const int& v ) { serverConfig().setSwitchDoubleTap(v); onChange();});
|
|
|
|
|
connect(m_pCheckBoxEnableClipboard, &QCheckBox::stateChanged,
|
|
|
|
|
this, [this]( const int& v ) { serverConfig().setClipboardSharing(v); onChange();});
|
|
|
|
|
connect(m_pSpinBoxClipboardSizeLimit, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
|
|
|
|
this, [this]( const int& v ) { serverConfig().setClipboardSharingSize(v * 1024); onChange();});
|
|
|
|
|
connect(m_pCheckBoxHeartbeat, &QCheckBox::stateChanged,
|
|
|
|
|
this, [this]( const int& v ) { serverConfig().haveHeartbeat(v); onChange();});
|
|
|
|
|
connect(m_pSpinBoxHeartbeat, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
|
|
|
|
this, [this]( const int& v ) { serverConfig().setHeartbeat(v); onChange();});
|
|
|
|
|
connect(m_pCheckBoxRelativeMouseMoves, &QCheckBox::stateChanged,
|
|
|
|
|
this, [this]( const int& v ) { serverConfig().setRelativeMouseMoves(v); onChange();});
|
|
|
|
|
connect(m_pCheckBoxWin32KeepForeground, &QCheckBox::stateChanged,
|
|
|
|
|
this, [this]( const int& v ) { serverConfig().setWin32KeepForeground(v); onChange();});
|
|
|
|
|
connect(m_pCheckBoxIgnoreAutoConfigClient, &QCheckBox::stateChanged,
|
|
|
|
|
this, [this]( const int& v ) { serverConfig().setIgnoreAutoConfigClient(v); onChange();});
|
|
|
|
|
connect(m_pCheckBoxDisableLockToScreen, &QCheckBox::stateChanged,
|
|
|
|
|
this, [this]( const int& v ) { serverConfig().setDisableLockToScreen(v); onChange();});
|
|
|
|
|
connect(m_pCheckBoxCornerTopLeft, &QCheckBox::stateChanged,
|
|
|
|
|
this, [this]( const int& v ) { serverConfig().setSwitchCorner(BaseConfig::TopLeft, v); onChange();});
|
|
|
|
|
connect(m_pCheckBoxCornerTopRight, &QCheckBox::stateChanged,
|
|
|
|
|
this, [this]( const int& v ) { serverConfig().setSwitchCorner(BaseConfig::TopRight, v); onChange();});
|
|
|
|
|
connect(m_pCheckBoxCornerBottomLeft, &QCheckBox::stateChanged,
|
|
|
|
|
this, [this]( const int& v ) { serverConfig().setSwitchCorner(BaseConfig::BottomLeft, v); onChange();});
|
|
|
|
|
connect(m_pCheckBoxCornerBottomRight, &QCheckBox::stateChanged,
|
|
|
|
|
this, [this]( const int& v ) { serverConfig().setSwitchCorner(BaseConfig::BottomRight, v); onChange();});
|
|
|
|
|
connect(m_pSpinBoxSwitchCornerSize, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
|
|
|
|
this, [this]( const int& v ) { serverConfig().setSwitchCornerSize(v); onChange();});
|
2021-08-20 12:22:07 +00:00
|
|
|
|
|
|
|
|
//config
|
|
|
|
|
connect(m_pCheckBoxUseExternalConfig, &QCheckBox::stateChanged,
|
Synergy 1161 when clicking on save preferences on configure server window, automatically apply all the new settings (#7077)
* SYNERGY-1161 When clicking on "Save" preferences on "Configure server" window, automatically apply all the new settings
*Added comparison for all classes which used in server config
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Added server config changes checking logic
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
* Update ChangeLog
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Fix code style
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
* Fix Linux build
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Fix Sonar code smells
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Fix Ubuntu, CentOS and Debian build
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Fix merge conflicts
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Update ChangeLog
Co-authored-by: Andrii Batyiev <andrii-external@symless.com>
2021-08-25 09:15:55 +00:00
|
|
|
this, [this]( const int& v ) { serverConfig().setUseExternalConfig(v); onChange();});
|
2021-08-20 12:22:07 +00:00
|
|
|
connect(m_pEditConfigFile, &QLineEdit::textChanged,
|
|
|
|
|
this, [this]() { serverConfig().setConfigFile(m_pEditConfigFile->text()); onChange();});
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
Synergy 1161 when clicking on save preferences on configure server window, automatically apply all the new settings (#7081)
* SYNERGY-1161 When clicking on "Save" preferences on "Configure server" window, automatically apply all the new settings
*Added comparison for all classes which used in server config
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Added server config changes checking logic
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
* Update ChangeLog
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Fix code style
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
* Fix Linux build
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Fix Sonar code smells
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Fix Ubuntu, CentOS and Debian build
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Fix merge conflicts
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Update ChangeLog
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Fix server config OK button behaviour on autoconfig
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Update changelog
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Fix sonar codesmell
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Fix build
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Adding client on autoconfig silently
Co-authored-by: Andrii Batyiev <andrii-external@symless.com>
2021-09-06 08:25:55 +00:00
|
|
|
bool ServerConfigDialog::addClient(const QString& clientName)
|
|
|
|
|
{
|
|
|
|
|
return addComputer(clientName, true);
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-21 17:32:40 +00:00
|
|
|
void ServerConfigDialog::showEvent(QShowEvent* event)
|
|
|
|
|
{
|
2016-12-28 11:50:32 +00:00
|
|
|
QDialog::show();
|
2014-08-21 17:32:40 +00:00
|
|
|
|
2016-12-28 11:50:32 +00:00
|
|
|
if (!m_Message.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
// TODO: ideally this massage box should pop up after the dialog is shown
|
|
|
|
|
QMessageBox::information(this, tr("Configure server"), m_Message);
|
|
|
|
|
}
|
2014-08-21 17:32:40 +00:00
|
|
|
}
|
|
|
|
|
|
2012-06-10 16:50:54 +00:00
|
|
|
void ServerConfigDialog::accept()
|
|
|
|
|
{
|
2021-04-12 09:03:37 +00:00
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-28 11:50:32 +00:00
|
|
|
// 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.
|
|
|
|
|
setOrigServerConfig(serverConfig());
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2016-12-28 11:50:32 +00:00
|
|
|
QDialog::accept();
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
2021-08-20 12:22:07 +00:00
|
|
|
void ServerConfigDialog::reject()
|
|
|
|
|
{
|
|
|
|
|
serverConfig().setUseExternalConfig(m_OrigServerAppConfigUseExternalConfig);
|
|
|
|
|
serverConfig().setConfigFile(m_OrigServerAppConfigExternalConfigFile);
|
|
|
|
|
|
|
|
|
|
QDialog::reject();
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-10 16:50:54 +00:00
|
|
|
void ServerConfigDialog::on_m_pButtonNewHotkey_clicked()
|
|
|
|
|
{
|
2022-09-13 15:31:45 +00:00
|
|
|
if (serverConfig().isHotkeysAvailable()) {
|
|
|
|
|
Hotkey hotkey;
|
|
|
|
|
HotkeyDialog dlg(this, hotkey);
|
|
|
|
|
if (dlg.exec() == QDialog::Accepted) {
|
|
|
|
|
serverConfig().hotkeys().append(hotkey);
|
|
|
|
|
m_pListHotkeys->addItem(hotkey.text());
|
|
|
|
|
onChange();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
UpgradeDialog upgradeDialog(this);
|
|
|
|
|
upgradeDialog.showDialog(
|
|
|
|
|
"Configuring custom hotkeys is a Synergy Ultimate feature.",
|
|
|
|
|
"synergy/purchase/purchase-ultimate-upgrade?source=gui"
|
|
|
|
|
);
|
2016-12-28 11:50:32 +00:00
|
|
|
}
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ServerConfigDialog::on_m_pButtonEditHotkey_clicked()
|
|
|
|
|
{
|
2016-12-28 11:50:32 +00:00
|
|
|
int idx = m_pListHotkeys->currentRow();
|
|
|
|
|
Q_ASSERT(idx >= 0 && idx < serverConfig().hotkeys().size());
|
|
|
|
|
Hotkey& hotkey = serverConfig().hotkeys()[idx];
|
|
|
|
|
HotkeyDialog dlg(this, hotkey);
|
2021-08-20 12:22:07 +00:00
|
|
|
if (dlg.exec() == QDialog::Accepted) {
|
2016-12-28 11:50:32 +00:00
|
|
|
m_pListHotkeys->currentItem()->setText(hotkey.text());
|
2021-08-20 12:22:07 +00:00
|
|
|
onChange();
|
|
|
|
|
}
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ServerConfigDialog::on_m_pButtonRemoveHotkey_clicked()
|
|
|
|
|
{
|
2016-12-28 11:50:32 +00:00
|
|
|
int idx = m_pListHotkeys->currentRow();
|
|
|
|
|
Q_ASSERT(idx >= 0 && idx < serverConfig().hotkeys().size());
|
|
|
|
|
serverConfig().hotkeys().removeAt(idx);
|
|
|
|
|
m_pListActions->clear();
|
|
|
|
|
delete m_pListHotkeys->item(idx);
|
2021-08-20 12:22:07 +00:00
|
|
|
onChange();
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ServerConfigDialog::on_m_pListHotkeys_itemSelectionChanged()
|
|
|
|
|
{
|
2016-12-28 11:50:32 +00:00
|
|
|
bool itemsSelected = !m_pListHotkeys->selectedItems().isEmpty();
|
|
|
|
|
m_pButtonEditHotkey->setEnabled(itemsSelected);
|
|
|
|
|
m_pButtonRemoveHotkey->setEnabled(itemsSelected);
|
|
|
|
|
m_pButtonNewAction->setEnabled(itemsSelected);
|
|
|
|
|
|
|
|
|
|
if (itemsSelected && serverConfig().hotkeys().size() > 0)
|
|
|
|
|
{
|
|
|
|
|
m_pListActions->clear();
|
|
|
|
|
|
|
|
|
|
int idx = m_pListHotkeys->row(m_pListHotkeys->selectedItems()[0]);
|
|
|
|
|
|
|
|
|
|
// There's a bug somewhere around here: We get idx == 1 right after we deleted the next to last item, so idx can
|
|
|
|
|
// only possibly be 0. GDB shows we got called indirectly from the delete line in
|
|
|
|
|
// on_m_pButtonRemoveHotkey_clicked() above, but the delete is of course necessary and seems correct.
|
|
|
|
|
// The while() is a generalized workaround for all that and shouldn't be required.
|
|
|
|
|
while (idx >= 0 && idx >= serverConfig().hotkeys().size())
|
|
|
|
|
idx--;
|
|
|
|
|
|
|
|
|
|
Q_ASSERT(idx >= 0 && idx < serverConfig().hotkeys().size());
|
|
|
|
|
|
|
|
|
|
const Hotkey& hotkey = serverConfig().hotkeys()[idx];
|
|
|
|
|
foreach(const Action& action, hotkey.actions())
|
|
|
|
|
m_pListActions->addItem(action.text());
|
|
|
|
|
}
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ServerConfigDialog::on_m_pButtonNewAction_clicked()
|
|
|
|
|
{
|
2016-12-28 11:50:32 +00:00
|
|
|
int idx = m_pListHotkeys->currentRow();
|
|
|
|
|
Q_ASSERT(idx >= 0 && idx < serverConfig().hotkeys().size());
|
|
|
|
|
Hotkey& hotkey = serverConfig().hotkeys()[idx];
|
|
|
|
|
|
|
|
|
|
Action action;
|
|
|
|
|
ActionDialog dlg(this, serverConfig(), hotkey, action);
|
|
|
|
|
if (dlg.exec() == QDialog::Accepted)
|
|
|
|
|
{
|
|
|
|
|
hotkey.actions().append(action);
|
|
|
|
|
m_pListActions->addItem(action.text());
|
2021-08-20 12:22:07 +00:00
|
|
|
onChange();
|
2016-12-28 11:50:32 +00:00
|
|
|
}
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ServerConfigDialog::on_m_pButtonEditAction_clicked()
|
|
|
|
|
{
|
2016-12-28 11:50:32 +00:00
|
|
|
int idxHotkey = m_pListHotkeys->currentRow();
|
|
|
|
|
Q_ASSERT(idxHotkey >= 0 && idxHotkey < serverConfig().hotkeys().size());
|
|
|
|
|
Hotkey& hotkey = serverConfig().hotkeys()[idxHotkey];
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2016-12-28 11:50:32 +00:00
|
|
|
int idxAction = m_pListActions->currentRow();
|
|
|
|
|
Q_ASSERT(idxAction >= 0 && idxAction < hotkey.actions().size());
|
|
|
|
|
Action& action = hotkey.actions()[idxAction];
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2016-12-28 11:50:32 +00:00
|
|
|
ActionDialog dlg(this, serverConfig(), hotkey, action);
|
2021-08-20 12:22:07 +00:00
|
|
|
if (dlg.exec() == QDialog::Accepted) {
|
2016-12-28 11:50:32 +00:00
|
|
|
m_pListActions->currentItem()->setText(action.text());
|
2021-08-20 12:22:07 +00:00
|
|
|
onChange();
|
|
|
|
|
}
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ServerConfigDialog::on_m_pButtonRemoveAction_clicked()
|
|
|
|
|
{
|
2016-12-28 11:50:32 +00:00
|
|
|
int idxHotkey = m_pListHotkeys->currentRow();
|
|
|
|
|
Q_ASSERT(idxHotkey >= 0 && idxHotkey < serverConfig().hotkeys().size());
|
|
|
|
|
Hotkey& hotkey = serverConfig().hotkeys()[idxHotkey];
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2016-12-28 11:50:32 +00:00
|
|
|
int idxAction = m_pListActions->currentRow();
|
|
|
|
|
Q_ASSERT(idxAction >= 0 && idxAction < hotkey.actions().size());
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2016-12-28 11:50:32 +00:00
|
|
|
hotkey.actions().removeAt(idxAction);
|
|
|
|
|
delete m_pListActions->currentItem();
|
2021-08-20 12:22:07 +00:00
|
|
|
onChange();
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
2017-01-30 14:45:30 +00:00
|
|
|
void ServerConfigDialog::on_m_pCheckBoxEnableClipboard_stateChanged(int const state)
|
|
|
|
|
{
|
|
|
|
|
m_pSpinBoxClipboardSizeLimit->setEnabled (state == Qt::Checked);
|
2017-01-30 14:57:53 +00:00
|
|
|
if ((state == Qt::Checked) && (!m_pSpinBoxClipboardSizeLimit->value())) {
|
2018-08-01 12:03:41 +00:00
|
|
|
int size = static_cast<int>((serverConfig().defaultClipboardSharingSize() + 512) / 1024);
|
2017-01-30 14:57:53 +00:00
|
|
|
m_pSpinBoxClipboardSizeLimit->setValue (size ? size : 1);
|
|
|
|
|
}
|
2017-01-30 14:45:30 +00:00
|
|
|
}
|
|
|
|
|
|
2012-06-10 16:50:54 +00:00
|
|
|
void ServerConfigDialog::on_m_pListActions_itemSelectionChanged()
|
|
|
|
|
{
|
2016-12-28 11:50:32 +00:00
|
|
|
m_pButtonEditAction->setEnabled(!m_pListActions->selectedItems().isEmpty());
|
|
|
|
|
m_pButtonRemoveAction->setEnabled(!m_pListActions->selectedItems().isEmpty());
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
2021-04-09 14:53:27 +00:00
|
|
|
|
|
|
|
|
void ServerConfigDialog::on_m_pButtonAddComputer_clicked()
|
|
|
|
|
{
|
Synergy 1161 when clicking on save preferences on configure server window, automatically apply all the new settings (#7081)
* SYNERGY-1161 When clicking on "Save" preferences on "Configure server" window, automatically apply all the new settings
*Added comparison for all classes which used in server config
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Added server config changes checking logic
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
* Update ChangeLog
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Fix code style
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
* Fix Linux build
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Fix Sonar code smells
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Fix Ubuntu, CentOS and Debian build
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Fix merge conflicts
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Update ChangeLog
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Fix server config OK button behaviour on autoconfig
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Update changelog
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Fix sonar codesmell
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Fix build
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Adding client on autoconfig silently
Co-authored-by: Andrii Batyiev <andrii-external@symless.com>
2021-09-06 08:25:55 +00:00
|
|
|
addComputer("", false);
|
2021-04-09 14:53:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ServerConfigDialog::onScreenRemoved()
|
|
|
|
|
{
|
|
|
|
|
m_pButtonAddComputer->setEnabled(true);
|
2021-08-20 12:22:07 +00:00
|
|
|
onChange();
|
2021-04-09 14:53:27 +00:00
|
|
|
}
|
2021-04-13 16:04:58 +00:00
|
|
|
|
2021-04-12 09:03:37 +00:00
|
|
|
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;
|
|
|
|
|
}
|
2021-08-20 12:22:07 +00:00
|
|
|
|
Synergy 1161 when clicking on save preferences on configure server window, automatically apply all the new settings (#7081)
* SYNERGY-1161 When clicking on "Save" preferences on "Configure server" window, automatically apply all the new settings
*Added comparison for all classes which used in server config
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Added server config changes checking logic
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
* Update ChangeLog
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Fix code style
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
* Fix Linux build
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Fix Sonar code smells
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Fix Ubuntu, CentOS and Debian build
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Fix merge conflicts
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Update ChangeLog
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Fix server config OK button behaviour on autoconfig
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Update changelog
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Fix sonar codesmell
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Fix build
* SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings
*Adding client on autoconfig silently
Co-authored-by: Andrii Batyiev <andrii-external@symless.com>
2021-09-06 08:25:55 +00:00
|
|
|
bool ServerConfigDialog::addComputer(const QString& clientName, bool doSilent)
|
|
|
|
|
{
|
|
|
|
|
bool isAccepted = false;
|
|
|
|
|
Screen newScreen(clientName);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ScreenSettingsDialog dlg(this, &newScreen, &model().m_Screens);
|
|
|
|
|
if (doSilent || dlg.exec() == QDialog::Accepted)
|
|
|
|
|
{
|
|
|
|
|
model().addScreen(newScreen);
|
|
|
|
|
isAccepted = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_pButtonAddComputer->setEnabled(!model().isFull());
|
|
|
|
|
return isAccepted;
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-20 12:22:07 +00:00
|
|
|
void ServerConfigDialog::onChange()
|
|
|
|
|
{
|
|
|
|
|
bool isAppConfigDataEqual = m_OrigServerAppConfigUseExternalConfig == serverConfig().getUseExternalConfig() &&
|
|
|
|
|
m_OrigServerAppConfigExternalConfigFile == serverConfig().getConfigFile();
|
|
|
|
|
m_pButtonBox->button(QDialogButtonBox::Ok)->setEnabled(!isAppConfigDataEqual || !(m_OrigServerConfig == m_ServerConfig));
|
|
|
|
|
}
|