refactor: remove Settings::Client::Binary and Settings::Server::Binary use kCoreBinName, instead
This commit is contained in:
committed by
Chris Rizzitello
parent
d9ce9c4f10
commit
8192d7b2d8
@ -103,12 +103,6 @@ QVariant Settings::defaultValue(const QString &key)
|
||||
if (key == Log::Level)
|
||||
return 4; // INFO
|
||||
|
||||
if (key == Client::Binary)
|
||||
return kCoreBinName;
|
||||
|
||||
if (key == Server::Binary)
|
||||
return kCoreBinName;
|
||||
|
||||
if (key == Daemon::Elevate)
|
||||
return Settings::isNativeMode();
|
||||
|
||||
|
||||
@ -33,7 +33,6 @@ public:
|
||||
|
||||
struct Client
|
||||
{
|
||||
inline static const auto Binary = QStringLiteral("client/binary");
|
||||
inline static const auto InvertScrollDirection = QStringLiteral("client/invertScrollDirection");
|
||||
inline static const auto LanguageSync = QStringLiteral("client/languageSync");
|
||||
inline static const auto RemoteHost = QStringLiteral("client/remoteHost");
|
||||
@ -84,7 +83,6 @@ public:
|
||||
};
|
||||
struct Server
|
||||
{
|
||||
inline static const auto Binary = QStringLiteral("server/binary");
|
||||
inline static const auto ConfigVisible = QStringLiteral("server/configVisible");
|
||||
inline static const auto ExternalConfig = QStringLiteral("server/externalConfig");
|
||||
inline static const auto ExternalConfigFile = QStringLiteral("server/externalConfigFile");
|
||||
@ -159,8 +157,7 @@ private:
|
||||
};
|
||||
|
||||
inline static const QStringList m_validKeys = {
|
||||
Settings::Client::Binary
|
||||
, Settings::Client::InvertScrollDirection
|
||||
Settings::Client::InvertScrollDirection
|
||||
, Settings::Client::LanguageSync
|
||||
, Settings::Client::RemoteHost
|
||||
, Settings::Client::XdpRestoreToken
|
||||
@ -191,7 +188,6 @@ private:
|
||||
, Settings::Security::CheckPeers
|
||||
, Settings::Security::KeySize
|
||||
, Settings::Security::TlsEnabled
|
||||
, Settings::Server::Binary
|
||||
, Settings::Server::ConfigVisible
|
||||
, Settings::Server::ExternalConfig
|
||||
, Settings::Server::ExternalConfigFile
|
||||
|
||||
@ -358,23 +358,24 @@ void CoreProcess::start(std::optional<ProcessMode> processModeOption)
|
||||
);
|
||||
}
|
||||
|
||||
QString app;
|
||||
const auto app = getAppFilePath(kCoreBinName);
|
||||
if (!QFile::exists(app)) {
|
||||
qFatal("core server binary does not exist");
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList args;
|
||||
|
||||
addGenericArgs(args);
|
||||
|
||||
if (mode() == Server && !addServerArgs(args, app)) {
|
||||
qWarning("failed to add server args for core process, aborting start");
|
||||
return;
|
||||
} else if (mode() == Client && !addClientArgs(args, app)) {
|
||||
qWarning("failed to add client args for core process, aborting start");
|
||||
return;
|
||||
}
|
||||
|
||||
if (mode() == Server) {
|
||||
args.prepend("server");
|
||||
args.prepend(QStringLiteral("server"));
|
||||
if (!addServerArgs(args))
|
||||
qWarning("failed to add server args for core process, aborting start");
|
||||
} else if (mode() == Client) {
|
||||
args.prepend("client");
|
||||
args.prepend(QStringLiteral("client"));
|
||||
if (!addClientArgs(args))
|
||||
qWarning("failed to add client args for core process, aborting start");
|
||||
} else {
|
||||
qFatal("core started without mode");
|
||||
return;
|
||||
@ -476,15 +477,8 @@ bool CoreProcess::addGenericArgs(QStringList &args) const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CoreProcess::addServerArgs(QStringList &args, QString &app)
|
||||
bool CoreProcess::addServerArgs(QStringList &args)
|
||||
{
|
||||
app = getAppFilePath(Settings::value(Settings::Server::Binary).toString());
|
||||
|
||||
if (!QFile::exists(app)) {
|
||||
qFatal("core server binary does not exist");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Settings::value(Settings::Log::ToFile).toBool()) {
|
||||
persistLogDir();
|
||||
args << "--log" << Settings::value(Settings::Log::File).toString();
|
||||
@ -522,15 +516,8 @@ bool CoreProcess::addServerArgs(QStringList &args, QString &app)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CoreProcess::addClientArgs(QStringList &args, QString &app)
|
||||
bool CoreProcess::addClientArgs(QStringList &args)
|
||||
{
|
||||
app = getAppFilePath(Settings::value(Settings::Client::Binary).toString());
|
||||
|
||||
if (!QFile::exists(app)) {
|
||||
qFatal("core client binary does not exist");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Settings::value(Settings::Log::ToFile).toBool()) {
|
||||
persistLogDir();
|
||||
args << "--log" << Settings::value(Settings::Log::File).toString();
|
||||
|
||||
@ -116,8 +116,8 @@ private:
|
||||
void stopForegroundProcess() const;
|
||||
void stopProcessFromDaemon();
|
||||
bool addGenericArgs(QStringList &args) const;
|
||||
bool addServerArgs(QStringList &args, QString &app);
|
||||
bool addClientArgs(QStringList &args, QString &app);
|
||||
bool addServerArgs(QStringList &args);
|
||||
bool addClientArgs(QStringList &args);
|
||||
QString persistServerConfig() const;
|
||||
QString modeString() const;
|
||||
QString processModeString() const;
|
||||
|
||||
Reference in New Issue
Block a user