refactor: move CoreProcess::ProcessState => common/Enums deskflow::core::ProcessState
This commit is contained in:
@ -24,6 +24,17 @@ Q_ENUM_NS(ErrorType)
|
||||
|
||||
namespace deskflow::core {
|
||||
Q_NAMESPACE
|
||||
|
||||
enum class ProcessState
|
||||
{
|
||||
Starting,
|
||||
Started,
|
||||
Stopping,
|
||||
Stopped,
|
||||
RetryPending
|
||||
};
|
||||
Q_ENUM_NS(ProcessState)
|
||||
|
||||
enum class ConnectionState
|
||||
{
|
||||
Disconnected,
|
||||
|
||||
@ -54,8 +54,6 @@
|
||||
|
||||
using namespace deskflow::gui;
|
||||
|
||||
using CoreProcessState = CoreProcess::ProcessState;
|
||||
|
||||
MainWindow::MainWindow()
|
||||
: ui{std::make_unique<Ui::MainWindow>()},
|
||||
m_coreProcess(m_serverConfig),
|
||||
@ -908,7 +906,7 @@ void MainWindow::updateStatus()
|
||||
|
||||
updateSecurityIcon(false);
|
||||
switch (process) {
|
||||
using enum CoreProcessState;
|
||||
using enum ProcessState;
|
||||
|
||||
case Starting:
|
||||
setStatus(tr("%1 is starting...").arg(kAppName));
|
||||
@ -962,11 +960,11 @@ void MainWindow::updateStatus()
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::coreProcessStateChanged(CoreProcessState state)
|
||||
void MainWindow::coreProcessStateChanged(ProcessState state)
|
||||
{
|
||||
using enum ProcessState;
|
||||
updateStatus();
|
||||
|
||||
if (state == CoreProcessState::Started) {
|
||||
if (state == Started) {
|
||||
qDebug() << "recording that core has started";
|
||||
Settings::setValue(Settings::Gui::AutoStartCore, true);
|
||||
if (m_coreProcess.mode() == CoreMode::Server &&
|
||||
@ -977,8 +975,7 @@ void MainWindow::coreProcessStateChanged(CoreProcessState state)
|
||||
}
|
||||
}
|
||||
|
||||
if (state == CoreProcessState::Started || state == CoreProcessState::Starting ||
|
||||
state == CoreProcessState::RetryPending) {
|
||||
if (state == Started || state == Starting || state == RetryPending) {
|
||||
disconnect(ui->btnToggleCore, &QPushButton::clicked, m_actionStartCore, &QAction::trigger);
|
||||
connect(ui->btnToggleCore, &QPushButton::clicked, m_actionStopCore, &QAction::trigger, Qt::UniqueConnection);
|
||||
|
||||
@ -987,7 +984,7 @@ void MainWindow::coreProcessStateChanged(CoreProcessState state)
|
||||
m_actionRestartCore->setVisible(true);
|
||||
m_actionStopCore->setEnabled(true);
|
||||
|
||||
if (state == CoreProcessState::Starting) {
|
||||
if (state == Starting) {
|
||||
if (deskflow::platform::isWayland()) {
|
||||
m_waylandWarnings.showOnce(this);
|
||||
}
|
||||
|
||||
@ -63,6 +63,7 @@ class MainWindow : public QMainWindow
|
||||
using CoreMode = Settings::CoreMode;
|
||||
using CoreProcess = deskflow::gui::CoreProcess;
|
||||
using NetworkMonitor = deskflow::gui::NetworkMonitor;
|
||||
using ProcessState = deskflow::core::ProcessState;
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
@ -106,7 +107,7 @@ private:
|
||||
void serverConfigSaving();
|
||||
void coreProcessError(CoreProcess::Error error);
|
||||
void coreConnectionStateChanged(ConnectionState state);
|
||||
void coreProcessStateChanged(CoreProcess::ProcessState state);
|
||||
void coreProcessStateChanged(ProcessState state);
|
||||
void versionCheckerUpdateFound(const QString &version);
|
||||
void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
|
||||
void serverConnectionConfigureClient(const QString &clientName);
|
||||
|
||||
@ -27,6 +27,7 @@ class CoreProcess : public QObject
|
||||
{
|
||||
using ConnectionState = deskflow::core::ConnectionState;
|
||||
using ProcessMode = Settings::ProcessMode;
|
||||
using ProcessState = deskflow::core::ProcessState;
|
||||
using IServerConfig = deskflow::gui::IServerConfig;
|
||||
|
||||
Q_OBJECT
|
||||
@ -37,15 +38,6 @@ public:
|
||||
AddressMissing,
|
||||
StartFailed
|
||||
};
|
||||
enum class ProcessState
|
||||
{
|
||||
Starting,
|
||||
Started,
|
||||
Stopping,
|
||||
Stopped,
|
||||
RetryPending
|
||||
};
|
||||
Q_ENUM(ProcessState)
|
||||
|
||||
explicit CoreProcess(const IServerConfig &serverConfig);
|
||||
|
||||
@ -93,7 +85,7 @@ Q_SIGNALS:
|
||||
void error(deskflow::gui::CoreProcess::Error error);
|
||||
void logLine(const QString &line);
|
||||
void connectionStateChanged(deskflow::core::ConnectionState state);
|
||||
void processStateChanged(deskflow::gui::CoreProcess::ProcessState state);
|
||||
void processStateChanged(deskflow::core::ProcessState state);
|
||||
void secureSocket(bool enabled);
|
||||
void daemonIpcClientConnectionFailed();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user