fix avatar update on timeline sync

This commit is contained in:
Jedi18 2021-02-11 23:50:45 +05:30
parent a7d7d18e92
commit f044e2d2a1
7 changed files with 13 additions and 9 deletions

View file

@ -175,7 +175,7 @@ Page {
}
Connections {
target: TimelineManager
target: TimelineManager.timeline
onOpenRoomSettingsDialog: {
var roomSettings = roomSettingsComponent.createObject(timelineRoot, {
"roomSettings": settings

View file

@ -807,6 +807,14 @@ TimelineModel::openUserProfile(QString userid, bool global)
emit openProfile(userProfile);
}
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)
{

View file

@ -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);

View file

@ -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

View file

@ -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);

View file

@ -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();
});
});
}

View file

@ -15,7 +15,6 @@ class ThreadProxy : public QObject
signals:
void error(const QString &msg);
void avatarChanged();
void nameEventSent(const QString &);
void topicEventSent();
void stopLoading();