summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI')
-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
8 files changed, 42 insertions, 2 deletions
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",