refactor: move hasSwitchDoubleTap to general settings

This commit is contained in:
sithlord48 2026-06-10 22:21:05 -04:00 committed by Nick Bolton
parent f686e3c503
commit f51fb4affb
6 changed files with 21 additions and 22 deletions

View file

@ -144,6 +144,7 @@ This section contains options used when in server mode it will begin with `[serv
|:-------------------|:-----------------:|:-----------|
| 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)|
| enableSwitchDoubleTap | `true` or `false` | Enables the doubletap to switch method (default: false)|
| 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.|
| gridHeight | int | Height of the server's intenal grid used for the computer layout (default: 3)|
@ -162,7 +163,6 @@ clipboardSharing=true
clipboardSharingSize=@Variant(\0\0\0\x84\0\0\0\0\0\0<\0)
defaultLockToScreenState=false
disableLockToScreen=false
hasSwitchDoubleTap=false
heartbeat=5000
hotkeys\1\actions\1\activeOnRelease=false
hotkeys\1\actions\1\hasScreens=true

View file

@ -106,6 +106,7 @@ public:
{
inline static const auto EnableHeatbeat = QStringLiteral("server/enableHeatbeat");
inline static const auto EnableSwitchDelay = QStringLiteral("server/enableSwitchDelay");
inline static const auto EnableSwitchDoubleTap = QStringLiteral("server/enableSwitchDoubleTap");
inline static const auto ExternalConfig = QStringLiteral("server/externalConfig");
inline static const auto ExternalConfigFile = QStringLiteral("server/externalConfigFile");
inline static const auto GridHeight = QStringLiteral("server/gridHeight");
@ -247,6 +248,7 @@ private:
, Settings::Security::TlsEnabled
, Settings::Server::EnableHeatbeat
, Settings::Server::EnableSwitchDelay
, Settings::Server::EnableSwitchDoubleTap
, Settings::Server::ExternalConfig
, Settings::Server::ExternalConfigFile
, Settings::Server::GridHeight
@ -274,6 +276,7 @@ private:
, Settings::Log::GuiDebug
, Settings::Server::EnableHeatbeat
, Settings::Server::EnableSwitchDelay
, Settings::Server::EnableSwitchDoubleTap
, Settings::Server::ExternalConfig
};
@ -301,6 +304,7 @@ private:
inline static const QStringList m_oldServerConfigKeys = {
QStringLiteral("internalConfig/hasHeartbeat")
, QStringLiteral("internalConfig/hasSwitchDelay")
, QStringLiteral("internalConfig/hasSwitchDoubleTap")
, QStringLiteral("internalConfig/protocol")
, QStringLiteral("internalConfig/numColumns")
, QStringLiteral("internalConfig/numRows")

View file

@ -57,7 +57,6 @@ bool ServerConfig::operator==(const ServerConfig &sc) const
m_RelativeMouseMoves == sc.m_RelativeMouseMoves && //
m_Win32KeepForeground == sc.m_Win32KeepForeground && //
m_SwitchDelay == sc.m_SwitchDelay && //
m_HasSwitchDoubleTap == sc.m_HasSwitchDoubleTap && //
m_SwitchDoubleTap == sc.m_SwitchDoubleTap && //
m_SwitchCornerSize == sc.m_SwitchCornerSize && //
m_SwitchCorners == sc.m_SwitchCorners && //
@ -101,7 +100,6 @@ void ServerConfig::commit()
settings().setValue("relativeMouseMoves", relativeMouseMoves());
settings().setValue("win32KeepForeground", win32KeepForeground());
settings().setValue("switchDelay", switchDelay());
settings().setValue("hasSwitchDoubleTap", hasSwitchDoubleTap());
settings().setValue("switchDoubleTap", switchDoubleTap());
settings().setValue("switchCornerSize", switchCornerSize());
settings().setValue("defaultLockToScreenState", defaultLockToScreenState());
@ -150,7 +148,6 @@ void ServerConfig::recall()
setRelativeMouseMoves(settings().value("relativeMouseMoves", false).toBool());
setWin32KeepForeground(settings().value("win32KeepForeground", false).toBool());
setSwitchDelay(settings().value("switchDelay", 250).toInt());
haveSwitchDoubleTap(settings().value("hasSwitchDoubleTap", false).toBool());
setSwitchDoubleTap(settings().value("switchDoubleTap", 250).toInt());
setSwitchCornerSize(settings().value("switchCornerSize").toInt());
setDefaultLockToScreenState(settings().value("defaultLockToScreenState", false).toBool());
@ -261,7 +258,7 @@ QTextStream &operator<<(QTextStream &outStream, const ServerConfig &config)
outStream << "\t"
<< "switchDelay = " << config.switchDelay() << Qt::endl;
if (config.hasSwitchDoubleTap())
if (Settings::value(Settings::Server::EnableSwitchDoubleTap).toBool())
outStream << "\t"
<< "switchDoubleTap = " << config.switchDoubleTap() << Qt::endl;

View file

@ -56,10 +56,6 @@ public:
{
return m_SwitchDelay;
}
bool hasSwitchDoubleTap() const
{
return m_HasSwitchDoubleTap;
}
int switchDoubleTap() const
{
return m_SwitchDoubleTap;
@ -142,10 +138,6 @@ private:
{
m_SwitchDelay = val;
}
void haveSwitchDoubleTap(bool on)
{
m_HasSwitchDoubleTap = on;
}
void setSwitchDoubleTap(int val)
{
m_SwitchDoubleTap = val;
@ -190,7 +182,6 @@ private:
bool m_RelativeMouseMoves = false;
bool m_Win32KeepForeground = false;
int m_SwitchDelay = 0;
bool m_HasSwitchDoubleTap = false;
int m_SwitchDoubleTap = 0;
int m_SwitchCornerSize = 0;
bool m_DefaultLockToScreenState = false;

View file

@ -78,6 +78,7 @@ void ServerConfigDialog::accept()
Settings::setValue(Settings::Server::Protocol, networkProtocolToOption(m_protocol));
Settings::setValue(Settings::Server::EnableHeatbeat, m_enableHeartbeat);
Settings::setValue(Settings::Server::EnableSwitchDelay, m_enableSwitchDelay);
Settings::setValue(Settings::Server::EnableSwitchDoubleTap, m_enableSwitchDoubleTap);
QDialog::accept();
}
@ -288,8 +289,8 @@ void ServerConfigDialog::listActionsSelectionChanged(const QItemSelection &selec
void ServerConfigDialog::toggleSwitchDoubleTap(bool enable)
{
m_enableSwitchDoubleTap = enable;
ui->sbSwitchDoubleTap->setEnabled(enable);
serverConfig().haveSwitchDoubleTap(enable);
onChange();
}
@ -391,10 +392,13 @@ void ServerConfigDialog::loadFromConfig()
m_enableSwitchDelay = Settings::value(Settings::Server::EnableSwitchDelay).toBool();
ui->cbSwitchDelay->setChecked(m_enableSwitchDelay);
ui->sbSwitchDelay->setValue(serverConfig().switchDelay());
ui->cbSwitchDoubleTap->setChecked(serverConfig().hasSwitchDoubleTap());
ui->sbSwitchDelay->setEnabled(ui->cbSwitchDelay->isChecked());
ui->sbSwitchDoubleTap->setEnabled(ui->cbSwitchDoubleTap->isChecked());
m_enableSwitchDoubleTap = Settings::value(Settings::Server::EnableSwitchDoubleTap).toBool();
ui->cbSwitchDoubleTap->setChecked(m_enableSwitchDoubleTap);
ui->sbSwitchDoubleTap->setValue(serverConfig().switchDoubleTap());
ui->sbSwitchDoubleTap->setEnabled(ui->cbSwitchDoubleTap->isChecked());
ui->groupExternalConfig->setChecked(serverConfig().useExternalConfig());
ui->widgetExternalConfigControls->setEnabled(ui->groupExternalConfig->isChecked());
@ -507,11 +511,13 @@ bool ServerConfigDialog::addComputer(const QString &clientName, bool doSilent)
void ServerConfigDialog::onChange()
{
bool isAppConfigDataEqual = m_originalServerConfigIsExternal == serverConfig().useExternalConfig() &&
m_originalServerConfigUsesExternalFile == serverConfig().configFile() &&
m_protocol == Settings::networkProtocol() &&
m_enableHeartbeat == Settings::value(Settings::Server::EnableHeatbeat).toBool() &&
m_enableSwitchDelay == Settings::value(Settings::Server::EnableSwitchDelay).toBool();
bool isAppConfigDataEqual =
m_originalServerConfigIsExternal == serverConfig().useExternalConfig() &&
m_originalServerConfigUsesExternalFile == serverConfig().configFile() &&
m_protocol == Settings::networkProtocol() &&
m_enableHeartbeat == Settings::value(Settings::Server::EnableHeatbeat).toBool() &&
m_enableSwitchDelay == Settings::value(Settings::Server::EnableSwitchDelay).toBool() &&
m_enableSwitchDoubleTap == Settings::value(Settings::Server::EnableSwitchDoubleTap).toBool();
ui->buttonBox->button(QDialogButtonBox::Ok)
->setEnabled(!isAppConfigDataEqual || !(m_originalServerConfig == m_serverConfig));
}

View file

@ -106,6 +106,7 @@ private:
NetworkProtocol m_protocol;
bool m_enableHeartbeat;
bool m_enableSwitchDelay;
bool m_enableSwitchDoubleTap;
bool m_originalServerConfigIsExternal;
QString m_originalServerConfigUsesExternalFile;
ServerConfig m_serverConfig;