diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-02-10 11:14:50 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-02-10 11:14:50 (GMT) |
commit | 4d0c1d3b8a40cb74cfb30ed27a294afaa6ced56f (patch) | |
tree | 63ce3df61e88f27ed183d373e3496d8f56af7fb1 | |
parent | 936f7ff9b80aca95040301a4b3cfcd2a248e3334 (diff) | |
download | swift-4d0c1d3b8a40cb74cfb30ed27a294afaa6ced56f.zip swift-4d0c1d3b8a40cb74cfb30ed27a294afaa6ced56f.tar.bz2 |
Move the Chat stuff in Controllers into Chat folder.
It was starting to get a bit unwieldly in Controllers/
-rw-r--r-- | Swift/Controllers/Chat/ChatController.cpp (renamed from Swift/Controllers/ChatController.cpp) | 2 | ||||
-rw-r--r-- | Swift/Controllers/Chat/ChatController.h (renamed from Swift/Controllers/ChatController.h) | 2 | ||||
-rw-r--r-- | Swift/Controllers/Chat/ChatControllerBase.cpp (renamed from Swift/Controllers/ChatControllerBase.cpp) | 2 | ||||
-rw-r--r-- | Swift/Controllers/Chat/ChatControllerBase.h (renamed from Swift/Controllers/ChatControllerBase.h) | 0 | ||||
-rw-r--r-- | Swift/Controllers/Chat/ChatsManager.cpp (renamed from Swift/Controllers/ChatsManager.cpp) | 6 | ||||
-rw-r--r-- | Swift/Controllers/Chat/ChatsManager.h (renamed from Swift/Controllers/ChatsManager.h) | 0 | ||||
-rw-r--r-- | Swift/Controllers/Chat/MUCController.cpp (renamed from Swift/Controllers/MUCController.cpp) | 2 | ||||
-rw-r--r-- | Swift/Controllers/Chat/MUCController.h (renamed from Swift/Controllers/MUCController.h) | 2 | ||||
-rw-r--r-- | Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp (renamed from Swift/Controllers/UnitTest/ChatsManagerTest.cpp) | 6 | ||||
-rw-r--r-- | Swift/Controllers/MainController.cpp | 6 | ||||
-rw-r--r-- | Swift/Controllers/SConscript | 10 | ||||
-rw-r--r-- | Swift/QtUI/QtSwift.cpp | 1 |
12 files changed, 19 insertions, 20 deletions
diff --git a/Swift/Controllers/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp index c4f45d8..e4031f2 100644 --- a/Swift/Controllers/ChatController.cpp +++ b/Swift/Controllers/Chat/ChatController.cpp @@ -1,49 +1,49 @@ -#include "Swift/Controllers/ChatController.h" +#include "Swift/Controllers/Chat/ChatController.h" #include <boost/bind.hpp> #include "Swiften/Avatars/AvatarManager.h" #include "Swift/Controllers/UIInterfaces/ChatWindow.h" #include "Swift/Controllers/UIInterfaces/ChatWindowFactory.h" #include "Swift/Controllers/NickResolver.h" namespace Swift { /** * The controller does not gain ownership of the stanzaChannel, nor the factory. */ ChatController::ChatController(const JID& self, StanzaChannel* stanzaChannel, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, const JID &contact, NickResolver* nickResolver, PresenceOracle* presenceOracle, AvatarManager* avatarManager) : ChatControllerBase(self, stanzaChannel, iqRouter, chatWindowFactory, contact, presenceOracle, avatarManager) { nickResolver_ = nickResolver; presenceOracle_->onPresenceChange.connect(boost::bind(&ChatController::handlePresenceChange, this, _1, _2)); chatWindow_->setName(nickResolver_->jidToNick(toJID_)); } bool ChatController::isIncomingMessageFromMe(boost::shared_ptr<Message>) { return false; } void ChatController::preHandleIncomingMessage(boost::shared_ptr<Message> message) { JID from = message->getFrom(); if (!from.equals(toJID_, JID::WithResource)) { if (toJID_.equals(from, JID::WithoutResource) && toJID_.isBare()){ toJID_ = from; } } } void ChatController::postSendMessage(const String& body) { addMessage(body, "me", true, labelsEnabled_ ? chatWindow_->getSelectedSecurityLabel() : boost::optional<SecurityLabel>(), String(avatarManager_->getAvatarPath(selfJID_).string())); } String ChatController::senderDisplayNameFromMessage(const JID& from) { return nickResolver_->jidToNick(from); } String ChatController::getStatusChangeString(boost::shared_ptr<Presence> presence) { String nick = senderDisplayNameFromMessage(presence->getFrom()); if (presence->getType() == Presence::Unavailable) { return nick + " has gone offline."; } else if (presence->getType() == Presence::Available) { StatusShow::Type show = presence->getShow(); if (show == StatusShow::Online || show == StatusShow::FFC) { diff --git a/Swift/Controllers/ChatController.h b/Swift/Controllers/Chat/ChatController.h index ea844ad..58ea797 100644 --- a/Swift/Controllers/ChatController.h +++ b/Swift/Controllers/Chat/ChatController.h @@ -1,27 +1,27 @@ #ifndef SWIFTEN_ChatController_H #define SWIFTEN_ChatController_H -#include "Swift/Controllers/ChatControllerBase.h" +#include "Swift/Controllers/Chat/ChatControllerBase.h" namespace Swift { class AvatarManager; class NickResolver; class ChatController : public ChatControllerBase { public: ChatController(const JID& self, StanzaChannel* stanzaChannel, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, const JID &contact, NickResolver* nickResolver, PresenceOracle* presenceOracle, AvatarManager*); private: void handlePresenceChange(boost::shared_ptr<Presence> newPresence, boost::shared_ptr<Presence> previousPresence); String getStatusChangeString(boost::shared_ptr<Presence> presence); bool isIncomingMessageFromMe(boost::shared_ptr<Message> message); void postSendMessage(const String &body); void preHandleIncomingMessage(boost::shared_ptr<Message> message); String senderDisplayNameFromMessage(const JID& from); private: NickResolver* nickResolver_; JID contact_; }; } #endif diff --git a/Swift/Controllers/ChatControllerBase.cpp b/Swift/Controllers/Chat/ChatControllerBase.cpp index 3e1ce5e..5f78795 100644 --- a/Swift/Controllers/ChatControllerBase.cpp +++ b/Swift/Controllers/Chat/ChatControllerBase.cpp @@ -1,49 +1,49 @@ -#include "Swift/Controllers/ChatControllerBase.h" +#include "Swift/Controllers/Chat/ChatControllerBase.h" #include <boost/bind.hpp> #include <boost/shared_ptr.hpp> #include "Swiften/Client/StanzaChannel.h" #include "Swiften/Base/foreach.h" #include "Swift/Controllers/UIInterfaces/ChatWindow.h" #include "Swift/Controllers/UIInterfaces/ChatWindowFactory.h" #include "Swiften/Queries/Requests/GetSecurityLabelsCatalogRequest.h" #include "Swiften/Avatars/AvatarManager.h" namespace Swift { ChatControllerBase::ChatControllerBase(const JID& self, StanzaChannel* stanzaChannel, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, const JID &toJID, PresenceOracle* presenceOracle, AvatarManager* avatarManager) : selfJID_(self), stanzaChannel_(stanzaChannel), iqRouter_(iqRouter), chatWindowFactory_(chatWindowFactory), toJID_(toJID), labelsEnabled_(false), presenceOracle_(presenceOracle), avatarManager_(avatarManager) { chatWindow_ = chatWindowFactory_->createChatWindow(toJID); chatWindow_->onAllMessagesRead.connect(boost::bind(&ChatControllerBase::handleAllMessagesRead, this)); chatWindow_->onSendMessageRequest.connect(boost::bind(&ChatControllerBase::handleSendMessageRequest, this, _1)); setEnabled(stanzaChannel->isAvailable() && iqRouter->isAvailable()); } ChatControllerBase::~ChatControllerBase() { delete chatWindow_; } void ChatControllerBase::setEnabled(bool enabled) { chatWindow_->setInputEnabled(enabled); } void ChatControllerBase::setAvailableServerFeatures(boost::shared_ptr<DiscoInfo> info) { if (iqRouter_->isAvailable() && info->hasFeature(DiscoInfo::SecurityLabels)) { chatWindow_->setSecurityLabelsEnabled(true); chatWindow_->setSecurityLabelsError(); boost::shared_ptr<GetSecurityLabelsCatalogRequest> request(new GetSecurityLabelsCatalogRequest(JID(toJID_.toBare()), iqRouter_)); request->onResponse.connect(boost::bind(&ChatControllerBase::handleSecurityLabelsCatalogResponse, this, _1, _2)); request->send(); labelsEnabled_ = true; } else { chatWindow_->setSecurityLabelsEnabled(false); labelsEnabled_ = false; } } void ChatControllerBase::handleAllMessagesRead() { foreach (boost::shared_ptr<MessageEvent> messageEvent, unreadMessages_) { messageEvent->read(); } unreadMessages_.clear(); chatWindow_->setUnreadMessageCount(0); diff --git a/Swift/Controllers/ChatControllerBase.h b/Swift/Controllers/Chat/ChatControllerBase.h index abf0116..abf0116 100644 --- a/Swift/Controllers/ChatControllerBase.h +++ b/Swift/Controllers/Chat/ChatControllerBase.h diff --git a/Swift/Controllers/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp index a805802..0efd3e1 100644 --- a/Swift/Controllers/ChatsManager.cpp +++ b/Swift/Controllers/Chat/ChatsManager.cpp @@ -1,57 +1,57 @@ -#include "Swift/Controllers/ChatsManager.h" +#include "Swift/Controllers/Chat/ChatsManager.h" #include <boost/bind.hpp> #include "Swiften/Client/Client.h" -#include "Swift/Controllers/ChatController.h" +#include "Swift/Controllers/Chat/ChatController.h" #include "Swift/Controllers/EventController.h" -#include "Swift/Controllers/MUCController.h" +#include "Swift/Controllers/Chat/MUCController.h" #include "Swiften/Presence/PresenceSender.h" namespace Swift { typedef std::pair<JID, ChatController*> JIDChatControllerPair; typedef std::pair<JID, MUCController*> JIDMUCControllerPair; ChatsManager::ChatsManager(JID jid, StanzaChannel* stanzaChannel, IQRouter* iqRouter, EventController* eventController, ChatWindowFactory* chatWindowFactory, TreeWidgetFactory* treeWidgetFactory, NickResolver* nickResolver, PresenceOracle* presenceOracle, boost::shared_ptr<DiscoInfo> serverDiscoInfo, PresenceSender* presenceSender) : jid_(jid) { eventController_ = eventController; stanzaChannel_ = stanzaChannel; iqRouter_ = iqRouter; chatWindowFactory_ = chatWindowFactory; treeWidgetFactory_ = treeWidgetFactory; nickResolver_ = nickResolver; presenceOracle_ = presenceOracle; avatarManager_ = NULL; serverDiscoInfo_ = serverDiscoInfo; presenceSender_ = presenceSender; presenceOracle_->onPresenceChange.connect(boost::bind(&ChatsManager::handlePresenceChange, this, _1, _2)); } ChatsManager::~ChatsManager() { foreach (JIDChatControllerPair controllerPair, chatControllers_) { delete controllerPair.second; } foreach (JIDMUCControllerPair controllerPair, mucControllers_) { delete controllerPair.second; } } /** * If a resource goes offline, release bound chatdialog to that resource. */ void ChatsManager::handlePresenceChange(boost::shared_ptr<Presence> newPresence, boost::shared_ptr<Presence> /*lastPresence*/) { if (newPresence->getType() != Presence::Unavailable) return; JID fullJID(newPresence->getFrom()); std::map<JID, ChatController*>::iterator it = chatControllers_.find(fullJID); if (it == chatControllers_.end()) return; JID bareJID(fullJID.toBare()); //It doesn't make sense to have two unbound dialogs. if (chatControllers_.find(bareJID) != chatControllers_.end()) return; rebindControllerJID(fullJID, bareJID); } void ChatsManager::setAvatarManager(AvatarManager* avatarManager) { avatarManager_ = avatarManager; } diff --git a/Swift/Controllers/ChatsManager.h b/Swift/Controllers/Chat/ChatsManager.h index dd80d95..dd80d95 100644 --- a/Swift/Controllers/ChatsManager.h +++ b/Swift/Controllers/Chat/ChatsManager.h diff --git a/Swift/Controllers/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp index c85fffa..7736aec 100644 --- a/Swift/Controllers/MUCController.cpp +++ b/Swift/Controllers/Chat/MUCController.cpp @@ -1,49 +1,49 @@ -#include "Swift/Controllers/MUCController.h" +#include "Swift/Controllers/Chat/MUCController.h" #include <boost/bind.hpp> #include "Swiften/Base/foreach.h" #include "Swift/Controllers/UIInterfaces/ChatWindow.h" #include "Swift/Controllers/UIInterfaces/ChatWindowFactory.h" #include "Swiften/Avatars/AvatarManager.h" #include "Swiften/MUC/MUC.h" #include "Swiften/Client/StanzaChannel.h" #include "Swiften/Roster/Roster.h" #include "Swiften/Roster/SetAvatar.h" #include "Swiften/Roster/SetPresence.h" #include "Swiften/Roster/TreeWidgetFactory.h" namespace Swift { /** * The controller does not gain ownership of the stanzaChannel, nor the factory. */ MUCController::MUCController ( const JID& self, const JID &muc, const String &nick, StanzaChannel* stanzaChannel, PresenceSender* presenceSender, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, TreeWidgetFactory *treeWidgetFactory, PresenceOracle* presenceOracle, AvatarManager* avatarManager) : ChatControllerBase(self, stanzaChannel, iqRouter, chatWindowFactory, muc, presenceOracle, avatarManager), muc_(new MUC(stanzaChannel, presenceSender, muc)), nick_(nick), treeWidgetFactory_(treeWidgetFactory) { roster_ = new Roster(chatWindow_->getTreeWidget(), treeWidgetFactory_); chatWindow_->onClosed.connect(boost::bind(&MUCController::handleWindowClosed, this)); muc_->joinAs(nick); muc_->onOccupantJoined.connect(boost::bind(&MUCController::handleOccupantJoined, this, _1)); muc_->onOccupantPresenceChange.connect(boost::bind(&MUCController::handleOccupantPresenceChange, this, _1)); muc_->onOccupantLeft.connect(boost::bind(&MUCController::handleOccupantLeft, this, _1, _2, _3)); chatWindow_->convertToMUC(); chatWindow_->show(); if (avatarManager_ != NULL) { avatarManager_->onAvatarChanged.connect(boost::bind(&MUCController::handleAvatarChanged, this, _1, _2)); } } MUCController::~MUCController() { diff --git a/Swift/Controllers/MUCController.h b/Swift/Controllers/Chat/MUCController.h index aa5a274..bafe3db 100644 --- a/Swift/Controllers/MUCController.h +++ b/Swift/Controllers/Chat/MUCController.h @@ -1,48 +1,48 @@ #ifndef SWIFTEN_MUCController_H #define SWIFTEN_MUCController_H #include <boost/shared_ptr.hpp> #include "Swiften/Base/String.h" -#include "Swift/Controllers/ChatControllerBase.h" +#include "Swift/Controllers/Chat/ChatControllerBase.h" #include "Swiften/Elements/Message.h" #include "Swiften/Elements/DiscoInfo.h" #include "Swiften/JID/JID.h" #include "Swiften/MUC/MUC.h" #include "Swiften/MUC/MUCOccupant.h" namespace Swift { class StanzaChannel; class IQRouter; class ChatWindow; class ChatWindowFactory; class Roster; class TreeWidgetFactory; class AvatarManager; class MUCController : public ChatControllerBase { public: MUCController(const JID& self, const JID &muc, const String &nick, StanzaChannel* stanzaChannel, PresenceSender* presenceSender, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, TreeWidgetFactory *treeWidgetFactory, PresenceOracle* presenceOracle, AvatarManager* avatarManager); ~MUCController(); protected: void preSendMessageRequest(boost::shared_ptr<Message> message); bool isIncomingMessageFromMe(boost::shared_ptr<Message> message); String senderDisplayNameFromMessage(const JID& from); private: void handleWindowClosed(); void handleAvatarChanged(const JID& jid, const String&); void handleOccupantJoined(const MUCOccupant& occupant); void handleOccupantLeft(const MUCOccupant& occupant, MUC::LeavingType type, const String& reason); void handleOccupantPresenceChange(boost::shared_ptr<Presence> presence); private: MUC *muc_; String nick_; TreeWidgetFactory *treeWidgetFactory_; Roster *roster_; }; } #endif diff --git a/Swift/Controllers/UnitTest/ChatsManagerTest.cpp b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp index 219b9b0..ab1c03b 100644 --- a/Swift/Controllers/UnitTest/ChatsManagerTest.cpp +++ b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp @@ -1,61 +1,61 @@ #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> #include "3rdParty/hippomocks.h" -#include "Swift/Controllers/ChatsManager.h" +#include "Swift/Controllers/Chat/ChatsManager.h" #include "Swift/Controllers/UIInterfaces/ChatWindow.h" #include "Swift/Controllers/UIInterfaces/ChatWindowFactory.h" #include "Swiften/Roster/TreeWidgetFactory.h" #include "Swiften/Client/Client.h" -#include "Swift/Controllers/ChatController.h" +#include "Swift/Controllers/Chat/ChatController.h" #include "Swift/Controllers/EventController.h" -#include "Swift/Controllers/MUCController.h" +#include "Swift/Controllers/Chat/MUCController.h" #include "Swiften/Presence/PresenceSender.h" #include "Swiften/Avatars/UnitTest/MockAvatarManager.h" #include "Swift/Controllers/NickResolver.h" #include "Swiften/Roster/XMPPRoster.h" #include "Swift/Controllers/UnitTest/MockChatWindow.h" #include "Swiften/Client/DummyStanzaChannel.h" #include "Swiften/Queries/DummyIQChannel.h" #include "Swiften/Presence/PresenceOracle.h" using namespace Swift; class ChatsManagerTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(ChatsManagerTest); CPPUNIT_TEST(testFirstOpenWindowIncoming); CPPUNIT_TEST(testSecondOpenWindowIncoming); CPPUNIT_TEST(testFirstOpenWindowOutgoing); CPPUNIT_TEST(testFirstOpenWindowBareToFull); CPPUNIT_TEST(testSecondWindow); CPPUNIT_TEST(testUnbindRebind); CPPUNIT_TEST(testNoDuplicateUnbind); CPPUNIT_TEST_SUITE_END(); public: ChatsManagerTest() {}; void setUp() { mocks_ = new MockRepository(); jid_ = JID("test@test.com/resource"); stanzaChannel_ = new DummyStanzaChannel(); iqChannel_ = new DummyIQChannel(); iqRouter_ = new IQRouter(iqChannel_); eventController_ = new EventController(); chatWindowFactory_ = mocks_->InterfaceMock<ChatWindowFactory>(); treeWidgetFactory_ = NULL; xmppRoster_ = boost::shared_ptr<XMPPRoster>(new XMPPRoster()); nickResolver_ = new NickResolver(xmppRoster_); presenceOracle_ = new PresenceOracle(stanzaChannel_); serverDiscoInfo_ = boost::shared_ptr<DiscoInfo>(new DiscoInfo()); presenceSender_ = NULL; manager_ = new ChatsManager(jid_, stanzaChannel_, iqRouter_, eventController_, chatWindowFactory_, treeWidgetFactory_, nickResolver_, presenceOracle_, serverDiscoInfo_, presenceSender_); avatarManager_ = new MockAvatarManager(); manager_->setAvatarManager(avatarManager_); }; void tearDown() { delete manager_; diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index 3fd0764..074369e 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp @@ -1,66 +1,66 @@ #include "Swift/Controllers/MainController.h" #include <boost/bind.hpp> #include <boost/lexical_cast.hpp> #include <boost/shared_ptr.hpp> #include <stdlib.h> #include "Swiften/Application/Application.h" #include "Swiften/Application/ApplicationMessageDisplay.h" -#include "Swift/Controllers/ChatController.h" +#include "Swift/Controllers/Chat/ChatController.h" #include "Swift/Controllers/UIInterfaces/ChatWindowFactory.h" -#include "Swift/Controllers/ChatsManager.h" +#include "Swift/Controllers/Chat/ChatsManager.h" #include "Swift/Controllers/EventController.h" #include "Swift/Controllers/UIInterfaces/LoginWindow.h" #include "Swift/Controllers/UIInterfaces/LoginWindowFactory.h" #include "Swift/Controllers/MainWindow.h" #include "Swift/Controllers/MainWindowFactory.h" -#include "Swift/Controllers/MUCController.h" +#include "Swift/Controllers/Chat/MUCController.h" #include "Swift/Controllers/NickResolver.h" #include "Swift/Controllers/ProfileSettingsProvider.h" #include "Swift/Controllers/RosterController.h" #include "Swift/Controllers/SoundEventController.h" #include "Swift/Controllers/SoundPlayer.h" #include "Swift/Controllers/SystemTray.h" #include "Swift/Controllers/SystemTrayController.h" #include "Swift/Controllers/XMLConsoleController.h" #include "Swift/Controllers/XMPPRosterController.h" #include "Swift/Controllers/UIInterfaces/XMLConsoleWidgetFactory.h" #include "Swift/Controllers/UIEvents/UIEventStream.h" #include "Swiften/Base/foreach.h" #include "Swiften/Base/String.h" #include "Swiften/Client/Client.h" #include "Swiften/Presence/PresenceSender.h" #include "Swiften/Elements/Presence.h" #include "Swiften/Elements/VCardUpdate.h" #include "Swiften/Queries/Responders/SoftwareVersionResponder.h" #include "Swiften/Roster/TreeWidgetFactory.h" #include "Swiften/Settings/SettingsProvider.h" #include "Swiften/Elements/DiscoInfo.h" #include "Swiften/Queries/Responders/DiscoInfoResponder.h" #include "Swiften/Disco/CapsInfoGenerator.h" #include "Swiften/Queries/Requests/GetDiscoInfoRequest.h" #include "Swiften/Queries/Requests/GetVCardRequest.h" #include "Swiften/Avatars/AvatarFileStorage.h" #include "Swiften/Avatars/AvatarManager.h" #include "Swiften/StringCodecs/SHA1.h" #include "Swiften/StringCodecs/Hexify.h" namespace Swift { static const String CLIENT_NAME = "Swift"; static const String CLIENT_VERSION = "0.3"; static const String CLIENT_NODE = "http://swift.im"; MainController::MainController(ChatWindowFactory* chatWindowFactory, MainWindowFactory *mainWindowFactory, LoginWindowFactory *loginWindowFactory, TreeWidgetFactory *treeWidgetFactory, SettingsProvider *settings, Application* application, SystemTray* systemTray, SoundPlayer* soundPlayer, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory) : timerFactory_(&boostIOServiceThread_.getIOService()), idleDetector_(&idleQuerier_, &timerFactory_, 100), client_(NULL), presenceSender_(NULL), chatWindowFactory_(chatWindowFactory), mainWindowFactory_(mainWindowFactory), loginWindowFactory_(loginWindowFactory), treeWidgetFactory_(treeWidgetFactory), settings_(settings), xmppRosterController_(NULL), rosterController_(NULL), loginWindow_(NULL), clientVersionResponder_(NULL), nickResolver_(NULL), discoResponder_(NULL) { application_ = application; presenceOracle_ = NULL; avatarManager_ = NULL; chatsManager_ = NULL; uiEventStream_ = new UIEventStream(); avatarStorage_ = new AvatarFileStorage(application_->getAvatarDir()); eventController_ = new EventController(); diff --git a/Swift/Controllers/SConscript b/Swift/Controllers/SConscript index 82bacaa..6bd742b 100644 --- a/Swift/Controllers/SConscript +++ b/Swift/Controllers/SConscript @@ -1,35 +1,35 @@ Import("env") env["SWIFT_CONTROLLERS_FLAGS"] = { "LIBPATH": [Dir(".")], "LIBS": ["SwiftControllers"] } myenv = env.Clone() myenv.MergeFlags(env["BOOST_FLAGS"]) myenv.StaticLibrary("SwiftControllers", [ - "ChatController.cpp", - "ChatControllerBase.cpp", - "ChatsManager.cpp", + "Chat/ChatController.cpp", + "Chat/ChatControllerBase.cpp", + "Chat/ChatsManager.cpp", "MainController.cpp", "NickResolver.cpp", "RosterController.cpp", "XMPPRosterController.cpp", - "MUCController.cpp", + "Chat/MUCController.cpp", "EventController.cpp", "SoundEventController.cpp", "SystemTrayController.cpp", "XMLConsoleController.cpp", "UIEvents/UIEvent.cpp", "UIInterfaces/XMLConsoleWidget.cpp", "PreviousStatusStore.cpp", ]) env.Append(UNITTEST_SOURCES = [ File("UnitTest/NickResolverTest.cpp"), File("UnitTest/RosterControllerTest.cpp"), File("UnitTest/XMPPRosterControllerTest.cpp"), File("UnitTest/PreviousStatusStoreTest.cpp"), - File("UnitTest/ChatsManagerTest.cpp"), + File("Chat/UnitTest/ChatsManagerTest.cpp"), File("UnitTest/MockChatWindow.cpp"), ]) diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp index 5802e48..be2d291 100644 --- a/Swift/QtUI/QtSwift.cpp +++ b/Swift/QtUI/QtSwift.cpp @@ -1,69 +1,68 @@ #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/swift-mac-dev.xml" #else #define SWIFT_APPCAST_URL "" #endif 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_); PlatformAutoUpdaterFactory autoUpdaterFactory; if (autoUpdaterFactory.isSupported()) { autoUpdater_ = autoUpdaterFactory.createAutoUpdater(SWIFT_APPCAST_URL); autoUpdater_->checkForUpdates(); } } QtSwift::~QtSwift() { |