2023-04-09 05:35:35 +00:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2022-09-14 05:01:10 +00:00
|
|
|
import QtQuick
|
2023-03-20 06:53:56 +00:00
|
|
|
import QtQuick.Layouts
|
2022-09-14 05:01:10 +00:00
|
|
|
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
|
|
|
|
2023-03-20 06:53:56 +00:00
|
|
|
Item {
|
|
|
|
width: 960 * 0.8
|
|
|
|
height: 540 * 0.8
|
2022-04-30 07:27:56 +00:00
|
|
|
anchors.centerIn: parent
|
2023-03-20 06:53:56 +00:00
|
|
|
|
|
|
|
Item {
|
|
|
|
id: left
|
|
|
|
width: 300
|
|
|
|
height: parent.height
|
|
|
|
|
|
|
|
Image {
|
|
|
|
id: lady
|
|
|
|
width: parent.width + 20
|
|
|
|
height: parent.height
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
}
|
|
|
|
|
|
|
|
Image {
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.bottomMargin: 12
|
|
|
|
width: parent.width
|
|
|
|
source: AppPath + "/image/widelogo"
|
|
|
|
}
|
2022-05-01 10:37:13 +00:00
|
|
|
}
|
2023-02-26 08:51:29 +00:00
|
|
|
|
2023-03-20 06:53:56 +00:00
|
|
|
Rectangle {
|
|
|
|
id: right
|
|
|
|
anchors.left: left.right
|
|
|
|
width: parent.width - left.width
|
|
|
|
height: parent.height
|
|
|
|
color: "#88EEEEEE"
|
|
|
|
radius: 16
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
width: parent.width * 0.8
|
|
|
|
height: parent.height * 0.8
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 40
|
|
|
|
//spacing
|
|
|
|
|
|
|
|
Text {
|
|
|
|
text: qsTr("Welcome back!")
|
|
|
|
font.pixelSize: 28
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
}
|
|
|
|
|
|
|
|
GridLayout {
|
|
|
|
columns: 2
|
|
|
|
rowSpacing: 20
|
|
|
|
|
|
|
|
Text {
|
|
|
|
text: qsTr("Server Addr")
|
|
|
|
}
|
|
|
|
ComboBox {
|
|
|
|
id: server_addr
|
|
|
|
Layout.fillWidth: true
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Text {
|
|
|
|
text: qsTr("Username")
|
|
|
|
}
|
|
|
|
TextField {
|
|
|
|
id: screenNameEdit
|
2023-04-30 10:51:05 +00:00
|
|
|
maximumLength: 32
|
2023-03-20 06:53:56 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
placeholderText: qsTr("Username")
|
|
|
|
text: ""
|
|
|
|
onTextChanged: {
|
|
|
|
passwordEdit.text = "";
|
|
|
|
let data = config.savedPassword[server_addr.editText];
|
|
|
|
if (data) {
|
|
|
|
if (text === data.username) {
|
|
|
|
passwordEdit.text = data.shorten_password;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CheckBox {
|
|
|
|
id: showPasswordCheck
|
|
|
|
text: qsTr("Show Password")
|
|
|
|
}
|
|
|
|
TextField {
|
|
|
|
id: passwordEdit
|
2023-04-30 10:51:05 +00:00
|
|
|
maximumLength: 64
|
2023-03-20 06:53:56 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
placeholderText: qsTr("Password")
|
|
|
|
text: ""
|
|
|
|
echoMode: showPasswordCheck.checked ? TextInput.Normal : TextInput.Password
|
|
|
|
passwordCharacter: "*"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
|
|
|
text: qsTr("Join Server")
|
|
|
|
Layout.fillWidth: true
|
2023-03-20 07:25:23 +00:00
|
|
|
display: AbstractButton.TextBesideIcon
|
|
|
|
icon.name: "go-next"
|
2023-03-20 06:53:56 +00:00
|
|
|
enabled: passwordEdit.text !== ""
|
|
|
|
onClicked: {
|
|
|
|
config.serverAddr = server_addr.editText;
|
|
|
|
config.screenName = screenNameEdit.text;
|
|
|
|
config.password = passwordEdit.text;
|
|
|
|
mainWindow.busy = true;
|
|
|
|
Backend.joinServer(server_addr.editText);
|
2022-12-18 04:52:52 +00:00
|
|
|
}
|
|
|
|
}
|
2023-03-20 06:53:56 +00:00
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
Button {
|
|
|
|
Layout.preferredWidth: 180
|
|
|
|
text: qsTr("Console start")
|
|
|
|
enabled: passwordEdit.text !== ""
|
|
|
|
onClicked: {
|
|
|
|
config.serverAddr = "127.0.0.1";
|
|
|
|
config.screenName = screenNameEdit.text;
|
|
|
|
config.password = passwordEdit.text;
|
|
|
|
mainWindow.busy = true;
|
|
|
|
Backend.startServer(9527);
|
|
|
|
Backend.joinServer("127.0.0.1");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
text: qsTr("PackageManage")
|
|
|
|
onClicked: {
|
|
|
|
mainStack.push(packageManage);
|
2022-12-18 04:52:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-04-30 07:27:56 +00:00
|
|
|
}
|
2023-03-20 06:53:56 +00:00
|
|
|
|
|
|
|
Text {
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.leftMargin: 12
|
|
|
|
anchors.bottomMargin: 12
|
|
|
|
text: "FreeKill " + FkVersion
|
|
|
|
font.pixelSize: 16
|
|
|
|
font.bold: true
|
2022-04-30 07:27:56 +00:00
|
|
|
}
|
2023-03-20 06:53:56 +00:00
|
|
|
|
|
|
|
Text {
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.rightMargin: 8
|
|
|
|
anchors.bottomMargin: 8
|
|
|
|
text: qsTr("FAQ")
|
|
|
|
color: "blue"
|
|
|
|
font.pixelSize: 24
|
|
|
|
font.underline: true
|
|
|
|
|
|
|
|
TapHandler {
|
|
|
|
onTapped: {
|
|
|
|
errDialog.txt = qsTr("$LoginFAQ");
|
|
|
|
errDialog.open();
|
|
|
|
}
|
2022-04-30 07:27:56 +00:00
|
|
|
}
|
|
|
|
}
|
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-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();
|
2023-03-20 06:53:56 +00:00
|
|
|
|
|
|
|
lady.source = config.ladyImg;
|
|
|
|
|
2022-12-18 04:52:52 +00:00
|
|
|
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];
|
2023-03-20 06:53:56 +00:00
|
|
|
if (data) {
|
|
|
|
screenNameEdit.text = data.username;
|
|
|
|
passwordEdit.text = data.shorten_password;
|
|
|
|
}
|
2022-12-18 04:52:52 +00:00
|
|
|
}
|
2022-01-24 02:23:08 +00:00
|
|
|
}
|