diff options
Diffstat (limited to 'src/timeline/TimelineViewManager.cpp')
-rw-r--r-- | src/timeline/TimelineViewManager.cpp | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp index a3b91ce7..2f6553e5 100644 --- a/src/timeline/TimelineViewManager.cpp +++ b/src/timeline/TimelineViewManager.cpp @@ -96,29 +96,21 @@ TimelineViewManager::userColor(QString id, QColor background) TimelineViewManager::TimelineViewManager(CallManager *, ChatPage *parent) : QObject(parent) , rooms_(new RoomlistModel(this)) + , frooms_(new FilteredRoomlistModel(this->rooms_)) , communities_(new CommunitiesModel(this)) , verificationManager_(new VerificationManager(this)) , presenceEmitter(new PresenceEmitter(this)) { - static auto self = this; - qmlRegisterSingletonInstance("im.nheko", 1, 0, "TimelineManager", self); - qmlRegisterSingletonType<RoomlistModel>( - "im.nheko", 1, 0, "Rooms", [](QQmlEngine *, QJSEngine *) -> QObject * { - auto ptr = new FilteredRoomlistModel(self->rooms_); - - connect(self->communities_, - &CommunitiesModel::currentTagIdChanged, - ptr, - &FilteredRoomlistModel::updateFilterTag); - connect(self->communities_, - &CommunitiesModel::hiddenTagsChanged, - ptr, - &FilteredRoomlistModel::updateHiddenTagsAndSpaces); - return ptr; - }); - qmlRegisterSingletonInstance("im.nheko", 1, 0, "Communities", self->communities_); - qmlRegisterSingletonInstance("im.nheko", 1, 0, "VerificationManager", verificationManager_); - qmlRegisterSingletonInstance("im.nheko", 1, 0, "Presence", presenceEmitter); + instance_ = this; + + connect(this->communities_, + &CommunitiesModel::currentTagIdChanged, + frooms_, + &FilteredRoomlistModel::updateFilterTag); + connect(this->communities_, + &CommunitiesModel::hiddenTagsChanged, + frooms_, + &FilteredRoomlistModel::updateHiddenTagsAndSpaces); updateColorPalette(); |