summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtSystemTray.cpp11
-rw-r--r--Swift/QtUI/QtSystemTray.h3
2 files changed, 12 insertions, 2 deletions
diff --git a/Swift/QtUI/QtSystemTray.cpp b/Swift/QtUI/QtSystemTray.cpp
index 57bf20c..90d07dd 100644
--- a/Swift/QtUI/QtSystemTray.cpp
+++ b/Swift/QtUI/QtSystemTray.cpp
@@ -11,7 +11,7 @@
#include <QResource>
namespace Swift {
-QtSystemTray::QtSystemTray() : QObject(), onlineIcon_(":icons/online.png"), awayIcon_(":icons/away.png"), dndIcon_(":icons/dnd.png"), offlineIcon_(":icons/offline.png"), newMessageIcon_(":icons/new-chat.png"), unreadMessages_(false) {
+QtSystemTray::QtSystemTray() : QObject(), onlineIcon_(":icons/online.png"), awayIcon_(":icons/away.png"), dndIcon_(":icons/dnd.png"), offlineIcon_(":icons/offline.png"), newMessageIcon_(":icons/new-chat.png"), throbberIcon_(":/icons/throbber.gif"), unreadMessages_(false), connecting_(false) {
trayIcon_ = new QSystemTrayIcon(offlineIcon_);
connect(trayIcon_, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(handleIconActivated(QSystemTrayIcon::ActivationReason)));
trayIcon_->show();
@@ -26,12 +26,17 @@ void QtSystemTray::setUnreadMessages(bool some) {
updateStatusIcon();
}
+void QtSystemTray::setConnecting() {
+ connecting_ = true;
+}
+
void QtSystemTray::handleIconActivated(QSystemTrayIcon::ActivationReason reason) {
if (reason == QSystemTrayIcon::Trigger) {
emit clicked();
}
}
void QtSystemTray::setStatusType(StatusShow::Type type) {
+ connecting_ = false;
statusType_ = type;
updateStatusIcon();
}
@@ -39,7 +44,9 @@ void QtSystemTray::setStatusType(StatusShow::Type type) {
void QtSystemTray::updateStatusIcon() {
if (unreadMessages_) {
trayIcon_->setIcon(newMessageIcon_);
- } else {
+ } else if (connecting_) {
+ trayIcon_->setIcon(throbberIcon_);
+ } else {
switch (statusType_) {
case StatusShow::Online : trayIcon_->setIcon(onlineIcon_);break;
case StatusShow::FFC : trayIcon_->setIcon(onlineIcon_);break;
diff --git a/Swift/QtUI/QtSystemTray.h b/Swift/QtUI/QtSystemTray.h
index c889ecf..30fc860 100644
--- a/Swift/QtUI/QtSystemTray.h
+++ b/Swift/QtUI/QtSystemTray.h
@@ -20,6 +20,7 @@ namespace Swift {
~QtSystemTray();
void setUnreadMessages(bool some);
void setStatusType(StatusShow::Type type);
+ void setConnecting();
signals:
void clicked();
private slots:
@@ -33,6 +34,8 @@ namespace Swift {
QIcon dndIcon_;
QIcon offlineIcon_;
QIcon newMessageIcon_;
+ QIcon throbberIcon_;
bool unreadMessages_;
+ bool connecting_;
};
}