add search list

This commit is contained in:
2026-11-25 17:32:55 +03:00
parent fee71a68e7
commit 8ecbcae4fc
2 changed files with 121 additions and 4 deletions

115
qml/lists/SearchList.qml Normal file
View File

@@ -0,0 +1,115 @@
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
}
}
}
}
}

View File

@@ -1,9 +1,10 @@
import QtQuick import QtQuick
import QtQuick.Layouts
import QtQuick.Window
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Layouts
import archpack
import "../lists" as Lists
Item { Item {
id: root id: root
property int status: 0; property int status: 0;
@@ -26,7 +27,7 @@ Item {
enabled: root.status === ProcessManager.Status.Null enabled: root.status === ProcessManager.Status.Null
background: Rectangle { background: Rectangle {
color: "#313244" color: Theme.color5
radius: 3 radius: 3
border.width: 1 border.width: 1
border.color: packageSearchField.activeFocus ? Theme.color6 : Theme.color4 border.color: packageSearchField.activeFocus ? Theme.color6 : Theme.color4
@@ -46,6 +47,7 @@ Item {
} }
Item { Item {
Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
} }
} }