-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConnectServerPage.qml
More file actions
56 lines (54 loc) · 1.58 KB
/
ConnectServerPage.qml
File metadata and controls
56 lines (54 loc) · 1.58 KB
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
import QtCore
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import net.blumia.pineapple.comic.reader
Control {
anchors.fill: parent
padding: 5
contentItem: ColumnLayout {
Label {
text: "Pineapple Comic Reader"
font.pixelSize: 20
}
Item {
Layout.fillHeight: true
Layout.verticalStretchFactor: 2
}
Label {
text: "YACReader Library Server URL:"
}
TextField {
id: baseUrlEdit
Layout.fillWidth: true
placeholderText: "e.g. http://192.168.123.123:8080"
inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhUrlCharactersOnly
enabled: AppController.connectionState === AppController.NotConnected
}
Label {
text: AppController.lastErrorMessage
}
Button {
Layout.fillWidth: true
text: AppController.connectionState === AppController.NotConnected ? "Connect" : "Connecting"
enabled: baseUrlEdit.enabled
onClicked: function() {
settings.setValue("server_url", baseUrlEdit.text)
AppController.connectServer(baseUrlEdit.text)
}
}
Item {
Layout.fillHeight: true
Layout.verticalStretchFactor: 3
}
}
Settings {
id: settings
Component.onCompleted: function() {
let srvUrl = settings.value("server_url", "")
if (srvUrl !== "") {
baseUrlEdit.text = srvUrl
}
}
}
}