mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-03-18 21:16:09 -04:00
- Moved settings for user notify into the base class
- Removed defines TRAYNOTIFY_... git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7470 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
d355e8dd88
commit
6792348402
@ -35,37 +35,14 @@ FeedReaderUserNotify::FeedReaderUserNotify(FeedReaderDialog *feedReaderDialog, R
|
||||
connect(mNotify, SIGNAL(msgChanged(QString,QString,int)), this, SLOT(updateIcon()), Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
bool FeedReaderUserNotify::hasSetting(QString &name)
|
||||
bool FeedReaderUserNotify::hasSetting(QString *name, QString *group)
|
||||
{
|
||||
name = tr("FeedReader Message");
|
||||
if (name) *name = tr("FeedReader Message");
|
||||
if (group) *group = "FeedReader";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FeedReaderUserNotify::notifyEnabled()
|
||||
{
|
||||
return Settings->valueFromGroup("FeedReader", "TrayNotifyEnable", true).toBool();
|
||||
}
|
||||
|
||||
bool FeedReaderUserNotify::notifyCombined()
|
||||
{
|
||||
return Settings->valueFromGroup("FeedReader", "TrayNotifyCombined", false).toBool();
|
||||
}
|
||||
|
||||
bool FeedReaderUserNotify::notifyBlink()
|
||||
{
|
||||
return Settings->valueFromGroup("FeedReader", "TrayNotifyBlink", false).toBool();
|
||||
}
|
||||
|
||||
void FeedReaderUserNotify::setNotifyEnabled(bool enabled, bool combined, bool blink)
|
||||
{
|
||||
Settings->beginGroup("FeedReader");
|
||||
Settings->setValue("TrayNotifyEnable", enabled);
|
||||
Settings->setValue("TrayNotifyCombined", combined);
|
||||
Settings->setValue("TrayNotifyBlink", blink);
|
||||
Settings->endGroup();
|
||||
}
|
||||
|
||||
QIcon FeedReaderUserNotify::getIcon()
|
||||
{
|
||||
return QIcon(":/images/Feed.png");
|
||||
|
@ -35,11 +35,7 @@ class FeedReaderUserNotify : public UserNotify
|
||||
public:
|
||||
FeedReaderUserNotify(FeedReaderDialog *feedReaderDialog, RsFeedReader *feedReader, FeedReaderNotify *notify, QObject *parent);
|
||||
|
||||
virtual bool hasSetting(QString &name);
|
||||
virtual bool notifyEnabled();
|
||||
virtual bool notifyCombined();
|
||||
virtual bool notifyBlink();
|
||||
virtual void setNotifyEnabled(bool enabled, bool combined, bool blink);
|
||||
virtual bool hasSetting(QString *name, QString *group);
|
||||
|
||||
private slots:
|
||||
void feedChanged(const QString &feedId, int type);
|
||||
|
@ -20,7 +20,6 @@
|
||||
****************************************************************/
|
||||
|
||||
#include "TransferUserNotify.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/MainWindow.h"
|
||||
|
||||
@ -32,55 +31,14 @@ TransferUserNotify::TransferUserNotify(QObject *parent) :
|
||||
connect(NotifyQt::getInstance(), SIGNAL(downloadCompleteCountChanged(int)), this, SLOT(downloadCountChanged(int)));
|
||||
}
|
||||
|
||||
bool TransferUserNotify::hasSetting(QString &name)
|
||||
bool TransferUserNotify::hasSetting(QString *name, QString *group)
|
||||
{
|
||||
name = tr("Download completed");
|
||||
if (name) *name = tr("Download completed");
|
||||
if (group) *group = "Transfer";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TransferUserNotify::notifyEnabled()
|
||||
{
|
||||
return (Settings->getTrayNotifyFlags() & TRAYNOTIFY_TRANSFERS);
|
||||
}
|
||||
|
||||
bool TransferUserNotify::notifyCombined()
|
||||
{
|
||||
return (Settings->getTrayNotifyFlags() & TRAYNOTIFY_TRANSFERS_COMBINED);
|
||||
}
|
||||
|
||||
bool TransferUserNotify::notifyBlink()
|
||||
{
|
||||
return (Settings->getTrayNotifyBlinkFlags() & TRAYNOTIFY_BLINK_TRANSFERS);
|
||||
}
|
||||
|
||||
void TransferUserNotify::setNotifyEnabled(bool enabled, bool combined, bool blink)
|
||||
{
|
||||
uint notifyFlags = Settings->getTrayNotifyFlags();
|
||||
uint blinkFlags = Settings->getTrayNotifyBlinkFlags();
|
||||
|
||||
if (enabled) {
|
||||
notifyFlags |= TRAYNOTIFY_TRANSFERS;
|
||||
} else {
|
||||
notifyFlags &= ~TRAYNOTIFY_TRANSFERS;
|
||||
}
|
||||
|
||||
if (combined) {
|
||||
notifyFlags |= TRAYNOTIFY_TRANSFERS_COMBINED;
|
||||
} else {
|
||||
notifyFlags &= ~TRAYNOTIFY_TRANSFERS_COMBINED;
|
||||
}
|
||||
|
||||
if (blink) {
|
||||
blinkFlags |= TRAYNOTIFY_BLINK_TRANSFERS;
|
||||
} else {
|
||||
blinkFlags &= ~TRAYNOTIFY_BLINK_TRANSFERS;
|
||||
}
|
||||
|
||||
Settings->setTrayNotifyFlags(notifyFlags);
|
||||
Settings->setTrayNotifyBlinkFlags(blinkFlags);
|
||||
}
|
||||
|
||||
QIcon TransferUserNotify::getIcon()
|
||||
{
|
||||
return QIcon(":/images/ktorrent32.png");
|
||||
|
@ -31,11 +31,7 @@ class TransferUserNotify : public UserNotify
|
||||
public:
|
||||
TransferUserNotify(QObject *parent = 0);
|
||||
|
||||
virtual bool hasSetting(QString &name);
|
||||
virtual bool notifyEnabled();
|
||||
virtual bool notifyCombined();
|
||||
virtual bool notifyBlink();
|
||||
virtual void setNotifyEnabled(bool enabled, bool combined, bool blink);
|
||||
virtual bool hasSetting(QString *name, QString *group);
|
||||
|
||||
private slots:
|
||||
void downloadCountChanged(int count);
|
||||
|
@ -20,7 +20,6 @@
|
||||
****************************************************************/
|
||||
|
||||
#include "PostedUserNotify.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "gui/MainWindow.h"
|
||||
|
||||
PostedUserNotify::PostedUserNotify(RsGxsIfaceHelper *ifaceImpl, QObject *parent) :
|
||||
@ -28,55 +27,14 @@ PostedUserNotify::PostedUserNotify(RsGxsIfaceHelper *ifaceImpl, QObject *parent)
|
||||
{
|
||||
}
|
||||
|
||||
bool PostedUserNotify::hasSetting(QString &name)
|
||||
bool PostedUserNotify::hasSetting(QString *name, QString *group)
|
||||
{
|
||||
name = tr("Posted");
|
||||
if (name) *name = tr("Posted");
|
||||
if (group) *group = "Posted";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PostedUserNotify::notifyEnabled()
|
||||
{
|
||||
return (Settings->getTrayNotifyFlags() & TRAYNOTIFY_POSTED);
|
||||
}
|
||||
|
||||
bool PostedUserNotify::notifyCombined()
|
||||
{
|
||||
return (Settings->getTrayNotifyFlags() & TRAYNOTIFY_POSTED_COMBINED);
|
||||
}
|
||||
|
||||
bool PostedUserNotify::notifyBlink()
|
||||
{
|
||||
return (Settings->getTrayNotifyBlinkFlags() & TRAYNOTIFY_BLINK_POSTED);
|
||||
}
|
||||
|
||||
void PostedUserNotify::setNotifyEnabled(bool enabled, bool combined, bool blink)
|
||||
{
|
||||
uint notifyFlags = Settings->getTrayNotifyFlags();
|
||||
uint blinkFlags = Settings->getTrayNotifyBlinkFlags();
|
||||
|
||||
if (enabled) {
|
||||
notifyFlags |= TRAYNOTIFY_POSTED;
|
||||
} else {
|
||||
notifyFlags &= ~TRAYNOTIFY_POSTED;
|
||||
}
|
||||
|
||||
if (combined) {
|
||||
notifyFlags |= TRAYNOTIFY_POSTED_COMBINED;
|
||||
} else {
|
||||
notifyFlags &= ~TRAYNOTIFY_POSTED_COMBINED;
|
||||
}
|
||||
|
||||
if (blink) {
|
||||
blinkFlags |= TRAYNOTIFY_BLINK_POSTED;
|
||||
} else {
|
||||
blinkFlags &= ~TRAYNOTIFY_BLINK_POSTED;
|
||||
}
|
||||
|
||||
Settings->setTrayNotifyFlags(notifyFlags);
|
||||
Settings->setTrayNotifyBlinkFlags(blinkFlags);
|
||||
}
|
||||
|
||||
QIcon PostedUserNotify::getIcon()
|
||||
{
|
||||
return QIcon(":/images/wikibook_32.png");
|
||||
|
@ -31,11 +31,7 @@ class PostedUserNotify : public GxsUserNotify
|
||||
public:
|
||||
PostedUserNotify(RsGxsIfaceHelper *ifaceImpl, QObject *parent = 0);
|
||||
|
||||
virtual bool hasSetting(QString &name);
|
||||
virtual bool notifyEnabled();
|
||||
virtual bool notifyCombined();
|
||||
virtual bool notifyBlink();
|
||||
virtual void setNotifyEnabled(bool enabled, bool combined, bool blink);
|
||||
virtual bool hasSetting(QString *name, QString *group);
|
||||
|
||||
private:
|
||||
virtual QIcon getIcon();
|
||||
|
@ -20,7 +20,6 @@
|
||||
****************************************************************/
|
||||
|
||||
#include "ChatUserNotify.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/MainWindow.h"
|
||||
#include "gui/chat/ChatDialog.h"
|
||||
@ -34,55 +33,14 @@ ChatUserNotify::ChatUserNotify(QObject *parent) :
|
||||
connect(NotifyQt::getInstance(), SIGNAL(privateChatChanged(int, int)), this, SLOT(privateChatChanged(int, int)));
|
||||
}
|
||||
|
||||
bool ChatUserNotify::hasSetting(QString &name)
|
||||
bool ChatUserNotify::hasSetting(QString *name, QString *group)
|
||||
{
|
||||
name = tr("Private Chat");
|
||||
if (name) *name = tr("Private Chat");
|
||||
if (group) *group = "PrivateChat";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatUserNotify::notifyEnabled()
|
||||
{
|
||||
return (Settings->getTrayNotifyFlags() & TRAYNOTIFY_PRIVATECHAT);
|
||||
}
|
||||
|
||||
bool ChatUserNotify::notifyCombined()
|
||||
{
|
||||
return (Settings->getTrayNotifyFlags() & TRAYNOTIFY_PRIVATECHAT_COMBINED);
|
||||
}
|
||||
|
||||
bool ChatUserNotify::notifyBlink()
|
||||
{
|
||||
return (Settings->getTrayNotifyBlinkFlags() & TRAYNOTIFY_BLINK_PRIVATECHAT);
|
||||
}
|
||||
|
||||
void ChatUserNotify::setNotifyEnabled(bool enabled, bool combined, bool blink)
|
||||
{
|
||||
uint notifyFlags = Settings->getTrayNotifyFlags();
|
||||
uint blinkFlags = Settings->getTrayNotifyBlinkFlags();
|
||||
|
||||
if (enabled) {
|
||||
notifyFlags |= TRAYNOTIFY_PRIVATECHAT;
|
||||
} else {
|
||||
notifyFlags &= ~TRAYNOTIFY_PRIVATECHAT;
|
||||
}
|
||||
|
||||
if (combined) {
|
||||
notifyFlags |= TRAYNOTIFY_PRIVATECHAT_COMBINED;
|
||||
} else {
|
||||
notifyFlags &= ~TRAYNOTIFY_PRIVATECHAT_COMBINED;
|
||||
}
|
||||
|
||||
if (blink) {
|
||||
blinkFlags |= TRAYNOTIFY_BLINK_PRIVATECHAT;
|
||||
} else {
|
||||
blinkFlags &= ~TRAYNOTIFY_BLINK_PRIVATECHAT;
|
||||
}
|
||||
|
||||
Settings->setTrayNotifyFlags(notifyFlags);
|
||||
Settings->setTrayNotifyBlinkFlags(blinkFlags);
|
||||
}
|
||||
|
||||
QIcon ChatUserNotify::getIcon()
|
||||
{
|
||||
return QIcon(":/images/chat.png");
|
||||
|
@ -31,11 +31,7 @@ class ChatUserNotify : public UserNotify
|
||||
public:
|
||||
ChatUserNotify(QObject *parent = 0);
|
||||
|
||||
virtual bool hasSetting(QString &name);
|
||||
virtual bool notifyEnabled();
|
||||
virtual bool notifyCombined();
|
||||
virtual bool notifyBlink();
|
||||
virtual void setNotifyEnabled(bool enabled, bool combined, bool blink);
|
||||
virtual bool hasSetting(QString *name, QString *group);
|
||||
|
||||
private slots:
|
||||
void privateChatChanged(int list, int type);
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include "UserNotify.h"
|
||||
#include "rshare.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
|
||||
UserNotify::UserNotify(QObject *parent) :
|
||||
QObject(parent)
|
||||
@ -44,6 +45,50 @@ UserNotify::~UserNotify()
|
||||
{
|
||||
}
|
||||
|
||||
bool UserNotify::notifyEnabled()
|
||||
{
|
||||
QString group;
|
||||
if (!hasSetting(NULL, &group) || group.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Settings->valueFromGroup(group, "TrayNotifyEnable", true).toBool();
|
||||
}
|
||||
|
||||
bool UserNotify::notifyCombined()
|
||||
{
|
||||
QString group;
|
||||
if (!hasSetting(NULL, &group) || group.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Settings->valueFromGroup(group, "TrayNotifyCombined", false).toBool();
|
||||
}
|
||||
|
||||
bool UserNotify::notifyBlink()
|
||||
{
|
||||
QString group;
|
||||
if (!hasSetting(NULL, &group) || group.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Settings->valueFromGroup(group, "TrayNotifyBlink", false).toBool();
|
||||
}
|
||||
|
||||
void UserNotify::setNotifyEnabled(bool enabled, bool combined, bool blink)
|
||||
{
|
||||
QString group;
|
||||
if (!hasSetting(NULL, &group) || group.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Settings->beginGroup(group);
|
||||
Settings->setValue("TrayNotifyEnable", enabled);
|
||||
Settings->setValue("TrayNotifyCombined", combined);
|
||||
Settings->setValue("TrayNotifyBlink", blink);
|
||||
Settings->endGroup();
|
||||
}
|
||||
|
||||
void UserNotify::initialize(QToolBar *mainToolBar, QAction *mainAction, QListWidgetItem *listItem)
|
||||
{
|
||||
mMainAction = mainAction;
|
||||
|
@ -41,11 +41,11 @@ public:
|
||||
void initialize(QToolBar *mainToolBar, QAction *mainAction, QListWidgetItem *listItem);
|
||||
void createIcons(QMenu *notifyMenu);
|
||||
|
||||
virtual bool hasSetting(QString &/*name*/) { return false; }
|
||||
virtual bool notifyEnabled() { return false; }
|
||||
virtual bool notifyCombined() { return false; }
|
||||
virtual bool notifyBlink() { return false; }
|
||||
virtual void setNotifyEnabled(bool /*enabled*/, bool /*combined*/, bool /*blink*/) {}
|
||||
virtual bool hasSetting(QString */*name*/, QString */*group*/) { return false; }
|
||||
bool notifyEnabled();
|
||||
bool notifyCombined();
|
||||
bool notifyBlink();
|
||||
void setNotifyEnabled(bool enabled, bool combined, bool blink);
|
||||
|
||||
signals:
|
||||
void countChanged();
|
||||
|
@ -20,7 +20,6 @@
|
||||
****************************************************************/
|
||||
|
||||
#include "GxsChannelUserNotify.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "gui/MainWindow.h"
|
||||
|
||||
GxsChannelUserNotify::GxsChannelUserNotify(RsGxsIfaceHelper *ifaceImpl, QObject *parent) :
|
||||
@ -28,55 +27,14 @@ GxsChannelUserNotify::GxsChannelUserNotify(RsGxsIfaceHelper *ifaceImpl, QObject
|
||||
{
|
||||
}
|
||||
|
||||
bool GxsChannelUserNotify::hasSetting(QString &name)
|
||||
bool GxsChannelUserNotify::hasSetting(QString *name, QString *group)
|
||||
{
|
||||
name = tr("Channel Post");
|
||||
if (name) *name = tr("Channel Post");
|
||||
if (group) *group = "Channel";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GxsChannelUserNotify::notifyEnabled()
|
||||
{
|
||||
return (Settings->getTrayNotifyFlags() & TRAYNOTIFY_CHANNELS);
|
||||
}
|
||||
|
||||
bool GxsChannelUserNotify::notifyCombined()
|
||||
{
|
||||
return (Settings->getTrayNotifyFlags() & TRAYNOTIFY_CHANNELS_COMBINED);
|
||||
}
|
||||
|
||||
bool GxsChannelUserNotify::notifyBlink()
|
||||
{
|
||||
return (Settings->getTrayNotifyBlinkFlags() & TRAYNOTIFY_BLINK_CHANNELS);
|
||||
}
|
||||
|
||||
void GxsChannelUserNotify::setNotifyEnabled(bool enabled, bool combined, bool blink)
|
||||
{
|
||||
uint notifyFlags = Settings->getTrayNotifyFlags();
|
||||
uint blinkFlags = Settings->getTrayNotifyBlinkFlags();
|
||||
|
||||
if (enabled) {
|
||||
notifyFlags |= TRAYNOTIFY_CHANNELS;
|
||||
} else {
|
||||
notifyFlags &= ~TRAYNOTIFY_CHANNELS;
|
||||
}
|
||||
|
||||
if (combined) {
|
||||
notifyFlags |= TRAYNOTIFY_CHANNELS_COMBINED;
|
||||
} else {
|
||||
notifyFlags &= ~TRAYNOTIFY_CHANNELS_COMBINED;
|
||||
}
|
||||
|
||||
if (blink) {
|
||||
blinkFlags |= TRAYNOTIFY_BLINK_CHANNELS;
|
||||
} else {
|
||||
blinkFlags &= ~TRAYNOTIFY_BLINK_CHANNELS;
|
||||
}
|
||||
|
||||
Settings->setTrayNotifyFlags(notifyFlags);
|
||||
Settings->setTrayNotifyBlinkFlags(blinkFlags);
|
||||
}
|
||||
|
||||
QIcon GxsChannelUserNotify::getIcon()
|
||||
{
|
||||
return QIcon(":/images/channels16.png");
|
||||
|
@ -31,11 +31,7 @@ class GxsChannelUserNotify : public GxsUserNotify
|
||||
public:
|
||||
GxsChannelUserNotify(RsGxsIfaceHelper *ifaceImpl, QObject *parent = 0);
|
||||
|
||||
virtual bool hasSetting(QString &name);
|
||||
virtual bool notifyEnabled();
|
||||
virtual bool notifyCombined();
|
||||
virtual bool notifyBlink();
|
||||
virtual void setNotifyEnabled(bool enabled, bool combined, bool blink);
|
||||
virtual bool hasSetting(QString *name, QString *group);
|
||||
|
||||
private:
|
||||
virtual QIcon getIcon();
|
||||
|
@ -20,7 +20,6 @@
|
||||
****************************************************************/
|
||||
|
||||
#include "GxsForumUserNotify.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "gui/MainWindow.h"
|
||||
|
||||
GxsForumUserNotify::GxsForumUserNotify(RsGxsIfaceHelper *ifaceImpl, QObject *parent) :
|
||||
@ -28,55 +27,14 @@ GxsForumUserNotify::GxsForumUserNotify(RsGxsIfaceHelper *ifaceImpl, QObject *par
|
||||
{
|
||||
}
|
||||
|
||||
bool GxsForumUserNotify::hasSetting(QString &name)
|
||||
bool GxsForumUserNotify::hasSetting(QString *name, QString *group)
|
||||
{
|
||||
name = tr("Forum Post");
|
||||
if (name) *name = tr("Forum Post");
|
||||
if (group) *group = "Forum";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GxsForumUserNotify::notifyEnabled()
|
||||
{
|
||||
return (Settings->getTrayNotifyFlags() & TRAYNOTIFY_FORUMS);
|
||||
}
|
||||
|
||||
bool GxsForumUserNotify::notifyCombined()
|
||||
{
|
||||
return (Settings->getTrayNotifyFlags() & TRAYNOTIFY_FORUMS_COMBINED);
|
||||
}
|
||||
|
||||
bool GxsForumUserNotify::notifyBlink()
|
||||
{
|
||||
return (Settings->getTrayNotifyBlinkFlags() & TRAYNOTIFY_BLINK_FORUMS);
|
||||
}
|
||||
|
||||
void GxsForumUserNotify::setNotifyEnabled(bool enabled, bool combined, bool blink)
|
||||
{
|
||||
uint notifyFlags = Settings->getTrayNotifyFlags();
|
||||
uint blinkFlags = Settings->getTrayNotifyBlinkFlags();
|
||||
|
||||
if (enabled) {
|
||||
notifyFlags |= TRAYNOTIFY_FORUMS;
|
||||
} else {
|
||||
notifyFlags &= ~TRAYNOTIFY_FORUMS;
|
||||
}
|
||||
|
||||
if (combined) {
|
||||
notifyFlags |= TRAYNOTIFY_FORUMS_COMBINED;
|
||||
} else {
|
||||
notifyFlags &= ~TRAYNOTIFY_FORUMS_COMBINED;
|
||||
}
|
||||
|
||||
if (blink) {
|
||||
blinkFlags |= TRAYNOTIFY_BLINK_FORUMS;
|
||||
} else {
|
||||
blinkFlags &= ~TRAYNOTIFY_BLINK_FORUMS;
|
||||
}
|
||||
|
||||
Settings->setTrayNotifyFlags(notifyFlags);
|
||||
Settings->setTrayNotifyBlinkFlags(blinkFlags);
|
||||
}
|
||||
|
||||
QIcon GxsForumUserNotify::getIcon()
|
||||
{
|
||||
return QIcon(":/images/konversation16.png");
|
||||
|
@ -31,11 +31,7 @@ class GxsForumUserNotify : public GxsUserNotify
|
||||
public:
|
||||
GxsForumUserNotify(RsGxsIfaceHelper *ifaceImpl, QObject *parent = 0);
|
||||
|
||||
virtual bool hasSetting(QString &name);
|
||||
virtual bool notifyEnabled();
|
||||
virtual bool notifyCombined();
|
||||
virtual bool notifyBlink();
|
||||
virtual void setNotifyEnabled(bool enabled, bool combined, bool blink);
|
||||
virtual bool hasSetting(QString *name, QString *group);
|
||||
|
||||
private:
|
||||
virtual QIcon getIcon();
|
||||
|
@ -20,7 +20,6 @@
|
||||
****************************************************************/
|
||||
|
||||
#include "MessageUserNotify.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/MainWindow.h"
|
||||
|
||||
@ -32,55 +31,14 @@ MessageUserNotify::MessageUserNotify(QObject *parent) :
|
||||
connect(NotifyQt::getInstance(), SIGNAL(messagesChanged()), this, SLOT(updateIcon()));
|
||||
}
|
||||
|
||||
bool MessageUserNotify::hasSetting(QString &name)
|
||||
bool MessageUserNotify::hasSetting(QString *name, QString *group)
|
||||
{
|
||||
name = tr("Message");
|
||||
if (name) *name = tr("Message");
|
||||
if (group) *group = "Message";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MessageUserNotify::notifyEnabled()
|
||||
{
|
||||
return (Settings->getTrayNotifyFlags() & TRAYNOTIFY_MESSAGES);
|
||||
}
|
||||
|
||||
bool MessageUserNotify::notifyCombined()
|
||||
{
|
||||
return (Settings->getTrayNotifyFlags() & TRAYNOTIFY_MESSAGES_COMBINED);
|
||||
}
|
||||
|
||||
bool MessageUserNotify::notifyBlink()
|
||||
{
|
||||
return (Settings->getTrayNotifyBlinkFlags() & TRAYNOTIFY_BLINK_MESSAGES);
|
||||
}
|
||||
|
||||
void MessageUserNotify::setNotifyEnabled(bool enabled, bool combined, bool blink)
|
||||
{
|
||||
uint notifyFlags = Settings->getTrayNotifyFlags();
|
||||
uint blinkFlags = Settings->getTrayNotifyBlinkFlags();
|
||||
|
||||
if (enabled) {
|
||||
notifyFlags |= TRAYNOTIFY_MESSAGES;
|
||||
} else {
|
||||
notifyFlags &= ~TRAYNOTIFY_MESSAGES;
|
||||
}
|
||||
|
||||
if (combined) {
|
||||
notifyFlags |= TRAYNOTIFY_MESSAGES_COMBINED;
|
||||
} else {
|
||||
notifyFlags &= ~TRAYNOTIFY_MESSAGES_COMBINED;
|
||||
}
|
||||
|
||||
if (blink) {
|
||||
blinkFlags |= TRAYNOTIFY_BLINK_MESSAGES;
|
||||
} else {
|
||||
blinkFlags &= ~TRAYNOTIFY_BLINK_MESSAGES;
|
||||
}
|
||||
|
||||
Settings->setTrayNotifyFlags(notifyFlags);
|
||||
Settings->setTrayNotifyBlinkFlags(blinkFlags);
|
||||
}
|
||||
|
||||
QIcon MessageUserNotify::getIcon()
|
||||
{
|
||||
return QIcon(":/images/inbox_22.png");
|
||||
|
@ -31,11 +31,7 @@ class MessageUserNotify : public UserNotify
|
||||
public:
|
||||
MessageUserNotify(QObject *parent = 0);
|
||||
|
||||
virtual bool hasSetting(QString &name);
|
||||
virtual bool notifyEnabled();
|
||||
virtual bool notifyCombined();
|
||||
virtual bool notifyBlink();
|
||||
virtual void setNotifyEnabled(bool enabled, bool combined, bool blink);
|
||||
virtual bool hasSetting(QString *name, QString *group);
|
||||
|
||||
private:
|
||||
virtual QIcon getIcon();
|
||||
|
@ -76,7 +76,7 @@ NotifyPage::NotifyPage(QWidget * parent, Qt::WindowFlags flags)
|
||||
UserNotify *userNotify = *it;
|
||||
|
||||
QString name;
|
||||
if (!userNotify->hasSetting(name)) {
|
||||
if (!userNotify->hasSetting(&name, NULL)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,6 @@
|
||||
#define SETTING_NEWSFEED_FLAGS "NewsFeedFlags"
|
||||
#define SETTING_CHAT_FLAGS "ChatFlags"
|
||||
#define SETTING_NOTIFY_FLAGS "NotifyFlags"
|
||||
#define SETTING_TRAYNOTIFY_FLAGS "TrayNotifyFlags"
|
||||
#define SETTING_CHAT_AVATAR "ChatAvatar"
|
||||
|
||||
/* Default Retroshare Settings */
|
||||
@ -457,26 +456,6 @@ void RshareSettings::setNotifyFlags(uint flags)
|
||||
setValue(SETTING_NOTIFY_FLAGS, flags);
|
||||
}
|
||||
|
||||
uint RshareSettings::getTrayNotifyFlags()
|
||||
{
|
||||
return value(SETTING_TRAYNOTIFY_FLAGS, TRAYNOTIFY_PRIVATECHAT | TRAYNOTIFY_MESSAGES | TRAYNOTIFY_CHANNELS | TRAYNOTIFY_FORUMS | TRAYNOTIFY_POSTED ).toUInt();
|
||||
}
|
||||
|
||||
void RshareSettings::setTrayNotifyFlags(uint flags)
|
||||
{
|
||||
setValue(SETTING_TRAYNOTIFY_FLAGS, flags);
|
||||
}
|
||||
|
||||
uint RshareSettings::getTrayNotifyBlinkFlags()
|
||||
{
|
||||
return value("TrayNotifyBlinkFlags", 0).toUInt();
|
||||
}
|
||||
|
||||
void RshareSettings::setTrayNotifyBlinkFlags(uint flags)
|
||||
{
|
||||
setValue("TrayNotifyBlinkFlags", flags);
|
||||
}
|
||||
|
||||
uint RshareSettings::getMessageFlags()
|
||||
{
|
||||
return value("MessageFlags").toUInt();
|
||||
|
@ -30,29 +30,6 @@
|
||||
#include <gui/linetypes.h>
|
||||
#include "rsettings.h"
|
||||
|
||||
/* Defines for get/setTrayNotifyFlags */
|
||||
#define TRAYNOTIFY_PRIVATECHAT 0x00000001
|
||||
#define TRAYNOTIFY_MESSAGES 0x00000002
|
||||
#define TRAYNOTIFY_CHANNELS 0x00000004
|
||||
#define TRAYNOTIFY_FORUMS 0x00000008
|
||||
#define TRAYNOTIFY_TRANSFERS 0x00000010
|
||||
|
||||
#define TRAYNOTIFY_PRIVATECHAT_COMBINED 0x00000020
|
||||
#define TRAYNOTIFY_MESSAGES_COMBINED 0x00000040
|
||||
#define TRAYNOTIFY_CHANNELS_COMBINED 0x00000080
|
||||
#define TRAYNOTIFY_FORUMS_COMBINED 0x00000100
|
||||
#define TRAYNOTIFY_TRANSFERS_COMBINED 0x00000200
|
||||
|
||||
#define TRAYNOTIFY_POSTED 0x00000400
|
||||
#define TRAYNOTIFY_POSTED_COMBINED 0x00000800
|
||||
|
||||
#define TRAYNOTIFY_BLINK_PRIVATECHAT 0x00000001
|
||||
#define TRAYNOTIFY_BLINK_MESSAGES 0x00000002
|
||||
#define TRAYNOTIFY_BLINK_CHANNELS 0x00000004
|
||||
#define TRAYNOTIFY_BLINK_FORUMS 0x00000008
|
||||
#define TRAYNOTIFY_BLINK_TRANSFERS 0x00000010
|
||||
#define TRAYNOTIFY_BLINK_POSTED 0x00000020
|
||||
|
||||
#define RS_CHATLOBBY_BLINK 0x00000001
|
||||
|
||||
#define STATUSBAR_DISC 0x00000001
|
||||
@ -214,12 +191,6 @@ public:
|
||||
uint getNotifyFlags();
|
||||
void setNotifyFlags(uint flags);
|
||||
|
||||
uint getTrayNotifyFlags();
|
||||
void setTrayNotifyFlags(uint flags);
|
||||
|
||||
uint getTrayNotifyBlinkFlags();
|
||||
void setTrayNotifyBlinkFlags(uint flags);
|
||||
|
||||
uint getMessageFlags();
|
||||
void setMessageFlags(uint flags);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user