refactor(Settings): move defaultLockToScreenState to general settings
This commit is contained in:
parent
b665c730b7
commit
eb6930a062
8 changed files with 30 additions and 30 deletions
|
|
@ -142,6 +142,7 @@ This section contains options used when in server mode it will begin with `[serv
|
|||
|
||||
|Option | Valid Values |Description|
|
||||
|:-------------------|:-----------------:|:-----------|
|
||||
| defaultLockToComputerState| `true` or `false` | When this is true the cursor is locked to the new computer when switching (default: false)|
|
||||
| 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)|
|
||||
| enableSwitchDelay | `true` or `false` | Switching will be delayed by the set value (default: false)|
|
||||
|
|
@ -169,7 +170,6 @@ block of a server config file as seen below. This section is used by the GUI to
|
|||
[internalConfig]
|
||||
clipboardSharing=true
|
||||
clipboardSharingSize=@Variant(\0\0\0\x84\0\0\0\0\0\0<\0)
|
||||
defaultLockToScreenState=false
|
||||
hotkeys\1\actions\1\activeOnRelease=false
|
||||
hotkeys\1\actions\1\hasScreens=true
|
||||
hotkeys\1\actions\1\keys\1\key=83
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ public:
|
|||
};
|
||||
struct Server
|
||||
{
|
||||
inline static const auto DefaultLockToComputerState = QStringLiteral("server/defaultLockToComputerState");
|
||||
inline static const auto DisableLockToComputer = QStringLiteral("server/disableLockToComputer");
|
||||
inline static const auto EnableHeatbeat = QStringLiteral("server/enableHeatbeat");
|
||||
inline static const auto EnableSwitchDelay = QStringLiteral("server/enableSwitchDelay");
|
||||
|
|
@ -252,6 +253,7 @@ private:
|
|||
, Settings::Security::CheckPeers
|
||||
, Settings::Security::KeySize
|
||||
, Settings::Security::TlsEnabled
|
||||
, Settings::Server::DefaultLockToComputerState
|
||||
, Settings::Server::DisableLockToComputer
|
||||
, Settings::Server::EnableHeatbeat
|
||||
, Settings::Server::EnableSwitchDelay
|
||||
|
|
@ -286,6 +288,7 @@ private:
|
|||
, Settings::Client::InvertXScroll
|
||||
, Settings::Log::ToFile
|
||||
, Settings::Log::GuiDebug
|
||||
, Settings::Server::DefaultLockToComputerState
|
||||
, Settings::Server::DisableLockToComputer
|
||||
, Settings::Server::EnableHeatbeat
|
||||
, Settings::Server::EnableSwitchDelay
|
||||
|
|
@ -317,7 +320,8 @@ private:
|
|||
};
|
||||
// Contains settings removed from server-configuration file
|
||||
inline static const QStringList m_oldServerConfigKeys = {
|
||||
QStringLiteral("internalConfig/disableLockToScreen")
|
||||
QStringLiteral("internalConfig/defaultLockToScreenState")
|
||||
, QStringLiteral("internalConfig/disableLockToScreen")
|
||||
, QStringLiteral("internalConfig/hasHeartbeat")
|
||||
, QStringLiteral("internalConfig/hasSwitchDelay")
|
||||
, QStringLiteral("internalConfig/hasSwitchDoubleTap")
|
||||
|
|
|
|||
|
|
@ -52,12 +52,11 @@ bool ServerConfig::save(const QString &fileName) const
|
|||
|
||||
bool ServerConfig::operator==(const ServerConfig &sc) const
|
||||
{
|
||||
return m_Screens == sc.m_Screens && //
|
||||
m_SwitchCornerSize == sc.m_SwitchCornerSize && //
|
||||
m_SwitchCorners == sc.m_SwitchCorners && //
|
||||
m_Hotkeys == sc.m_Hotkeys && //
|
||||
m_DefaultLockToScreenState == sc.m_DefaultLockToScreenState && //
|
||||
m_ClipboardSharing == sc.m_ClipboardSharing && //
|
||||
return m_Screens == sc.m_Screens && //
|
||||
m_SwitchCornerSize == sc.m_SwitchCornerSize && //
|
||||
m_SwitchCorners == sc.m_SwitchCorners && //
|
||||
m_Hotkeys == sc.m_Hotkeys && //
|
||||
m_ClipboardSharing == sc.m_ClipboardSharing && //
|
||||
m_ClipboardSharingSize == sc.m_ClipboardSharingSize;
|
||||
}
|
||||
|
||||
|
|
@ -91,7 +90,6 @@ void ServerConfig::commit()
|
|||
settings().remove("");
|
||||
|
||||
settings().setValue("switchCornerSize", switchCornerSize());
|
||||
settings().setValue("defaultLockToScreenState", defaultLockToScreenState());
|
||||
settings().setValue("clipboardSharing", clipboardSharing());
|
||||
settings().setValue("clipboardSharingSize", QVariant::fromValue(clipboardSharingSize()));
|
||||
|
||||
|
|
@ -133,7 +131,6 @@ void ServerConfig::recall()
|
|||
setupScreens();
|
||||
|
||||
setSwitchCornerSize(settings().value("switchCornerSize").toInt());
|
||||
setDefaultLockToScreenState(settings().value("defaultLockToScreenState", false).toBool());
|
||||
setClipboardSharingSize(
|
||||
settings().value("clipboardSharingSize", (int)ServerConfig::defaultClipboardSharingSize()).toULongLong()
|
||||
);
|
||||
|
|
@ -219,8 +216,6 @@ QTextStream &operator<<(QTextStream &outStream, const ServerConfig &config)
|
|||
outStream << "end" << Qt::endl << Qt::endl;
|
||||
|
||||
outStream << "section: options" << Qt::endl;
|
||||
outStream << "\t"
|
||||
<< "defaultLockToScreenState = " << (config.defaultLockToScreenState() ? "true" : "false") << Qt::endl;
|
||||
outStream << "\t"
|
||||
<< "clipboardSharing = " << (config.clipboardSharing() ? "true" : "false") << Qt::endl;
|
||||
outStream << "\t"
|
||||
|
|
|
|||
|
|
@ -56,10 +56,6 @@ public:
|
|||
{
|
||||
return m_Hotkeys;
|
||||
}
|
||||
bool defaultLockToScreenState() const
|
||||
{
|
||||
return m_DefaultLockToScreenState;
|
||||
}
|
||||
bool clipboardSharing() const
|
||||
{
|
||||
return m_ClipboardSharing;
|
||||
|
|
@ -106,10 +102,6 @@ private:
|
|||
{
|
||||
m_SwitchCornerSize = val;
|
||||
}
|
||||
void setDefaultLockToScreenState(bool on)
|
||||
{
|
||||
m_DefaultLockToScreenState = on;
|
||||
}
|
||||
void setClipboardSharing(bool on)
|
||||
{
|
||||
m_ClipboardSharing = on;
|
||||
|
|
@ -131,7 +123,6 @@ private:
|
|||
|
||||
private:
|
||||
int m_SwitchCornerSize = 0;
|
||||
bool m_DefaultLockToScreenState = false;
|
||||
bool m_ClipboardSharing = true;
|
||||
QList<bool> m_SwitchCorners;
|
||||
HotkeyList m_Hotkeys;
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ void ServerConfigDialog::accept()
|
|||
Settings::setValue(Settings::Server::Heartbeat, m_heartbeatRate);
|
||||
Settings::setValue(Settings::Server::EnableSwitchDelay, m_enableSwitchDelay);
|
||||
Settings::setValue(Settings::Server::SwitchDelay, m_switchDelay);
|
||||
Settings::setValue(Settings::Server::DefaultLockToComputerState, m_defaultLockToComputerState);
|
||||
Settings::setValue(Settings::Server::DisableLockToComputer, m_disableLockToComputer);
|
||||
Settings::setValue(Settings::Server::EnableSwitchDoubleTap, m_enableSwitchDoubleTap);
|
||||
Settings::setValue(Settings::Server::SwitchDoubleTap, m_switchDoubleTap);
|
||||
|
|
@ -329,7 +330,9 @@ void ServerConfigDialog::setSwitchDelay(int delay)
|
|||
|
||||
void ServerConfigDialog::toggleDefaultLockToScreenState(bool state)
|
||||
{
|
||||
serverConfig().setDefaultLockToScreenState(state);
|
||||
if (m_defaultLockToComputerState == state)
|
||||
return;
|
||||
m_defaultLockToComputerState = state;
|
||||
onChange();
|
||||
}
|
||||
|
||||
|
|
@ -365,7 +368,6 @@ void ServerConfigDialog::toggleExternalConfig(bool checked)
|
|||
ui->widgetExternalConfigControls->setEnabled(checked);
|
||||
ui->tabWidget->setTabEnabled(0, !checked);
|
||||
ui->tabWidget->setTabEnabled(1, !checked);
|
||||
ui->cbDefaultLockToScreenState->setEnabled(!checked);
|
||||
ui->cbEnableClipboard->setEnabled(!checked);
|
||||
ui->label_7->setEnabled(checked ? !checked : ui->cbEnableClipboard->isChecked());
|
||||
ui->sbClipboardSizeLimit->setEnabled(checked ? !checked : ui->cbEnableClipboard->isChecked());
|
||||
|
|
@ -438,7 +440,9 @@ void ServerConfigDialog::loadFromConfig()
|
|||
ui->cbCornerBottomLeft->setChecked(serverConfig().switchCorner(static_cast<int>(BottomLeft)));
|
||||
ui->cbCornerBottomRight->setChecked(serverConfig().switchCorner(static_cast<int>(BottomRight)));
|
||||
ui->sbSwitchCornerSize->setValue(serverConfig().switchCornerSize());
|
||||
ui->cbDefaultLockToScreenState->setChecked(serverConfig().defaultLockToScreenState());
|
||||
|
||||
m_defaultLockToComputerState = Settings::value(Settings::Server::DefaultLockToComputerState).toBool();
|
||||
ui->cbDefaultLockToScreenState->setChecked(m_defaultLockToComputerState);
|
||||
|
||||
m_disableLockToComputer = Settings::value(Settings::Server::DisableLockToComputer).toBool();
|
||||
ui->cbDisableLockToComputer->setChecked(m_disableLockToComputer);
|
||||
|
|
@ -554,7 +558,8 @@ void ServerConfigDialog::onChange()
|
|||
m_switchDoubleTap == Settings::value(Settings::Server::SwitchDoubleTap).toInt() &&
|
||||
m_relativeMouseMoves == Settings::value(Settings::Server::RelativeMouseMoves).toBool() &&
|
||||
m_win32keepForeground == Settings::value(Settings::Server::Win32KeepForeground).toBool() &&
|
||||
m_disableLockToComputer == Settings::value(Settings::Server::DisableLockToComputer).toBool();
|
||||
m_disableLockToComputer == Settings::value(Settings::Server::DisableLockToComputer).toBool() &&
|
||||
m_defaultLockToComputerState == Settings::value(Settings::Server::DefaultLockToComputerState).toBool();
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)
|
||||
->setEnabled(!isAppConfigDataEqual || !(m_originalServerConfig == m_serverConfig));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,6 +114,7 @@ private:
|
|||
bool m_originalServerConfigIsExternal;
|
||||
bool m_win32keepForeground;
|
||||
bool m_disableLockToComputer;
|
||||
bool m_defaultLockToComputerState;
|
||||
QString m_originalServerConfigUsesExternalFile;
|
||||
ServerConfig m_serverConfig;
|
||||
ScreenSetupModel m_screenSetupModel;
|
||||
|
|
|
|||
|
|
@ -656,8 +656,6 @@ void Config::readSectionOptions(ConfigReadContext &s)
|
|||
addOption("", kOptionScreenSwitchNeedsControl, s.parseBoolean(value));
|
||||
} else if (name == "switchNeedsAlt") {
|
||||
addOption("", kOptionScreenSwitchNeedsAlt, s.parseBoolean(value));
|
||||
} else if (name == "defaultLockToScreenState") {
|
||||
addOption("", kOptionDefaultLockToScreenState, s.parseBoolean(value));
|
||||
} else if (name == "clipboardSharing") {
|
||||
addOption("", kOptionClipboardSharing, s.parseBoolean(value));
|
||||
} else if (name == "clipboardSharingSize") {
|
||||
|
|
@ -722,6 +720,7 @@ void Config::readSectionOptions(ConfigReadContext &s)
|
|||
addOption("", kOptionScreenSwitchTwoTap, Settings::value(Settings::Server::SwitchDoubleTap).toInt());
|
||||
}
|
||||
|
||||
addOption("", kOptionDefaultLockToScreenState, Settings::value(Settings::Server::DefaultLockToComputerState).toInt());
|
||||
addOption("", kOptionDisableLockToScreen, Settings::value(Settings::Server::DisableLockToComputer).toInt());
|
||||
addOption("", kOptionRelativeMouseMoves, Settings::value(Settings::Server::RelativeMouseMoves).toInt());
|
||||
addOption("", kOptionWin32KeepForeground, Settings::value(Settings::Server::Win32KeepForeground).toInt());
|
||||
|
|
|
|||
|
|
@ -476,9 +476,14 @@ private:
|
|||
bool m_hasLockToScreenAction = false;
|
||||
IEventQueue *m_events;
|
||||
inline static const QStringList m_oldNames = {
|
||||
QStringLiteral("protocol"), QStringLiteral("heartbeat"), QStringLiteral("switchDelay"),
|
||||
QStringLiteral("switchDoubleTap"), QStringLiteral("relativeMouseMoves"), QStringLiteral("win32KeepForeground"),
|
||||
QStringLiteral("disableLockToScreen")
|
||||
QStringLiteral("protocol"),
|
||||
QStringLiteral("heartbeat"),
|
||||
QStringLiteral("switchDelay"),
|
||||
QStringLiteral("switchDoubleTap"),
|
||||
QStringLiteral("relativeMouseMoves"),
|
||||
QStringLiteral("win32KeepForeground"),
|
||||
QStringLiteral("disableLockToScreen"),
|
||||
QStringLiteral("defaultLockToScreenState")
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue