summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Swift/Controllers/Chat/ChatsManager.cpp11
-rw-r--r--Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp2
-rw-r--r--Swift/Controllers/MainController.cpp2
-rw-r--r--Swift/Controllers/WhiteboardManager.cpp31
-rw-r--r--Swift/Controllers/WhiteboardManager.h6
-rw-r--r--Swift/QtUI/ChatList/QtChatListWindow.cpp3
6 files changed, 21 insertions, 34 deletions
diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp
index bfcc15a..3c87fc6 100644
--- a/Swift/Controllers/Chat/ChatsManager.cpp
+++ b/Swift/Controllers/Chat/ChatsManager.cpp
@@ -672,6 +672,17 @@ void ChatsManager::handleWhiteboardStateChange(const JID& contact, const ChatWin
ChatController* chatController = getChatControllerOrCreate(contact);
chatController->handleWhiteboardStateChange(state);
chatController->activateChatWindow();
+ if (state == ChatWindow::WhiteboardAccepted) {
+ boost::filesystem::path path;
+ JID bareJID = contact.toBare();
+ if (avatarManager_) {
+ path = avatarManager_->getAvatarPath(bareJID);
+ }
+ ChatListWindow::Chat chat(bareJID, nickResolver_->jidToNick(bareJID), "", 0, StatusShow::None, path, false);
+ chatListWindow_->addWhiteboardSession(chat);
+ } else {
+ chatListWindow_->removeWhiteboardSession(contact.toBare());
+ }
}
void ChatsManager::handleRecentActivated(const ChatListWindow::Chat& chat) {
diff --git a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
index 53fee18..1ac1e72 100644
--- a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
+++ b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
@@ -105,7 +105,7 @@ public:
ftOverview_ = new FileTransferOverview(ftManager_);
avatarManager_ = new NullAvatarManager();
wbSessionManager_ = new WhiteboardSessionManager(iqRouter_, presenceOracle_, entityCapsManager_);
- wbManager_ = new WhiteboardManager(whiteboardWindowFactory_, chatListWindowFactory_, uiEventStream_, nickResolver_, avatarManager_, wbSessionManager_);
+ wbManager_ = new WhiteboardManager(whiteboardWindowFactory_, uiEventStream_, nickResolver_, avatarManager_, wbSessionManager_);
mocks_->ExpectCall(chatListWindowFactory_, ChatListWindowFactory::createChatListWindow).With(uiEventStream_).Return(chatListWindow_);
manager_ = new ChatsManager(jid_, stanzaChannel_, iqRouter_, eventController_, chatWindowFactory_, joinMUCWindowFactory_, nickResolver_, presenceOracle_, directedPresenceSender_, uiEventStream_, chatListWindowFactory_, true, NULL, mucRegistry_, entityCapsManager_, mucManager_, mucSearchWindowFactory_, profileSettings_, ftOverview_, xmppRoster_, false, settings_, wbManager_);
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index 8b3d1a7..70b7dd1 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -292,7 +292,7 @@ void MainController::handleConnected() {
rosterController_->getWindow()->onShowCertificateRequest.connect(boost::bind(&MainController::handleShowCertificateRequest, this));
contactEditController_ = new ContactEditController(rosterController_, client_->getVCardManager(), uiFactory_, uiEventStream_);
- whiteboardManager_ = new WhiteboardManager(uiFactory_, uiFactory_, uiEventStream_, client_->getNickResolver(), client_->getAvatarManager(), client_->getWhiteboardSessionManager());
+ whiteboardManager_ = new WhiteboardManager(uiFactory_, uiEventStream_, client_->getNickResolver(), client_->getAvatarManager(), client_->getWhiteboardSessionManager());
chatsManager_ = new ChatsManager(jid_, client_->getStanzaChannel(), client_->getIQRouter(), eventController_, uiFactory_, uiFactory_, client_->getNickResolver(), client_->getPresenceOracle(), client_->getPresenceSender(), uiEventStream_, uiFactory_, useDelayForLatency_, networkFactories_->getTimerFactory(), client_->getMUCRegistry(), client_->getEntityCapsProvider(), client_->getMUCManager(), uiFactory_, profileSettings_, ftOverview_, client_->getRoster(), !settings_->getSetting(SettingConstants::REMEMBER_RECENT_CHATS), settings_, whiteboardManager_);
diff --git a/Swift/Controllers/WhiteboardManager.cpp b/Swift/Controllers/WhiteboardManager.cpp
index 8ac7ba2..2b6c448 100644
--- a/Swift/Controllers/WhiteboardManager.cpp
+++ b/Swift/Controllers/WhiteboardManager.cpp
@@ -13,7 +13,6 @@
#include <Swift/Controllers/UIEvents/AcceptWhiteboardSessionUIEvent.h>
#include <Swift/Controllers/UIEvents/CancelWhiteboardSessionUIEvent.h>
#include <Swift/Controllers/UIEvents/ShowWhiteboardUIEvent.h>
-#include <Swift/Controllers/UIInterfaces/ChatListWindowFactory.h>
#include "Swiften/Client/NickResolver.h"
#include <Swiften/Client/StanzaChannel.h>
#include <Swiften/Avatars/AvatarManager.h>
@@ -22,9 +21,7 @@
namespace Swift {
typedef std::pair<JID, WhiteboardWindow*> JIDWhiteboardWindowPair;
- WhiteboardManager::WhiteboardManager(WhiteboardWindowFactory* whiteboardWindowFactory, ChatListWindowFactory* chatListWindowFactory, UIEventStream* uiEventStream, NickResolver* nickResolver, AvatarManager* avatarManager, WhiteboardSessionManager* whiteboardSessionManager) : whiteboardWindowFactory_(whiteboardWindowFactory), uiEventStream_(uiEventStream), nickResolver_(nickResolver), avatarManager_(avatarManager), whiteboardSessionManager_(whiteboardSessionManager) {
- chatListWindow_ = chatListWindowFactory->createChatListWindow(uiEventStream_);
- chatListWindow_->onWhiteboardActivated.connect(boost::bind(&WhiteboardManager::activateWindow, this, _1));
+ WhiteboardManager::WhiteboardManager(WhiteboardWindowFactory* whiteboardWindowFactory, UIEventStream* uiEventStream, NickResolver* nickResolver, AvatarManager* avatarManager, WhiteboardSessionManager* whiteboardSessionManager) : whiteboardWindowFactory_(whiteboardWindowFactory), uiEventStream_(uiEventStream), nickResolver_(nickResolver), avatarManager_(avatarManager), whiteboardSessionManager_(whiteboardSessionManager) {
whiteboardSessionManager_->onSessionRequest.connect(boost::bind(&WhiteboardManager::handleIncomingSession, this, _1));
uiEventConnection_ = uiEventStream_->onUIEvent.connect(boost::bind(&WhiteboardManager::handleUIEvent, this, _1));
}
@@ -64,7 +61,10 @@ namespace Swift {
}
boost::shared_ptr<ShowWhiteboardUIEvent> showWindowEvent = boost::dynamic_pointer_cast<ShowWhiteboardUIEvent>(event);
if (showWindowEvent) {
- activateWindow(showWindowEvent->getContact());
+ WhiteboardWindow* window = findWhiteboardWindow(showWindowEvent->getContact());
+ if (window != NULL) {
+ window->activateWindow();
+ }
}
}
@@ -115,27 +115,6 @@ namespace Swift {
onSessionRequest(session->getTo(), false);
}
-/* void WhiteboardManager::handleSessionAccepted(const JID& from) {
- boost::filesystem::path path;
- JID bareJID = from.toBare();
- if (avatarManager_) {
- path = avatarManager_->getAvatarPath(bareJID);
- }
- ChatListWindow::Chat chat(bareJID, nickResolver_->jidToNick(bareJID), "", 0, StatusShow::None, path, false);
- chatListWindow_->addWhiteboardSession(chat);
- }
-
- void WhiteboardManager::handleSessionTerminated(const JID& from) {
- chatListWindow_->removeWhiteboardSession(from.toBare());
- }*/
-
- void WhiteboardManager::activateWindow(const JID& jid) {
- WhiteboardWindow* window = findWhiteboardWindow(jid);
- if (window != NULL) {
- window->activateWindow();
- }
- }
-
void WhiteboardManager::handleSessionTerminate(const JID& contact) {
onSessionTerminate(contact);
}
diff --git a/Swift/Controllers/WhiteboardManager.h b/Swift/Controllers/WhiteboardManager.h
index 78938e1..5bd42ac 100644
--- a/Swift/Controllers/WhiteboardManager.h
+++ b/Swift/Controllers/WhiteboardManager.h
@@ -21,14 +21,12 @@
namespace Swift {
class WhiteboardSessionManager;
- class ChatListWindowFactory;
- class ChatListWindow;
class NickResolver;
class AvatarManager;
class WhiteboardManager {
public:
- WhiteboardManager(WhiteboardWindowFactory* whiteboardWindowFactory, ChatListWindowFactory* chatListWindowFactory, UIEventStream* uiEventStream, NickResolver* nickResolver, AvatarManager* avatarManager, WhiteboardSessionManager* whiteboardSessionManager);
+ WhiteboardManager(WhiteboardWindowFactory* whiteboardWindowFactory, UIEventStream* uiEventStream, NickResolver* nickResolver, AvatarManager* avatarManager, WhiteboardSessionManager* whiteboardSessionManager);
~WhiteboardManager();
WhiteboardWindow* createNewWhiteboardWindow(const JID& contact, WhiteboardSession::ref session);
@@ -50,12 +48,10 @@ namespace Swift {
void requestSession(const JID& contact);
void cancelSession(const JID& from);
WhiteboardWindow* findWhiteboardWindow(const JID& contact);
- void activateWindow(const JID& jid);
private:
std::map<JID, WhiteboardWindow*> whiteboardWindows_;
WhiteboardWindowFactory* whiteboardWindowFactory_;
- ChatListWindow* chatListWindow_;
UIEventStream* uiEventStream_;
NickResolver* nickResolver_;
AvatarManager* avatarManager_;
diff --git a/Swift/QtUI/ChatList/QtChatListWindow.cpp b/Swift/QtUI/ChatList/QtChatListWindow.cpp
index 7561820..9692c9c 100644
--- a/Swift/QtUI/ChatList/QtChatListWindow.cpp
+++ b/Swift/QtUI/ChatList/QtChatListWindow.cpp
@@ -22,6 +22,7 @@
#include <Swift/Controllers/UIEvents/AddMUCBookmarkUIEvent.h>
#include <Swift/Controllers/UIEvents/RemoveMUCBookmarkUIEvent.h>
#include <Swift/Controllers/UIEvents/EditMUCBookmarkUIEvent.h>
+#include <Swift/Controllers/UIEvents/ShowWhiteboardUIEvent.h>
#include <Swift/Controllers/Settings/SettingsProvider.h>
@@ -100,7 +101,7 @@ void QtChatListWindow::handleItemActivated(const QModelIndex& index) {
}
else if (ChatListWhiteboardItem* whiteboardItem = dynamic_cast<ChatListWhiteboardItem*>(item)) {
if (!whiteboardItem->getChat().isMUC || bookmarksEnabled_) {
- onWhiteboardActivated(whiteboardItem->getChat().jid);
+ eventStream_->send(boost::make_shared<ShowWhiteboardUIEvent>(whiteboardItem->getChat().jid));
}
}
}