summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-10-24 15:50:14 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-10-24 15:50:14 (GMT)
commit16386458ff461edfdfd498fe737436ce9297babf (patch)
tree592dfbf63d8c03a93a429c78ff090414377c538e /Swift
parent9d3b9903fcf830599c1b46fd1725f4d1d197e966 (diff)
downloadswift-contrib-16386458ff461edfdfd498fe737436ce9297babf.zip
swift-contrib-16386458ff461edfdfd498fe737436ce9297babf.tar.bz2
Blind attempt at animated system tray
Diffstat (limited to 'Swift')
-rw-r--r--Swift/Controllers/MainController.cpp1
-rw-r--r--Swift/Controllers/SystemTray.h1
-rw-r--r--Swift/Controllers/SystemTrayController.cpp4
-rw-r--r--Swift/Controllers/SystemTrayController.h1
-rw-r--r--Swift/QtUI/QtSystemTray.cpp11
-rw-r--r--Swift/QtUI/QtSystemTray.h3
6 files changed, 19 insertions, 2 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index 614e2d2..f6fe40c 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -427,6 +427,7 @@ void MainController::performLoginFromCachedCredentials() {
/* In case we're in the middle of another login, make sure they don't overlap */
client_->disconnect();
}
+ systemTrayController_->setConnecting();
if (rosterController_) {
rosterController_->getWindow()->setConnecting();
}
diff --git a/Swift/Controllers/SystemTray.h b/Swift/Controllers/SystemTray.h
index 2821785..736b1fa 100644
--- a/Swift/Controllers/SystemTray.h
+++ b/Swift/Controllers/SystemTray.h
@@ -14,5 +14,6 @@ namespace Swift {
virtual ~SystemTray(){};
virtual void setUnreadMessages(bool some) = 0;
virtual void setStatusType(StatusShow::Type type) = 0;
+ virtual void setConnecting() = 0;
};
}
diff --git a/Swift/Controllers/SystemTrayController.cpp b/Swift/Controllers/SystemTrayController.cpp
index d3824c9..598771c 100644
--- a/Swift/Controllers/SystemTrayController.cpp
+++ b/Swift/Controllers/SystemTrayController.cpp
@@ -35,4 +35,8 @@ void SystemTrayController::setMyStatusType(StatusShow::Type type) {
systemTray_->setStatusType(type);
}
+void SystemTrayController::setConnecting() {
+ systemTray_->setConnecting();
+}
+
}
diff --git a/Swift/Controllers/SystemTrayController.h b/Swift/Controllers/SystemTrayController.h
index 8fd514f..3624ea2 100644
--- a/Swift/Controllers/SystemTrayController.h
+++ b/Swift/Controllers/SystemTrayController.h
@@ -16,6 +16,7 @@ namespace Swift {
public:
SystemTrayController(EventController* eventController, SystemTray* systemTray);
void setMyStatusType(StatusShow::Type type);
+ void setConnecting();
private:
void handleEventQueueLengthChange(int length);
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_;
};
}