diff options
| author | Remko Tronçon <git@el-tramo.be> | 2009-11-28 08:55:05 (GMT) |
|---|---|---|
| committer | Remko Tronçon <git@el-tramo.be> | 2009-11-28 08:55:05 (GMT) |
| commit | 86494383d58646a366df4d4d4dac357e6a9b5fb9 (patch) | |
| tree | b01b1b432de5254cd36fdc28496e4affaea3a2ff | |
| parent | d9d9503fe39f772b40ec43a3022a715e6374eb58 (diff) | |
| download | swift-86494383d58646a366df4d4d4dac357e6a9b5fb9.zip swift-86494383d58646a366df4d4d4dac357e6a9b5fb9.tar.bz2 | |
Removed dummy autoupdater.
| -rw-r--r-- | SwifTools/AutoUpdater/DummyAutoUpdater.h | 10 | ||||
| -rw-r--r-- | SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.cpp | 14 | ||||
| -rw-r--r-- | SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.h | 2 | ||||
| -rw-r--r-- | SwifTools/AutoUpdater/SparkleAutoUpdater.mm | 1 | ||||
| -rw-r--r-- | Swift/QtUI/QtSwift.cpp | 9 |
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,20 +1,28 @@ #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 @@ -1,10 +1,12 @@ #include "Swiften/Base/String.h" namespace Swift { class AutoUpdater; 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 @@ -1,33 +1,34 @@ #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]; + [d->updater setAutomaticallyChecksForUpdates: true]; 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]; } } 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 @@ -1,82 +1,85 @@ #include "QtSwift.h" #include "QtLoginWindowFactory.h" #include "QtChatWindowFactory.h" #include "QtLoginWindow.h" #include "QtChatTabs.h" #include "QtMainWindowFactory.h" #include "Roster/QtTreeWidgetFactory.h" #include "QtSystemTray.h" #include "QtSoundPlayer.h" #include "QtXMLConsoleWidgetFactory.h" #include <boost/bind.hpp> #include <QSplitter> #include "Swiften/Application/Application.h" #include "Swiften/Application/Platform/PlatformApplication.h" #include "Swiften/Base/String.h" #include "Swiften/Base/Platform.h" #include "Swiften/Elements/Presence.h" #include "Swiften/Client/Client.h" #include "Swift/Controllers/ChatController.h" #include "Swift/Controllers/MainController.h" #include "Swift/QtUI/BuildVersion.h" #include "SwifTools/AutoUpdater/AutoUpdater.h" #include "SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.h" namespace Swift{ #if defined(SWIFTEN_PLATFORM_MACOSX) #define SWIFT_APPCAST_URL "http://swift.im/appcast/psi-mac-dev.xml" #else #define SWIFT_APPCAST_URL "" #endif -QtSwift::QtSwift(bool netbookMode) { +QtSwift::QtSwift(bool netbookMode) : autoUpdater_(NULL) { if (netbookMode) { splitter_ = new QSplitter(); } else { splitter_ = NULL; } QCoreApplication::setApplicationName("Swift"); QCoreApplication::setOrganizationName("Swift"); QCoreApplication::setOrganizationDomain("swift.im"); QCoreApplication::setApplicationVersion(buildVersion); tabs_ = new QtChatTabs(); settings_ = new QtSettingsProvider(); application_ = new PlatformApplication("Swift"); treeWidgetFactory_ = new QtTreeWidgetFactory(); systemTray_ = new QtSystemTray(); loginWindowFactory_ = new QtLoginWindowFactory(splitter_, systemTray_, settings_); chatWindowFactory_ = new QtChatWindowFactory(treeWidgetFactory_, splitter_, settings_, tabs_); rosterWindowFactory_ = new QtMainWindowFactory(treeWidgetFactory_); xmlConsoleWidgetFactory_ = new QtXMLConsoleWidgetFactory(tabs_); soundPlayer_ = new QtSoundPlayer(); if (splitter_) { splitter_->show(); } 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() { delete autoUpdater_; delete chatWindowFactory_; delete rosterWindowFactory_; delete loginWindowFactory_; delete treeWidgetFactory_; delete mainController_; delete settings_; delete application_; delete systemTray_; delete splitter_; delete soundPlayer_; delete tabs_; delete xmlConsoleWidgetFactory_; } } |
Swift