Explorar el Código

Properly display status string for changes in updater

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
Claudio Cambra hace 3 años
padre
commit
feb4188b2b
Se han modificado 2 ficheros con 14 adiciones y 16 borrados
  1. 2 0
      src/gui/updater/sparkleupdater.h
  2. 12 16
      src/gui/updater/sparkleupdater_mac.mm

+ 2 - 0
src/gui/updater/sparkleupdater.h

@@ -45,6 +45,8 @@ signals:
 
 private:
     std::unique_ptr<SparkleInterface> _interface;
+    QString _statusString;
+    friend class SparkleInterface;
 };
 
 } // namespace OCC

+ 12 - 16
src/gui/updater/sparkleupdater_mac.mm

@@ -38,8 +38,9 @@ public:
         [delegate release];
     }
 
-    void statusChanged()
+    void statusChanged(const QString &statusString)
     {
+        q->_statusString = statusString;
         emit q->statusChanged();
     }
 
@@ -78,9 +79,10 @@ private:
     return YES;
 }
 
-- (void)notifyChange
+- (void)notifyChange:(const QString&)statusString
 {
-    _owner->statusChanged();
+    qCDebug(OCC::lcUpdater) << statusString;
+    _owner->statusChanged(statusString);
 }
 
 // Sent when a valid update is found by the update driver.
@@ -88,16 +90,14 @@ private:
 {
     Q_UNUSED(updater)
     Q_UNUSED(update)
-    qCDebug(OCC::lcUpdater) << "Found a valid update.";
-    [self notifyChange];
+    [self notifyChange:QStringLiteral("Found a valid update.")];
 }
 
 // Sent when a valid update is not found.
 - (void)updaterDidNotFindUpdate:(SUUpdater *)update
 {
     Q_UNUSED(update)
-    qCDebug(OCC::lcUpdater) << "No valid update found.";
-    [self notifyChange];
+    [self notifyChange:QStringLiteral("No valid update found.")];
 }
 
 // Sent immediately before installing the specified update.
@@ -105,24 +105,21 @@ private:
 {
     Q_UNUSED(updater)
     Q_UNUSED(update)
-    qCDebug(OCC::lcUpdater) << "About to install update.";
-    [self notifyChange];
+    [self notifyChange:QStringLiteral("About to install update.")];
 }
 
 - (void)updater:(SUUpdater *)updater didAbortWithError:(NSError *)error
 {
     Q_UNUSED(updater)
-    qCDebug(OCC::lcUpdater) << error.description;
-    [self notifyChange];
+    const QString message(QStringLiteral("Aborted with error: ") + QString::fromNSString(error.description));
+    [self notifyChange:message];
 }
 
 - (void)updater:(SUUpdater *)updater didFinishLoadingAppcast:(SUAppcast *)appcast
 {
     Q_UNUSED(updater)
     Q_UNUSED(appcast)
-
-    qCDebug(OCC::lcUpdater) << "Finished loading appcast.";
-    [self notifyChange];
+    [self notifyChange:QStringLiteral("Finished loading appcast.")];
 }
 
 
@@ -200,8 +197,7 @@ void SparkleUpdater::backgroundCheckForUpdate()
 
 QString SparkleUpdater::statusString()
 {
-    // FIXME Show the real state depending on the callbacks
-    return QString();
+    return _statusString;
 }
 
 } // namespace OCC