diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-10-24 16:18:40 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-10-24 16:18:55 (GMT) |
commit | a8a37c1d43412c410c33eba18c5ab46b0cf7b0d1 (patch) | |
tree | 463188c9954939e476d5da8d1247cbf703fe28b2 /Swift/QtUI/QtSystemTray.cpp | |
parent | 8af6fb273cb433ece756459d887c411c61ddcd76 (diff) | |
download | swift-contrib-a8a37c1d43412c410c33eba18c5ab46b0cf7b0d1.zip swift-contrib-a8a37c1d43412c410c33eba18c5ab46b0cf7b0d1.tar.bz2 |
Animated systray that works
Diffstat (limited to 'Swift/QtUI/QtSystemTray.cpp')
-rw-r--r-- | Swift/QtUI/QtSystemTray.cpp | 10 |
1 files changed, 8 insertions, 2 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; |