refactor: mv hasSwitchDelay to general settings
This commit is contained in:
parent
d665b55111
commit
f686e3c503
6 changed files with 16 additions and 19 deletions
|
|
@ -143,6 +143,7 @@ This section contains options used when in server mode it will begin with `[serv
|
||||||
|Option | Valid Values |Description|
|
|Option | Valid Values |Description|
|
||||||
|:-------------------|:-----------------:|:-----------|
|
|:-------------------|:-----------------:|:-----------|
|
||||||
| 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)|
|
||||||
| externalConfig | `true` or `false` | When true use the external config path |
|
| externalConfig | `true` or `false` | When true use the external config path |
|
||||||
| externalConfigFile | Filepath | Path the server config file if it does not exist the GUI will it generated based on the `internalConfig` section.|
|
| externalConfigFile | Filepath | Path the server config file if it does not exist the GUI will it generated based on the `internalConfig` section.|
|
||||||
| gridHeight | int | Height of the server's intenal grid used for the computer layout (default: 3)|
|
| gridHeight | int | Height of the server's intenal grid used for the computer layout (default: 3)|
|
||||||
|
|
@ -161,7 +162,6 @@ 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
|
disableLockToScreen=false
|
||||||
hasSwitchDelay=false
|
|
||||||
hasSwitchDoubleTap=false
|
hasSwitchDoubleTap=false
|
||||||
heartbeat=5000
|
heartbeat=5000
|
||||||
hotkeys\1\actions\1\activeOnRelease=false
|
hotkeys\1\actions\1\activeOnRelease=false
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,7 @@ public:
|
||||||
struct Server
|
struct Server
|
||||||
{
|
{
|
||||||
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 ExternalConfig = QStringLiteral("server/externalConfig");
|
inline static const auto ExternalConfig = QStringLiteral("server/externalConfig");
|
||||||
inline static const auto ExternalConfigFile = QStringLiteral("server/externalConfigFile");
|
inline static const auto ExternalConfigFile = QStringLiteral("server/externalConfigFile");
|
||||||
inline static const auto GridHeight = QStringLiteral("server/gridHeight");
|
inline static const auto GridHeight = QStringLiteral("server/gridHeight");
|
||||||
|
|
@ -245,6 +246,7 @@ private:
|
||||||
, Settings::Security::KeySize
|
, Settings::Security::KeySize
|
||||||
, Settings::Security::TlsEnabled
|
, Settings::Security::TlsEnabled
|
||||||
, Settings::Server::EnableHeatbeat
|
, Settings::Server::EnableHeatbeat
|
||||||
|
, Settings::Server::EnableSwitchDelay
|
||||||
, Settings::Server::ExternalConfig
|
, Settings::Server::ExternalConfig
|
||||||
, Settings::Server::ExternalConfigFile
|
, Settings::Server::ExternalConfigFile
|
||||||
, Settings::Server::GridHeight
|
, Settings::Server::GridHeight
|
||||||
|
|
@ -263,15 +265,16 @@ private:
|
||||||
, Settings::Gui::IgnoreMissingKeyboardLayouts
|
, Settings::Gui::IgnoreMissingKeyboardLayouts
|
||||||
, Settings::Core::PreventSleep
|
, Settings::Core::PreventSleep
|
||||||
, Settings::Core::UseWlClipboard
|
, Settings::Core::UseWlClipboard
|
||||||
, Settings::Server::EnableHeatbeat
|
|
||||||
, Settings::Core::EnableEnterCommand
|
, Settings::Core::EnableEnterCommand
|
||||||
, Settings::Core::EnableExitCommand
|
, Settings::Core::EnableExitCommand
|
||||||
, Settings::Client::DynamicConnectionRetry
|
, Settings::Client::DynamicConnectionRetry
|
||||||
, Settings::Server::ExternalConfig
|
|
||||||
, Settings::Client::InvertYScroll
|
, Settings::Client::InvertYScroll
|
||||||
, Settings::Client::InvertXScroll
|
, Settings::Client::InvertXScroll
|
||||||
, Settings::Log::ToFile
|
, Settings::Log::ToFile
|
||||||
, Settings::Log::GuiDebug
|
, Settings::Log::GuiDebug
|
||||||
|
, Settings::Server::EnableHeatbeat
|
||||||
|
, Settings::Server::EnableSwitchDelay
|
||||||
|
, Settings::Server::ExternalConfig
|
||||||
};
|
};
|
||||||
|
|
||||||
// When checking the default values this list contains the ones that default to true.
|
// When checking the default values this list contains the ones that default to true.
|
||||||
|
|
@ -297,6 +300,7 @@ 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/hasHeartbeat")
|
||||||
|
, QStringLiteral("internalConfig/hasSwitchDelay")
|
||||||
, QStringLiteral("internalConfig/protocol")
|
, QStringLiteral("internalConfig/protocol")
|
||||||
, QStringLiteral("internalConfig/numColumns")
|
, QStringLiteral("internalConfig/numColumns")
|
||||||
, QStringLiteral("internalConfig/numRows")
|
, QStringLiteral("internalConfig/numRows")
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,6 @@ bool ServerConfig::operator==(const ServerConfig &sc) const
|
||||||
m_Heartbeat == sc.m_Heartbeat && //
|
m_Heartbeat == sc.m_Heartbeat && //
|
||||||
m_RelativeMouseMoves == sc.m_RelativeMouseMoves && //
|
m_RelativeMouseMoves == sc.m_RelativeMouseMoves && //
|
||||||
m_Win32KeepForeground == sc.m_Win32KeepForeground && //
|
m_Win32KeepForeground == sc.m_Win32KeepForeground && //
|
||||||
m_HasSwitchDelay == sc.m_HasSwitchDelay && //
|
|
||||||
m_SwitchDelay == sc.m_SwitchDelay && //
|
m_SwitchDelay == sc.m_SwitchDelay && //
|
||||||
m_HasSwitchDoubleTap == sc.m_HasSwitchDoubleTap && //
|
m_HasSwitchDoubleTap == sc.m_HasSwitchDoubleTap && //
|
||||||
m_SwitchDoubleTap == sc.m_SwitchDoubleTap && //
|
m_SwitchDoubleTap == sc.m_SwitchDoubleTap && //
|
||||||
|
|
@ -101,7 +100,6 @@ void ServerConfig::commit()
|
||||||
settings().setValue("heartbeat", heartbeat());
|
settings().setValue("heartbeat", heartbeat());
|
||||||
settings().setValue("relativeMouseMoves", relativeMouseMoves());
|
settings().setValue("relativeMouseMoves", relativeMouseMoves());
|
||||||
settings().setValue("win32KeepForeground", win32KeepForeground());
|
settings().setValue("win32KeepForeground", win32KeepForeground());
|
||||||
settings().setValue("hasSwitchDelay", hasSwitchDelay());
|
|
||||||
settings().setValue("switchDelay", switchDelay());
|
settings().setValue("switchDelay", switchDelay());
|
||||||
settings().setValue("hasSwitchDoubleTap", hasSwitchDoubleTap());
|
settings().setValue("hasSwitchDoubleTap", hasSwitchDoubleTap());
|
||||||
settings().setValue("switchDoubleTap", switchDoubleTap());
|
settings().setValue("switchDoubleTap", switchDoubleTap());
|
||||||
|
|
@ -151,7 +149,6 @@ void ServerConfig::recall()
|
||||||
setHeartbeat(settings().value("heartbeat", 5000).toInt());
|
setHeartbeat(settings().value("heartbeat", 5000).toInt());
|
||||||
setRelativeMouseMoves(settings().value("relativeMouseMoves", false).toBool());
|
setRelativeMouseMoves(settings().value("relativeMouseMoves", false).toBool());
|
||||||
setWin32KeepForeground(settings().value("win32KeepForeground", false).toBool());
|
setWin32KeepForeground(settings().value("win32KeepForeground", false).toBool());
|
||||||
haveSwitchDelay(settings().value("hasSwitchDelay", false).toBool());
|
|
||||||
setSwitchDelay(settings().value("switchDelay", 250).toInt());
|
setSwitchDelay(settings().value("switchDelay", 250).toInt());
|
||||||
haveSwitchDoubleTap(settings().value("hasSwitchDoubleTap", false).toBool());
|
haveSwitchDoubleTap(settings().value("hasSwitchDoubleTap", false).toBool());
|
||||||
setSwitchDoubleTap(settings().value("switchDoubleTap", 250).toInt());
|
setSwitchDoubleTap(settings().value("switchDoubleTap", 250).toInt());
|
||||||
|
|
@ -260,7 +257,7 @@ QTextStream &operator<<(QTextStream &outStream, const ServerConfig &config)
|
||||||
outStream << "\t"
|
outStream << "\t"
|
||||||
<< "clipboardSharingSize = " << config.clipboardSharingSize() << Qt::endl;
|
<< "clipboardSharingSize = " << config.clipboardSharingSize() << Qt::endl;
|
||||||
|
|
||||||
if (config.hasSwitchDelay())
|
if (Settings::value(Settings::Server::EnableSwitchDelay).toBool())
|
||||||
outStream << "\t"
|
outStream << "\t"
|
||||||
<< "switchDelay = " << config.switchDelay() << Qt::endl;
|
<< "switchDelay = " << config.switchDelay() << Qt::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,10 +52,6 @@ public:
|
||||||
{
|
{
|
||||||
return m_Win32KeepForeground;
|
return m_Win32KeepForeground;
|
||||||
}
|
}
|
||||||
bool hasSwitchDelay() const
|
|
||||||
{
|
|
||||||
return m_HasSwitchDelay;
|
|
||||||
}
|
|
||||||
int switchDelay() const
|
int switchDelay() const
|
||||||
{
|
{
|
||||||
return m_SwitchDelay;
|
return m_SwitchDelay;
|
||||||
|
|
@ -142,10 +138,6 @@ private:
|
||||||
{
|
{
|
||||||
m_Win32KeepForeground = on;
|
m_Win32KeepForeground = on;
|
||||||
}
|
}
|
||||||
void haveSwitchDelay(bool on)
|
|
||||||
{
|
|
||||||
m_HasSwitchDelay = on;
|
|
||||||
}
|
|
||||||
void setSwitchDelay(int val)
|
void setSwitchDelay(int val)
|
||||||
{
|
{
|
||||||
m_SwitchDelay = val;
|
m_SwitchDelay = val;
|
||||||
|
|
@ -197,7 +189,6 @@ private:
|
||||||
int m_Heartbeat = 0;
|
int m_Heartbeat = 0;
|
||||||
bool m_RelativeMouseMoves = false;
|
bool m_RelativeMouseMoves = false;
|
||||||
bool m_Win32KeepForeground = false;
|
bool m_Win32KeepForeground = false;
|
||||||
bool m_HasSwitchDelay = false;
|
|
||||||
int m_SwitchDelay = 0;
|
int m_SwitchDelay = 0;
|
||||||
bool m_HasSwitchDoubleTap = false;
|
bool m_HasSwitchDoubleTap = false;
|
||||||
int m_SwitchDoubleTap = 0;
|
int m_SwitchDoubleTap = 0;
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,7 @@ void ServerConfigDialog::accept()
|
||||||
setOriginalServerConfig(serverConfig());
|
setOriginalServerConfig(serverConfig());
|
||||||
Settings::setValue(Settings::Server::Protocol, networkProtocolToOption(m_protocol));
|
Settings::setValue(Settings::Server::Protocol, networkProtocolToOption(m_protocol));
|
||||||
Settings::setValue(Settings::Server::EnableHeatbeat, m_enableHeartbeat);
|
Settings::setValue(Settings::Server::EnableHeatbeat, m_enableHeartbeat);
|
||||||
|
Settings::setValue(Settings::Server::EnableSwitchDelay, m_enableSwitchDelay);
|
||||||
|
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
|
@ -300,8 +301,8 @@ void ServerConfigDialog::setSwitchDoubleTap(int within)
|
||||||
|
|
||||||
void ServerConfigDialog::toggleSwitchDelay(bool enable)
|
void ServerConfigDialog::toggleSwitchDelay(bool enable)
|
||||||
{
|
{
|
||||||
|
m_enableSwitchDelay = enable;
|
||||||
ui->sbSwitchDelay->setEnabled(enable);
|
ui->sbSwitchDelay->setEnabled(enable);
|
||||||
serverConfig().haveSwitchDelay(enable);
|
|
||||||
onChange();
|
onChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -386,7 +387,9 @@ void ServerConfigDialog::loadFromConfig()
|
||||||
ui->sbHeartbeat->setValue(serverConfig().heartbeat());
|
ui->sbHeartbeat->setValue(serverConfig().heartbeat());
|
||||||
ui->cbRelativeMouseMoves->setChecked(serverConfig().relativeMouseMoves());
|
ui->cbRelativeMouseMoves->setChecked(serverConfig().relativeMouseMoves());
|
||||||
ui->cbWin32KeepForeground->setChecked(serverConfig().win32KeepForeground());
|
ui->cbWin32KeepForeground->setChecked(serverConfig().win32KeepForeground());
|
||||||
ui->cbSwitchDelay->setChecked(serverConfig().hasSwitchDelay());
|
|
||||||
|
m_enableSwitchDelay = Settings::value(Settings::Server::EnableSwitchDelay).toBool();
|
||||||
|
ui->cbSwitchDelay->setChecked(m_enableSwitchDelay);
|
||||||
ui->sbSwitchDelay->setValue(serverConfig().switchDelay());
|
ui->sbSwitchDelay->setValue(serverConfig().switchDelay());
|
||||||
ui->cbSwitchDoubleTap->setChecked(serverConfig().hasSwitchDoubleTap());
|
ui->cbSwitchDoubleTap->setChecked(serverConfig().hasSwitchDoubleTap());
|
||||||
ui->sbSwitchDelay->setEnabled(ui->cbSwitchDelay->isChecked());
|
ui->sbSwitchDelay->setEnabled(ui->cbSwitchDelay->isChecked());
|
||||||
|
|
@ -507,7 +510,8 @@ void ServerConfigDialog::onChange()
|
||||||
bool isAppConfigDataEqual = m_originalServerConfigIsExternal == serverConfig().useExternalConfig() &&
|
bool isAppConfigDataEqual = m_originalServerConfigIsExternal == serverConfig().useExternalConfig() &&
|
||||||
m_originalServerConfigUsesExternalFile == serverConfig().configFile() &&
|
m_originalServerConfigUsesExternalFile == serverConfig().configFile() &&
|
||||||
m_protocol == Settings::networkProtocol() &&
|
m_protocol == Settings::networkProtocol() &&
|
||||||
m_enableHeartbeat == Settings::value(Settings::Server::EnableHeatbeat).toBool();
|
m_enableHeartbeat == Settings::value(Settings::Server::EnableHeatbeat).toBool() &&
|
||||||
|
m_enableSwitchDelay == Settings::value(Settings::Server::EnableSwitchDelay).toBool();
|
||||||
ui->buttonBox->button(QDialogButtonBox::Ok)
|
ui->buttonBox->button(QDialogButtonBox::Ok)
|
||||||
->setEnabled(!isAppConfigDataEqual || !(m_originalServerConfig == m_serverConfig));
|
->setEnabled(!isAppConfigDataEqual || !(m_originalServerConfig == m_serverConfig));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,7 @@ private:
|
||||||
ServerConfig &m_originalServerConfig;
|
ServerConfig &m_originalServerConfig;
|
||||||
NetworkProtocol m_protocol;
|
NetworkProtocol m_protocol;
|
||||||
bool m_enableHeartbeat;
|
bool m_enableHeartbeat;
|
||||||
|
bool m_enableSwitchDelay;
|
||||||
bool m_originalServerConfigIsExternal;
|
bool m_originalServerConfigIsExternal;
|
||||||
QString m_originalServerConfigUsesExternalFile;
|
QString m_originalServerConfigUsesExternalFile;
|
||||||
ServerConfig m_serverConfig;
|
ServerConfig m_serverConfig;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue