2009-07-23 13:11:51 -04:00
|
|
|
/****************************************************************
|
|
|
|
* RetroShare is distributed under the following license:
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006 - 2009 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
|
2009-08-19 18:15:16 -04:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
2009-07-23 13:11:51 -04:00
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
****************************************************************/
|
|
|
|
|
|
|
|
#include <rshare.h>
|
|
|
|
#include "NotifyPage.h"
|
|
|
|
|
2010-08-06 05:40:23 -04:00
|
|
|
#include <retroshare/rsnotify.h>
|
2013-01-08 17:07:52 -05:00
|
|
|
#include <retroshare/rsplugin.h>
|
2010-05-11 16:02:52 -04:00
|
|
|
#include "rsharesettings.h"
|
2009-07-23 13:11:51 -04:00
|
|
|
|
2010-06-15 12:51:48 -04:00
|
|
|
#include "gui/MainWindow.h"
|
2012-08-05 16:12:55 -04:00
|
|
|
#include "gui/common/UserNotify.h"
|
2013-01-08 17:07:52 -05:00
|
|
|
#include "gui/common/FeedNotify.h"
|
2015-05-26 11:19:57 -04:00
|
|
|
#include "gui/common/ToasterNotify.h"
|
2012-09-04 16:04:49 -04:00
|
|
|
#include "gui/notifyqt.h"
|
|
|
|
#include "gui/NewsFeed.h"
|
2017-02-27 17:41:31 -05:00
|
|
|
#include "util/misc.h"
|
2009-07-23 13:11:51 -04:00
|
|
|
|
|
|
|
/** Constructor */
|
2013-10-18 17:10:33 -04:00
|
|
|
NotifyPage::NotifyPage(QWidget * parent, Qt::WindowFlags flags)
|
2009-08-19 18:15:16 -04:00
|
|
|
: ConfigPage(parent, flags)
|
2009-07-23 13:11:51 -04:00
|
|
|
{
|
2017-01-29 15:47:13 -05:00
|
|
|
/* Invoke the Qt Designer generated object setup routine */
|
|
|
|
ui.setupUi(this);
|
|
|
|
|
|
|
|
connect(ui.testFeedButton, SIGNAL(clicked()), this, SLOT(testFeed()));
|
|
|
|
connect(ui.testToasterButton, SIGNAL(clicked()), this, SLOT(testToaster()));
|
|
|
|
connect(ui.pushButtonDisableAll,SIGNAL(toggled(bool)), NotifyQt::getInstance(), SLOT(SetDisableAll(bool)));
|
|
|
|
connect(NotifyQt::getInstance(),SIGNAL(disableAllChanged(bool)), ui.pushButtonDisableAll, SLOT(setChecked(bool)));
|
|
|
|
connect(ui.chatLobbies_CountFollowingText,SIGNAL(toggled(bool)),ui.chatLobbies_TextToNotify,SLOT(setEnabled(bool)));
|
|
|
|
|
|
|
|
ui.notify_Blogs->hide();
|
|
|
|
|
|
|
|
QFont font = ui.notify_Peers->font(); // use font from existing checkbox
|
|
|
|
|
|
|
|
/* add feed and Toaster notify */
|
|
|
|
int rowFeed = 0;
|
|
|
|
int rowToaster = 0;
|
|
|
|
int pluginCount = rsPlugins->nbPlugins();
|
|
|
|
for (int i = 0; i < pluginCount; ++i)
|
|
|
|
{
|
|
|
|
RsPlugin *rsPlugin = rsPlugins->plugin(i);
|
|
|
|
if (rsPlugin) {
|
|
|
|
FeedNotify *feedNotify = rsPlugin->qt_feedNotify();
|
|
|
|
if (feedNotify) {
|
|
|
|
QString name;
|
|
|
|
if (feedNotify->hasSetting(name)) {
|
|
|
|
|
|
|
|
QCheckBox *enabledCheckBox = new QCheckBox(name, this);
|
|
|
|
enabledCheckBox->setFont(font);
|
|
|
|
ui.feedLayout->addWidget(enabledCheckBox, rowFeed++);
|
|
|
|
|
|
|
|
mFeedNotifySettingList.push_back(FeedNotifySetting(feedNotify, enabledCheckBox));
|
|
|
|
|
2017-02-27 17:00:49 -05:00
|
|
|
connect(enabledCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateFeedNotifySettings()));
|
2017-01-29 15:47:13 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ToasterNotify *toasterNotify = rsPlugin->qt_toasterNotify();
|
|
|
|
if (toasterNotify) {
|
|
|
|
QString name;
|
|
|
|
if (toasterNotify->hasSetting(name)) {
|
|
|
|
|
|
|
|
QCheckBox *enabledCheckBox = new QCheckBox(name, this);
|
|
|
|
enabledCheckBox->setFont(font);
|
|
|
|
ui.toasterLayout->addWidget(enabledCheckBox, rowToaster++);
|
|
|
|
|
|
|
|
mToasterNotifySettingList.push_back(ToasterNotifySetting(toasterNotify, enabledCheckBox));
|
|
|
|
|
2017-02-27 17:00:49 -05:00
|
|
|
connect(enabledCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateToasterNotifySettings()));
|
2017-01-29 15:47:13 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
QMap<QString, QString> map;
|
|
|
|
if (toasterNotify->hasSettings(name, map)) {
|
|
|
|
if (!map.empty()){
|
|
|
|
QWidget* widget = new QWidget();
|
|
|
|
QVBoxLayout* vbLayout = new QVBoxLayout(widget);
|
|
|
|
QLabel *label = new QLabel(name, this);
|
|
|
|
QFont fontBold = QFont(font);
|
|
|
|
fontBold.setBold(true);
|
|
|
|
label->setFont(fontBold);
|
|
|
|
vbLayout->addWidget(label);
|
|
|
|
for (QMap<QString, QString>::const_iterator it = map.begin(); it != map.end(); ++it){
|
|
|
|
QCheckBox *enabledCheckBox = new QCheckBox(it.value(), this);
|
|
|
|
enabledCheckBox->setAccessibleName(it.key());
|
|
|
|
enabledCheckBox->setFont(font);
|
|
|
|
vbLayout->addWidget(enabledCheckBox);
|
|
|
|
mToasterNotifySettingList.push_back(ToasterNotifySetting(toasterNotify, enabledCheckBox));
|
|
|
|
|
|
|
|
connect(enabledCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateToasterNotifySettings())) ;
|
|
|
|
}
|
|
|
|
ui.toasterLayout->addWidget(widget, rowToaster++);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-02-27 17:00:49 -05:00
|
|
|
/* Add user notify */
|
|
|
|
const QList<UserNotify*> &userNotifyList = MainWindow::getInstance()->getUserNotifyList() ;
|
2017-01-29 15:47:13 -05:00
|
|
|
QList<UserNotify*>::const_iterator it;
|
|
|
|
rowFeed = 0;
|
|
|
|
mChatLobbyUserNotify = 0;
|
|
|
|
for (it = userNotifyList.begin(); it != userNotifyList.end(); ++it) {
|
|
|
|
UserNotify *userNotify = *it;
|
|
|
|
|
|
|
|
QString name;
|
|
|
|
if (!userNotify->hasSetting(&name, NULL)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
QCheckBox *enabledCheckBox = new QCheckBox(name, this);
|
|
|
|
enabledCheckBox->setFont(font);
|
|
|
|
ui.notifyLayout->addWidget(enabledCheckBox, rowFeed, 0, 0);
|
|
|
|
connect(enabledCheckBox, SIGNAL(toggled(bool)), this, SLOT(notifyToggled()));
|
|
|
|
|
|
|
|
QCheckBox *combinedCheckBox = new QCheckBox(tr("Combined"), this);
|
|
|
|
combinedCheckBox->setFont(font);
|
|
|
|
ui.notifyLayout->addWidget(combinedCheckBox, rowFeed, 1);
|
|
|
|
|
|
|
|
QCheckBox *blinkCheckBox = new QCheckBox(tr("Blink"), this);
|
|
|
|
blinkCheckBox->setFont(font);
|
|
|
|
ui.notifyLayout->addWidget(blinkCheckBox, rowFeed++, 2);
|
|
|
|
|
|
|
|
mUserNotifySettingList.push_back(UserNotifySetting(userNotify, enabledCheckBox, combinedCheckBox, blinkCheckBox));
|
|
|
|
|
|
|
|
connect(enabledCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateUserNotifySettings())) ;
|
|
|
|
connect(blinkCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateUserNotifySettings())) ;
|
|
|
|
connect(combinedCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateUserNotifySettings())) ;
|
|
|
|
|
|
|
|
//To get ChatLobbyUserNotify Settings
|
|
|
|
if (!mChatLobbyUserNotify) mChatLobbyUserNotify = dynamic_cast<ChatLobbyUserNotify*>(*it);
|
|
|
|
}
|
|
|
|
|
|
|
|
connect(ui.popup_Connect, SIGNAL(toggled(bool)), this, SLOT(updateNotifyFlags())) ;
|
|
|
|
connect(ui.popup_NewMsg, SIGNAL(toggled(bool)), this, SLOT(updateNotifyFlags())) ;
|
|
|
|
connect(ui.popup_DownloadFinished, SIGNAL(toggled(bool)), this, SLOT(updateNotifyFlags())) ;
|
|
|
|
connect(ui.popup_PrivateChat, SIGNAL(toggled(bool)), this, SLOT(updateNotifyFlags())) ;
|
|
|
|
connect(ui.popup_GroupChat, SIGNAL(toggled(bool)), this, SLOT(updateNotifyFlags())) ;
|
|
|
|
connect(ui.popup_ChatLobby, SIGNAL(toggled(bool)), this, SLOT(updateNotifyFlags())) ;
|
|
|
|
connect(ui.popup_ConnectAttempt, SIGNAL(toggled(bool)), this, SLOT(updateNotifyFlags())) ;
|
|
|
|
|
|
|
|
connect(ui.message_ConnectAttempt, SIGNAL(toggled(bool)), this, SLOT(updateMessageFlags())) ;
|
|
|
|
|
|
|
|
connect(ui.notify_Peers, SIGNAL(toggled(bool)), this, SLOT(updateNewsFeedFlags()));
|
|
|
|
connect(ui.notify_Channels, SIGNAL(toggled(bool)), this, SLOT(updateNewsFeedFlags()));
|
|
|
|
connect(ui.notify_Forums, SIGNAL(toggled(bool)), this, SLOT(updateNewsFeedFlags()));
|
|
|
|
connect(ui.notify_Posted, SIGNAL(toggled(bool)), this, SLOT(updateNewsFeedFlags()));
|
|
|
|
connect(ui.notify_Messages, SIGNAL(toggled(bool)), this, SLOT(updateNewsFeedFlags()));
|
|
|
|
connect(ui.notify_Chat, SIGNAL(toggled(bool)), this, SLOT(updateNewsFeedFlags()));
|
|
|
|
connect(ui.notify_Security, SIGNAL(toggled(bool)), this, SLOT(updateNewsFeedFlags()));
|
|
|
|
connect(ui.notify_SecurityIp, SIGNAL(toggled(bool)), this, SLOT(updateNewsFeedFlags()));
|
|
|
|
|
2017-02-27 17:00:49 -05:00
|
|
|
connect(ui.systray_ChatLobby, SIGNAL(toggled(bool)), this, SLOT(updateSystrayChatLobby()));
|
|
|
|
connect(ui.systray_GroupChat, SIGNAL(toggled(bool)), this, SLOT(updateSystrayGroupChat()));
|
2017-01-29 15:47:13 -05:00
|
|
|
|
2017-02-27 17:00:49 -05:00
|
|
|
connect(ui.spinBoxToasterXMargin, SIGNAL(valueChanged(int)), this, SLOT(updateToasterMargin()));
|
|
|
|
connect(ui.spinBoxToasterYMargin, SIGNAL(valueChanged(int)), this, SLOT(updateToasterMargin()));
|
2017-01-29 15:47:13 -05:00
|
|
|
|
|
|
|
connect(ui.comboBoxToasterPosition, SIGNAL(currentIndexChanged(int)),this, SLOT(updateToasterPosition())) ;
|
|
|
|
|
|
|
|
connect(ui.chatLobbies_CountUnRead, SIGNAL(toggled(bool)),this, SLOT(updateChatLobbyUserNotify())) ;
|
|
|
|
connect(ui.chatLobbies_CheckNickName, SIGNAL(toggled(bool)),this, SLOT(updateChatLobbyUserNotify())) ;
|
|
|
|
connect(ui.chatLobbies_CountFollowingText, SIGNAL(toggled(bool)),this, SLOT(updateChatLobbyUserNotify())) ;
|
|
|
|
connect(ui.chatLobbies_TextToNotify, SIGNAL(textChanged(QString)),this, SLOT(updateChatLobbyUserNotify()));
|
|
|
|
connect(ui.chatLobbies_TextCaseSensitive, SIGNAL(toggled(bool)),this, SLOT(updateChatLobbyUserNotify())) ;
|
2009-07-23 13:11:51 -04:00
|
|
|
}
|
|
|
|
|
2010-05-07 19:58:17 -04:00
|
|
|
NotifyPage::~NotifyPage()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-09-04 16:04:49 -04:00
|
|
|
uint NotifyPage::getNewsFlags()
|
2009-07-23 13:11:51 -04:00
|
|
|
{
|
2012-09-04 16:04:49 -04:00
|
|
|
uint newsFlags = 0;
|
2009-07-23 13:11:51 -04:00
|
|
|
|
2012-09-04 16:04:49 -04:00
|
|
|
if (ui.notify_Peers->isChecked())
|
|
|
|
newsFlags |= RS_FEED_TYPE_PEER;
|
|
|
|
if (ui.notify_Channels->isChecked())
|
2014-11-13 17:03:12 -05:00
|
|
|
newsFlags |= RS_FEED_TYPE_CHANNEL;
|
2012-09-04 16:04:49 -04:00
|
|
|
if (ui.notify_Forums->isChecked())
|
|
|
|
newsFlags |= RS_FEED_TYPE_FORUM;
|
2014-11-20 19:50:18 -05:00
|
|
|
if (ui.notify_Posted->isChecked())
|
|
|
|
newsFlags |= RS_FEED_TYPE_POSTED;
|
2014-11-13 17:03:12 -05:00
|
|
|
#if 0
|
2012-09-04 16:04:49 -04:00
|
|
|
if (ui.notify_Blogs->isChecked())
|
|
|
|
newsFlags |= RS_FEED_TYPE_BLOG;
|
2013-09-07 00:21:48 -04:00
|
|
|
#endif
|
2012-09-04 16:04:49 -04:00
|
|
|
if (ui.notify_Messages->isChecked())
|
|
|
|
newsFlags |= RS_FEED_TYPE_MSG;
|
|
|
|
if (ui.notify_Chat->isChecked())
|
|
|
|
newsFlags |= RS_FEED_TYPE_CHAT;
|
|
|
|
if (ui.notify_Security->isChecked())
|
|
|
|
newsFlags |= RS_FEED_TYPE_SECURITY;
|
2015-06-12 21:28:01 -04:00
|
|
|
if (ui.notify_SecurityIp->isChecked())
|
|
|
|
newsFlags |= RS_FEED_TYPE_SECURITY_IP;
|
2012-09-04 16:04:49 -04:00
|
|
|
|
|
|
|
return newsFlags;
|
|
|
|
}
|
|
|
|
|
2013-10-13 08:16:46 -04:00
|
|
|
QString NotifyPage::helpText() const
|
|
|
|
{
|
2015-06-30 12:44:58 -04:00
|
|
|
return tr("<h1><img width=\"24\" src=\":/icons/help_64.png\"> Notify</h1> \
|
2013-10-13 08:16:46 -04:00
|
|
|
<p>Retroshare will notify you about what happens in your network. \
|
|
|
|
Depending on your usage, you may want to enable or disable some of the \
|
|
|
|
notifications. This page is designed for that!</p> \
|
|
|
|
") ;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-09-04 16:04:49 -04:00
|
|
|
uint NotifyPage::getNotifyFlags()
|
|
|
|
{
|
|
|
|
uint notifyFlags = 0;
|
2009-07-23 13:11:51 -04:00
|
|
|
|
2010-06-15 12:51:48 -04:00
|
|
|
if (ui.popup_Connect->isChecked())
|
2012-09-04 16:04:49 -04:00
|
|
|
notifyFlags |= RS_POPUP_CONNECT;
|
2010-06-15 12:51:48 -04:00
|
|
|
if (ui.popup_NewMsg->isChecked())
|
2012-09-04 16:04:49 -04:00
|
|
|
notifyFlags |= RS_POPUP_MSG;
|
2010-11-24 19:20:25 -05:00
|
|
|
if (ui.popup_DownloadFinished->isChecked())
|
2012-09-04 16:04:49 -04:00
|
|
|
notifyFlags |= RS_POPUP_DOWNLOAD;
|
2012-03-30 19:02:52 -04:00
|
|
|
if (ui.popup_PrivateChat->isChecked())
|
2012-09-04 16:04:49 -04:00
|
|
|
notifyFlags |= RS_POPUP_CHAT;
|
2012-03-30 19:02:52 -04:00
|
|
|
if (ui.popup_GroupChat->isChecked())
|
2012-09-04 16:04:49 -04:00
|
|
|
notifyFlags |= RS_POPUP_GROUPCHAT;
|
2012-03-30 19:02:52 -04:00
|
|
|
if (ui.popup_ChatLobby->isChecked())
|
2012-09-04 16:04:49 -04:00
|
|
|
notifyFlags |= RS_POPUP_CHATLOBBY;
|
2012-04-25 15:19:16 -04:00
|
|
|
if (ui.popup_ConnectAttempt->isChecked())
|
2012-09-04 16:04:49 -04:00
|
|
|
notifyFlags |= RS_POPUP_CONNECT_ATTEMPT;
|
2009-07-23 13:11:51 -04:00
|
|
|
|
2012-09-04 16:04:49 -04:00
|
|
|
return notifyFlags;
|
|
|
|
}
|
|
|
|
|
2009-07-23 13:11:51 -04:00
|
|
|
|
2017-01-29 15:47:13 -05:00
|
|
|
void NotifyPage::updateFeedNotifySettings()
|
|
|
|
{
|
|
|
|
/* save feed notify */
|
|
|
|
QList<FeedNotifySetting>::iterator feedNotifyIt;
|
|
|
|
for (feedNotifyIt = mFeedNotifySettingList.begin(); feedNotifyIt != mFeedNotifySettingList.end(); ++feedNotifyIt)
|
|
|
|
feedNotifyIt->mFeedNotify->setNotifyEnabled(feedNotifyIt->mEnabledCheckBox->isChecked());
|
|
|
|
}
|
2013-01-08 17:07:52 -05:00
|
|
|
|
2017-01-29 15:47:13 -05:00
|
|
|
void NotifyPage::updateToasterNotifySettings()
|
|
|
|
{
|
2015-05-26 11:19:57 -04:00
|
|
|
/* save toaster notify */
|
|
|
|
QList<ToasterNotifySetting>::iterator toasterNotifyIt;
|
|
|
|
for (toasterNotifyIt = mToasterNotifySettingList.begin(); toasterNotifyIt != mToasterNotifySettingList.end(); ++toasterNotifyIt) {
|
2017-01-29 15:47:13 -05:00
|
|
|
if(toasterNotifyIt->mEnabledCheckBox->accessibleName().isEmpty())
|
2015-05-26 11:19:57 -04:00
|
|
|
toasterNotifyIt->mToasterNotify->setNotifyEnabled(toasterNotifyIt->mEnabledCheckBox->isChecked()) ;
|
2017-01-29 15:47:13 -05:00
|
|
|
else
|
2015-05-26 11:19:57 -04:00
|
|
|
toasterNotifyIt->mToasterNotify->setNotifyEnabled(toasterNotifyIt->mEnabledCheckBox->accessibleName(), toasterNotifyIt->mEnabledCheckBox->isChecked()) ;
|
|
|
|
}
|
2017-01-29 15:47:13 -05:00
|
|
|
}
|
2015-05-26 11:19:57 -04:00
|
|
|
|
2017-01-29 15:47:13 -05:00
|
|
|
void NotifyPage::updateUserNotifySettings()
|
|
|
|
{
|
|
|
|
/* save user notify */
|
|
|
|
QList<UserNotifySetting>::iterator notifyIt;
|
|
|
|
for (notifyIt = mUserNotifySettingList.begin(); notifyIt != mUserNotifySettingList.end(); ++notifyIt)
|
|
|
|
notifyIt->mUserNotify->setNotifyEnabled(notifyIt->mEnabledCheckBox->isChecked(), notifyIt->mCombinedCheckBox->isChecked(), notifyIt->mBlinkCheckBox->isChecked());
|
|
|
|
|
|
|
|
MainWindow::installNotifyIcons();
|
|
|
|
}
|
2012-08-05 16:12:55 -04:00
|
|
|
|
2017-01-29 15:47:13 -05:00
|
|
|
void NotifyPage::updateMessageFlags() { Settings->setMessageFlags( ui.message_ConnectAttempt->isChecked()? RS_MESSAGE_CONNECT_ATTEMPT : 0); }
|
|
|
|
void NotifyPage::updateNotifyFlags() { Settings->setNotifyFlags(getNotifyFlags()); }
|
|
|
|
void NotifyPage::updateNewsFeedFlags(){ Settings->setNewsFeedFlags(getNewsFlags()); }
|
2009-07-23 13:11:51 -04:00
|
|
|
|
2017-01-29 15:47:13 -05:00
|
|
|
void NotifyPage::updateSystrayChatLobby() { Settings->setDisplayTrayChatLobby(ui.systray_ChatLobby->isChecked()); }
|
|
|
|
void NotifyPage::updateSystrayGroupChat() { Settings->setDisplayTrayGroupChat(ui.systray_GroupChat->isChecked()); MainWindow::installGroupChatNotifier(); }
|
|
|
|
void NotifyPage::updateToasterMargin() { Settings->setToasterMargin(QPoint(ui.spinBoxToasterXMargin->value(), ui.spinBoxToasterYMargin->value())); }
|
2010-06-15 12:51:48 -04:00
|
|
|
|
2017-01-29 15:47:13 -05:00
|
|
|
void NotifyPage::updateToasterPosition()
|
|
|
|
{
|
2010-12-10 16:49:38 -05:00
|
|
|
int index = ui.comboBoxToasterPosition->currentIndex();
|
2017-01-29 15:47:13 -05:00
|
|
|
if (index != -1)
|
2010-12-10 16:49:38 -05:00
|
|
|
Settings->setToasterPosition((RshareSettings::enumToasterPosition) ui.comboBoxToasterPosition->itemData(index).toInt());
|
2017-01-29 15:47:13 -05:00
|
|
|
}
|
2010-12-10 16:49:38 -05:00
|
|
|
|
2017-01-29 15:47:13 -05:00
|
|
|
void NotifyPage::updateChatLobbyUserNotify()
|
|
|
|
{
|
|
|
|
if(!mChatLobbyUserNotify)
|
|
|
|
return ;
|
|
|
|
|
|
|
|
mChatLobbyUserNotify->setCountUnRead(ui.chatLobbies_CountUnRead->isChecked()) ;
|
|
|
|
mChatLobbyUserNotify->setCheckForNickName(ui.chatLobbies_CheckNickName->isChecked()) ;
|
|
|
|
mChatLobbyUserNotify->setCountSpecificText(ui.chatLobbies_CountFollowingText->isChecked()) ;
|
|
|
|
mChatLobbyUserNotify->setTextToNotify(ui.chatLobbies_TextToNotify->document()->toPlainText());
|
|
|
|
mChatLobbyUserNotify->setTextCaseSensitive(ui.chatLobbies_TextCaseSensitive->isChecked());
|
2009-07-23 13:11:51 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Loads the settings for this page */
|
|
|
|
void NotifyPage::load()
|
|
|
|
{
|
2017-02-27 17:41:31 -05:00
|
|
|
/* Extract from rsNotify the flags */
|
|
|
|
uint notifyflags = Settings->getNotifyFlags() ;
|
|
|
|
uint newsflags = Settings->getNewsFeedFlags() ;
|
|
|
|
uint messageflags = Settings->getMessageFlags() ;
|
|
|
|
|
|
|
|
whileBlocking(ui.popup_Connect)->setChecked(notifyflags & RS_POPUP_CONNECT);
|
|
|
|
whileBlocking(ui.popup_NewMsg)->setChecked(notifyflags & RS_POPUP_MSG);
|
|
|
|
whileBlocking(ui.popup_DownloadFinished)->setChecked(notifyflags & RS_POPUP_DOWNLOAD);
|
|
|
|
whileBlocking(ui.popup_PrivateChat)->setChecked(notifyflags & RS_POPUP_CHAT);
|
|
|
|
whileBlocking(ui.popup_GroupChat)->setChecked(notifyflags & RS_POPUP_GROUPCHAT);
|
|
|
|
whileBlocking(ui.popup_ChatLobby)->setChecked(notifyflags & RS_POPUP_CHATLOBBY);
|
|
|
|
whileBlocking(ui.popup_ConnectAttempt)->setChecked(notifyflags & RS_POPUP_CONNECT_ATTEMPT);
|
|
|
|
|
|
|
|
whileBlocking(ui.notify_Peers)->setChecked(newsflags & RS_FEED_TYPE_PEER);
|
|
|
|
whileBlocking(ui.notify_Channels)->setChecked(newsflags & RS_FEED_TYPE_CHANNEL);
|
|
|
|
whileBlocking(ui.notify_Forums)->setChecked(newsflags & RS_FEED_TYPE_FORUM);
|
|
|
|
whileBlocking(ui.notify_Posted)->setChecked(newsflags & RS_FEED_TYPE_POSTED);
|
2014-11-13 17:03:12 -05:00
|
|
|
#if 0
|
2017-02-27 17:41:31 -05:00
|
|
|
whileBlocking(ui.notify_Blogs)->setChecked(newsflags & RS_FEED_TYPE_BLOG);
|
2013-09-07 00:21:48 -04:00
|
|
|
#endif
|
2017-02-27 17:41:31 -05:00
|
|
|
whileBlocking(ui.notify_Chat)->setChecked(newsflags & RS_FEED_TYPE_CHAT);
|
|
|
|
whileBlocking(ui.notify_Messages)->setChecked(newsflags & RS_FEED_TYPE_MSG);
|
|
|
|
whileBlocking(ui.notify_Chat)->setChecked(newsflags & RS_FEED_TYPE_CHAT);
|
|
|
|
whileBlocking(ui.notify_Security)->setChecked(newsflags & RS_FEED_TYPE_SECURITY);
|
|
|
|
whileBlocking(ui.notify_SecurityIp)->setChecked(newsflags & RS_FEED_TYPE_SECURITY_IP);
|
2009-07-23 13:11:51 -04:00
|
|
|
|
2017-02-27 17:41:31 -05:00
|
|
|
whileBlocking(ui.message_ConnectAttempt)->setChecked(messageflags & RS_MESSAGE_CONNECT_ATTEMPT);
|
2012-04-26 19:41:14 -04:00
|
|
|
|
2017-02-27 17:41:31 -05:00
|
|
|
whileBlocking(ui.systray_GroupChat)->setChecked(Settings->getDisplayTrayGroupChat());
|
|
|
|
whileBlocking(ui.systray_ChatLobby)->setChecked(Settings->getDisplayTrayChatLobby());
|
2009-07-23 13:11:51 -04:00
|
|
|
|
2017-02-27 17:41:31 -05:00
|
|
|
whileBlocking(ui.pushButtonDisableAll)->setChecked(NotifyQt::isAllDisable());
|
2014-05-10 14:32:48 -04:00
|
|
|
|
2010-12-10 16:49:38 -05:00
|
|
|
RshareSettings::enumToasterPosition toasterPosition = Settings->getToasterPosition();
|
|
|
|
ui.comboBoxToasterPosition->clear();
|
|
|
|
|
|
|
|
QMap<int, QString> toasterPositions;
|
|
|
|
toasterPositions[RshareSettings::TOASTERPOS_TOPLEFT] = tr("Top Left");
|
|
|
|
toasterPositions[RshareSettings::TOASTERPOS_TOPRIGHT] = tr("Top Right");
|
|
|
|
toasterPositions[RshareSettings::TOASTERPOS_BOTTOMLEFT] = tr("Bottom Left");
|
|
|
|
toasterPositions[RshareSettings::TOASTERPOS_BOTTOMRIGHT] = tr("Bottom Right");
|
|
|
|
|
|
|
|
QMap<int, QString>::iterator it;
|
|
|
|
int index = 0;
|
2014-10-21 18:33:02 -04:00
|
|
|
for (it = toasterPositions.begin(); it != toasterPositions.end(); ++it, ++index) {
|
2010-12-10 16:49:38 -05:00
|
|
|
ui.comboBoxToasterPosition->addItem(it.value(), it.key());
|
|
|
|
|
|
|
|
if (it.key() == toasterPosition) {
|
2017-02-27 17:41:31 -05:00
|
|
|
whileBlocking(ui.comboBoxToasterPosition)->setCurrentIndex(index);
|
2010-12-10 16:49:38 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-27 17:41:31 -05:00
|
|
|
QPoint margin = Settings->getToasterMargin() ;
|
|
|
|
whileBlocking(ui.spinBoxToasterXMargin)->setValue(margin.x());
|
|
|
|
whileBlocking(ui.spinBoxToasterYMargin)->setValue(margin.y());
|
2011-07-13 15:24:33 -04:00
|
|
|
|
2017-02-27 17:41:31 -05:00
|
|
|
/* Load feed notify */
|
|
|
|
QList<FeedNotifySetting>::iterator feedNotifyIt ;
|
|
|
|
for (feedNotifyIt = mFeedNotifySettingList.begin(); feedNotifyIt != mFeedNotifySettingList.end(); ++feedNotifyIt ) {
|
|
|
|
whileBlocking(feedNotifyIt->mEnabledCheckBox)->setChecked(feedNotifyIt->mFeedNotify->notifyEnabled());
|
|
|
|
}
|
2013-01-08 17:07:52 -05:00
|
|
|
|
2017-02-27 17:41:31 -05:00
|
|
|
/* Load toaster notify */
|
|
|
|
QList<ToasterNotifySetting>::iterator toasterNotifyIt ;
|
|
|
|
for (toasterNotifyIt = mToasterNotifySettingList.begin(); toasterNotifyIt != mToasterNotifySettingList.end(); ++toasterNotifyIt ) {
|
|
|
|
if( toasterNotifyIt->mEnabledCheckBox->accessibleName().isEmpty() ) {
|
|
|
|
whileBlocking(toasterNotifyIt->mEnabledCheckBox)->setChecked(toasterNotifyIt->mToasterNotify->notifyEnabled()) ;
|
|
|
|
} else {
|
|
|
|
whileBlocking(toasterNotifyIt->mEnabledCheckBox)->setChecked(toasterNotifyIt->mToasterNotify->notifyEnabled(toasterNotifyIt->mEnabledCheckBox->accessibleName())) ;
|
|
|
|
}
|
|
|
|
}
|
2015-05-26 11:19:57 -04:00
|
|
|
|
2017-02-27 17:41:31 -05:00
|
|
|
/* Load user notify */
|
|
|
|
QList<UserNotifySetting>::iterator userNotifyIt ;
|
|
|
|
for (userNotifyIt = mUserNotifySettingList.begin(); userNotifyIt != mUserNotifySettingList.end(); ++userNotifyIt ) {
|
|
|
|
whileBlocking(userNotifyIt->mEnabledCheckBox)->setChecked(userNotifyIt->mUserNotify->notifyEnabled());
|
|
|
|
whileBlocking(userNotifyIt->mCombinedCheckBox)->setChecked(userNotifyIt->mUserNotify->notifyCombined());
|
|
|
|
whileBlocking(userNotifyIt->mBlinkCheckBox)->setChecked(userNotifyIt->mUserNotify->notifyBlink());
|
|
|
|
}
|
2012-08-05 16:12:55 -04:00
|
|
|
|
2017-02-27 17:41:31 -05:00
|
|
|
notifyToggled() ;
|
2015-03-26 18:17:48 -04:00
|
|
|
|
2017-02-27 17:41:31 -05:00
|
|
|
if (mChatLobbyUserNotify){
|
|
|
|
whileBlocking(ui.chatLobbies_CountUnRead)->setChecked(mChatLobbyUserNotify->isCountUnRead());
|
|
|
|
whileBlocking(ui.chatLobbies_CheckNickName)->setChecked(mChatLobbyUserNotify->isCheckForNickName());
|
|
|
|
whileBlocking(ui.chatLobbies_CountFollowingText)->setChecked(mChatLobbyUserNotify->isCountSpecificText()) ;
|
|
|
|
whileBlocking(ui.chatLobbies_TextToNotify)->setEnabled(mChatLobbyUserNotify->isCountSpecificText()) ;
|
|
|
|
whileBlocking(ui.chatLobbies_TextToNotify)->setPlainText(mChatLobbyUserNotify->textToNotify());
|
|
|
|
whileBlocking(ui.chatLobbies_TextCaseSensitive)->setChecked(mChatLobbyUserNotify->isTextCaseSensitive());
|
|
|
|
}
|
2011-07-13 15:24:33 -04:00
|
|
|
}
|
|
|
|
|
2012-08-05 16:12:55 -04:00
|
|
|
void NotifyPage::notifyToggled()
|
2011-07-13 15:24:33 -04:00
|
|
|
{
|
2012-08-05 16:12:55 -04:00
|
|
|
QList<UserNotifySetting>::iterator notifyIt;
|
|
|
|
for (notifyIt = mUserNotifySettingList.begin(); notifyIt != mUserNotifySettingList.end(); ++notifyIt) {
|
|
|
|
if (notifyIt->mEnabledCheckBox->isChecked()) {
|
|
|
|
notifyIt->mCombinedCheckBox->setEnabled(true);
|
2012-10-27 11:59:12 -04:00
|
|
|
notifyIt->mBlinkCheckBox->setEnabled(true);
|
2011-07-13 15:24:33 -04:00
|
|
|
} else {
|
2012-08-05 16:12:55 -04:00
|
|
|
notifyIt->mCombinedCheckBox->setChecked(false);
|
|
|
|
notifyIt->mCombinedCheckBox->setEnabled(false);
|
2012-10-27 11:59:12 -04:00
|
|
|
|
|
|
|
notifyIt->mBlinkCheckBox->setChecked(false);
|
|
|
|
notifyIt->mBlinkCheckBox->setEnabled(false);
|
2011-07-13 15:24:33 -04:00
|
|
|
}
|
|
|
|
}
|
2010-12-10 16:49:38 -05:00
|
|
|
}
|
2012-09-04 16:04:49 -04:00
|
|
|
|
2015-05-26 11:19:57 -04:00
|
|
|
void NotifyPage::testFeed()
|
2012-09-04 16:04:49 -04:00
|
|
|
{
|
|
|
|
NewsFeed::testFeeds(getNewsFlags());
|
2013-01-14 17:41:31 -05:00
|
|
|
|
|
|
|
/* notify of plugins */
|
|
|
|
QList<FeedNotifySetting>::iterator feedNotifyIt;
|
|
|
|
for (feedNotifyIt = mFeedNotifySettingList.begin(); feedNotifyIt != mFeedNotifySettingList.end(); ++feedNotifyIt) {
|
|
|
|
if (feedNotifyIt->mEnabledCheckBox->isChecked()) {
|
|
|
|
NewsFeed::testFeed(feedNotifyIt->mFeedNotify);
|
|
|
|
}
|
|
|
|
}
|
2012-09-04 16:04:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void NotifyPage::testToaster()
|
|
|
|
{
|
2015-05-26 11:19:57 -04:00
|
|
|
RshareSettings::enumToasterPosition pos = (RshareSettings::enumToasterPosition) ui.comboBoxToasterPosition->itemData(ui.comboBoxToasterPosition->currentIndex()).toInt();
|
|
|
|
QPoint margin = QPoint(ui.spinBoxToasterXMargin->value(), ui.spinBoxToasterYMargin->value());
|
|
|
|
NotifyQt::getInstance()->testToasters(getNotifyFlags(), pos, margin);
|
|
|
|
|
|
|
|
/* notify of plugins */
|
|
|
|
QList<ToasterNotifySetting>::iterator toasterNotifyIt;
|
|
|
|
for (toasterNotifyIt = mToasterNotifySettingList.begin(); toasterNotifyIt != mToasterNotifySettingList.end(); ++toasterNotifyIt) {
|
|
|
|
if (toasterNotifyIt->mEnabledCheckBox->isChecked()){
|
|
|
|
if (toasterNotifyIt->mEnabledCheckBox->accessibleName().isEmpty()){
|
|
|
|
NotifyQt::getInstance()->testToaster(toasterNotifyIt->mToasterNotify, pos, margin) ;
|
|
|
|
} else {
|
|
|
|
NotifyQt::getInstance()->testToaster(toasterNotifyIt->mEnabledCheckBox->accessibleName(), toasterNotifyIt->mToasterNotify, pos, margin) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-09-04 16:04:49 -04:00
|
|
|
}
|