summary refs log tree commit diff
path: root/include/CommunitiesList.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/CommunitiesList.h')
-rw-r--r--include/CommunitiesList.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/include/CommunitiesList.h b/include/CommunitiesList.h
new file mode 100644
index 00000000..53715363
--- /dev/null
+++ b/include/CommunitiesList.h
@@ -0,0 +1,42 @@
+#pragma once
+
+#include <QScrollArea>
+#include <QSharedPointer>
+#include <QVBoxLayout>
+#include <QWidget>
+
+#include "CommunitiesListItem.h"
+#include "Community.h"
+#include "MatrixClient.h"
+#include "ui/Theme.h"
+
+class CommunitiesList : public QWidget
+{
+        Q_OBJECT
+
+public:
+        CommunitiesList(QSharedPointer<MatrixClient> client, QWidget *parent = nullptr);
+        ~CommunitiesList();
+
+        void setCommunities(const QMap<QString, QSharedPointer<Community>> &communities);
+        void clear();
+
+        void addCommunity(QSharedPointer<Community> community, const QString &community_id);
+        void removeCommunity(const QString &community_id);
+signals:
+        void communityChanged(const QString &community_id);
+
+public slots:
+        void updateCommunityAvatar(const QString &community_id, const QPixmap &img);
+        void highlightSelectedCommunity(const QString &community_id);
+
+private:
+        QVBoxLayout *topLayout_;
+        QVBoxLayout *contentsLayout_;
+        QWidget *scrollAreaContents_;
+        QScrollArea *scrollArea_;
+
+        QMap<QString, QSharedPointer<CommunitiesListItem>> communities_;
+
+        QSharedPointer<MatrixClient> client_;
+};