From 7fa1d812f91812f0ee2165517274240bb4573b86 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Tue, 21 May 2019 17:54:27 +0200 Subject: [PATCH] Allow refreshing the cache also when there are already known updates --- nymea-app/ui/system/SystemUpdatePage.qml | 72 +++++++++++++++--------- 1 file changed, 45 insertions(+), 27 deletions(-) diff --git a/nymea-app/ui/system/SystemUpdatePage.qml b/nymea-app/ui/system/SystemUpdatePage.qml index d96edd6a..c4b72b09 100644 --- a/nymea-app/ui/system/SystemUpdatePage.qml +++ b/nymea-app/ui/system/SystemUpdatePage.qml @@ -81,18 +81,60 @@ Page { RowLayout { Layout.margins: app.margins + spacing: app.margins ColorIcon { Layout.preferredHeight: app.iconSize * 2 Layout.preferredWidth: height name: "../images/system-update.svg" color: app.accentColor + RotationAnimation on rotation { + from: 0; to: 360 + duration: 2000 + running: engine.systemController.updateManagementBusy + loops: Animation.Infinite + } } - Label { - Layout.fillWidth: true - text: qsTr("%n update(s) available", "", updatesModel.count) + ColumnLayout { + Label { + Layout.fillWidth: true + text: engine.systemController.updateManagementBusy ? qsTr("Checking for updates...") : qsTr("%n update(s) available", "", updatesModel.count) + } + GridLayout { + columns: width > 250 ? 2 : 1 + Button { + Layout.fillWidth: true + text: qsTr("Check again") + enabled: !engine.systemController.updateManagementBusy + onClicked: { + engine.systemController.checkForUpdates() + } + } + Button { + Layout.fillWidth: true + text: qsTr("Update all") + visible: updatesModel.count > 0 + enabled: !engine.systemController.updateManagementBusy + onClicked: { + var dialog = Qt.createComponent(Qt.resolvedUrl("../components/MeaDialog.qml")); + var text = qsTr("This will start a system update. Note that the update might take several minutes and your %1:core might not be functioning properly during this time and restart during the process.\nDo you want to proceed?").arg(app.systemName) + var popup = dialog.createObject(app, + { + headerIcon: "../images/system-update.svg", + title: qsTr("System update"), + text: text, + standardButtons: Dialog.Ok | Dialog.Cancel + }); + popup.open(); + popup.accepted.connect(function() { + engine.systemController.updatePackages() + }) + } + } + } } + } ThinDivider {} @@ -119,30 +161,6 @@ Page { } } } - - ThinDivider {} - - Button { - Layout.fillWidth: true - Layout.margins: app.margins - text: qsTr("Update all") - visible: updatesModel.count > 0 - onClicked: { - var dialog = Qt.createComponent(Qt.resolvedUrl("../components/MeaDialog.qml")); - var text = qsTr("This will start a system update. Note that the update might take several minutes and your %1:core might not be functioning properly during this time and restart during the process.\nDo you want to proceed?").arg(app.systemName) - var popup = dialog.createObject(app, - { - headerIcon: "../images/system-update.svg", - title: qsTr("System update"), - text: text, - standardButtons: Dialog.Ok | Dialog.Cancel - }); - popup.open(); - popup.accepted.connect(function() { - engine.systemController.updatePackages() - }) - } - } } ThinDivider {}