summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJedi18 <targetakhil@gmail.com>2021-02-11 23:50:45 +0530
committerJedi18 <targetakhil@gmail.com>2021-02-11 23:50:45 +0530
commitf044e2d2a11150d026d5a523b518027154602d3a (patch)
tree473b85ac1f0c3c749228e34430bacdaf36a14af1 /src
parentshifted room avatar changing (diff)
downloadnheko-f044e2d2a11150d026d5a523b518027154602d3a.tar.xz
fix avatar update on timeline sync
Diffstat (limited to 'src')
-rw-r--r--src/timeline/TimelineModel.cpp8
-rw-r--r--src/timeline/TimelineModel.h3
-rw-r--r--src/timeline/TimelineViewManager.cpp4
-rw-r--r--src/timeline/TimelineViewManager.h2
-rw-r--r--src/ui/RoomSettings.cpp2
-rw-r--r--src/ui/RoomSettings.h1
6 files changed, 12 insertions, 8 deletions
diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp
index 968ec3c7..29808fdd 100644
--- a/src/timeline/TimelineModel.cpp
+++ b/src/timeline/TimelineModel.cpp
@@ -808,6 +808,14 @@ TimelineModel::openUserProfile(QString userid, bool global)
 }
 
 void
+TimelineModel::openRoomSettings(QString roomid)
+{
+        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 51b8049e..1a12a8c3 100644
--- a/src/timeline/TimelineModel.h
+++ b/src/timeline/TimelineModel.h
@@ -12,6 +12,7 @@
 #include "EventStore.h"
 #include "InputBar.h"
 #include "ui/UserProfile.h"
+#include "ui/RoomSettings.h"
 
 namespace mtx::http {
 using RequestErr = const std::optional<mtx::http::ClientError> &;
@@ -213,6 +214,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(QString roomid);
         Q_INVOKABLE void replyAction(QString id);
         Q_INVOKABLE void readReceiptsAction(QString id) const;
         Q_INVOKABLE void redactEvent(QString id);
@@ -296,6 +298,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 4edc3369..99a2e388 100644
--- a/src/timeline/TimelineViewManager.cpp
+++ b/src/timeline/TimelineViewManager.cpp
@@ -399,9 +399,7 @@ void
 TimelineViewManager::openRoomSettings()
 {
         MainWindow::instance()->openRoomSettings(timeline_->roomId());
-
-        RoomSettings *settings = new RoomSettings(timeline_->roomId(), this);
-        emit openRoomSettingsDialog(settings);
+        timeline_->openRoomSettings(timeline_->roomId());
 }
 
 void
diff --git a/src/timeline/TimelineViewManager.h b/src/timeline/TimelineViewManager.h
index 10708033..a2d37342 100644
--- a/src/timeline/TimelineViewManager.h
+++ b/src/timeline/TimelineViewManager.h
@@ -19,7 +19,6 @@
 #include "emoji/EmojiModel.h"
 #include "emoji/Provider.h"
 #include "dialogs/RoomSettingsOld.h"
-#include "ui/RoomSettings.h"
 
 class MxcImageProvider;
 class BlurhashProvider;
@@ -89,7 +88,6 @@ signals:
         void showRoomList();
         void narrowViewChanged();
         void focusChanged();
-        void openRoomSettingsDialog(RoomSettings *settings);
 
 public slots:
         void updateReadReceipts(const QString &room_id, const std::vector<QString> &event_ids);
diff --git a/src/ui/RoomSettings.cpp b/src/ui/RoomSettings.cpp
index 3ff1d5d5..adf8d8a7 100644
--- a/src/ui/RoomSettings.cpp
+++ b/src/ui/RoomSettings.cpp
@@ -395,7 +395,6 @@ RoomSettings::updateAvatar()
         // be queued back into the UI thread through this proxy object.
         auto proxy = std::make_shared<ThreadProxy>();
         connect(proxy.get(), &ThreadProxy::error, this, &RoomSettings::displayError);
-        connect(proxy.get(), &ThreadProxy::avatarChanged, this, &RoomSettings::avatarChanged);
         connect(proxy.get(), &ThreadProxy::stopLoading, this, &RoomSettings::stopLoading);
 
         const auto bin        = file.peek(file.size());
@@ -445,7 +444,6 @@ RoomSettings::updateAvatar()
                             }
 
                             emit proxy->stopLoading();
-                            emit proxy->avatarChanged();
                     });
           });
 }
\ No newline at end of file
diff --git a/src/ui/RoomSettings.h b/src/ui/RoomSettings.h
index 09295a58..d31b38f2 100644
--- a/src/ui/RoomSettings.h
+++ b/src/ui/RoomSettings.h
@@ -15,7 +15,6 @@ class ThreadProxy : public QObject
 
 signals:
         void error(const QString &msg);
-        void avatarChanged();
         void nameEventSent(const QString &);
         void topicEventSent();
         void stopLoading();