summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortg(x) <*@tg-x.net>2016-03-19 00:43:19 +0100
committertg(x) <*@tg-x.net>2016-03-19 00:43:19 +0100
commit56073bc428e8336b6bb61fd952e0424506111232 (patch)
tree1d6a73900b17c7e56a9a22aa5c7c1f19eb7042b1
parentc0b49453eb61e6979c2f378398f84fef7f954a51 (diff)
downloadsecushare-56073bc428e8336b6bb61fd952e0424506111232.tar.gz
secushare-56073bc428e8336b6bb61fd952e0424506111232.zip
qml layout
-rw-r--r--qml.qrc1
-rw-r--r--qml/SidePlaceList.qml27
-rw-r--r--qml/SideThreadList.qml2
-rw-r--r--qml/ThreadList.qml273
-rw-r--r--qml/main.qml148
5 files changed, 363 insertions, 88 deletions
diff --git a/qml.qrc b/qml.qrc
index e4761fa..9efd478 100644
--- a/qml.qrc
+++ b/qml.qrc
@@ -13,6 +13,7 @@
13 <file>qml/PlaceThread.qml</file> 13 <file>qml/PlaceThread.qml</file>
14 <file>qml/SidePlaceList.qml</file> 14 <file>qml/SidePlaceList.qml</file>
15 <file>qml/SideThreadList.qml</file> 15 <file>qml/SideThreadList.qml</file>
16 <file>qml/ThreadList.qml</file>
16 <file>qml/Profile.qml</file> 17 <file>qml/Profile.qml</file>
17 <file>qml/Prefs.qml</file> 18 <file>qml/Prefs.qml</file>
18 <file>qml/QrReader.qml</file> 19 <file>qml/QrReader.qml</file>
diff --git a/qml/SidePlaceList.qml b/qml/SidePlaceList.qml
index 139a182..358504a 100644
--- a/qml/SidePlaceList.qml
+++ b/qml/SidePlaceList.qml
@@ -14,7 +14,7 @@ Rectangle {
14 property int createHomeTab: 2 14 property int createHomeTab: 2
15 property int profileTab: 5 15 property int profileTab: 5
16 16
17 property int currentIndex: profileTab 17 property int currentIndex: -1
18 18
19 property var selectedPlace: null 19 property var selectedPlace: null
20 20
@@ -22,7 +22,16 @@ Rectangle {
22 console.log ("place list index changed:", currentIndex) 22 console.log ("place list index changed:", currentIndex)
23 if (profileTab != currentIndex) 23 if (profileTab != currentIndex)
24 { 24 {
25 placeList.currentIndex = -1 25 setPlaceIndex(-1)
26 }
27 }
28
29 function setPlaceIndex (idx) {
30 placeList.currentIndex = idx
31 selectedPlace = placeList.model.get(idx)
32 if (selectedPlace)
33 {
34 root.currentIndex = profileTab
26 } 35 }
27 } 36 }
28 37
@@ -74,7 +83,7 @@ Rectangle {
74 id: enterButtonMa 83 id: enterButtonMa
75 anchors.fill: parent 84 anchors.fill: parent
76 //hoverEnabled: true 85 //hoverEnabled: true
77 onClicked: {console.log ("click"); root.currentIndex = enterPlaceTab } 86 onClicked: root.currentIndex = enterPlaceTab
78 } 87 }
79 } 88 }
80 89
@@ -147,7 +156,7 @@ Rectangle {
147 156
148 ListView { 157 ListView {
149 id: placeList 158 id: placeList
150 //currentIndex: -1 159 currentIndex: -1
151 160
152 width: 186 161 width: 186
153 //Layout.fillWidth: true 162 //Layout.fillWidth: true
@@ -162,14 +171,6 @@ Rectangle {
162 delegate: placeListDelegate 171 delegate: placeListDelegate
163 focus: true 172 focus: true
164 173
165 onCurrentIndexChanged: {
166 selectedPlace = model.get(currentIndex)
167 if (selectedPlace)
168 {
169 root.currentIndex = profileTab
170 }
171 }
172
173 Component { 174 Component {
174 id: placeListDelegate 175 id: placeListDelegate
175 176
@@ -218,7 +219,7 @@ Rectangle {
218 219
219 MouseArea { 220 MouseArea {
220 anchors.fill: parent 221 anchors.fill: parent
221 onClicked: placeList.currentIndex = index 222 onClicked: setPlaceIndex(index)
222 } 223 }
223 } 224 }
224 225
diff --git a/qml/SideThreadList.qml b/qml/SideThreadList.qml
index 850fa2d..9f4efbd 100644
--- a/qml/SideThreadList.qml
+++ b/qml/SideThreadList.qml
@@ -7,7 +7,7 @@ import secushare 1.0
7 7
8Rectangle { 8Rectangle {
9 id: root 9 id: root
10 color: Settings.leftSideColor 10 color: Settings.rightSideColor
11 11
12 property int noTab: -1 12 property int noTab: -1
13 property int threadTab: 4 13 property int threadTab: 4
diff --git a/qml/ThreadList.qml b/qml/ThreadList.qml
new file mode 100644
index 0000000..83986d2
--- /dev/null
+++ b/qml/ThreadList.qml
@@ -0,0 +1,273 @@
1import QtQuick 2.2
2import QtQuick.Window 2.1;
3import QtQuick.Controls 1.1
4import QtQuick.Layouts 1.1
5
6import secushare 1.0
7
8Rectangle {
9 id: root
10 color: "white"
11 anchors.margins: 20
12
13 property int noTab: -1
14 property int threadTab: 4
15
16 property int currentIndex: -1
17
18 property var selectedThread: null
19
20 onCurrentIndexChanged: {
21 console.log ("thread list index changed:", currentIndex)
22 if (threadTab != currentIndex)
23 {
24 threadList.currentIndex = -1
25 }
26 }
27
28 function setThreadIndex (idx) {
29 threadList.currentIndex = idx
30 selectedThread = threadList.model.get(idx)
31 if (selectedThread)
32 {
33 root.currentIndex = threadTab
34 }
35 }
36
37 Image {
38 id: placeBackgroundImage
39 anchors.fill: parent
40 opacity: 0.5
41 fillMode: Image.Tile
42 clip: true
43 source: "images/demo/ubuntu-wallpaper.jpg"
44 }
45
46 Rectangle { height: 10 }
47
48 ColumnLayout {
49 width: parent.width
50 height: parent.height
51
52 ListModel {
53 id: threadListModel
54
55 // FIXME: These threads are just mock-ups,
56 // they should actually be coming from
57 // the user's subscribed places! -lynX
58 //
59
60 ListElement {
61 messageId: 1
62 threadId: 1
63 date: "2012-12-20 12:12"
64 nymName: "Bailadora"
65 nymImage: "images/demo/baila.jpg"
66 title: "Things you knew this morning"
67 textData: "Did you see that NSA graffiti on the corner of Chaussestr. and Torstr. not only does it look amazing, it's also such a strong message !!"
68 image: "images/demo/Conffeti-background.jpg"
69 }
70 ListElement {
71 messageId: 2
72 threadId: 1
73 date: "2012-12-20 12:20"
74 nymName: "La Doll"
75 nymImage: "images/demo/doll.jpg"
76 title: "Did you see the NSA graffiti"
77 textData: "Oh yeah, totally awesome! Was about time somebody said that! And with style!"
78 image: "images/demo/ubuntu-wallpaper.jpg"
79 }
80 ListElement {
81 messageId: 3
82 threadId: 1
83 date: "2015-12-22 20:12"
84 nymName: "Arpeggio"
85 nymImage: "images/demo/arp.jpg"
86 title: "Popcorn"
87 textData: "What! What ? Guess I'll take an extra detour on the bike to see that!"
88 image: "images/demo/popcorn-background.jpg"
89 }
90 }
91
92 ListView {
93 id: threadList
94 currentIndex: -1
95
96 Layout.fillWidth: true
97 Layout.fillHeight: true
98 Layout.margins: 15
99
100 spacing: 15
101 clip: true
102
103 model: threadListModel
104 //model: App.models.threads // FIXME
105 delegate: threadListDelegate
106 focus: true
107
108 Component {
109 id: threadListDelegate
110
111 Item {
112 id: threadItem
113
114 width: parent.width - 100
115 height: (contentWrapper.height > userWrapper.height) ? contentWrapper.height : userWrapper.height
116
117 Rectangle {
118 id: userWrapper
119 width: 90
120 height: 90
121 anchors.left: parent.left
122
123 color: "black"
124 opacity: 1.0
125
126 Image {
127 id: messageMiniImage
128 source: nymImage
129 fillMode: Image.PreserveAspectCrop
130 height: 60
131 width: 80
132 anchors.left: parent.left
133 anchors.leftMargin: 5
134 anchors.top: parent.top
135 anchors.topMargin: 5
136 }
137
138 Text {
139 anchors.top: messageMiniImage.bottom
140 id: contactText
141 text: nymName
142
143 width: 85
144 height: 30
145 anchors.left: parent.left
146 anchors.leftMargin: 10
147
148 wrapMode : Text.Wrap
149 elide : Text.ElideRight
150 color: "white"
151 font.family: ubuntuBIFont.name
152 font.pointSize: 12
153 font.letterSpacing : -2
154 }
155
156 MouseArea {
157 anchors.fill: parent
158 onClicked: {
159 setThreadIndex(index)
160 }
161 }
162 }
163
164 Rectangle {
165 id: contentWrapper
166
167 anchors.left: userWrapper.right
168 anchors.right: parent.right
169 anchors.top: parent.top
170 anchors.leftMargin: 10
171 anchors.rightMargin: 10
172 anchors.topMargin: 0
173
174 height: contentText.contentHeight + contentDate.contentHeight + 25
175
176 Text {
177 id: contentText
178 anchors.margins: 10
179 //width: parent.width
180 anchors.fill: parent
181
182 text: title
183 font.pointSize: 12
184 wrapMode : Text.Wrap
185
186 font.family: ubuntuFont.name
187 }
188
189 Text {
190 id: contentDate
191
192 width: parent.width - 10
193 anchors.bottom: parent.bottom
194 anchors.margins: 10
195
196 text: date
197 font.pointSize: 11
198 horizontalAlignment: Text.AlignRight
199 font.family: ubuntuFont.name
200 }
201 }
202/*
203 Rectangle {
204 id: threadItemInside
205 anchors.fill: parent
206 anchors.topMargin: 20
207 opacity: 1.0
208
209 color: "black" // threadTab == root.currentIndex && threadItem.ListView.isCurrentItem ? "white" : "black"
210
211 Image {
212 id: threadMiniImage
213 source: "images/demo/ubuntu-wallpaper.jpg" // FIXME
214 fillMode: Image.PreserveAspectCrop
215 height: 60
216 width: 160
217 anchors.left: parent.left
218 anchors.leftMargin: 5
219 anchors.top: parent.top
220 anchors.topMargin: 5
221 }
222
223 Text {
224 anchors.top: threadMiniImage.bottom
225 id: contactInfo
226 text: name
227 width: 160
228 height: 80
229 anchors.left: parent.left
230 anchors.leftMargin: 5
231
232 wrapMode : Text.Wrap
233 elide : Text.ElideRight
234 color: "white" //threadTab == root.currentIndex && threadItem.ListView.isCurrentItem ? "black" : "white"
235
236 font.family: ubuntuBIFont.name
237 font.pointSize: 18
238 font.letterSpacing : -2
239 }
240
241 MouseArea {
242 anchors.fill: parent
243 onClicked: threadList.currentIndex = index
244 }
245 }
246 Rectangle {
247 id: indicator
248
249 radius: 35
250 color: "#EFC208"
251 anchors.left: threadItemInside.left
252 anchors.leftMargin: 125
253 anchors.top: parent.top
254 anchors.topMargin: 10
255 border.color: "black"
256 border.width: 3
257 height: 35
258 width: 35
259 visible: true // threadTab == root.currentIndex && threadItem.ListView.isCurrentItem ? false : true
260
261 Text {
262 anchors.centerIn: parent
263 text: "12"
264 font.family: ubuntuFont.name
265 font.pointSize: 14
266 }
267 }
268*/
269 }
270 }
271 }
272 }
273}
diff --git a/qml/main.qml b/qml/main.qml
index 8e99040..701349d 100644
--- a/qml/main.qml
+++ b/qml/main.qml
@@ -7,6 +7,8 @@ import QtQuick.Controls.Styles 1.2
7import secushare 1.0 7import secushare 1.0
8 8
9ApplicationWindow { 9ApplicationWindow {
10 opacity: App.connected ? 1 : 0.25
11
10 onClosing: { 12 onClosing: {
11 close.accepted = false 13 close.accepted = false
12 App.close() 14 App.close()
@@ -20,15 +22,15 @@ ApplicationWindow {
20 22
21 property int noTab: -1 23 property int noTab: -1
22 24
23 property int prefsTab: 0 25 property int threadListTab: 0
24 property int enterPlaceTab: 1 26 property int enterPlaceTab: 1
25 property int createHomeTab: 2 27 property int createHomeTab: 2
26 property int createEgoTab: 3 28 property int createEgoTab: 3
27 property int threadTab: 4 29 property int threadTab: 4
28 property int profileTab: 5 30 property int profileTab: 5
31 property int prefsTab: 6
29 32
30 property int threadsTab: 0 33 property int placesTab: 0
31 property int placesTab: 1
32 34
33 property int rightTabIndex: noTab 35 property int rightTabIndex: noTab
34 property int nymsTab: 0 36 property int nymsTab: 0
@@ -68,7 +70,7 @@ ApplicationWindow {
68 Rectangle { 70 Rectangle {
69 width: parent.width 71 width: parent.width
70 height: 60 72 height: 60
71 color: prefsTab == main.currentIndex ? "white" : "transparent" 73 color: threadListTab == main.currentIndex ? "white" : "transparent"
72 74
73 Rectangle { 75 Rectangle {
74 width: parent.width - 8 76 width: parent.width - 8
@@ -85,7 +87,11 @@ ApplicationWindow {
85 87
86 MouseArea { 88 MouseArea {
87 anchors.fill: parent 89 anchors.fill: parent
88 onClicked: main.currentIndex = prefsTab 90 onClicked: {
91 main.currentIndex = threadListTab
92 rightTabIndex = nymsTab
93 nymsList.model = nymsModel
94 }
89 } 95 }
90 } 96 }
91 97
@@ -98,35 +104,12 @@ ApplicationWindow {
98 104
99 Rectangle { 105 Rectangle {
100 height: 30 106 height: 30
101 width: parent.width / 2 107 width: parent.width
102 color: threadsTab == left.currentIndex ? "white" : "black" 108 color: "black"
103
104 Text {
105 text: qsTr("TOPICS")
106 color: threadsTab == left.currentIndex ? "black" : "white"
107 anchors.centerIn: parent
108 font.pointSize: 22
109 font.family: bebasFont.name
110 }
111
112 MouseArea {
113 anchors.fill: parent
114 onClicked: {
115 left.currentIndex = threadsTab
116 rightTabIndex = nymsTab
117 nymsList.model = nymsModel
118 }
119 }
120 }
121
122 Rectangle {
123 height: 30
124 width: parent.width / 2
125 color: placesTab == left.currentIndex ? "white" : "black"
126 109
127 Text { 110 Text {
128 text: qsTr("PLACES") 111 text: qsTr("PLACES")
129 color: placesTab == left.currentIndex ? "black" : "white" 112 color: "white"
130 anchors.centerIn: parent 113 anchors.centerIn: parent
131 font.pointSize: 22 114 font.pointSize: 22
132 font.family: bebasFont.name 115 font.family: bebasFont.name
@@ -152,7 +135,7 @@ ApplicationWindow {
152 tabsVisible: false 135 tabsVisible: false
153 frameVisible: false 136 frameVisible: false
154 137
155 currentIndex: threadsTab 138 currentIndex: placesTab
156 139
157 onCurrentIndexChanged: { 140 onCurrentIndexChanged: {
158 console.log("left tabview index changed:", currentIndex) 141 console.log("left tabview index changed:", currentIndex)
@@ -164,50 +147,19 @@ ApplicationWindow {
164 { 147 {
165 main.currentIndex = placeListTab.currentIndex 148 main.currentIndex = placeListTab.currentIndex
166 } 149 }
167 break 150 break;
168
169 case threadsTab:
170 if (0 <= placeListTab.currentIndex)
171 {
172 main.currentIndex = threadListTab.currentIndex
173 }
174 break
175 }
176 }
177
178 Tab {
179 id: threadListTab
180 active: true
181 property int currentIndex: threadTab
182
183 SideThreadList {
184 anchors.fill: parent
185
186 onCurrentIndexChanged:
187 {
188 placeListTab.currentIndex = currentIndex
189 main.currentIndex = currentIndex
190 }
191
192 onSelectedThreadChanged: {
193 console.log("selected thread changed:", selectedThread)
194 root.selectedThread = selectedThread
195 if (selectedThread)
196 {
197 main.currentIndex = threadTab
198 rightTabIndex = nymsTab
199 }
200 }
201 } 151 }
202 } 152 }
203 153
204 Tab { 154 Tab {
205 id: placeListTab 155 id: placeListTab
206 property int currentIndex: profileTab 156 active: true
157 property int currentIndex: -1
207 158
208 SidePlaceList { 159 SidePlaceList {
209 id: placeList 160 id: placeList
210 anchors.fill: parent 161 anchors.fill: parent
162 width: 200 - 8
211 163
212 onCurrentIndexChanged: 164 onCurrentIndexChanged:
213 { 165 {
@@ -227,6 +179,34 @@ ApplicationWindow {
227 } 179 }
228 } 180 }
229 } 181 }
182
183 Rectangle { height: 10 }
184
185 Rectangle {
186 width: parent.width
187 height: 30
188 color: prefsTab == main.currentIndex ? "white" : "transparent"
189
190 Rectangle {
191 width: parent.width - 8
192 height: parent.height
193 color: "white"
194
195 Image {
196 height: 24
197 anchors.centerIn: parent
198 source: "images/settings-black.png"
199 fillMode: Image.PreserveAspectFit
200 }
201 }
202
203 MouseArea {
204 anchors.fill: parent
205 onClicked: main.currentIndex = prefsTab
206 }
207 }
208
209 Rectangle { height: 15 }
230 } 210 }
231 } 211 }
232 212
@@ -239,18 +219,15 @@ ApplicationWindow {
239 tabsVisible: false 219 tabsVisible: false
240 frameVisible: false 220 frameVisible: false
241 221
242 currentIndex: threadTab 222 currentIndex: threadListTab
243 223
244 onCurrentIndexChanged: { 224 onCurrentIndexChanged: {
245 console.log("main index changed:", currentIndex) 225 console.log("main index changed:", currentIndex)
246 226
247 if (profileTab != currentIndex 227 if (profileTab != currentIndex
248 && threadTab != currentIndex 228 && threadTab != currentIndex)
249 && enterPlaceTab != currentIndex
250 && createHomeTab != currentIndex
251 && createEgoTab != currentIndex)
252 { 229 {
253 left.currentIndex = noTab 230 placeListTab.currentIndex = noTab
254 } 231 }
255 232
256 if (profileTab != currentIndex 233 if (profileTab != currentIndex
@@ -263,8 +240,24 @@ ApplicationWindow {
263 } 240 }
264 241
265 Tab { 242 Tab {
266 Prefs { 243 ThreadList {
267 anchors.fill: parent 244 anchors.fill: parent
245
246 onCurrentIndexChanged:
247 {
248 placeListTab.currentIndex = currentIndex
249 main.currentIndex = currentIndex
250 }
251
252 onSelectedThreadChanged: {
253 console.log("selected thread changed:", selectedThread)
254 root.selectedThread = selectedThread
255 if (selectedThread)
256 {
257 main.currentIndex = threadTab
258 rightTabIndex = nymsTab
259 }
260 }
268 } 261 }
269 } 262 }
270 263
@@ -299,6 +292,12 @@ ApplicationWindow {
299 place: selectedPlace 292 place: selectedPlace
300 } 293 }
301 } 294 }
295
296 Tab {
297 Prefs {
298 anchors.fill: parent
299 }
300 }
302 } 301 }
303 302
304 Rectangle { 303 Rectangle {
@@ -503,6 +502,7 @@ ApplicationWindow {
503 } 502 }
504 } 503 }
505 } 504 }
505
506 } 506 }
507 } 507 }
508 } 508 }