diff options
author | Kevin Smith <git@kismith.co.uk> | 2009-08-29 21:28:20 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2009-08-29 21:28:20 (GMT) |
commit | 509c20d24b59e09e7aeb5045abebad8a370bb3ba (patch) | |
tree | e063f3fa2060f09474aeb9d8fe4c68dbeb54ac35 /Swift/QtUI | |
parent | 0d6f71fadac786fb94302e8f5762e37f7e598e53 (diff) | |
download | swift-509c20d24b59e09e7aeb5045abebad8a370bb3ba.zip swift-509c20d24b59e09e7aeb5045abebad8a370bb3ba.tar.bz2 |
Experimental fix for stuff in background, chats coming to front when opened etc.
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/QtChatTabs.cpp | 11 | ||||
-rw-r--r-- | Swift/QtUI/QtChatTabs.h | 2 | ||||
-rw-r--r-- | Swift/QtUI/QtChatWindow.cpp | 4 | ||||
-rw-r--r-- | Swift/QtUI/QtChatWindow.h | 1 | ||||
-rw-r--r-- | Swift/QtUI/QtChatWindowFactory.cpp | 5 | ||||
-rw-r--r-- | Swift/QtUI/QtTabbable.h | 1 |
6 files changed, 23 insertions, 1 deletions
diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp index a896dc9..e79b2ef 100644 --- a/Swift/QtUI/QtChatTabs.cpp +++ b/Swift/QtUI/QtChatTabs.cpp @@ -1,6 +1,7 @@ #include "QtChatTabs.h" #include <QCloseEvent> +#include <QtGlobal> #include <QTabWidget> #include <QLayout> @@ -36,6 +37,7 @@ void QtChatTabs::addTab(QtTabbable* tab) { connect(tab, SIGNAL(titleUpdated()), this, SLOT(handleTabTitleUpdated())); connect(tab, SIGNAL(windowClosing()), this, SLOT(handleTabClosing())); connect(tab, SIGNAL(windowOpening()), this, SLOT(handleWidgetShown())); + connect(tab, SIGNAL(wantsToActivate()), this, SLOT(handleWantsToActivate())); } void QtChatTabs::handleWidgetShown() { @@ -50,6 +52,15 @@ void QtChatTabs::handleWidgetShown() { show(); } +void QtChatTabs::handleWantsToActivate() { + QtTabbable* widget = qobject_cast<QtTabbable*>(sender()); + Q_ASSERT(widget); + Q_ASSERT(tabs_->indexOf(widget) >= 0); + //Un-minimize and bring to front. + setWindowState(windowState() & ~Qt::WindowMinimized | Qt::WindowActive); + tabs_->setCurrentWidget(widget); +} + void QtChatTabs::handleTabClosing() { QWidget* widget = qobject_cast<QWidget*>(sender()); if (!widget) { diff --git a/Swift/QtUI/QtChatTabs.h b/Swift/QtUI/QtChatTabs.h index 97967c9..87b8b10 100644 --- a/Swift/QtUI/QtChatTabs.h +++ b/Swift/QtUI/QtChatTabs.h @@ -10,6 +10,7 @@ namespace Swift { public: QtChatTabs(); void addTab(QtTabbable* tab); + void minimise(); protected slots: void closeEvent(QCloseEvent* event); @@ -19,6 +20,7 @@ namespace Swift { void handleTabTitleUpdated(); void handleTabCloseRequested(int index); void handleWidgetShown(); + void handleWantsToActivate(); private: QTabWidget* tabs_; }; diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index b7987b9..7e71b7f 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -195,4 +195,8 @@ void QtChatWindow::show() { emit windowOpening(); } +void QtChatWindow::activate() { + emit wantsToActivate(); +} + } diff --git a/Swift/QtUI/QtChatWindow.h b/Swift/QtUI/QtChatWindow.h index ea4983f..80961f8 100644 --- a/Swift/QtUI/QtChatWindow.h +++ b/Swift/QtUI/QtChatWindow.h @@ -23,6 +23,7 @@ namespace Swift { void addSystemMessage(const String& message); void addErrorMessage(const String& errorMessage); void show(); + void activate(); void setUnreadMessageCount(int count); void convertToMUC(); TreeWidget *getTreeWidget(); diff --git a/Swift/QtUI/QtChatWindowFactory.cpp b/Swift/QtUI/QtChatWindowFactory.cpp index 47c943f..b3efeac 100644 --- a/Swift/QtUI/QtChatWindowFactory.cpp +++ b/Swift/QtUI/QtChatWindowFactory.cpp @@ -17,7 +17,10 @@ QtChatWindowFactory::QtChatWindowFactory(QtTreeWidgetFactory *treeWidgetFactory, ChatWindow* QtChatWindowFactory::createChatWindow(const JID &contact) { QtChatWindow *chatWindow = new QtChatWindow(P2QSTRING(contact.toString()), treeWidgetFactory_); tabs_->addTab(chatWindow); - tabs_->show(); + if (!tabs_->isVisible()) { + tabs_->showMinimized(); + //tabs_->minimise(); + } //chatWindow->show(); return chatWindow; } diff --git a/Swift/QtUI/QtTabbable.h b/Swift/QtUI/QtTabbable.h index ebd495e..e3dd47b 100644 --- a/Swift/QtUI/QtTabbable.h +++ b/Swift/QtUI/QtTabbable.h @@ -15,5 +15,6 @@ namespace Swift { void titleUpdated(); void windowClosing(); void windowOpening(); + void wantsToActivate(); }; } |