refactor: move numRows to general configuation server/gridHeight

This commit is contained in:
sithlord48 2026-06-08 19:36:16 -04:00 committed by Nick Bolton
parent cd1ceccda5
commit 6105e4025a
6 changed files with 10 additions and 6 deletions

View file

@ -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 |
| 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)|
| 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 |
| xdpRestoreToken | UUID | Restore token provided by XDG portals |

View file

@ -23,6 +23,7 @@ const auto kCopyright = //
const auto kCoreBinName = "@CORE_BINARY@";
const auto kCoreIpcName = "@CMAKE_PROJECT_NAME@-core";
const auto kServerGridHeight = 3;
const auto kServerGridWidth = 5;
#ifdef _WIN32

View file

@ -213,6 +213,9 @@ QVariant Settings::defaultValue(const QString &key)
if (key == Server::GridWidth)
return kServerGridWidth;
if (key == Server::GridHeight)
return kServerGridHeight;
return QVariant();
}

View file

@ -105,6 +105,7 @@ public:
{
inline static const auto ExternalConfig = QStringLiteral("server/externalConfig");
inline static const auto ExternalConfigFile = QStringLiteral("server/externalConfigFile");
inline static const auto GridHeight = QStringLiteral("server/gridHeight");
inline static const auto GridWidth = QStringLiteral("server/gridWidth");
inline static const auto Protocol = QStringLiteral("server/protocol");
inline static const auto XdpRestoreToken = QStringLiteral("server/xdpRestoreToken");
@ -242,6 +243,7 @@ private:
, Settings::Security::TlsEnabled
, Settings::Server::ExternalConfig
, Settings::Server::ExternalConfigFile
, Settings::Server::GridHeight
, Settings::Server::GridWidth
, Settings::Server::Protocol
, Settings::Server::XdpRestoreToken
@ -291,6 +293,7 @@ private:
inline static const QStringList m_oldServerConfigKeys = {
QStringLiteral("internalConfig/protocol")
, QStringLiteral("internalConfig/numColumns")
, QStringLiteral("internalConfig/numRows")
};
// clang-format on
};

View file

@ -102,8 +102,6 @@ void ServerConfig::commit()
settings().beginGroup("internalConfig");
settings().remove("");
settings().setValue("numRows", numRows());
settings().setValue("hasHeartbeat", hasHeartbeat());
settings().setValue("heartbeat", heartbeat());
settings().setValue("relativeMouseMoves", relativeMouseMoves());
@ -149,7 +147,7 @@ void ServerConfig::recall()
settings().beginGroup("internalConfig");
setNumColumns(Settings::value(Settings::Server::GridWidth).toInt());
setNumRows(settings().value("numRows", 3).toInt());
setNumRows(Settings::value(Settings::Server::GridHeight).toInt());
// we need to know the number of columns and rows before we can set up
// ourselves

View file

@ -15,8 +15,6 @@
#include <QList>
const auto kDefaultRows = 3;
class QTextStream;
class QSettings;
class QString;
@ -36,7 +34,7 @@ class ServerConfig : public ScreenConfig
friend QTextStream &operator<<(QTextStream &outStream, const ServerConfig &config);
public:
explicit ServerConfig(int columns = kServerGridWidth, int rows = kDefaultRows);
explicit ServerConfig(int columns = kServerGridWidth, int rows = kServerGridHeight);
~ServerConfig() = default;
bool operator==(const ServerConfig &sc) const;