refactor: move serverBinary to Settings
newkey: server/binary <= General/coreServerBinary remove coreServer from AppConfig
This commit is contained in:
@ -92,6 +92,9 @@ QVariant Settings::defaultValue(const QString &key)
|
||||
if (key == Client::Binary)
|
||||
return kClientBinName;
|
||||
|
||||
if (key == Server::Binary)
|
||||
return kServerBinName;
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
@ -57,6 +57,10 @@ public:
|
||||
inline static const auto KeySize = QStringLiteral("security/keySize");
|
||||
inline static const auto TlsEnabled = QStringLiteral("security/tlsEnabled");
|
||||
};
|
||||
struct Server
|
||||
{
|
||||
inline static const auto Binary = QStringLiteral("server/binary");
|
||||
};
|
||||
|
||||
static Settings *instance();
|
||||
static void setSettingFile(const QString &settingsFile = QString());
|
||||
@ -104,6 +108,7 @@ private:
|
||||
, Security::CheckPeers
|
||||
, Security::KeySize
|
||||
, Security::TlsEnabled
|
||||
, Server::Binary
|
||||
};
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
@ -51,9 +51,11 @@ const auto kCloseEventName = "Global\\@CMAKE_PROJECT_PROPER_NAME@Close";
|
||||
const auto kSendSasEventName = "Global\\@CMAKE_PROJECT_PROPER_NAME@SendSAS";
|
||||
|
||||
const auto kClientBinName = "@CMAKE_PROJECT_NAME@-client.exe";
|
||||
const auto kServerBinName = "@CMAKE_PROJECT_NAME@-server.exe";
|
||||
|
||||
#else
|
||||
|
||||
const auto kClientBinName = "@CMAKE_PROJECT_NAME@-client";
|
||||
const auto kServerBinName = "@CMAKE_PROJECT_NAME@-server";
|
||||
|
||||
#endif
|
||||
|
||||
@ -406,15 +406,6 @@ ProcessMode AppConfig::processMode() const
|
||||
return m_EnableService ? ProcessMode::kService : ProcessMode::kDesktop;
|
||||
}
|
||||
|
||||
QString AppConfig::coreServerName() const
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
return s_winExeTemplate.arg(s_CoreServerName);
|
||||
#else
|
||||
return s_CoreServerName;
|
||||
#endif
|
||||
}
|
||||
|
||||
ElevateMode AppConfig::elevateMode() const
|
||||
{
|
||||
return m_ElevateMode;
|
||||
|
||||
@ -134,7 +134,6 @@ public:
|
||||
const QString &screenName() const override;
|
||||
bool logToFile() const override;
|
||||
const QString &logFilename() const override;
|
||||
QString coreServerName() const override;
|
||||
void persistLogDir() const override;
|
||||
bool languageSync() const override;
|
||||
bool invertScrollDirection() const override;
|
||||
@ -235,11 +234,6 @@ private:
|
||||
/// @param [in] scope which should be loaded.
|
||||
void loadScope(IConfigScopes::Scope scope);
|
||||
|
||||
// Used to make the server and client names on windows.
|
||||
#ifdef Q_OS_WIN
|
||||
inline static const auto s_winExeTemplate = QStringLiteral("%1.exe");
|
||||
#endif
|
||||
inline static const auto s_CoreServerName = QStringLiteral("deskflow-server");
|
||||
static const char m_LogDir[];
|
||||
|
||||
/// @brief Contains the string values of the settings names that will be saved
|
||||
|
||||
@ -38,7 +38,6 @@ public:
|
||||
virtual const QString &screenName() const = 0;
|
||||
virtual bool logToFile() const = 0;
|
||||
virtual const QString &logFilename() const = 0;
|
||||
virtual QString coreServerName() const = 0;
|
||||
virtual void persistLogDir() const = 0;
|
||||
virtual bool languageSync() const = 0;
|
||||
virtual bool invertScrollDirection() const = 0;
|
||||
|
||||
@ -521,7 +521,7 @@ bool CoreProcess::addGenericArgs(QStringList &args, const ProcessMode processMod
|
||||
|
||||
bool CoreProcess::addServerArgs(QStringList &args, QString &app)
|
||||
{
|
||||
app = m_pDeps->appPath(m_appConfig.coreServerName());
|
||||
app = m_pDeps->appPath(Settings::value(Settings::Server::Binary).toString());
|
||||
|
||||
if (!m_pDeps->fileExists(app)) {
|
||||
qFatal("core server binary does not exist");
|
||||
|
||||
@ -39,7 +39,6 @@ public:
|
||||
MOCK_METHOD(const QString &, screenName, (), (const, override));
|
||||
MOCK_METHOD(bool, logToFile, (), (const, override));
|
||||
MOCK_METHOD(const QString &, logFilename, (), (const, override));
|
||||
MOCK_METHOD(QString, coreServerName, (), (const, override));
|
||||
MOCK_METHOD(void, persistLogDir, (), (const, override));
|
||||
MOCK_METHOD(bool, languageSync, (), (const, override));
|
||||
MOCK_METHOD(bool, invertScrollDirection, (), (const, override));
|
||||
|
||||
Reference in New Issue
Block a user