From 41e89bb5ed1a9d38d1ece1310ef708daad54a9a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be> Date: Sun, 12 Sep 2010 18:10:50 +0200 Subject: Moved application message display around. diff --git a/SwifTools/Dock/Dock.cpp b/SwifTools/Dock/Dock.cpp new file mode 100644 index 0000000..77bcd84 --- /dev/null +++ b/SwifTools/Dock/Dock.cpp @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2010 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include "SwifTools/Dock/Dock.h" + +namespace Swift { + +Dock::~Dock() { +} + +} diff --git a/SwifTools/Dock/Dock.h b/SwifTools/Dock/Dock.h new file mode 100644 index 0000000..a1c652d --- /dev/null +++ b/SwifTools/Dock/Dock.h @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2010 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +namespace Swift { + class String; + + class Dock { + public: + virtual ~Dock(); + + virtual void setMessage(const String& message) = 0; + }; +} diff --git a/SwifTools/Dock/MacOSXDock.h b/SwifTools/Dock/MacOSXDock.h new file mode 100644 index 0000000..e9667a6 --- /dev/null +++ b/SwifTools/Dock/MacOSXDock.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2010 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include "SwifTools/Dock/Dock.h" + +namespace Swift { + class String; + class CocoaApplication; + + class MacOSXDock : public Dock { + public: + MacOSXDock(CocoaApplication* application); + + void setMessage(const String& label); + }; +} diff --git a/SwifTools/Dock/MacOSXDock.mm b/SwifTools/Dock/MacOSXDock.mm new file mode 100644 index 0000000..d2a06b3 --- /dev/null +++ b/SwifTools/Dock/MacOSXDock.mm @@ -0,0 +1,20 @@ +#include "SwifTools/Dock/MacOSXDock.h" + +#include <AppKit/AppKit.h> +#include <Cocoa/Cocoa.h> + +#include "Swiften/Base/String.h" + +namespace Swift { + +MacOSXDock::MacOSXDock(CocoaApplication*) { +} + +void MacOSXDock::setMessage(const String& label) { + NSString *labelString = [[NSString alloc] initWithUTF8String: label.getUTF8Data()]; + [[NSApp dockTile] setBadgeLabel: labelString]; + [labelString release]; + [NSApp requestUserAttention: NSInformationalRequest]; +} + +} diff --git a/SwifTools/Dock/NullDock.h b/SwifTools/Dock/NullDock.h new file mode 100644 index 0000000..f2d27b7 --- /dev/null +++ b/SwifTools/Dock/NullDock.h @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2010 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include "SwifTools/Dock/Dock.h" + +namespace Swift { + class NullDock : public Dock { + public: + NullDock() {} + + virtual void setMessage(const String&) { + } + }; +} diff --git a/SwifTools/Dock/SConscript b/SwifTools/Dock/SConscript new file mode 100644 index 0000000..94797cb --- /dev/null +++ b/SwifTools/Dock/SConscript @@ -0,0 +1,13 @@ +Import("swiftools_env") + +sources = [ + "Dock.cpp", + ] + +if swiftools_env["PLATFORM"] == "darwin" and swiftools_env["target"] == "native" : + sources += [ + "MacOSXDock.mm", + ] + +objects = swiftools_env.StaticObject(sources) +swiftools_env.Append(SWIFTOOLS_OBJECTS = objects) diff --git a/SwifTools/SConscript b/SwifTools/SConscript index 7620879..2675b9f 100644 --- a/SwifTools/SConscript +++ b/SwifTools/SConscript @@ -15,8 +15,8 @@ if env["SCONS_STAGE"] == "flags" : ################################################################################ if env["SCONS_STAGE"] == "build" : - myenv = env.Clone() - myenv.MergeFlags(myenv["BOOST_FLAGS"]) + swiftools_env = env.Clone() + swiftools_env.MergeFlags(swiftools_env["BOOST_FLAGS"]) sources = [ "Idle/IdleDetector.cpp", @@ -29,24 +29,29 @@ if env["SCONS_STAGE"] == "build" : "TabComplete.cpp", ] - if myenv.get("HAVE_SPARKLE", 0) : - myenv.MergeFlags(myenv["SPARKLE_FLAGS"]) - myenv.Append(CPPDEFINES = ["HAVE_SPARKLE"]) + if swiftools_env.get("HAVE_SPARKLE", 0) : + swiftools_env.MergeFlags(swiftools_env["SPARKLE_FLAGS"]) + swiftools_env.Append(CPPDEFINES = ["HAVE_SPARKLE"]) sources += ["AutoUpdater/SparkleAutoUpdater.mm"] - if myenv["PLATFORM"] == "win32" : + if swiftools_env["PLATFORM"] == "win32" : sources += ["Idle/WindowsIdleQuerier.cpp"] - elif myenv["PLATFORM"] == "darwin" and myenv.get("HAVE_IOKIT", False) : - myenv.Append(CPPDEFINES = ["HAVE_IOKIT"]) + elif swiftools_env["PLATFORM"] == "darwin" and swiftools_env.get("HAVE_IOKIT", False) : + swiftools_env.Append(CPPDEFINES = ["HAVE_IOKIT"]) sources += ["Idle/MacOSXIdleQuerier.cpp"] - elif myenv["HAVE_XSS"] : - myenv.Append(CPPDEFINES = ["HAVE_XSS"]) + elif swiftools_env["HAVE_XSS"] : + swiftools_env.Append(CPPDEFINES = ["HAVE_XSS"]) sources += ["Idle/XSSIdleQuerier.cpp"] - - myenv.StaticLibrary("SwifTools", sources) - + + swiftools_env["SWIFTOOLS_OBJECTS"] = [] + Export("swiftools_env") + SConscript(dirs = [ + "Dock", "Idle/IdleQuerierTest", "Idle/UnitTest", "UnitTest" ]) + + swiftools_env.StaticLibrary("SwifTools", sources + swiftools_env["SWIFTOOLS_OBJECTS"]) + \ No newline at end of file diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index afffa59..04112ea 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp @@ -12,8 +12,6 @@ #include <stdlib.h> #include <sstream> -#include "Swiften/Application/Application.h" -#include "Swiften/Application/ApplicationMessageDisplay.h" #include "Swiften/Network/TimerFactory.h" #include "Swiften/Network/BoostIOServiceThread.h" #include "Swiften/Network/MainBoostIOServiceThread.h" @@ -40,6 +38,7 @@ #include "Swift/Controllers/XMLConsoleController.h" #include "Swift/Controllers/XMPPRosterController.h" #include "Swift/Controllers/UIEvents/UIEventStream.h" +#include "SwifTools/Dock/Dock.h" #include "Swiften/Base/foreach.h" #include "Swiften/Base/String.h" #include "Swiften/Client/Client.h" @@ -83,7 +82,7 @@ MainController::MainController( AvatarStorage* avatarStorage, CapsStorage* capsStorage, VCardStorageFactory* vcardStorageFactory, - ApplicationMessageDisplay* applicationMessageDisplay, + Dock* dock, bool useDelayForLatency) : timerFactory_(&boostIOServiceThread_.getIOService()), idleDetector_(&idleQuerier_, &timerFactory_, 100), @@ -114,7 +113,7 @@ MainController::MainController( timeBeforeNextReconnect_ = -1; mucSearchWindowFactory_ = mucSearchWindowFactory; eventWindowFactory_ = eventWindowFactory; - applicationMessageDisplay_ = applicationMessageDisplay; + dock_ = dock; chatListWindowFactory_ = chatListWindowFactory; uiEventStream_ = new UIEventStream(); @@ -291,7 +290,7 @@ void MainController::handleConnected() { } void MainController::handleEventQueueLengthChange(int count) { - applicationMessageDisplay_->setMessage(count == 0 ? "" : boost::lexical_cast<std::string>(count).c_str()); + dock_->setMessage(count == 0 ? "" : boost::lexical_cast<std::string>(count).c_str()); } void MainController::reconnectAfterError() { diff --git a/Swift/Controllers/MainController.h b/Swift/Controllers/MainController.h index 8596ace..7aad4a0 100644 --- a/Swift/Controllers/MainController.h +++ b/Swift/Controllers/MainController.h @@ -46,7 +46,6 @@ namespace Swift { class XMPPRosterController; class PresenceSender; class DiscoInfoResponder; - class ApplicationMessageDisplay; class AvatarManager; class CapsManager; class EntityCapsManager; @@ -70,6 +69,7 @@ namespace Swift { class StatusTracker; class VCardStorageFactory; class MUCRegistry; + class Dock; class MainController { public: @@ -87,7 +87,7 @@ namespace Swift { AvatarStorage* avatarStorage, CapsStorage* capsStorage, VCardStorageFactory* vcardStorageFactory, - ApplicationMessageDisplay* applicationMessageDisplay, + Dock* dock, bool useDelayForLatency); ~MainController(); @@ -133,7 +133,7 @@ namespace Swift { CapsStorage* capsStorage_; VCardStorageFactory* vcardStorageFactory_; VCardManager* vcardManager_; - ApplicationMessageDisplay* applicationMessageDisplay_; + Dock* dock_; ChatController* chatController_; XMPPRosterController* xmppRosterController_; RosterController* rosterController_; diff --git a/Swift/QtUI/QtAboutWidget.cpp b/Swift/QtUI/QtAboutWidget.cpp index e9e6329..e8b0baf 100644 --- a/Swift/QtUI/QtAboutWidget.cpp +++ b/Swift/QtUI/QtAboutWidget.cpp @@ -16,8 +16,6 @@ #include <QFile> #include <QTextStream> -#include "Swiften/Application/Application.h" - namespace Swift { QtAboutWidget::QtAboutWidget() : QDialog() { diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp index e548e29..6606f85 100644 --- a/Swift/QtUI/QtSwift.cpp +++ b/Swift/QtUI/QtSwift.cpp @@ -23,8 +23,6 @@ #include <boost/bind.hpp> #include <QSplitter> -#include "Swiften/Application/Application.h" -#include "Swiften/Application/PlatformApplication.h" #include "Swiften/Application/PlatformApplicationPathProvider.h" #include "Swiften/Avatars/AvatarFileStorage.h" #include "Swiften/Disco/CapsFileStorage.h" @@ -33,11 +31,17 @@ #include "Swiften/Base/Platform.h" #include "Swiften/Elements/Presence.h" #include "Swiften/Client/Client.h" +#include "SwifTools/Dock/PlatformDock.h" #include "Swift/Controllers/MainController.h" #include "Swift/Controllers/ApplicationInfo.h" #include "Swift/Controllers/BuildVersion.h" #include "SwifTools/AutoUpdater/AutoUpdater.h" #include "SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.h" +#if defined(SWIFTEN_PLATFORM_MACOSX) +#include "SwifTools/Dock/MacOSXDock.h" +#else +#include "SwifTools/Dock/NullDock.h" +#endif namespace Swift{ @@ -81,13 +85,19 @@ QtSwift::QtSwift(po::variables_map options) : autoUpdater_(NULL) { tabs_ = options.count("no-tabs") && !(splitter_ > 0) ? NULL : new QtChatTabs(); settings_ = new QtSettingsProvider(); - application_ = new PlatformApplication(SWIFT_APPLICATION_NAME); applicationPathProvider_ = new PlatformApplicationPathProvider(SWIFT_APPLICATION_NAME); avatarStorage_ = new AvatarFileStorage(applicationPathProvider_->getAvatarDir()); vcardStorageFactory_ = new VCardFileStorageFactory(applicationPathProvider_->getDataDir()); capsStorage_ = new CapsFileStorage(applicationPathProvider_->getDataDir() / "caps"); chatWindowFactory_ = new QtChatWindowFactory(splitter_, settings_, tabs_, ""); soundPlayer_ = new QtSoundPlayer(applicationPathProvider_); + +#if defined(SWIFTEN_PLATFORM_MACOSX) + dock_ = new MacOSXDock(&cocoaApplication_); +#else + dock_ = new NullDock(); +#endif + if (splitter_) { splitter_->show(); } @@ -121,7 +131,7 @@ QtSwift::QtSwift(po::variables_map options) : autoUpdater_(NULL) { avatarStorage_, capsStorage_, vcardStorageFactory_, - application_->getApplicationMessageDisplay(), + dock_, options.count("latency-debug") > 0); mainControllers_.push_back(mainController); } @@ -150,12 +160,12 @@ QtSwift::~QtSwift() { delete controller; } delete settings_; - delete application_; foreach (QtSystemTray* tray, systemTrays_) { delete tray; } delete tabs_; delete splitter_; + delete dock_; delete soundPlayer_; foreach (QtXMLConsoleWidgetFactory* factory, xmlConsoleWidgetFactories_) { delete factory; diff --git a/Swift/QtUI/QtSwift.h b/Swift/QtUI/QtSwift.h index 4c570ae..657b749 100644 --- a/Swift/QtUI/QtSwift.h +++ b/Swift/QtUI/QtSwift.h @@ -11,20 +11,24 @@ #include <boost/program_options/options_description.hpp> #include "Swiften/Base/String.h" +#include "Swiften/Base/Platform.h" #include "Swiften/EventLoop/Qt/QtEventLoop.h" #include "QtLoginWindowFactory.h" #include "QtMainWindowFactory.h" #include "QtChatWindowFactory.h" #include "QtSettingsProvider.h" +#if defined(SWIFTEN_PLATFORM_MACOSX) +#include "Swiften/Application/CocoaApplication.h" +#endif namespace po = boost::program_options; class QSplitter; namespace Swift { + class Dock; class VCardStorageFactory; class AutoUpdater; - class Application; class ApplicationPathProvider; class AvatarStorage; class CapsStorage; @@ -59,14 +63,16 @@ namespace Swift { QtSettingsProvider *settings_; QSplitter* splitter_; QtSoundPlayer* soundPlayer_; + Dock* dock_; QtChatTabs* tabs_; - Application* application_; ApplicationPathProvider* applicationPathProvider_; AvatarStorage* avatarStorage_; CapsStorage* capsStorage_; VCardStorageFactory* vcardStorageFactory_; AutoUpdater* autoUpdater_; - +#if defined(SWIFTEN_PLATFORM_MACOSX) + CocoaApplication cocoaApplication_; +#endif }; } diff --git a/Swiften/Application/Application.cpp b/Swiften/Application/Application.cpp deleted file mode 100644 index c9706aa..0000000 --- a/Swiften/Application/Application.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2010 Remko Tronçon - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#include "Swiften/Application/Application.h" - -#include <iostream> -#include <stdlib.h> - -#include "Swiften/Application/ApplicationMessageDisplay.h" - -namespace Swift { - -Application::Application(const String& name) : name_(name) { -} - -Application::~Application() { -} - -} diff --git a/Swiften/Application/Application.h b/Swiften/Application/Application.h deleted file mode 100644 index 98e2881..0000000 --- a/Swiften/Application/Application.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2010 Remko Tronçon - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#pragma once - -#include "Swiften/Base/String.h" - -namespace Swift { - class ApplicationMessageDisplay; - - class Application { - public: - Application(const String& name); - virtual ~Application(); - - const String& getName() const { - return name_; - } - - virtual ApplicationMessageDisplay* getApplicationMessageDisplay() = 0; - - private: - String name_; - }; -} diff --git a/Swiften/Application/ApplicationMessageDisplay.cpp b/Swiften/Application/ApplicationMessageDisplay.cpp deleted file mode 100644 index 4143c15..0000000 --- a/Swiften/Application/ApplicationMessageDisplay.cpp +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 2010 Remko Tronçon - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#include "Swiften/Application/ApplicationMessageDisplay.h" - -namespace Swift { - -ApplicationMessageDisplay::~ApplicationMessageDisplay() { -} - -} diff --git a/Swiften/Application/ApplicationMessageDisplay.h b/Swiften/Application/ApplicationMessageDisplay.h deleted file mode 100644 index 6663e71..0000000 --- a/Swiften/Application/ApplicationMessageDisplay.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2010 Remko Tronçon - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#ifndef SWIFTEN_ApplicationMessageDisplay_H -#define SWIFTEN_ApplicationMessageDisplay_H - -namespace Swift { - class String; - - class ApplicationMessageDisplay { - public: - virtual ~ApplicationMessageDisplay(); - - virtual void setMessage(const String& message) = 0; - }; -} - -#endif diff --git a/Swiften/Application/ApplicationPathProvider.cpp b/Swiften/Application/ApplicationPathProvider.cpp index f24aa2e..634f183 100644 --- a/Swiften/Application/ApplicationPathProvider.cpp +++ b/Swiften/Application/ApplicationPathProvider.cpp @@ -4,8 +4,6 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#include "Swiften/Application/Application.h" - #include <boost/filesystem.hpp> #include <iostream> diff --git a/Swiften/Application/CocoaApplication.h b/Swiften/Application/CocoaApplication.h new file mode 100644 index 0000000..3b19d28 --- /dev/null +++ b/Swiften/Application/CocoaApplication.h @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2010 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +namespace Swift { + class CocoaApplication { + public: + CocoaApplication(); + ~CocoaApplication(); + + private: + class Private; + Private* d; + }; +} diff --git a/Swiften/Application/CocoaApplication.mm b/Swiften/Application/CocoaApplication.mm new file mode 100644 index 0000000..c5b3335 --- /dev/null +++ b/Swiften/Application/CocoaApplication.mm @@ -0,0 +1,24 @@ +#include "Swiften/Application/CocoaApplication.h" + +#include <AppKit/AppKit.h> +#include <Cocoa/Cocoa.h> + +namespace Swift { + +class CocoaApplication::Private { + public: + NSAutoreleasePool* autoReleasePool_; +}; + +CocoaApplication::CocoaApplication() { + d = new CocoaApplication::Private(); + NSApplicationLoad(); + d->autoReleasePool_ = [[NSAutoreleasePool alloc] init]; +} + +CocoaApplication::~CocoaApplication() { + [d->autoReleasePool_ release]; + delete d; +} + +} diff --git a/Swiften/Application/MacOSX/MacOSXApplication.cpp b/Swiften/Application/MacOSX/MacOSXApplication.cpp deleted file mode 100644 index 8212d36..0000000 --- a/Swiften/Application/MacOSX/MacOSXApplication.cpp +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2010 Remko Tronçon - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#include "Swiften/Application/MacOSX/MacOSXApplication.h" - -#include <iostream> - -namespace Swift { - -MacOSXApplication::MacOSXApplication(const String& name) : Application(name) { -} - -ApplicationMessageDisplay* MacOSXApplication::getApplicationMessageDisplay() { - return &messageDisplay_; -} - -} diff --git a/Swiften/Application/MacOSX/MacOSXApplication.h b/Swiften/Application/MacOSX/MacOSXApplication.h deleted file mode 100644 index f753f72..0000000 --- a/Swiften/Application/MacOSX/MacOSXApplication.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2010 Remko Tronçon - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#pragma once - -#include <boost/filesystem.hpp> - -#include "Swiften/Application/Application.h" -#include "Swiften/Application/MacOSX/MacOSXApplicationMessageDisplay.h" -#include "Swiften/Application/MacOSX/MacOSXApplicationInitializer.h" - -namespace Swift { - class ApplicationMessageDisplay; - - class MacOSXApplication : public Application { - public: - MacOSXApplication(const String& name); - - ApplicationMessageDisplay* getApplicationMessageDisplay(); - - private: - MacOSXApplicationInitializer initializer_; - MacOSXApplicationMessageDisplay messageDisplay_; - }; -} diff --git a/Swiften/Application/MacOSX/MacOSXApplicationInitializer.h b/Swiften/Application/MacOSX/MacOSXApplicationInitializer.h deleted file mode 100644 index 9cd4960..0000000 --- a/Swiften/Application/MacOSX/MacOSXApplicationInitializer.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2010 Remko Tronçon - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#ifndef SWIFTEN_MacOSXApplicationInitializer_H -#define SWIFTEN_MacOSXApplicationInitializer_H - -namespace Swift { - class MacOSXApplicationInitializer { - public: - MacOSXApplicationInitializer(); - ~MacOSXApplicationInitializer(); - - private: - class Private; - Private* d; - }; -} - -#endif diff --git a/Swiften/Application/MacOSX/MacOSXApplicationInitializer.mm b/Swiften/Application/MacOSX/MacOSXApplicationInitializer.mm deleted file mode 100644 index e401697..0000000 --- a/Swiften/Application/MacOSX/MacOSXApplicationInitializer.mm +++ /dev/null @@ -1,24 +0,0 @@ -#include "Swiften/Application/MacOSX/MacOSXApplicationInitializer.h" - -#include <AppKit/AppKit.h> -#include <Cocoa/Cocoa.h> - -namespace Swift { - -class MacOSXApplicationInitializer::Private { - public: - NSAutoreleasePool* autoReleasePool_; -}; - -MacOSXApplicationInitializer::MacOSXApplicationInitializer() { - d = new MacOSXApplicationInitializer::Private(); - NSApplicationLoad(); - d->autoReleasePool_ = [[NSAutoreleasePool alloc] init]; -} - -MacOSXApplicationInitializer::~MacOSXApplicationInitializer() { - [d->autoReleasePool_ release]; - delete d; -} - -} diff --git a/Swiften/Application/MacOSX/MacOSXApplicationMessageDisplay.h b/Swiften/Application/MacOSX/MacOSXApplicationMessageDisplay.h deleted file mode 100644 index df33152..0000000 --- a/Swiften/Application/MacOSX/MacOSXApplicationMessageDisplay.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2010 Remko Tronçon - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#ifndef SWIFTEN_MacOSXApplicationMessageDisplay_H -#define SWIFTEN_MacOSXApplicationMessageDisplay_H - -#include "Swiften/Application/ApplicationMessageDisplay.h" - -namespace Swift { - class String; - - class MacOSXApplicationMessageDisplay : public ApplicationMessageDisplay { - public: - MacOSXApplicationMessageDisplay(); - - void setMessage(const String& label); - }; -} - -#endif diff --git a/Swiften/Application/MacOSX/MacOSXApplicationMessageDisplay.mm b/Swiften/Application/MacOSX/MacOSXApplicationMessageDisplay.mm deleted file mode 100644 index c10c707..0000000 --- a/Swiften/Application/MacOSX/MacOSXApplicationMessageDisplay.mm +++ /dev/null @@ -1,20 +0,0 @@ -#include "Swiften/Application/MacOSX/MacOSXApplicationMessageDisplay.h" - -#include <AppKit/AppKit.h> -#include <Cocoa/Cocoa.h> - -#include "Swiften/Base/String.h" - -namespace Swift { - -MacOSXApplicationMessageDisplay::MacOSXApplicationMessageDisplay() { -} - -void MacOSXApplicationMessageDisplay::setMessage(const String& label) { - NSString *labelString = [[NSString alloc] initWithUTF8String: label.getUTF8Data()]; - [[NSApp dockTile] setBadgeLabel: labelString]; - [labelString release]; - [NSApp requestUserAttention: NSInformationalRequest]; -} - -} diff --git a/Swiften/Application/NullApplicationMessageDisplay.h b/Swiften/Application/NullApplicationMessageDisplay.h deleted file mode 100644 index 42019cd..0000000 --- a/Swiften/Application/NullApplicationMessageDisplay.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2010 Remko Tronçon - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#ifndef SWIFTEN_NullApplicationMessageDisplay_H -#define SWIFTEN_NullApplicationMessageDisplay_H - -#include "Swiften/Application/ApplicationMessageDisplay.h" - -namespace Swift { - class NullApplicationMessageDisplay : public ApplicationMessageDisplay { - public: - NullApplicationMessageDisplay() {} - - virtual void setMessage(const String&) { - } - }; -} - -#endif diff --git a/Swiften/Application/PlatformApplication.h b/Swiften/Application/PlatformApplication.h deleted file mode 100644 index 7facbe5..0000000 --- a/Swiften/Application/PlatformApplication.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2010 Remko Tronçon - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#pragma once - -#include "Swiften/Base/Platform.h" - - -#if defined(SWIFTEN_PLATFORM_MACOSX) -#include "Swiften/Application/MacOSX/MacOSXApplication.h" -namespace Swift { - typedef MacOSXApplication PlatformApplication; -} -#elif defined(SWIFTEN_PLATFORM_WIN32) -#include "Swiften/Application/WindowsApplication.h" -namespace Swift { - typedef WindowsApplication PlatformApplication; -} -#else -#include "Swiften/Application/UnixApplication.h" -namespace Swift { - typedef UnixApplication PlatformApplication; -} -#endif diff --git a/Swiften/Application/SConscript b/Swiften/Application/SConscript index 7b25a97..d3a2383 100644 --- a/Swiften/Application/SConscript +++ b/Swiften/Application/SConscript @@ -1,16 +1,12 @@ Import("swiften_env") sources = [ - "Application.cpp", - "ApplicationMessageDisplay.cpp", "ApplicationPathProvider.cpp", ] if swiften_env["PLATFORM"] == "darwin" and swiften_env["target"] == "native" : sources += [ - "MacOSX/MacOSXApplication.cpp", - "MacOSX/MacOSXApplicationMessageDisplay.mm", - "MacOSX/MacOSXApplicationInitializer.mm", + "CocoaApplication.mm", "MacOSXApplicationPathProvider.cpp", ] elif swiften_env["PLATFORM"] == "win32" : diff --git a/Swiften/Application/UnixApplication.h b/Swiften/Application/UnixApplication.h deleted file mode 100644 index c607b7d..0000000 --- a/Swiften/Application/UnixApplication.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2010 Remko Tronçon - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#pragma once - -#include "Swiften/Application/Application.h" -#include "Swiften/Application/NullApplicationMessageDisplay.h" - -#include <iostream> - -namespace Swift { - class UnixApplication : public Application { - public: - UnixApplication(const String& name) : Application(name) { - } - - virtual ApplicationMessageDisplay* getApplicationMessageDisplay() { - return &messageDisplay_; - } - - private: - NullApplicationMessageDisplay messageDisplay_; - }; -} - diff --git a/Swiften/Application/WindowsApplication.h b/Swiften/Application/WindowsApplication.h deleted file mode 100644 index eda066d..0000000 --- a/Swiften/Application/WindowsApplication.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2010 Remko Tronçon - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#ifndef SWIFTEN_WindowsApplication_H -#define SWIFTEN_WindowsApplication_H - -#include "Swiften/Application/Application.h" -#include "Swiften/Application/NullApplicationMessageDisplay.h" - -namespace Swift { - class WindowsApplication : public Application { - public: - WindowsApplication(const String& name) : Application(name) { - } - - virtual ApplicationMessageDisplay* getApplicationMessageDisplay() { - return &messageDisplay_; - } - - private: - NullApplicationMessageDisplay messageDisplay_; - }; -} - -#endif -- cgit v0.10.2-6-g49f6