add base install and delete
This commit is contained in:
@@ -11,6 +11,8 @@ Button {
|
||||
property int status: 0
|
||||
|
||||
enabled: status === ProcessManager.Status.Null && root.packageCount > 0
|
||||
visible: status !== ProcessManager.Status.Updating
|
||||
&& status !== ProcessManager.Status.Installing
|
||||
text: status === ProcessManager.Status.Updating ? "Обновление..." : status === ProcessManager.Status.Checking ? "Проверка..." : root.packageCount > 0 ? "Обновить систему" : "✓ Всё обновлено"
|
||||
|
||||
background: Rectangle {
|
||||
|
||||
@@ -9,8 +9,11 @@ ListView {
|
||||
clip: true
|
||||
spacing: 2
|
||||
model: consoleLogData
|
||||
onModelChanged: positionViewAtEnd()
|
||||
onCountChanged: positionViewAtEnd()
|
||||
property bool follow: true
|
||||
|
||||
onMovementEnded: follow = atYEnd
|
||||
onCountChanged: if (follow) positionViewAtEnd()
|
||||
onModelChanged: if (follow) positionViewAtEnd()
|
||||
|
||||
property var consoleLogData: ""
|
||||
|
||||
|
||||
@@ -7,51 +7,85 @@ import "../lists" as Lists
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property int status: 0;
|
||||
property var installTarget: null;
|
||||
signal search();
|
||||
signal install();
|
||||
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: packageSearchField
|
||||
id: searchField
|
||||
Layout.fillWidth: true
|
||||
placeholderText: "название пакета, например sourcegit"
|
||||
placeholderTextColor: Theme.color3
|
||||
selectByMouse: true
|
||||
color: Theme.color2
|
||||
font.pixelSize: 14
|
||||
enabled: root.status === ProcessManager.Status.Null
|
||||
enabled: !root.busy
|
||||
|
||||
background: Rectangle {
|
||||
color: Theme.color5
|
||||
radius: 3
|
||||
border.width: 1
|
||||
border.color: packageSearchField.activeFocus ? Theme.color6 : Theme.color4
|
||||
border.color: searchField.activeFocus ? Theme.color6 : Theme.color4
|
||||
}
|
||||
|
||||
// Задержку набора и очистку старого списка делает ProcessManager.
|
||||
onTextChanged: {
|
||||
if (root.installTarget !== null) root.installTarget = null;
|
||||
root.search(text);
|
||||
}
|
||||
|
||||
// Enter при выбранном пакете возвращает к результатам поиска.
|
||||
onAccepted: {
|
||||
if (root.installTarget !== null) root.installTarget = null;
|
||||
root.search(text);
|
||||
}
|
||||
// Задержку набора и отмену устаревших запросов делает 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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user