From 86494383d58646a366df4d4d4dac357e6a9b5fb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Sat, 28 Nov 2009 09:55:05 +0100 Subject: Removed dummy autoupdater. diff --git a/SwifTools/AutoUpdater/DummyAutoUpdater.h b/SwifTools/AutoUpdater/DummyAutoUpdater.h deleted file mode 100644 index bdddb2a..0000000 --- a/SwifTools/AutoUpdater/DummyAutoUpdater.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -#include "SwifTools/AutoUpdater/AutoUpdater.h" - -namespace Swift { - class DummyAutoUpdater : public AutoUpdater { - public: - void checkForUpdates() {} - }; -} diff --git a/SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.cpp b/SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.cpp index 90c27bd..4f591f5 100644 --- a/SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.cpp +++ b/SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.cpp @@ -1,19 +1,27 @@ #include "SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.h" +#include + #ifdef HAVE_SPARKLE #include "SwifTools/AutoUpdater/SparkleAutoUpdater.h" -#else -#include "SwifTools/AutoUpdater/DummyAutoUpdater.h" #endif namespace Swift { +bool PlatformAutoUpdaterFactory::isSupported() const { +#ifdef HAVE_SPARKLE + return true; +#else + return false; +#endif +} + AutoUpdater* PlatformAutoUpdaterFactory::createAutoUpdater(const String& appcastURL) { #ifdef HAVE_SPARKLE return new SparkleAutoUpdater(appcastURL); #else (void) appcastURL; - return new DummyAutoUpdater(); + return NULL; #endif } diff --git a/SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.h b/SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.h index 6d16c68..76520e2 100644 --- a/SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.h +++ b/SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.h @@ -5,6 +5,8 @@ namespace Swift { class PlatformAutoUpdaterFactory { public: + bool isSupported() const; + AutoUpdater* createAutoUpdater(const String& appcastURL); }; } diff --git a/SwifTools/AutoUpdater/SparkleAutoUpdater.mm b/SwifTools/AutoUpdater/SparkleAutoUpdater.mm index 30e2ae2..a8ae60a 100644 --- a/SwifTools/AutoUpdater/SparkleAutoUpdater.mm +++ b/SwifTools/AutoUpdater/SparkleAutoUpdater.mm @@ -15,6 +15,7 @@ SparkleAutoUpdater::SparkleAutoUpdater(const String& url) { d->updater = [SUUpdater sharedUpdater]; [d->updater retain]; + [d->updater setAutomaticallyChecksForUpdates: true]; NSURL* nsurl = [NSURL URLWithString: [NSString stringWithUTF8String: url.getUTF8Data()]]; diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp index 370d7c3..383e5ca 100644 --- a/Swift/QtUI/QtSwift.cpp +++ b/Swift/QtUI/QtSwift.cpp @@ -33,7 +33,7 @@ namespace Swift{ #endif -QtSwift::QtSwift(bool netbookMode) { +QtSwift::QtSwift(bool netbookMode) : autoUpdater_(NULL) { if (netbookMode) { splitter_ = new QSplitter(); } else { @@ -59,8 +59,11 @@ QtSwift::QtSwift(bool netbookMode) { } mainController_ = new MainController(chatWindowFactory_, rosterWindowFactory_, loginWindowFactory_, treeWidgetFactory_, settings_, application_, systemTray_, soundPlayer_, xmlConsoleWidgetFactory_); - autoUpdater_ = PlatformAutoUpdaterFactory().createAutoUpdater(SWIFT_APPCAST_URL); - autoUpdater_->checkForUpdates(); + PlatformAutoUpdaterFactory autoUpdaterFactory; + if (autoUpdaterFactory.isSupported()) { + autoUpdater_ = autoUpdaterFactory.createAutoUpdater(SWIFT_APPCAST_URL); + autoUpdater_->checkForUpdates(); + } } QtSwift::~QtSwift() { -- cgit v0.10.2-6-g49f6