refactor: CoreProcess::onProcessFinished add using for ProcessState enum
This commit is contained in:
parent
60e71aad38
commit
f0e02724ee
1 changed files with 5 additions and 4 deletions
|
|
@ -198,6 +198,7 @@ void CoreProcess::daemonIpcClientConnected()
|
||||||
|
|
||||||
void CoreProcess::onProcessFinished(int exitCode, QProcess::ExitStatus)
|
void CoreProcess::onProcessFinished(int exitCode, QProcess::ExitStatus)
|
||||||
{
|
{
|
||||||
|
using enum ProcessState;
|
||||||
setConnectionState(ConnectionState::Disconnected);
|
setConnectionState(ConnectionState::Disconnected);
|
||||||
|
|
||||||
if (m_retryTimer.isActive()) {
|
if (m_retryTimer.isActive()) {
|
||||||
|
|
@ -205,20 +206,20 @@ void CoreProcess::onProcessFinished(int exitCode, QProcess::ExitStatus)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exitCode == s_exitDuplicate) {
|
if (exitCode == s_exitDuplicate) {
|
||||||
setProcessState(ProcessState::Stopped);
|
setProcessState(Stopped);
|
||||||
qWarning("desktop process is already running");
|
qWarning("desktop process is already running");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_IPC("desktop process exited with code: %d", exitCode);
|
LOG_IPC("desktop process exited with code: %d", exitCode);
|
||||||
|
|
||||||
if (const auto wasStarted = m_processState == ProcessState::Started; wasStarted) {
|
if (const auto wasStarted = m_processState == Started; wasStarted) {
|
||||||
qDebug("desktop process was running, retrying in %d ms", kRetryDelay);
|
qDebug("desktop process was running, retrying in %d ms", kRetryDelay);
|
||||||
setProcessState(ProcessState::RetryPending);
|
setProcessState(RetryPending);
|
||||||
m_retryTimer.setSingleShot(true);
|
m_retryTimer.setSingleShot(true);
|
||||||
m_retryTimer.start(kRetryDelay);
|
m_retryTimer.start(kRetryDelay);
|
||||||
} else {
|
} else {
|
||||||
setProcessState(ProcessState::Stopped);
|
setProcessState(Stopped);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue