FreeKill/qml/Pages/LobbyElement/EditProfile.qml

167 lines
3.3 KiB
QML
Raw Normal View History

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Dialogs
2022-03-27 12:00:29 +00:00
Item {
id: root
2022-03-27 12:00:29 +00:00
width: childrenRect.width
height: childrenRect.height
2022-03-27 12:00:29 +00:00
signal finished()
2022-03-27 12:00:29 +00:00
ColumnLayout {
spacing: 20
2022-03-27 12:00:29 +00:00
RowLayout {
anchors.rightMargin: 8
spacing: 16
Text {
text: Backend.translate("Username")
}
Text {
text: Self.screenName
font.pixelSize: 18
}
}
2022-03-27 12:00:29 +00:00
RowLayout {
anchors.rightMargin: 8
spacing: 16
Text {
text: Backend.translate("Avatar")
}
TextField {
id: avatarName
font.pixelSize: 18
text: Self.avatar
}
Button {
text: Backend.translate("Update Avatar")
enabled: avatarName.text !== ""
onClicked: {
mainWindow.busy = true;
ClientInstance.notifyServer(
"UpdateAvatar",
JSON.stringify([avatarName.text])
);
}
}
}
2022-03-27 12:00:29 +00:00
RowLayout {
anchors.rightMargin: 8
spacing: 16
Text {
text: Backend.translate("Old Password")
}
TextField {
id: oldPassword
echoMode: TextInput.Password
passwordCharacter: "*"
}
}
2022-03-27 12:00:29 +00:00
RowLayout {
anchors.rightMargin: 8
spacing: 16
Text {
text: Backend.translate("New Password")
}
TextField {
id: newPassword
echoMode: TextInput.Password
passwordCharacter: "*"
}
Button {
text: Backend.translate("Update Password")
enabled: oldPassword.text !== "" && newPassword.text !== ""
onClicked: {
mainWindow.busy = true;
ClientInstance.notifyServer(
"UpdatePassword",
JSON.stringify([oldPassword.text, newPassword.text])
);
}
}
}
2022-03-27 12:00:29 +00:00
RowLayout {
anchors.rightMargin: 8
spacing: 16
Text {
text: Backend.translate("Lobby BG")
}
TextField {
text: config.lobbyBg
}
Button {
text: "..."
onClicked: {
fdialog.nameFilters = ["Image Files (*.jpg *.png)"];
fdialog.configKey = "lobbyBg";
fdialog.open();
}
}
}
RowLayout {
anchors.rightMargin: 8
spacing: 16
Text {
text: Backend.translate("Room BG")
}
TextField {
text: config.roomBg
}
Button {
text: "..."
onClicked: {
fdialog.nameFilters = ["Image Files (*.jpg *.png)"];
fdialog.configKey = "roomBg";
fdialog.open();
}
}
}
RowLayout {
anchors.rightMargin: 8
spacing: 16
Text {
text: Backend.translate("Game BGM")
}
TextField {
text: config.bgmFile
}
Button {
text: "..."
onClicked: {
fdialog.nameFilters = ["Music Files (*.mp3)"];
fdialog.configKey = "bgmFile";
fdialog.open();
2022-03-27 12:00:29 +00:00
}
}
2022-03-27 12:00:29 +00:00
}
RowLayout {
anchors.rightMargin: 8
spacing: 16
Text {
text: "Language"
}
ComboBox {
model: ["zh_CN", "en_US"]
currentIndex: model.indexOf(config.language)
onCurrentTextChanged: { config.language = currentText; }
}
}
}
FileDialog {
id: fdialog
property string configKey
onAccepted: { config[configKey] = selectedFile; }
}
2022-03-27 12:00:29 +00:00
}