summary refs log tree commit diff
path: root/src/timeline
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-07-21 13:37:57 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2021-07-23 17:43:17 +0200
commiteafbab6ae128dd5b14f145ba9214a6673e982951 (patch)
tree47cb8bd57501ef2d6da1b1e128ac2c431e4a6553 /src/timeline
parentRename image pack model (diff)
downloadnheko-eafbab6ae128dd5b14f145ba9214a6673e982951.tar.xz
Add menu to enable or disable stickers globally
Diffstat (limited to 'src/timeline')
-rw-r--r--src/timeline/TimelineViewManager.cpp20
-rw-r--r--src/timeline/TimelineViewManager.h3
2 files changed, 23 insertions, 0 deletions
diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp
index 2da7d789..4353ef62 100644
--- a/src/timeline/TimelineViewManager.cpp
+++ b/src/timeline/TimelineViewManager.cpp
@@ -20,12 +20,14 @@
 #include "DelegateChooser.h"
 #include "DeviceVerificationFlow.h"
 #include "EventAccessors.h"
+#include "ImagePackListModel.h"
 #include "InviteesModel.h"
 #include "Logging.h"
 #include "MainWindow.h"
 #include "MatrixClient.h"
 #include "MxcImageProvider.h"
 #include "RoomsModel.h"
+#include "SingleImagePackModel.h"
 #include "UserSettingsPage.h"
 #include "UsersModel.h"
 #include "dialogs/ImageOverlay.h"
@@ -185,6 +187,18 @@ TimelineViewManager::TimelineViewManager(CallManager *callManager, ChatPage *par
           "Room Settings needs to be instantiated on the C++ side");
         qmlRegisterUncreatableType<TimelineModel>(
           "im.nheko", 1, 0, "Room", "Room needs to be instantiated on the C++ side");
+        qmlRegisterUncreatableType<ImagePackListModel>(
+          "im.nheko",
+          1,
+          0,
+          "ImagePackListModel",
+          "ImagePackListModel needs to be instantiated on the C++ side");
+        qmlRegisterUncreatableType<SingleImagePackModel>(
+          "im.nheko",
+          1,
+          0,
+          "SingleImagePackModel",
+          "SingleImagePackModel needs to be instantiated on the C++ side");
         qmlRegisterUncreatableType<InviteesModel>(
           "im.nheko",
           1,
@@ -437,6 +451,12 @@ TimelineViewManager::openImageOverlay(QString mxcUrl, QString eventId)
 }
 
 void
+TimelineViewManager::openImagePackSettings(QString roomid)
+{
+        emit showImagePackSettings(new ImagePackListModel(roomid.toStdString(), this));
+}
+
+void
 TimelineViewManager::openImageOverlayInternal(QString eventId, QImage img)
 {
         auto pixmap = QPixmap::fromImage(img);
diff --git a/src/timeline/TimelineViewManager.h b/src/timeline/TimelineViewManager.h
index 374685e3..bdec405a 100644
--- a/src/timeline/TimelineViewManager.h
+++ b/src/timeline/TimelineViewManager.h
@@ -33,6 +33,7 @@ class ColorImageProvider;
 class UserSettings;
 class ChatPage;
 class DeviceVerificationFlow;
+class ImagePackListModel;
 
 class TimelineViewManager : public QObject
 {
@@ -57,6 +58,7 @@ public:
         Q_INVOKABLE bool isInitialSync() const { return isInitialSync_; }
         bool isWindowFocused() const { return isWindowFocused_; }
         Q_INVOKABLE void openImageOverlay(QString mxcUrl, QString eventId);
+        Q_INVOKABLE void openImagePackSettings(QString roomid);
         Q_INVOKABLE QColor userColor(QString id, QColor background);
         Q_INVOKABLE QString escapeEmoji(QString str) const;
         Q_INVOKABLE QString htmlEscape(QString str) const { return str.toHtmlEscaped(); }
@@ -93,6 +95,7 @@ signals:
         void openRoomSettingsDialog(RoomSettings *settings);
         void openInviteUsersDialog(InviteesModel *invitees);
         void openProfile(UserProfile *profile);
+        void showImagePackSettings(ImagePackListModel *packlist);
 
 public slots:
         void updateReadReceipts(const QString &room_id, const std::vector<QString> &event_ids);