2008-06-20 08:43:23 -04:00
|
|
|
/****************************************************************
|
|
|
|
* RetroShare is distributed under the following license:
|
|
|
|
*
|
|
|
|
* Copyright (C) 2008 Robert Fernie
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
****************************************************************/
|
|
|
|
|
|
|
|
#ifndef _NEWS_FEED_DIALOG_H
|
|
|
|
#define _NEWS_FEED_DIALOG_H
|
|
|
|
|
|
|
|
#include "mainpage.h"
|
|
|
|
|
|
|
|
#include "gui/feeds/FeedHolder.h"
|
2014-11-17 19:49:21 -05:00
|
|
|
#include "util/TokenQueue.h"
|
2013-04-21 18:20:11 -04:00
|
|
|
#include <retroshare-gui/RsAutoUpdatePage.h>
|
2014-05-09 22:38:47 -04:00
|
|
|
|
2014-11-15 12:24:49 -05:00
|
|
|
#define IMAGE_NEWSFEED ":/images/newsfeed/news-feed-32.png"
|
2014-05-09 22:38:47 -04:00
|
|
|
|
2014-11-15 12:24:49 -05:00
|
|
|
namespace Ui {
|
|
|
|
class NewsFeed;
|
|
|
|
}
|
2008-06-20 08:43:23 -04:00
|
|
|
|
2014-11-15 12:24:49 -05:00
|
|
|
class RsFeedItem;
|
2013-01-14 17:41:31 -05:00
|
|
|
class FeedNotify;
|
2014-11-15 12:24:49 -05:00
|
|
|
class FeedItem;
|
2008-06-20 08:43:23 -04:00
|
|
|
|
2014-11-17 19:49:21 -05:00
|
|
|
class NewsFeed : public RsAutoUpdatePage, public FeedHolder, public TokenResponse
|
2008-06-20 08:43:23 -04:00
|
|
|
{
|
2014-11-13 17:03:12 -05:00
|
|
|
Q_OBJECT
|
2008-06-20 08:43:23 -04:00
|
|
|
|
|
|
|
public:
|
2014-11-13 17:03:12 -05:00
|
|
|
/** Default Constructor */
|
|
|
|
NewsFeed(QWidget *parent = 0);
|
|
|
|
/** Default Destructor */
|
|
|
|
virtual ~NewsFeed();
|
2008-06-20 08:43:23 -04:00
|
|
|
|
2014-11-13 17:03:12 -05:00
|
|
|
virtual QIcon iconPixmap() const { return QIcon(IMAGE_NEWSFEED) ; } //MainPage
|
|
|
|
virtual QString pageName() const { return tr("News feed") ; } //MainPage
|
|
|
|
virtual QString helpText() const { return ""; } //MainPage
|
2014-05-09 22:38:47 -04:00
|
|
|
|
2014-11-13 17:03:12 -05:00
|
|
|
virtual UserNotify *getUserNotify(QObject *parent);
|
2013-06-21 20:05:02 -04:00
|
|
|
|
2014-11-13 17:03:12 -05:00
|
|
|
/* FeedHolder Functions (for FeedItem functionality) */
|
|
|
|
virtual QScrollArea *getScrollArea();
|
|
|
|
virtual void deleteFeedItem(QWidget *item, uint32_t type);
|
|
|
|
virtual void openChat(const RsPeerId& peerId);
|
|
|
|
virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title);
|
2008-06-20 08:43:23 -04:00
|
|
|
|
2014-11-13 17:03:12 -05:00
|
|
|
static void testFeeds(uint notifyFlags);
|
|
|
|
static void testFeed(FeedNotify *feedNotify);
|
|
|
|
|
|
|
|
virtual void updateDisplay();
|
2012-09-04 16:04:49 -04:00
|
|
|
|
2010-11-10 07:24:36 -05:00
|
|
|
signals:
|
2014-11-13 17:03:12 -05:00
|
|
|
void newsFeedChanged(int count);
|
2010-11-10 07:24:36 -05:00
|
|
|
|
2014-11-17 19:49:21 -05:00
|
|
|
protected:
|
2015-01-20 13:06:56 -05:00
|
|
|
void processSettings(bool load);
|
|
|
|
|
2014-11-17 19:49:21 -05:00
|
|
|
/* TokenResponse */
|
|
|
|
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
|
|
|
|
2008-06-20 08:43:23 -04:00
|
|
|
private slots:
|
2014-11-13 17:03:12 -05:00
|
|
|
// void toggleChanMsgItems(bool on);
|
|
|
|
void feedoptions();
|
2015-01-20 13:06:56 -05:00
|
|
|
void sortChanged(int index);
|
2011-07-11 11:53:41 -04:00
|
|
|
|
2014-11-15 12:24:49 -05:00
|
|
|
void sendNewsFeedChanged();
|
2011-07-10 21:08:01 -04:00
|
|
|
|
2014-11-13 17:03:12 -05:00
|
|
|
private:
|
2014-11-15 12:24:49 -05:00
|
|
|
void addFeedItem(FeedItem *item);
|
|
|
|
void addFeedItemIfUnique(FeedItem *item, int itemType, const RsPeerId &sslId, bool replace);
|
|
|
|
|
|
|
|
void addFeedItemPeerConnect(const RsFeedItem &fi);
|
|
|
|
void addFeedItemPeerDisconnect(const RsFeedItem &fi);
|
|
|
|
void addFeedItemPeerNew(const RsFeedItem &fi);
|
|
|
|
void addFeedItemPeerHello(const RsFeedItem &fi);
|
|
|
|
|
|
|
|
void addFeedItemSecurityConnectAttempt(const RsFeedItem &fi);
|
|
|
|
void addFeedItemSecurityAuthDenied(const RsFeedItem &fi);
|
|
|
|
void addFeedItemSecurityUnknownIn(const RsFeedItem &fi);
|
|
|
|
void addFeedItemSecurityUnknownOut(const RsFeedItem &fi);
|
2015-06-02 17:36:26 -04:00
|
|
|
void addFeedItemSecurityIpBlacklisted(const RsFeedItem &fi, bool isTest);
|
2014-11-15 12:24:49 -05:00
|
|
|
|
|
|
|
void addFeedItemChannelNew(const RsFeedItem &fi);
|
|
|
|
// void addFeedItemChannelUpdate(const RsFeedItem &fi);
|
|
|
|
void addFeedItemChannelMsg(const RsFeedItem &fi);
|
2014-11-20 19:50:18 -05:00
|
|
|
|
2014-11-15 12:24:49 -05:00
|
|
|
void addFeedItemForumNew(const RsFeedItem &fi);
|
|
|
|
// void addFeedItemForumUpdate(const RsFeedItem &fi);
|
|
|
|
void addFeedItemForumMsg(const RsFeedItem &fi);
|
2014-11-20 19:50:18 -05:00
|
|
|
|
|
|
|
void addFeedItemPostedNew(const RsFeedItem &fi);
|
|
|
|
// void addFeedItemPostedUpdate(const RsFeedItem &fi);
|
|
|
|
void addFeedItemPostedMsg(const RsFeedItem &fi);
|
|
|
|
|
2013-09-07 00:21:48 -04:00
|
|
|
#if 0
|
2014-11-15 12:24:49 -05:00
|
|
|
void addFeedItemBlogNew(const RsFeedItem &fi);
|
|
|
|
void addFeedItemBlogMsg(const RsFeedItem &fi);
|
2013-09-07 00:21:48 -04:00
|
|
|
#endif
|
|
|
|
|
2014-11-15 12:24:49 -05:00
|
|
|
void addFeedItemChatNew(const RsFeedItem &fi, bool addWithoutCheck);
|
|
|
|
void addFeedItemMessage(const RsFeedItem &fi);
|
|
|
|
void addFeedItemFilesNew(const RsFeedItem &fi);
|
2008-06-20 08:43:23 -04:00
|
|
|
|
2014-11-17 19:49:21 -05:00
|
|
|
virtual void loadChannelGroup(const uint32_t &token);
|
|
|
|
virtual void loadChannelPost(const uint32_t &token);
|
2015-02-07 20:01:48 -05:00
|
|
|
virtual void loadChannelPublishKey(const uint32_t &token);
|
2014-11-17 19:49:21 -05:00
|
|
|
|
|
|
|
virtual void loadForumGroup(const uint32_t &token);
|
|
|
|
virtual void loadForumMessage(const uint32_t &token);
|
2015-02-07 20:01:48 -05:00
|
|
|
virtual void loadForumPublishKey(const uint32_t &token);
|
2014-11-17 19:49:21 -05:00
|
|
|
|
2014-11-20 19:50:18 -05:00
|
|
|
virtual void loadPostedGroup(const uint32_t &token);
|
|
|
|
virtual void loadPostedMessage(const uint32_t &token);
|
|
|
|
|
2014-11-15 12:24:49 -05:00
|
|
|
private:
|
2014-11-17 19:49:21 -05:00
|
|
|
TokenQueue *mTokenQueueChannel;
|
|
|
|
TokenQueue *mTokenQueueForum;
|
2014-11-20 19:50:18 -05:00
|
|
|
TokenQueue *mTokenQueuePosted;
|
2014-11-17 19:49:21 -05:00
|
|
|
|
2014-11-15 12:24:49 -05:00
|
|
|
/* UI - from Designer */
|
|
|
|
Ui::NewsFeed *ui;
|
2008-06-20 08:43:23 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|