refactor: mv CoreProcess::ConnectionState -> common/Enums deskflow::core::ConnectionState

This commit is contained in:
sithlord48 2026-02-21 23:23:21 -05:00 committed by Nick Bolton
parent 76353eceb3
commit 79fdf3a1f6
4 changed files with 20 additions and 14 deletions

View file

@ -21,3 +21,15 @@ enum class ErrorType : uint8_t
}; };
Q_ENUM_NS(ErrorType) Q_ENUM_NS(ErrorType)
} // namespace deskflow::client } // namespace deskflow::client
namespace deskflow::core {
Q_NAMESPACE
enum class ConnectionState
{
Disconnected,
Connecting,
Connected,
Listening
};
Q_ENUM_NS(ConnectionState)
} // namespace deskflow::core

View file

@ -54,7 +54,6 @@
using namespace deskflow::gui; using namespace deskflow::gui;
using CoreConnectionState = CoreProcess::ConnectionState;
using CoreProcessState = CoreProcess::ProcessState; using CoreProcessState = CoreProcess::ProcessState;
MainWindow::MainWindow() MainWindow::MainWindow()
@ -931,7 +930,7 @@ void MainWindow::updateStatus()
case Started: { case Started: {
updateNetworkInfo(); updateNetworkInfo();
switch (connection) { switch (connection) {
using enum CoreConnectionState; using enum ConnectionState;
case Listening: { case Listening: {
if (isServer) { if (isServer) {
@ -1007,7 +1006,7 @@ void MainWindow::coreProcessStateChanged(CoreProcessState state)
updateModeControlLabels(); updateModeControlLabels();
} }
void MainWindow::coreConnectionStateChanged(CoreConnectionState state) void MainWindow::coreConnectionStateChanged(ConnectionState state)
{ {
qDebug() << "core connection state changed: " << static_cast<int>(state); qDebug() << "core connection state changed: " << static_cast<int>(state);
@ -1016,7 +1015,7 @@ void MainWindow::coreConnectionStateChanged(CoreConnectionState state)
// always assume connection is not secure when connection changes // always assume connection is not secure when connection changes
// to anything except connected. the only way the padlock shows is // to anything except connected. the only way the padlock shows is
// when the correct TLS version string is detected. // when the correct TLS version string is detected.
if (state != CoreConnectionState::Connected) { if (state != ConnectionState::Connected) {
secureSocket(false); secureSocket(false);
} else if (isVisible()) { } else if (isVisible()) {
showFirstConnectedMessage(); showFirstConnectedMessage();

View file

@ -59,6 +59,7 @@ class DaemonIpcClient;
class MainWindow : public QMainWindow class MainWindow : public QMainWindow
{ {
using ConnectionState = deskflow::core::ConnectionState;
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;
@ -104,7 +105,7 @@ private:
void settingsChanged(const QString &key = QString()); void settingsChanged(const QString &key = QString());
void serverConfigSaving(); void serverConfigSaving();
void coreProcessError(CoreProcess::Error error); void coreProcessError(CoreProcess::Error error);
void coreConnectionStateChanged(CoreProcess::ConnectionState state); void coreConnectionStateChanged(ConnectionState state);
void coreProcessStateChanged(CoreProcess::ProcessState state); void coreProcessStateChanged(CoreProcess::ProcessState state);
void versionCheckerUpdateFound(const QString &version); void versionCheckerUpdateFound(const QString &version);
void trayIconActivated(QSystemTrayIcon::ActivationReason reason); void trayIconActivated(QSystemTrayIcon::ActivationReason reason);

View file

@ -7,6 +7,7 @@
#pragma once #pragma once
#include "common/Enums.h"
#include "common/Settings.h" #include "common/Settings.h"
#include "gui/FileTail.h" #include "gui/FileTail.h"
#include "gui/config/IServerConfig.h" #include "gui/config/IServerConfig.h"
@ -24,6 +25,7 @@ class DaemonIpcClient;
class CoreProcess : public QObject class CoreProcess : public QObject
{ {
using ConnectionState = deskflow::core::ConnectionState;
using ProcessMode = Settings::ProcessMode; using ProcessMode = Settings::ProcessMode;
using IServerConfig = deskflow::gui::IServerConfig; using IServerConfig = deskflow::gui::IServerConfig;
@ -45,14 +47,6 @@ public:
}; };
Q_ENUM(ProcessState) Q_ENUM(ProcessState)
enum class ConnectionState
{
Disconnected,
Connecting,
Connected,
Listening
};
explicit CoreProcess(const IServerConfig &serverConfig); explicit CoreProcess(const IServerConfig &serverConfig);
void start(std::optional<ProcessMode> processMode = std::nullopt); void start(std::optional<ProcessMode> processMode = std::nullopt);
@ -98,7 +92,7 @@ public:
Q_SIGNALS: 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::gui::CoreProcess::ConnectionState state); void connectionStateChanged(deskflow::core::ConnectionState state);
void processStateChanged(deskflow::gui::CoreProcess::ProcessState state); void processStateChanged(deskflow::gui::CoreProcess::ProcessState state);
void secureSocket(bool enabled); void secureSocket(bool enabled);
void daemonIpcClientConnectionFailed(); void daemonIpcClientConnectionFailed();