2023-04-09 05:35:35 +00:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2023-03-14 06:12:13 +00:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Controls
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
|
|
|
Flickable {
|
|
|
|
id: root
|
|
|
|
flickableDirection: Flickable.AutoFlickIfNeeded
|
|
|
|
clip: true
|
|
|
|
contentHeight: layout.height
|
2023-08-10 19:19:59 +00:00
|
|
|
property bool loading: false
|
2023-03-14 06:12:13 +00:00
|
|
|
ScrollBar.vertical: ScrollBar {
|
|
|
|
parent: root.parent
|
|
|
|
anchors.top: root.top
|
|
|
|
anchors.right: root.right
|
|
|
|
anchors.bottom: root.bottom
|
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
id: layout
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 8
|
|
|
|
|
2023-04-28 11:19:45 +00:00
|
|
|
Switch {
|
2023-08-03 07:24:17 +00:00
|
|
|
text: Backend.translate("Disable Extension")
|
2023-03-14 06:12:13 +00:00
|
|
|
}
|
|
|
|
|
2023-06-16 05:26:02 +00:00
|
|
|
RowLayout {
|
|
|
|
Text {
|
|
|
|
text: Backend.translate("General Packages")
|
|
|
|
font.bold: true
|
|
|
|
}
|
|
|
|
Button {
|
|
|
|
text: Backend.translate("Select All")
|
|
|
|
onClicked: {
|
|
|
|
for (let i = 0; i < gpacks.count; i++) {
|
|
|
|
const item = gpacks.itemAt(i);
|
|
|
|
item.checked = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Button {
|
|
|
|
text: Backend.translate("Revert Selection")
|
|
|
|
onClicked: {
|
|
|
|
for (let i = 0; i < gpacks.count; i++) {
|
|
|
|
const item = gpacks.itemAt(i);
|
|
|
|
item.checked = !item.checked;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-03-14 06:12:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GridLayout {
|
2023-12-06 13:07:35 +00:00
|
|
|
columns: 4
|
2023-03-14 06:12:13 +00:00
|
|
|
|
|
|
|
Repeater {
|
2023-06-16 05:26:02 +00:00
|
|
|
id: gpacks
|
2023-03-14 06:12:13 +00:00
|
|
|
model: ListModel {
|
|
|
|
id: gpacklist
|
|
|
|
}
|
|
|
|
|
|
|
|
CheckBox {
|
|
|
|
text: name
|
|
|
|
checked: pkg_enabled
|
|
|
|
enabled: orig_name !== "test_p_0"
|
|
|
|
|
|
|
|
onCheckedChanged: {
|
2023-08-10 19:19:59 +00:00
|
|
|
if (!loading) {
|
|
|
|
checkPackage(orig_name, checked);
|
|
|
|
}
|
2023-03-14 06:12:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-16 05:26:02 +00:00
|
|
|
RowLayout {
|
|
|
|
Text {
|
|
|
|
text: Backend.translate("Card Packages")
|
|
|
|
font.bold: true
|
|
|
|
}
|
|
|
|
Button {
|
|
|
|
text: Backend.translate("Select All")
|
|
|
|
onClicked: {
|
|
|
|
for (let i = 0; i < cpacks.count; i++) {
|
|
|
|
const item = cpacks.itemAt(i);
|
|
|
|
item.checked = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Button {
|
|
|
|
text: Backend.translate("Revert Selection")
|
|
|
|
onClicked: {
|
|
|
|
for (let i = 0; i < cpacks.count; i++) {
|
|
|
|
const item = cpacks.itemAt(i);
|
|
|
|
item.checked = !item.checked;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-03-14 06:12:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GridLayout {
|
2023-12-06 13:07:35 +00:00
|
|
|
columns: 4
|
2023-03-14 06:12:13 +00:00
|
|
|
|
|
|
|
Repeater {
|
2023-06-16 05:26:02 +00:00
|
|
|
id: cpacks
|
2023-03-14 06:12:13 +00:00
|
|
|
model: ListModel {
|
|
|
|
id: cpacklist
|
|
|
|
}
|
|
|
|
|
|
|
|
CheckBox {
|
|
|
|
text: name
|
|
|
|
checked: pkg_enabled
|
|
|
|
|
|
|
|
onCheckedChanged: {
|
2023-06-16 05:26:02 +00:00
|
|
|
checkPackage(orig_name, checked);
|
2023-03-14 06:12:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-16 05:26:02 +00:00
|
|
|
function checkPackage(orig_name, checked) {
|
|
|
|
const packs = config.disabledPack;
|
|
|
|
if (checked) {
|
|
|
|
const idx = packs.indexOf(orig_name);
|
|
|
|
if (idx !== -1) packs.splice(idx, 1);
|
|
|
|
} else {
|
|
|
|
packs.push(orig_name);
|
|
|
|
}
|
|
|
|
Backend.callLuaFunction("UpdatePackageEnable", [orig_name, checked]);
|
|
|
|
config.disabledPackChanged();
|
|
|
|
}
|
|
|
|
|
2023-03-14 06:12:13 +00:00
|
|
|
Component.onCompleted: {
|
2023-08-10 19:19:59 +00:00
|
|
|
loading = true;
|
2023-06-09 09:23:02 +00:00
|
|
|
const g = JSON.parse(Backend.callLuaFunction("GetAllGeneralPack", []));
|
2023-03-14 06:12:13 +00:00
|
|
|
for (let orig of g) {
|
2023-08-03 07:24:17 +00:00
|
|
|
if (config.serverHiddenPacks.includes(orig)) {
|
|
|
|
continue;
|
|
|
|
}
|
2023-03-14 06:12:13 +00:00
|
|
|
gpacklist.append({
|
|
|
|
name: Backend.translate(orig),
|
|
|
|
orig_name: orig,
|
2023-08-03 07:24:17 +00:00
|
|
|
pkg_enabled: !config.disabledPack.includes(orig),
|
2023-03-14 06:12:13 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-06-09 09:23:02 +00:00
|
|
|
const c = JSON.parse(Backend.callLuaFunction("GetAllCardPack", []));
|
2023-03-14 06:12:13 +00:00
|
|
|
for (let orig of c) {
|
2023-08-03 07:24:17 +00:00
|
|
|
if (config.serverHiddenPacks.includes(orig)) {
|
|
|
|
continue;
|
|
|
|
}
|
2023-03-14 06:12:13 +00:00
|
|
|
cpacklist.append({
|
|
|
|
name: Backend.translate(orig),
|
|
|
|
orig_name: orig,
|
2023-08-03 07:24:17 +00:00
|
|
|
pkg_enabled: !config.disabledPack.includes(orig),
|
2023-03-14 06:12:13 +00:00
|
|
|
});
|
|
|
|
}
|
2023-08-10 19:19:59 +00:00
|
|
|
loading = false;
|
2023-03-14 06:12:13 +00:00
|
|
|
}
|
|
|
|
}
|