2023-04-09 05:35:35 +00:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2023-01-03 15:37:14 +00:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Controls
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
scale: 2
|
|
|
|
|
|
|
|
// Change this to your server's IP or domain name
|
2023-01-04 02:19:51 +00:00
|
|
|
property string server_addr: ServerAddr
|
2023-01-03 15:37:14 +00:00
|
|
|
|
|
|
|
Frame {
|
|
|
|
id: join_server
|
|
|
|
anchors.centerIn: parent
|
|
|
|
background: Rectangle {
|
|
|
|
color: "#88888888"
|
|
|
|
radius: 2
|
|
|
|
}
|
2023-02-26 08:51:29 +00:00
|
|
|
|
2023-01-03 15:37:14 +00:00
|
|
|
Column {
|
|
|
|
spacing: 8
|
|
|
|
TextField {
|
|
|
|
id: screenNameEdit
|
|
|
|
text: "player"
|
|
|
|
onTextChanged: {
|
|
|
|
passwordEdit.text = "";
|
|
|
|
let data = config.savedPassword[server_addr.editText];
|
|
|
|
if (data) {
|
|
|
|
if (text === data.username) {
|
|
|
|
passwordEdit.text = data.shorten_password;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TextField {
|
|
|
|
id: passwordEdit
|
|
|
|
text: ""
|
|
|
|
echoMode: TextInput.Password
|
|
|
|
passwordCharacter: "*"
|
|
|
|
}
|
|
|
|
Button {
|
|
|
|
text: "Login"
|
|
|
|
enabled: passwordEdit.text !== ""
|
|
|
|
onClicked: {
|
|
|
|
config.serverAddr = server_addr;
|
|
|
|
config.screenName = screenNameEdit.text;
|
|
|
|
config.password = passwordEdit.text;
|
|
|
|
mainWindow.busy = true;
|
|
|
|
Backend.joinServer(server_addr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
config.loadConf();
|
|
|
|
|
|
|
|
let data = config.savedPassword[config.lastLoginServer];
|
|
|
|
screenNameEdit.text = data.username;
|
|
|
|
passwordEdit.text = data.shorten_password;
|
|
|
|
}
|
|
|
|
}
|