summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-03-28 13:40:14 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-03-28 13:40:43 (GMT)
commitb61486fefe602e0d18fa5279021006f87b965307 (patch)
tree437585cbef1179e1ec31f79789591d5610200c29 /Swiften/Application
parentdae28dd45e43fc6e6ef2ec4c6c65d5d736ed86f8 (diff)
downloadswift-contrib-b61486fefe602e0d18fa5279021006f87b965307.zip
swift-contrib-b61486fefe602e0d18fa5279021006f87b965307.tar.bz2
Moved Swiften to a separate module.
Diffstat (limited to 'Swiften/Application')
m---------Swiften0
-rw-r--r--Swiften/Application/Application.cpp30
-rw-r--r--Swiften/Application/Application.h33
-rw-r--r--Swiften/Application/ApplicationMessageDisplay.cpp8
-rw-r--r--Swiften/Application/ApplicationMessageDisplay.h15
-rw-r--r--Swiften/Application/MacOSX/MacOSXApplication.cpp22
-rw-r--r--Swiften/Application/MacOSX/MacOSXApplication.h25
-rw-r--r--Swiften/Application/MacOSX/MacOSXApplicationInitializer.h16
-rw-r--r--Swiften/Application/MacOSX/MacOSXApplicationInitializer.mm24
-rw-r--r--Swiften/Application/MacOSX/MacOSXApplicationMessageDisplay.h17
-rw-r--r--Swiften/Application/MacOSX/MacOSXApplicationMessageDisplay.mm20
-rw-r--r--Swiften/Application/NullApplicationMessageDisplay.h16
-rw-r--r--Swiften/Application/Platform/PlatformApplication.h24
-rw-r--r--Swiften/Application/SConscript16
-rw-r--r--Swiften/Application/UnitTest/ApplicationTest.cpp39
-rw-r--r--Swiften/Application/Unix/UnixApplication.h32
-rw-r--r--Swiften/Application/Windows/WindowsApplication.h36
17 files changed, 0 insertions, 373 deletions
diff --git a/Swiften b/Swiften
new file mode 160000
+Subproject 8213ba16d0043d2461f4b031c881d61dda5a38c
diff --git a/Swiften/Application/Application.cpp b/Swiften/Application/Application.cpp
deleted file mode 100644
index be77e95..0000000
--- a/Swiften/Application/Application.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-#include "Swiften/Application/Application.h"
-
-#include <boost/filesystem.hpp>
-#include <stdlib.h>
-
-#include "Swiften/Application/ApplicationMessageDisplay.h"
-
-namespace Swift {
-
-Application::Application(const String& name) : name_(name) {
-}
-
-Application::~Application() {
-}
-
-boost::filesystem::path Application::getSettingsFileName() const {
- return getSettingsDir() / "settings";
-}
-
-boost::filesystem::path Application::getAvatarDir() const {
- return getSettingsDir() / "avatars";
-}
-
-boost::filesystem::path Application::getProfileDir(const String& profile) const {
- boost::filesystem::path result(getHomeDir() / profile.getUTF8String());
- boost::filesystem::create_directory(result);
- return result;
-}
-
-}
diff --git a/Swiften/Application/Application.h b/Swiften/Application/Application.h
deleted file mode 100644
index 20d686c..0000000
--- a/Swiften/Application/Application.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef SWIFTEN_Application_H
-#define SWIFTEN_Application_H
-
-#include <boost/filesystem.hpp>
-
-#include "Swiften/Base/String.h"
-
-namespace Swift {
- class ApplicationMessageDisplay;
-
- class Application {
- public:
- Application(const String& name);
- virtual ~Application();
-
- boost::filesystem::path getSettingsFileName() const;
- boost::filesystem::path getAvatarDir() const;
- virtual boost::filesystem::path getHomeDir() const = 0;
- virtual boost::filesystem::path getSettingsDir() const = 0;
- boost::filesystem::path getProfileDir(const String& profile) const;
-
- const String& getName() const {
- return name_;
- }
-
- virtual ApplicationMessageDisplay* getApplicationMessageDisplay() = 0;
-
- private:
- String name_;
- };
-}
-
-#endif
diff --git a/Swiften/Application/ApplicationMessageDisplay.cpp b/Swiften/Application/ApplicationMessageDisplay.cpp
deleted file mode 100644
index 48db37d..0000000
--- a/Swiften/Application/ApplicationMessageDisplay.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-#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 df7f0cb..0000000
--- a/Swiften/Application/ApplicationMessageDisplay.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#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/MacOSX/MacOSXApplication.cpp b/Swiften/Application/MacOSX/MacOSXApplication.cpp
deleted file mode 100644
index 79d7586..0000000
--- a/Swiften/Application/MacOSX/MacOSXApplication.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-#include "Swiften/Application/MacOSX/MacOSXApplication.h"
-
-namespace Swift {
-
-MacOSXApplication::MacOSXApplication(const String& name) : Application(name) {
-}
-
-ApplicationMessageDisplay* MacOSXApplication::getApplicationMessageDisplay() {
- return &messageDisplay_;
-}
-
-boost::filesystem::path MacOSXApplication::getSettingsDir() const {
- boost::filesystem::path result(getHomeDir() / "Library/Application Support" / getName().getUTF8String());
- boost::filesystem::create_directory(result);
- return result;
-}
-
-boost::filesystem::path MacOSXApplication::getHomeDir() const {
- return boost::filesystem::path(getenv("HOME"));
-}
-
-}
diff --git a/Swiften/Application/MacOSX/MacOSXApplication.h b/Swiften/Application/MacOSX/MacOSXApplication.h
deleted file mode 100644
index cd5e69f..0000000
--- a/Swiften/Application/MacOSX/MacOSXApplication.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef SWIFTEN_MacOSXApplication_H
-#define SWIFTEN_MacOSXApplication_H
-
-#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);
-
- virtual boost::filesystem::path getHomeDir() const;
- virtual ApplicationMessageDisplay* getApplicationMessageDisplay();
- boost::filesystem::path getSettingsDir() const;
-
- private:
- MacOSXApplicationInitializer initializer_;
- MacOSXApplicationMessageDisplay messageDisplay_;
- };
-}
-
-#endif
diff --git a/Swiften/Application/MacOSX/MacOSXApplicationInitializer.h b/Swiften/Application/MacOSX/MacOSXApplicationInitializer.h
deleted file mode 100644
index db551eb..0000000
--- a/Swiften/Application/MacOSX/MacOSXApplicationInitializer.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#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 98af1fa..0000000
--- a/Swiften/Application/MacOSX/MacOSXApplicationMessageDisplay.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#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 03e0b42..0000000
--- a/Swiften/Application/NullApplicationMessageDisplay.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#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/Platform/PlatformApplication.h b/Swiften/Application/Platform/PlatformApplication.h
deleted file mode 100644
index 749bce4..0000000
--- a/Swiften/Application/Platform/PlatformApplication.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef SWIFTEN_PlatformApplication_H
-#define SWIFTEN_PlatformApplication_H
-
-#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/Windows/WindowsApplication.h"
-namespace Swift {
- typedef WindowsApplication PlatformApplication;
-}
-#else
-#include "Swiften/Application/Unix/UnixApplication.h"
-namespace Swift {
- typedef UnixApplication PlatformApplication;
-}
-#endif
-
-#endif
diff --git a/Swiften/Application/SConscript b/Swiften/Application/SConscript
deleted file mode 100644
index 78b3a34..0000000
--- a/Swiften/Application/SConscript
+++ /dev/null
@@ -1,16 +0,0 @@
-Import("swiften_env")
-
-sources = [
- "Application.cpp",
- "ApplicationMessageDisplay.cpp",
- ]
-
-if swiften_env["PLATFORM"] == "darwin" and swiften_env["target"] == "native" :
- sources += [
- "MacOSX/MacOSXApplication.cpp",
- "MacOSX/MacOSXApplicationMessageDisplay.mm",
- "MacOSX/MacOSXApplicationInitializer.mm",
- ]
-
-objects = swiften_env.StaticObject(sources)
-swiften_env.Append(SWIFTEN_OBJECTS = [objects])
diff --git a/Swiften/Application/UnitTest/ApplicationTest.cpp b/Swiften/Application/UnitTest/ApplicationTest.cpp
deleted file mode 100644
index 0196755..0000000
--- a/Swiften/Application/UnitTest/ApplicationTest.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-
-#include "Swiften/Application/Application.h"
-#include "Swiften/Application/Platform/PlatformApplication.h"
-
-using namespace Swift;
-
-class ApplicationTest : public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE(ApplicationTest);
- CPPUNIT_TEST(testGetSettingsDir);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- ApplicationTest() {}
-
- void setUp() {
- testling_ = new PlatformApplication("SwiftTest");
- }
-
- void tearDown() {
- delete testling_;
- }
-
- void testGetSettingsDir() {
- boost::filesystem::path dir = testling_->getSettingsDir();
-
- CPPUNIT_ASSERT(boost::filesystem::exists(dir));
- CPPUNIT_ASSERT(boost::filesystem::is_directory(dir));
-
- boost::filesystem::remove(dir);
- }
-
- private:
- Application* testling_;
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(ApplicationTest);
diff --git a/Swiften/Application/Unix/UnixApplication.h b/Swiften/Application/Unix/UnixApplication.h
deleted file mode 100644
index c2671d8..0000000
--- a/Swiften/Application/Unix/UnixApplication.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef SWIFTEN_UnixApplication_H
-#define SWIFTEN_UnixApplication_H
-
-#include "Swiften/Application/Application.h"
-#include "Swiften/Application/NullApplicationMessageDisplay.h"
-
-namespace Swift {
- class UnixApplication : public Application {
- public:
- UnixApplication(const String& name) : Application(name) {
- }
-
- virtual ApplicationMessageDisplay* getApplicationMessageDisplay() {
- return &messageDisplay_;
- }
-
- virtual boost::filesystem::path getHomeDir() const {
- return boost::filesystem::path(getenv("HOME"));
- }
-
- boost::filesystem::path getSettingsDir() const {
- boost::filesystem::path result(getHomeDir() / ("." + getName().getLowerCase().getUTF8String()));
- boost::filesystem::create_directory(result);
- return result;
- }
-
- private:
- NullApplicationMessageDisplay messageDisplay_;
- };
-}
-
-#endif
diff --git a/Swiften/Application/Windows/WindowsApplication.h b/Swiften/Application/Windows/WindowsApplication.h
deleted file mode 100644
index 365157b..0000000
--- a/Swiften/Application/Windows/WindowsApplication.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#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_;
- }
-
- boost::filesystem::path getSettingsDir() const {
- char* appDirRaw = getenv("APPDATA");
- boost::filesystem::path result(boost::filesystem::path(appDirRaw) / getName().getUTF8String());
- boost::filesystem::create_directory(result);
- return result;
- }
-
- boost::filesystem::path getHomeDir() const {
- //FIXME: This should be My Documents
-
- char* homeDirRaw = getenv("USERPROFILE");
- return boost::filesystem::path(homeDirRaw);
- }
-
- private:
- NullApplicationMessageDisplay messageDisplay_;
- };
-}
-
-#endif