2023-04-09 05:35:35 +00:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2023-03-18 18:21:45 +00:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Controls
|
|
|
|
import QtQuick.Layouts
|
2023-05-19 02:08:36 +00:00
|
|
|
import Fk.RoomElement
|
2023-03-18 18:21:45 +00:00
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
anchors.fill: parent
|
|
|
|
property var extra_data: ({})
|
|
|
|
|
|
|
|
signal finish()
|
|
|
|
|
|
|
|
Flickable {
|
|
|
|
height: parent.height
|
|
|
|
width: generalButtons.width
|
|
|
|
anchors.centerIn: parent
|
|
|
|
contentHeight: generalButtons.height
|
|
|
|
ScrollBar.vertical: ScrollBar {}
|
|
|
|
ColumnLayout {
|
|
|
|
id: generalButtons
|
|
|
|
Repeater {
|
|
|
|
model: ListModel {
|
|
|
|
id: glist
|
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
2023-12-12 11:22:18 +00:00
|
|
|
Text {
|
|
|
|
color: "#E4D5A0"
|
2024-01-24 19:23:29 +00:00
|
|
|
text: luatr(gname)
|
2023-12-12 11:22:18 +00:00
|
|
|
}
|
2023-03-18 18:21:45 +00:00
|
|
|
GridLayout {
|
2023-12-06 13:07:35 +00:00
|
|
|
columns: 6
|
2023-03-18 18:21:45 +00:00
|
|
|
|
|
|
|
Repeater {
|
2024-01-24 19:23:29 +00:00
|
|
|
model: lcall("GetSameGenerals", gname)
|
2023-03-18 18:21:45 +00:00
|
|
|
|
|
|
|
GeneralCardItem {
|
|
|
|
name: modelData
|
|
|
|
selectable: true
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
let idx = 0;
|
|
|
|
for (; idx < extra_data.cards.count; idx++) {
|
|
|
|
if (extra_data.cards.get(idx).name === gname)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (idx < extra_data.cards.count) {
|
|
|
|
extra_data.cards.set(idx, { name: modelData });
|
|
|
|
}
|
2024-06-10 06:58:48 +00:00
|
|
|
|
|
|
|
idx = 0;
|
|
|
|
extra_data.choices.forEach( s => {
|
|
|
|
if (s === gname) {
|
|
|
|
extra_data.choices[idx] = modelData;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
idx++;
|
|
|
|
});
|
|
|
|
|
2023-03-18 18:21:45 +00:00
|
|
|
root.finish();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onExtra_dataChanged: {
|
|
|
|
if (!extra_data.cards) return;
|
|
|
|
for (let i = 0; i < extra_data.cards.count; i++) {
|
|
|
|
glist.set(i, { gname: extra_data.cards.get(i).name });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|