add install adn remove completed

This commit is contained in:
2026-12-06 10:06:21 +03:00
parent fb24f66c04
commit 2c6d397f76
11 changed files with 845 additions and 59 deletions

View File

@@ -13,6 +13,7 @@ Button {
enabled: status === ProcessManager.Status.Null && root.packageCount > 0
visible: status !== ProcessManager.Status.Updating
&& status !== ProcessManager.Status.Installing
&& status !== ProcessManager.Status.Removing
text: status === ProcessManager.Status.Updating ? "Обновление..." : status === ProcessManager.Status.Checking ? "Проверка..." : root.packageCount > 0 ? "Обновить систему" : "✓ Всё обновлено"
background: Rectangle {

View File

@@ -79,40 +79,6 @@ Popup {
onClicked: root.pick(ProcessManager.PackageManager.Pacman)
}
Rectangle {
Layout.fillWidth: true
Layout.topMargin: 2
Layout.preferredHeight: 1
color: Theme.color4
}
// Пункт меню «История»: открывает список завершённых заданий.
Button {
id: historyButton
text: "История"
Layout.fillWidth: true
leftPadding: 8
rightPadding: 8
topPadding: 8
bottomPadding: 8
onClicked: {
root.close()
}
background: Rectangle {
radius: 3
color: historyButton.down ? Theme.color4 : historyButton.hovered ? Theme.color5 : Theme.colorTransparent
}
contentItem: Text {
text: historyButton.text
font.pixelSize: 13
color: Theme.color2
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
}
}
onOpened: {

View File

@@ -0,0 +1,121 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
Dialog {
id: root
x: (parent.width - width) / 2
y: (parent.height - height) / 2
width: 380
padding: 16
modal: true
parent: Overlay.overlay
closePolicy: Popup.CloseOnEscape
property string packageName: ""
signal confirmed()
onAccepted: root.confirmed()
background: Rectangle {
color: Theme.color1
radius: 3
border.width: 1
border.color: Theme.color4
}
contentItem: ColumnLayout {
spacing: 10
Label {
text: "Удалить пакет?"
color: Theme.color2
font.pixelSize: 15
font.bold: true
Layout.fillWidth: true
}
Label {
text: root.packageName
color: Theme.color7
font.pixelSize: 13
font.family: "monospace"
wrapMode: Text.WordWrap
Layout.fillWidth: true
}
Label {
text: "Пакет и его файлы будут удалены. Зависимости останутся."
color: Theme.color14
font.pixelSize: 12
wrapMode: Text.WordWrap
Layout.fillWidth: true
}
}
footer: Item {
implicitHeight: footerRow.implicitHeight + 22
RowLayout {
id: footerRow
anchors.fill: parent
anchors.rightMargin: 18
spacing: 8
Item { Layout.fillWidth: true }
Button {
id: cancelButton
text: "✕ Отмена"
leftPadding: 14
rightPadding: 14
topPadding: 8
bottomPadding: 8
onClicked: root.reject()
background: Rectangle {
radius: 4
color: cancelButton.down ? Theme.color4 : cancelButton.hovered ? Theme.color4 : Theme.colorTransparent
border.width: 1
border.color: Theme.color4
}
contentItem: Text {
text: cancelButton.text
font.pixelSize: 13
color: Theme.color2
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
Button {
id: removeButton
text: "✓ Удалить"
leftPadding: 14
rightPadding: 14
topPadding: 8
bottomPadding: 8
onClicked: root.accept()
background: Rectangle {
radius: 4
color: removeButton.down ? Theme.color11 : removeButton.hovered ? Theme.color6 : Theme.color10
}
contentItem: Text {
text: removeButton.text
font.pixelSize: 13
font.bold: true
color: Theme.color8
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
}
}
}

112
qml/lists/InstalledList.qml Normal file
View File

@@ -0,0 +1,112 @@
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Controls
import archpack
ListView {
id: root
clip: true
spacing: 2
model: root.packages
visible: count > 0
property var packages: []
property bool busy: false
property bool removing: false
property string removingPackage: ""
signal removeRequested(string name)
ScrollBar.vertical: ScrollBar {
policy: ScrollBar.AsNeeded
width: 6
}
delegate: Rectangle {
id: delegate
required property var modelData
width: root.width
height: 48
radius: 7
color: "transparent"
Text {
id: nameText
anchors.left: parent.left
anchors.leftMargin: 8
anchors.right: dateText.left
anchors.rightMargin: 8
anchors.top: parent.top
anchors.topMargin: 6
text: delegate.modelData.name
font.pixelSize: 13
font.family: "monospace"
color: Theme.color2
elide: Text.ElideRight
}
Text {
id: versionText
anchors.left: nameText.left
anchors.right: nameText.right
anchors.top: nameText.bottom
anchors.topMargin: 1
text: delegate.modelData.version
font.pixelSize: 10
color: Theme.color3
elide: Text.ElideRight
}
Text {
id: dateText
anchors.right: removeButton.left
anchors.rightMargin: 8
anchors.verticalCenter: parent.verticalCenter
width: 170
horizontalAlignment: Text.AlignRight
text: delegate.modelData.installedAtText
font.pixelSize: 10
color: Theme.color12
}
Button {
id: removeButton
anchors.right: parent.right
anchors.rightMargin: 8
anchors.verticalCenter: parent.verticalCenter
width: 100
text: root.removing && root.removingPackage === delegate.modelData.name
? "Удаление..."
: "Удалить"
enabled: !root.busy
implicitHeight: 28
leftPadding: 10
rightPadding: 10
font.pixelSize: 11
onClicked: root.removeRequested(delegate.modelData.name)
background: Rectangle {
radius: 4
color: !removeButton.enabled ? Theme.color5
: removeButton.down ? Theme.color11
: removeButton.hovered ? Theme.color6
: Theme.color10
}
contentItem: Text {
text: removeButton.text
font: removeButton.font
color: removeButton.enabled ? Theme.color8 : Theme.color12
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
}
}

View File

@@ -1,37 +1,92 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Window
import QtQuick.Controls
import QtQuick.Layouts
import archpack
import "../lists" as Lists
Item {
Item {
id: root
property var installedPackages: []
property bool loadingInstalled: false
property string installedError: ""
property bool busy: false
property bool removing: false
property string removingPackage: ""
signal reloadRequested()
signal filterRequested(string query)
signal removeRequested(string name)
// Загружаем список при каждом входе на вкладку и после завершения операции.
onVisibleChanged: if (visible) root.reloadRequested()
onBusyChanged: if (!root.busy && root.visible) root.reloadRequested()
ColumnLayout {
anchors.fill: parent
spacing: 8
TextField {
id: packageSearchField
id: filterField
Layout.fillWidth: true
placeholderText: "название установленного пакета"
placeholderTextColor: Theme.color3
selectByMouse: true
color: Theme.color2
font.pixelSize: 14
enabled: !root.busy
background: Rectangle {
color: "#313244"
color: Theme.color5
radius: 3
border.width: 1
border.color: packageSearchField.activeFocus ? Theme.color6 : Theme.color4
border.color: filterField.activeFocus ? Theme.color6 : Theme.color4
}
onTextChanged: root.filterRequested(text)
}
Item {
Layout.fillWidth: true
Layout.fillHeight: true
Lists.InstalledList {
anchors.fill: parent
packages: root.installedPackages
busy: root.busy
removing: root.removing
removingPackage: root.removingPackage
onRemoveRequested: (name) => root.removeRequested(name)
}
ColumnLayout {
anchors.centerIn: parent
spacing: 8
visible: root.installedPackages.length === 0
BusyIndicator {
running: root.loadingInstalled
visible: root.loadingInstalled
Layout.alignment: Qt.AlignHCenter
implicitWidth: 24
implicitHeight: 24
palette.dark: Theme.color2
palette.text: Theme.color2
}
Text {
Layout.alignment: Qt.AlignHCenter
Layout.maximumWidth: Math.max(0, root.width - 40)
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
text: root.loadingInstalled ? "загрузка списка..."
: root.installedError !== "" ? root.installedError
: "Ничего не найдено"
font.pixelSize: 13
color: root.installedError !== "" ? Theme.color7 : Theme.color3
}
}
}
}
}