AddServerEntry.qml 3.09 KB
Newer Older
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
import QtQuick 2.8
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3
import QtQuick.Window 2.2

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

Popup {
    id: serverSelectionPopup
    closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
    width: 600
    height: 200
    x: Screen.width/2 - serverSelectionPopup.width/2
    y: Screen.height/2 - serverSelectionPopup.height/2

    Column{
        anchors.horizontalCenter: parent.horizontalCenter
        width: 500
        TextField {
            anchors.left: parent.left
            anchors.right: parent.right
            id: serverName
            color: Colors.fontColor
            font.pointSize: Fonts.largeFontSize
            leftPadding: 5
            rightPadding: 5
            bottomPadding: 5
            horizontalAlignment: TextField.AlignLeft
            verticalAlignment:  TextField.AlignBottom
            selectByMouse: true
            text: ""
            inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhNoPredictiveText|
                              Qt.ImhPreferLowercase
            focus: true
            placeholderText: qsTr("server name")
            background: Rectangle {
                implicitWidth: parent.width
                implicitHeight: 30
                color: "transparent"
                Rectangle {
                    height: 1
                    width: parent.width
                    color: Colors.white
                    anchors.bottom: parent.bottom
                }
            }
        }
        TextField {
            anchors.left: parent.left
            anchors.right: parent.right
            id: serverAddress
            color: Colors.fontColor
            font.pointSize: Fonts.largeFontSize
            leftPadding: 5
            rightPadding: 5
            bottomPadding: 5
            horizontalAlignment: TextField.AlignLeft
            verticalAlignment:  TextField.AlignBottom
            selectByMouse: true
            text: ""
            inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhNoPredictiveText|
                              Qt.ImhPreferLowercase
            focus: true
            placeholderText: qsTr("server address")
            background: Rectangle {
                implicitWidth: parent.width
                implicitHeight: 30
                color: "transparent"
                Rectangle {
                    height: 1
                    width: parent.width
                    color: Colors.white
                    anchors.bottom: parent.bottom
                }
            }
        }
        Row{
            anchors.horizontalCenter: parent.horizontalCenter
            StdButton{
                text: qsTr("add")
                onPressed: {
                    serverSelector.addServer(serverName.text,serverAddress.text)
                    serverSelectionPopup.close()
                }
            }
            StdButton{
                text: qsTr("cancel")
                onPressed: {
                    serverSelectionPopup.close()
                }
            }
        }
    }
    onOpened: {
        serverName.clear()
        serverAddress.clear()
    }
}