summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtSystemTray.cpp10
-rw-r--r--Swift/QtUI/QtSystemTray.h4
2 files changed, 11 insertions, 3 deletions
diff --git a/Swift/QtUI/QtSystemTray.cpp b/Swift/QtUI/QtSystemTray.cpp
index aa9bac2..4393c74 100644
--- a/Swift/QtUI/QtSystemTray.cpp
+++ b/Swift/QtUI/QtSystemTray.cpp
@@ -11,9 +11,10 @@
#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"), throbberIcon_(":/icons/throbber.gif"), unreadMessages_(false), connecting_(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"), throbberMovie_(":/icons/throbber.gif"), unreadMessages_(false), connecting_(false) {
trayIcon_ = new QSystemTrayIcon(offlineIcon_);
connect(trayIcon_, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(handleIconActivated(QSystemTrayIcon::ActivationReason)));
+ connect(&throbberMovie_, SIGNAL(frameChanged(int)), this, SLOT(handleThrobberFrameChanged(int)));
trayIcon_->show();
}
@@ -26,6 +27,10 @@ void QtSystemTray::setUnreadMessages(bool some) {
updateStatusIcon();
}
+void QtSystemTray::handleThrobberFrameChanged(int /*frameNumber*/) {
+ trayIcon_->setIcon(QIcon(throbberMovie_.currentPixmap()));
+}
+
void QtSystemTray::setConnecting() {
connecting_ = true;
updateStatusIcon();
@@ -43,10 +48,11 @@ void QtSystemTray::setStatusType(StatusShow::Type type) {
}
void QtSystemTray::updateStatusIcon() {
+ throbberMovie_.stop();
if (unreadMessages_) {
trayIcon_->setIcon(newMessageIcon_);
} else if (connecting_) {
- trayIcon_->setIcon(throbberIcon_);
+ throbberMovie_.start();
} else {
switch (statusType_) {
case StatusShow::Online : trayIcon_->setIcon(onlineIcon_);break;
diff --git a/Swift/QtUI/QtSystemTray.h b/Swift/QtUI/QtSystemTray.h
index 30fc860..a49357e 100644
--- a/Swift/QtUI/QtSystemTray.h
+++ b/Swift/QtUI/QtSystemTray.h
@@ -9,6 +9,7 @@
#include "Swift/Controllers/SystemTray.h"
#include <QSystemTrayIcon>
+#include <QMovie>
class QIcon;
@@ -25,6 +26,7 @@ namespace Swift {
void clicked();
private slots:
void handleIconActivated(QSystemTrayIcon::ActivationReason reason);
+ void handleThrobberFrameChanged(int);
private:
void updateStatusIcon();
StatusShow::Type statusType_;
@@ -34,7 +36,7 @@ namespace Swift {
QIcon dndIcon_;
QIcon offlineIcon_;
QIcon newMessageIcon_;
- QIcon throbberIcon_;
+ QMovie throbberMovie_;
bool unreadMessages_;
bool connecting_;
};