2022-09-14 05:01:10 +00:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Controls
|
2022-01-24 02:23:08 +00:00
|
|
|
|
|
|
|
Item {
|
2022-04-30 07:27:56 +00:00
|
|
|
id: root
|
2022-01-24 02:23:08 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
Frame {
|
|
|
|
id: join_server
|
|
|
|
anchors.centerIn: parent
|
2023-02-15 11:54:35 +00:00
|
|
|
scale: 1.5
|
2022-05-01 10:37:13 +00:00
|
|
|
background: Rectangle {
|
|
|
|
color: "#88888888"
|
|
|
|
radius: 2
|
|
|
|
}
|
2023-02-26 08:51:29 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
Column {
|
|
|
|
spacing: 8
|
2022-12-18 04:52:52 +00:00
|
|
|
ComboBox {
|
2022-04-30 07:27:56 +00:00
|
|
|
id: server_addr
|
2022-12-18 04:52:52 +00:00
|
|
|
model: []
|
|
|
|
editable: true
|
|
|
|
|
|
|
|
onEditTextChanged: {
|
|
|
|
if (model.indexOf(editText) === -1) {
|
|
|
|
passwordEdit.text = "";
|
|
|
|
} else {
|
|
|
|
let data = config.savedPassword[editText];
|
|
|
|
screenNameEdit.text = data.username;
|
|
|
|
passwordEdit.text = data.shorten_password;
|
|
|
|
}
|
|
|
|
}
|
2022-04-30 07:27:56 +00:00
|
|
|
}
|
|
|
|
TextField {
|
|
|
|
id: screenNameEdit
|
2023-01-29 10:11:41 +00:00
|
|
|
placeholderText: qsTr("Username")
|
|
|
|
text: ""
|
2022-12-18 04:52:52 +00:00
|
|
|
onTextChanged: {
|
|
|
|
passwordEdit.text = "";
|
|
|
|
let data = config.savedPassword[server_addr.editText];
|
|
|
|
if (data) {
|
|
|
|
if (text === data.username) {
|
|
|
|
passwordEdit.text = data.shorten_password;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-04-30 07:27:56 +00:00
|
|
|
}
|
|
|
|
/*TextField {
|
|
|
|
id: avatarEdit
|
|
|
|
text: "liubei"
|
|
|
|
}*/
|
|
|
|
TextField {
|
|
|
|
id: passwordEdit
|
2023-01-29 10:11:41 +00:00
|
|
|
placeholderText: qsTr("Password")
|
2022-04-30 07:27:56 +00:00
|
|
|
text: ""
|
|
|
|
echoMode: TextInput.Password
|
|
|
|
passwordCharacter: "*"
|
|
|
|
}
|
|
|
|
Button {
|
2023-01-29 10:11:41 +00:00
|
|
|
text: qsTr("Join Server")
|
2022-12-18 04:52:52 +00:00
|
|
|
enabled: passwordEdit.text !== ""
|
2022-04-30 07:27:56 +00:00
|
|
|
onClicked: {
|
2022-12-18 04:52:52 +00:00
|
|
|
config.serverAddr = server_addr.editText;
|
2022-04-30 07:27:56 +00:00
|
|
|
config.screenName = screenNameEdit.text;
|
|
|
|
config.password = passwordEdit.text;
|
|
|
|
mainWindow.busy = true;
|
2022-12-18 04:52:52 +00:00
|
|
|
Backend.joinServer(server_addr.editText);
|
2022-01-24 02:23:08 +00:00
|
|
|
}
|
2022-04-30 07:27:56 +00:00
|
|
|
}
|
|
|
|
Button {
|
2023-01-29 10:11:41 +00:00
|
|
|
text: qsTr("Console start")
|
2022-12-18 04:52:52 +00:00
|
|
|
enabled: passwordEdit.text !== ""
|
2022-04-30 07:27:56 +00:00
|
|
|
onClicked: {
|
2022-12-18 04:52:52 +00:00
|
|
|
config.serverAddr = "127.0.0.1";
|
2022-04-30 07:27:56 +00:00
|
|
|
config.screenName = screenNameEdit.text;
|
|
|
|
config.password = passwordEdit.text;
|
|
|
|
mainWindow.busy = true;
|
|
|
|
Backend.startServer(9527);
|
|
|
|
Backend.joinServer("127.0.0.1");
|
|
|
|
}
|
|
|
|
}
|
2022-01-24 02:23:08 +00:00
|
|
|
}
|
2022-04-30 07:27:56 +00:00
|
|
|
}
|
2022-12-18 04:52:52 +00:00
|
|
|
|
2023-02-15 11:54:35 +00:00
|
|
|
Button {
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
text: qsTr("PackageManage")
|
|
|
|
onClicked: {
|
|
|
|
mainStack.push(packageManage);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-21 05:44:24 +00:00
|
|
|
function downloadComplete() {
|
|
|
|
toast.show(qsTr("updated packages for md5"));
|
|
|
|
}
|
|
|
|
|
2022-12-18 04:52:52 +00:00
|
|
|
Component.onCompleted: {
|
|
|
|
config.loadConf();
|
|
|
|
server_addr.model = Object.keys(config.savedPassword);
|
|
|
|
server_addr.onModelChanged();
|
|
|
|
server_addr.currentIndex = server_addr.model.indexOf(config.lastLoginServer);
|
|
|
|
|
|
|
|
let data = config.savedPassword[config.lastLoginServer];
|
|
|
|
screenNameEdit.text = data.username;
|
|
|
|
passwordEdit.text = data.shorten_password;
|
|
|
|
}
|
2022-01-24 02:23:08 +00:00
|
|
|
}
|