Move currentRoom/timeline handling to roomlist

This commit is contained in:
Nicolas Werner 2021-05-28 22:14:59 +02:00
parent e2765212fb
commit 298822baea
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
30 changed files with 349 additions and 345 deletions

View file

@ -341,6 +341,8 @@ RoomlistModel::clear()
models.clear();
invites.clear();
roomids.clear();
currentRoom_ = nullptr;
emit currentRoomChanged();
endResetModel();
}
@ -390,6 +392,17 @@ RoomlistModel::leave(QString roomid)
}
}
void
RoomlistModel::setCurrentRoom(QString roomid)
{
nhlog::ui()->debug("Trying to switch to: {}", roomid.toStdString());
if (models.contains(roomid)) {
currentRoom_ = models.value(roomid);
emit currentRoomChanged();
nhlog::ui()->debug("Switched to: {}", roomid.toStdString());
}
}
namespace {
enum NotificationImportance : short
{
@ -463,6 +476,11 @@ FilteredRoomlistModel::FilteredRoomlistModel(RoomlistModel *model, QObject *pare
invalidate();
});
connect(roomlistmodel,
&RoomlistModel::currentRoomChanged,
this,
&FilteredRoomlistModel::currentRoomChanged);
sort(0);
}