mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
4581067b78
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5388 b45a01b8-16f6-495d-af2f-9b41ad6348cc
94 lines
2.6 KiB
C++
94 lines
2.6 KiB
C++
/****************************************************************
|
|
* 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.
|
|
****************************************************************/
|
|
|
|
#include "ChannelUserNotify.h"
|
|
#include "gui/settings/rsharesettings.h"
|
|
#include "gui/notifyqt.h"
|
|
#include "gui/MainWindow.h"
|
|
|
|
#include <retroshare/rschannels.h>
|
|
|
|
ChannelUserNotify::ChannelUserNotify(QObject *parent) :
|
|
UserNotify(parent)
|
|
{
|
|
connect(NotifyQt::getInstance(), SIGNAL(channelsChanged(int)), this, SLOT(updateIcon()), Qt::QueuedConnection);
|
|
}
|
|
|
|
bool ChannelUserNotify::hasSetting(QString &name)
|
|
{
|
|
name = tr("Channel Post");
|
|
|
|
return true;
|
|
}
|
|
|
|
bool ChannelUserNotify::notifyEnabled()
|
|
{
|
|
return (Settings->getTrayNotifyFlags() & TRAYNOTIFY_CHANNELS);
|
|
}
|
|
|
|
bool ChannelUserNotify::notifyCombined()
|
|
{
|
|
return (Settings->getTrayNotifyFlags() & TRAYNOTIFY_CHANNELS_COMBINED);
|
|
}
|
|
|
|
void ChannelUserNotify::setNotifyEnabled(bool enabled, bool combined)
|
|
{
|
|
uint notifyFlags = Settings->getTrayNotifyFlags();
|
|
|
|
if (enabled) {
|
|
notifyFlags |= TRAYNOTIFY_CHANNELS;
|
|
} else {
|
|
notifyFlags &= ~TRAYNOTIFY_CHANNELS;
|
|
}
|
|
|
|
if (combined) {
|
|
notifyFlags |= TRAYNOTIFY_CHANNELS_COMBINED;
|
|
} else {
|
|
notifyFlags &= ~TRAYNOTIFY_CHANNELS_COMBINED;
|
|
}
|
|
|
|
Settings->setTrayNotifyFlags(notifyFlags);
|
|
}
|
|
|
|
QIcon ChannelUserNotify::getIcon()
|
|
{
|
|
return QIcon(":/images/channels16.png");
|
|
}
|
|
|
|
QIcon ChannelUserNotify::getMainIcon(bool hasNew)
|
|
{
|
|
return hasNew ? QIcon(":/images/channels_new.png") : QIcon(":/images/channels.png");
|
|
}
|
|
|
|
unsigned int ChannelUserNotify::getNewCount()
|
|
{
|
|
unsigned int newMessageCount = 0;
|
|
unsigned int unreadMessageCount = 0;
|
|
rsChannels->getMessageCount("", newMessageCount, unreadMessageCount);
|
|
|
|
return newMessageCount;
|
|
}
|
|
|
|
void ChannelUserNotify::iconClicked()
|
|
{
|
|
MainWindow::showWindow(MainWindow::Channels);
|
|
}
|