Add offline indicator (#472)
This commit is contained in:
parent
fcefdb7ca6
commit
5bed3684ec
|
@ -17,10 +17,29 @@ Rectangle {
|
|||
|
||||
color: Nheko.colors.window
|
||||
|
||||
ColumnLayout {
|
||||
spacing: 0
|
||||
anchors.fill: parent
|
||||
|
||||
Rectangle {
|
||||
id: offlineIndicator
|
||||
|
||||
color: Nheko.theme.error
|
||||
visible: !TimelineManager.isConnected
|
||||
Layout.preferredHeight: fontMetrics.height + Nheko.paddingMedium
|
||||
Layout.fillWidth: true
|
||||
|
||||
Label {
|
||||
anchors.centerIn: parent
|
||||
text: qsTr("No network connection")
|
||||
}
|
||||
}
|
||||
|
||||
AdaptiveLayout {
|
||||
id: adaptiveView
|
||||
|
||||
anchors.fill: parent
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
singlePageMode: communityListC.preferredWidth + roomListC.preferredWidth + timlineViewC.minimumWidth > width
|
||||
pageIndex: 1
|
||||
|
||||
|
@ -43,19 +62,6 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: Communities
|
||||
function onCurrentTagIdChanged() {
|
||||
adaptiveView.initializePageIndex();
|
||||
}
|
||||
}
|
||||
|
||||
onPageIndexChanged: {
|
||||
if (adaptiveView.pageIndex == 1 && (Rooms.currentRoom || Rooms.currentRoomPreview.roomid)) {
|
||||
Rooms.resetCurrentRoom();
|
||||
}
|
||||
}
|
||||
|
||||
AdaptiveLayoutElement {
|
||||
id: communityListC
|
||||
|
||||
|
@ -95,9 +101,8 @@ Rectangle {
|
|||
RoomList {
|
||||
id: roomlist
|
||||
|
||||
implicitHeight: chatPage.height
|
||||
height: adaptiveView.height
|
||||
collapsed: parent.collapsed
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
Binding {
|
||||
|
@ -128,6 +133,8 @@ Rectangle {
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PrivacyScreen {
|
||||
anchors.fill: parent
|
||||
visible: Settings.privacyScreen
|
||||
|
|
|
@ -23,7 +23,6 @@ Container {
|
|||
|
||||
onSinglePageModeChanged: if (!singlePageMode) pageIndex = 0
|
||||
|
||||
anchors.fill: parent
|
||||
Component.onCompleted: {
|
||||
for (var i = 0; i < count - 1; i++) {
|
||||
let handle_ = handle.createObject(contentChildren[i]);
|
||||
|
|
|
@ -162,6 +162,14 @@ TimelineViewManager::TimelineViewManager(CallManager *, ChatPage *parent)
|
|||
&QApplication::focusWindowChanged,
|
||||
this,
|
||||
&TimelineViewManager::focusChanged);
|
||||
connect(parent, &ChatPage::connectionLost, this, [this] {
|
||||
isConnected_ = false;
|
||||
emit isConnectedChanged(false);
|
||||
});
|
||||
connect(parent, &ChatPage::connectionRestored, this, [this] {
|
||||
isConnected_ = true;
|
||||
emit isConnectedChanged(true);
|
||||
});
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -42,6 +42,7 @@ class TimelineViewManager : public QObject
|
|||
Q_PROPERTY(
|
||||
bool isInitialSync MEMBER isInitialSync_ READ isInitialSync NOTIFY initialSyncChanged)
|
||||
Q_PROPERTY(bool isWindowFocused READ isWindowFocused NOTIFY focusChanged)
|
||||
Q_PROPERTY(bool isConnected READ isConnected NOTIFY isConnectedChanged)
|
||||
|
||||
public:
|
||||
TimelineViewManager(CallManager *callManager, ChatPage *parent = nullptr);
|
||||
|
@ -54,6 +55,7 @@ public:
|
|||
|
||||
Q_INVOKABLE bool isInitialSync() const { return isInitialSync_; }
|
||||
bool isWindowFocused() const;
|
||||
bool isConnected() const { return isConnected_; }
|
||||
Q_INVOKABLE void openImageOverlay(TimelineModel *room, QString mxcUrl, QString eventId);
|
||||
Q_INVOKABLE void openImagePackSettings(QString roomid);
|
||||
Q_INVOKABLE void saveMedia(QString mxcUrl);
|
||||
|
@ -73,6 +75,7 @@ public:
|
|||
signals:
|
||||
void activeTimelineChanged(TimelineModel *timeline);
|
||||
void initialSyncChanged(bool isInitialSync);
|
||||
void isConnectedChanged(bool state);
|
||||
void replyingEventChanged(QString replyingEvent);
|
||||
void replyClosed();
|
||||
void inviteUsers(QString roomId, QStringList users);
|
||||
|
@ -111,6 +114,7 @@ public slots:
|
|||
|
||||
private:
|
||||
bool isInitialSync_ = true;
|
||||
bool isConnected_ = true;
|
||||
|
||||
RoomlistModel *rooms_ = nullptr;
|
||||
CommunitiesModel *communities_ = nullptr;
|
||||
|
|
Loading…
Reference in New Issue