2022-09-14 05:01:10 +00:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Layouts
|
|
|
|
import QtQuick.Controls
|
2022-04-15 10:37:20 +00:00
|
|
|
import "RoomElement"
|
|
|
|
|
|
|
|
Item {
|
2022-04-30 07:27:56 +00:00
|
|
|
id: root
|
2022-04-15 10:37:20 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
property bool loaded: false
|
2022-04-15 10:37:20 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
ListView {
|
|
|
|
width: Math.floor(root.width / 98) * 98
|
|
|
|
height: parent.height
|
|
|
|
anchors.centerIn: parent
|
|
|
|
ScrollBar.vertical: ScrollBar {}
|
|
|
|
model: ListModel {
|
|
|
|
id: packages
|
|
|
|
}
|
2022-04-15 10:37:20 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
delegate: ColumnLayout {
|
|
|
|
Text { text: Backend.translate(name) }
|
|
|
|
GridLayout {
|
|
|
|
columns: root.width / 98
|
|
|
|
Repeater {
|
|
|
|
model: JSON.parse(Backend.callLuaFunction("GetCards", [name]))
|
|
|
|
CardItem {
|
|
|
|
autoBack: false
|
|
|
|
Component.onCompleted: {
|
|
|
|
let data = JSON.parse(Backend.callLuaFunction("GetCardData", [modelData]));
|
|
|
|
setData(data);
|
2022-04-15 10:37:20 +00:00
|
|
|
}
|
2022-04-30 07:27:56 +00:00
|
|
|
}
|
2022-04-15 10:37:20 +00:00
|
|
|
}
|
2022-04-30 07:27:56 +00:00
|
|
|
}
|
2022-04-15 10:37:20 +00:00
|
|
|
}
|
2022-04-30 07:27:56 +00:00
|
|
|
}
|
2022-04-15 10:37:20 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
Button {
|
2022-05-01 10:37:13 +00:00
|
|
|
text: Backend.translate("Quit")
|
2022-04-30 07:27:56 +00:00
|
|
|
anchors.right: parent.right
|
|
|
|
onClicked: {
|
|
|
|
mainStack.pop();
|
2022-04-15 10:37:20 +00:00
|
|
|
}
|
2022-04-30 07:27:56 +00:00
|
|
|
}
|
2022-04-15 10:37:20 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
function loadPackages() {
|
|
|
|
if (loaded) return;
|
|
|
|
let packs = JSON.parse(Backend.callLuaFunction("GetAllCardPack", []));
|
|
|
|
packs.forEach((name) => packages.append({ name: name }));
|
|
|
|
loaded = true;
|
|
|
|
}
|
2022-04-15 10:37:20 +00:00
|
|
|
}
|