mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 03:00:46 +03:00
Check isPreviewFetched property for hints
This commit is contained in:
parent
f186e56121
commit
b3b5b6b374
3 changed files with 7 additions and 3 deletions
|
@ -211,7 +211,7 @@ Item {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
|
||||||
MatrixText {
|
MatrixText {
|
||||||
text: preview.roomName == "" ? qsTr("No preview available") : preview.roomName
|
text: !roomPreview.isFetched ? qsTr("No preview available") : preview.roomName
|
||||||
font.pixelSize: 24
|
font.pixelSize: 24
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ Item {
|
||||||
Layout.rightMargin: Nheko.paddingLarge
|
Layout.rightMargin: Nheko.paddingLarge
|
||||||
|
|
||||||
TextArea {
|
TextArea {
|
||||||
text: preview.roomName != "" ? TimelineManager.escapeEmoji(preview.roomTopic) : qsTr("This room is possibly inaccessible. If this room is private, you should remove it from the child list of this space.")
|
text: roomPreview.isFetched ? TimelineManager.escapeEmoji(preview.roomTopic) : qsTr("This room is possibly inaccessible. If this room is private, you should remove it from the child list of this space.")
|
||||||
wrapMode: TextEdit.WordWrap
|
wrapMode: TextEdit.WordWrap
|
||||||
textFormat: TextEdit.RichText
|
textFormat: TextEdit.RichText
|
||||||
readOnly: true
|
readOnly: true
|
||||||
|
|
|
@ -796,11 +796,13 @@ RoomlistModel::setCurrentRoom(const QString &roomid)
|
||||||
p.roomName_ = QString::fromStdString(i->name);
|
p.roomName_ = QString::fromStdString(i->name);
|
||||||
p.roomTopic_ = QString::fromStdString(i->topic);
|
p.roomTopic_ = QString::fromStdString(i->topic);
|
||||||
p.roomAvatarUrl_ = QString::fromStdString(i->avatar_url);
|
p.roomAvatarUrl_ = QString::fromStdString(i->avatar_url);
|
||||||
|
p.isFetched_ = true;
|
||||||
currentRoomPreview_ = std::move(p);
|
currentRoomPreview_ = std::move(p);
|
||||||
nhlog::ui()->debug("Switched to (preview): {}",
|
nhlog::ui()->debug("Switched to (preview): {}",
|
||||||
currentRoomPreview_->roomid_.toStdString());
|
currentRoomPreview_->roomid_.toStdString());
|
||||||
} else {
|
} else {
|
||||||
p.roomid_ = roomid;
|
p.roomid_ = roomid;
|
||||||
|
p.isFetched_ = false;
|
||||||
currentRoomPreview_ = p;
|
currentRoomPreview_ = p;
|
||||||
nhlog::ui()->debug("Switched to (empty): {}",
|
nhlog::ui()->debug("Switched to (empty): {}",
|
||||||
currentRoomPreview_->roomid_.toStdString());
|
currentRoomPreview_->roomid_.toStdString());
|
||||||
|
|
|
@ -32,6 +32,7 @@ class RoomPreview
|
||||||
Q_PROPERTY(QString roomAvatarUrl READ roomAvatarUrl CONSTANT)
|
Q_PROPERTY(QString roomAvatarUrl READ roomAvatarUrl CONSTANT)
|
||||||
Q_PROPERTY(QString reason READ reason CONSTANT)
|
Q_PROPERTY(QString reason READ reason CONSTANT)
|
||||||
Q_PROPERTY(bool isInvite READ isInvite CONSTANT)
|
Q_PROPERTY(bool isInvite READ isInvite CONSTANT)
|
||||||
|
Q_PROPERTY(bool isFetched READ isFetched CONSTANT)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RoomPreview() {}
|
RoomPreview() {}
|
||||||
|
@ -42,9 +43,10 @@ public:
|
||||||
QString roomAvatarUrl() const { return roomAvatarUrl_; }
|
QString roomAvatarUrl() const { return roomAvatarUrl_; }
|
||||||
QString reason() const { return reason_; }
|
QString reason() const { return reason_; }
|
||||||
bool isInvite() const { return isInvite_; }
|
bool isInvite() const { return isInvite_; }
|
||||||
|
bool isFetched() const { return isFetched_; }
|
||||||
|
|
||||||
QString roomid_, roomName_, roomAvatarUrl_, roomTopic_, reason_;
|
QString roomid_, roomName_, roomAvatarUrl_, roomTopic_, reason_;
|
||||||
bool isInvite_ = false;
|
bool isInvite_ = false, isFetched_ = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RoomlistModel final : public QAbstractListModel
|
class RoomlistModel final : public QAbstractListModel
|
||||||
|
|
Loading…
Reference in a new issue