summaryrefslogtreecommitdiff
path: root/qml/SidePlaceList.qml
blob: 05742314843b9c8f9f1f64dff4e011c73adaea9a (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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
import QtQuick 2.2
import QtQuick.Window 2.1;
import QtQuick.Controls 1.1
import QtQuick.Layouts 1.1

import secushare 1.0

Rectangle {
    id: root
    color: Settings.leftSideColor

    property int noTab: -1
    property int enterPlaceTab: 1
    property int createHomeTab: 2
    property int profileTab: 5

    property int currentIndex: profileTab

    property var selectedPlace: null

    onCurrentIndexChanged: {
        console.log ("place list index changed:", currentIndex)
        if (profileTab != currentIndex)
        {
            placeList.currentIndex = -1
        }
    }

    ColumnLayout {
        width: parent.width
        height: parent.height
        spacing: 0

        RowLayout {
            anchors.left: parent.left
            width: parent.width - 8
            spacing: 0

                Rectangle {
                    id: enterButton
                    width: parent.width / 2
                    height: 30
                    state: "NORMAL"

                    states: [
                    State {
                        name: "NORMAL"
                        when: enterPlaceTab != root.currentIndex // && !enterButtonMa.containsMouse
                        PropertyChanges { target: enterButton; color: "black" }
                        PropertyChanges { target: enterButtonImage; source: "images/enter-white.png" }
                    },
                    State {
                        name: "HOVER"
                        //when: ((enterButtonMa.containsMouse) && (root.currentIndex !== 2))
                        //PropertyChanges { target: enterButton; color: "#282828" }
                    },
                    State {
                        name: "PRESSED"
                        when: enterPlaceTab == root.currentIndex
                        PropertyChanges { target: enterButton; color: "white" }
                        PropertyChanges { target: enterButtonImage; source: "images/enter.png" }
                    }
                    ]

                    Image {
                        id: enterButtonImage
                        height: parent.height - 4
                        anchors.centerIn: parent
                        fillMode: Image.PreserveAspectFit
                        source: "images/enter-white.png"
                    }

                    MouseArea {
                        id: enterButtonMa
                        anchors.fill: parent
                        //hoverEnabled: true
                        onClicked: {console.log ("click"); root.currentIndex = enterPlaceTab }
                    }
                }

                Rectangle {
                    id: createButton
                    width: parent.width / 2
                    height: 30
                    state: "NORMAL"

                    states: [
                    State {
                        name: "NORMAL"
                        when: createHomeTab != root.currentIndex // && !createButtonMa.containsMouse
                        PropertyChanges { target: createButton; color: "black"}
                        PropertyChanges { target: createButtonImage; source: "images/create_home.png" }
                    },
                    State {
                        name: "HOVER"
                        //when: ((createButtonMa.containsMouse) && (root.currentIndex !== 3))
                        //PropertyChanges { target: createButton; color: "#282828"}
                    },
                    State {
                        name: "PRESSED"
                        when: createHomeTab == root.currentIndex
                        PropertyChanges { target: createButton; color: "white"}
                        PropertyChanges { target: createButtonImage; source: "images/create_home-black.png" }
                    }
                    ]

                    Image {
                        id: createButtonImage
                        source: "images/create_home.png"
                        anchors.centerIn: parent
                    }
                    MouseArea {
                        id: createButtonMa
                        anchors.fill: parent
                        //hoverEnabled: true
                        onClicked: {
                            root.currentIndex = createHomeTab
                            //root.createHome()
                        }
                    }
                }
            }


        ListModel {
            id: placeListModel

            // FIXME: These places are just mock-ups,
            //	      they should actually be coming from
            //	      the user's subscribed places!	-lynX
            //

            ListElement {
                name: "Clandestine Urban Art"
                image: "images/demo/ubuntu-wallpaper.jpg"
            }
            ListElement {
                name: "GNUnet"
                image: "images/demo/gnunet.png"
            }
            ListElement {
                name: "SecuShare"
                image: "images/demo/secushare.png"
            }
        }

        ListView {
            id: placeList
            //currentIndex: -1

            width: 186
            //Layout.fillWidth: true
            Layout.fillHeight: true
            anchors.right: parent.right

            spacing: 15
            clip: true

            //model: placeListModel
            model: App.models.places
            delegate: placeListDelegate
            focus: true

            onCurrentIndexChanged: {
                selectedPlace = model.get(currentIndex)
                if (selectedPlace)
                {
                    root.currentIndex = profileTab
                }
            }

            Component {
                id: placeListDelegate

                Item {
                    id: placeItem
                    width: profileTab == root.currentIndex && placeItem.ListView.isCurrentItem ? 186 : 170
                    height: 170

                    Rectangle {
                        id: placeItemInside
                        anchors.fill: parent
                        anchors.topMargin: 20
                        opacity: 1.0

                        color: profileTab == root.currentIndex && placeItem.ListView.isCurrentItem ? "white" : "black"

                        Image {
                            id: threadMiniImage
                            source: image ? image : ""
                            fillMode: Image.PreserveAspectCrop
                            height: 60
                            width: 160
                            anchors.left: parent.left
                            anchors.leftMargin: 5
                            anchors.top: parent.top
                            anchors.topMargin: 5
                        }

                        Text {
                            anchors.top: threadMiniImage.bottom
                            id: contactInfo
                            text: name
                            width: 160
                            height: 80
                            anchors.left: parent.left
                            anchors.leftMargin: 5

                            wrapMode : Text.Wrap
                            elide : Text.ElideRight
                            color: profileTab == root.currentIndex && placeItem.ListView.isCurrentItem ? "black" : "white"

                            font.family: ubuntuBIFont.name
                            font.pointSize: 18
                            font.letterSpacing : -2
                        }

                        MouseArea {
                            anchors.fill: parent
                            onClicked: placeList.currentIndex = index
                        }
                    }

                    Rectangle {
                        id: indicator

                        radius: 35
                        color: "#EFC208"
                        anchors.left: placeItemInside.left
                        anchors.leftMargin: 125
                        anchors.top: parent.top
                        anchors.topMargin: 10
                        border.color: "black"
                        border.width: 3
                        height: 35
                        width: 35
                        visible: profileTab == root.currentIndex && placeItem.ListView.isCurrentItem ? false : true

                        Text {
                            anchors.centerIn: parent
                            id: numberNewPlaces
                            text: "12"
                            font.family: ubuntuFont.name
                            font.pointSize: 14
                        }
                    }
                }
            }
        }
    }
}