add install adn remove completed
This commit is contained in:
@@ -1,37 +1,92 @@
|
||||
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 var installedPackages: []
|
||||
property bool loadingInstalled: false
|
||||
property string installedError: ""
|
||||
property bool busy: false
|
||||
property bool removing: false
|
||||
property string removingPackage: ""
|
||||
|
||||
signal reloadRequested()
|
||||
signal filterRequested(string query)
|
||||
signal removeRequested(string name)
|
||||
|
||||
// Загружаем список при каждом входе на вкладку и после завершения операции.
|
||||
onVisibleChanged: if (visible) root.reloadRequested()
|
||||
onBusyChanged: if (!root.busy && root.visible) root.reloadRequested()
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
spacing: 8
|
||||
|
||||
TextField {
|
||||
id: packageSearchField
|
||||
id: filterField
|
||||
Layout.fillWidth: true
|
||||
placeholderText: "название установленного пакета"
|
||||
placeholderTextColor: Theme.color3
|
||||
selectByMouse: true
|
||||
color: Theme.color2
|
||||
font.pixelSize: 14
|
||||
enabled: !root.busy
|
||||
|
||||
background: Rectangle {
|
||||
color: "#313244"
|
||||
color: Theme.color5
|
||||
radius: 3
|
||||
border.width: 1
|
||||
border.color: packageSearchField.activeFocus ? Theme.color6 : Theme.color4
|
||||
border.color: filterField.activeFocus ? Theme.color6 : Theme.color4
|
||||
}
|
||||
|
||||
onTextChanged: root.filterRequested(text)
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
Lists.InstalledList {
|
||||
anchors.fill: parent
|
||||
packages: root.installedPackages
|
||||
busy: root.busy
|
||||
removing: root.removing
|
||||
removingPackage: root.removingPackage
|
||||
onRemoveRequested: (name) => root.removeRequested(name)
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.centerIn: parent
|
||||
spacing: 8
|
||||
visible: root.installedPackages.length === 0
|
||||
|
||||
BusyIndicator {
|
||||
running: root.loadingInstalled
|
||||
visible: root.loadingInstalled
|
||||
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: root.loadingInstalled ? "загрузка списка..."
|
||||
: root.installedError !== "" ? root.installedError
|
||||
: "Ничего не найдено"
|
||||
font.pixelSize: 13
|
||||
color: root.installedError !== "" ? Theme.color7 : Theme.color3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user