aboutsummaryrefslogtreecommitdiff
path: root/src/scenes/add_server_wizard/Scene_step_1.qml
blob: a80e4f4641c4ef7e72ec0b688e0246e3ca239853 (plain)
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
import QtQuick 2.9
import QtQuick.Window 2.2
import QtQuick.Extras 1.4
import QtQuick.Controls 2.2
import QtQuick.Controls.Material 2.3

/*!
  This .qml file is a Scene which can be loaded through for example a StackView (main_content in main.qml).
  */

Item {
    id: scene_server_wizard_step_1
    objectName: "Scene_step_1"

    Connections {
        target: add_server_wizard
        onStep1Success: {
            // Go onto the first page of the stack.
            main_content_pop(null)
            mainqmladaptor.showToast(qsTr("Successfully added remote web app host."), 5000);
        }
    }

    Connections {
        target: add_server_wizard
        onStep1Failed: {
            mainqmladaptor.showToast(reason, 3000);
        }
    }

    Rectangle {
        id: rectangle
        anchors.fill: parent
        color: Material.background

        Button {
            id: next_step1_button
            text: qsTr("Next Step")
            anchors.bottom: parent.bottom
            anchors.bottomMargin: 15
            anchors.right: parent.right
            anchors.rightMargin: 15

            onClicked: {
                add_server_wizard.processStep1(host_url.text)
            }
        }

        Text {
            color: Material.foreground
            id: step_indicator

            text: qsTr("Step 1")
            anchors.leftMargin: 15
            anchors.top: parent.top
            anchors.topMargin: 15
            font.pointSize: 21
            wrapMode: Text.WordWrap

            font.bold: true
            horizontalAlignment: Text.AlignHCenter
            anchors.left: parent.left
            anchors.margins: 5
        }

        Text {
            color: Material.foreground
            id: explaining_text

            text: qsTr("Please input the address for the "+
                       "remote web app server which you want "+
                       "to connect to.\nIf you don't know "+
                       "what this means, ask your local "+
                       "administrator about it please.\nBefore you can "+
                       "start any remote sessions you will have to "+
                       "be approved for remote support.")
            font.pointSize: 13
            anchors.right: parent.right
            anchors.rightMargin: 15
            anchors.leftMargin: 15
            anchors.top: step_indicator.bottom
            anchors.topMargin: 30
            wrapMode: Text.WordWrap

            anchors.left: parent.left
            anchors.margins: 5
        }

        TextField {
            id: host_url
            selectByMouse: true
            placeholderText: qsTr("http://example.com:8000")

            font.pixelSize: 16
            color: Material.foreground
            anchors.topMargin: 30

            padding: 15
            topPadding: 15

            anchors.top: explaining_text.bottom
            anchors.left: parent.left
            anchors.leftMargin: 15
            anchors.right: parent.right
            anchors.margins: 30

            MouseArea {
                anchors.fill: parent
                hoverEnabled: true
                onHoveredChanged: {
                    if (containsMouse) {
                        host_url_background.state = "hovered"
                    } else if (!host_url.focus) {
                        host_url_background.state = "unhovered"
                    }
                }
                onClicked: {
                    host_url.forceActiveFocus();
                }
            }

            onFocusChanged: {
                host_url_background.state = host_url.focus ? "hovered" : "unhovered"
            }

            background: Rectangle {
                id: host_url_background
                color: Material.background
                border.color: Material.foreground
                border.width: 1
                radius: 4

                states: [
                    State {
                        name: "hovered"
                        PropertyChanges {
                            target: host_url_background
                            border.color: "#0178EF"
                        }
                    },
                    State {
                        name: "unhovered"
                        PropertyChanges {
                            target: host_url_background
                            border.color: Material.foreground
                        }
                    }
                ]
                transitions: [
                    Transition {
                        from: "*"
                        to: "*"
                        PropertyAnimation {
                            property: "border.color"
                            duration: 100
                            easing.type: Easing.Linear
                        }
                    }
                ]

                Text {
                    color: Material.foreground
                    text: qsTr("RWA-server address")
                    anchors.left: parent.left
                    anchors.leftMargin: 15
                    anchors.verticalCenterOffset: - host_url.height / 2
                    anchors.verticalCenter: parent.verticalCenter
                    leftPadding: 5

                    Rectangle {
                        color: Material.background
                        width: parent.width + 5 + 3
                        height: parent.height
                        z: -1
                    }
                }
            }
        }
    }
}

/*##^## Designer {
    D{i:0;autoSize:true;height:480;width:640}D{i:4;anchors_width:351;anchors_x:279}
}
 ##^##*/