added a button to cancel installation if the package manager on the server is busy

This commit is contained in:
vladimir.kuznetsov 2023-11-30 19:21:57 +07:00
parent dd233f77fc
commit 3defb09da9
7 changed files with 29 additions and 4 deletions

View file

@ -19,6 +19,7 @@ PageType {
property bool isTimerRunning: true
property string progressBarText: qsTr("Usually it takes no more than 5 minutes")
property bool isCancelButtonVisible: false
Connections {
target: InstallController
@ -61,11 +62,13 @@ PageType {
function onServerIsBusy(isBusy) {
if (isBusy) {
root.isCancelButtonVisible = true
root.progressBarText = qsTr("Amnezia has detected that your server is currently ") +
qsTr("busy installing other software. Amnezia installation ") +
qsTr("will pause until the server finishes installing other software")
root.isTimerRunning = false
} else {
root.isCancelButtonVisible = false
root.progressBarText = qsTr("Usually it takes no more than 5 minutes")
root.isTimerRunning = true
}
@ -150,6 +153,22 @@ PageType {
text: root.progressBarText
}
BasicButtonType {
id: cancelIntallationButton
Layout.fillWidth: true
Layout.topMargin: 24
visible: root.isCancelButtonVisible
text: qsTr("Cancel installation")
onClicked: {
InstallController.cancelInstallation()
PageController.showBusyIndicator(true)
}
}
}
}
}

View file

@ -60,6 +60,7 @@ PageType {
target: InstallController
function onInstallationErrorOccurred(errorMessage) {
PageController.showBusyIndicator(false)
PageController.showErrorMessage(errorMessage)
var currentPageName = stackView.currentItem.objectName

View file

@ -82,6 +82,7 @@ PageType {
target: InstallController
function onInstallationErrorOccurred(errorMessage) {
PageController.showBusyIndicator(false)
PageController.showErrorMessage(errorMessage)
var needCloseCurrentPage = false