diff options
| author | me_desk <me_desk@fb96df88-216d-11de-830c-f3023f12d8ac> | 2013-10-15 19:43:35 +0000 |
|---|---|---|
| committer | me_desk <me_desk@fb96df88-216d-11de-830c-f3023f12d8ac> | 2013-10-15 19:43:35 +0000 |
| commit | 2bd64d2c683016b9b64720f92809094933fc7f50 (patch) | |
| tree | 31a17caecc122713dc926a085a3d9cb1f530c213 /pica-client/picasystray.cpp | |
| parent | f92f5b874cf2d936d7c722cfcecf20e0ff066e16 (diff) | |
| download | pica-pica-2bd64d2c683016b9b64720f92809094933fc7f50.tar.gz pica-pica-2bd64d2c683016b9b64720f92809094933fc7f50.zip | |
blinking systray icon on incoming messages, initial implementation, can be buggy
git-svn-id: svn://localhost/project_picapica/trunk@288 fb96df88-216d-11de-830c-f3023f12d8ac
Diffstat (limited to 'pica-client/picasystray.cpp')
| -rw-r--r-- | pica-client/picasystray.cpp | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/pica-client/picasystray.cpp b/pica-client/picasystray.cpp index 64e94b4..62a7adb 100644 --- a/pica-client/picasystray.cpp +++ b/pica-client/picasystray.cpp @@ -10,7 +10,7 @@ #endif PicaSysTray::PicaSysTray(QObject *parent) : - QObject(parent) + QObject(parent), emptyicon_(32,32) { systrayMenu_ = new QMenu(); @@ -26,13 +26,16 @@ PicaSysTray::PicaSysTray(QObject *parent) : connect(systray_, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(systray_activated(QSystemTrayIcon::ActivationReason))); connect(skynet, SIGNAL(BecameSelfAware()), this, SLOT(skynet_became_self_aware())); connect(skynet, SIGNAL(LostSelfAwareness()), this, SLOT(skynet_lost_self_awareness())); + + emptyicon_.fill(Qt::transparent); + } void PicaSysTray::systray_activated(QSystemTrayIcon::ActivationReason r) { if (r == QSystemTrayIcon::DoubleClick && mainwindow!=NULL) { - mainwindow->showNormal(); + emit doubleclicked(); } } @@ -46,3 +49,25 @@ void PicaSysTray::skynet_lost_self_awareness() { systray_->setIcon(picapica_ico_sit); } + +void PicaSysTray::StartBlinking() +{ + blink_ = systray_->icon(); + timer_id_ = startTimer(300); +} + +void PicaSysTray::StopBlinking() +{ + killTimer(timer_id_); + systray_->setIcon(blink_); +} + +void PicaSysTray::timerEvent(QTimerEvent *event) +{ +static int blinker; + + blinker++ % 2 ? systray_->setIcon(blink_) + : + systray_->setIcon(QIcon(emptyicon_)); + +} |
