aboutsummaryrefslogtreecommitdiff
path: root/src/widgets/playerlistwidget.h
diff options
context:
space:
mode:
authorSalanto <62221668+Salanto@users.noreply.github.com>2024-07-12 11:48:01 +0200
committerGitHub <noreply@github.com>2024-07-12 11:48:01 +0200
commitfb64ca386c51cc3942e1f38cfd76132b1b50e9db (patch)
treef805cd22b191a028312e7f546b571fb35488fa50 /src/widgets/playerlistwidget.h
parentc745d0a1b78732550ae790fee12bd23b71a4f25e (diff)
Add playerlist widget element (#996)
* Commit * Boyfailure code commit * Cooking code spaghetti * Accidental overwrite recursive function call hell * Implemented player list * Add partial moderator widget Sleepy time! Hee-Hoo! * Moderator Dialog - Step 1 - WIP * Appease the clang gods * Clang appeasement policy * *sacrifices goat to clang* * Added player report, reworked implementation, ... * Added player-specific report * Reworked implementation * No longer uses JSON. * Removed preset loader. --------- Co-authored-by: TrickyLeifa <date.epoch@gmail.com> Co-authored-by: Leifa <26681464+TrickyLeifa@users.noreply.github.com>
Diffstat (limited to 'src/widgets/playerlistwidget.h')
-rw-r--r--src/widgets/playerlistwidget.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/widgets/playerlistwidget.h b/src/widgets/playerlistwidget.h
new file mode 100644
index 00000000..e771d7e1
--- /dev/null
+++ b/src/widgets/playerlistwidget.h
@@ -0,0 +1,36 @@
+#pragma once
+
+#include "datatypes.h"
+
+#include <QList>
+#include <QListWidget>
+#include <QMap>
+
+class AOApplication;
+
+class PlayerListWidget : public QListWidget
+{
+public:
+ explicit PlayerListWidget(AOApplication *ao_app, QWidget *parent = nullptr);
+ virtual ~PlayerListWidget();
+
+ void registerPlayer(const PlayerRegister &update);
+ void updatePlayer(const PlayerUpdate &update);
+
+ void setAuthenticated(bool f_state);
+
+private:
+ AOApplication *ao_app;
+ QMap<int, PlayerData> m_player_map;
+ QMap<int, QListWidgetItem *> m_item_map;
+ bool m_is_authenticated = false;
+
+ void addPlayer(int playerId);
+ void removePlayer(int playerId);
+ void updatePlayer(int playerId, bool updateIcon);
+
+ void filterPlayerList();
+
+private Q_SLOTS:
+ void onCustomContextMenuRequested(const QPoint &pos);
+};