refactor: move hasHeartbeat to general settings
This commit is contained in:
parent
c66c356665
commit
d665b55111
6 changed files with 15 additions and 18 deletions
|
|
@ -142,6 +142,7 @@ This section contains options used when in server mode it will begin with `[serv
|
|||
|
||||
|Option | Valid Values |Description|
|
||||
|:-------------------|:-----------------:|:-----------|
|
||||
| enableHeartbeat | `true` or `false` | Send a heartbeat to connected clients; this has been replaced by internal keep alive (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)|
|
||||
|
|
@ -160,7 +161,6 @@ clipboardSharing=true
|
|||
clipboardSharingSize=@Variant(\0\0\0\x84\0\0\0\0\0\0<\0)
|
||||
defaultLockToScreenState=false
|
||||
disableLockToScreen=false
|
||||
hasHeartbeat=false
|
||||
hasSwitchDelay=false
|
||||
hasSwitchDoubleTap=false
|
||||
heartbeat=5000
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ public:
|
|||
};
|
||||
struct Server
|
||||
{
|
||||
inline static const auto EnableHeatbeat = QStringLiteral("server/enableHeatbeat");
|
||||
inline static const auto ExternalConfig = QStringLiteral("server/externalConfig");
|
||||
inline static const auto ExternalConfigFile = QStringLiteral("server/externalConfigFile");
|
||||
inline static const auto GridHeight = QStringLiteral("server/gridHeight");
|
||||
|
|
@ -243,6 +244,7 @@ private:
|
|||
, Settings::Security::CheckPeers
|
||||
, Settings::Security::KeySize
|
||||
, Settings::Security::TlsEnabled
|
||||
, Settings::Server::EnableHeatbeat
|
||||
, Settings::Server::ExternalConfig
|
||||
, Settings::Server::ExternalConfigFile
|
||||
, Settings::Server::GridHeight
|
||||
|
|
@ -261,6 +263,7 @@ private:
|
|||
, Settings::Gui::IgnoreMissingKeyboardLayouts
|
||||
, Settings::Core::PreventSleep
|
||||
, Settings::Core::UseWlClipboard
|
||||
, Settings::Server::EnableHeatbeat
|
||||
, Settings::Core::EnableEnterCommand
|
||||
, Settings::Core::EnableExitCommand
|
||||
, Settings::Client::DynamicConnectionRetry
|
||||
|
|
@ -293,7 +296,8 @@ private:
|
|||
};
|
||||
// Contains settings removed from server-configuration file
|
||||
inline static const QStringList m_oldServerConfigKeys = {
|
||||
QStringLiteral("internalConfig/protocol")
|
||||
QStringLiteral("internalConfig/hasHeartbeat")
|
||||
, QStringLiteral("internalConfig/protocol")
|
||||
, QStringLiteral("internalConfig/numColumns")
|
||||
, QStringLiteral("internalConfig/numRows")
|
||||
};
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ bool ServerConfig::save(const QString &fileName) const
|
|||
bool ServerConfig::operator==(const ServerConfig &sc) const
|
||||
{
|
||||
return m_Screens == sc.m_Screens && //
|
||||
m_HasHeartbeat == sc.m_HasHeartbeat && //
|
||||
m_Heartbeat == sc.m_Heartbeat && //
|
||||
m_RelativeMouseMoves == sc.m_RelativeMouseMoves && //
|
||||
m_Win32KeepForeground == sc.m_Win32KeepForeground && //
|
||||
|
|
@ -99,7 +98,6 @@ void ServerConfig::commit()
|
|||
settings().beginGroup("internalConfig");
|
||||
settings().remove("");
|
||||
|
||||
settings().setValue("hasHeartbeat", hasHeartbeat());
|
||||
settings().setValue("heartbeat", heartbeat());
|
||||
settings().setValue("relativeMouseMoves", relativeMouseMoves());
|
||||
settings().setValue("win32KeepForeground", win32KeepForeground());
|
||||
|
|
@ -150,7 +148,6 @@ void ServerConfig::recall()
|
|||
// ourselves
|
||||
setupScreens();
|
||||
|
||||
haveHeartbeat(settings().value("hasHeartbeat", false).toBool());
|
||||
setHeartbeat(settings().value("heartbeat", 5000).toInt());
|
||||
setRelativeMouseMoves(settings().value("relativeMouseMoves", false).toBool());
|
||||
setWin32KeepForeground(settings().value("win32KeepForeground", false).toBool());
|
||||
|
|
@ -247,7 +244,7 @@ QTextStream &operator<<(QTextStream &outStream, const ServerConfig &config)
|
|||
|
||||
outStream << "section: options" << Qt::endl;
|
||||
|
||||
if (config.hasHeartbeat())
|
||||
if (Settings::value(Settings::Server::EnableHeatbeat).toBool())
|
||||
outStream << "\t" << "heartbeat = " << config.heartbeat() << Qt::endl;
|
||||
|
||||
outStream << "\t"
|
||||
|
|
|
|||
|
|
@ -40,10 +40,6 @@ public:
|
|||
//
|
||||
// New methods
|
||||
//
|
||||
bool hasHeartbeat() const
|
||||
{
|
||||
return m_HasHeartbeat;
|
||||
}
|
||||
int heartbeat() const
|
||||
{
|
||||
return m_Heartbeat;
|
||||
|
|
@ -134,10 +130,6 @@ private:
|
|||
{
|
||||
m_Screens.append(screen);
|
||||
}
|
||||
void haveHeartbeat(bool on)
|
||||
{
|
||||
m_HasHeartbeat = on;
|
||||
}
|
||||
void setHeartbeat(int val)
|
||||
{
|
||||
m_Heartbeat = val;
|
||||
|
|
@ -202,7 +194,6 @@ private:
|
|||
bool fixNoServer(const QString &name, int &index);
|
||||
|
||||
private:
|
||||
bool m_HasHeartbeat = false;
|
||||
int m_Heartbeat = 0;
|
||||
bool m_RelativeMouseMoves = false;
|
||||
bool m_Win32KeepForeground = false;
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ void ServerConfigDialog::accept()
|
|||
// original one, which is a reference to the one in MainWindow.
|
||||
setOriginalServerConfig(serverConfig());
|
||||
Settings::setValue(Settings::Server::Protocol, networkProtocolToOption(m_protocol));
|
||||
Settings::setValue(Settings::Server::EnableHeatbeat, m_enableHeartbeat);
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
|
@ -224,8 +225,8 @@ void ServerConfigDialog::setClipboardLimit(int limit)
|
|||
|
||||
void ServerConfigDialog::toggleHeartbeat(bool enabled)
|
||||
{
|
||||
m_enableHeartbeat = enabled;
|
||||
ui->sbHeartbeat->setEnabled(enabled);
|
||||
serverConfig().haveHeartbeat(enabled);
|
||||
onChange();
|
||||
}
|
||||
|
||||
|
|
@ -378,7 +379,9 @@ void ServerConfigDialog::loadFromConfig()
|
|||
ui->rbProtocolBarrier->setChecked(m_protocol == NetworkProtocol::Barrier);
|
||||
|
||||
ui->lineConfigFile->setText(serverConfig().configFile());
|
||||
ui->cbHeartbeat->setChecked(serverConfig().hasHeartbeat());
|
||||
|
||||
m_enableHeartbeat = Settings::value(Settings::Server::EnableHeatbeat).toBool();
|
||||
ui->cbHeartbeat->setChecked(m_enableHeartbeat);
|
||||
ui->sbHeartbeat->setEnabled(ui->cbHeartbeat->isChecked());
|
||||
ui->sbHeartbeat->setValue(serverConfig().heartbeat());
|
||||
ui->cbRelativeMouseMoves->setChecked(serverConfig().relativeMouseMoves());
|
||||
|
|
@ -503,7 +506,8 @@ void ServerConfigDialog::onChange()
|
|||
{
|
||||
bool isAppConfigDataEqual = m_originalServerConfigIsExternal == serverConfig().useExternalConfig() &&
|
||||
m_originalServerConfigUsesExternalFile == serverConfig().configFile() &&
|
||||
m_protocol == Settings::networkProtocol();
|
||||
m_protocol == Settings::networkProtocol() &&
|
||||
m_enableHeartbeat == Settings::value(Settings::Server::EnableHeatbeat).toBool();
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)
|
||||
->setEnabled(!isAppConfigDataEqual || !(m_originalServerConfig == m_serverConfig));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ private:
|
|||
int m_rows;
|
||||
ServerConfig &m_originalServerConfig;
|
||||
NetworkProtocol m_protocol;
|
||||
bool m_enableHeartbeat;
|
||||
bool m_originalServerConfigIsExternal;
|
||||
QString m_originalServerConfigUsesExternalFile;
|
||||
ServerConfig m_serverConfig;
|
||||
|
|
|
|||
Loading…
Reference in a new issue