mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 11:42:45 +08:00
9519d1b9a7
- 扣上限心碎 - 进服维护的各种跟后端稳定性有关的代码 - 断线重连/旁观时候计入技能次数 - ban人和banip,相应的也有解禁 - 开房设置现在可以滑动 - 完善网络错误报错 - 现在开始游戏之前需要等待和所有人准备 - 指示掉线之人和走小道之人 - 掉线和走小道的人不再被AI接管 - 延时锦囊牌素材从拓展包找 - 拓展包管理界面UI优化,下载失败的包可以在管理拓展包中删除
194 lines
4.4 KiB
QML
194 lines
4.4 KiB
QML
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Layouts
|
|
|
|
Item {
|
|
id: root
|
|
|
|
ToolBar {
|
|
id: bar
|
|
width: parent.width
|
|
RowLayout {
|
|
anchors.fill: parent
|
|
ToolButton {
|
|
icon.source: AppPath + "/image/modmaker/back"
|
|
onClicked: mainStack.pop();
|
|
}
|
|
Label {
|
|
text: qsTr("Package Manager")
|
|
horizontalAlignment: Qt.AlignHCenter
|
|
Layout.fillWidth: true
|
|
}
|
|
ToolButton {
|
|
icon.source: AppPath + "/image/modmaker/menu"
|
|
onClicked: menu.open()
|
|
|
|
Menu {
|
|
id: menu
|
|
y: bar.height
|
|
|
|
MenuItem {
|
|
text: qsTr("Enable All")
|
|
onTriggered: {
|
|
for (let i = 0; i < packageModel.count; i++) {
|
|
let name = packageModel.get(i).pkgName;
|
|
Pacman.enablePack(name);
|
|
}
|
|
updatePackageList();
|
|
}
|
|
}
|
|
MenuItem {
|
|
text: qsTr("Disable All")
|
|
onTriggered: {
|
|
for (let i = 0; i < packageModel.count; i++) {
|
|
let name = packageModel.get(i).pkgName;
|
|
Pacman.disablePack(name);
|
|
}
|
|
updatePackageList();
|
|
}
|
|
}
|
|
MenuItem {
|
|
text: qsTr("Upgrade All")
|
|
onTriggered: {
|
|
for (let i = 0; i < packageModel.count; i++) {
|
|
let name = packageModel.get(i).pkgName;
|
|
Pacman.upgradePack(name);
|
|
}
|
|
updatePackageList();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Rectangle {
|
|
width: parent.width
|
|
height: parent.height - bar.height - urlInstaller.height
|
|
anchors.top: bar.bottom
|
|
color: "snow"
|
|
opacity: 0.75
|
|
clip: true
|
|
|
|
ListView {
|
|
id: packageList
|
|
anchors.fill: parent
|
|
model: ListModel {
|
|
id: packageModel
|
|
}
|
|
delegate: ItemDelegate {
|
|
width: root.width
|
|
height: 64
|
|
|
|
ColumnLayout {
|
|
anchors.fill: parent
|
|
anchors.margins: 8
|
|
Text {
|
|
text: "<b>" + pkgName + "</b> (" + pkgVersion + ")"
|
|
font.pixelSize: 18
|
|
textFormat: Text.RichText
|
|
color: pkgEnabled === "1" ? "black" : "grey"
|
|
}
|
|
Text {
|
|
text: pkgURL
|
|
color: pkgEnabled === "1" ? "black" : "grey"
|
|
}
|
|
}
|
|
|
|
Button {
|
|
id: enableBtn
|
|
text: pkgEnabled === "0" ? qsTr("Enable") : qsTr("Disable")
|
|
anchors.right: upgradeBtn.left
|
|
anchors.rightMargin: 8
|
|
onClicked: {
|
|
if (pkgEnabled === "0") {
|
|
Pacman.enablePack(pkgName);
|
|
} else {
|
|
Pacman.disablePack(pkgName);
|
|
}
|
|
updatePackageList();
|
|
}
|
|
}
|
|
|
|
Button {
|
|
id: upgradeBtn
|
|
text: qsTr("Upgrade")
|
|
anchors.right: delBtn.left
|
|
anchors.rightMargin: 8
|
|
onClicked: {
|
|
Pacman.upgradePack(pkgName);
|
|
updatePackageList();
|
|
}
|
|
}
|
|
|
|
Button {
|
|
id: delBtn
|
|
text: qsTr("Remove")
|
|
anchors.right: parent.right
|
|
anchors.rightMargin: 8
|
|
onClicked: {
|
|
Pacman.removePack(pkgName);
|
|
updatePackageList();
|
|
}
|
|
}
|
|
|
|
onClicked: {
|
|
Backend.copyToClipboard(pkgURL);
|
|
toast.show(qsTr("Copied %1.").arg(pkgURL));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Rectangle {
|
|
id: urlInstaller
|
|
width: parent.width
|
|
height: childrenRect.height
|
|
color: "snow"
|
|
opacity: 0.75
|
|
anchors.bottom: parent.bottom
|
|
|
|
RowLayout {
|
|
width: parent.width
|
|
TextField {
|
|
id: urlEdit
|
|
Layout.fillWidth: true
|
|
clip: true
|
|
}
|
|
|
|
Button {
|
|
text: qsTr("Install From URL")
|
|
enabled: urlEdit.text !== ""
|
|
onClicked: {
|
|
let url = urlEdit.text;
|
|
mainWindow.busy = true;
|
|
Pacman.downloadNewPack(url, true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function updatePackageList() {
|
|
packageModel.clear();
|
|
let data = JSON.parse(Pacman.listPackages());
|
|
data.forEach(e => packageModel.append({
|
|
pkgName: e.name,
|
|
pkgURL: e.url,
|
|
pkgVersion: e.hash.substring(0, 8),
|
|
pkgEnabled: e.enabled
|
|
}));
|
|
}
|
|
|
|
function downloadComplete() {
|
|
let idx = packageList.currentIndex;
|
|
updatePackageList();
|
|
packageList.currentIndex = idx;
|
|
}
|
|
|
|
Component.onCompleted: {
|
|
updatePackageList();
|
|
}
|
|
}
|