diff options
author | DeepBlueV7.X <nicolas.werner@hotmail.de> | 2022-02-04 07:13:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-04 07:13:53 +0100 |
commit | 00116e81282612762b4091bfe1fe693a2e47e8fe (patch) | |
tree | 389c657053f9ceb3130f495d7483e837d5646371 /resources | |
parent | Merge pull request #918 from tastytea/stickerpicker-reapply-search (diff) | |
parent | Use different height setting (diff) | |
download | nheko-00116e81282612762b4091bfe1fe693a2e47e8fe.tar.xz |
Merge pull request #906 from LorenDB/offlineIndicator
Add offline indicator
Diffstat (limited to 'resources')
-rw-r--r-- | resources/qml/ChatPage.qml | 167 | ||||
-rw-r--r-- | resources/qml/components/AdaptiveLayout.qml | 1 |
2 files changed, 88 insertions, 80 deletions
diff --git a/resources/qml/ChatPage.qml b/resources/qml/ChatPage.qml index e3aa3e48..7cc6552a 100644 --- a/resources/qml/ChatPage.qml +++ b/resources/qml/ChatPage.qml @@ -17,111 +17,120 @@ Rectangle { color: Nheko.colors.window - AdaptiveLayout { - id: adaptiveView - + ColumnLayout { + spacing: 0 anchors.fill: parent - singlePageMode: communityListC.preferredWidth + roomListC.preferredWidth + timlineViewC.minimumWidth > width - pageIndex: 1 - - Component.onCompleted: initializePageIndex() - onSinglePageModeChanged: initializePageIndex() - - function initializePageIndex() { - if (!singlePageMode) - adaptiveView.pageIndex = 0; - else if (Rooms.currentRoom || Rooms.currentRoomPreview.roomid) - adaptiveView.pageIndex = 2; - else - adaptiveView.pageIndex = 1; - } - Connections { - target: Rooms - function onCurrentRoomChanged() { - adaptiveView.initializePageIndex(); - } - } + Rectangle { + id: offlineIndicator - Connections { - target: Communities - function onCurrentTagIdChanged() { - adaptiveView.initializePageIndex(); - } - } + color: Nheko.theme.error + visible: !TimelineManager.isConnected + Layout.preferredHeight: offlineLabel.height + Nheko.paddingMedium + Layout.fillWidth: true - onPageIndexChanged: { - if (adaptiveView.pageIndex == 1 && (Rooms.currentRoom || Rooms.currentRoomPreview.roomid)) { - Rooms.resetCurrentRoom(); + Label { + id: offlineLabel + + anchors.centerIn: parent + text: qsTr("No network connection") } } - AdaptiveLayoutElement { - id: communityListC + AdaptiveLayout { + id: adaptiveView - visible: Settings.groupView - minimumWidth: communitiesList.avatarSize * 4 + Nheko.paddingMedium * 2 - collapsedWidth: communitiesList.avatarSize + 2 * Nheko.paddingMedium - preferredWidth: Settings.communityListWidth >= minimumWidth ? Settings.communityListWidth : collapsedWidth - maximumWidth: communitiesList.avatarSize * 10 + 2 * Nheko.paddingMedium + Layout.fillWidth: true + Layout.fillHeight: true + singlePageMode: communityListC.preferredWidth + roomListC.preferredWidth + timlineViewC.minimumWidth > width + pageIndex: 1 - CommunitiesList { - id: communitiesList + Component.onCompleted: initializePageIndex() + onSinglePageModeChanged: initializePageIndex() - collapsed: parent.collapsed + function initializePageIndex() { + if (!singlePageMode) + adaptiveView.pageIndex = 0; + else if (Rooms.currentRoom || Rooms.currentRoomPreview.roomid) + adaptiveView.pageIndex = 2; + else + adaptiveView.pageIndex = 1; } - Binding { - target: Settings - property: 'communityListWidth' - value: communityListC.preferredWidth - when: !adaptiveView.singlePageMode - delayed: true - restoreMode: Binding.RestoreBindingOrValue + Connections { + target: Rooms + function onCurrentRoomChanged() { + adaptiveView.initializePageIndex(); + } } - } + AdaptiveLayoutElement { + id: communityListC - AdaptiveLayoutElement { - id: roomListC + visible: Settings.groupView + minimumWidth: communitiesList.avatarSize * 4 + Nheko.paddingMedium * 2 + collapsedWidth: communitiesList.avatarSize + 2 * Nheko.paddingMedium + preferredWidth: Settings.communityListWidth >= minimumWidth ? Settings.communityListWidth : collapsedWidth + maximumWidth: communitiesList.avatarSize * 10 + 2 * Nheko.paddingMedium - minimumWidth: roomlist.avatarSize * 4 + Nheko.paddingSmall * 2 - preferredWidth: (Settings.roomListWidth == - 1) - ? (roomlist.avatarSize * 5 + Nheko.paddingSmall * 2) - : (Settings.roomListWidth >= minimumWidth ? Settings.roomListWidth : collapsedWidth) - maximumWidth: roomlist.avatarSize * 10 + Nheko.paddingSmall * 2 - collapsedWidth: roomlist.avatarSize + 2 * Nheko.paddingMedium + CommunitiesList { + id: communitiesList - RoomList { - id: roomlist + collapsed: parent.collapsed + } + + Binding { + target: Settings + property: 'communityListWidth' + value: communityListC.preferredWidth + when: !adaptiveView.singlePageMode + delayed: true + restoreMode: Binding.RestoreBindingOrValue + } - implicitHeight: chatPage.height - collapsed: parent.collapsed - anchors.fill: parent } - Binding { - target: Settings - property: 'roomListWidth' - value: roomListC.preferredWidth - when: !adaptiveView.singlePageMode - delayed: true - restoreMode: Binding.RestoreBindingOrValue + AdaptiveLayoutElement { + id: roomListC + + minimumWidth: roomlist.avatarSize * 4 + Nheko.paddingSmall * 2 + preferredWidth: (Settings.roomListWidth == - 1) + ? (roomlist.avatarSize * 5 + Nheko.paddingSmall * 2) + : (Settings.roomListWidth >= minimumWidth ? Settings.roomListWidth : collapsedWidth) + maximumWidth: roomlist.avatarSize * 10 + Nheko.paddingSmall * 2 + collapsedWidth: roomlist.avatarSize + 2 * Nheko.paddingMedium + + RoomList { + id: roomlist + + height: adaptiveView.height + collapsed: parent.collapsed + } + + Binding { + target: Settings + property: 'roomListWidth' + value: roomListC.preferredWidth + when: !adaptiveView.singlePageMode + delayed: true + restoreMode: Binding.RestoreBindingOrValue + } + } - } + AdaptiveLayoutElement { + id: timlineViewC - AdaptiveLayoutElement { - id: timlineViewC + minimumWidth: fontMetrics.averageCharacterWidth * 40 + Nheko.avatarSize + 2 * Nheko.paddingMedium - minimumWidth: fontMetrics.averageCharacterWidth * 40 + Nheko.avatarSize + 2 * Nheko.paddingMedium + TimelineView { + id: timeline - TimelineView { - id: timeline + showBackButton: adaptiveView.singlePageMode + room: Rooms.currentRoom + roomPreview: Rooms.currentRoomPreview.roomid ? Rooms.currentRoomPreview : null + } - showBackButton: adaptiveView.singlePageMode - room: Rooms.currentRoom - roomPreview: Rooms.currentRoomPreview.roomid ? Rooms.currentRoomPreview : null } } diff --git a/resources/qml/components/AdaptiveLayout.qml b/resources/qml/components/AdaptiveLayout.qml index 414b4d53..28befe91 100644 --- a/resources/qml/components/AdaptiveLayout.qml +++ b/resources/qml/components/AdaptiveLayout.qml @@ -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]); |