2012-08-08 06:48:29 -04:00
|
|
|
/****************************************************************
|
|
|
|
* RetroShare is distributed under the following license:
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012 RetroShare Team
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
****************************************************************/
|
|
|
|
|
2012-08-05 16:12:55 -04:00
|
|
|
#ifndef USERNOTIFY_H
|
|
|
|
#define USERNOTIFY_H
|
2014-07-06 06:32:13 -04:00
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QSystemTrayIcon>
|
|
|
|
#include <QListWidgetItem>
|
|
|
|
|
|
|
|
class QToolBar;
|
|
|
|
class QToolButton;
|
|
|
|
class QAction;
|
|
|
|
|
|
|
|
class UserNotify : public QObject
|
|
|
|
{
|
2012-08-05 16:12:55 -04:00
|
|
|
Q_OBJECT
|
|
|
|
|
2014-07-06 06:32:13 -04:00
|
|
|
public:
|
|
|
|
UserNotify(QObject *parent = 0);
|
|
|
|
virtual ~UserNotify();
|
|
|
|
|
|
|
|
void initialize(QToolBar *mainToolBar, QAction *mainAction, QListWidgetItem *listItem);
|
|
|
|
void createIcons(QMenu *notifyMenu);
|
2015-03-26 18:17:48 -04:00
|
|
|
QSystemTrayIcon* getTrayIcon(){ return mTrayIcon;}
|
|
|
|
QAction* getNotifyIcon(){ return mNotifyIcon;}
|
2014-07-06 06:32:13 -04:00
|
|
|
|
2014-07-24 16:01:12 -04:00
|
|
|
virtual bool hasSetting(QString */*name*/, QString */*group*/) { return false; }
|
|
|
|
bool notifyEnabled();
|
|
|
|
bool notifyCombined();
|
|
|
|
bool notifyBlink();
|
|
|
|
void setNotifyEnabled(bool enabled, bool combined, bool blink);
|
2012-08-05 16:12:55 -04:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void countChanged();
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void updateIcon();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void trayIconClicked(QSystemTrayIcon::ActivationReason e = QSystemTrayIcon::Trigger);
|
2015-03-26 18:17:48 -04:00
|
|
|
void trayIconHovered();
|
2012-10-25 14:06:33 -04:00
|
|
|
void blink(bool on);
|
2012-08-05 16:12:55 -04:00
|
|
|
|
2014-07-06 06:32:13 -04:00
|
|
|
protected:
|
|
|
|
virtual void startUpdate();
|
|
|
|
void update();
|
|
|
|
|
2012-08-05 16:12:55 -04:00
|
|
|
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() {}
|
2015-03-26 18:17:48 -04:00
|
|
|
virtual void iconHovered() {}
|
2014-07-06 06:32:13 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
QToolButton *mMainToolButton;
|
|
|
|
QAction *mMainAction;
|
|
|
|
QListWidgetItem *mListItem;
|
|
|
|
QSystemTrayIcon *mTrayIcon;
|
|
|
|
QAction *mNotifyIcon;
|
|
|
|
unsigned int mNewCount;
|
2012-10-24 04:34:42 -04:00
|
|
|
QString mButtonText;
|
2012-10-24 09:24:38 -04:00
|
|
|
bool mLastBlinking;
|
2012-08-05 16:12:55 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // USERNOTIFY_H
|