add install adn remove completed
This commit is contained in:
112
qml/lists/InstalledList.qml
Normal file
112
qml/lists/InstalledList.qml
Normal 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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user