2013-03-15 17:02:43 -04:00
|
|
|
/*
|
|
|
|
* Retroshare Gxs Support
|
|
|
|
*
|
|
|
|
* Copyright 2012-2013 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".
|
|
|
|
*
|
|
|
|
*/
|
2012-07-31 21:47:53 -04:00
|
|
|
|
|
|
|
#ifndef _GXS_COMMENT_TREE_WIDGET_H
|
|
|
|
#define _GXS_COMMENT_TREE_WIDGET_H
|
|
|
|
|
|
|
|
#include <QTreeWidget>
|
|
|
|
|
2012-10-21 15:45:35 -04:00
|
|
|
#include "util/TokenQueue.h"
|
2013-03-11 16:53:15 -04:00
|
|
|
#include <retroshare/rsgxscommon.h>
|
2013-03-12 20:33:14 -04:00
|
|
|
#include <retroshare/rsidentity.h>
|
2012-07-31 21:47:53 -04:00
|
|
|
|
2012-10-21 15:45:35 -04:00
|
|
|
class GxsCommentTreeWidget : public QTreeWidget, public TokenResponse
|
2012-07-31 21:47:53 -04:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2012-11-25 16:50:45 -05:00
|
|
|
GxsCommentTreeWidget(QWidget *parent = 0);
|
2014-10-12 06:46:09 -04:00
|
|
|
~GxsCommentTreeWidget();
|
2013-03-11 16:53:15 -04:00
|
|
|
void setup(RsTokenService *token_service, RsGxsCommentService *comment_service);
|
2012-07-31 21:47:53 -04:00
|
|
|
|
2012-11-25 16:50:45 -05:00
|
|
|
void requestComments(const RsGxsGrpMsgIdPair& threadId);
|
|
|
|
void getCurrentMsgId(RsGxsMessageId& parentId);
|
2012-11-30 13:54:25 -05:00
|
|
|
void applyRankings(std::map<RsGxsMessageId, uint32_t>& positions);
|
2012-07-31 21:47:53 -04:00
|
|
|
|
2012-11-25 16:50:45 -05:00
|
|
|
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
2013-03-12 20:33:14 -04:00
|
|
|
void setVoteId(const RsGxsId &voterId);
|
2012-07-31 21:47:53 -04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2012-11-25 16:50:45 -05:00
|
|
|
/* to be overloaded */
|
|
|
|
virtual void service_requestComments(const RsGxsGrpMsgIdPair& threadId);
|
|
|
|
virtual void service_loadThread(const uint32_t &token);
|
|
|
|
virtual QTreeWidgetItem *service_createMissingItem(const RsGxsMessageId& parent);
|
2012-07-31 21:47:53 -04:00
|
|
|
|
2012-11-25 16:50:45 -05:00
|
|
|
void clearItems();
|
|
|
|
void completeItems();
|
2012-07-31 21:47:53 -04:00
|
|
|
|
2012-11-25 16:50:45 -05:00
|
|
|
void acknowledgeComment(const uint32_t& token);
|
2013-03-15 17:02:43 -04:00
|
|
|
void acknowledgeVote(const uint32_t &token);
|
|
|
|
|
2012-11-25 16:50:45 -05:00
|
|
|
void loadThread(const uint32_t &token);
|
2012-07-31 21:47:53 -04:00
|
|
|
|
2014-03-17 16:56:06 -04:00
|
|
|
void addItem(RsGxsMessageId itemId, RsGxsMessageId parentId, QTreeWidgetItem *item);
|
2012-07-31 21:47:53 -04:00
|
|
|
|
2012-11-25 16:50:45 -05:00
|
|
|
public slots:
|
|
|
|
void customPopUpMenu(const QPoint& point);
|
2012-11-30 13:54:25 -05:00
|
|
|
void setCurrentMsgId(QTreeWidgetItem* current, QTreeWidgetItem* previous);
|
2012-07-31 21:47:53 -04:00
|
|
|
|
|
|
|
|
2012-11-25 16:50:45 -05:00
|
|
|
void makeComment();
|
2012-11-30 13:54:25 -05:00
|
|
|
void replyToComment();
|
2012-07-31 21:47:53 -04:00
|
|
|
|
2013-03-12 20:33:14 -04:00
|
|
|
void voteUp();
|
|
|
|
void voteDown();
|
|
|
|
|
|
|
|
void showReputation();
|
|
|
|
void markInteresting();
|
|
|
|
void markSpammer();
|
|
|
|
void banUser();
|
|
|
|
|
2012-11-25 16:50:45 -05:00
|
|
|
protected:
|
|
|
|
|
2013-03-12 20:33:14 -04:00
|
|
|
void vote(const RsGxsGroupId &groupId, const RsGxsMessageId &threadId,
|
|
|
|
const RsGxsMessageId &parentId, const RsGxsId &authorId, bool up);
|
|
|
|
|
2012-11-25 16:50:45 -05:00
|
|
|
/* Data */
|
|
|
|
RsGxsGrpMsgIdPair mThreadId;
|
|
|
|
RsGxsMessageId mCurrentMsgId;
|
2013-03-12 20:33:14 -04:00
|
|
|
RsGxsId mVoterId;
|
2012-11-25 16:50:45 -05:00
|
|
|
|
2014-03-17 16:56:06 -04:00
|
|
|
std::map<RsGxsMessageId, QTreeWidgetItem *> mLoadingMap;
|
|
|
|
std::multimap<RsGxsMessageId, QTreeWidgetItem *> mPendingInsertMap;
|
2012-07-31 21:47:53 -04:00
|
|
|
|
2012-11-25 16:50:45 -05:00
|
|
|
TokenQueue *mTokenQueue;
|
2013-03-11 16:53:15 -04:00
|
|
|
RsTokenService *mRsTokenService;
|
|
|
|
RsGxsCommentService *mCommentService;
|
2012-07-31 21:47:53 -04:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|