diff options
| author | Aleix Pol <aleixpol@kde.org> | 2015-09-21 16:24:51 (GMT) |
|---|---|---|
| committer | Aleix Pol <aleixpol@kde.org> | 2015-09-21 16:24:51 (GMT) |
| commit | c2112bdf63a57fa78916e7033f3d5c7c39437846 (patch) | |
| tree | 5d29689cf7a676577ba57c2034d2f7ab6673f3d8 | |
| parent | 1a788c382a383da37975b26ebbedfecd73f4f482 (diff) | |
Adopt vdg's progress update approach
Instead of a separate page, include it in the present upgrades page together
with a fancy component at the top to control the view.
| -rw-r--r-- | discover/qml/PresentUpdatesPage.qml | 48 | ||||
| -rw-r--r-- | discover/qml/UpdateProgressPage.qml | 68 | ||||
| -rw-r--r-- | discover/qml/UpdatesPage.qml | 15 | ||||
| -rw-r--r-- | discover/resources.qrc | 1 |
4 files changed, 48 insertions, 84 deletions
diff --git a/discover/qml/PresentUpdatesPage.qml b/discover/qml/PresentUpdatesPage.qml index feea8cd..40fb4fc 100644 --- a/discover/qml/PresentUpdatesPage.qml +++ b/discover/qml/PresentUpdatesPage.qml @@ -9,10 +9,56 @@ ScrollView id: page property real proposedMargin: 0 + function start() { + resourcesUpdatesModel.prepare() + resourcesUpdatesModel.updateAll() + } + ColumnLayout { x: proposedMargin width: app.actualWidth + + GridItem { + Layout.fillWidth: true + height: 50 + + ConditionalLoader { + anchors { + left: parent.left + right: parent.right + verticalCenter: parent.verticalCenter + } + + condition: resourcesUpdatesModel.isProgressing + componentFalse: RowLayout { + Label { + anchors.verticalCenter: parent.verticalCenter + text: i18n("%1 updates", updateModel.toUpdateCount) + } + Label { + anchors.verticalCenter: parent.verticalCenter + text: i18n("%1 updates disabled", (updateModel.totalUpdatesCount - updateModel.toUpdateCount)) + } + Item { Layout.fillWidth: true} + Button { + id: startButton + text: i18n("Update") + onClicked: page.start() + } + } + componentTrue: ColumnLayout { + Label { + text: resourcesUpdatesModel.remainingTime + } + ProgressBar { + anchors.centerIn: parent + value: resourcesUpdatesModel.progress + } + } + } + } + Repeater { id: rep model: updateModel @@ -33,10 +79,12 @@ ScrollView Layout.fillWidth: true height: 32 RowLayout { + enabled: !resourcesUpdatesModel.isProgressing anchors.fill: parent CheckBox { anchors.verticalCenter: parent.verticalCenter checked: model.checked + onClicked: model.checked = !model.checked } QIconItem { diff --git a/discover/qml/UpdateProgressPage.qml b/discover/qml/UpdateProgressPage.qml deleted file mode 100644 index 34b1f7b..0000000 --- a/discover/qml/UpdateProgressPage.qml +++ /dev/null @@ -1,68 +0,0 @@ -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import QtQuick.Layouts 1.1 - -ColumnLayout -{ - id: page - readonly property real proposedMargin: (width-app.actualWidth)/2 - readonly property string title: i18n("Updating...") - readonly property string icon: "system-software-update" - - function start() { - resourcesUpdatesModel.prepare() - resourcesUpdatesModel.updateAll() - } - - onVisibleChanged: window.navigationEnabled=!visible - Binding { - target: progressBox - property: "enabled" - value: !visible - } - - ProgressBar { - id: progress - width: app.actualWidth - - value: resourcesUpdatesModel.progress - minimumValue: 0 - maximumValue: 100 - indeterminate: resourcesUpdatesModel.progress==-1 - - Label { - anchors.centerIn: parent - text: resourcesUpdatesModel.remainingTime - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - visible: text!="" - } - } - - ScrollView { - Layout.fillWidth: true - Layout.fillHeight: true - - ListView { - id: messageFlickable - width: app.actualWidth - property bool userScrolled: false - clip: true - model: resourcesUpdatesModel - delegate: Label { - text: display - height: paintedHeight - wrapMode: Text.Wrap - width: messageFlickable.width - } - onContentHeightChanged: { - if(!userScrolled && contentHeight>height && !moving) { - contentY = contentHeight - height + anchors.topMargin/2 - } - } - - //if the user scrolls down, the viewport will be back to following the new progress - onMovementEnded: userScrolled = !messageFlickable.atYEnd - } - } -} diff --git a/discover/qml/UpdatesPage.qml b/discover/qml/UpdatesPage.qml index d8c7e7f..06a0fe7 100644 --- a/discover/qml/UpdatesPage.qml +++ b/discover/qml/UpdatesPage.qml @@ -12,21 +12,6 @@ ConditionalLoader readonly property var icon: "system-updates" readonly property string title: i18n("System Update") readonly property real proposedMargin: (width-app.actualWidth)/2 - readonly property Component tools: RowLayout { - Button { - Component { - id: updatesPage - UpdateProgressPage {} - } - - text: i18n("Update") - enabled: updateModel.hasUpdates - onClicked: { - var updates = page.Stack.view.push(updatesPage) - updates.start() - } - } - } ResourcesUpdatesModel { id: resourcesUpdatesModel diff --git a/discover/resources.qrc b/discover/resources.qrc index 52549b1..016a016 100644 --- a/discover/resources.qrc +++ b/discover/resources.qrc @@ -18,7 +18,6 @@ <file>qml/InstallApplicationButton.qml</file> <file>qml/Rating.qml</file> <file>qml/UpdatesPage.qml</file> - <file>qml/UpdateProgressPage.qml</file> <file>qml/ReviewDialog.qml</file> <file>qml/ProgressView.qml</file> <file>qml/BrowsingPage.qml</file> |
