mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Added two buttons to the NotifyPage to show examples of the activated news feeds and toasters.
Can also be used to test the stylesheets. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5510 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
61429b0ddd
commit
345187262d
@ -25,6 +25,9 @@
|
||||
|
||||
#include <retroshare/rsnotify.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rschannels.h>
|
||||
#include <retroshare/rsforums.h>
|
||||
#include <retroshare/rsmsgs.h>
|
||||
|
||||
#include "feeds/ChanNewItem.h"
|
||||
#include "feeds/ChanMsgItem.h"
|
||||
@ -62,6 +65,8 @@ const uint32_t NEWSFEED_SECLIST = 0x000a;
|
||||
* #define NEWS_DEBUG 1
|
||||
****/
|
||||
|
||||
static NewsFeed *instance = NULL;
|
||||
|
||||
/** Constructor */
|
||||
NewsFeed::NewsFeed(QWidget *parent)
|
||||
: MainPage (parent)
|
||||
@ -69,15 +74,25 @@ NewsFeed::NewsFeed(QWidget *parent)
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
setupUi(this);
|
||||
|
||||
if (!instance) {
|
||||
instance = this;
|
||||
}
|
||||
|
||||
connect(removeAllButton, SIGNAL(clicked()), this, SLOT(removeAll()));
|
||||
connect(feedOptionsButton, SIGNAL(clicked()), this, SLOT(feedoptions()));
|
||||
|
||||
|
||||
QTimer *timer = new QTimer(this);
|
||||
timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateFeed()));
|
||||
timer->start(1000);
|
||||
}
|
||||
|
||||
NewsFeed::~NewsFeed()
|
||||
{
|
||||
if (instance == this) {
|
||||
instance = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void NewsFeed::updateFeed()
|
||||
{
|
||||
if (!rsNotify)
|
||||
@ -162,14 +177,17 @@ void NewsFeed::updateFeed()
|
||||
if (flags & RS_FEED_TYPE_BLOG)
|
||||
addFeedItemBlogMsg(fi);
|
||||
break;
|
||||
|
||||
case RS_FEED_ITEM_CHAT_NEW:
|
||||
if (flags & RS_FEED_TYPE_CHAT)
|
||||
addFeedItemChatNew(fi);
|
||||
addFeedItemChatNew(fi, false);
|
||||
break;
|
||||
|
||||
case RS_FEED_ITEM_MESSAGE:
|
||||
if (flags & RS_FEED_TYPE_MSG)
|
||||
addFeedItemMessage(fi);
|
||||
break;
|
||||
|
||||
case RS_FEED_ITEM_FILES_NEW:
|
||||
if (flags & RS_FEED_TYPE_FILES)
|
||||
addFeedItemFilesNew(fi);
|
||||
@ -180,6 +198,199 @@ void NewsFeed::updateFeed()
|
||||
}
|
||||
}
|
||||
|
||||
void NewsFeed::testFeeds(uint notifyFlags)
|
||||
{
|
||||
if (!instance) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint pos = 0;
|
||||
|
||||
while (notifyFlags) {
|
||||
uint type = notifyFlags & (1 << pos);
|
||||
notifyFlags &= ~(1 << pos);
|
||||
++pos;
|
||||
|
||||
RsFeedItem fi;
|
||||
|
||||
switch(type) {
|
||||
case RS_FEED_TYPE_PEER:
|
||||
fi.mId1 = rsPeers->getOwnId();
|
||||
|
||||
instance->addFeedItemPeerConnect(fi);
|
||||
instance->addFeedItemPeerDisconnect(fi);
|
||||
instance->addFeedItemPeerNew(fi);
|
||||
instance->addFeedItemPeerHello(fi);
|
||||
break;
|
||||
|
||||
case RS_FEED_TYPE_SECURITY:
|
||||
fi.mId1 = rsPeers->getGPGOwnId();
|
||||
fi.mId2 = rsPeers->getOwnId();
|
||||
|
||||
instance->addFeedItemSecurityConnectAttempt(fi);
|
||||
instance->addFeedItemSecurityAuthDenied(fi);
|
||||
instance->addFeedItemSecurityUnknownIn(fi);
|
||||
instance->addFeedItemSecurityUnknownOut(fi);
|
||||
break;
|
||||
|
||||
case RS_FEED_TYPE_CHAN:
|
||||
{
|
||||
std::list<ChannelInfo> channelList;
|
||||
rsChannels->getChannelList(channelList);
|
||||
|
||||
std::list<ChannelInfo>::iterator channelIt;
|
||||
for (channelIt = channelList.begin(); channelIt != channelList.end(); ++channelIt) {
|
||||
if (fi.mId1.empty()) {
|
||||
/* store first channel */
|
||||
fi.mId1 = channelIt->channelId;
|
||||
}
|
||||
|
||||
if (!channelIt->channelDesc.empty()) {
|
||||
/* take channel with description */
|
||||
fi.mId1 = channelIt->channelId;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
instance->addFeedItemChanNew(fi);
|
||||
instance->addFeedItemChanUpdate(fi);
|
||||
|
||||
RsFeedItem fiMsg;
|
||||
bool bFound = false;
|
||||
|
||||
for (channelIt = channelList.begin(); channelIt != channelList.end(); ++channelIt) {
|
||||
std::list<ChannelMsgSummary> channelMsgs;
|
||||
rsChannels->getChannelMsgList(channelIt->channelId, channelMsgs);
|
||||
|
||||
std::list<ChannelMsgSummary>::iterator msgIt;
|
||||
for (msgIt = channelMsgs.begin(); msgIt != channelMsgs.end(); ++msgIt) {
|
||||
if (fiMsg.mId2.empty()) {
|
||||
/* store first channel message */
|
||||
fiMsg.mId1 = msgIt->channelId;
|
||||
fiMsg.mId2 = msgIt->msgId;
|
||||
}
|
||||
|
||||
if (!msgIt->msg.empty()) {
|
||||
/* take channel message with description */
|
||||
fiMsg.mId1 = msgIt->channelId;
|
||||
fiMsg.mId2 = msgIt->msgId;
|
||||
bFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (bFound) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
instance->addFeedItemChanMsg(fiMsg);
|
||||
break;
|
||||
}
|
||||
|
||||
case RS_FEED_TYPE_FORUM:
|
||||
{
|
||||
std::list<ForumInfo> forumList;
|
||||
rsForums->getForumList(forumList);
|
||||
|
||||
std::list<ForumInfo>::iterator forumIt;
|
||||
for (forumIt = forumList.begin(); forumIt != forumList.end(); ++forumIt) {
|
||||
if (fi.mId1.empty()) {
|
||||
/* store first forum */
|
||||
fi.mId1 = forumIt->forumId;
|
||||
}
|
||||
|
||||
if (!forumIt->forumDesc.empty()) {
|
||||
/* take forum with description */
|
||||
fi.mId1 = forumIt->forumId;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
instance->addFeedItemForumNew(fi);
|
||||
instance->addFeedItemForumUpdate(fi);
|
||||
|
||||
RsFeedItem fiMsg;
|
||||
bool bFound = false;
|
||||
|
||||
for (forumIt = forumList.begin(); forumIt != forumList.end(); ++forumIt) {
|
||||
std::list<ThreadInfoSummary> forumMsgs;
|
||||
rsForums->getForumThreadList(forumIt->forumId, forumMsgs);
|
||||
|
||||
std::list<ThreadInfoSummary>::iterator msgIt;
|
||||
for (msgIt = forumMsgs.begin(); msgIt != forumMsgs.end(); ++msgIt) {
|
||||
if (fiMsg.mId2.empty()) {
|
||||
/* store first forum message */
|
||||
fiMsg.mId1 = msgIt->forumId;
|
||||
fiMsg.mId2 = msgIt->msgId;
|
||||
}
|
||||
|
||||
if (!msgIt->msg.empty()) {
|
||||
/* take channel message with description */
|
||||
fiMsg.mId1 = msgIt->forumId;
|
||||
fiMsg.mId2 = msgIt->msgId;
|
||||
bFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (bFound) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
instance->addFeedItemForumMsg(fiMsg);
|
||||
break;
|
||||
}
|
||||
|
||||
case RS_FEED_TYPE_BLOG:
|
||||
// not used
|
||||
// instance->addFeedItemBlogNew(fi);
|
||||
// instance->addFeedItemBlogMsg(fi);
|
||||
break;
|
||||
|
||||
case RS_FEED_TYPE_CHAT:
|
||||
fi.mId1 = rsPeers->getOwnId();
|
||||
fi.mId2 = tr("This is a test.").toUtf8().constData();
|
||||
|
||||
instance->addFeedItemChatNew(fi, true);
|
||||
break;
|
||||
|
||||
case RS_FEED_TYPE_MSG:
|
||||
{
|
||||
std::list<MsgInfoSummary> msgList;
|
||||
rsMsgs->getMessageSummaries(msgList);
|
||||
|
||||
std::list<MsgInfoSummary>::const_iterator msgIt;
|
||||
for (msgIt = msgList.begin(); msgIt != msgList.end(); ++msgIt) {
|
||||
if (fi.mId1.empty()) {
|
||||
/* store first message */
|
||||
fi.mId1 = msgIt->msgId;
|
||||
}
|
||||
|
||||
if (msgIt->msgflags & RS_MSG_TRASH) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((msgIt->msgflags & RS_MSG_BOXMASK) == RS_MSG_INBOX) {
|
||||
/* take message from inbox */
|
||||
fi.mId1 = msgIt->msgId;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
instance->addFeedItemMessage(fi);
|
||||
break;
|
||||
}
|
||||
|
||||
case RS_FEED_TYPE_FILES:
|
||||
// not used
|
||||
// instance->addFeedItemFilesNew(fi);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NewsFeed::addFeedItem(QWidget *item)
|
||||
{
|
||||
item->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
@ -485,14 +696,14 @@ void NewsFeed::addFeedItemBlogMsg(RsFeedItem &fi)
|
||||
#endif
|
||||
}
|
||||
|
||||
void NewsFeed::addFeedItemChatNew(RsFeedItem &fi)
|
||||
void NewsFeed::addFeedItemChatNew(RsFeedItem &fi, bool addWithoutCheck)
|
||||
{
|
||||
#ifdef NEWS_DEBUG
|
||||
std::cerr << "NewsFeed::addFeedItemChatNew()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
if (fi.mId1 == rsPeers->getOwnId()) {
|
||||
if (!addWithoutCheck && fi.mId1 == rsPeers->getOwnId()) {
|
||||
/* chat message from myself */
|
||||
return;
|
||||
}
|
||||
|
@ -40,11 +40,14 @@ public:
|
||||
/** Default Constructor */
|
||||
NewsFeed(QWidget *parent = 0);
|
||||
/** Default Destructor */
|
||||
virtual ~NewsFeed();
|
||||
|
||||
/* FeedHolder Functions (for FeedItem functionality) */
|
||||
virtual void deleteFeedItem(QWidget *item, uint32_t type);
|
||||
virtual void openChat(std::string peerId);
|
||||
|
||||
static void testFeeds(uint notifyFlags);
|
||||
|
||||
signals:
|
||||
void newsFeedChanged(int count);
|
||||
|
||||
@ -78,7 +81,7 @@ private:
|
||||
void addFeedItemForumMsg(RsFeedItem &fi);
|
||||
void addFeedItemBlogNew(RsFeedItem &fi);
|
||||
void addFeedItemBlogMsg(RsFeedItem &fi);
|
||||
void addFeedItemChatNew(RsFeedItem &fi);
|
||||
void addFeedItemChatNew(RsFeedItem &fi, bool addWithoutCheck);
|
||||
void addFeedItemMessage(RsFeedItem &fi);
|
||||
void addFeedItemFilesNew(RsFeedItem &fi);
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "notifyqt.h"
|
||||
#include <retroshare/rsnotify.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
|
||||
#include "RsAutoUpdatePage.h"
|
||||
|
||||
@ -56,6 +57,11 @@ public:
|
||||
{
|
||||
this->widget = widget;
|
||||
|
||||
/* Values from settings */
|
||||
position = Settings->getToasterPosition();
|
||||
Settings->getToasterMargin();
|
||||
|
||||
|
||||
/* Standard values */
|
||||
timeToShow = 500;
|
||||
timeToLive = 3000;
|
||||
@ -70,6 +76,10 @@ public:
|
||||
public:
|
||||
QWidget *widget;
|
||||
|
||||
/* Values from settings */
|
||||
RshareSettings::enumToasterPosition position;
|
||||
QPoint margin;
|
||||
|
||||
/* Standard values */
|
||||
int timeToShow;
|
||||
int timeToLive;
|
||||
@ -725,6 +735,60 @@ void NotifyQt::UpdateGUI()
|
||||
startWaitingToasters();
|
||||
}
|
||||
|
||||
void NotifyQt::testToaster(uint notifyFlags, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin)
|
||||
{
|
||||
QString title = tr("Test");
|
||||
QString message = tr("This is a test.");
|
||||
|
||||
std::string id = rsPeers->getOwnId();
|
||||
|
||||
uint pos = 0;
|
||||
|
||||
while (notifyFlags) {
|
||||
uint type = notifyFlags & (1 << pos);
|
||||
notifyFlags &= ~(1 << pos);
|
||||
++pos;
|
||||
|
||||
Toaster *toaster = NULL;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case RS_POPUP_MSG:
|
||||
toaster = new Toaster(new MessageToaster(id, title, message));
|
||||
break;
|
||||
case RS_POPUP_CONNECT:
|
||||
toaster = new Toaster(new OnlineToaster(id));
|
||||
break;
|
||||
case RS_POPUP_DOWNLOAD:
|
||||
toaster = new Toaster(new DownloadToaster(id, title));
|
||||
break;
|
||||
case RS_POPUP_CHAT:
|
||||
toaster = new Toaster(new ChatToaster(id, message));
|
||||
break;
|
||||
case RS_POPUP_GROUPCHAT:
|
||||
toaster = new Toaster(new GroupChatToaster(id, message));
|
||||
break;
|
||||
case RS_POPUP_CHATLOBBY:
|
||||
toaster = new Toaster(new ChatLobbyToaster(id, title, message));
|
||||
break;
|
||||
case RS_POPUP_CONNECT_ATTEMPT:
|
||||
toaster = new Toaster(new FriendRequestToaster(id, title, id));
|
||||
break;
|
||||
}
|
||||
|
||||
if (toaster) {
|
||||
/* init attributes */
|
||||
toaster->widget->setWindowFlags(Qt::ToolTip | Qt::WindowStaysOnTopHint);
|
||||
toaster->position = (RshareSettings::enumToasterPosition) position;
|
||||
toaster->margin = margin;
|
||||
|
||||
/* add toaster to waiting list */
|
||||
// QMutexLocker lock(&waitingToasterMutex);
|
||||
waitingToasterList.push_back(toaster);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NotifyQt::notifyChatStyleChanged(int /*ChatStyle::enumStyleType*/ styleType)
|
||||
{
|
||||
{
|
||||
@ -777,26 +841,23 @@ void NotifyQt::startWaitingToasters()
|
||||
QDesktopWidget *desktop = QApplication::desktop();
|
||||
QRect desktopGeometry = desktop->availableGeometry(desktop->primaryScreen());
|
||||
|
||||
RshareSettings::enumToasterPosition position = Settings->getToasterPosition();
|
||||
QPoint margin = Settings->getToasterMargin();
|
||||
|
||||
switch (position) {
|
||||
switch (toaster->position) {
|
||||
case RshareSettings::TOASTERPOS_TOPLEFT:
|
||||
toaster->startPos = QPoint(desktopGeometry.left() + margin.x(), desktopGeometry.top() - size.height());
|
||||
toaster->endPos = QPoint(toaster->startPos.x(), desktopGeometry.top() + margin.y());
|
||||
toaster->startPos = QPoint(desktopGeometry.left() + toaster->margin.x(), desktopGeometry.top() - size.height());
|
||||
toaster->endPos = QPoint(toaster->startPos.x(), desktopGeometry.top() + toaster->margin.y());
|
||||
break;
|
||||
case RshareSettings::TOASTERPOS_TOPRIGHT:
|
||||
toaster->startPos = QPoint(desktopGeometry.right() - size.width() - margin.x(), desktopGeometry.top() - size.height());
|
||||
toaster->endPos = QPoint(toaster->startPos.x(), desktopGeometry.top() + margin.y());
|
||||
toaster->startPos = QPoint(desktopGeometry.right() - size.width() - toaster->margin.x(), desktopGeometry.top() - size.height());
|
||||
toaster->endPos = QPoint(toaster->startPos.x(), desktopGeometry.top() + toaster->margin.y());
|
||||
break;
|
||||
case RshareSettings::TOASTERPOS_BOTTOMLEFT:
|
||||
toaster->startPos = QPoint(desktopGeometry.left() + margin.x(), desktopGeometry.bottom());
|
||||
toaster->endPos = QPoint(toaster->startPos.x(), desktopGeometry.bottom() - size.height() - margin.y());
|
||||
toaster->startPos = QPoint(desktopGeometry.left() + toaster->margin.x(), desktopGeometry.bottom());
|
||||
toaster->endPos = QPoint(toaster->startPos.x(), desktopGeometry.bottom() - size.height() - toaster->margin.y());
|
||||
break;
|
||||
case RshareSettings::TOASTERPOS_BOTTOMRIGHT: // default
|
||||
default:
|
||||
toaster->startPos = QPoint(desktopGeometry.right() - size.width() - margin.x(), desktopGeometry.bottom());
|
||||
toaster->endPos = QPoint(toaster->startPos.x(), desktopGeometry.bottom() - size.height() - margin.y());
|
||||
toaster->startPos = QPoint(desktopGeometry.right() - size.width() - toaster->margin.x(), desktopGeometry.bottom());
|
||||
toaster->endPos = QPoint(toaster->startPos.x(), desktopGeometry.bottom() - size.height() - toaster->margin.y());
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <retroshare/rsturtle.h>
|
||||
#include <QObject>
|
||||
#include <QMutex>
|
||||
#include <QPoint>
|
||||
//#include <QMutex>
|
||||
|
||||
#include <string>
|
||||
@ -62,6 +63,8 @@ class NotifyQt: public QObject, public NotifyBase
|
||||
/* Notify from GUI */
|
||||
void notifyChatStyleChanged(int /*ChatStyle::enumStyleType*/ styleType);
|
||||
|
||||
void testToaster(uint notifyFlags, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin);
|
||||
|
||||
signals:
|
||||
// It's beneficial to send info to the GUI using signals, because signals are thread-safe
|
||||
// as they get queued by Qt.
|
||||
|
@ -28,6 +28,8 @@
|
||||
|
||||
#include "gui/MainWindow.h"
|
||||
#include "gui/common/UserNotify.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/NewsFeed.h"
|
||||
|
||||
/** Constructor */
|
||||
NotifyPage::NotifyPage(QWidget * parent, Qt::WFlags flags)
|
||||
@ -36,6 +38,9 @@ NotifyPage::NotifyPage(QWidget * parent, Qt::WFlags flags)
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
connect(ui.notifyButton, SIGNAL(clicked()), this, SLOT(testNotify()));
|
||||
connect(ui.toasterButton, SIGNAL(clicked()), this, SLOT(testToaster()));
|
||||
|
||||
/* add user notify */
|
||||
QFont font = ui.notify_Peers->font(); // use font from existing checkbox
|
||||
const QList<UserNotify*> &userNotifyList = MainWindow::getInstance()->getUserNotifyList();
|
||||
@ -71,49 +76,59 @@ NotifyPage::~NotifyPage()
|
||||
{
|
||||
}
|
||||
|
||||
uint NotifyPage::getNewsFlags()
|
||||
{
|
||||
uint newsFlags = 0;
|
||||
|
||||
if (ui.notify_Peers->isChecked())
|
||||
newsFlags |= RS_FEED_TYPE_PEER;
|
||||
if (ui.notify_Channels->isChecked())
|
||||
newsFlags |= RS_FEED_TYPE_CHAN;
|
||||
if (ui.notify_Forums->isChecked())
|
||||
newsFlags |= RS_FEED_TYPE_FORUM;
|
||||
if (ui.notify_Blogs->isChecked())
|
||||
newsFlags |= RS_FEED_TYPE_BLOG;
|
||||
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;
|
||||
|
||||
return newsFlags;
|
||||
}
|
||||
|
||||
uint NotifyPage::getNotifyFlags()
|
||||
{
|
||||
uint notifyFlags = 0;
|
||||
|
||||
if (ui.popup_Connect->isChecked())
|
||||
notifyFlags |= RS_POPUP_CONNECT;
|
||||
if (ui.popup_NewMsg->isChecked())
|
||||
notifyFlags |= RS_POPUP_MSG;
|
||||
if (ui.popup_DownloadFinished->isChecked())
|
||||
notifyFlags |= RS_POPUP_DOWNLOAD;
|
||||
if (ui.popup_PrivateChat->isChecked())
|
||||
notifyFlags |= RS_POPUP_CHAT;
|
||||
if (ui.popup_GroupChat->isChecked())
|
||||
notifyFlags |= RS_POPUP_GROUPCHAT;
|
||||
if (ui.popup_ChatLobby->isChecked())
|
||||
notifyFlags |= RS_POPUP_CHATLOBBY;
|
||||
if (ui.popup_ConnectAttempt->isChecked())
|
||||
notifyFlags |= RS_POPUP_CONNECT_ATTEMPT;
|
||||
|
||||
return notifyFlags;
|
||||
}
|
||||
|
||||
/** Saves the changes on this page */
|
||||
bool
|
||||
NotifyPage::save(QString &/*errmsg*/)
|
||||
{
|
||||
/* extract from rsNotify the flags */
|
||||
|
||||
uint notifyflags = 0;
|
||||
uint newsflags = 0;
|
||||
uint chatflags = 0;
|
||||
uint messageflags = 0;
|
||||
|
||||
if (ui.popup_Connect->isChecked())
|
||||
notifyflags |= RS_POPUP_CONNECT;
|
||||
if (ui.popup_NewMsg->isChecked())
|
||||
notifyflags |= RS_POPUP_MSG;
|
||||
if (ui.popup_DownloadFinished->isChecked())
|
||||
notifyflags |= RS_POPUP_DOWNLOAD;
|
||||
if (ui.popup_PrivateChat->isChecked())
|
||||
notifyflags |= RS_POPUP_CHAT;
|
||||
if (ui.popup_GroupChat->isChecked())
|
||||
notifyflags |= RS_POPUP_GROUPCHAT;
|
||||
if (ui.popup_ChatLobby->isChecked())
|
||||
notifyflags |= RS_POPUP_CHATLOBBY;
|
||||
if (ui.popup_ConnectAttempt->isChecked())
|
||||
notifyflags |= RS_POPUP_CONNECT_ATTEMPT;
|
||||
|
||||
if (ui.notify_Peers->isChecked())
|
||||
newsflags |= RS_FEED_TYPE_PEER;
|
||||
if (ui.notify_Channels->isChecked())
|
||||
newsflags |= RS_FEED_TYPE_CHAN;
|
||||
if (ui.notify_Forums->isChecked())
|
||||
newsflags |= RS_FEED_TYPE_FORUM;
|
||||
if (ui.notify_Blogs->isChecked())
|
||||
newsflags |= RS_FEED_TYPE_BLOG;
|
||||
if (ui.notify_Chat->isChecked())
|
||||
newsflags |= RS_FEED_TYPE_CHAT;
|
||||
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;
|
||||
|
||||
if (ui.chat_NewWindow->isChecked())
|
||||
chatflags |= RS_CHAT_OPEN;
|
||||
if (ui.chat_Focus->isChecked())
|
||||
@ -130,8 +145,8 @@ NotifyPage::save(QString &/*errmsg*/)
|
||||
notifyIt->mUserNotify->setNotifyEnabled(notifyIt->mEnabledCheckBox->isChecked(), notifyIt->mCombinedCheckBox->isChecked());
|
||||
}
|
||||
|
||||
Settings->setNotifyFlags(notifyflags);
|
||||
Settings->setNewsFeedFlags(newsflags);
|
||||
Settings->setNotifyFlags(getNotifyFlags());
|
||||
Settings->setNewsFeedFlags(getNewsFlags());
|
||||
Settings->setChatFlags(chatflags);
|
||||
Settings->setMessageFlags(messageflags);
|
||||
|
||||
@ -235,3 +250,13 @@ void NotifyPage::notifyToggled()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NotifyPage::testNotify()
|
||||
{
|
||||
NewsFeed::testFeeds(getNewsFlags());
|
||||
}
|
||||
|
||||
void NotifyPage::testToaster()
|
||||
{
|
||||
NotifyQt::getInstance()->testToaster(getNotifyFlags(), (RshareSettings::enumToasterPosition) ui.comboBoxToasterPosition->itemData(ui.comboBoxToasterPosition->currentIndex()).toInt(), QPoint(ui.spinBoxToasterXMargin->value(), ui.spinBoxToasterYMargin->value()));
|
||||
}
|
||||
|
@ -59,8 +59,13 @@ public:
|
||||
|
||||
private slots:
|
||||
void notifyToggled();
|
||||
void testToaster();
|
||||
void testNotify();
|
||||
|
||||
private:
|
||||
uint getNewsFlags();
|
||||
uint getNotifyFlags();
|
||||
|
||||
QList<UserNotifySetting> mUserNotifySettingList;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
|
@ -18,13 +18,15 @@
|
||||
<property name="title">
|
||||
<string>News Feed</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="notify_Peers">
|
||||
<property name="text">
|
||||
@ -89,6 +91,32 @@
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<widget class="QPushButton" name="notifyButton">
|
||||
<property name="text">
|
||||
<string>Test</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -148,6 +176,10 @@
|
||||
<property name="topMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="popup_Connect">
|
||||
<property name="text">
|
||||
@ -197,6 +229,34 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<item>
|
||||
<widget class="QPushButton" name="toasterButton">
|
||||
<property name="text">
|
||||
<string>Test</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
|
Loading…
Reference in New Issue
Block a user