128 lines
3.2 KiB
C++
128 lines
3.2 KiB
C++
#ifndef MAINWINDOW_H
|
|
#define MAINWINDOW_H
|
|
|
|
#include <QMainWindow>
|
|
#include <QTcpSocket>
|
|
#include <QComboBox>
|
|
#include <QLineEdit>
|
|
#include <QPushButton>
|
|
#include <QSlider>
|
|
#include <QLabel>
|
|
#include <QListWidget>
|
|
#include <QMap>
|
|
#include <QVBoxLayout>
|
|
#include <QHBoxLayout>
|
|
#include <QGroupBox>
|
|
#include <QTimer>
|
|
#include <QTextEdit>
|
|
#include <QTabWidget>
|
|
|
|
class MainWindow : public QMainWindow {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
MainWindow(QWidget *parent = nullptr);
|
|
~MainWindow();
|
|
|
|
private slots:
|
|
void saveServerEntry();
|
|
void loadSelectedServer();
|
|
void deleteSelectedServer();
|
|
void refreshUsers();
|
|
void displaySelectedUserInfo(int row);
|
|
void kickSelectedUser();
|
|
void banSelectedUser();
|
|
void refreshBans();
|
|
void displaySelectedBanInfo(int row);
|
|
void removeSelectedBan();
|
|
void lockServerTime();
|
|
void unlockServerTime();
|
|
void resendLockedServerTime();
|
|
void sendTimeCommand();
|
|
void sendSpeedCommand();
|
|
void updateSliderLabel(int value);
|
|
void sendCustomCommand();
|
|
void attemptConnection();
|
|
void updateConnectionStatus();
|
|
void disconnectFromServer();
|
|
void readServerOutput();
|
|
|
|
private:
|
|
struct SavedServerEntry {
|
|
QString name;
|
|
QString server;
|
|
QString port;
|
|
QString password;
|
|
};
|
|
|
|
struct UserEntry {
|
|
QString playerId;
|
|
QString username;
|
|
QString position;
|
|
QString rotation;
|
|
QString remoteState;
|
|
QString health;
|
|
QString deaths;
|
|
QString zombies;
|
|
QString players;
|
|
QString score;
|
|
QString level;
|
|
QString platformId;
|
|
QString eosId;
|
|
QString ipAddress;
|
|
QString ping;
|
|
};
|
|
|
|
struct BanEntry {
|
|
QString bannedUntil;
|
|
QString userId;
|
|
QString username;
|
|
QString reason;
|
|
};
|
|
|
|
QLineEdit *serverEdit, *portEdit, *passwordEdit;
|
|
QLineEdit *dayEdit, *hourEdit, *minuteEdit;
|
|
QLineEdit *customCommandEdit;
|
|
QComboBox *savedServersCombo;
|
|
QListWidget *usersListWidget;
|
|
QListWidget *bansListWidget;
|
|
QMap<QString, QLabel *> userInfoValueLabels;
|
|
QMap<QString, QLabel *> banInfoValueLabels;
|
|
QSlider *speedSlider;
|
|
QLabel *sliderLabel;
|
|
QLabel *connectionStatusLabel;
|
|
QLabel *serverTimeStatusLabel;
|
|
QPushButton *serverTimeLockButton;
|
|
QTcpSocket *socket;
|
|
QPushButton *connectButton;
|
|
QPushButton *disconnectButton;
|
|
QTimer *statusTimer;
|
|
QTimer *lockedTimeTimer;
|
|
QTextEdit *historyTextEdit;
|
|
QTextEdit *serverLogTextEdit;
|
|
QTabWidget *tabWidget;
|
|
QList<SavedServerEntry> savedServers;
|
|
QList<UserEntry> users;
|
|
QList<BanEntry> bans;
|
|
bool isAuthenticated = false;
|
|
bool isServerTimeLocked = false;
|
|
bool awaitingUsersResponse = false;
|
|
bool awaitingBansResponse = false;
|
|
QString usersResponseBuffer;
|
|
QString bansResponseBuffer;
|
|
|
|
QString serverConfigFilePath() const;
|
|
void clearUserInfo();
|
|
void clearBanInfo();
|
|
void loadSavedServers();
|
|
void parseUsersResponse(const QString &text);
|
|
void parseBansResponse(const QString &text);
|
|
bool writeSavedServers() const;
|
|
bool sendValidatedTimeCommand();
|
|
void updateServerTimeLockState(bool locked);
|
|
bool sendTelnetCommand(const QString &command);
|
|
void setupUI();
|
|
};
|
|
|
|
#endif
|