2018-11-17 14:10:08 +01:00
|
|
|
/*******************************************************************************
|
|
|
|
* retroshare-gui/src/gui/Posted/PostedListWidget.h *
|
|
|
|
* *
|
|
|
|
* Copyright (C) 2013 by Robert Fernie <retroshare.project@gmail.com> *
|
|
|
|
* *
|
|
|
|
* This program is free software: you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU Affero General Public License as *
|
|
|
|
* published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Affero General Public License *
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
|
|
|
* *
|
|
|
|
*******************************************************************************/
|
2012-07-01 23:05:03 +00:00
|
|
|
|
2014-07-22 15:04:36 +00:00
|
|
|
#ifndef POSTED_LIST_WIDGET_H
|
|
|
|
#define POSTED_LIST_WIDGET_H
|
2012-07-01 23:05:03 +00:00
|
|
|
|
2014-07-22 15:04:36 +00:00
|
|
|
#include <QMap>
|
2012-07-01 23:05:03 +00:00
|
|
|
|
2014-07-23 18:51:56 +00:00
|
|
|
#include "gui/gxs/GxsMessageFramePostWidget.h"
|
2013-07-15 18:39:39 +00:00
|
|
|
#include "gui/feeds/FeedHolder.h"
|
2012-11-22 22:40:31 +00:00
|
|
|
|
2014-07-22 15:04:36 +00:00
|
|
|
class RsPostedGroup;
|
|
|
|
class RsPostedPost;
|
2013-07-15 18:39:39 +00:00
|
|
|
class PostedItem;
|
2019-12-25 17:16:58 +01:00
|
|
|
class PostedCardView;
|
2012-11-22 22:40:31 +00:00
|
|
|
|
2014-07-22 15:04:36 +00:00
|
|
|
namespace Ui {
|
|
|
|
class PostedListWidget;
|
|
|
|
}
|
2012-10-29 22:41:41 +00:00
|
|
|
|
2014-07-23 18:51:56 +00:00
|
|
|
class PostedListWidget : public GxsMessageFramePostWidget, public FeedHolder
|
2012-07-01 23:05:03 +00:00
|
|
|
{
|
2013-07-15 18:39:39 +00:00
|
|
|
Q_OBJECT
|
2012-07-01 23:05:03 +00:00
|
|
|
|
|
|
|
public:
|
2014-07-22 15:04:36 +00:00
|
|
|
PostedListWidget(const RsGxsGroupId &postedId, QWidget *parent = 0);
|
|
|
|
~PostedListWidget();
|
|
|
|
|
|
|
|
/* GxsMessageFrameWidget */
|
|
|
|
virtual QIcon groupIcon();
|
2019-10-05 17:50:00 +02:00
|
|
|
virtual void groupIdChanged();
|
2014-07-22 15:04:36 +00:00
|
|
|
|
|
|
|
/* FeedHolder */
|
2013-03-15 21:02:43 +00:00
|
|
|
virtual QScrollArea *getScrollArea();
|
|
|
|
virtual void deleteFeedItem(QWidget *item, uint32_t type);
|
2014-07-22 15:04:36 +00:00
|
|
|
virtual void openChat(const RsPeerId& peerId);
|
2017-05-18 22:31:52 +02:00
|
|
|
virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const QVector<RsGxsMessageId> &versions, const RsGxsMessageId &msgId, const QString &title);
|
2012-07-01 23:05:03 +00:00
|
|
|
|
2014-07-23 18:51:56 +00:00
|
|
|
/* GXS functions */
|
|
|
|
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
2012-07-01 23:05:03 +00:00
|
|
|
|
2014-07-22 15:04:36 +00:00
|
|
|
protected:
|
2014-07-23 18:51:56 +00:00
|
|
|
/* GxsMessageFramePostWidget */
|
|
|
|
virtual bool insertGroupData(const uint32_t &token, RsGroupMetaData &metaData);
|
2015-08-13 15:22:48 +02:00
|
|
|
virtual void insertAllPosts(const uint32_t &token, GxsMessageFramePostThread *thread);
|
|
|
|
virtual void insertPosts(const uint32_t &token);
|
2014-07-23 18:51:56 +00:00
|
|
|
virtual void clearPosts();
|
2018-06-25 23:08:10 +02:00
|
|
|
virtual void blank();
|
2014-10-25 23:52:33 +00:00
|
|
|
virtual bool navigatePostItem(const RsGxsMessageId& msgId);
|
2014-02-09 10:43:59 +00:00
|
|
|
|
2015-03-14 21:13:28 +00:00
|
|
|
/* GxsMessageFrameWidget */
|
|
|
|
virtual void setAllMessagesReadDo(bool read, uint32_t &token);
|
|
|
|
|
2014-07-22 15:04:36 +00:00
|
|
|
private slots:
|
2013-07-15 18:39:39 +00:00
|
|
|
void newPost();
|
2012-12-05 22:45:44 +00:00
|
|
|
|
2013-07-15 18:39:39 +00:00
|
|
|
void submitVote(const RsGxsGrpMsgIdPair& msgId, bool up);
|
2012-07-30 23:55:21 +00:00
|
|
|
|
2019-01-12 15:46:47 +01:00
|
|
|
void getRankings(int);
|
2012-12-11 22:26:11 +00:00
|
|
|
|
2014-07-23 20:04:25 +00:00
|
|
|
void subscribeGroup(bool subscribe);
|
2013-03-24 16:29:08 +00:00
|
|
|
|
2013-07-15 18:39:39 +00:00
|
|
|
void showNext();
|
|
|
|
void showPrev();
|
2013-06-04 21:00:43 +00:00
|
|
|
|
2019-12-25 17:16:58 +01:00
|
|
|
void setViewMode(int viewMode);
|
|
|
|
|
2012-07-01 23:05:03 +00:00
|
|
|
private:
|
2014-07-22 15:04:36 +00:00
|
|
|
void processSettings(bool load);
|
2013-07-15 18:39:39 +00:00
|
|
|
void updateShowText();
|
2012-07-01 23:05:03 +00:00
|
|
|
|
2019-12-25 17:16:58 +01:00
|
|
|
int viewMode();
|
|
|
|
|
2013-07-15 18:39:39 +00:00
|
|
|
/*!
|
|
|
|
* Only removes it from layout
|
|
|
|
*/
|
|
|
|
void shallowClearPosts();
|
2012-07-01 23:05:03 +00:00
|
|
|
|
2013-07-15 18:39:39 +00:00
|
|
|
void loadPost(const RsPostedPost &post);
|
2019-12-25 17:16:58 +01:00
|
|
|
void loadPostCardView(const RsPostedPost &post);
|
2012-07-01 23:05:03 +00:00
|
|
|
|
2014-07-22 15:04:36 +00:00
|
|
|
void insertPostedDetails(const RsPostedGroup &group);
|
2013-03-24 16:29:08 +00:00
|
|
|
|
2013-07-15 18:39:39 +00:00
|
|
|
// subscribe/unsubscribe ack.
|
2014-07-22 15:04:36 +00:00
|
|
|
// void acknowledgeSubscribeChange(const uint32_t &token);
|
2012-07-01 23:05:03 +00:00
|
|
|
|
2013-07-15 18:39:39 +00:00
|
|
|
// votes
|
|
|
|
void acknowledgeVoteMsg(const uint32_t& token);
|
|
|
|
void loadVoteData(const uint32_t &token);
|
2012-12-05 22:45:44 +00:00
|
|
|
|
2013-07-15 18:39:39 +00:00
|
|
|
// ranking
|
|
|
|
//void loadRankings(const uint32_t& token);
|
|
|
|
//void applyRanking(const PostedRanking& ranks);
|
|
|
|
void applyRanking();
|
2012-12-11 22:26:11 +00:00
|
|
|
|
2012-11-17 21:43:21 +00:00
|
|
|
private:
|
2013-07-15 18:39:39 +00:00
|
|
|
int mSortMethod;
|
|
|
|
int mLastSortMethod;
|
|
|
|
int mPostIndex;
|
|
|
|
int mPostShow;
|
2013-06-04 21:00:43 +00:00
|
|
|
|
2014-07-23 18:51:56 +00:00
|
|
|
uint32_t mTokenTypeVote;
|
2013-06-04 21:00:43 +00:00
|
|
|
|
2013-07-15 18:39:39 +00:00
|
|
|
QMap<RsGxsMessageId, PostedItem*> mPosts;
|
2014-08-01 14:49:58 +00:00
|
|
|
QList<PostedItem*> mPostItems;
|
2014-07-22 15:04:36 +00:00
|
|
|
|
2019-12-25 17:16:58 +01:00
|
|
|
QMap<RsGxsMessageId, PostedCardView*> mCVPosts;
|
|
|
|
QList<PostedCardView*> mPostCardView;
|
|
|
|
|
2013-07-15 18:39:39 +00:00
|
|
|
/* UI - from Designer */
|
2014-07-22 15:04:36 +00:00
|
|
|
Ui::PostedListWidget *ui;
|
2012-07-01 23:05:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|