rename packagelist to updatelist and fix visible preloader

This commit is contained in:
2026-11-25 13:18:38 +03:00
parent b412798325
commit f6b4688945
6 changed files with 109 additions and 111 deletions

View File

@@ -1,104 +0,0 @@
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import archpack
Item {
id: root
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"
// из-зa предупреждение 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
}
}
}
}
}

104
qml/lists/UpdateList.qml Normal file
View File

@@ -0,0 +1,104 @@
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import archpack
Item {
id: root
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"
// из-зa предупреждение 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
}
}
}
}
}