Implement switching in narrow mode
This commit is contained in:
parent
686298e023
commit
d364c29c43
8 changed files with 109 additions and 77 deletions
|
|
@ -21,7 +21,8 @@ class TimelineViewManager;
|
|||
class RoomlistModel : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(TimelineModel *currentRoom READ currentRoom NOTIFY currentRoomChanged)
|
||||
Q_PROPERTY(TimelineModel *currentRoom READ currentRoom NOTIFY currentRoomChanged RESET
|
||||
resetCurrentRoom)
|
||||
public:
|
||||
enum Roles
|
||||
{
|
||||
|
|
@ -73,6 +74,11 @@ public slots:
|
|||
void leave(QString roomid);
|
||||
TimelineModel *currentRoom() const { return currentRoom_.get(); }
|
||||
void setCurrentRoom(QString roomid);
|
||||
void resetCurrentRoom()
|
||||
{
|
||||
currentRoom_ = nullptr;
|
||||
emit currentRoomChanged();
|
||||
}
|
||||
|
||||
private slots:
|
||||
void updateReadStatus(const std::map<QString, bool> roomReadStatus_);
|
||||
|
|
@ -98,7 +104,8 @@ private:
|
|||
class FilteredRoomlistModel : public QSortFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(TimelineModel *currentRoom READ currentRoom NOTIFY currentRoomChanged)
|
||||
Q_PROPERTY(TimelineModel *currentRoom READ currentRoom NOTIFY currentRoomChanged RESET
|
||||
resetCurrentRoom)
|
||||
public:
|
||||
FilteredRoomlistModel(RoomlistModel *model, QObject *parent = nullptr);
|
||||
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
|
||||
|
|
@ -117,6 +124,7 @@ public slots:
|
|||
|
||||
TimelineModel *currentRoom() const { return roomlistmodel->currentRoom(); }
|
||||
void setCurrentRoom(QString roomid) { roomlistmodel->setCurrentRoom(std::move(roomid)); }
|
||||
void resetCurrentRoom() { roomlistmodel->resetCurrentRoom(); }
|
||||
|
||||
void nextRoom();
|
||||
void previousRoom();
|
||||
|
|
|
|||
|
|
@ -891,7 +891,6 @@ TimelineModel::updateLastMessage()
|
|||
time};
|
||||
if (description != lastMessage_) {
|
||||
lastMessage_ = description;
|
||||
emit manager_->updateRoomsLastMessage(room_id_, lastMessage_);
|
||||
emit lastMessageChanged();
|
||||
}
|
||||
return;
|
||||
|
|
@ -906,7 +905,6 @@ TimelineModel::updateLastMessage()
|
|||
QString::fromStdString(mtx::accessors::sender(*event))));
|
||||
if (description != lastMessage_) {
|
||||
lastMessage_ = description;
|
||||
emit manager_->updateRoomsLastMessage(room_id_, description);
|
||||
emit lastMessageChanged();
|
||||
}
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -37,8 +37,6 @@ class TimelineViewManager : public QObject
|
|||
|
||||
Q_PROPERTY(
|
||||
bool isInitialSync MEMBER isInitialSync_ READ isInitialSync NOTIFY initialSyncChanged)
|
||||
Q_PROPERTY(
|
||||
bool isNarrowView MEMBER isNarrowView_ READ isNarrowView NOTIFY narrowViewChanged)
|
||||
Q_PROPERTY(
|
||||
bool isWindowFocused MEMBER isWindowFocused_ READ isWindowFocused NOTIFY focusChanged)
|
||||
|
||||
|
|
@ -54,7 +52,6 @@ public:
|
|||
void clearAll() { rooms_->clear(); }
|
||||
|
||||
Q_INVOKABLE bool isInitialSync() const { return isInitialSync_; }
|
||||
bool isNarrowView() const { return isNarrowView_; }
|
||||
bool isWindowFocused() const { return isWindowFocused_; }
|
||||
Q_INVOKABLE void openImageOverlay(QString mxcUrl, QString eventId);
|
||||
Q_INVOKABLE QColor userColor(QString id, QColor background);
|
||||
|
|
@ -74,16 +71,12 @@ public:
|
|||
void verifyDevice(QString userid, QString deviceid);
|
||||
|
||||
signals:
|
||||
void clearRoomMessageCount(QString roomid);
|
||||
void updateRoomsLastMessage(QString roomid, const DescInfo &info);
|
||||
void activeTimelineChanged(TimelineModel *timeline);
|
||||
void initialSyncChanged(bool isInitialSync);
|
||||
void replyingEventChanged(QString replyingEvent);
|
||||
void replyClosed();
|
||||
void newDeviceVerificationRequest(DeviceVerificationFlow *flow);
|
||||
void inviteUsers(QStringList users);
|
||||
void showRoomList();
|
||||
void narrowViewChanged();
|
||||
void focusChanged();
|
||||
void focusInput();
|
||||
void openImageOverlayInternalCb(QString eventId, QImage img);
|
||||
|
|
@ -113,22 +106,6 @@ public slots:
|
|||
|
||||
void setVideoCallItem();
|
||||
|
||||
void enableBackButton()
|
||||
{
|
||||
if (isNarrowView_)
|
||||
return;
|
||||
isNarrowView_ = true;
|
||||
emit narrowViewChanged();
|
||||
}
|
||||
void disableBackButton()
|
||||
{
|
||||
if (!isNarrowView_)
|
||||
return;
|
||||
isNarrowView_ = false;
|
||||
emit narrowViewChanged();
|
||||
}
|
||||
|
||||
void backToRooms() { emit showRoomList(); }
|
||||
QObject *completerFor(QString completerName, QString roomId = "");
|
||||
void forwardMessageToRoom(mtx::events::collections::TimelineEvents *e, QString roomId);
|
||||
|
||||
|
|
@ -152,7 +129,6 @@ private:
|
|||
CallManager *callManager_ = nullptr;
|
||||
|
||||
bool isInitialSync_ = true;
|
||||
bool isNarrowView_ = false;
|
||||
bool isWindowFocused_ = false;
|
||||
|
||||
RoomlistModel *rooms_ = nullptr;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue