Introduce production-grade desktop GUI for hosting Commonwealth Online servers. Features: - Native C++ Qt6 application with minimal dependencies - Start/stop server buttons with live status indicator - Real-time stats display (uptime, clients, packet counts) - Live connected clients table - Server log viewer with timestamps - Fallout 4-inspired dark theme (amber/green accents) - Subprocess management (server independent of GUI) - Auto-detection of Python and server directory - Professional error handling and graceful shutdown Architecture: - MainWindow: Qt UI components and layout - ServerProcess: Manages Python relay subprocess - Subprocess spawns consumer_server_cli.py - Real-time log capture and parsing - Qt signals/slots for UI updates Build: - CMake 3.20+ configuration - Visual Studio 2022 MSVC compiler - Qt6.4+ required - Windows 10+ target - build.bat script for easy compilation Project structure: - src/main.cpp - entry point - src/MainWindow.h/cpp - main UI window - src/ServerProcess.h/cpp - subprocess and IPC layer - src/resources/ - Qt resources and icons - CMakeLists.txt - Qt6 build config - build.bat - Windows build script - README.md - user guide - DEVELOPMENT.md - developer guide Co-authored-by: Cursor <cursoragent@cursor.com>
49 lines
1.1 KiB
C++
49 lines
1.1 KiB
C++
#ifndef SERVERPROCESS_H
|
|
#define SERVERPROCESS_H
|
|
|
|
#include <QObject>
|
|
#include <QProcess>
|
|
#include <QJsonArray>
|
|
#include <QLocalSocket>
|
|
|
|
class ServerProcess : public QObject {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit ServerProcess(QObject *parent = nullptr);
|
|
~ServerProcess();
|
|
|
|
void start(const QString &configPath);
|
|
void stop();
|
|
void fetchStats();
|
|
bool isRunning() const;
|
|
|
|
signals:
|
|
void started();
|
|
void stopped();
|
|
void logMessage(const QString &message);
|
|
void clientsUpdated(const QJsonArray &clients);
|
|
void statsUpdated(const QJsonObject &stats);
|
|
void error(const QString &message);
|
|
|
|
private slots:
|
|
void onProcessStarted();
|
|
void onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
|
void onProcessError(QProcess::ProcessError error);
|
|
void onReadyReadStandardOutput();
|
|
void onReadyReadStandardError();
|
|
|
|
private:
|
|
QString findPythonExecutable();
|
|
QString findServerDirectory();
|
|
void parseLogLine(const QString &line);
|
|
|
|
QProcess *process;
|
|
QString pythonPath;
|
|
QString serverDir;
|
|
bool running;
|
|
QString outputBuffer;
|
|
};
|
|
|
|
#endif // SERVERPROCESS_H
|