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