Improve system update views

This commit is contained in:
Michael Zanetti 2019-05-20 22:25:19 +02:00
parent 46dc3fee96
commit a6edb7f39e
13 changed files with 586 additions and 72 deletions

View File

@ -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;

View File

@ -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 &params)
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");
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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<int, QByteArray> Packages::roleNames() const
QHash<int, QByteArray> 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();

View File

@ -13,6 +13,7 @@ public:
enum Roles {
RoleId,
RoleDisplayName,
RoleSummary,
RoleInstalledVersion,
RoleCandidateVersion,
RoleChangelog,

View File

@ -1905,6 +1905,14 @@ Bitte versuche es erneut.</translation>
<source>Time zone</source>
<translation>Zeitzone</translation>
</message>
<message>
<source>Reboot %1:core</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Shutdown %1:core</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>GenericDeviceListPage</name>
@ -2715,6 +2723,17 @@ Bitte versuche es erneut.</translation>
<source>Disconnect</source>
<translation>Trennen</translation>
</message>
<message>
<source>System update in progress...</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<source>%n system update(s) available</source>
<translation type="unfinished">
<numerusform>%n System-Update verfügbar</numerusform>
<numerusform>%n System-Updates verfügbar</numerusform>
</translation>
</message>
</context>
<context>
<name>ManualConnectPage</name>
@ -3467,6 +3486,18 @@ Bitte versuche es erneut.</translation>
<source>OK</source>
<translation>OK</translation>
</message>
<message>
<source>Use a thing&apos;s state value</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Insert value here</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select a state</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SelectStateDescriptorParamsPage</name>
@ -3483,6 +3514,13 @@ Bitte versuche es erneut.</translation>
<translation>Optionen</translation>
</message>
</context>
<context>
<name>SelectStatePage</name>
<message>
<source>Select state</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SelectThingPage</name>
<message>
@ -3546,6 +3584,14 @@ Bitte versuche es erneut.</translation>
<source>Sensors</source>
<translation>Sensoren</translation>
</message>
<message>
<source>is closed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>is open</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ServerConfigurationDialog</name>
@ -3764,6 +3810,14 @@ Bitte versuche es erneut.</translation>
<source>Find server UUID and versions</source>
<translation>Finde Server UUID und Versionen</translation>
</message>
<message>
<source>System update</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Update your %1:core system</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SetupWizard</name>
@ -3942,6 +3996,84 @@ Bitte versuche es erneut.</translation>
<translation type="vanished">Logansicht</translation>
</message>
</context>
<context>
<name>SystemUpdatePage</name>
<message>
<source>System update</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Configure updates</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Show all packages</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Your system is up to date.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>There are %1 updates available.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Update all</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>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?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Configure update sources</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>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.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable package source</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>All packages</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Installed version:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Candidate version:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Update</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Install</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Start update</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Remove</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Remove package</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TimeEventDelegate</name>
<message>
@ -4005,6 +4137,14 @@ Bitte versuche es erneut.</translation>
<translation>jährlich</translation>
</message>
</context>
<context>
<name>UpdateRunningOverlay</name>
<message>
<source>An update operation is currently running.
Please wait for it to complete.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>WeatherDeviceListPage</name>
<message>

View File

@ -1475,6 +1475,14 @@ Please try again.</source>
<source>Time zone</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Reboot %1:core</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Shutdown %1:core</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>GenericDeviceListPage</name>
@ -2184,6 +2192,17 @@ Please try again.</source>
<source>Disconnect</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>System update in progress...</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<source>%n system update(s) available</source>
<translation type="unfinished">
<numerusform>%n system update available</numerusform>
<numerusform>%n system updates available</numerusform>
</translation>
</message>
</context>
<context>
<name>ManualConnectPage</name>
@ -2783,6 +2802,18 @@ Please try again.</source>
<source>OK</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Use a thing&apos;s state value</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Insert value here</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select a state</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SelectStateDescriptorParamsPage</name>
@ -2795,6 +2826,13 @@ Please try again.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SelectStatePage</name>
<message>
<source>Select state</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SelectThingPage</name>
<message>
@ -2850,6 +2888,14 @@ Please try again.</source>
<source>Sensors</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>is closed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>is open</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ServerConfigurationDialog</name>
@ -2968,6 +3014,14 @@ Please try again.</source>
<source>Find server UUID and versions</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>System update</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Update your %1:core system</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SetupWizard</name>
@ -3099,6 +3153,84 @@ Please try again.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SystemUpdatePage</name>
<message>
<source>System update</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Configure updates</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Show all packages</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Your system is up to date.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>There are %1 updates available.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Update all</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>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?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Configure update sources</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>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.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable package source</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>All packages</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Installed version:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Candidate version:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Update</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Install</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Start update</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Remove</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Remove package</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TimeEventDelegate</name>
<message>
@ -3162,6 +3294,14 @@ Please try again.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UpdateRunningOverlay</name>
<message>
<source>An update operation is currently running.
Please wait for it to complete.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>WeatherDeviceListPage</name>
<message>

View File

@ -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 {

View File

@ -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"
}
}
}

View File

@ -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()
})
}
}
}

View File

@ -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
}
}