summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2009-12-19 19:52:05 (GMT)
committerKevin Smith <git@kismith.co.uk>2009-12-19 19:52:05 (GMT)
commitca44245623972e6d52fe72acca09a96772d7e26a (patch)
tree6639114733f2769269080efadb24080216745fd6
parentbdb8ace202917809c5492aa37921e0ffd0354730 (diff)
downloadswift-contrib-ca44245623972e6d52fe72acca09a96772d7e26a.zip
swift-contrib-ca44245623972e6d52fe72acca09a96772d7e26a.tar.bz2
Colour tabs with waiting messages.
Resolves: #278
-rw-r--r--.project2
-rw-r--r--Swift/QtUI/QtChatTabs.cpp5
-rw-r--r--Swift/QtUI/QtChatTabs.h3
-rw-r--r--Swift/QtUI/QtChatWindow.cpp4
-rw-r--r--Swift/QtUI/QtChatWindow.h1
-rw-r--r--Swift/QtUI/QtTabWidget.cpp17
-rw-r--r--Swift/QtUI/QtTabWidget.h12
-rw-r--r--Swift/QtUI/QtTabbable.h1
-rw-r--r--Swift/QtUI/SConscript1
9 files changed, 43 insertions, 3 deletions
diff --git a/.project b/.project
index 04db171..e6f13ff 100644
--- a/.project
+++ b/.project
@@ -23,7 +23,7 @@
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
- <value>-j 2 check=1</value>
+ <value>-j 2</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp
index f9a42a4..6e5c55d 100644
--- a/Swift/QtUI/QtChatTabs.cpp
+++ b/Swift/QtUI/QtChatTabs.cpp
@@ -7,10 +7,11 @@
#include <QtGlobal>
#include <QTabWidget>
#include <QLayout>
+#include <QTabBar>
namespace Swift {
QtChatTabs::QtChatTabs() : QWidget() {
- tabs_ = new QTabWidget(this);
+ tabs_ = new QtTabWidget(this);
#if QT_VERSION >= 0x040500
/*For Macs, change the tab rendering.*/
tabs_->setDocumentMode(true);
@@ -97,11 +98,13 @@ void QtChatTabs::handleTabTitleUpdated(QWidget* widget) {
if (!widget) {
return;
}
+ QtTabbable* tabbable = qobject_cast<QtTabbable*>(widget);
int index = tabs_->indexOf(widget);
if (index < 0) {
return;
}
tabs_->setTabText(index, widget->windowTitle());
+ tabs_->tabBar()->setTabTextColor(index, tabbable->isWidgetAlerting() ? QColor(255,0,0) : QColor(-1,-1,-1)); //invalid resets to default
if (widget == tabs_->currentWidget()) {
setWindowTitle(widget->windowTitle());
}
diff --git a/Swift/QtUI/QtChatTabs.h b/Swift/QtUI/QtChatTabs.h
index c51b88d..12ab3b8 100644
--- a/Swift/QtUI/QtChatTabs.h
+++ b/Swift/QtUI/QtChatTabs.h
@@ -1,6 +1,7 @@
#pragma once
#include "QtTabbable.h"
+#include "QtTabWidget.h"
#include <QWidget>
#include <QRect>
@@ -29,7 +30,7 @@ namespace Swift {
void handleWidgetShown();
void handleWantsToActivate();
private:
- QTabWidget* tabs_;
+ QtTabWidget* tabs_;
};
}
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp
index bebebe8..831dbfd 100644
--- a/Swift/QtUI/QtChatWindow.cpp
+++ b/Swift/QtUI/QtChatWindow.cpp
@@ -134,6 +134,10 @@ void QtChatWindow::setUnreadMessageCount(int count) {
updateTitleWithUnreadCount();
}
+bool QtChatWindow::isWidgetAlerting() {
+ return unreadCount_ > 0;
+}
+
void QtChatWindow::setName(const String& name) {
contact_ = P2QSTRING(name);
updateTitleWithUnreadCount();
diff --git a/Swift/QtUI/QtChatWindow.h b/Swift/QtUI/QtChatWindow.h
index 9c41ddc..b743aaf 100644
--- a/Swift/QtUI/QtChatWindow.h
+++ b/Swift/QtUI/QtChatWindow.h
@@ -34,6 +34,7 @@ namespace Swift {
SecurityLabel getSelectedSecurityLabel();
void setName(const String& name);
void setInputEnabled(bool enabled);
+ virtual bool isWidgetAlerting();
protected slots:
void qAppFocusChanged(QWidget* old, QWidget* now);
diff --git a/Swift/QtUI/QtTabWidget.cpp b/Swift/QtUI/QtTabWidget.cpp
new file mode 100644
index 0000000..64399c5
--- /dev/null
+++ b/Swift/QtUI/QtTabWidget.cpp
@@ -0,0 +1,17 @@
+#include "QtTabWidget.h"
+
+namespace Swift {
+
+QtTabWidget::QtTabWidget(QWidget* parent) : QTabWidget(parent) {
+
+}
+
+QtTabWidget::~QtTabWidget() {
+
+}
+
+QTabBar* QtTabWidget::tabBar() {
+ return QTabWidget::tabBar();
+}
+
+}
diff --git a/Swift/QtUI/QtTabWidget.h b/Swift/QtUI/QtTabWidget.h
new file mode 100644
index 0000000..a7721bf
--- /dev/null
+++ b/Swift/QtUI/QtTabWidget.h
@@ -0,0 +1,12 @@
+#pragma once
+#include <QTabWidget>
+
+namespace Swift {
+ class QtTabWidget : public QTabWidget {
+ Q_OBJECT
+ public:
+ QtTabWidget(QWidget* parent);
+ ~QtTabWidget();
+ QTabBar* tabBar();
+ };
+}
diff --git a/Swift/QtUI/QtTabbable.h b/Swift/QtUI/QtTabbable.h
index e3dd47b..c28e301 100644
--- a/Swift/QtUI/QtTabbable.h
+++ b/Swift/QtUI/QtTabbable.h
@@ -8,6 +8,7 @@ namespace Swift {
Q_OBJECT
public:
bool isWidgetSelected();
+ virtual bool isWidgetAlerting() {return false;};
protected:
QtTabbable() : QWidget() {};
diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript
index 77bc8f8..d6bc47a 100644
--- a/Swift/QtUI/SConscript
+++ b/Swift/QtUI/SConscript
@@ -68,6 +68,7 @@ sources = [
"QtSoundPlayer.cpp",
"QtSystemTray.cpp",
"QtTabbable.cpp",
+ "QtTabWidget.cpp",
"QtTextEdit.cpp",
"QtXMLConsoleWidgetFactory.cpp",
"QtXMLConsoleWidget.cpp",