pineapple-comic-reader/ConnectServerPage.qml

57 lines
1.6 KiB
QML
Raw Normal View History

import QtCore
2024-11-09 15:05:14 +08:00
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
2024-11-09 15:05:14 +08:00
enabled: AppController.connectionState === AppController.NotConnected
}
Label {
text: AppController.lastErrorMessage
2024-11-09 15:05:14 +08:00
}
Button {
Layout.fillWidth: true
text: AppController.connectionState === AppController.NotConnected ? "Connect" : "Connecting"
enabled: baseUrlEdit.enabled
onClicked: function() {
settings.setValue("server_url", baseUrlEdit.text)
2024-11-09 15:05:14 +08:00
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
}
}
}
2024-11-09 15:05:14 +08:00
}