summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-06-25 18:36:42 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-06-25 18:36:42 (GMT)
commit5518a05a200d6531b5ee1d1409a1d451bc3b0749 (patch)
treed40e77f5ed163ff19ec7a9b2292ec74a8ad5b455 /Swift/QtUI/QtChatWindowFactory.cpp
parent9695b3f8343a04e71fea697fc8c280cdafe85465 (diff)
downloadswift-5518a05a200d6531b5ee1d1409a1d451bc3b0749.zip
swift-5518a05a200d6531b5ee1d1409a1d451bc3b0749.tar.bz2
Command-line option to not use tabs.
Resolves: #476
Diffstat (limited to 'Swift/QtUI/QtChatWindowFactory.cpp')
-rw-r--r--Swift/QtUI/QtChatWindowFactory.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/Swift/QtUI/QtChatWindowFactory.cpp b/Swift/QtUI/QtChatWindowFactory.cpp
index 5029324..9787c2c 100644
--- a/Swift/QtUI/QtChatWindowFactory.cpp
+++ b/Swift/QtUI/QtChatWindowFactory.cpp
@@ -19,7 +19,7 @@ QtChatWindowFactory::QtChatWindowFactory(QSplitter* splitter, QtSettingsProvider
tabs_ = tabs;
if (splitter) {
splitter->addWidget(tabs_);
- } else {
+ } else if (tabs_) {
QVariant chatTabsGeometryVariant = settings_->getQSettings()->value("chatTabsGeometry");
if (chatTabsGeometryVariant.isValid()) {
tabs_->restoreGeometry(chatTabsGeometryVariant.toByteArray());
@@ -30,12 +30,20 @@ QtChatWindowFactory::QtChatWindowFactory(QSplitter* splitter, QtSettingsProvider
ChatWindow* QtChatWindowFactory::createChatWindow(const JID &contact,UIEventStream* eventStream) {
QtChatWindow *chatWindow = new QtChatWindow(P2QSTRING(contact.toString()), eventStream);
- tabs_->addTab(chatWindow);
+ if (tabs_) {
+ tabs_->addTab(chatWindow);
+ } else {
+ QVariant chatGeometryVariant = settings_->getQSettings()->value("chatTabsGeometry");
+ if (chatGeometryVariant.isValid()) {
+ chatWindow->restoreGeometry(chatGeometryVariant.toByteArray());
+ }
+ connect(chatWindow, SIGNAL(geometryChanged()), this, SLOT(handleWindowGeometryChanged()));
+ }
return chatWindow;
}
void QtChatWindowFactory::handleWindowGeometryChanged() {
- settings_->getQSettings()->setValue("chatTabsGeometry", tabs_->saveGeometry());
+ settings_->getQSettings()->setValue("chatTabsGeometry", qobject_cast<QWidget*>(sender())->saveGeometry());
}
}