summary refs log tree commit diff
path: root/src/timeline
diff options
context:
space:
mode:
authorDeepBlueV7.X <nicolas.werner@hotmail.de>2021-02-19 08:43:03 +0000
committerGitHub <noreply@github.com>2021-02-19 08:43:03 +0000
commit744feabecaf0daaf587807925361653302787a40 (patch)
tree9e31972499bcf4094ea7b5d42684ad760c61e672 /src/timeline
parentAdapt to changes in MSC2312 (diff)
parentfixed roomsettings spacing and toggle button right align bug (diff)
downloadnheko-744feabecaf0daaf587807925361653302787a40.tar.xz
Merge pull request #474 from Jedi18/room_settings_qml
Shifted Room Settings Dialog to QML
Diffstat (limited to 'src/timeline')
-rw-r--r--src/timeline/TimelineModel.cpp8
-rw-r--r--src/timeline/TimelineModel.h3
-rw-r--r--src/timeline/TimelineViewManager.cpp11
-rw-r--r--src/timeline/TimelineViewManager.h1
4 files changed, 17 insertions, 6 deletions
diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp
index 80e73440..af4c6aa2 100644
--- a/src/timeline/TimelineModel.cpp
+++ b/src/timeline/TimelineModel.cpp
@@ -837,6 +837,14 @@ TimelineModel::openUserProfile(QString userid, bool global)
 }
 
 void
+TimelineModel::openRoomSettings()
+{
+        RoomSettings *settings = new RoomSettings(roomId(), this);
+        connect(this, &TimelineModel::roomAvatarUrlChanged, settings, &RoomSettings::avatarChanged);
+        openRoomSettingsDialog(settings);
+}
+
+void
 TimelineModel::replyAction(QString id)
 {
         setReply(id);
diff --git a/src/timeline/TimelineModel.h b/src/timeline/TimelineModel.h
index 83012cd8..5f599741 100644
--- a/src/timeline/TimelineModel.h
+++ b/src/timeline/TimelineModel.h
@@ -11,6 +11,7 @@
 #include "CacheCryptoStructs.h"
 #include "EventStore.h"
 #include "InputBar.h"
+#include "ui/RoomSettings.h"
 #include "ui/UserProfile.h"
 
 namespace mtx::http {
@@ -216,6 +217,7 @@ public:
         Q_INVOKABLE void viewRawMessage(QString id) const;
         Q_INVOKABLE void viewDecryptedRawMessage(QString id) const;
         Q_INVOKABLE void openUserProfile(QString userid, bool global = false);
+        Q_INVOKABLE void openRoomSettings();
         Q_INVOKABLE void editAction(QString id);
         Q_INVOKABLE void replyAction(QString id);
         Q_INVOKABLE void readReceiptsAction(QString id) const;
@@ -307,6 +309,7 @@ signals:
         void newCallEvent(const mtx::events::collections::TimelineEvents &event);
 
         void openProfile(UserProfile *profile);
+        void openRoomSettingsDialog(RoomSettings *settings);
 
         void newMessageToSend(mtx::events::collections::TimelineEvents event);
         void addPendingMessageToStore(mtx::events::collections::TimelineEvents event);
diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp
index b7d2bfb1..f2e6d571 100644
--- a/src/timeline/TimelineViewManager.cpp
+++ b/src/timeline/TimelineViewManager.cpp
@@ -128,6 +128,12 @@ TimelineViewManager::TimelineViewManager(CallManager *callManager, ChatPage *par
           0,
           "UserProfileModel",
           "UserProfile needs to be instantiated on the C++ side");
+        qmlRegisterUncreatableType<RoomSettings>(
+          "im.nheko",
+          1,
+          0,
+          "RoomSettingsModel",
+          "Room Settings needs to be instantiated on the C++ side");
 
         static auto self = this;
         qmlRegisterSingletonType<MainWindow>(
@@ -387,11 +393,6 @@ TimelineViewManager::openLeaveRoomDialog() const
 {
         MainWindow::instance()->openLeaveRoomDialog(timeline_->roomId());
 }
-void
-TimelineViewManager::openRoomSettings() const
-{
-        MainWindow::instance()->openRoomSettings(timeline_->roomId());
-}
 
 void
 TimelineViewManager::verifyUser(QString userid)
diff --git a/src/timeline/TimelineViewManager.h b/src/timeline/TimelineViewManager.h
index 7c994a14..61fce574 100644
--- a/src/timeline/TimelineViewManager.h
+++ b/src/timeline/TimelineViewManager.h
@@ -70,7 +70,6 @@ public:
         Q_INVOKABLE void openInviteUsersDialog();
         Q_INVOKABLE void openMemberListDialog() const;
         Q_INVOKABLE void openLeaveRoomDialog() const;
-        Q_INVOKABLE void openRoomSettings() const;
         Q_INVOKABLE void removeVerificationFlow(DeviceVerificationFlow *flow);
 
         void verifyUser(QString userid);