refactor: remove Settings::Client::Binary and Settings::Server::Binary use kCoreBinName, instead
This commit is contained in:
parent
d9ce9c4f10
commit
8192d7b2d8
4 changed files with 17 additions and 40 deletions
|
|
@ -103,12 +103,6 @@ QVariant Settings::defaultValue(const QString &key)
|
||||||
if (key == Log::Level)
|
if (key == Log::Level)
|
||||||
return 4; // INFO
|
return 4; // INFO
|
||||||
|
|
||||||
if (key == Client::Binary)
|
|
||||||
return kCoreBinName;
|
|
||||||
|
|
||||||
if (key == Server::Binary)
|
|
||||||
return kCoreBinName;
|
|
||||||
|
|
||||||
if (key == Daemon::Elevate)
|
if (key == Daemon::Elevate)
|
||||||
return Settings::isNativeMode();
|
return Settings::isNativeMode();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ public:
|
||||||
|
|
||||||
struct Client
|
struct Client
|
||||||
{
|
{
|
||||||
inline static const auto Binary = QStringLiteral("client/binary");
|
|
||||||
inline static const auto InvertScrollDirection = QStringLiteral("client/invertScrollDirection");
|
inline static const auto InvertScrollDirection = QStringLiteral("client/invertScrollDirection");
|
||||||
inline static const auto LanguageSync = QStringLiteral("client/languageSync");
|
inline static const auto LanguageSync = QStringLiteral("client/languageSync");
|
||||||
inline static const auto RemoteHost = QStringLiteral("client/remoteHost");
|
inline static const auto RemoteHost = QStringLiteral("client/remoteHost");
|
||||||
|
|
@ -84,7 +83,6 @@ public:
|
||||||
};
|
};
|
||||||
struct Server
|
struct Server
|
||||||
{
|
{
|
||||||
inline static const auto Binary = QStringLiteral("server/binary");
|
|
||||||
inline static const auto ConfigVisible = QStringLiteral("server/configVisible");
|
inline static const auto ConfigVisible = QStringLiteral("server/configVisible");
|
||||||
inline static const auto ExternalConfig = QStringLiteral("server/externalConfig");
|
inline static const auto ExternalConfig = QStringLiteral("server/externalConfig");
|
||||||
inline static const auto ExternalConfigFile = QStringLiteral("server/externalConfigFile");
|
inline static const auto ExternalConfigFile = QStringLiteral("server/externalConfigFile");
|
||||||
|
|
@ -159,8 +157,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
inline static const QStringList m_validKeys = {
|
inline static const QStringList m_validKeys = {
|
||||||
Settings::Client::Binary
|
Settings::Client::InvertScrollDirection
|
||||||
, Settings::Client::InvertScrollDirection
|
|
||||||
, Settings::Client::LanguageSync
|
, Settings::Client::LanguageSync
|
||||||
, Settings::Client::RemoteHost
|
, Settings::Client::RemoteHost
|
||||||
, Settings::Client::XdpRestoreToken
|
, Settings::Client::XdpRestoreToken
|
||||||
|
|
@ -191,7 +188,6 @@ private:
|
||||||
, Settings::Security::CheckPeers
|
, Settings::Security::CheckPeers
|
||||||
, Settings::Security::KeySize
|
, Settings::Security::KeySize
|
||||||
, Settings::Security::TlsEnabled
|
, Settings::Security::TlsEnabled
|
||||||
, Settings::Server::Binary
|
|
||||||
, Settings::Server::ConfigVisible
|
, Settings::Server::ConfigVisible
|
||||||
, Settings::Server::ExternalConfig
|
, Settings::Server::ExternalConfig
|
||||||
, Settings::Server::ExternalConfigFile
|
, 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;
|
QStringList args;
|
||||||
|
|
||||||
addGenericArgs(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) {
|
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) {
|
} 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 {
|
} else {
|
||||||
qFatal("core started without mode");
|
qFatal("core started without mode");
|
||||||
return;
|
return;
|
||||||
|
|
@ -476,15 +477,8 @@ bool CoreProcess::addGenericArgs(QStringList &args) const
|
||||||
return true;
|
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()) {
|
if (Settings::value(Settings::Log::ToFile).toBool()) {
|
||||||
persistLogDir();
|
persistLogDir();
|
||||||
args << "--log" << Settings::value(Settings::Log::File).toString();
|
args << "--log" << Settings::value(Settings::Log::File).toString();
|
||||||
|
|
@ -522,15 +516,8 @@ bool CoreProcess::addServerArgs(QStringList &args, QString &app)
|
||||||
return true;
|
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()) {
|
if (Settings::value(Settings::Log::ToFile).toBool()) {
|
||||||
persistLogDir();
|
persistLogDir();
|
||||||
args << "--log" << Settings::value(Settings::Log::File).toString();
|
args << "--log" << Settings::value(Settings::Log::File).toString();
|
||||||
|
|
|
||||||
|
|
@ -116,8 +116,8 @@ private:
|
||||||
void stopForegroundProcess() const;
|
void stopForegroundProcess() const;
|
||||||
void stopProcessFromDaemon();
|
void stopProcessFromDaemon();
|
||||||
bool addGenericArgs(QStringList &args) const;
|
bool addGenericArgs(QStringList &args) const;
|
||||||
bool addServerArgs(QStringList &args, QString &app);
|
bool addServerArgs(QStringList &args);
|
||||||
bool addClientArgs(QStringList &args, QString &app);
|
bool addClientArgs(QStringList &args);
|
||||||
QString persistServerConfig() const;
|
QString persistServerConfig() const;
|
||||||
QString modeString() const;
|
QString modeString() const;
|
||||||
QString processModeString() const;
|
QString processModeString() const;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue