refactor(Settings): Move heartbeat to general settings
This commit is contained in:
parent
f51fb4affb
commit
488d620b3b
8 changed files with 28 additions and 29 deletions
|
|
@ -149,6 +149,7 @@ This section contains options used when in server mode it will begin with `[serv
|
||||||
| 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)|
|
||||||
| gridWidth | int | Width of the server's intenal grid used for the computer layout (default: 5) |
|
| gridWidth | int | Width of the server's intenal grid used for the computer layout (default: 5) |
|
||||||
|
| heartbeat | int | The server will expect each client to send a message no less than every `N` milliseconds. If no message arrives from a client within `3N` seconds the server forces that client to disconnect. If deskflow fails to detect clients disconnecting while the server is sleeping or vice versa, try using this option. |
|
||||||
| protocol | `barrier` or `synergy` | The protocol to use when saying hello to clients. Can be set to barrier or synergy. If not set barrier is used as the default |
|
| protocol | `barrier` or `synergy` | The protocol to use when saying hello to clients. Can be set to barrier or synergy. If not set barrier is used as the default |
|
||||||
| xdpRestoreToken | UUID | Restore token provided by XDG portals |
|
| xdpRestoreToken | UUID | Restore token provided by XDG portals |
|
||||||
|
|
||||||
|
|
@ -163,7 +164,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
|
||||||
heartbeat=5000
|
|
||||||
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
|
||||||
|
|
@ -390,8 +390,7 @@ Note that links do not have to be symmetrical; for instance, here the edge betwe
|
||||||
|
|
||||||
```
|
```
|
||||||
section: options
|
section: options
|
||||||
heartbeat = 5000
|
switchDelay = 500
|
||||||
switchDelay = 500
|
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -399,7 +398,6 @@ end
|
||||||
|
|
||||||
| Options | Value Values| Description|
|
| Options | Value Values| Description|
|
||||||
|:--------|:-----------:|:-----------|
|
|:--------|:-----------:|:-----------|
|
||||||
|heartbeat| integer (N) | The server will expect each client to send a message no less than every `N` milliseconds. If no message arrives from a client within `3N` seconds the server forces that client to disconnect. If deskflow fails to detect clients disconnecting while the server is sleeping or vice versa, try using this option. |
|
|
||||||
|switchCorners | none top-left top-right bottom-left bottom-right left right top bottom all | Deskflow won't switch computers when the mouse reaches the edge of the computer if it's in a listed corner. The size of all corners is given by the `switchCornerSize` option. The first name in the list is one of the above names and defines the initial set of corners. Subsequent names are prefixed with + or - to add the corner to or remove the corner from the set, respectively. For example: `all -left +top-left` starts will all corners, removes the left corners (top and bottom) then adds the top-left back in, resulting in the top-left, bottom-left and bottom-right corners.|
|
|switchCorners | none top-left top-right bottom-left bottom-right left right top bottom all | Deskflow won't switch computers when the mouse reaches the edge of the computer if it's in a listed corner. The size of all corners is given by the `switchCornerSize` option. The first name in the list is one of the above names and defines the initial set of corners. Subsequent names are prefixed with + or - to add the corner to or remove the corner from the set, respectively. For example: `all -left +top-left` starts will all corners, removes the left corners (top and bottom) then adds the top-left back in, resulting in the top-left, bottom-left and bottom-right corners.|
|
||||||
|switchCornerSize | integer (N) | Sets the size of all corners in pixels. The cursor must be within `N` pixels of the corner to be considered to be in the corner.|
|
|switchCornerSize | integer (N) | Sets the size of all corners in pixels. The cursor must be within `N` pixels of the corner to be considered to be in the corner.|
|
||||||
|switchDelay | integer| Deskflow won't switch computers when the mouse reaches edge of a computer unless it stays on the edge for `N` milliseconds. This helps prevent unintentional switching when working near an edge.|
|
|switchDelay | integer| Deskflow won't switch computers when the mouse reaches edge of a computer unless it stays on the edge for `N` milliseconds. This helps prevent unintentional switching when working near an edge.|
|
||||||
|
|
|
||||||
|
|
@ -216,6 +216,9 @@ QVariant Settings::defaultValue(const QString &key)
|
||||||
if (key == Server::GridHeight)
|
if (key == Server::GridHeight)
|
||||||
return kServerGridHeight;
|
return kServerGridHeight;
|
||||||
|
|
||||||
|
if (key == Server::Heartbeat)
|
||||||
|
return 5000;
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,7 @@ public:
|
||||||
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");
|
||||||
inline static const auto GridWidth = QStringLiteral("server/gridWidth");
|
inline static const auto GridWidth = QStringLiteral("server/gridWidth");
|
||||||
|
inline static const auto Heartbeat = QStringLiteral("server/heartbeat");
|
||||||
inline static const auto Protocol = QStringLiteral("server/protocol");
|
inline static const auto Protocol = QStringLiteral("server/protocol");
|
||||||
inline static const auto XdpRestoreToken = QStringLiteral("server/xdpRestoreToken");
|
inline static const auto XdpRestoreToken = QStringLiteral("server/xdpRestoreToken");
|
||||||
};
|
};
|
||||||
|
|
@ -253,6 +254,7 @@ private:
|
||||||
, Settings::Server::ExternalConfigFile
|
, Settings::Server::ExternalConfigFile
|
||||||
, Settings::Server::GridHeight
|
, Settings::Server::GridHeight
|
||||||
, Settings::Server::GridWidth
|
, Settings::Server::GridWidth
|
||||||
|
, Settings::Server::Heartbeat
|
||||||
, Settings::Server::Protocol
|
, Settings::Server::Protocol
|
||||||
, Settings::Server::XdpRestoreToken
|
, Settings::Server::XdpRestoreToken
|
||||||
};
|
};
|
||||||
|
|
@ -305,6 +307,7 @@ private:
|
||||||
QStringLiteral("internalConfig/hasHeartbeat")
|
QStringLiteral("internalConfig/hasHeartbeat")
|
||||||
, QStringLiteral("internalConfig/hasSwitchDelay")
|
, QStringLiteral("internalConfig/hasSwitchDelay")
|
||||||
, QStringLiteral("internalConfig/hasSwitchDoubleTap")
|
, QStringLiteral("internalConfig/hasSwitchDoubleTap")
|
||||||
|
, QStringLiteral("internalConfig/heartbeat")
|
||||||
, QStringLiteral("internalConfig/protocol")
|
, QStringLiteral("internalConfig/protocol")
|
||||||
, QStringLiteral("internalConfig/numColumns")
|
, QStringLiteral("internalConfig/numColumns")
|
||||||
, QStringLiteral("internalConfig/numRows")
|
, QStringLiteral("internalConfig/numRows")
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,6 @@ bool ServerConfig::save(const QString &fileName) const
|
||||||
bool ServerConfig::operator==(const ServerConfig &sc) const
|
bool ServerConfig::operator==(const ServerConfig &sc) const
|
||||||
{
|
{
|
||||||
return m_Screens == sc.m_Screens && //
|
return m_Screens == sc.m_Screens && //
|
||||||
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_SwitchDelay == sc.m_SwitchDelay && //
|
m_SwitchDelay == sc.m_SwitchDelay && //
|
||||||
|
|
@ -96,7 +95,6 @@ void ServerConfig::commit()
|
||||||
settings().beginGroup("internalConfig");
|
settings().beginGroup("internalConfig");
|
||||||
settings().remove("");
|
settings().remove("");
|
||||||
|
|
||||||
settings().setValue("heartbeat", heartbeat());
|
|
||||||
settings().setValue("relativeMouseMoves", relativeMouseMoves());
|
settings().setValue("relativeMouseMoves", relativeMouseMoves());
|
||||||
settings().setValue("win32KeepForeground", win32KeepForeground());
|
settings().setValue("win32KeepForeground", win32KeepForeground());
|
||||||
settings().setValue("switchDelay", switchDelay());
|
settings().setValue("switchDelay", switchDelay());
|
||||||
|
|
@ -144,7 +142,6 @@ void ServerConfig::recall()
|
||||||
// ourselves
|
// ourselves
|
||||||
setupScreens();
|
setupScreens();
|
||||||
|
|
||||||
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());
|
||||||
setSwitchDelay(settings().value("switchDelay", 250).toInt());
|
setSwitchDelay(settings().value("switchDelay", 250).toInt());
|
||||||
|
|
@ -238,9 +235,6 @@ QTextStream &operator<<(QTextStream &outStream, const ServerConfig &config)
|
||||||
|
|
||||||
outStream << "section: options" << Qt::endl;
|
outStream << "section: options" << Qt::endl;
|
||||||
|
|
||||||
if (Settings::value(Settings::Server::EnableHeatbeat).toBool())
|
|
||||||
outStream << "\t" << "heartbeat = " << config.heartbeat() << Qt::endl;
|
|
||||||
|
|
||||||
outStream << "\t"
|
outStream << "\t"
|
||||||
<< "relativeMouseMoves = " << (config.relativeMouseMoves() ? "true" : "false") << Qt::endl;
|
<< "relativeMouseMoves = " << (config.relativeMouseMoves() ? "true" : "false") << Qt::endl;
|
||||||
outStream << "\t"
|
outStream << "\t"
|
||||||
|
|
|
||||||
|
|
@ -40,10 +40,6 @@ public:
|
||||||
//
|
//
|
||||||
// New methods
|
// New methods
|
||||||
//
|
//
|
||||||
int heartbeat() const
|
|
||||||
{
|
|
||||||
return m_Heartbeat;
|
|
||||||
}
|
|
||||||
bool relativeMouseMoves() const
|
bool relativeMouseMoves() const
|
||||||
{
|
{
|
||||||
return m_RelativeMouseMoves;
|
return m_RelativeMouseMoves;
|
||||||
|
|
@ -122,10 +118,6 @@ private:
|
||||||
{
|
{
|
||||||
m_Screens.append(screen);
|
m_Screens.append(screen);
|
||||||
}
|
}
|
||||||
void setHeartbeat(int val)
|
|
||||||
{
|
|
||||||
m_Heartbeat = val;
|
|
||||||
}
|
|
||||||
void setRelativeMouseMoves(bool on)
|
void setRelativeMouseMoves(bool on)
|
||||||
{
|
{
|
||||||
m_RelativeMouseMoves = on;
|
m_RelativeMouseMoves = on;
|
||||||
|
|
@ -178,7 +170,6 @@ private:
|
||||||
bool fixNoServer(const QString &name, int &index);
|
bool fixNoServer(const QString &name, int &index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_Heartbeat = 0;
|
|
||||||
bool m_RelativeMouseMoves = false;
|
bool m_RelativeMouseMoves = false;
|
||||||
bool m_Win32KeepForeground = false;
|
bool m_Win32KeepForeground = false;
|
||||||
int m_SwitchDelay = 0;
|
int m_SwitchDelay = 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::Heartbeat, m_heartbeatRate);
|
||||||
Settings::setValue(Settings::Server::EnableSwitchDelay, m_enableSwitchDelay);
|
Settings::setValue(Settings::Server::EnableSwitchDelay, m_enableSwitchDelay);
|
||||||
Settings::setValue(Settings::Server::EnableSwitchDoubleTap, m_enableSwitchDoubleTap);
|
Settings::setValue(Settings::Server::EnableSwitchDoubleTap, m_enableSwitchDoubleTap);
|
||||||
|
|
||||||
|
|
@ -234,7 +235,9 @@ void ServerConfigDialog::toggleHeartbeat(bool enabled)
|
||||||
|
|
||||||
void ServerConfigDialog::setHeartbeat(int rate)
|
void ServerConfigDialog::setHeartbeat(int rate)
|
||||||
{
|
{
|
||||||
serverConfig().setHeartbeat(rate);
|
if (rate == m_heartbeatRate)
|
||||||
|
return;
|
||||||
|
m_heartbeatRate = rate;
|
||||||
onChange();
|
onChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -350,7 +353,6 @@ void ServerConfigDialog::toggleExternalConfig(bool checked)
|
||||||
ui->groupMisc->setEnabled(!checked);
|
ui->groupMisc->setEnabled(!checked);
|
||||||
ui->groupCorners->setEnabled(!checked);
|
ui->groupCorners->setEnabled(!checked);
|
||||||
ui->groupSwitch->setEnabled(!checked);
|
ui->groupSwitch->setEnabled(!checked);
|
||||||
ui->widgetHeartbeat->setEnabled(!checked);
|
|
||||||
serverConfig().setUseExternalConfig(checked);
|
serverConfig().setUseExternalConfig(checked);
|
||||||
onChange();
|
onChange();
|
||||||
}
|
}
|
||||||
|
|
@ -385,7 +387,10 @@ void ServerConfigDialog::loadFromConfig()
|
||||||
m_enableHeartbeat = Settings::value(Settings::Server::EnableHeatbeat).toBool();
|
m_enableHeartbeat = Settings::value(Settings::Server::EnableHeatbeat).toBool();
|
||||||
ui->cbHeartbeat->setChecked(m_enableHeartbeat);
|
ui->cbHeartbeat->setChecked(m_enableHeartbeat);
|
||||||
ui->sbHeartbeat->setEnabled(ui->cbHeartbeat->isChecked());
|
ui->sbHeartbeat->setEnabled(ui->cbHeartbeat->isChecked());
|
||||||
ui->sbHeartbeat->setValue(serverConfig().heartbeat());
|
|
||||||
|
m_heartbeatRate = Settings::value(Settings::Server::Heartbeat).toInt();
|
||||||
|
ui->sbHeartbeat->setValue(m_heartbeatRate);
|
||||||
|
|
||||||
ui->cbRelativeMouseMoves->setChecked(serverConfig().relativeMouseMoves());
|
ui->cbRelativeMouseMoves->setChecked(serverConfig().relativeMouseMoves());
|
||||||
ui->cbWin32KeepForeground->setChecked(serverConfig().win32KeepForeground());
|
ui->cbWin32KeepForeground->setChecked(serverConfig().win32KeepForeground());
|
||||||
|
|
||||||
|
|
@ -516,6 +521,7 @@ void ServerConfigDialog::onChange()
|
||||||
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_heartbeatRate == Settings::value(Settings::Server::Heartbeat).toInt() &&
|
||||||
m_enableSwitchDelay == Settings::value(Settings::Server::EnableSwitchDelay).toBool() &&
|
m_enableSwitchDelay == Settings::value(Settings::Server::EnableSwitchDelay).toBool() &&
|
||||||
m_enableSwitchDoubleTap == Settings::value(Settings::Server::EnableSwitchDoubleTap).toBool();
|
m_enableSwitchDoubleTap == Settings::value(Settings::Server::EnableSwitchDoubleTap).toBool();
|
||||||
ui->buttonBox->button(QDialogButtonBox::Ok)
|
ui->buttonBox->button(QDialogButtonBox::Ok)
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,7 @@ private:
|
||||||
ServerConfig &m_originalServerConfig;
|
ServerConfig &m_originalServerConfig;
|
||||||
NetworkProtocol m_protocol;
|
NetworkProtocol m_protocol;
|
||||||
bool m_enableHeartbeat;
|
bool m_enableHeartbeat;
|
||||||
|
int m_heartbeatRate;
|
||||||
bool m_enableSwitchDelay;
|
bool m_enableSwitchDelay;
|
||||||
bool m_enableSwitchDoubleTap;
|
bool m_enableSwitchDoubleTap;
|
||||||
bool m_originalServerConfigIsExternal;
|
bool m_originalServerConfigIsExternal;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
#include "server/Config.h"
|
#include "server/Config.h"
|
||||||
|
|
||||||
#include "base/IEventQueue.h"
|
#include "base/IEventQueue.h"
|
||||||
#include "deskflow/DeskflowException.h"
|
|
||||||
#include "deskflow/KeyMap.h"
|
#include "deskflow/KeyMap.h"
|
||||||
#include "deskflow/KeyTypes.h"
|
#include "deskflow/KeyTypes.h"
|
||||||
#include "deskflow/OptionTypes.h"
|
#include "deskflow/OptionTypes.h"
|
||||||
|
|
@ -635,12 +634,13 @@ void Config::readSectionOptions(ConfigReadContext &s)
|
||||||
++i;
|
++i;
|
||||||
s.parseNameWithArgs("value", line, ",;\n", i, value, valueArgs);
|
s.parseNameWithArgs("value", line, ",;\n", i, value, valueArgs);
|
||||||
|
|
||||||
// Skip old protocol name
|
|
||||||
if (name == "protocol")
|
|
||||||
continue;
|
|
||||||
|
|
||||||
bool handled = true;
|
bool handled = true;
|
||||||
|
|
||||||
|
// Skip old protocol name
|
||||||
|
if (name == "protocol" || name == "heartbeat") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (name == "address") {
|
if (name == "address") {
|
||||||
try {
|
try {
|
||||||
m_deskflowAddress = NetworkAddress(value, kDefaultPort);
|
m_deskflowAddress = NetworkAddress(value, kDefaultPort);
|
||||||
|
|
@ -648,8 +648,6 @@ void Config::readSectionOptions(ConfigReadContext &s)
|
||||||
} catch (SocketAddressException &e) {
|
} catch (SocketAddressException &e) {
|
||||||
throw ServerConfigReadException(s, std::string("invalid address argument ") + e.what());
|
throw ServerConfigReadException(s, std::string("invalid address argument ") + e.what());
|
||||||
}
|
}
|
||||||
} else if (name == "heartbeat") {
|
|
||||||
addOption("", kOptionHeartbeat, s.parseInt(value));
|
|
||||||
} else if (name == "switchCorners") {
|
} else if (name == "switchCorners") {
|
||||||
addOption("", kOptionScreenSwitchCorners, s.parseCorners(value));
|
addOption("", kOptionScreenSwitchCorners, s.parseCorners(value));
|
||||||
} else if (name == "switchCornerSize") {
|
} else if (name == "switchCornerSize") {
|
||||||
|
|
@ -723,6 +721,11 @@ void Config::readSectionOptions(ConfigReadContext &s)
|
||||||
m_inputFilter.addFilterRule(rule);
|
m_inputFilter.addFilterRule(rule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Settings::value(Settings::Server::EnableHeatbeat).toBool()) {
|
||||||
|
addOption("", kOptionHeartbeat, Settings::value(Settings::Server::Heartbeat).toInt());
|
||||||
|
}
|
||||||
|
|
||||||
throw ServerConfigReadException(s, "unexpected end of options section");
|
throw ServerConfigReadException(s, "unexpected end of options section");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue