107 lines
2.9 KiB
QML
107 lines
2.9 KiB
QML
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"
|
||
|
||
// из-з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
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|