refactor: move numColumns to general configuation server/gridWidth
This commit is contained in:
parent
16141d7156
commit
cd1ceccda5
6 changed files with 18 additions and 6 deletions
|
|
@ -144,6 +144,7 @@ This section contains options used when in server mode it will begin with `[serv
|
||||||
|:-------------------|:-----------------:|:-----------|
|
|:-------------------|:-----------------:|:-----------|
|
||||||
| 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.|
|
||||||
|
| gridWidth | int | Width of the server's intenal grid used for the computer layout (default: 5) |
|
||||||
| 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 |
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Deskflow -- mouse and keyboard sharing utility
|
* Deskflow -- mouse and keyboard sharing utility
|
||||||
* SPDX-FileCopyrightText: (C) 2024 - 2025 Chris Rizzitello <sithlord48@gmail.com>
|
* SPDX-FileCopyrightText: (C) 2024 - 2026 Chris Rizzitello <sithlord48@gmail.com>
|
||||||
* SPDX-FileCopyrightText: (C) 2025 Synergy App Ltd
|
* SPDX-FileCopyrightText: (C) 2025 Synergy App Ltd
|
||||||
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
||||||
*/
|
*/
|
||||||
|
|
@ -23,6 +23,8 @@ const auto kCopyright = //
|
||||||
const auto kCoreBinName = "@CORE_BINARY@";
|
const auto kCoreBinName = "@CORE_BINARY@";
|
||||||
const auto kCoreIpcName = "@CMAKE_PROJECT_NAME@-core";
|
const auto kCoreIpcName = "@CMAKE_PROJECT_NAME@-core";
|
||||||
|
|
||||||
|
const auto kServerGridWidth = 5;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ void Settings::cleanSettings()
|
||||||
{
|
{
|
||||||
const QStringList keys = m_settings->allKeys();
|
const QStringList keys = m_settings->allKeys();
|
||||||
for (const QString &key : keys) {
|
for (const QString &key : keys) {
|
||||||
if (key.startsWith(QStringLiteral("internalConfig/protocol")))
|
if (m_oldServerConfigKeys.contains(key))
|
||||||
m_settings->remove(key);
|
m_settings->remove(key);
|
||||||
if (key.startsWith(QStringLiteral("internalConfig")))
|
if (key.startsWith(QStringLiteral("internalConfig")))
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -210,6 +210,9 @@ QVariant Settings::defaultValue(const QString &key)
|
||||||
if (key == Server::Protocol)
|
if (key == Server::Protocol)
|
||||||
return QVariant::fromValue(NetworkProtocol::Barrier);
|
return QVariant::fromValue(NetworkProtocol::Barrier);
|
||||||
|
|
||||||
|
if (key == Server::GridWidth)
|
||||||
|
return kServerGridWidth;
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,7 @@ public:
|
||||||
{
|
{
|
||||||
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 GridWidth = QStringLiteral("server/gridWidth");
|
||||||
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");
|
||||||
};
|
};
|
||||||
|
|
@ -241,6 +242,7 @@ private:
|
||||||
, Settings::Security::TlsEnabled
|
, Settings::Security::TlsEnabled
|
||||||
, Settings::Server::ExternalConfig
|
, Settings::Server::ExternalConfig
|
||||||
, Settings::Server::ExternalConfigFile
|
, Settings::Server::ExternalConfigFile
|
||||||
|
, Settings::Server::GridWidth
|
||||||
, Settings::Server::Protocol
|
, Settings::Server::Protocol
|
||||||
, Settings::Server::XdpRestoreToken
|
, Settings::Server::XdpRestoreToken
|
||||||
};
|
};
|
||||||
|
|
@ -285,5 +287,10 @@ private:
|
||||||
/* OLD KEY NEW KEY */
|
/* OLD KEY NEW KEY */
|
||||||
{QStringLiteral("core/screenName"), Settings::Core::ComputerName}
|
{QStringLiteral("core/screenName"), Settings::Core::ComputerName}
|
||||||
};
|
};
|
||||||
|
// Contains settings removed from server-configuration file
|
||||||
|
inline static const QStringList m_oldServerConfigKeys = {
|
||||||
|
QStringLiteral("internalConfig/protocol")
|
||||||
|
, QStringLiteral("internalConfig/numColumns")
|
||||||
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,6 @@ void ServerConfig::commit()
|
||||||
settings().beginGroup("internalConfig");
|
settings().beginGroup("internalConfig");
|
||||||
settings().remove("");
|
settings().remove("");
|
||||||
|
|
||||||
settings().setValue("numColumns", numColumns());
|
|
||||||
settings().setValue("numRows", numRows());
|
settings().setValue("numRows", numRows());
|
||||||
|
|
||||||
settings().setValue("hasHeartbeat", hasHeartbeat());
|
settings().setValue("hasHeartbeat", hasHeartbeat());
|
||||||
|
|
@ -149,7 +148,7 @@ void ServerConfig::recall()
|
||||||
|
|
||||||
settings().beginGroup("internalConfig");
|
settings().beginGroup("internalConfig");
|
||||||
|
|
||||||
setNumColumns(settings().value("numColumns", 5).toInt());
|
setNumColumns(Settings::value(Settings::Server::GridWidth).toInt());
|
||||||
setNumRows(settings().value("numRows", 3).toInt());
|
setNumRows(settings().value("numRows", 3).toInt());
|
||||||
|
|
||||||
// we need to know the number of columns and rows before we can set up
|
// we need to know the number of columns and rows before we can set up
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "common/Constants.h"
|
||||||
#include "common/NetworkProtocol.h"
|
#include "common/NetworkProtocol.h"
|
||||||
#include "gui/Hotkey.h"
|
#include "gui/Hotkey.h"
|
||||||
#include "gui/config/ScreenConfig.h"
|
#include "gui/config/ScreenConfig.h"
|
||||||
|
|
@ -14,7 +15,6 @@
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
|
||||||
const auto kDefaultColumns = 5;
|
|
||||||
const auto kDefaultRows = 3;
|
const auto kDefaultRows = 3;
|
||||||
|
|
||||||
class QTextStream;
|
class QTextStream;
|
||||||
|
|
@ -36,7 +36,7 @@ class ServerConfig : public ScreenConfig
|
||||||
friend QTextStream &operator<<(QTextStream &outStream, const ServerConfig &config);
|
friend QTextStream &operator<<(QTextStream &outStream, const ServerConfig &config);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ServerConfig(int columns = kDefaultColumns, int rows = kDefaultRows);
|
explicit ServerConfig(int columns = kServerGridWidth, int rows = kDefaultRows);
|
||||||
~ServerConfig() = default;
|
~ServerConfig() = default;
|
||||||
|
|
||||||
bool operator==(const ServerConfig &sc) const;
|
bool operator==(const ServerConfig &sc) const;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue