2012-07-01 19:05:03 -04:00
|
|
|
/*
|
|
|
|
* Retroshare Posted List
|
|
|
|
*
|
|
|
|
* Copyright 2012-2012 by Robert Fernie.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License Version 2.1 as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This library 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
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
* USA.
|
|
|
|
*
|
|
|
|
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MRK_POSTED_LIST_DIALOG_H
|
|
|
|
#define MRK_POSTED_LIST_DIALOG_H
|
|
|
|
|
2012-07-27 11:41:52 -04:00
|
|
|
#include "retroshare-gui/mainpage.h"
|
2012-07-01 19:05:03 -04:00
|
|
|
#include "ui_PostedListDialog.h"
|
|
|
|
|
2012-10-21 15:45:35 -04:00
|
|
|
#include <retroshare/rsposted.h>
|
2012-07-01 19:05:03 -04:00
|
|
|
|
2012-10-21 15:45:35 -04:00
|
|
|
#include "util/TokenQueue.h"
|
2013-07-15 14:39:39 -04:00
|
|
|
#include "gui/gxs/RsGxsUpdateBroadcastPage.h"
|
2012-07-01 19:05:03 -04:00
|
|
|
|
2013-03-11 16:53:15 -04:00
|
|
|
#include "gui/gxs/GxsCommentContainer.h"
|
2013-07-15 14:39:39 -04:00
|
|
|
#include "gui/feeds/FeedHolder.h"
|
2012-11-22 17:40:31 -05:00
|
|
|
|
2014-05-09 22:38:47 -04:00
|
|
|
#define IMAGE_POSTED ":/images/posted_32.png"
|
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
class PostedItem;
|
2012-11-22 17:40:31 -05:00
|
|
|
|
2012-10-29 18:41:41 -04:00
|
|
|
/*********************** **** **** **** ***********************/
|
|
|
|
/** Request / Response of Data ********************************/
|
|
|
|
/*********************** **** **** **** ***********************/
|
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
#define POSTEDDIALOG_LISTING 1
|
|
|
|
#define POSTEDDIALOG_CURRENTFORUM 2
|
|
|
|
#define POSTEDDIALOG_INSERTTHREADS 3
|
|
|
|
#define POSTEDDIALOG_INSERTCHILD 4
|
|
|
|
#define POSTEDDIALOG_INSERT_POST 5
|
|
|
|
#define POSTEDDIALOG_REPLY_MESSAGE 6
|
2012-10-29 18:41:41 -04:00
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
class PostedListDialog : public RsGxsUpdateBroadcastPage, public FeedHolder, public TokenResponse, public GxsServiceDialog
|
2012-07-01 19:05:03 -04:00
|
|
|
{
|
2013-07-15 14:39:39 -04:00
|
|
|
Q_OBJECT
|
2012-07-01 19:05:03 -04:00
|
|
|
|
|
|
|
public:
|
2013-07-15 14:39:39 -04:00
|
|
|
PostedListDialog(QWidget *parent = 0);
|
2014-05-09 22:38:47 -04:00
|
|
|
|
|
|
|
virtual QIcon iconPixmap() const { return QIcon(IMAGE_POSTED) ; } //MainPage
|
|
|
|
virtual QString pageName() const { return tr("Posted Links") ; } //MainPage
|
|
|
|
virtual QString helpText() const { return ""; } //MainPage
|
|
|
|
|
2012-07-01 19:05:03 -04:00
|
|
|
|
2013-03-15 17:02:43 -04:00
|
|
|
// Overloaded from FeedHolder.
|
|
|
|
virtual QScrollArea *getScrollArea();
|
|
|
|
virtual void deleteFeedItem(QWidget *item, uint32_t type);
|
2014-03-17 16:56:06 -04:00
|
|
|
virtual void openChat(const RsPeerId& peerId);
|
2013-03-15 17:02:43 -04:00
|
|
|
virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title);
|
2012-07-01 19:05:03 -04:00
|
|
|
|
|
|
|
private slots:
|
2013-07-15 14:39:39 -04:00
|
|
|
void groupListCustomPopupMenu(QPoint point);
|
|
|
|
void changedTopic(const QString &id);
|
2012-07-01 19:05:03 -04:00
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
void newTopic();
|
2014-02-09 05:43:59 -05:00
|
|
|
void showTopic();
|
|
|
|
void editTopic();
|
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
void showGroupDetails();
|
|
|
|
void newPost();
|
2012-12-05 17:45:44 -05:00
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
void submitVote(const RsGxsGrpMsgIdPair& msgId, bool up);
|
2012-07-30 19:55:21 -04:00
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
void getRankings();
|
2012-12-11 17:26:11 -05:00
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
void subscribeTopic();
|
|
|
|
void unsubscribeTopic();
|
2013-03-24 12:29:08 -04:00
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
void showNext();
|
|
|
|
void showPrev();
|
2014-01-10 13:41:08 -05:00
|
|
|
|
|
|
|
void todo();
|
2013-06-04 17:00:43 -04:00
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
protected:
|
2013-07-19 05:48:51 -04:00
|
|
|
virtual void updateDisplay(bool complete);
|
2013-06-04 17:00:43 -04:00
|
|
|
|
2012-07-01 19:05:03 -04:00
|
|
|
private:
|
2013-07-15 14:39:39 -04:00
|
|
|
void updateShowText();
|
2012-07-01 19:05:03 -04:00
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
void clearPosts();
|
2012-07-01 19:05:03 -04:00
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
/*!
|
|
|
|
* Only removes it from layout
|
|
|
|
*/
|
|
|
|
void shallowClearPosts();
|
2012-07-01 19:05:03 -04:00
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
void loadPost(const RsPostedPost &post);
|
2012-07-01 19:05:03 -04:00
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
void insertGroups();
|
|
|
|
void requestGroupSummary();
|
|
|
|
void acknowledgeGroup(const uint32_t &token);
|
|
|
|
void loadGroupSummary(const uint32_t &token);
|
2012-07-01 19:05:03 -04:00
|
|
|
|
2014-03-17 16:56:06 -04:00
|
|
|
void requestGroupSummary_CurrentForum(const RsGxsGroupId &forumId);
|
2013-07-15 14:39:39 -04:00
|
|
|
void loadGroupSummary_CurrentForum(const uint32_t &token);
|
2013-03-24 12:29:08 -04:00
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
// subscribe/unsubscribe ack.
|
|
|
|
void acknowledgeSubscribeChange(const uint32_t &token);
|
2012-07-01 19:05:03 -04:00
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
// posts
|
|
|
|
void acknowledgePostMsg(const uint32_t &token);
|
|
|
|
void loadPostData(const uint32_t &token);
|
|
|
|
void insertThreads();
|
2014-03-17 16:56:06 -04:00
|
|
|
void loadCurrentTopicThreads(const RsGxsGroupId &forumId);
|
|
|
|
void requestGroupThreadData_InsertThreads(const RsGxsGroupId &forumId);
|
2013-07-15 14:39:39 -04:00
|
|
|
void loadGroupThreadData_InsertThreads(const uint32_t &token);
|
2012-12-05 17:45:44 -05:00
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
// votes
|
|
|
|
void acknowledgeVoteMsg(const uint32_t& token);
|
|
|
|
void loadVoteData(const uint32_t &token);
|
2012-12-05 17:45:44 -05:00
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
// ranking
|
|
|
|
//void loadRankings(const uint32_t& token);
|
|
|
|
//void applyRanking(const PostedRanking& ranks);
|
|
|
|
void applyRanking();
|
2012-12-11 17:26:11 -05:00
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
// update displayed item
|
|
|
|
void updateDisplayedItems(const std::vector<RsGxsMessageId>& msgIds);
|
|
|
|
void updateCurrentDisplayComplete(const uint32_t& token);
|
2012-12-11 17:26:11 -05:00
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
void insertGroupData(const std::list<RsGroupMetaData> &groupList);
|
|
|
|
void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo);
|
2012-12-05 17:45:44 -05:00
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
2014-01-08 21:05:20 -05:00
|
|
|
|
2012-07-01 19:05:03 -04:00
|
|
|
|
2012-11-17 16:43:21 -05:00
|
|
|
private:
|
2013-07-15 14:39:39 -04:00
|
|
|
QTreeWidgetItem *yourTopics;
|
|
|
|
QTreeWidgetItem *subscribedTopics;
|
|
|
|
QTreeWidgetItem *popularTopics;
|
|
|
|
QTreeWidgetItem *otherTopics;
|
2012-11-17 16:43:21 -05:00
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
int mSortMethod;
|
|
|
|
int mLastSortMethod;
|
|
|
|
int mPostIndex;
|
|
|
|
int mPostShow;
|
2013-06-04 17:00:43 -04:00
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
bool mThreadLoading;
|
|
|
|
RsGxsGroupId mCurrTopicId;
|
2013-06-04 17:00:43 -04:00
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
QMap<RsGxsGroupId, RsPostedGroup> mGroups;
|
|
|
|
QMap<RsGxsMessageId, PostedItem*> mPosts;
|
|
|
|
std::list<PostedItem *> mPostList;
|
2012-07-01 19:05:03 -04:00
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
TokenQueue *mPostedQueue;
|
2012-11-22 17:40:31 -05:00
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
//CommentHolder* mCommentHolder;
|
2012-07-01 19:05:03 -04:00
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
/* UI - from Designer */
|
|
|
|
Ui::PostedListDialog ui;
|
2012-07-01 19:05:03 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|