refactor(Settings): move disableLockToComputer to general settings
This commit is contained in:
parent
69b9baaaeb
commit
b665c730b7
9 changed files with 24 additions and 28 deletions
|
|
@ -142,6 +142,7 @@ This section contains options used when in server mode it will begin with `[serv
|
||||||
|
|
||||||
|Option | Valid Values |Description|
|
|Option | Valid Values |Description|
|
||||||
|:-------------------|:-----------------:|:-----------|
|
|:-------------------|:-----------------:|:-----------|
|
||||||
|
| disableLockToComputer| `true` or `false` | If false pressing scroll lock will toggle your cursor to be locked to current computer. (default: false) |
|
||||||
| enableHeartbeat | `true` or `false` | Send a heartbeat to connected clients; this has been replaced by internal keep alive (default: false)|
|
| enableHeartbeat | `true` or `false` | Send a heartbeat to connected clients; this has been replaced by internal keep alive (default: false)|
|
||||||
| enableSwitchDelay | `true` or `false` | Switching will be delayed by the set value (default: false)|
|
| enableSwitchDelay | `true` or `false` | Switching will be delayed by the set value (default: false)|
|
||||||
| enableSwitchDoubleTap | `true` or `false` | Enables the doubletap to switch method (default: false)|
|
| enableSwitchDoubleTap | `true` or `false` | Enables the doubletap to switch method (default: false)|
|
||||||
|
|
@ -169,7 +170,6 @@ block of a server config file as seen below. This section is used by the GUI to
|
||||||
clipboardSharing=true
|
clipboardSharing=true
|
||||||
clipboardSharingSize=@Variant(\0\0\0\x84\0\0\0\0\0\0<\0)
|
clipboardSharingSize=@Variant(\0\0\0\x84\0\0\0\0\0\0<\0)
|
||||||
defaultLockToScreenState=false
|
defaultLockToScreenState=false
|
||||||
disableLockToScreen=false
|
|
||||||
hotkeys\1\actions\1\activeOnRelease=false
|
hotkeys\1\actions\1\activeOnRelease=false
|
||||||
hotkeys\1\actions\1\hasScreens=true
|
hotkeys\1\actions\1\hasScreens=true
|
||||||
hotkeys\1\actions\1\keys\1\key=83
|
hotkeys\1\actions\1\keys\1\key=83
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,7 @@ public:
|
||||||
};
|
};
|
||||||
struct Server
|
struct Server
|
||||||
{
|
{
|
||||||
|
inline static const auto DisableLockToComputer = QStringLiteral("server/disableLockToComputer");
|
||||||
inline static const auto EnableHeatbeat = QStringLiteral("server/enableHeatbeat");
|
inline static const auto EnableHeatbeat = QStringLiteral("server/enableHeatbeat");
|
||||||
inline static const auto EnableSwitchDelay = QStringLiteral("server/enableSwitchDelay");
|
inline static const auto EnableSwitchDelay = QStringLiteral("server/enableSwitchDelay");
|
||||||
inline static const auto EnableSwitchDoubleTap = QStringLiteral("server/enableSwitchDoubleTap");
|
inline static const auto EnableSwitchDoubleTap = QStringLiteral("server/enableSwitchDoubleTap");
|
||||||
|
|
@ -251,6 +252,7 @@ private:
|
||||||
, Settings::Security::CheckPeers
|
, Settings::Security::CheckPeers
|
||||||
, Settings::Security::KeySize
|
, Settings::Security::KeySize
|
||||||
, Settings::Security::TlsEnabled
|
, Settings::Security::TlsEnabled
|
||||||
|
, Settings::Server::DisableLockToComputer
|
||||||
, Settings::Server::EnableHeatbeat
|
, Settings::Server::EnableHeatbeat
|
||||||
, Settings::Server::EnableSwitchDelay
|
, Settings::Server::EnableSwitchDelay
|
||||||
, Settings::Server::EnableSwitchDoubleTap
|
, Settings::Server::EnableSwitchDoubleTap
|
||||||
|
|
@ -284,6 +286,7 @@ private:
|
||||||
, Settings::Client::InvertXScroll
|
, Settings::Client::InvertXScroll
|
||||||
, Settings::Log::ToFile
|
, Settings::Log::ToFile
|
||||||
, Settings::Log::GuiDebug
|
, Settings::Log::GuiDebug
|
||||||
|
, Settings::Server::DisableLockToComputer
|
||||||
, Settings::Server::EnableHeatbeat
|
, Settings::Server::EnableHeatbeat
|
||||||
, Settings::Server::EnableSwitchDelay
|
, Settings::Server::EnableSwitchDelay
|
||||||
, Settings::Server::EnableSwitchDoubleTap
|
, Settings::Server::EnableSwitchDoubleTap
|
||||||
|
|
@ -314,7 +317,8 @@ private:
|
||||||
};
|
};
|
||||||
// Contains settings removed from server-configuration file
|
// Contains settings removed from server-configuration file
|
||||||
inline static const QStringList m_oldServerConfigKeys = {
|
inline static const QStringList m_oldServerConfigKeys = {
|
||||||
QStringLiteral("internalConfig/hasHeartbeat")
|
QStringLiteral("internalConfig/disableLockToScreen")
|
||||||
|
, QStringLiteral("internalConfig/hasHeartbeat")
|
||||||
, QStringLiteral("internalConfig/hasSwitchDelay")
|
, QStringLiteral("internalConfig/hasSwitchDelay")
|
||||||
, QStringLiteral("internalConfig/hasSwitchDoubleTap")
|
, QStringLiteral("internalConfig/hasSwitchDoubleTap")
|
||||||
, QStringLiteral("internalConfig/heartbeat")
|
, QStringLiteral("internalConfig/heartbeat")
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,6 @@ bool ServerConfig::operator==(const ServerConfig &sc) const
|
||||||
m_SwitchCorners == sc.m_SwitchCorners && //
|
m_SwitchCorners == sc.m_SwitchCorners && //
|
||||||
m_Hotkeys == sc.m_Hotkeys && //
|
m_Hotkeys == sc.m_Hotkeys && //
|
||||||
m_DefaultLockToScreenState == sc.m_DefaultLockToScreenState && //
|
m_DefaultLockToScreenState == sc.m_DefaultLockToScreenState && //
|
||||||
m_DisableLockToScreen == sc.m_DisableLockToScreen && //
|
|
||||||
m_ClipboardSharing == sc.m_ClipboardSharing && //
|
m_ClipboardSharing == sc.m_ClipboardSharing && //
|
||||||
m_ClipboardSharingSize == sc.m_ClipboardSharingSize;
|
m_ClipboardSharingSize == sc.m_ClipboardSharingSize;
|
||||||
}
|
}
|
||||||
|
|
@ -93,7 +92,6 @@ void ServerConfig::commit()
|
||||||
|
|
||||||
settings().setValue("switchCornerSize", switchCornerSize());
|
settings().setValue("switchCornerSize", switchCornerSize());
|
||||||
settings().setValue("defaultLockToScreenState", defaultLockToScreenState());
|
settings().setValue("defaultLockToScreenState", defaultLockToScreenState());
|
||||||
settings().setValue("disableLockToScreen", disableLockToScreen());
|
|
||||||
settings().setValue("clipboardSharing", clipboardSharing());
|
settings().setValue("clipboardSharing", clipboardSharing());
|
||||||
settings().setValue("clipboardSharingSize", QVariant::fromValue(clipboardSharingSize()));
|
settings().setValue("clipboardSharingSize", QVariant::fromValue(clipboardSharingSize()));
|
||||||
|
|
||||||
|
|
@ -136,7 +134,6 @@ void ServerConfig::recall()
|
||||||
|
|
||||||
setSwitchCornerSize(settings().value("switchCornerSize").toInt());
|
setSwitchCornerSize(settings().value("switchCornerSize").toInt());
|
||||||
setDefaultLockToScreenState(settings().value("defaultLockToScreenState", false).toBool());
|
setDefaultLockToScreenState(settings().value("defaultLockToScreenState", false).toBool());
|
||||||
setDisableLockToScreen(settings().value("disableLockToScreen", false).toBool());
|
|
||||||
setClipboardSharingSize(
|
setClipboardSharingSize(
|
||||||
settings().value("clipboardSharingSize", (int)ServerConfig::defaultClipboardSharingSize()).toULongLong()
|
settings().value("clipboardSharingSize", (int)ServerConfig::defaultClipboardSharingSize()).toULongLong()
|
||||||
);
|
);
|
||||||
|
|
@ -224,8 +221,6 @@ QTextStream &operator<<(QTextStream &outStream, const ServerConfig &config)
|
||||||
outStream << "section: options" << Qt::endl;
|
outStream << "section: options" << Qt::endl;
|
||||||
outStream << "\t"
|
outStream << "\t"
|
||||||
<< "defaultLockToScreenState = " << (config.defaultLockToScreenState() ? "true" : "false") << Qt::endl;
|
<< "defaultLockToScreenState = " << (config.defaultLockToScreenState() ? "true" : "false") << Qt::endl;
|
||||||
outStream << "\t"
|
|
||||||
<< "disableLockToScreen = " << (config.disableLockToScreen() ? "true" : "false") << Qt::endl;
|
|
||||||
outStream << "\t"
|
outStream << "\t"
|
||||||
<< "clipboardSharing = " << (config.clipboardSharing() ? "true" : "false") << Qt::endl;
|
<< "clipboardSharing = " << (config.clipboardSharing() ? "true" : "false") << Qt::endl;
|
||||||
outStream << "\t"
|
outStream << "\t"
|
||||||
|
|
|
||||||
|
|
@ -60,10 +60,6 @@ public:
|
||||||
{
|
{
|
||||||
return m_DefaultLockToScreenState;
|
return m_DefaultLockToScreenState;
|
||||||
}
|
}
|
||||||
bool disableLockToScreen() const
|
|
||||||
{
|
|
||||||
return m_DisableLockToScreen;
|
|
||||||
}
|
|
||||||
bool clipboardSharing() const
|
bool clipboardSharing() const
|
||||||
{
|
{
|
||||||
return m_ClipboardSharing;
|
return m_ClipboardSharing;
|
||||||
|
|
@ -114,10 +110,6 @@ private:
|
||||||
{
|
{
|
||||||
m_DefaultLockToScreenState = on;
|
m_DefaultLockToScreenState = on;
|
||||||
}
|
}
|
||||||
void setDisableLockToScreen(bool on)
|
|
||||||
{
|
|
||||||
m_DisableLockToScreen = on;
|
|
||||||
}
|
|
||||||
void setClipboardSharing(bool on)
|
void setClipboardSharing(bool on)
|
||||||
{
|
{
|
||||||
m_ClipboardSharing = on;
|
m_ClipboardSharing = on;
|
||||||
|
|
@ -140,7 +132,6 @@ private:
|
||||||
private:
|
private:
|
||||||
int m_SwitchCornerSize = 0;
|
int m_SwitchCornerSize = 0;
|
||||||
bool m_DefaultLockToScreenState = false;
|
bool m_DefaultLockToScreenState = false;
|
||||||
bool m_DisableLockToScreen = false;
|
|
||||||
bool m_ClipboardSharing = true;
|
bool m_ClipboardSharing = true;
|
||||||
QList<bool> m_SwitchCorners;
|
QList<bool> m_SwitchCorners;
|
||||||
HotkeyList m_Hotkeys;
|
HotkeyList m_Hotkeys;
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,7 @@ void ServerConfigDialog::accept()
|
||||||
Settings::setValue(Settings::Server::Heartbeat, m_heartbeatRate);
|
Settings::setValue(Settings::Server::Heartbeat, m_heartbeatRate);
|
||||||
Settings::setValue(Settings::Server::EnableSwitchDelay, m_enableSwitchDelay);
|
Settings::setValue(Settings::Server::EnableSwitchDelay, m_enableSwitchDelay);
|
||||||
Settings::setValue(Settings::Server::SwitchDelay, m_switchDelay);
|
Settings::setValue(Settings::Server::SwitchDelay, m_switchDelay);
|
||||||
|
Settings::setValue(Settings::Server::DisableLockToComputer, m_disableLockToComputer);
|
||||||
Settings::setValue(Settings::Server::EnableSwitchDoubleTap, m_enableSwitchDoubleTap);
|
Settings::setValue(Settings::Server::EnableSwitchDoubleTap, m_enableSwitchDoubleTap);
|
||||||
Settings::setValue(Settings::Server::SwitchDoubleTap, m_switchDoubleTap);
|
Settings::setValue(Settings::Server::SwitchDoubleTap, m_switchDoubleTap);
|
||||||
Settings::setValue(Settings::Server::RelativeMouseMoves, m_relativeMouseMoves);
|
Settings::setValue(Settings::Server::RelativeMouseMoves, m_relativeMouseMoves);
|
||||||
|
|
@ -332,9 +333,11 @@ void ServerConfigDialog::toggleDefaultLockToScreenState(bool state)
|
||||||
onChange();
|
onChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerConfigDialog::toggleLockToScreen(bool disabled)
|
void ServerConfigDialog::toggleLockToComputer(bool disabled)
|
||||||
{
|
{
|
||||||
serverConfig().setDisableLockToScreen(disabled);
|
if (m_disableLockToComputer == disabled)
|
||||||
|
return;
|
||||||
|
m_disableLockToComputer = disabled;
|
||||||
onChange();
|
onChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -363,7 +366,6 @@ void ServerConfigDialog::toggleExternalConfig(bool checked)
|
||||||
ui->tabWidget->setTabEnabled(0, !checked);
|
ui->tabWidget->setTabEnabled(0, !checked);
|
||||||
ui->tabWidget->setTabEnabled(1, !checked);
|
ui->tabWidget->setTabEnabled(1, !checked);
|
||||||
ui->cbDefaultLockToScreenState->setEnabled(!checked);
|
ui->cbDefaultLockToScreenState->setEnabled(!checked);
|
||||||
ui->cbDisableLockToScreen->setEnabled(!checked);
|
|
||||||
ui->cbEnableClipboard->setEnabled(!checked);
|
ui->cbEnableClipboard->setEnabled(!checked);
|
||||||
ui->label_7->setEnabled(checked ? !checked : ui->cbEnableClipboard->isChecked());
|
ui->label_7->setEnabled(checked ? !checked : ui->cbEnableClipboard->isChecked());
|
||||||
ui->sbClipboardSizeLimit->setEnabled(checked ? !checked : ui->cbEnableClipboard->isChecked());
|
ui->sbClipboardSizeLimit->setEnabled(checked ? !checked : ui->cbEnableClipboard->isChecked());
|
||||||
|
|
@ -438,7 +440,9 @@ void ServerConfigDialog::loadFromConfig()
|
||||||
ui->sbSwitchCornerSize->setValue(serverConfig().switchCornerSize());
|
ui->sbSwitchCornerSize->setValue(serverConfig().switchCornerSize());
|
||||||
ui->cbDefaultLockToScreenState->setChecked(serverConfig().defaultLockToScreenState());
|
ui->cbDefaultLockToScreenState->setChecked(serverConfig().defaultLockToScreenState());
|
||||||
|
|
||||||
ui->cbDisableLockToScreen->setChecked(serverConfig().disableLockToScreen());
|
m_disableLockToComputer = Settings::value(Settings::Server::DisableLockToComputer).toBool();
|
||||||
|
ui->cbDisableLockToComputer->setChecked(m_disableLockToComputer);
|
||||||
|
|
||||||
ui->cbEnableClipboard->setChecked(serverConfig().clipboardSharing());
|
ui->cbEnableClipboard->setChecked(serverConfig().clipboardSharing());
|
||||||
|
|
||||||
auto clipboardSharingSizeM = static_cast<int>(serverConfig().clipboardSharingSize() / 1024);
|
auto clipboardSharingSizeM = static_cast<int>(serverConfig().clipboardSharingSize() / 1024);
|
||||||
|
|
@ -518,7 +522,7 @@ void ServerConfigDialog::initConnections()
|
||||||
connect(
|
connect(
|
||||||
ui->cbDefaultLockToScreenState, &QCheckBox::toggled, this, &ServerConfigDialog::toggleDefaultLockToScreenState
|
ui->cbDefaultLockToScreenState, &QCheckBox::toggled, this, &ServerConfigDialog::toggleDefaultLockToScreenState
|
||||||
);
|
);
|
||||||
connect(ui->cbDisableLockToScreen, &QCheckBox::toggled, this, &ServerConfigDialog::toggleLockToScreen);
|
connect(ui->cbDisableLockToComputer, &QCheckBox::toggled, this, &ServerConfigDialog::toggleLockToComputer);
|
||||||
connect(&m_screenSetupModel, &ScreenSetupModel::screensChanged, this, &ServerConfigDialog::onChange);
|
connect(&m_screenSetupModel, &ScreenSetupModel::screensChanged, this, &ServerConfigDialog::onChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -549,7 +553,8 @@ void ServerConfigDialog::onChange()
|
||||||
m_enableSwitchDoubleTap == Settings::value(Settings::Server::EnableSwitchDoubleTap).toBool() &&
|
m_enableSwitchDoubleTap == Settings::value(Settings::Server::EnableSwitchDoubleTap).toBool() &&
|
||||||
m_switchDoubleTap == Settings::value(Settings::Server::SwitchDoubleTap).toInt() &&
|
m_switchDoubleTap == Settings::value(Settings::Server::SwitchDoubleTap).toInt() &&
|
||||||
m_relativeMouseMoves == Settings::value(Settings::Server::RelativeMouseMoves).toBool() &&
|
m_relativeMouseMoves == Settings::value(Settings::Server::RelativeMouseMoves).toBool() &&
|
||||||
m_win32keepForeground == Settings::value(Settings::Server::Win32KeepForeground).toBool();
|
m_win32keepForeground == Settings::value(Settings::Server::Win32KeepForeground).toBool() &&
|
||||||
|
m_disableLockToComputer == Settings::value(Settings::Server::DisableLockToComputer).toBool();
|
||||||
ui->buttonBox->button(QDialogButtonBox::Ok)
|
ui->buttonBox->button(QDialogButtonBox::Ok)
|
||||||
->setEnabled(!isAppConfigDataEqual || !(m_originalServerConfig == m_serverConfig));
|
->setEnabled(!isAppConfigDataEqual || !(m_originalServerConfig == m_serverConfig));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ protected:
|
||||||
void setSwitchDelay(int delay);
|
void setSwitchDelay(int delay);
|
||||||
|
|
||||||
void toggleDefaultLockToScreenState(bool state);
|
void toggleDefaultLockToScreenState(bool state);
|
||||||
void toggleLockToScreen(bool disabled);
|
void toggleLockToComputer(bool disabled);
|
||||||
void toggleWin32Foreground(bool enabled);
|
void toggleWin32Foreground(bool enabled);
|
||||||
|
|
||||||
void toggleClipboard(bool enabled);
|
void toggleClipboard(bool enabled);
|
||||||
|
|
@ -113,6 +113,7 @@ private:
|
||||||
bool m_enableSwitchDoubleTap;
|
bool m_enableSwitchDoubleTap;
|
||||||
bool m_originalServerConfigIsExternal;
|
bool m_originalServerConfigIsExternal;
|
||||||
bool m_win32keepForeground;
|
bool m_win32keepForeground;
|
||||||
|
bool m_disableLockToComputer;
|
||||||
QString m_originalServerConfigUsesExternalFile;
|
QString m_originalServerConfigUsesExternalFile;
|
||||||
ServerConfig m_serverConfig;
|
ServerConfig m_serverConfig;
|
||||||
ScreenSetupModel m_screenSetupModel;
|
ScreenSetupModel m_screenSetupModel;
|
||||||
|
|
|
||||||
|
|
@ -428,7 +428,7 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="cbDisableLockToScreen">
|
<widget class="QCheckBox" name="cbDisableLockToComputer">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Disable lock to computer (scroll lock key)</string>
|
<string>Disable lock to computer (scroll lock key)</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
||||||
|
|
@ -658,8 +658,6 @@ void Config::readSectionOptions(ConfigReadContext &s)
|
||||||
addOption("", kOptionScreenSwitchNeedsAlt, s.parseBoolean(value));
|
addOption("", kOptionScreenSwitchNeedsAlt, s.parseBoolean(value));
|
||||||
} else if (name == "defaultLockToScreenState") {
|
} else if (name == "defaultLockToScreenState") {
|
||||||
addOption("", kOptionDefaultLockToScreenState, s.parseBoolean(value));
|
addOption("", kOptionDefaultLockToScreenState, s.parseBoolean(value));
|
||||||
} else if (name == "disableLockToScreen") {
|
|
||||||
addOption("", kOptionDisableLockToScreen, s.parseBoolean(value));
|
|
||||||
} else if (name == "clipboardSharing") {
|
} else if (name == "clipboardSharing") {
|
||||||
addOption("", kOptionClipboardSharing, s.parseBoolean(value));
|
addOption("", kOptionClipboardSharing, s.parseBoolean(value));
|
||||||
} else if (name == "clipboardSharingSize") {
|
} else if (name == "clipboardSharingSize") {
|
||||||
|
|
@ -724,6 +722,7 @@ void Config::readSectionOptions(ConfigReadContext &s)
|
||||||
addOption("", kOptionScreenSwitchTwoTap, Settings::value(Settings::Server::SwitchDoubleTap).toInt());
|
addOption("", kOptionScreenSwitchTwoTap, Settings::value(Settings::Server::SwitchDoubleTap).toInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addOption("", kOptionDisableLockToScreen, Settings::value(Settings::Server::DisableLockToComputer).toInt());
|
||||||
addOption("", kOptionRelativeMouseMoves, Settings::value(Settings::Server::RelativeMouseMoves).toInt());
|
addOption("", kOptionRelativeMouseMoves, Settings::value(Settings::Server::RelativeMouseMoves).toInt());
|
||||||
addOption("", kOptionWin32KeepForeground, Settings::value(Settings::Server::Win32KeepForeground).toInt());
|
addOption("", kOptionWin32KeepForeground, Settings::value(Settings::Server::Win32KeepForeground).toInt());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -476,8 +476,9 @@ private:
|
||||||
bool m_hasLockToScreenAction = false;
|
bool m_hasLockToScreenAction = false;
|
||||||
IEventQueue *m_events;
|
IEventQueue *m_events;
|
||||||
inline static const QStringList m_oldNames = {
|
inline static const QStringList m_oldNames = {
|
||||||
QStringLiteral("protocol"), QStringLiteral("heartbeat"), QStringLiteral("switchDelay"),
|
QStringLiteral("protocol"), QStringLiteral("heartbeat"), QStringLiteral("switchDelay"),
|
||||||
QStringLiteral("switchDoubleTap"), QStringLiteral("relativeMouseMoves"), QStringLiteral("win32KeepForeground")
|
QStringLiteral("switchDoubleTap"), QStringLiteral("relativeMouseMoves"), QStringLiteral("win32KeepForeground"),
|
||||||
|
QStringLiteral("disableLockToScreen")
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue