Zhenkai Zhu | aca6cb5 | 2013-02-24 23:34:03 -0800 | [diff] [blame^] | 1 | #include "sparkle-auto-update.h" |
| 2 | #import <Sparkle/Sparkle.h> |
| 3 | |
| 4 | class SparkleAutoUpdate::Private |
| 5 | { |
| 6 | public: |
| 7 | SUUpdater *updater; |
| 8 | }; |
| 9 | |
| 10 | SparkleAutoUpdate::SparkleAutoUpdate(const QString &updateUrl) |
| 11 | { |
| 12 | d = new Private; |
| 13 | d->updater = [SUUpdater sharedUpdater]; |
| 14 | [d->updater setAutomaticallyChecksForUpdates:YES]; |
| 15 | NSURL *url = [NSURL URLWithString: [NSString stringWithUTF8String: updateUrl.toUtf8().data()]]; |
| 16 | [d->updater setFeedURL: url]; |
| 17 | } |
| 18 | |
| 19 | SparkleAutoUpdate::~SparkleAutoUpdate() |
| 20 | { |
| 21 | delete d; |
| 22 | // presummably SUUpdater handles garbage collection |
| 23 | } |
| 24 | |
| 25 | void SparkleAutoUpdate::checkForUpdates() |
| 26 | { |
| 27 | [d->updater checkForUpdatesInBackground]; |
| 28 | } |