ServerSelectionPage.qml 4.36 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import QtQuick 2.8
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3
import QtQml.Models 2.2

import "qrc:/qml/navigation"
import "qrc:/qml/various"
import "qrc:/qml/popups"
import "qrc:/qml/style"

Page {
    DeleteEntry{
        id:deletePopup
    }
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
    header: ToolBar {
         id: topToolbar
         property string color: Colors.primary
         height: 50
         anchors.left: parent.left
         anchors.right: parent.right
         background: Rectangle {
             color: topToolbar.color
             Rectangle {
                 anchors.bottom: parent.bottom
                 anchors.left: parent.left
                 anchors.right: parent.right
                 height: 1
                 color: Colors.separatorGrey
             }
         }
         Row {
             anchors.left: parent.left
             anchors.top: parent.top
             anchors.bottom: parent.bottom
             spacing: 9
             Backbutton {
                 id: backbutton
                 anchors.verticalCenter: parent.verticalCenter
                 onClicked: {
                     mainStack.pop()
                 }
             }

             Text {
                 anchors.top: parent.top
                 anchors.bottom: parent.bottom
                 text: qsTr("Server Choice")
                 font.bold: false
                 font.family: Fonts.opensans.name
                 color: Colors.white

                 verticalAlignment: Text.AlignVCenter
             }
         }
     }
56
57
58
59
60
61
62
63
64
65

    ListView {
        anchors.bottom: addServerButton.top
        anchors.bottomMargin: 25
        anchors.top:parent.top
        anchors.left: parent.left
        anchors.right: parent.right
        spacing: 1
        clip:true
        id: serverListView
Dennis Beier's avatar
Dennis Beier committed
66
        model:serverChoices
67

Dennis Beier's avatar
Dennis Beier committed
68
        delegate: Button {
69
70
71
72
            //color: Colors.grey
            height: 58
            anchors.left: parent.left
            anchors.right: parent.right
Dennis Beier's avatar
Dennis Beier committed
73
            onClicked:{
74
75
               serverChoices.currentServer     = model.domain;
               serverChoices.currentServerDesc = model.description;
Dennis Beier's avatar
Dennis Beier committed
76
               mainStack.pop();
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100

            }

            Rectangle {
                color: Colors.grey
                anchors.left: parent.left
                anchors.right: parent.right
                anchors.top: parent.top
                anchors.bottom: parent.bottom
                anchors.bottomMargin: 1
                Row {
                    leftPadding: 26
                    anchors.left:parent.left
                    anchors.right: parent.right
                    anchors.verticalCenter: parent.verticalCenter
                    spacing: 14

                    Column {
                        leftPadding: 15
                        spacing: 2
                        anchors.verticalCenter: parent.verticalCenter

                        Text {
                            id: serverName
101
                            text: model.description
102
103
104
105
106
107
108
109
110
                            font.bold: true
                            textFormat: Text.PlainText
                            font.family: Fonts.opensans.name
                            font.pointSize: Fonts.largeFontSize
                            smooth: true
                            color: "black"
                        }
                    }
                }
Dennis Beier's avatar
Dennis Beier committed
111
112
113
114
115
116
117
118
                Button{
                    text:qsTr("delete")
                    onClicked: {
                        serverChoices.removeDomain(model.domain);
                    }
                    anchors.right: parent.right
                    flat: true
                    anchors.verticalCenter: parent.verticalCenter
119
                    visible: !(model.domain === "fairchat.net")
Dennis Beier's avatar
Dennis Beier committed
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
            }
            Rectangle {
                anchors.bottom: parent.bottom
                id: bottomLine
                anchors.left: parent.left
                anchors.right: parent.right
                height: 1
                //color: "#dfdfdf"
                color: Colors.separatorGrey
            }
        }
    }
    StdButton{
        anchors.bottom: parent.bottom
        anchors.left: parent.left
        anchors.right: parent.right
        anchors.leftMargin: 30
        anchors.rightMargin: 30
        anchors.bottomMargin: 25
        text:qsTr("add server")
        id: addServerButton
        onPressed: {
            addServerEntry.open()
        }
    }
}