diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-09-12 16:10:50 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-09-12 16:10:50 (GMT) |
commit | 41e89bb5ed1a9d38d1ece1310ef708daad54a9a9 (patch) | |
tree | 729117779ef76f28bff02413ce74daac46ccc565 /Swiften | |
parent | de0cdc61015f86a334bc4c0589bafe0bfdf89786 (diff) | |
download | swift-41e89bb5ed1a9d38d1ece1310ef708daad54a9a9.zip swift-41e89bb5ed1a9d38d1ece1310ef708daad54a9a9.tar.bz2 |
Moved application message display around.
Diffstat (limited to 'Swiften')
17 files changed, 34 insertions, 324 deletions
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.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/ApplicationMessageDisplay.cpp b/Swiften/Application/CocoaApplication.h index 4143c15..3b19d28 100644 --- a/Swiften/Application/ApplicationMessageDisplay.cpp +++ b/Swiften/Application/CocoaApplication.h @@ -4,11 +4,16 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#include "Swiften/Application/ApplicationMessageDisplay.h" +#pragma once namespace Swift { + class CocoaApplication { + public: + CocoaApplication(); + ~CocoaApplication(); -ApplicationMessageDisplay::~ApplicationMessageDisplay() { -} - + 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 |