refactor: move clientBinary to Settings
newkey: client/binary <= General/coreClientBinary remove coreBinary from AppConfig
This commit is contained in:
parent
b7960eecb4
commit
de3b9d8e2e
8 changed files with 16 additions and 15 deletions
|
|
@ -89,6 +89,9 @@ QVariant Settings::defaultValue(const QString &key)
|
||||||
if (key == Security::Certificate)
|
if (key == Security::Certificate)
|
||||||
return QStringLiteral("%1/%2/%3").arg(instance()->settingsPath(), kTlsDirName, kTlsCertificateFilename);
|
return QStringLiteral("%1/%2/%3").arg(instance()->settingsPath(), kTlsDirName, kTlsCertificateFilename);
|
||||||
|
|
||||||
|
if (key == Client::Binary)
|
||||||
|
return kClientBinName;
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,10 @@ public:
|
||||||
inline const static auto UserSettingFile = QStringLiteral("%1/%2.conf").arg(UserDir, kAppName);
|
inline const static auto UserSettingFile = QStringLiteral("%1/%2.conf").arg(UserDir, kAppName);
|
||||||
inline const static auto SystemSettingFile = QStringLiteral("%1/%2.conf").arg(SystemDir, kAppName);
|
inline const static auto SystemSettingFile = QStringLiteral("%1/%2.conf").arg(SystemDir, kAppName);
|
||||||
|
|
||||||
|
struct Client
|
||||||
|
{
|
||||||
|
inline static const auto Binary = QStringLiteral("client/binary");
|
||||||
|
};
|
||||||
struct Core
|
struct Core
|
||||||
{
|
{
|
||||||
inline static const auto LastVersion = QStringLiteral("core/lastVersion");
|
inline static const auto LastVersion = QStringLiteral("core/lastVersion");
|
||||||
|
|
@ -84,7 +88,8 @@ private:
|
||||||
QString m_portableSettingsFile = QStringLiteral("%1.conf").arg(kAppName);
|
QString m_portableSettingsFile = QStringLiteral("%1.conf").arg(kAppName);
|
||||||
// clang-format off
|
// clang-format off
|
||||||
inline static const QStringList m_validKeys = {
|
inline static const QStringList m_validKeys = {
|
||||||
Core::LastVersion
|
Client::Binary
|
||||||
|
, Core::LastVersion
|
||||||
, Core::PreventSleep
|
, Core::PreventSleep
|
||||||
, Core::Scope
|
, Core::Scope
|
||||||
, Core::StartedBefore
|
, Core::StartedBefore
|
||||||
|
|
|
||||||
|
|
@ -50,4 +50,10 @@ const auto kWindowsRegistryKey = "SOFTWARE\\@CMAKE_PROJECT_PROPER_NAME@";
|
||||||
const auto kCloseEventName = "Global\\@CMAKE_PROJECT_PROPER_NAME@Close";
|
const auto kCloseEventName = "Global\\@CMAKE_PROJECT_PROPER_NAME@Close";
|
||||||
const auto kSendSasEventName = "Global\\@CMAKE_PROJECT_PROPER_NAME@SendSAS";
|
const auto kSendSasEventName = "Global\\@CMAKE_PROJECT_PROPER_NAME@SendSAS";
|
||||||
|
|
||||||
|
const auto kClientBinName = "@CMAKE_PROJECT_NAME@-client.exe";
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
const auto kClientBinName = "@CMAKE_PROJECT_NAME@-client";
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -415,15 +415,6 @@ QString AppConfig::coreServerName() const
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AppConfig::coreClientName() const
|
|
||||||
{
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
return s_winExeTemplate.arg(s_CoreClientName);
|
|
||||||
#else
|
|
||||||
return s_CoreClientName;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
ElevateMode AppConfig::elevateMode() const
|
ElevateMode AppConfig::elevateMode() const
|
||||||
{
|
{
|
||||||
return m_ElevateMode;
|
return m_ElevateMode;
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,6 @@ public:
|
||||||
bool logToFile() const override;
|
bool logToFile() const override;
|
||||||
const QString &logFilename() const override;
|
const QString &logFilename() const override;
|
||||||
QString coreServerName() const override;
|
QString coreServerName() const override;
|
||||||
QString coreClientName() const override;
|
|
||||||
void persistLogDir() const override;
|
void persistLogDir() const override;
|
||||||
bool languageSync() const override;
|
bool languageSync() const override;
|
||||||
bool invertScrollDirection() const override;
|
bool invertScrollDirection() const override;
|
||||||
|
|
@ -241,7 +240,6 @@ private:
|
||||||
inline static const auto s_winExeTemplate = QStringLiteral("%1.exe");
|
inline static const auto s_winExeTemplate = QStringLiteral("%1.exe");
|
||||||
#endif
|
#endif
|
||||||
inline static const auto s_CoreServerName = QStringLiteral("deskflow-server");
|
inline static const auto s_CoreServerName = QStringLiteral("deskflow-server");
|
||||||
inline static const auto s_CoreClientName = QStringLiteral("deskflow-client");
|
|
||||||
static const char m_LogDir[];
|
static const char m_LogDir[];
|
||||||
|
|
||||||
/// @brief Contains the string values of the settings names that will be saved
|
/// @brief Contains the string values of the settings names that will be saved
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@ public:
|
||||||
virtual bool logToFile() const = 0;
|
virtual bool logToFile() const = 0;
|
||||||
virtual const QString &logFilename() const = 0;
|
virtual const QString &logFilename() const = 0;
|
||||||
virtual QString coreServerName() const = 0;
|
virtual QString coreServerName() const = 0;
|
||||||
virtual QString coreClientName() const = 0;
|
|
||||||
virtual void persistLogDir() const = 0;
|
virtual void persistLogDir() const = 0;
|
||||||
virtual bool languageSync() const = 0;
|
virtual bool languageSync() const = 0;
|
||||||
virtual bool invertScrollDirection() const = 0;
|
virtual bool invertScrollDirection() const = 0;
|
||||||
|
|
|
||||||
|
|
@ -569,7 +569,7 @@ bool CoreProcess::addServerArgs(QStringList &args, QString &app)
|
||||||
|
|
||||||
bool CoreProcess::addClientArgs(QStringList &args, QString &app)
|
bool CoreProcess::addClientArgs(QStringList &args, QString &app)
|
||||||
{
|
{
|
||||||
app = m_pDeps->appPath(m_appConfig.coreClientName());
|
app = m_pDeps->appPath(Settings::value(Settings::Client::Binary).toString());
|
||||||
|
|
||||||
if (!m_pDeps->fileExists(app)) {
|
if (!m_pDeps->fileExists(app)) {
|
||||||
qFatal("core client binary does not exist");
|
qFatal("core client binary does not exist");
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,6 @@ public:
|
||||||
MOCK_METHOD(bool, logToFile, (), (const, override));
|
MOCK_METHOD(bool, logToFile, (), (const, override));
|
||||||
MOCK_METHOD(const QString &, logFilename, (), (const, override));
|
MOCK_METHOD(const QString &, logFilename, (), (const, override));
|
||||||
MOCK_METHOD(QString, coreServerName, (), (const, override));
|
MOCK_METHOD(QString, coreServerName, (), (const, override));
|
||||||
MOCK_METHOD(QString, coreClientName, (), (const, override));
|
|
||||||
MOCK_METHOD(void, persistLogDir, (), (const, override));
|
MOCK_METHOD(void, persistLogDir, (), (const, override));
|
||||||
MOCK_METHOD(bool, languageSync, (), (const, override));
|
MOCK_METHOD(bool, languageSync, (), (const, override));
|
||||||
MOCK_METHOD(bool, invertScrollDirection, (), (const, override));
|
MOCK_METHOD(bool, invertScrollDirection, (), (const, override));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue