2023-04-09 13:35:35 +08:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2023-03-20 14:53:56 +08:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Layouts
|
|
|
|
import QtQuick.Controls
|
|
|
|
|
|
|
|
Item {
|
|
|
|
RowLayout {
|
|
|
|
anchors.fill: parent
|
|
|
|
spacing: 10
|
|
|
|
|
|
|
|
ListView {
|
|
|
|
id: listView
|
2023-06-16 23:53:44 +08:00
|
|
|
clip: true
|
2023-03-20 14:53:56 +08:00
|
|
|
width: parent.width * 0.2
|
|
|
|
height: parent.height
|
|
|
|
model: ListModel {
|
|
|
|
id: modeList
|
|
|
|
}
|
|
|
|
highlight: Rectangle { color: "lightsteelblue"; radius: 5 }
|
|
|
|
delegate: Item {
|
|
|
|
width: parent.width
|
|
|
|
height: 40
|
|
|
|
|
|
|
|
Text {
|
|
|
|
text: name
|
|
|
|
anchors.centerIn: parent
|
|
|
|
}
|
|
|
|
|
|
|
|
TapHandler {
|
|
|
|
onTapped: {
|
|
|
|
listView.currentIndex = index;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
color: "#88EEEEEE"
|
|
|
|
Flickable {
|
|
|
|
width: parent.width - 16
|
|
|
|
height: parent.height - 16
|
|
|
|
anchors.centerIn: parent
|
|
|
|
contentHeight: modeDesc.height
|
|
|
|
ScrollBar.vertical: ScrollBar {}
|
|
|
|
clip: true
|
|
|
|
|
|
|
|
Text {
|
|
|
|
id: modeDesc
|
|
|
|
width: parent.width - 16
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
text: Backend.translate(":" + modeList.get(listView.currentIndex).orig_name)
|
|
|
|
textFormat: Text.MarkdownText
|
|
|
|
font.pixelSize: 16
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
2023-09-30 11:51:17 +08:00
|
|
|
text: Backend.translate("Quit")
|
2023-03-20 14:53:56 +08:00
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
onClicked: {
|
|
|
|
mainStack.pop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
2023-06-09 17:23:02 +08:00
|
|
|
const mode_data = JSON.parse(Backend.callLuaFunction("GetGameModes", []));
|
2023-03-20 14:53:56 +08:00
|
|
|
for (let d of mode_data) {
|
|
|
|
modeList.append(d);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|