summaryrefslogtreecommitdiffstats
path: root/Swift
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
parent9695b3f8343a04e71fea697fc8c280cdafe85465 (diff)
downloadswift-5518a05a200d6531b5ee1d1409a1d451bc3b0749.zip
swift-5518a05a200d6531b5ee1d1409a1d451bc3b0749.tar.bz2
Command-line option to not use tabs.
Resolves: #476
Diffstat (limited to 'Swift')
-rw-r--r--Swift/QtUI/QtChatWindow.cpp17
-rw-r--r--Swift/QtUI/QtChatWindow.h6
-rw-r--r--Swift/QtUI/QtChatWindowFactory.cpp14
-rw-r--r--Swift/QtUI/QtSwift.cpp3
4 files changed, 35 insertions, 5 deletions
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp
index fcc1308..8fed3c6 100644
--- a/Swift/QtUI/QtChatWindow.cpp
+++ b/Swift/QtUI/QtChatWindow.cpp
@@ -222,7 +222,11 @@ void QtChatWindow::setName(const String& name) {
}
void QtChatWindow::updateTitleWithUnreadCount() {
- setWindowTitle(contact_);
+ if (isWindow()) {
+ setWindowTitle(unreadCount_ > 0 ? QString("(%1) %2").arg(unreadCount_).arg(contact_) : contact_);
+ } else {
+ setWindowTitle(contact_);
+ }
emit titleUpdated();
}
@@ -318,7 +322,18 @@ void QtChatWindow::show() {
}
void QtChatWindow::activate() {
+ if (isWindow()) {
+ QWidget::show();
+ }
emit wantsToActivate();
}
+void QtChatWindow::resizeEvent(QResizeEvent*) {
+ emit geometryChanged();
+}
+
+void QtChatWindow::moveEvent(QMoveEvent*) {
+ emit geometryChanged();
+}
+
}
diff --git a/Swift/QtUI/QtChatWindow.h b/Swift/QtUI/QtChatWindow.h
index 00d7f25..f68ff1c 100644
--- a/Swift/QtUI/QtChatWindow.h
+++ b/Swift/QtUI/QtChatWindow.h
@@ -48,12 +48,18 @@ namespace Swift {
void setTabComplete(TabComplete* completer);
int getCount();
+ signals:
+ void geometryChanged();
+
protected slots:
void qAppFocusChanged(QWidget* old, QWidget* now);
void closeEvent(QCloseEvent* event);
+ void resizeEvent(QResizeEvent* event);
+ void moveEvent(QMoveEvent* event);
protected:
void showEvent(QShowEvent* event);
+
private slots:
void returnPressed();
void handleInputChanged();
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());
}
}
diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp
index 2bf1fcf..3e8bc8b 100644
--- a/Swift/QtUI/QtSwift.cpp
+++ b/Swift/QtUI/QtSwift.cpp
@@ -45,6 +45,7 @@ po::options_description QtSwift::getOptionsDescription() {
result.add_options()
("help", "produce help message")
("netbook-mode", "use netbook mode display")
+ ("no-tabs", "don't manage chat windows in tabs")
("latency-debug", "use latency debugging")
;
return result;
@@ -62,7 +63,7 @@ QtSwift::QtSwift(po::variables_map options) : autoUpdater_(NULL) {
QCoreApplication::setOrganizationDomain(SWIFT_ORGANIZATION_DOMAIN);
QCoreApplication::setApplicationVersion(buildVersion);
- tabs_ = new QtChatTabs();
+ tabs_ = options.count("no-tabs") && !splitter_ > 0 ? NULL : new QtChatTabs();
settings_ = new QtSettingsProvider();
application_ = new PlatformApplication(SWIFT_APPLICATION_NAME);
systemTray_ = new QtSystemTray();