blob: cc62d501d4ebb5427ce6b32d2c5c8ae26294e52d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
// SPDX-FileCopyrightText: 2022 Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.3
import "components"
import im.nheko 1.0
// this needs to be last
import QtQml 2.15
Rectangle {
id: chatPage
color: Nheko.colors.window
ColumnLayout {
spacing: 0
anchors.fill: parent
Rectangle {
id: offlineIndicator
color: Nheko.theme.error
visible: !TimelineManager.isConnected
Layout.preferredHeight: offlineLabel.height + Nheko.paddingMedium
Layout.fillWidth: true
z: 1
Label {
id: offlineLabel
anchors.centerIn: parent
text: qsTr("No network connection")
}
}
AdaptiveLayout {
id: adaptiveView
Layout.fillWidth: true
Layout.fillHeight: true
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();
}
}
AdaptiveLayoutElement {
id: communityListC
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
CommunitiesList {
id: communitiesList
collapsed: parent.collapsed
}
Binding {
target: Settings
property: 'communityListWidth'
value: communityListC.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
minimumWidth: fontMetrics.averageCharacterWidth * 40 + Nheko.avatarSize + 2 * Nheko.paddingMedium
TimelineView {
id: timeline
showBackButton: adaptiveView.singlePageMode
room: Rooms.currentRoom
roomPreview: Rooms.currentRoomPreview.roomid ? Rooms.currentRoomPreview : null
}
}
}
}
PrivacyScreen {
anchors.fill: parent
visible: Settings.privacyScreen
screenTimeout: Settings.privacyScreenTimeout
timelineRoot: adaptiveView
windowTarget: MainWindow
}
}
|