forked from Drifter321/admintool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.h
170 lines (151 loc) · 4.06 KB
/
mainwindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QDebug>
#include <QMainWindow>
#include <QSplitter>
#include <QStringList>
#include <QHostAddress>
#include <QTableWidget>
#include <QMutableListIterator>
#include "query.h"
#include "serverinfo.h"
#include "loghandler.h"
class ServerTableIndexItem;
enum AddServerError
{
AddServerError_None,
AddServerError_Invalid,
AddServerError_AlreadyExists,
AddServerError_Hostname,
};
enum ContextTypes
{
ContextTypeNone,
ContextTypeSteamID,
ContextTypeName
};
struct InfoTableItem
{
InfoTableItem()
{
display = "";
val = "";
}
InfoTableItem(QString name, QString value, bool richValue = false)
{
display = name;
val = value;
this->richValue = richValue;
}
QString display;
QString val;
bool richValue = false;
};
struct CtxSubItem
{
QString display;
QString val;
};
struct ContextMenuItem
{
QString display;
QString cmd;
ContextTypes type;
QString subTitle;
QString defaultSub;
QList<CtxSubItem> subItems;
void clear()
{
type = ContextTypeNone;
display = QString();
cmd = QString();
subTitle = QString();
defaultSub = QString();
subItems.clear();
}
};
enum : size_t
{
kBrowserColIndex,
kBrowserColModIcon,
kBrowserColVACIcon,
kBrowserColLockIcon,
kBrowserColFlagIcon,
kBrowserColHostname,
kBrowserColMap,
kBrowserColPlayerCount,
kBrowserColPing,
kBrowserColCount
};
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
AddServerError CheckServerList(QString server);
ServerInfo *AddServerToList(QString server, AddServerError *error = nullptr);
void UpdateSelectedItemInfo(bool removeFirst = true, bool updateRules = false);
void CreateTableItemOrUpdate(size_t row, size_t col, QTableWidget *table, ServerInfo *info);
ServerTableIndexItem *GetServerTableIndexItem(size_t row);
Ui::MainWindow *GetUi(){return ui;}
~MainWindow();
void parseLogLine(QString, ServerInfo *);
PlayerQuery *pPlayerQuery;
RulesQuery *pRulesQuery;
quint16 u16logPort;
bool showLoggingInfo;
protected:
void closeEvent(QCloseEvent *event);
bool eventFilter(QObject *object, QEvent *event);
public slots:
void ServerInfoReady(InfoReply *, ServerTableIndexItem *);
void PlayerInfoReady(QList<PlayerInfo> *, ServerTableIndexItem *);
void RulesInfoReady(QList<RulesInfo> *, ServerTableIndexItem *);
void RconAuthReady(ServerInfo *info, QList<QueuedCommand>queuedcmds);
void RconOutput(ServerInfo *info, QByteArray res);
void darkThemeTriggered();
void showPortEntry();
void showAbout();
void AddRconHistory(QString cmd);
void AddChatHistory(QString txt);
private slots:
void addServerEntry();
void browserTableItemSelected();
void TimedUpdate();
void processCommand();
void sendChat();
void passwordUpdated(const QString &);
void rconSaveToggled(bool);
void rconLogin();
void getLog();
void showRconClicked(bool checked);
void customPlayerContextMenu(const QPoint &pos);
void hideContextMenu();
void playerContextMenuAction(const QString &cmd);
void serverBrowserContextMenu(const QPoint &pos);
private:
Ui::MainWindow *ui;
QTimer *updateTimer;
void ConnectSlots();
void UpdateInfoTable(ServerInfo *info, bool current = true, QList<RulesInfo> *list = NULL);
void HookEvents();
void SetRconSignals(bool block);
void RestoreRcon(ServerInfo *info);
void SetRconEnabled(bool);
QImage GetVACImage();
QImage GetLockImage();
QColor GetTextColor();
void runCommand(ServerInfo *, QString);
void rconLoginQueued(QList<QueuedCommand>);
bool deleteServerDialog();
void connectToServer();
LogHandler *pLogHandler;
QList<QString> commandHistory;
QList<QString> sayHistory;
QMutableListIterator<QString> *commandIter;
QMutableListIterator<QString> *sayIter;
};
#endif // MAINWINDOW_H