refactor: CoreProcess::processStateToString use QVariant conversion to string, make static member of CoreProcess
This commit is contained in:
parent
a120441a10
commit
13990438d3
2 changed files with 5 additions and 22 deletions
|
|
@ -31,34 +31,14 @@ const int kRetryDelay = 1000;
|
|||
const auto kServerConfigFilename = QStringLiteral("%1-server.conf").arg(kAppId);
|
||||
const auto kLineSplitRegex = QRegularExpression("\r|\n|\r\n");
|
||||
|
||||
//
|
||||
// free functions
|
||||
//
|
||||
|
||||
QString CoreProcess::processModeToString(const Settings::ProcessMode mode)
|
||||
{
|
||||
return QVariant::fromValue(mode).toString().toLower();
|
||||
}
|
||||
|
||||
QString processStateToString(CoreProcess::ProcessState state)
|
||||
QString CoreProcess::processStateToString(const CoreProcess::ProcessState state)
|
||||
{
|
||||
using enum CoreProcess::ProcessState;
|
||||
|
||||
switch (state) {
|
||||
case Starting:
|
||||
return "starting";
|
||||
case Started:
|
||||
return "started";
|
||||
case Stopping:
|
||||
return "stopping";
|
||||
case Stopped:
|
||||
return "stopped";
|
||||
case RetryPending:
|
||||
return "retry pending";
|
||||
default:
|
||||
qFatal("invalid process state");
|
||||
abort();
|
||||
}
|
||||
return QVariant::fromValue(state).toString().toLower();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ public:
|
|||
Stopped,
|
||||
RetryPending
|
||||
};
|
||||
Q_ENUM(ProcessState)
|
||||
|
||||
enum class ConnectionState
|
||||
{
|
||||
Disconnected,
|
||||
|
|
@ -126,6 +128,7 @@ private:
|
|||
void persistLogDir() const;
|
||||
static QString makeQuotedArgs(const QString &app, const QStringList &args);
|
||||
static QString processModeToString(const Settings::ProcessMode mode);
|
||||
static QString processStateToString(const CoreProcess::ProcessState state);
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
void checkOSXNotification(const QString &line);
|
||||
|
|
|
|||
Loading…
Reference in a new issue