mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-10 10:05:19 -04:00
Added blinking of the chat icon for private chat window and chat lobby.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5722 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
179618edbf
commit
7272b7e768
8 changed files with 103 additions and 23 deletions
|
@ -22,9 +22,9 @@
|
|||
#include <QMenu>
|
||||
#include <QToolBar>
|
||||
#include <QToolButton>
|
||||
#include <QTimer>
|
||||
|
||||
#include "UserNotify.h"
|
||||
#include "rshare.h"
|
||||
|
||||
UserNotify::UserNotify(QObject *parent) :
|
||||
QObject(parent)
|
||||
|
@ -36,10 +36,7 @@ UserNotify::UserNotify(QObject *parent) :
|
|||
mNewCount = 0;
|
||||
mLastBlinking = false;
|
||||
|
||||
mTimer = new QTimer(this);
|
||||
mTimer->setInterval(500);
|
||||
|
||||
connect(mTimer, SIGNAL(timeout()), this, SLOT(timer()));
|
||||
connect(rApp, SIGNAL(blink(bool)), this, SLOT(blink(bool)));
|
||||
}
|
||||
|
||||
void UserNotify::initialize(QToolBar *mainToolBar, QAction *mainAction)
|
||||
|
@ -109,11 +106,7 @@ void UserNotify::updateIcon()
|
|||
if (count) {
|
||||
mTrayIcon->setToolTip("RetroShare\n" + getTrayMessage(count > 1).arg(count));
|
||||
mTrayIcon->show();
|
||||
if (!mTimer->isActive()) {
|
||||
mTimer->start();
|
||||
}
|
||||
} else {
|
||||
mTimer->stop();
|
||||
mTrayIcon->hide();
|
||||
}
|
||||
}
|
||||
|
@ -152,18 +145,14 @@ void UserNotify::trayIconClicked(QSystemTrayIcon::ActivationReason e)
|
|||
}
|
||||
}
|
||||
|
||||
void UserNotify::timer()
|
||||
void UserNotify::blink(bool on)
|
||||
{
|
||||
bool blinking = isBlinking();
|
||||
|
||||
if (mTrayIcon) {
|
||||
if (blinking) {
|
||||
/* blink icon */
|
||||
if (mTrayIcon->icon().isNull()) {
|
||||
mTrayIcon->setIcon(getIcon());
|
||||
} else {
|
||||
mTrayIcon->setIcon(QIcon());
|
||||
}
|
||||
mTrayIcon->setIcon(on ? getIcon() : QIcon());
|
||||
} else {
|
||||
if (mLastBlinking) {
|
||||
/* reset icon */
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
class QToolBar;
|
||||
class QToolButton;
|
||||
class QAction;
|
||||
class QTimer;
|
||||
|
||||
class UserNotify : public QObject
|
||||
{
|
||||
|
@ -53,7 +52,7 @@ public slots:
|
|||
|
||||
private slots:
|
||||
void trayIconClicked(QSystemTrayIcon::ActivationReason e = QSystemTrayIcon::Trigger);
|
||||
void timer();
|
||||
void blink(bool on);
|
||||
|
||||
private:
|
||||
virtual QIcon getIcon() { return QIcon(); }
|
||||
|
@ -72,7 +71,6 @@ private:
|
|||
QAction *mNotifyIcon;
|
||||
unsigned int mNewCount;
|
||||
QString mButtonText;
|
||||
QTimer *mTimer;
|
||||
bool mLastBlinking;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue