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".
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2014-07-22 11:04:36 -04:00
|
|
|
#ifndef POSTED_LIST_WIDGET_H
|
|
|
|
#define POSTED_LIST_WIDGET_H
|
2012-07-01 19:05:03 -04:00
|
|
|
|
2014-07-22 11:04:36 -04:00
|
|
|
#include <QMap>
|
2012-07-01 19:05:03 -04:00
|
|
|
|
2014-07-23 14:51:56 -04:00
|
|
|
#include "gui/gxs/GxsMessageFramePostWidget.h"
|
2013-07-15 14:39:39 -04:00
|
|
|
#include "gui/feeds/FeedHolder.h"
|
2012-11-22 17:40:31 -05:00
|
|
|
|
2014-07-22 11:04:36 -04:00
|
|
|
class RsPostedGroup;
|
|
|
|
class RsPostedPost;
|
2013-07-15 14:39:39 -04:00
|
|
|
class PostedItem;
|
2012-11-22 17:40:31 -05:00
|
|
|
|
2014-07-22 11:04:36 -04:00
|
|
|
namespace Ui {
|
|
|
|
class PostedListWidget;
|
|
|
|
}
|
2012-10-29 18:41:41 -04:00
|
|
|
|
2014-07-23 14:51:56 -04:00
|
|
|
class PostedListWidget : public GxsMessageFramePostWidget, public FeedHolder
|
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:
|
2014-07-22 11:04:36 -04:00
|
|
|
PostedListWidget(const RsGxsGroupId &postedId, QWidget *parent = 0);
|
|
|
|
~PostedListWidget();
|
|
|
|
|
|
|
|
/* GxsMessageFrameWidget */
|
|
|
|
virtual QIcon groupIcon();
|
|
|
|
|
|
|
|
/* FeedHolder */
|
2013-03-15 17:02:43 -04:00
|
|
|
virtual QScrollArea *getScrollArea();
|
|
|
|
virtual void deleteFeedItem(QWidget *item, uint32_t type);
|
2014-07-22 11:04:36 -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
|
|
|
|
2014-07-23 14:51:56 -04:00
|
|
|
/* GXS functions */
|
|
|
|
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
2012-07-01 19:05:03 -04:00
|
|
|
|
2014-07-22 11:04:36 -04:00
|
|
|
protected:
|
2014-07-23 14:51:56 -04:00
|
|
|
/* GxsMessageFramePostWidget */
|
|
|
|
virtual bool insertGroupData(const uint32_t &token, RsGroupMetaData &metaData);
|
|
|
|
virtual void insertPosts(const uint32_t &token);
|
|
|
|
virtual void insertRelatedPosts(const uint32_t &token);
|
|
|
|
virtual void setMessageRead(GxsFeedItem *item, bool read);
|
|
|
|
virtual void clearPosts();
|
2014-02-09 05:43:59 -05:00
|
|
|
|
2014-07-22 11:04:36 -04:00
|
|
|
private slots:
|
2014-07-06 07:19:58 -04:00
|
|
|
void createNewGxsId();
|
2013-07-15 14:39:39 -04:00
|
|
|
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
|
|
|
|
2014-07-22 11:04:36 -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();
|
2013-06-04 17:00:43 -04:00
|
|
|
|
2012-07-01 19:05:03 -04:00
|
|
|
private:
|
2014-07-22 11:04:36 -04:00
|
|
|
void processSettings(bool load);
|
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
|
|
|
/*!
|
|
|
|
* 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
|
|
|
|
2014-07-22 11:04:36 -04:00
|
|
|
void insertPostedDetails(const RsPostedGroup &group);
|
2013-03-24 12:29:08 -04:00
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
// subscribe/unsubscribe ack.
|
2014-07-22 11:04:36 -04:00
|
|
|
// void acknowledgeSubscribeChange(const uint32_t &token);
|
2012-07-01 19:05:03 -04: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
|
|
|
|
2012-11-17 16:43:21 -05:00
|
|
|
private:
|
2013-07-15 14:39:39 -04:00
|
|
|
int mSortMethod;
|
|
|
|
int mLastSortMethod;
|
|
|
|
int mPostIndex;
|
|
|
|
int mPostShow;
|
2013-06-04 17:00:43 -04:00
|
|
|
|
2014-07-23 14:51:56 -04:00
|
|
|
uint32_t mTokenTypeVote;
|
2013-06-04 17:00:43 -04:00
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
QMap<RsGxsMessageId, PostedItem*> mPosts;
|
2014-07-22 11:04:36 -04:00
|
|
|
|
2013-07-15 14:39:39 -04:00
|
|
|
/* UI - from Designer */
|
2014-07-22 11:04:36 -04:00
|
|
|
Ui::PostedListWidget *ui;
|
2012-07-01 19:05:03 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|