summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortg(x) <*@tg-x.net>2016-02-06 00:28:44 +0100
committertg(x) <*@tg-x.net>2016-02-06 00:28:44 +0100
commit7d3eac5b9f56f113d7a5a9f861006884267f4aed (patch)
tree39acdfec0e003a927d15eb68ce344a5c8011c99e
parentb5b8e9387f0fc3f697e8cd831a18820d58a27275 (diff)
downloadsecushare-7d3eac5b9f56f113d7a5a9f861006884267f4aed.tar.gz
secushare-7d3eac5b9f56f113d7a5a9f861006884267f4aed.zip
qml: SidePlaceList & SideTopicList
-rw-r--r--qml/SidePlaceList.qml251
-rw-r--r--qml/SideTopicList.qml155
2 files changed, 406 insertions, 0 deletions
diff --git a/qml/SidePlaceList.qml b/qml/SidePlaceList.qml
new file mode 100644
index 0000000..4f83d71
--- /dev/null
+++ b/qml/SidePlaceList.qml
@@ -0,0 +1,251 @@
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: Settings.leftSideColor
11
12 property int noTab: -1
13 property int enterPlaceTab: 1
14 property int createHomeTab: 2
15 property int profileTab: 5
16
17 property int currentIndex: profileTab
18
19 property var selectedPlace: null
20
21 onCurrentIndexChanged: {
22 console.log ("place list index changed:", currentIndex)
23 if (profileTab != currentIndex)
24 {
25 placeList.currentIndex = -1
26 }
27 }
28
29 ColumnLayout {
30 width: parent.width
31 height: parent.height
32 spacing: 0
33
34 RowLayout {
35 anchors.left: parent.left
36 width: parent.width - 8
37 spacing: 0
38
39 Rectangle {
40 id: enterButton
41 width: parent.width / 2
42 height: 30
43 state: "NORMAL"
44
45 states: [
46 State {
47 name: "NORMAL"
48 when: enterPlaceTab != root.currentIndex // && !enterButtonMa.containsMouse
49 PropertyChanges { target: enterButton; color: "black" }
50 PropertyChanges { target: enterButtonImage; source: "images/enter-white.png" }
51 },
52 State {
53 name: "HOVER"
54 //when: ((enterButtonMa.containsMouse) && (root.currentIndex !== 2))
55 //PropertyChanges { target: enterButton; color: "#282828" }
56 },
57 State {
58 name: "PRESSED"
59 when: enterPlaceTab == root.currentIndex
60 PropertyChanges { target: enterButton; color: "white" }
61 PropertyChanges { target: enterButtonImage; source: "images/enter.png" }
62 }
63 ]
64
65 Image {
66 id: enterButtonImage
67 height: parent.height - 4
68 anchors.centerIn: parent
69 fillMode: Image.PreserveAspectFit
70 source: "images/enter-white.png"
71 }
72
73 MouseArea {
74 id: enterButtonMa
75 anchors.fill: parent
76 //hoverEnabled: true
77 onClicked: {console.log ("click"); root.currentIndex = enterPlaceTab }
78 }
79 }
80
81 Rectangle {
82 id: createButton
83 width: parent.width / 2
84 height: 30
85 state: "NORMAL"
86
87 states: [
88 State {
89 name: "NORMAL"
90 when: createHomeTab != root.currentIndex // && !createButtonMa.containsMouse
91 PropertyChanges { target: createButton; color: "black"}
92 PropertyChanges { target: createButtonImage; source: "images/create_home.png" }
93 },
94 State {
95 name: "HOVER"
96 //when: ((createButtonMa.containsMouse) && (root.currentIndex !== 3))
97 //PropertyChanges { target: createButton; color: "#282828"}
98 },
99 State {
100 name: "PRESSED"
101 when: createHomeTab == root.currentIndex
102 PropertyChanges { target: createButton; color: "white"}
103 PropertyChanges { target: createButtonImage; source: "images/create_home-black.png" }
104 }
105 ]
106
107 Image {
108 id: createButtonImage
109 source: "images/create_home.png"
110 anchors.centerIn: parent
111 }
112 MouseArea {
113 id: createButtonMa
114 anchors.fill: parent
115 //hoverEnabled: true
116 onClicked: {
117 root.currentIndex = createHomeTab
118 //root.createHome()
119 }
120 }
121 }
122 }
123
124
125 ListModel {
126 id: placeListModel
127
128 // FIXME: These places are just mock-ups,
129 // they should actually be coming from
130 // the user's subscribed places! -lynX
131 //
132
133 ListElement {
134 name: "Clandestine Urban Art"
135 image: "images/demo/ubuntu-wallpaper.jpg"
136 }
137 ListElement {
138 name: "GNUnet"
139 image: "images/demo/gnunet.png"
140 }
141 ListElement {
142 name: "SecuShare"
143 image: "images/demo/secushare.png"
144 }
145 }
146
147 ListView {
148 id: placeList
149 //currentIndex: -1
150
151 width: 186
152 //Layout.fillWidth: true
153 Layout.fillHeight: true
154 anchors.right: parent.right
155
156 spacing: 15
157 clip: true
158
159 //model: placeListModel
160 model: App.models.places
161 delegate: placeListDelegate
162 focus: true
163
164 onCurrentIndexChanged: {
165 selectedPlace = model.get(currentIndex)
166 if (selectedPlace)
167 {
168 root.currentIndex = profileTab
169 }
170 }
171
172 Component {
173 id: placeListDelegate
174
175 Item {
176 id: placeItem
177 width: profileTab == root.currentIndex && placeItem.ListView.isCurrentItem ? 186 : 170
178 height: 170
179
180 Rectangle {
181 id: placeItemInside
182 anchors.fill: parent
183 anchors.topMargin: 20
184 opacity: 1.0
185
186 color: profileTab == root.currentIndex && placeItem.ListView.isCurrentItem ? "white" : "black"
187
188 Image {
189 id: threadMiniImage
190 source: image
191 fillMode: Image.PreserveAspectCrop
192 height: 60
193 width: 160
194 anchors.left: parent.left
195 anchors.leftMargin: 5
196 anchors.top: parent.top
197 anchors.topMargin: 5
198 }
199
200 Text {
201 anchors.top: threadMiniImage.bottom
202 id: contactInfo
203 text: name
204 width: 160
205 height: 80
206 anchors.left: parent.left
207 anchors.leftMargin: 5
208
209 wrapMode : Text.Wrap
210 elide : Text.ElideRight
211 color: profileTab == root.currentIndex && placeItem.ListView.isCurrentItem ? "black" : "white"
212
213 font.family: ubuntuBIFont.name
214 font.pointSize: 18
215 font.letterSpacing : -2
216 }
217
218 MouseArea {
219 anchors.fill: parent
220 onClicked: placeList.currentIndex = index
221 }
222 }
223
224 Rectangle {
225 id: indicator
226
227 radius: 35
228 color: "#EFC208"
229 anchors.left: placeItemInside.left
230 anchors.leftMargin: 125
231 anchors.top: parent.top
232 anchors.topMargin: 10
233 border.color: "black"
234 border.width: 3
235 height: 35
236 width: 35
237 visible: profileTab == root.currentIndex && placeItem.ListView.isCurrentItem ? false : true
238
239 Text {
240 anchors.centerIn: parent
241 id: numberNewPlaces
242 text: "12"
243 font.family: ubuntuFont.name
244 font.pointSize: 14
245 }
246 }
247 }
248 }
249 }
250 }
251} \ No newline at end of file
diff --git a/qml/SideTopicList.qml b/qml/SideTopicList.qml
new file mode 100644
index 0000000..2d474ef
--- /dev/null
+++ b/qml/SideTopicList.qml
@@ -0,0 +1,155 @@
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: Settings.leftSideColor
11
12 property int noTab: -1
13 property int topicTab: 4
14
15 property int currentIndex: topicTab
16
17 property var selectedTopic: null
18
19 onCurrentIndexChanged: {
20 console.log ("topic list index changed:", currentIndex)
21 if (topicTab != currentIndex)
22 {
23 topicList.currentIndex = -1
24 }
25 }
26
27 ColumnLayout {
28 width: parent.width
29 height: parent.height
30
31 ListModel {
32 id: topicListModel
33
34 // FIXME: These topics are just mock-ups,
35 // they should actually be coming from
36 // the user's subscribed places! -lynX
37 //
38
39 ListElement {
40 name: "Things you knew this morning"
41 image: "images/demo/Conffeti-background.jpg"
42 }
43 ListElement {
44 name: "Did you see the NSA graffiti"
45 image: "images/demo/ubuntu-wallpaper.jpg"
46 }
47 ListElement {
48 name: "Popcorn"
49 image: "images/demo/popcorn-background.jpg"
50 }
51 }
52
53 ListView {
54 id: topicList
55 //currentIndex: -1
56
57 width: 186
58 //Layout.fillWidth: true
59 Layout.fillHeight: true
60 anchors.right: parent.right
61
62 spacing: 15
63 clip: true
64
65 model: topicListModel
66 delegate: topicListDelegate
67 focus: true
68
69 onCurrentIndexChanged: {
70 selectedTopic = model.get(currentIndex)
71 if (selectedTopic)
72 {
73 root.currentIndex = topicTab
74 }
75 }
76
77 Component {
78 id: topicListDelegate
79
80 Item {
81 id: topicItem
82 width: topicTab == root.currentIndex && topicItem.ListView.isCurrentItem ? 186 : 170
83 height: 170
84
85 Rectangle {
86 id: topicItemInside
87 anchors.fill: parent
88 anchors.topMargin: 20
89 opacity: 1.0
90
91 color: topicTab == root.currentIndex && topicItem.ListView.isCurrentItem ? "white" : "black"
92
93 Image {
94 id: threadMiniImage
95 source: image
96 fillMode: Image.PreserveAspectCrop
97 height: 60
98 width: 160
99 anchors.left: parent.left
100 anchors.leftMargin: 5
101 anchors.top: parent.top
102 anchors.topMargin: 5
103 }
104
105 Text {
106 anchors.top: threadMiniImage.bottom
107 id: contactInfo
108 text: name
109 width: 160
110 height: 80
111 anchors.left: parent.left
112 anchors.leftMargin: 5
113
114 wrapMode : Text.Wrap
115 elide : Text.ElideRight
116 color: topicTab == root.currentIndex && topicItem.ListView.isCurrentItem ? "black" : "white"
117
118 font.family: ubuntuBIFont.name
119 font.pointSize: 18
120 font.letterSpacing : -2
121 }
122
123 MouseArea {
124 id:ma
125 anchors.fill: parent
126 onClicked: topicList.currentIndex = index
127 }
128 }
129 Rectangle {
130 id: indicator
131
132 radius: 35
133 color: "#EFC208"
134 anchors.left: topicItemInside.left
135 anchors.leftMargin: 125
136 anchors.top: parent.top
137 anchors.topMargin: 10
138 border.color: "black"
139 border.width: 3
140 height: 35
141 width: 35
142 visible: topicTab == root.currentIndex && topicItem.ListView.isCurrentItem ? false : true
143
144 Text {
145 anchors.centerIn: parent
146 text: "12"
147 font.family: ubuntuFont.name
148 font.pointSize: 14
149 }
150 }
151 }
152 }
153 }
154 }
155}