summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
Diffstat (limited to 'Swift')
-rw-r--r--Swift/Controllers/HighlightEditorController.cpp26
-rw-r--r--Swift/Controllers/HighlightEditorController.h13
-rw-r--r--Swift/Controllers/MainController.cpp2
-rw-r--r--Swift/Controllers/UIInterfaces/HighlightEditorWindow.cpp19
-rw-r--r--Swift/Controllers/UIInterfaces/HighlightEditorWindow.h19
-rw-r--r--Swift/Controllers/UIInterfaces/HighlightEditorWindowFactory.h24
-rw-r--r--Swift/Controllers/UIInterfaces/UIFactory.h4
-rw-r--r--Swift/QtUI/QtUIFactory.cpp6
8 files changed, 93 insertions, 20 deletions
diff --git a/Swift/Controllers/HighlightEditorController.cpp b/Swift/Controllers/HighlightEditorController.cpp
index 899e4bb..2b57dbf 100644
--- a/Swift/Controllers/HighlightEditorController.cpp
+++ b/Swift/Controllers/HighlightEditorController.cpp
@@ -7,34 +7,42 @@
#include <boost/bind.hpp>
#include <Swift/Controllers/HighlightEditorController.h>
-#include <Swift/Controllers/UIInterfaces/HighlightEditorWidget.h>
-#include <Swift/Controllers/UIInterfaces/HighlightEditorWidgetFactory.h>
#include <Swift/Controllers/UIEvents/RequestHighlightEditorUIEvent.h>
#include <Swift/Controllers/UIEvents/UIEventStream.h>
+#include <Swift/Controllers/UIInterfaces/HighlightEditorWindowFactory.h>
+#include <Swift/Controllers/UIInterfaces/HighlightEditorWindow.h>
+#include <Swift/Controllers/ContactSuggester.h>
namespace Swift {
-HighlightEditorController::HighlightEditorController(UIEventStream* uiEventStream, HighlightEditorWidgetFactory* highlightEditorWidgetFactory, HighlightManager* highlightManager) : highlightEditorWidgetFactory_(highlightEditorWidgetFactory), highlightEditorWidget_(NULL), highlightManager_(highlightManager)
+HighlightEditorController::HighlightEditorController(UIEventStream* uiEventStream, ContactSuggester* contactSuggester, HighlightEditorWindowFactory* highlightEditorWindowFactory, HighlightManager* highlightManager)
+: highlightEditorWindowFactory_(highlightEditorWindowFactory), highlightEditorWindow_(NULL), highlightManager_(highlightManager), contactSuggester_(contactSuggester)
{
uiEventStream->onUIEvent.connect(boost::bind(&HighlightEditorController::handleUIEvent, this, _1));
}
HighlightEditorController::~HighlightEditorController()
{
- delete highlightEditorWidget_;
- highlightEditorWidget_ = NULL;
+ delete highlightEditorWindow_;
+ highlightEditorWindow_ = NULL;
}
void HighlightEditorController::handleUIEvent(boost::shared_ptr<UIEvent> rawEvent)
{
boost::shared_ptr<RequestHighlightEditorUIEvent> event = boost::dynamic_pointer_cast<RequestHighlightEditorUIEvent>(rawEvent);
if (event) {
- if (!highlightEditorWidget_) {
- highlightEditorWidget_ = highlightEditorWidgetFactory_->createHighlightEditorWidget();
- highlightEditorWidget_->setHighlightManager(highlightManager_);
+ if (!highlightEditorWindow_) {
+ highlightEditorWindow_ = highlightEditorWindowFactory_->createHighlightEditorWindow();
+ highlightEditorWindow_->setHighlightManager(highlightManager_);
+ highlightEditorWindow_->onContactSuggestionsRequested.connect(boost::bind(&HighlightEditorController::handleContactSuggestionsRequested, this, _1));
}
- highlightEditorWidget_->show();
+ highlightEditorWindow_->show();
}
}
+void HighlightEditorController::handleContactSuggestionsRequested(const std::string& text)
+{
+ highlightEditorWindow_->setContactSuggestions(contactSuggester_->getSuggestions(text));
+}
+
}
diff --git a/Swift/Controllers/HighlightEditorController.h b/Swift/Controllers/HighlightEditorController.h
index 3868251..f784248 100644
--- a/Swift/Controllers/HighlightEditorController.h
+++ b/Swift/Controllers/HighlightEditorController.h
@@ -14,25 +14,28 @@ namespace Swift {
class UIEventStream;
- class HighlightEditorWidgetFactory;
- class HighlightEditorWidget;
+ class HighlightEditorWindowFactory;
+ class HighlightEditorWindow;
class HighlightManager;
+ class ContactSuggester;
class HighlightEditorController {
public:
- HighlightEditorController(UIEventStream* uiEventStream, HighlightEditorWidgetFactory* highlightEditorWidgetFactory, HighlightManager* highlightManager);
+ HighlightEditorController(UIEventStream* uiEventStream, ContactSuggester* contactSuggester, HighlightEditorWindowFactory* highlightEditorWindowFactory, HighlightManager* highlightManager);
~HighlightEditorController();
HighlightManager* getHighlightManager() const { return highlightManager_; }
private:
void handleUIEvent(boost::shared_ptr<UIEvent> event);
+ void handleContactSuggestionsRequested(const std::string& text);
private:
- HighlightEditorWidgetFactory* highlightEditorWidgetFactory_;
- HighlightEditorWidget* highlightEditorWidget_;
+ HighlightEditorWindowFactory* highlightEditorWindowFactory_;
+ HighlightEditorWindow* highlightEditorWindow_;
HighlightManager* highlightManager_;
+ ContactSuggester* contactSuggester_;
};
}
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index 45a0df7..b527583 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -167,7 +167,7 @@ MainController::MainController(
loginWindow_->setShowNotificationToggle(!notifier->isExternallyConfigured());
highlightManager_ = new HighlightManager(settings_);
- highlightEditorController_ = new HighlightEditorController(uiEventStream_, uiFactory_, highlightManager_);
+ highlightEditorController_ = new HighlightEditorController(uiEventStream_, contactSuggesterWithRoster_, uiFactory_, highlightManager_);
soundEventController_ = new SoundEventController(eventController_, soundPlayer, settings, highlightManager_);
diff --git a/Swift/Controllers/UIInterfaces/HighlightEditorWindow.cpp b/Swift/Controllers/UIInterfaces/HighlightEditorWindow.cpp
new file mode 100644
index 0000000..f90903b
--- /dev/null
+++ b/Swift/Controllers/UIInterfaces/HighlightEditorWindow.cpp
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2014 Kevin Smith and Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#include <Swift/Controllers/UIInterfaces/HighlightEditorWindow.h>
+
+namespace Swift {
+
+HighlightEditorWindow::HighlightEditorWindow()
+{
+}
+
+HighlightEditorWindow::~HighlightEditorWindow()
+{
+}
+
+}
diff --git a/Swift/Controllers/UIInterfaces/HighlightEditorWindow.h b/Swift/Controllers/UIInterfaces/HighlightEditorWindow.h
new file mode 100644
index 0000000..760b4a8
--- /dev/null
+++ b/Swift/Controllers/UIInterfaces/HighlightEditorWindow.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2014 Kevin Smith and Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+namespace Swift {
+
+class HighlightEditorWindow {
+public:
+ HighlightEditorWindow();
+ virtual ~HighlightEditorWindow();
+ virtual void setHighlightManager(HighlightManager *highlightManager) {highlightManager_ = highlightManager;}
+ virtual void show() = 0;
+private:
+ HighlightManager* highlightManager_;
+};
+
+}
diff --git a/Swift/Controllers/UIInterfaces/HighlightEditorWindowFactory.h b/Swift/Controllers/UIInterfaces/HighlightEditorWindowFactory.h
new file mode 100644
index 0000000..e0aaaef
--- /dev/null
+++ b/Swift/Controllers/UIInterfaces/HighlightEditorWindowFactory.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2012 Mateusz Piękos
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+/*
+ * Copyright (c) 2014 Kevin Smith and Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+namespace Swift {
+ class HighlightEditorWindow;
+
+ class HighlightEditorWindowFactory {
+ public :
+ virtual ~HighlightEditorWindowFactory() {}
+
+ virtual HighlightEditorWindow* createHighlightEditorWindow() = 0;
+ };
+}
diff --git a/Swift/Controllers/UIInterfaces/UIFactory.h b/Swift/Controllers/UIInterfaces/UIFactory.h
index 990dc98..15f4a6d 100644
--- a/Swift/Controllers/UIInterfaces/UIFactory.h
+++ b/Swift/Controllers/UIInterfaces/UIFactory.h
@@ -21,7 +21,7 @@
#include <Swift/Controllers/UIInterfaces/AdHocCommandWindowFactory.h>
#include <Swift/Controllers/UIInterfaces/FileTransferListWidgetFactory.h>
#include <Swift/Controllers/UIInterfaces/WhiteboardWindowFactory.h>
-#include <Swift/Controllers/UIInterfaces/HighlightEditorWidgetFactory.h>
+#include <Swift/Controllers/UIInterfaces/HighlightEditorWindowFactory.h>
#include <Swift/Controllers/UIInterfaces/BlockListEditorWidgetFactory.h>
namespace Swift {
@@ -41,7 +41,7 @@ namespace Swift {
public AdHocCommandWindowFactory,
public FileTransferListWidgetFactory,
public WhiteboardWindowFactory,
- public HighlightEditorWidgetFactory,
+ public HighlightEditorWindowFactory,
public BlockListEditorWidgetFactory {
public:
virtual ~UIFactory() {}
diff --git a/Swift/QtUI/QtUIFactory.cpp b/Swift/QtUI/QtUIFactory.cpp
index e5db22d..6b293a9 100644
--- a/Swift/QtUI/QtUIFactory.cpp
+++ b/Swift/QtUI/QtUIFactory.cpp
@@ -25,7 +25,7 @@
#include <Swift/QtUI/QtContactEditWindow.h>
#include <Swift/QtUI/QtAdHocCommandWindow.h>
#include <Swift/QtUI/QtFileTransferListWidget.h>
-#include <Swift/QtUI/QtHighlightEditorWidget.h>
+#include <Swift/QtUI/QtHighlightEditor.h>
#include <Swift/QtUI/Whiteboard/QtWhiteboardWindow.h>
#include <Swift/Controllers/Settings/SettingsProviderHierachy.h>
#include <Swift/QtUI/QtUISettingConstants.h>
@@ -164,8 +164,8 @@ WhiteboardWindow* QtUIFactory::createWhiteboardWindow(boost::shared_ptr<Whiteboa
return new QtWhiteboardWindow(whiteboardSession);
}
-HighlightEditorWidget* QtUIFactory::createHighlightEditorWidget() {
- return new QtHighlightEditorWidget();
+HighlightEditorWindow* QtUIFactory::createHighlightEditorWindow() {
+ return new QtHighlightEditor(qtOnlySettings);
}
BlockListEditorWidget *QtUIFactory::createBlockListEditorWidget() {