aboutsummaryrefslogtreecommitdiff
path: root/src/widgets/playerlistwidget.h
diff options
context:
space:
mode:
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);
+};