mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-21 04:18:23 -04:00
Reworked notification code in system tray.
Added a base class and a possibility for the main dialogs and the plugins (derived from MainPage) to provide a notifier. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5381 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
049b4bd577
commit
b21e66241b
30 changed files with 1040 additions and 539 deletions
49
retroshare-gui/src/gui/common/UserNotify.h
Normal file
49
retroshare-gui/src/gui/common/UserNotify.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
#ifndef USERNOTIFY_H
|
||||
#define USERNOTIFY_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QSystemTrayIcon>
|
||||
|
||||
class QAction;
|
||||
|
||||
class UserNotify : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
UserNotify(QObject *parent = 0);
|
||||
|
||||
void initialize(QAction *mainAction);
|
||||
void createIcons(QMenu *notifyMenu);
|
||||
|
||||
virtual bool hasSetting(QString &/*name*/) { return false; }
|
||||
virtual bool notifyEnabled() { return false; }
|
||||
virtual bool notifyCombined() { return false; }
|
||||
virtual void setNotifyEnabled(bool /*enabled*/, bool /*combined*/) {}
|
||||
|
||||
signals:
|
||||
void countChanged();
|
||||
|
||||
public slots:
|
||||
void updateIcon();
|
||||
|
||||
private slots:
|
||||
void trayIconClicked(QSystemTrayIcon::ActivationReason e = QSystemTrayIcon::Trigger);
|
||||
|
||||
private:
|
||||
virtual QIcon getIcon() { return QIcon(); }
|
||||
virtual QIcon getMainIcon(bool /*hasNew*/) { return QIcon(); }
|
||||
virtual unsigned int getNewCount() { return 0; }
|
||||
|
||||
virtual QString getTrayMessage(bool plural);
|
||||
virtual QString getNotifyMessage(bool plural);
|
||||
|
||||
virtual void iconClicked() {}
|
||||
|
||||
QAction *mMainIcon;
|
||||
QSystemTrayIcon *mTrayIcon;
|
||||
QAction *mNotifyIcon;
|
||||
unsigned int newCount;
|
||||
};
|
||||
|
||||
#endif // USERNOTIFY_H
|
Loading…
Add table
Add a link
Reference in a new issue