summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2009-11-26 17:31:53 (GMT)
committerKevin Smith <git@kismith.co.uk>2009-11-26 17:46:21 (GMT)
commiteebdef9a7724ff7fa86a5d1cca37759d37bbb336 (patch)
tree7dd76b8e5d364eb1b019b2511a839a9eac8397e4 /Swift/QtUI
parent39e58e4593f54a65f810e73728fe2490958fcba2 (diff)
downloadswift-contrib-eebdef9a7724ff7fa86a5d1cca37759d37bbb336.zip
swift-contrib-eebdef9a7724ff7fa86a5d1cca37759d37bbb336.tar.bz2
Plumbing to show a dummy XMLConsoleWidget in the chat tabs.
This should all work now, and the XMLConsoleController needs to talk to the QtXMLConsoleWidget through the XMLConsoleWidget interface. Resolves: #256
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtChatWindowFactory.cpp4
-rw-r--r--Swift/QtUI/QtChatWindowFactory.h2
-rw-r--r--Swift/QtUI/QtLoginWindow.cpp16
-rw-r--r--Swift/QtUI/QtLoginWindow.h8
-rw-r--r--Swift/QtUI/QtLoginWindowFactory.cpp4
-rw-r--r--Swift/QtUI/QtLoginWindowFactory.h4
-rw-r--r--Swift/QtUI/QtSwift.cpp10
-rw-r--r--Swift/QtUI/QtSwift.h5
-rw-r--r--Swift/QtUI/QtXMLConsole.cpp0
-rw-r--r--Swift/QtUI/QtXMLConsole.h0
-rw-r--r--Swift/QtUI/QtXMLConsoleWidget.cpp7
-rw-r--r--Swift/QtUI/QtXMLConsoleWidget.h12
-rw-r--r--Swift/QtUI/QtXMLConsoleWidgetFactory.cpp22
-rw-r--r--Swift/QtUI/QtXMLConsoleWidgetFactory.h16
-rw-r--r--Swift/QtUI/SConscript2
15 files changed, 99 insertions, 13 deletions
diff --git a/Swift/QtUI/QtChatWindowFactory.cpp b/Swift/QtUI/QtChatWindowFactory.cpp
index c0f1e09..ff927c9 100644
--- a/Swift/QtUI/QtChatWindowFactory.cpp
+++ b/Swift/QtUI/QtChatWindowFactory.cpp
@@ -9,9 +9,9 @@
namespace Swift {
-QtChatWindowFactory::QtChatWindowFactory(QtTreeWidgetFactory *treeWidgetFactory, QSplitter* splitter, QtSettingsProvider* settings) : treeWidgetFactory_(treeWidgetFactory) {
+QtChatWindowFactory::QtChatWindowFactory(QtTreeWidgetFactory *treeWidgetFactory, QSplitter* splitter, QtSettingsProvider* settings, QtChatTabs* tabs) : treeWidgetFactory_(treeWidgetFactory) {
settings_ = settings;
- tabs_ = new QtChatTabs();
+ tabs_ = tabs;
if (splitter) {
splitter->addWidget(tabs_);
} else {
diff --git a/Swift/QtUI/QtChatWindowFactory.h b/Swift/QtUI/QtChatWindowFactory.h
index 4a5a7fb..0c8a092 100644
--- a/Swift/QtUI/QtChatWindowFactory.h
+++ b/Swift/QtUI/QtChatWindowFactory.h
@@ -13,7 +13,7 @@ namespace Swift {
class QtChatWindowFactory : public QObject, public ChatWindowFactory {
Q_OBJECT
public:
- QtChatWindowFactory(QtTreeWidgetFactory *treeWidgetFactory, QSplitter* splitter, QtSettingsProvider* settings);
+ QtChatWindowFactory(QtTreeWidgetFactory *treeWidgetFactory, QSplitter* splitter, QtSettingsProvider* settings, QtChatTabs* tabs);
ChatWindow* createChatWindow(const JID &contact);
private slots:
void handleWindowGeometryChanged();
diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp
index 6466692..2fd27c6 100644
--- a/Swift/QtUI/QtLoginWindow.cpp
+++ b/Swift/QtUI/QtLoginWindow.cpp
@@ -1,5 +1,7 @@
#include "QtLoginWindow.h"
+#include "Swift/Controllers/UIEvents/UIEventStream.h"
+#include "Swift/Controllers/UIEvents/RequestXMLConsoleUIEvent.h"
#include "QtAboutWidget.h"
#include "QtSwiftUtil.h"
#include "QtMainWindow.h"
@@ -20,7 +22,8 @@
namespace Swift{
-QtLoginWindow::QtLoginWindow() : QMainWindow() {
+QtLoginWindow::QtLoginWindow(UIEventStream* uiEventStream) : QMainWindow() {
+ uiEventStream_ = uiEventStream;
setWindowTitle("Swift");
resize(200, 500);
setContentsMargins(0,0,0,0);
@@ -104,6 +107,12 @@ QtLoginWindow::QtLoginWindow() : QMainWindow() {
QAction* aboutAction = new QAction("About Swift", this);
connect(aboutAction, SIGNAL(activated()), SLOT(handleAbout()));
swiftMenu_->addAction(aboutAction);
+
+ toolsMenu_ = new QMenu(tr("Tools"), this);
+
+ QAction* xmlConsoleAction = new QAction(tr("Show Debug Console"), this);
+ connect(xmlConsoleAction, SIGNAL(activated()), SLOT(handleShowXMLConsole()));
+ toolsMenu_->addAction(xmlConsoleAction);
QAction* quitAction = new QAction("Quit", this);
connect(quitAction, SIGNAL(activated()), SLOT(handleQuit()));
@@ -210,6 +219,10 @@ void QtLoginWindow::handleAbout() {
}
}
+void QtLoginWindow::handleShowXMLConsole() {
+ uiEventStream_->send(boost::shared_ptr<RequestXMLConsoleUIEvent>(new RequestXMLConsoleUIEvent()));
+}
+
void QtLoginWindow::handleQuit() {
QApplication::quit();
}
@@ -217,6 +230,7 @@ void QtLoginWindow::handleQuit() {
void QtLoginWindow::setInitialMenus() {
menuBar_->clear();
menuBar_->addMenu(swiftMenu_);
+ menuBar_->addMenu(toolsMenu_);
}
void QtLoginWindow::morphInto(MainWindow *mainWindow) {
diff --git a/Swift/QtUI/QtLoginWindow.h b/Swift/QtUI/QtLoginWindow.h
index 5abb10a..491521b 100644
--- a/Swift/QtUI/QtLoginWindow.h
+++ b/Swift/QtUI/QtLoginWindow.h
@@ -9,7 +9,7 @@
#include <QStackedWidget>
#include <QMenuBar>
-#include "Swift/Controllers/LoginWindow.h"
+#include "Swift/Controllers/UIInterfaces/LoginWindow.h"
#include "Swift/Controllers/MainWindow.h"
#include "QtAboutWidget.h"
@@ -18,10 +18,11 @@ class QToolButton;
class QComboBox;
namespace Swift {
+ class UIEventStream;
class QtLoginWindow : public QMainWindow, public LoginWindow {
Q_OBJECT
public:
- QtLoginWindow();
+ QtLoginWindow(UIEventStream* uiEventStream);
void morphInto(MainWindow *mainWindow);
virtual void loggedOut();
@@ -36,6 +37,7 @@ namespace Swift {
void loginClicked();
void handleCertficateChecked(bool);
void handleQuit();
+ void handleShowXMLConsole();
void handleAbout();
void bringToFront();
void handleUsernameTextChanged();
@@ -57,6 +59,8 @@ namespace Swift {
QToolButton* certificateButton_;
QMenuBar* menuBar_;
QMenu* swiftMenu_;
+ QMenu* toolsMenu_;
+ UIEventStream* uiEventStream_;
QPointer<QtAboutWidget> aboutDialog_;
};
}
diff --git a/Swift/QtUI/QtLoginWindowFactory.cpp b/Swift/QtUI/QtLoginWindowFactory.cpp
index c395c57..0453d0f 100644
--- a/Swift/QtUI/QtLoginWindowFactory.cpp
+++ b/Swift/QtUI/QtLoginWindowFactory.cpp
@@ -11,8 +11,8 @@ QtLoginWindowFactory::QtLoginWindowFactory(QSplitter* splitter, QtSystemTray* sy
systemTray_ = systemTray;
}
-LoginWindow* QtLoginWindowFactory::createLoginWindow() {
- window_ = new QtLoginWindow();
+LoginWindow* QtLoginWindowFactory::createLoginWindow(UIEventStream* uiEventStream) {
+ window_ = new QtLoginWindow(uiEventStream);
if (splitter_) {
splitter_->insertWidget(0, window_);
return window_;
diff --git a/Swift/QtUI/QtLoginWindowFactory.h b/Swift/QtUI/QtLoginWindowFactory.h
index dd5bc57..5af8b76 100644
--- a/Swift/QtUI/QtLoginWindowFactory.h
+++ b/Swift/QtUI/QtLoginWindowFactory.h
@@ -1,7 +1,7 @@
#ifndef SWIFT_QtLoginWindowFactory_H
#define SWIFT_QtLoginWindowFactory_H
-#include "Swift/Controllers/LoginWindowFactory.h"
+#include "Swift/Controllers/UIInterfaces/LoginWindowFactory.h"
#include "Swift/QtUI/QtSystemTray.h"
#include <QSplitter>
@@ -14,7 +14,7 @@ namespace Swift {
Q_OBJECT
public:
QtLoginWindowFactory(QSplitter* splitter, QtSystemTray* systemTray, QtSettingsProvider* settings);
- LoginWindow* createLoginWindow();
+ LoginWindow* createLoginWindow(UIEventStream* uiEventStream);
private slots:
void handleWindowGeometryChanged();
private:
diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp
index 2aaa27e..7e204e9 100644
--- a/Swift/QtUI/QtSwift.cpp
+++ b/Swift/QtUI/QtSwift.cpp
@@ -8,6 +8,7 @@
#include "Roster/QtTreeWidgetFactory.h"
#include "QtSystemTray.h"
#include "QtSoundPlayer.h"
+#include "QtXMLConsoleWidgetFactory.h"
#include <boost/bind.hpp>
#include <QSplitter>
@@ -32,18 +33,21 @@ QtSwift::QtSwift(bool netbookMode) {
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_);
+ 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_);
+ mainController_ = new MainController(chatWindowFactory_, rosterWindowFactory_, loginWindowFactory_, treeWidgetFactory_, settings_, application_, systemTray_, soundPlayer_, xmlConsoleWidgetFactory_);
}
QtSwift::~QtSwift() {
@@ -57,6 +61,8 @@ QtSwift::~QtSwift() {
delete systemTray_;
delete splitter_;
delete soundPlayer_;
+ delete tabs_;
+ delete xmlConsoleWidgetFactory_;
}
}
diff --git a/Swift/QtUI/QtSwift.h b/Swift/QtUI/QtSwift.h
index 263dc05..ad113d6 100644
--- a/Swift/QtUI/QtSwift.h
+++ b/Swift/QtUI/QtSwift.h
@@ -17,9 +17,10 @@ namespace Swift {
class QtMainWindowFactory;
class QtLoginWindowFactory;
class QtTreeWidgetFactory;
+ class QtXMLConsoleWidgetFactory;
class QtSystemTray;
class QtSoundPlayer;
-
+
class QtSwift : public QObject {
Q_OBJECT
public:
@@ -31,11 +32,13 @@ namespace Swift {
QtChatWindowFactory *chatWindowFactory_;
QtMainWindowFactory *rosterWindowFactory_;
QtLoginWindowFactory *loginWindowFactory_;
+ QtXMLConsoleWidgetFactory* xmlConsoleWidgetFactory_;
QtEventLoop clientMainThreadCaller_;
QtSettingsProvider *settings_;
QtSystemTray* systemTray_;
QSplitter* splitter_;
QtSoundPlayer* soundPlayer_;
+ QtChatTabs* tabs_;
Application* application_;
};
}
diff --git a/Swift/QtUI/QtXMLConsole.cpp b/Swift/QtUI/QtXMLConsole.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Swift/QtUI/QtXMLConsole.cpp
diff --git a/Swift/QtUI/QtXMLConsole.h b/Swift/QtUI/QtXMLConsole.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Swift/QtUI/QtXMLConsole.h
diff --git a/Swift/QtUI/QtXMLConsoleWidget.cpp b/Swift/QtUI/QtXMLConsoleWidget.cpp
new file mode 100644
index 0000000..d2ebb06
--- /dev/null
+++ b/Swift/QtUI/QtXMLConsoleWidget.cpp
@@ -0,0 +1,7 @@
+#include "QtXMLConsoleWidget.h"
+
+namespace Swift {
+QtXMLConsoleWidget::QtXMLConsoleWidget() {
+
+}
+}
diff --git a/Swift/QtUI/QtXMLConsoleWidget.h b/Swift/QtUI/QtXMLConsoleWidget.h
new file mode 100644
index 0000000..f545e18
--- /dev/null
+++ b/Swift/QtUI/QtXMLConsoleWidget.h
@@ -0,0 +1,12 @@
+#pragma once
+
+#include "Swift/Controllers/UIInterfaces/XMLConsoleWidget.h"
+#include "QtTabbable.h"
+
+namespace Swift {
+ class QtXMLConsoleWidget : public QtTabbable, public XMLConsoleWidget {
+ Q_OBJECT
+ public:
+ QtXMLConsoleWidget();
+ };
+}
diff --git a/Swift/QtUI/QtXMLConsoleWidgetFactory.cpp b/Swift/QtUI/QtXMLConsoleWidgetFactory.cpp
new file mode 100644
index 0000000..9e32b0a
--- /dev/null
+++ b/Swift/QtUI/QtXMLConsoleWidgetFactory.cpp
@@ -0,0 +1,22 @@
+#include "QtXMLConsoleWidgetFactory.h"
+
+#include "QtXMLConsoleWidget.h"
+#include "QtChatTabs.h"
+
+namespace Swift {
+
+QtXMLConsoleWidgetFactory::QtXMLConsoleWidgetFactory(QtChatTabs* tabs) {
+ tabs_ = tabs;
+}
+
+XMLConsoleWidget* QtXMLConsoleWidgetFactory::createXMLConsoleWidget() {
+ QtXMLConsoleWidget* widget = new QtXMLConsoleWidget();
+ tabs_->addTab(widget);
+ if (!tabs_->isVisible()) {
+ tabs_->show();
+ }
+ widget->show();
+ return widget;
+}
+
+}
diff --git a/Swift/QtUI/QtXMLConsoleWidgetFactory.h b/Swift/QtUI/QtXMLConsoleWidgetFactory.h
new file mode 100644
index 0000000..5158949
--- /dev/null
+++ b/Swift/QtUI/QtXMLConsoleWidgetFactory.h
@@ -0,0 +1,16 @@
+#pragma once
+
+#include "Swift/Controllers/UIInterfaces/XMLConsoleWidgetFactory.h"
+
+#include "QtXMLConsoleWidget.h"
+
+namespace Swift {
+ class QtChatTabs;
+ class QtXMLConsoleWidgetFactory : public XMLConsoleWidgetFactory {
+ public:
+ QtXMLConsoleWidgetFactory(QtChatTabs* tabs);
+ XMLConsoleWidget* createXMLConsoleWidget();
+ private:
+ QtChatTabs* tabs_;
+ };
+}
diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript
index 42cf07a..b70832a 100644
--- a/Swift/QtUI/SConscript
+++ b/Swift/QtUI/SConscript
@@ -68,6 +68,8 @@ sources = [
"QtSystemTray.cpp",
"QtTabbable.cpp",
"QtTextEdit.cpp",
+ "QtXMLConsoleWidgetFactory.cpp",
+ "QtXMLConsoleWidget.cpp",
"ChatSnippet.cpp",
"MessageSnippet.cpp",
"SystemMessageSnippet.cpp",