diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-08-29 22:32:59 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-08-30 14:53:32 (GMT) |
commit | b9b535ffd46382c413504a1781400c1a554e04a8 (patch) | |
tree | 723b1e948930478e0324c374f74f1fabc88699ec /Swift/QtUI/QtChatWindowFactory.cpp | |
parent | 5546afc2bbf8ab0fd49647150da7a5f3df01deaf (diff) | |
download | swift-contrib-b9b535ffd46382c413504a1781400c1a554e04a8.zip swift-contrib-b9b535ffd46382c413504a1781400c1a554e04a8.tar.bz2 |
Render the Chat view directly with DOM commands, not javascript.
Tested locally, but it's conceivable there will be regressions.
Diffstat (limited to 'Swift/QtUI/QtChatWindowFactory.cpp')
-rw-r--r-- | Swift/QtUI/QtChatWindowFactory.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/Swift/QtUI/QtChatWindowFactory.cpp b/Swift/QtUI/QtChatWindowFactory.cpp index 9787c2c..d146474 100644 --- a/Swift/QtUI/QtChatWindowFactory.cpp +++ b/Swift/QtUI/QtChatWindowFactory.cpp @@ -11,12 +11,15 @@ #include "QtChatTabs.h" #include "QtChatWindow.h" #include "QtSwiftUtil.h" +#include "QtChatTheme.h" +#include <qdebug.h> namespace Swift { -QtChatWindowFactory::QtChatWindowFactory(QSplitter* splitter, QtSettingsProvider* settings, QtChatTabs* tabs) { +QtChatWindowFactory::QtChatWindowFactory(QSplitter* splitter, QtSettingsProvider* settings, QtChatTabs* tabs, const QString& themePath) : themePath_(themePath) { settings_ = settings; tabs_ = tabs; + theme_ = NULL; if (splitter) { splitter->addWidget(tabs_); } else if (tabs_) { @@ -28,8 +31,19 @@ QtChatWindowFactory::QtChatWindowFactory(QSplitter* splitter, QtSettingsProvider } } +QtChatWindowFactory::~QtChatWindowFactory() { + delete theme_; +} + ChatWindow* QtChatWindowFactory::createChatWindow(const JID &contact,UIEventStream* eventStream) { - QtChatWindow *chatWindow = new QtChatWindow(P2QSTRING(contact.toString()), eventStream); + if (!theme_) { + theme_ = new QtChatTheme(themePath_); + if (theme_->getIncomingContent().isEmpty()) { + delete theme_; + theme_ = new QtChatTheme(""); /* Use the inbuilt theme */ + } + } + QtChatWindow *chatWindow = new QtChatWindow(P2QSTRING(contact.toString()), theme_, eventStream); if (tabs_) { tabs_->addTab(chatWindow); } else { |