From 8ecbcae4fc3776ed9e3d3eae036df03372e4461a Mon Sep 17 00:00:00 2001 From: chatlanin Date: Wed, 25 Nov 2026 17:32:55 +0300 Subject: [PATCH] add search list --- qml/lists/SearchList.qml | 115 +++++++++++++++++++++++++++++++++++++++ qml/pages/InstallPg.qml | 10 ++-- 2 files changed, 121 insertions(+), 4 deletions(-) create mode 100644 qml/lists/SearchList.qml diff --git a/qml/lists/SearchList.qml b/qml/lists/SearchList.qml new file mode 100644 index 0000000..68049c5 --- /dev/null +++ b/qml/lists/SearchList.qml @@ -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 + } + } + } + } +} diff --git a/qml/pages/InstallPg.qml b/qml/pages/InstallPg.qml index 8f2237e..02b8ed7 100644 --- a/qml/pages/InstallPg.qml +++ b/qml/pages/InstallPg.qml @@ -1,9 +1,10 @@ import QtQuick -import QtQuick.Layouts -import QtQuick.Window import QtQuick.Controls +import QtQuick.Layouts +import archpack +import "../lists" as Lists -Item { +Item { id: root property int status: 0; @@ -26,7 +27,7 @@ Item { enabled: root.status === ProcessManager.Status.Null background: Rectangle { - color: "#313244" + color: Theme.color5 radius: 3 border.width: 1 border.color: packageSearchField.activeFocus ? Theme.color6 : Theme.color4 @@ -46,6 +47,7 @@ Item { } Item { + Layout.fillWidth: true Layout.fillHeight: true } }