diff options
Diffstat (limited to 'SwifTools/AutoUpdater')
-rw-r--r-- | SwifTools/AutoUpdater/AutoUpdater.cpp | 8 | ||||
-rw-r--r-- | SwifTools/AutoUpdater/AutoUpdater.h | 10 | ||||
-rw-r--r-- | SwifTools/AutoUpdater/SparkleAutoUpdater.h | 18 | ||||
-rw-r--r-- | SwifTools/AutoUpdater/SparkleAutoUpdater.mm | 33 |
4 files changed, 69 insertions, 0 deletions
diff --git a/SwifTools/AutoUpdater/AutoUpdater.cpp b/SwifTools/AutoUpdater/AutoUpdater.cpp new file mode 100644 index 0000000..cd0eb0b --- /dev/null +++ b/SwifTools/AutoUpdater/AutoUpdater.cpp @@ -0,0 +1,8 @@ +#include "SwifTools/AutoUpdater/AutoUpdater.h" + +namespace Swift { + +AutoUpdater::~AutoUpdater() { +} + +} diff --git a/SwifTools/AutoUpdater/AutoUpdater.h b/SwifTools/AutoUpdater/AutoUpdater.h new file mode 100644 index 0000000..c1a73f1 --- /dev/null +++ b/SwifTools/AutoUpdater/AutoUpdater.h @@ -0,0 +1,10 @@ +#pragma once + +namespace Swift { + class AutoUpdater { + public: + virtual ~AutoUpdater(); + + virtual void checkForUpdates() = 0; + }; +} diff --git a/SwifTools/AutoUpdater/SparkleAutoUpdater.h b/SwifTools/AutoUpdater/SparkleAutoUpdater.h new file mode 100644 index 0000000..37053fc --- /dev/null +++ b/SwifTools/AutoUpdater/SparkleAutoUpdater.h @@ -0,0 +1,18 @@ +#pragma once + +#include "Swiften/Base/String.h" +#include "SwifTools/AutoUpdater/AutoUpdater.h" + +namespace Swift { + class SparkleAutoUpdater : public AutoUpdater { + public: + SparkleAutoUpdater(const String& url); + ~SparkleAutoUpdater(); + + void checkForUpdates(); + + private: + class Private; + Private* d; + }; +} diff --git a/SwifTools/AutoUpdater/SparkleAutoUpdater.mm b/SwifTools/AutoUpdater/SparkleAutoUpdater.mm new file mode 100644 index 0000000..30e2ae2 --- /dev/null +++ b/SwifTools/AutoUpdater/SparkleAutoUpdater.mm @@ -0,0 +1,33 @@ +#include "SwifTools/AutoUpdater/SparkleAutoUpdater.h" + +#include <Cocoa/Cocoa.h> +#include <Sparkle/Sparkle.h> + +namespace Swift { + +class SparkleAutoUpdater::Private { + public: + SUUpdater* updater; +}; + +SparkleAutoUpdater::SparkleAutoUpdater(const String& url) { + d = new Private; + + d->updater = [SUUpdater sharedUpdater]; + [d->updater retain]; + + NSURL* nsurl = [NSURL URLWithString: + [NSString stringWithUTF8String: url.getUTF8Data()]]; + [d->updater setFeedURL: nsurl]; +} + +SparkleAutoUpdater::~SparkleAutoUpdater() { + [d->updater release]; + delete d; +} + +void SparkleAutoUpdater::checkForUpdates() { + [d->updater checkForUpdatesInBackground]; +} + +} |