refactor(settings): exclusively read proto from the general settings
This commit is contained in:
parent
c4f65c04a3
commit
b91a39492f
5 changed files with 7 additions and 28 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Deskflow -- mouse and keyboard sharing utility
|
||||
* SPDX-FileCopyrightText: (C) 2025 Chris Rizzitello <sithlord48@gmail.com>
|
||||
* SPDX-FileCopyrightText: (C) 2025 - 2026 Chris Rizzitello <sithlord48@gmail.com>
|
||||
* SPDX-FileCopyrightText: (C) 2012 Synergy App Ltd
|
||||
* SPDX-FileCopyrightText: (C) 2008 Volker Lanz <vl@fidra.de>
|
||||
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
||||
|
|
@ -55,7 +55,6 @@ bool ServerConfig::operator==(const ServerConfig &sc) const
|
|||
return m_Screens == sc.m_Screens && //
|
||||
m_HasHeartbeat == sc.m_HasHeartbeat && //
|
||||
m_Heartbeat == sc.m_Heartbeat && //
|
||||
m_Protocol == sc.m_Protocol && //
|
||||
m_RelativeMouseMoves == sc.m_RelativeMouseMoves && //
|
||||
m_Win32KeepForeground == sc.m_Win32KeepForeground && //
|
||||
m_HasSwitchDelay == sc.m_HasSwitchDelay && //
|
||||
|
|
@ -153,7 +152,6 @@ void ServerConfig::recall()
|
|||
|
||||
haveHeartbeat(settings().value("hasHeartbeat", false).toBool());
|
||||
setHeartbeat(settings().value("heartbeat", 5000).toInt());
|
||||
setProtocol(Settings::value(Settings::Server::Protocol).value<NetworkProtocol>());
|
||||
setRelativeMouseMoves(settings().value("relativeMouseMoves", false).toBool());
|
||||
setWin32KeepForeground(settings().value("win32KeepForeground", false).toBool());
|
||||
haveSwitchDelay(settings().value("hasSwitchDelay", false).toBool());
|
||||
|
|
@ -252,10 +250,6 @@ QTextStream &operator<<(QTextStream &outStream, const ServerConfig &config)
|
|||
if (config.hasHeartbeat())
|
||||
outStream << "\t" << "heartbeat = " << config.heartbeat() << Qt::endl;
|
||||
|
||||
if (config.protocol() == NetworkProtocol::Unknown)
|
||||
qFatal("unrecognized protocol when writing config");
|
||||
outStream << "\t" << "protocol = " << networkProtocolToOption(config.protocol()) << Qt::endl;
|
||||
|
||||
outStream << "\t"
|
||||
<< "relativeMouseMoves = " << (config.relativeMouseMoves() ? "true" : "false") << Qt::endl;
|
||||
outStream << "\t"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Deskflow -- mouse and keyboard sharing utility
|
||||
* SPDX-FileCopyrightText: (C) 2025 - 2026 Chris Rizzitello <sithlord48@gmail.com>
|
||||
* SPDX-FileCopyrightText: (C) 2012 Synergy App Ltd
|
||||
* SPDX-FileCopyrightText: (C) 2008 Volker Lanz <vl@fidra.de>
|
||||
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
||||
|
|
@ -8,7 +9,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "common/Constants.h"
|
||||
#include "common/NetworkProtocol.h"
|
||||
#include "gui/Hotkey.h"
|
||||
#include "gui/config/ScreenConfig.h"
|
||||
#include "gui/config/ScreenList.h"
|
||||
|
|
@ -21,13 +21,6 @@ class QString;
|
|||
class QFile;
|
||||
class ServerConfigDialog;
|
||||
|
||||
namespace deskflow::gui {
|
||||
|
||||
// The default protocol was decided by a community vote.
|
||||
const auto kDefaultProtocol = NetworkProtocol::Barrier;
|
||||
|
||||
} // namespace deskflow::gui
|
||||
|
||||
class ServerConfig : public ScreenConfig
|
||||
{
|
||||
friend class ServerConfigDialog;
|
||||
|
|
@ -55,10 +48,6 @@ public:
|
|||
{
|
||||
return m_Heartbeat;
|
||||
}
|
||||
NetworkProtocol protocol() const
|
||||
{
|
||||
return m_Protocol;
|
||||
}
|
||||
bool relativeMouseMoves() const
|
||||
{
|
||||
return m_RelativeMouseMoves;
|
||||
|
|
@ -153,10 +142,6 @@ private:
|
|||
{
|
||||
m_Heartbeat = val;
|
||||
}
|
||||
void setProtocol(NetworkProtocol val)
|
||||
{
|
||||
m_Protocol = val;
|
||||
}
|
||||
void setRelativeMouseMoves(bool on)
|
||||
{
|
||||
m_RelativeMouseMoves = on;
|
||||
|
|
@ -219,7 +204,6 @@ private:
|
|||
private:
|
||||
bool m_HasHeartbeat = false;
|
||||
int m_Heartbeat = 0;
|
||||
NetworkProtocol m_Protocol = deskflow::gui::kDefaultProtocol;
|
||||
bool m_RelativeMouseMoves = false;
|
||||
bool m_Win32KeepForeground = false;
|
||||
bool m_HasSwitchDelay = false;
|
||||
|
|
|
|||
|
|
@ -70,8 +70,9 @@ ServerConfigDialog::ServerConfigDialog(QWidget *parent, ServerConfig &config)
|
|||
ui->btnBrowseConfigFile->setIcon(QIcon::fromTheme(QIcon::ThemeIcon::DocumentOpen));
|
||||
ui->lineConfigFile->setText(serverConfig().configFile());
|
||||
|
||||
ui->rbProtocolSynergy->setChecked(serverConfig().protocol() == NetworkProtocol::Synergy);
|
||||
ui->rbProtocolBarrier->setChecked(serverConfig().protocol() == NetworkProtocol::Barrier);
|
||||
const auto networkProtocol = networkProtocolFromString(Settings::value(Settings::Server::Protocol).toString());
|
||||
ui->rbProtocolSynergy->setChecked(networkProtocol == NetworkProtocol::Synergy);
|
||||
ui->rbProtocolBarrier->setChecked(networkProtocol == NetworkProtocol::Barrier);
|
||||
connect(ui->rbProtocolBarrier, &QRadioButton::toggled, this, &ServerConfigDialog::toggleProtocol);
|
||||
|
||||
ui->cbHeartbeat->setChecked(serverConfig().hasHeartbeat());
|
||||
|
|
@ -368,7 +369,6 @@ void ServerConfigDialog::toggleRelativeMouseMoves(bool enabled)
|
|||
void ServerConfigDialog::toggleProtocol()
|
||||
{
|
||||
auto proto = ui->rbProtocolBarrier->isChecked() ? NetworkProtocol::Barrier : NetworkProtocol::Synergy;
|
||||
serverConfig().setProtocol(proto);
|
||||
Settings::setValue(Settings::Server::Protocol, networkProtocolToOption(proto));
|
||||
onChange();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "ScreenSetupModel.h"
|
||||
#include "common/NetworkProtocol.h"
|
||||
#include "config/ServerConfig.h"
|
||||
|
||||
#include <QDialog>
|
||||
|
|
|
|||
|
|
@ -1130,7 +1130,7 @@ void Server::processOptions()
|
|||
stopRelativeMoves();
|
||||
}
|
||||
m_relativeMoves = newRelativeMoves;
|
||||
m_protocol = Settings::value(Settings::Server::Protocol).value<NetworkProtocol>();
|
||||
m_protocol = networkProtocolFromString(Settings::value(Settings::Server::Protocol).toString());
|
||||
}
|
||||
|
||||
void Server::handleShapeChanged(BaseClientProxy *client)
|
||||
|
|
|
|||
Loading…
Reference in a new issue