feat(misc): a bunch of crude UI/UX tweaks
- display add time for later use - basic keyboard navigation support - remember last-used server address - show connection error when attempt to connect to server
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import QtCore
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
@@ -21,17 +22,19 @@ Control {
|
||||
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
|
||||
}
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
Layout.verticalStretchFactor: 1
|
||||
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)
|
||||
}
|
||||
}
|
||||
@@ -40,4 +43,14 @@ Control {
|
||||
Layout.verticalStretchFactor: 3
|
||||
}
|
||||
}
|
||||
|
||||
Settings {
|
||||
id: settings
|
||||
Component.onCompleted: function() {
|
||||
let srvUrl = settings.value("server_url", "")
|
||||
if (srvUrl !== "") {
|
||||
baseUrlEdit.text = srvUrl
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user