import QtQuick import QtQuick.Controls import QtQuick.Layouts import archpack import "../lists" as Lists Item { id: root property var searchResults: [] property bool searching: false property string searchError: "" property bool busy: false property bool installing: false property string installingPackage: "" signal searchRequested(string query) signal installRequested(string name) ColumnLayout { anchors.fill: parent spacing: 8 TextField { id: searchField Layout.fillWidth: true placeholderText: "название пакета, например sourcegit" placeholderTextColor: Theme.color3 selectByMouse: true color: Theme.color2 font.pixelSize: 14 enabled: !root.busy background: Rectangle { color: Theme.color5 radius: 3 border.width: 1 border.color: searchField.activeFocus ? Theme.color6 : Theme.color4 } // Задержку набора и отмену устаревших запросов делает SearchManager. onTextChanged: root.searchRequested(text) onAccepted: root.searchRequested(text) } Item { Layout.fillWidth: true Layout.fillHeight: true Lists.SearchList { anchors.fill: parent results: root.searchResults busy: root.busy installing: root.installing installingPackage: root.installingPackage onInstallRequested: (name) => root.installRequested(name) } ColumnLayout { anchors.centerIn: parent spacing: 8 visible: root.searchResults.length === 0 BusyIndicator { running: root.searching visible: root.searching Layout.alignment: Qt.AlignHCenter implicitWidth: 24 implicitHeight: 24 palette.dark: Theme.color2 palette.text: Theme.color2 } Text { Layout.alignment: Qt.AlignHCenter Layout.maximumWidth: Math.max(0, root.width - 40) horizontalAlignment: Text.AlignHCenter wrapMode: Text.WordWrap text: searchField.text.trim() === "" ? "Введите название пакета" : root.searchError !== "" ? root.searchError : root.searching ? "поиск..." : "Ничего не найдено" font.pixelSize: 13 color: root.searchError !== "" ? Theme.color7 : Theme.color3 } } } } }