add package list in update page

This commit is contained in:
2026-11-15 11:08:05 +03:00
parent f7892ab6c3
commit a2be5c161d
9 changed files with 128 additions and 12 deletions

View File

@@ -1,5 +1,3 @@
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Layouts
@@ -86,7 +84,7 @@ Rectangle {
// delegate: Text {
// width: logView.width
// text: modelData
// color: "#a6adc8"
// color: Theme.color3
// font.family: "monospace"
// font.pixelSize: 11
// wrapMode: Text.WrapAnywhere
@@ -96,7 +94,7 @@ Rectangle {
Text {
anchors.centerIn: parent
text: "Логи отсутствуют"
color: "#585b70"
color: Theme.color12
font.pixelSize: 12
visible: root.consoleLogData.length === 0
}

106
qml/lists/PackageList.qml Normal file
View File

@@ -0,0 +1,106 @@
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import archpack
Item {
id: root
property int packageCount: 0
property bool isChecking: false
property var packages: []
ListView {
id: listView
anchors.fill: parent
// свойство, которое обрезает всё содержимое списка по его границам. Без него элементы списка (делегаты) могут визуально «вылезать» за пределы ListView, наезжая на другие элементы интерфейса.
clip: true
spacing: 2
model: root.packages
ScrollBar.vertical: ScrollBar {
policy: ScrollBar.AsNeeded
width: 6
}
delegate: Rectangle {
id: delegate
width: listView.width
height: 32
radius: 7
color: modelData.updating ? "#313244" : "transparent"
// из-зи предупреждение qmllint
required property var modelData
Behavior on color { ColorAnimation { duration: 300 } }
RowLayout {
anchors.fill: parent
anchors.leftMargin: 8
anchors.rightMargin: 8
spacing: 8
Text {
text: delegate.modelData.name
font.pixelSize: 13
font.family: "monospace"
color: delegate.modelData.updated ? Theme.color2 : delegate.modelData.updating ? Theme.color7 : Theme.color3
Layout.fillWidth: true
Behavior on color { ColorAnimation { duration: 300 } }
}
Text {
text: delegate.modelData.version
font.pixelSize: 11
color: Theme.color12
visible: delegate.modelData.version !== ""
}
Text {
text: "○"
font.pixelSize: 16
font.bold: true
color: Theme.color4
horizontalAlignment: Text.AlignHCenter
Layout.preferredWidth: 18
Layout.alignment: Qt.AlignVCenter
visible: !delegate.modelData.updating && !delegate.modelData.updated
}
Text {
text: "⟳"
font.pixelSize: 14
color: Theme.color7
horizontalAlignment: Text.AlignHCenter
Layout.preferredWidth: 18
Layout.alignment: Qt.AlignVCenter
visible: delegate.modelData.updating
RotationAnimation on rotation {
running: delegate.modelData.updating
loops: Animation.Infinite
from: 0
to: 360
duration: 1000
}
}
Text {
text: "✓"
font.pixelSize: 16
font.bold: true
color: Theme.color13
horizontalAlignment: Text.AlignHCenter
Layout.preferredWidth: 18
Layout.alignment: Qt.AlignVCenter
visible: delegate.modelData.updated && !delegate.modelData.updating
}
}
}
}
}

View File

@@ -1,7 +1,8 @@
import QtQuick
import QtQuick.Layouts
import "../../buttons" as Buttons
import "../../components" as Components
import "../buttons" as Buttons
import "../components" as Components
import "../lists" as Lists
Item {
id: root
@@ -10,6 +11,7 @@ Item {
property bool isChecking: true
property bool isUpdating: false
property bool isInstalling: false
property var packages: []
signal updateRequested()
ColumnLayout {
@@ -20,6 +22,13 @@ Item {
Layout.fillWidth: true
Layout.fillHeight: true
Lists.PackageList {
anchors.fill: parent
packages: root.packages
packageCount: root.packageCount
isChecking: root.isChecking
}
Components.PreLoader {
visible: root.isChecking
anchors.fill: parent

View File

@@ -16,6 +16,7 @@ QtObject {
readonly property color color10: "#8CAAEE"
readonly property color color11: "#6f8fd8"
readonly property color color12: "#585b70"
readonly property color color13: "#a6e3a1"
readonly property int fontSize: 12
readonly property int fontTitleSize: 20