summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-11-28 08:55:05 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-11-28 08:55:05 (GMT)
commit86494383d58646a366df4d4d4dac357e6a9b5fb9 (patch)
treeb01b1b432de5254cd36fdc28496e4affaea3a2ff
parentd9d9503fe39f772b40ec43a3022a715e6374eb58 (diff)
downloadswift-contrib-86494383d58646a366df4d4d4dac357e6a9b5fb9.zip
swift-contrib-86494383d58646a366df4d4d4dac357e6a9b5fb9.tar.bz2
Removed dummy autoupdater.
-rw-r--r--SwifTools/AutoUpdater/DummyAutoUpdater.h10
-rw-r--r--SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.cpp14
-rw-r--r--SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.h2
-rw-r--r--SwifTools/AutoUpdater/SparkleAutoUpdater.mm1
-rw-r--r--Swift/QtUI/QtSwift.cpp9
5 files changed, 20 insertions, 16 deletions
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 <cassert>
+
#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() {