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