116 lines
2.6 KiB
QML
116 lines
2.6 KiB
QML
pragma ComponentBehavior: Bound
|
|
|
|
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Layouts
|
|
import archpack
|
|
|
|
ListView {
|
|
id: root
|
|
clip: true
|
|
spacing: 2
|
|
model: root.results
|
|
visible: count > 0
|
|
|
|
property var results: []
|
|
property bool busy: false
|
|
property bool installing: false
|
|
property string installingPackage: ""
|
|
|
|
signal installRequested(string name)
|
|
|
|
ScrollBar.vertical: ScrollBar {
|
|
policy: ScrollBar.AsNeeded
|
|
width: 6
|
|
}
|
|
|
|
delegate: Rectangle {
|
|
id: delegate
|
|
required property var modelData
|
|
|
|
width: root.width
|
|
height: 56
|
|
radius: 7
|
|
color: "transparent"
|
|
|
|
RowLayout {
|
|
anchors.fill: parent
|
|
anchors.leftMargin: 8
|
|
anchors.rightMargin: 8
|
|
spacing: 8
|
|
|
|
ColumnLayout {
|
|
Layout.fillWidth: true
|
|
spacing: 2
|
|
|
|
RowLayout {
|
|
Layout.fillWidth: true
|
|
spacing: 6
|
|
|
|
Text {
|
|
text: delegate.modelData.name
|
|
font.pixelSize: 13
|
|
font.family: "monospace"
|
|
color: Theme.color2
|
|
}
|
|
|
|
Text {
|
|
text: delegate.modelData.repo
|
|
font.pixelSize: 10
|
|
color: Theme.color3
|
|
}
|
|
|
|
Item { Layout.fillWidth: true }
|
|
|
|
Text {
|
|
text: delegate.modelData.version
|
|
font.pixelSize: 10
|
|
color: Theme.color12
|
|
}
|
|
}
|
|
|
|
Text {
|
|
Layout.fillWidth: true
|
|
text: delegate.modelData.description
|
|
font.pixelSize: 10
|
|
color: Theme.color3
|
|
elide: Text.ElideRight
|
|
visible: text !== ""
|
|
}
|
|
}
|
|
|
|
Button {
|
|
id: installButton
|
|
|
|
text: root.installing && root.installingPackage === delegate.modelData.name
|
|
? "Установка..."
|
|
: "Установить"
|
|
enabled: !root.busy
|
|
implicitHeight: 28
|
|
leftPadding: 10
|
|
rightPadding: 10
|
|
font.pixelSize: 11
|
|
Layout.alignment: Qt.AlignVCenter
|
|
|
|
onClicked: root.installRequested(delegate.modelData.name)
|
|
|
|
background: Rectangle {
|
|
radius: 4
|
|
color: !installButton.enabled ? Theme.color5
|
|
: installButton.down ? Theme.color11
|
|
: installButton.hovered ? Theme.color6
|
|
: Theme.color10
|
|
}
|
|
|
|
contentItem: Text {
|
|
text: installButton.text
|
|
font: installButton.font
|
|
color: installButton.enabled ? Theme.color8 : Theme.color12
|
|
horizontalAlignment: Text.AlignHCenter
|
|
verticalAlignment: Text.AlignVCenter
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|