diff options
author | Tobias Markmann <tm@ayena.de> | 2016-11-11 11:28:53 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-11-11 13:50:52 (GMT) |
commit | 97c87cf3e9b5e150152898e7907577c3ca3fdd86 (patch) | |
tree | 17c23b1a10537261e0d1e662493cc4ddf137026c /SwifTools/AutoUpdater | |
parent | 94ec9c25311f8d54519f045205d58526d885412a (diff) | |
download | swift-97c87cf3e9b5e150152898e7907577c3ca3fdd86.zip swift-97c87cf3e9b5e150152898e7907577c3ca3fdd86.tar.bz2 |
Add update channel configuration dialog to the about window
If software updates are enabled the about dialog will show
the currently configured update channel and provides a link
to a dialog to change the update channel.
Test-Information:
Builds on macOS 10.12.1, unit tests pass, and dialogs behave
as expected. Did not test Sparkle updating.
Change-Id: I05d5014f0d719ba9b2146c1e599db4f7fde80558
Diffstat (limited to 'SwifTools/AutoUpdater')
-rw-r--r-- | SwifTools/AutoUpdater/AutoUpdater.h | 3 | ||||
-rw-r--r-- | SwifTools/AutoUpdater/SparkleAutoUpdater.h | 3 | ||||
-rw-r--r-- | SwifTools/AutoUpdater/SparkleAutoUpdater.mm | 9 |
3 files changed, 12 insertions, 3 deletions
diff --git a/SwifTools/AutoUpdater/AutoUpdater.h b/SwifTools/AutoUpdater/AutoUpdater.h index ed53e11..274bf50 100644 --- a/SwifTools/AutoUpdater/AutoUpdater.h +++ b/SwifTools/AutoUpdater/AutoUpdater.h @@ -6,6 +6,8 @@ #pragma once +#include <string> + #include <boost/signals2.hpp> namespace Swift { @@ -13,6 +15,7 @@ namespace Swift { public: virtual ~AutoUpdater(); + virtual void setAppcastFeed(const std::string& appcastFeed) = 0; virtual void checkForUpdates() = 0; virtual bool recommendRestartToUpdate() = 0; diff --git a/SwifTools/AutoUpdater/SparkleAutoUpdater.h b/SwifTools/AutoUpdater/SparkleAutoUpdater.h index 41a25f0..dd22e73 100644 --- a/SwifTools/AutoUpdater/SparkleAutoUpdater.h +++ b/SwifTools/AutoUpdater/SparkleAutoUpdater.h @@ -20,9 +20,10 @@ namespace Swift { */ class SparkleAutoUpdater : public AutoUpdater { public: - SparkleAutoUpdater(const std::string& url); + SparkleAutoUpdater(const std::string& appcastFeed); ~SparkleAutoUpdater(); + void setAppcastFeed(const std::string& appcastFeed); void checkForUpdates(); bool recommendRestartToUpdate(); diff --git a/SwifTools/AutoUpdater/SparkleAutoUpdater.mm b/SwifTools/AutoUpdater/SparkleAutoUpdater.mm index 6b27ba7..ed5f094 100644 --- a/SwifTools/AutoUpdater/SparkleAutoUpdater.mm +++ b/SwifTools/AutoUpdater/SparkleAutoUpdater.mm @@ -21,7 +21,7 @@ class SparkleAutoUpdater::Private { bool restartToUpdate = false; }; -SparkleAutoUpdater::SparkleAutoUpdater(const std::string& url) : d(new Private()) { +SparkleAutoUpdater::SparkleAutoUpdater(const std::string& appcastFeed) : d(new Private()) { d->updater = [SUUpdater sharedUpdater]; [d->updater retain]; @@ -37,7 +37,7 @@ SparkleAutoUpdater::SparkleAutoUpdater(const std::string& url) : d(new Private() [d->updater setUpdateCheckInterval: 86400]; [d->updater setAutomaticallyDownloadsUpdates: true]; - NSURL* nsurl = [NSURL URLWithString: std2NSString(url)]; + NSURL* nsurl = [NSURL URLWithString: std2NSString(appcastFeed)]; [d->updater setFeedURL: nsurl]; } @@ -45,6 +45,11 @@ SparkleAutoUpdater::~SparkleAutoUpdater() { [d->updater release]; } +void SparkleAutoUpdater::setAppcastFeed(const std::string& appcastFeed) { + NSURL* nsurl = [NSURL URLWithString: std2NSString(appcastFeed)]; + [d->updater setFeedURL: nsurl]; +} + void SparkleAutoUpdater::checkForUpdates() { //[d->updater resetUpdateCycle]; // This is useful for testing to force a check ot start. [d->updater checkForUpdatesInBackground]; |