#ifndef MAINWINDOW_H #define MAINWINDOW_H #include #include #include #include #include #include #include #include "ServerProcess.h" #include "ConfigDialog.h" class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget *parent = nullptr); ~MainWindow(); protected: void closeEvent(QCloseEvent *event) override; private slots: void onStartServer(); void onStopServer(); void onOpenConfig(); void onServerStarted(); void onServerStopped(); void onServerLog(const QString &message); void onUpdateStats(); void onUpdateClients(const QJsonArray &clients); void onServerError(const QString &error); void onKickSelectedClient(); void onBanSelectedClient(); void onManageBans(); void onClientSelectionChanged(); void onAdminCommandFinished(bool ok, const QString &message); void onStatsUpdated(const QJsonObject &stats); private: void setupUI(); void setupStyles(); void setupConnections(); void setupTimer(); void updateServerStatus(bool running); void addLogMessage(const QString &message); void applyStatsToUi(const QJsonObject &stats); void resolveConfigPath(); void loadConfigIntoUi(); void applyConfigToUi(const ServerConfigData &config); // UI Components QWidget *centralWidget; // Toolbar QLabel *serverNameLabel; QLabel *statusDot; QLabel *statusIndicator; QPushButton *startButton; QPushButton *stopButton; QPushButton *configButton; // Status strip QLabel *uptimeLabel; QLabel *clientsLabel; QLabel *transformPacketsLabel; QLabel *worldStatePacketsLabel; QLabel *bindAddressLabel; QLabel *lanAddressLabel; // Main panes QSplitter *mainSplitter; QTableWidget *clientsTable; QPushButton *kickButton; QPushButton *banButton; QPushButton *bansButton; QTextEdit *logViewer; // Server Process ServerProcess *serverProcess; // Timer for stats updates QTimer *statsTimer; // State bool isServerRunning; QString serverName; QString configFilePath; }; #endif // MAINWINDOW_H