Commit 2196ed49 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

updates: Offer increased feedback during updates

Adds a tooltip to the "Fetching updates..." label so that users can know
what's holding the update back.

Keeping it in a tooltip since it's something that never should be seen,
except when there's a problem somewhere in the system.
parent 03e22070
......@@ -12,6 +12,7 @@ DiscoverPage
title: i18n("Updates")
property string footerLabel: ""
property string footerToolTip: ""
property int footerProgress: 0
property bool isBusy: false
......@@ -182,6 +183,9 @@ DiscoverPage
Layout.alignment: Qt.AlignHCenter
horizontalAlignment: Text.AlignHCenter
text: page.footerLabel
ToolTip.text: page.footerToolTip
ToolTip.visible: hovered && page.footerToolTip.length > 0
ToolTip.delay: Kirigami.Units.toolTipDelay
level: 3
}
Button {
......@@ -345,6 +349,17 @@ DiscoverPage
PropertyChanges { target: page; footerLabel: i18nc("@info", "Fetching updates...") }
PropertyChanges { target: statusLabel; enabled: true }
PropertyChanges { target: page; footerProgress: ResourcesModel.fetchingUpdatesProgress }
PropertyChanges { target: page; footerToolTip: {
var ret = "";
for (var i in ResourcesModel.backends) {
var backend = ResourcesModel.backends[i]
if (!backend.isFetching)
continue
ret += i18n("%1 (%2%)\n", backend.name, backend.fetchingUpdatesProgress)
}
return ret
}
}
PropertyChanges { target: page; isBusy: true }
PropertyChanges { target: updatesView; opacity: 0 }
},
......
......@@ -62,6 +62,7 @@ class DISCOVERCOMMON_EXPORT AbstractResourcesBackend : public QObject
Q_PROPERTY(QString displayName READ displayName CONSTANT)
Q_PROPERTY(AbstractReviewsBackend* reviewsBackend READ reviewsBackend CONSTANT)
Q_PROPERTY(int updatesCount READ updatesCount NOTIFY updatesCountChanged)
Q_PROPERTY(int fetchingUpdatesProgress READ fetchingUpdatesProgress NOTIFY fetchingUpdatesProgressChanged)
Q_PROPERTY(bool hasSecurityUpdates READ hasSecurityUpdates NOTIFY updatesCountChanged)
Q_PROPERTY(bool isFetching READ isFetching NOTIFY fetchingChanged)
Q_PROPERTY(bool hasApplications READ hasApplications CONSTANT)
......
......@@ -357,14 +357,9 @@ void ResourcesModel::checkForUpdates()
backend->checkForUpdates();
}
QVector<AbstractResourcesBackend *> ResourcesModel::applicationBackends() const
QVariantList ResourcesModel::backendsVariant() const
{
return kFilter<QVector<AbstractResourcesBackend*>>(m_backends, [](AbstractResourcesBackend* b){ return b->hasApplications(); });
}
QVariantList ResourcesModel::applicationBackendsVariant() const
{
return kTransform<QVariantList>(applicationBackends(), [](AbstractResourcesBackend* b) {return QVariant::fromValue<QObject*>(b);});
return kTransform<QVariantList>(m_backends, [](AbstractResourcesBackend* b) {return QVariant::fromValue<QObject*>(b);});
}
AbstractResourcesBackend* ResourcesModel::currentApplicationBackend() const
......
......@@ -69,7 +69,7 @@ class DISCOVERCOMMON_EXPORT ResourcesModel : public QObject
Q_PROPERTY(int updatesCount READ updatesCount NOTIFY updatesCountChanged)
Q_PROPERTY(bool hasSecurityUpdates READ hasSecurityUpdates NOTIFY updatesCountChanged)
Q_PROPERTY(bool isFetching READ isFetching NOTIFY fetchingChanged)
Q_PROPERTY(QVariantList applicationBackends READ applicationBackendsVariant NOTIFY backendsChanged)
Q_PROPERTY(QVariantList backends READ backendsVariant NOTIFY backendsChanged)
Q_PROPERTY(AbstractResourcesBackend* currentApplicationBackend READ currentApplicationBackend WRITE setCurrentApplicationBackend NOTIFY currentApplicationBackendChanged)
Q_PROPERTY(QAction* updateAction READ updateAction CONSTANT)
Q_PROPERTY(int fetchingUpdatesProgress READ fetchingUpdatesProgress NOTIFY fetchingUpdatesProgressChanged)
......@@ -96,8 +96,7 @@ class DISCOVERCOMMON_EXPORT ResourcesModel : public QObject
QString applicationSourceName() const;
QVariantList applicationBackendsVariant() const;
QVector<AbstractResourcesBackend*> applicationBackends() const;
QVariantList backendsVariant() const;
void setCurrentApplicationBackend(AbstractResourcesBackend* backend, bool writeConfig = true);
AbstractResourcesBackend* currentApplicationBackend() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment