diff --git a/libnymea-app-core/models/packagesfiltermodel.cpp b/libnymea-app-core/models/packagesfiltermodel.cpp index cb1437f2..19af4ebe 100644 --- a/libnymea-app-core/models/packagesfiltermodel.cpp +++ b/libnymea-app-core/models/packagesfiltermodel.cpp @@ -46,6 +46,7 @@ Package *PackagesFilterModel::get(int index) const bool PackagesFilterModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const { + Q_UNUSED(source_parent) if (m_updatesOnly) { if (!m_packages->get(source_row)->updateAvailable()) { return false; diff --git a/libnymea-app-core/system/systemcontroller.cpp b/libnymea-app-core/system/systemcontroller.cpp index 726170db..485395c1 100644 --- a/libnymea-app-core/system/systemcontroller.cpp +++ b/libnymea-app-core/system/systemcontroller.cpp @@ -50,11 +50,21 @@ void SystemController::shutdown() m_jsonRpcClient->sendCommand("System.Shutdown"); } +bool SystemController::updateManagementBusy() const +{ + return m_updateManagementBusy; +} + bool SystemController::updateRunning() const { return m_updateRunning; } +void SystemController::checkForUpdates() +{ + m_jsonRpcClient->sendCommand("System.CheckForUpdates"); +} + Packages *SystemController::packages() const { return m_packages; @@ -109,6 +119,7 @@ void SystemController::getCapabilitiesResponse(const QVariantMap &data) void SystemController::getUpdateStatusResponse(const QVariantMap &data) { + m_updateManagementBusy = data.value("params").toMap().value("busy").toBool(); m_updateRunning = data.value("params").toMap().value("updateRunning").toBool(); emit updateRunningChanged(); } @@ -119,6 +130,7 @@ void SystemController::getPackagesResponse(const QVariantMap &data) QString id = packageVariant.toMap().value("id").toString(); QString displayName = packageVariant.toMap().value("displayName").toString(); Package *p = new Package(id, displayName); + p->setSummary(packageVariant.toMap().value("summary").toString()); p->setInstalledVersion(packageVariant.toMap().value("installedVersion").toString()); p->setCandidateVersion(packageVariant.toMap().value("candidateVersion").toString()); p->setChangelog(packageVariant.toMap().value("changelog").toString()); @@ -148,16 +160,23 @@ void SystemController::removePackageResponse(const QVariantMap ¶ms) void SystemController::notificationReceived(const QVariantMap &data) { - qDebug() << "System Notification" << data.value("notification"); QString notification = data.value("notification").toString(); if (notification == "System.UpdateStatusChanged") { - m_updateRunning = data.value("params").toMap().value("updateRunning").toBool(); - emit updateRunningChanged(); + qDebug() << "System.UpdateStatusChanged:" << data.value("params").toMap(); + if (m_updateManagementBusy != data.value("params").toMap().value("busy").toBool()) { + m_updateManagementBusy = data.value("params").toMap().value("busy").toBool(); + emit updateManagementBusyChanged(); + } + if (m_updateRunning != data.value("params").toMap().value("updateRunning").toBool()) { + m_updateRunning = data.value("params").toMap().value("updateRunning").toBool(); + emit updateRunningChanged(); + } } else if (notification == "System.PackageAdded") { QVariantMap packageMap = data.value("params").toMap().value("package").toMap(); QString id = packageMap.value("id").toString(); QString displayName = packageMap.value("displayName").toString(); Package *p = new Package(id, displayName); + p->setSummary(packageMap.value("summary").toString()); p->setInstalledVersion(packageMap.value("installedVersion").toString()); p->setCandidateVersion(packageMap.value("candidateVersion").toString()); p->setChangelog(packageMap.value("changelog").toString()); @@ -173,6 +192,7 @@ void SystemController::notificationReceived(const QVariantMap &data) qWarning() << "Received a package update notification for a package we don't know"; return; } + p->setSummary(packageMap.value("summary").toString()); p->setInstalledVersion(packageMap.value("installedVersion").toString()); p->setCandidateVersion(packageMap.value("candidateVersion").toString()); p->setChangelog(packageMap.value("changelog").toString()); @@ -201,5 +221,7 @@ void SystemController::notificationReceived(const QVariantMap &data) } else if (notification == "System.RepositoryRemoved") { QString repositoryId = data.value("params").toMap().value("repositoryId").toString(); m_repositories->removeRepository(repositoryId); + } else { + qWarning() << "Unhandled System Notification" << data.value("notification"); } } diff --git a/libnymea-app-core/system/systemcontroller.h b/libnymea-app-core/system/systemcontroller.h index 36bda206..7362b624 100644 --- a/libnymea-app-core/system/systemcontroller.h +++ b/libnymea-app-core/system/systemcontroller.h @@ -15,6 +15,7 @@ class SystemController : public JsonHandler // Whether the update mechanism is available in the connected core Q_PROPERTY(bool updateManagementAvailable READ updateManagementAvailable NOTIFY updateManagementAvailableChanged) + Q_PROPERTY(bool updateManagementBusy READ updateManagementBusy NOTIFY updateManagementBusyChanged) Q_PROPERTY(bool updateRunning READ updateRunning NOTIFY updateRunningChanged) Q_PROPERTY(Packages* packages READ packages CONSTANT) Q_PROPERTY(Repositories* repositories READ repositories CONSTANT) @@ -31,8 +32,10 @@ public: Q_INVOKABLE void reboot(); Q_INVOKABLE void shutdown(); + bool updateManagementBusy() const; bool updateRunning() const; + Q_INVOKABLE void checkForUpdates(); Packages* packages() const; Q_INVOKABLE void updatePackages(const QString packageId = QString()); Q_INVOKABLE void removePackages(const QString packageId = QString()); @@ -44,6 +47,7 @@ public: signals: void powerManagementAvailableChanged(); void updateManagementAvailableChanged(); + void updateManagementBusyChanged(); void updateRunningChanged(); private slots: @@ -61,6 +65,7 @@ private: bool m_powerManagementAvailable = false; bool m_updateManagementAvailable = false; + bool m_updateManagementBusy = false; bool m_updateRunning = false; Packages *m_packages = nullptr; Repositories *m_repositories = nullptr; diff --git a/libnymea-common/types/package.cpp b/libnymea-common/types/package.cpp index ce0abbb1..fb92ecd8 100644 --- a/libnymea-common/types/package.cpp +++ b/libnymea-common/types/package.cpp @@ -18,6 +18,19 @@ QString Package::displayName() const return m_displayName; } +QString Package::summary() const +{ + return m_summary; +} + +void Package::setSummary(const QString &summary) +{ + if(m_summary != summary) { + m_summary = summary; + emit summaryChanged(); + } +} + QString Package::installedVersion() const { return m_installedVersion; diff --git a/libnymea-common/types/package.h b/libnymea-common/types/package.h index 3cc66044..c99c05d3 100644 --- a/libnymea-common/types/package.h +++ b/libnymea-common/types/package.h @@ -8,6 +8,7 @@ class Package : public QObject Q_OBJECT Q_PROPERTY(QString id READ id CONSTANT) Q_PROPERTY(QString displayName READ displayName CONSTANT) + Q_PROPERTY(QString summary READ summary NOTIFY summaryChanged) Q_PROPERTY(QString installedVersion READ installedVersion NOTIFY installedVersionChanged) Q_PROPERTY(QString candidateVersion READ candidateVersion NOTIFY candidateVersionChanged) Q_PROPERTY(QString changelog READ changelog NOTIFY changelogChanged) @@ -21,6 +22,9 @@ public: QString id() const; QString displayName() const; + QString summary() const; + void setSummary(const QString &summary); + QString installedVersion() const; void setInstalledVersion(const QString &installedVersion); @@ -40,6 +44,7 @@ public: void setCanRemove(bool canRemove); signals: + void summaryChanged(); void installedVersionChanged(); void candidateVersionChanged(); void changelogChanged(); @@ -50,6 +55,7 @@ signals: private: QString m_id; QString m_displayName; + QString m_summary; QString m_installedVersion; QString m_candidateVersion; QString m_changelog; diff --git a/libnymea-common/types/packages.cpp b/libnymea-common/types/packages.cpp index 42e48a51..b409136a 100644 --- a/libnymea-common/types/packages.cpp +++ b/libnymea-common/types/packages.cpp @@ -19,6 +19,8 @@ QVariant Packages::data(const QModelIndex &index, int role) const return m_list.at(index.row())->id(); case RoleDisplayName: return m_list.at(index.row())->displayName(); + case RoleSummary: + return m_list.at(index.row())->summary(); case RoleInstalledVersion: return m_list.at(index.row())->installedVersion(); case RoleCandidateVersion: @@ -38,6 +40,7 @@ QHash Packages::roleNames() const QHash roles; roles.insert(RoleId, "id"); roles.insert(RoleDisplayName, "displayName"); + roles.insert(RoleSummary, "summary"); roles.insert(RoleInstalledVersion, "installedVersion"); roles.insert(RoleCandidateVersion, "candidateVersion"); roles.insert(RoleChangelog, "changelog"); @@ -51,6 +54,10 @@ void Packages::addPackage(Package *package) package->setParent(this); beginInsertRows(QModelIndex(), m_list.count(), m_list.count()); m_list.append(package); + connect(package, &Package::summaryChanged, this, [this, package](){ + emit dataChanged(index(m_list.indexOf(package)), index(m_list.indexOf(package)), {RoleSummary}); + emit countChanged(); + }); connect(package, &Package::installedVersionChanged, this, [this, package](){ emit dataChanged(index(m_list.indexOf(package)), index(m_list.indexOf(package)), {RoleInstalledVersion}); emit countChanged(); diff --git a/libnymea-common/types/packages.h b/libnymea-common/types/packages.h index 63561178..df5a26a6 100644 --- a/libnymea-common/types/packages.h +++ b/libnymea-common/types/packages.h @@ -13,6 +13,7 @@ public: enum Roles { RoleId, RoleDisplayName, + RoleSummary, RoleInstalledVersion, RoleCandidateVersion, RoleChangelog, diff --git a/nymea-app/translations/nymea-app-de.ts b/nymea-app/translations/nymea-app-de.ts index d8ef9e8c..49d6ce1e 100644 --- a/nymea-app/translations/nymea-app-de.ts +++ b/nymea-app/translations/nymea-app-de.ts @@ -1905,6 +1905,14 @@ Bitte versuche es erneut. Time zone Zeitzone + + Reboot %1:core + + + + Shutdown %1:core + + GenericDeviceListPage @@ -2715,6 +2723,17 @@ Bitte versuche es erneut. Disconnect Trennen + + System update in progress... + + + + %n system update(s) available + + %n System-Update verfügbar + %n System-Updates verfügbar + + ManualConnectPage @@ -3467,6 +3486,18 @@ Bitte versuche es erneut. OK OK + + Use a thing's state value + + + + Insert value here + + + + Select a state + + SelectStateDescriptorParamsPage @@ -3483,6 +3514,13 @@ Bitte versuche es erneut. Optionen + + SelectStatePage + + Select state + + + SelectThingPage @@ -3546,6 +3584,14 @@ Bitte versuche es erneut. Sensors Sensoren + + is closed + + + + is open + + ServerConfigurationDialog @@ -3764,6 +3810,14 @@ Bitte versuche es erneut. Find server UUID and versions Finde Server UUID und Versionen + + System update + + + + Update your %1:core system + + SetupWizard @@ -3942,6 +3996,84 @@ Bitte versuche es erneut. Logansicht + + SystemUpdatePage + + System update + + + + Configure updates + + + + Show all packages + + + + Your system is up to date. + + + + There are %1 updates available. + + + + Update all + + + + 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. +Do you want to proceed? + + + + Configure update sources + + + + Enabling additional software sources allows to install unreleased %1:core packages. +This can potentially break your system and lead to problems. +Please only use this if you are sure you want this and consider reporting the issues you find when testing unreleased channels. + + + + Enable package source + + + + All packages + + + + Installed version: + + + + Candidate version: + + + + Update + + + + Install + + + + Start update + + + + Remove + + + + Remove package + + + TimeEventDelegate @@ -4005,6 +4137,14 @@ Bitte versuche es erneut. jährlich + + UpdateRunningOverlay + + An update operation is currently running. +Please wait for it to complete. + + + WeatherDeviceListPage diff --git a/nymea-app/translations/nymea-app-en_US.ts b/nymea-app/translations/nymea-app-en_US.ts index 46753f2a..b23e3725 100644 --- a/nymea-app/translations/nymea-app-en_US.ts +++ b/nymea-app/translations/nymea-app-en_US.ts @@ -1475,6 +1475,14 @@ Please try again. Time zone + + Reboot %1:core + + + + Shutdown %1:core + + GenericDeviceListPage @@ -2184,6 +2192,17 @@ Please try again. Disconnect + + System update in progress... + + + + %n system update(s) available + + %n system update available + %n system updates available + + ManualConnectPage @@ -2783,6 +2802,18 @@ Please try again. OK + + Use a thing's state value + + + + Insert value here + + + + Select a state + + SelectStateDescriptorParamsPage @@ -2795,6 +2826,13 @@ Please try again. + + SelectStatePage + + Select state + + + SelectThingPage @@ -2850,6 +2888,14 @@ Please try again. Sensors + + is closed + + + + is open + + ServerConfigurationDialog @@ -2968,6 +3014,14 @@ Please try again. Find server UUID and versions + + System update + + + + Update your %1:core system + + SetupWizard @@ -3099,6 +3153,84 @@ Please try again. + + SystemUpdatePage + + System update + + + + Configure updates + + + + Show all packages + + + + Your system is up to date. + + + + There are %1 updates available. + + + + Update all + + + + 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. +Do you want to proceed? + + + + Configure update sources + + + + Enabling additional software sources allows to install unreleased %1:core packages. +This can potentially break your system and lead to problems. +Please only use this if you are sure you want this and consider reporting the issues you find when testing unreleased channels. + + + + Enable package source + + + + All packages + + + + Installed version: + + + + Candidate version: + + + + Update + + + + Install + + + + Start update + + + + Remove + + + + Remove package + + + TimeEventDelegate @@ -3162,6 +3294,14 @@ Please try again. + + UpdateRunningOverlay + + An update operation is currently running. +Please wait for it to complete. + + + WeatherDeviceListPage diff --git a/nymea-app/ui/MainPage.qml b/nymea-app/ui/MainPage.qml index 781d1249..ac1276d6 100644 --- a/nymea-app/ui/MainPage.qml +++ b/nymea-app/ui/MainPage.qml @@ -125,6 +125,57 @@ Page { ColumnLayout { id: mainColumn anchors.fill: parent + spacing: 0 + + Pane { + Layout.fillWidth: true + Layout.preferredHeight: shownHeight + property int shownHeight: shown ? contentRow.implicitHeight : 0 + property bool shown: updatesModel.count > 0 || engine.systemController.updateRunning + visible: shownHeight > 0 + Behavior on shownHeight { NumberAnimation { easing.type: Easing.InOutQuad; duration: 150 } } + Material.elevation: 2 + padding: 0 + + MouseArea { + anchors.fill: parent + onClicked: pageStack.push(Qt.resolvedUrl("system/SystemUpdatePage.qml")) + } + + Rectangle { + color: app.accentColor + anchors.fill: parent + + PackagesFilterModel { + id: updatesModel + packages: engine.systemController.packages + updatesOnly: true + } + + RowLayout { + id: contentRow + anchors { left: parent.left; top: parent.top; right: parent.right; leftMargin: app.margins; rightMargin: app.margins } + Item { + Layout.fillWidth: true + height: app.iconSize + } + + Label { + text: engine.systemController.updateRunning ? qsTr("System update in progress...") : qsTr("%n system update(s) available", "", updatesModel.count) + color: "white" + font.pixelSize: app.smallFont + } + ColorIcon { + height: app.iconSize / 2 + width: height + visible: infoPane.connectedState !== null && infoPane.connectedState.value === false + color: "white" + name: "../images/system-update.svg" + RotationAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; running: engine.systemController.updateRunning } + } + } + } + } Item { diff --git a/nymea-app/ui/components/UpdateRunningOverlay.qml b/nymea-app/ui/components/UpdateRunningOverlay.qml index a26d18ec..b6e7cabd 100644 --- a/nymea-app/ui/components/UpdateRunningOverlay.qml +++ b/nymea-app/ui/components/UpdateRunningOverlay.qml @@ -1,13 +1,13 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.2 +import Nymea 1.0 Rectangle { anchors.fill: parent color: "#99000000" - visible: shown + visible: engine.systemController.updateRunning - property bool shown: false // Event eater MouseArea { anchors.fill: parent @@ -26,19 +26,36 @@ Rectangle { PropertyAnimation on rotation { from: 0; to: 360; duration: 2000 - loops: Animation.Inifinite - onStopped: start(); // No clue why loops won't work + loops: Animation.Infinite +// onStopped: start(); // No clue why loops won't work } } Label { Layout.fillWidth: true Layout.margins: app.margins * 2 - text: qsTr("An update operation is currently running.\nPlease wait for it to complete.") + text: qsTr("System update in progress...") horizontalAlignment: Text.AlignHCenter wrapMode: Text.WordWrap font.pixelSize: app.largeFont color: "white" } + Label { + Layout.fillWidth: true + Layout.margins: app.margins * 2 + text: qsTr("Please wait.") + horizontalAlignment: Text.AlignHCenter + wrapMode: Text.WordWrap + color: "white" + } + Label { + Layout.fillWidth: true + Layout.margins: app.margins * 2 + text: qsTr("The system may restart in order to complete the updates. %1:app will reconnect automatically after the update.").arg(app.systemName) + horizontalAlignment: Text.AlignHCenter + wrapMode: Text.WordWrap + font.pixelSize: app.smallFont + color: "white" + } } } diff --git a/nymea-app/ui/system/GeneralSettingsPage.qml b/nymea-app/ui/system/GeneralSettingsPage.qml index 2fa6afd4..e2c882dc 100644 --- a/nymea-app/ui/system/GeneralSettingsPage.qml +++ b/nymea-app/ui/system/GeneralSettingsPage.qml @@ -96,18 +96,44 @@ Page { Button { Layout.fillWidth: true + Layout.margins: app.margins text: qsTr("Reboot %1:core").arg(app.systemName) visible: engine.systemController.powerManagementAvailable onClicked: { - engine.systemController.reboot() + var dialog = Qt.createComponent(Qt.resolvedUrl("../components/MeaDialog.qml")); + var text = qsTr("Are you sure you want to reboot your %1:core sytem now?").arg(app.systemName) + var popup = dialog.createObject(app, + { + headerIcon: "../images/dialog-warning-symbolic.svg", + title: qsTr("Reboot %1:core").arg(app.systemName), + text: text, + standardButtons: Dialog.Ok | Dialog.Cancel + }); + popup.open(); + popup.accepted.connect(function() { + engine.systemController.reboot() + }) } } Button { Layout.fillWidth: true + Layout.margins: app.margins text: qsTr("Shutdown %1:core").arg(app.systemName) visible: engine.systemController.powerManagementAvailable onClicked: { - engine.systemController.shutdown() + var dialog = Qt.createComponent(Qt.resolvedUrl("../components/MeaDialog.qml")); + var text = qsTr("Are you sure you want to shut down your %1:core sytem now?").arg(app.systemName) + var popup = dialog.createObject(app, + { + headerIcon: "../images/dialog-warning-symbolic.svg", + title: qsTr("Shot down %1:core").arg(app.systemName), + text: text, + standardButtons: Dialog.Ok | Dialog.Cancel + }); + popup.open(); + popup.accepted.connect(function() { + engine.systemController.shutdown() + }) } } } diff --git a/nymea-app/ui/system/SystemUpdatePage.qml b/nymea-app/ui/system/SystemUpdatePage.qml index 98ce4ac2..d96edd6a 100644 --- a/nymea-app/ui/system/SystemUpdatePage.qml +++ b/nymea-app/ui/system/SystemUpdatePage.qml @@ -11,6 +11,14 @@ Page { text: qsTr("System update") backButtonVisible: true onBackPressed: pageStack.pop() + + HeaderButton { + text: qsTr("Settings") + imageSource: "../images/settings.svg" + onClicked: { + pageStack.push(repositoryListComponent) + } + } } PackagesFilterModel { @@ -23,73 +31,127 @@ Page { id: contentColumn anchors.fill: parent - MeaListItemDelegate { + Item { + Layout.fillHeight: true Layout.fillWidth: true - text: qsTr("Configure updates") - onClicked: { - pageStack.push(repositoryListComponent) + visible: updatesModel.count === 0 + + ColumnLayout { + width: parent.width + anchors.centerIn: parent + spacing: app.margins * 2 + + ColorIcon { + Layout.preferredHeight: app.iconSize * 4 + Layout.preferredWidth: height + Layout.alignment: Qt.AlignHCenter + 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 + Layout.margins: app.margins + horizontalAlignment: Text.AlignHCenter + wrapMode: Text.WordWrap + text: engine.systemController.updateManagementBusy ? qsTr("Checking for updates...") : qsTr("Your system is up to date.") + } + + Button { + Layout.alignment: Qt.AlignHCenter + text: qsTr("Check for updates") + enabled: !engine.systemController.updateManagementBusy + onClicked: { + engine.systemController.checkForUpdates() + } + } } } - MeaListItemDelegate { + ColumnLayout { + Layout.fillHeight: true Layout.fillWidth: true - text: qsTr("Show all packages") - onClicked: { - pageStack.push(packageListComponent, {packages: engine.systemController.packages}) + visible: updatesModel.count > 0 + + RowLayout { + Layout.margins: app.margins + + ColorIcon { + Layout.preferredHeight: app.iconSize * 2 + Layout.preferredWidth: height + name: "../images/system-update.svg" + color: app.accentColor + } + + Label { + Layout.fillWidth: true + text: qsTr("%n update(s) available", "", updatesModel.count) + } + } + + ThinDivider {} + + ListView { + Layout.fillWidth: true + Layout.fillHeight: true + visible: count > 0 + model: updatesModel + clip: true + delegate: MeaListItemDelegate { + width: parent.width + text: model.displayName + subText: model.candidateVersion + prominentSubText: false + iconName: model.updateAvailable + ? Qt.resolvedUrl("../images/system-update.svg") + : Qt.resolvedUrl("../images/view-" + (model.installedVersion.length > 0 ? "expand" : "collapse") + ".svg") + iconColor: model.updateAvailable + ? "green" + : model.installedVersion.length > 0 ? "blue" : iconKeyColor + onClicked: { + pageStack.push(packageDetailsComponent, {pkg: updatesModel.get(index)}) + } + } + } + + 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 {} - Label { + MeaListItemDelegate { Layout.fillWidth: true - Layout.margins: app.margins - elide: Text.ElideRight - text: updatesModel.count === 0 ? qsTr("Your system is up to date.") : qsTr("There are %1 updates available.").arg(updatesModel.count) - } - - Button { - Layout.fillWidth: true - Layout.margins: app.margins - text: qsTr("Update all") - visible: updatesModel.count > 0 + text: qsTr("Install or remove software") 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() - }) - - } - } - - ListView { - Layout.fillWidth: true - Layout.fillHeight: true - model: updatesModel - clip: true - delegate: MeaListItemDelegate { - width: parent.width - text: model.displayName - subText: model.candidateVersion - prominentSubText: false - iconName: model.updateAvailable - ? Qt.resolvedUrl("../images/system-update.svg") - : Qt.resolvedUrl("../images/view-" + (model.installedVersion.length > 0 ? "expand" : "collapse") + ".svg") - iconColor: model.updateAvailable - ? "green" - : model.installedVersion.length > 0 ? "blue" : iconKeyColor - onClicked: { - pageStack.push(packageDetailsComponent, {pkg: updatesModel.get(index)}) - } + pageStack.push(packageListComponent, {packages: engine.systemController.packages}) } } } @@ -134,7 +196,6 @@ Page { } } UpdateRunningOverlay { - visible: engine.systemController.updateRunning } } } @@ -174,7 +235,6 @@ Page { } } UpdateRunningOverlay { - visible: engine.systemController.updateRunning } } } @@ -187,17 +247,42 @@ Page { property Package pkg: null header: GuhHeader { - text: pkg.displayName + text: qsTr("Package inforation") onBackPressed: pageStack.pop() } GridLayout { anchors { left: parent.left; top: parent.top; right: parent.right } columns: app.landscape ? 2 : 1 + RowLayout { + Layout.margins: app.margins + spacing: app.margins + ColorIcon { + Layout.preferredHeight: app.iconSize * 2 + Layout.preferredWidth: app.iconSize * 2 + name: "../images/plugin.svg" + color: app.accentColor + } + Label { + Layout.fillWidth: true + text: pkg.displayName + font.pixelSize: app.largeFont + elide: Text.ElideRight + } + } + + Label { + Layout.fillWidth: true + Layout.leftMargin: app.margins + Layout.rightMargin: app.margins + text: packageDetailsPage.pkg.summary + wrapMode: Text.WordWrap + } + MeaListItemDelegate { Layout.fillWidth: true text: qsTr("Installed version:") - subText: packageDetailsPage.pkg.installedVersion + subText: packageDetailsPage.pkg.installedVersion.length > 0 ? packageDetailsPage.pkg.installedVersion : qsTr("Not installed") progressive: false } @@ -215,7 +300,9 @@ Page { text: packageDetailsPage.pkg.updateAvailable ? qsTr("Update") : qsTr("Install") 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 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 or restart during this time.").arg(app.systemName) + + "\n\n" + + qsTr("\nDo you want to proceed?") var popup = dialog.createObject(app, { headerIcon: "../images/system-update.svg", @@ -254,13 +341,11 @@ Page { } UpdateRunningOverlay { - visible: engine.systemController.updateRunning } } } UpdateRunningOverlay { - visible: engine.systemController.updateRunning } }