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)
} // 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 CoreConnectionState = CoreProcess::ConnectionState;
using CoreProcessState = CoreProcess::ProcessState;
MainWindow::MainWindow()
@ -931,7 +930,7 @@ void MainWindow::updateStatus()
case Started: {
updateNetworkInfo();
switch (connection) {
using enum CoreConnectionState;
using enum ConnectionState;
case Listening: {
if (isServer) {
@ -1007,7 +1006,7 @@ void MainWindow::coreProcessStateChanged(CoreProcessState state)
updateModeControlLabels();
}
void MainWindow::coreConnectionStateChanged(CoreConnectionState state)
void MainWindow::coreConnectionStateChanged(ConnectionState 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
// to anything except connected. the only way the padlock shows is
// when the correct TLS version string is detected.
if (state != CoreConnectionState::Connected) {
if (state != ConnectionState::Connected) {
secureSocket(false);
} else if (isVisible()) {
showFirstConnectedMessage();

View File

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

View File

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