summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
@@ -20,13 +20,13 @@
<dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
<value>all</value>
</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>
<value>scons</value>
</dictionary>
<dictionary>
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
@@ -4,16 +4,17 @@
#include <QCloseEvent>
#include <QDesktopWidget>
#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);
/*Closable tabs are only in Qt4.5 and later*/
tabs_->setTabsClosable(true);
connect(tabs_, SIGNAL(tabCloseRequested(int)), this, SLOT(handleTabCloseRequested(int)));
@@ -94,17 +95,19 @@ void QtChatTabs::handleTabTitleUpdated() {
}
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());
}
}
void QtChatTabs::resizeEvent(QResizeEvent*) {
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,9 +1,10 @@
#pragma once
#include "QtTabbable.h"
+#include "QtTabWidget.h"
#include <QWidget>
#include <QRect>
class QTabWidget;
namespace Swift {
@@ -26,10 +27,10 @@ namespace Swift {
void handleTabTitleUpdated();
void handleTabTitleUpdated(QWidget* widget);
void handleTabCloseRequested(int index);
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
@@ -131,12 +131,16 @@ void QtChatWindow::showEvent(QShowEvent* event) {
void QtChatWindow::setUnreadMessageCount(int count) {
unreadCount_ = count;
updateTitleWithUnreadCount();
}
+bool QtChatWindow::isWidgetAlerting() {
+ return unreadCount_ > 0;
+}
+
void QtChatWindow::setName(const String& name) {
contact_ = P2QSTRING(name);
updateTitleWithUnreadCount();
}
void QtChatWindow::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
@@ -31,12 +31,13 @@ namespace Swift {
void setAvailableSecurityLabels(const std::vector<SecurityLabel>& labels);
void setSecurityLabelsEnabled(bool enabled);
void setSecurityLabelsError();
SecurityLabel getSelectedSecurityLabel();
void setName(const String& name);
void setInputEnabled(bool enabled);
+ virtual bool isWidgetAlerting();
protected slots:
void qAppFocusChanged(QWidget* old, QWidget* now);
void closeEvent(QCloseEvent* event);
protected:
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
@@ -5,12 +5,13 @@
namespace Swift {
class QtTabbable : public QWidget {
Q_OBJECT
public:
bool isWidgetSelected();
+ virtual bool isWidgetAlerting() {return false;};
protected:
QtTabbable() : QWidget() {};
signals:
void titleUpdated();
void windowClosing();
diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript
index 77bc8f8..d6bc47a 100644
--- a/Swift/QtUI/SConscript
+++ b/Swift/QtUI/SConscript
@@ -65,12 +65,13 @@ sources = [
"QtSwift.cpp",
"QtChatView.cpp",
"QtChatTabs.cpp",
"QtSoundPlayer.cpp",
"QtSystemTray.cpp",
"QtTabbable.cpp",
+ "QtTabWidget.cpp",
"QtTextEdit.cpp",
"QtXMLConsoleWidgetFactory.cpp",
"QtXMLConsoleWidget.cpp",
"ChatSnippet.cpp",
"MessageSnippet.cpp",
"SystemMessageSnippet.cpp",