summary refs log tree commit diff
path: root/include/CommunitiesList.h
diff options
context:
space:
mode:
authorMax Sandholm <max@sandholm.org>2018-01-09 15:07:32 +0200
committermujx <mujx@users.noreply.github.com>2018-01-09 15:07:32 +0200
commit312df6f3bbcba0ad502864b13f9c51b4854ea2ce (patch)
treed43396836cb2ba21b13f218a6d25a7c82049338b /include/CommunitiesList.h
parentMake usernames in timeline less bold (diff)
downloadnheko-312df6f3bbcba0ad502864b13f9c51b4854ea2ce.tar.xz
Communities (#195)
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_; +};