From af80c251d75e5e8bf7e8c6f870f8c8b069a822e1 Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Wed, 31 May 2017 19:42:07 +0300 Subject: Add context menu on RoomList items --- include/RoomInfoListItem.h | 18 +++++++++++++++++- include/RoomList.h | 3 ++- 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/RoomInfoListItem.h b/include/RoomInfoListItem.h index 17c75fc3..40a1cbb0 100644 --- a/include/RoomInfoListItem.h +++ b/include/RoomInfoListItem.h @@ -17,9 +17,13 @@ #pragma once +#include +#include #include +#include "Menu.h" #include "RippleOverlay.h" +#include "RoomSettings.h" #include "RoomState.h" class RoomInfoListItem : public QWidget @@ -27,7 +31,11 @@ class RoomInfoListItem : public QWidget Q_OBJECT public: - RoomInfoListItem(RoomState state, QString room_id, QWidget *parent = 0); + RoomInfoListItem(QSharedPointer settings, + RoomState state, + QString room_id, + QWidget *parent = 0); + ~RoomInfoListItem(); void updateUnreadMessageCount(int count); @@ -48,8 +56,11 @@ public slots: protected: void mousePressEvent(QMouseEvent *event) override; void paintEvent(QPaintEvent *event) override; + void contextMenuEvent(QContextMenuEvent *event) override; private: + QString notificationText(); + const int Padding = 7; const int IconSize = 46; @@ -64,6 +75,11 @@ private: QPixmap roomAvatar_; + Menu *menu_; + QAction *toggleNotifications_; + + QSharedPointer roomSettings_; + bool isPressed_ = false; int maxHeight_; diff --git a/include/RoomList.h b/include/RoomList.h index 489083d1..417ed363 100644 --- a/include/RoomList.h +++ b/include/RoomList.h @@ -35,7 +35,8 @@ public: RoomList(QSharedPointer client, QWidget *parent = 0); ~RoomList(); - void setInitialRooms(const QMap &states); + void setInitialRooms(const QMap> &settings, + const QMap &states); void sync(const QMap &states); void clear(); -- cgit 1.5.1