2012-08-01 01:47:53 +00: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 _GXS_COMMENT_TREE_WIDGET_H
|
|
|
|
#define _GXS_COMMENT_TREE_WIDGET_H
|
|
|
|
|
|
|
|
#include <QTreeWidget>
|
|
|
|
|
2012-10-21 19:45:35 +00:00
|
|
|
#include "util/TokenQueue.h"
|
2013-03-11 20:53:15 +00:00
|
|
|
#include <retroshare/rsgxscommon.h>
|
2013-03-13 00:33:14 +00:00
|
|
|
#include <retroshare/rsidentity.h>
|
2012-08-01 01:47:53 +00:00
|
|
|
|
2012-10-21 19:45:35 +00:00
|
|
|
class GxsCommentTreeWidget : public QTreeWidget, public TokenResponse
|
2012-08-01 01:47:53 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2012-11-25 21:50:45 +00:00
|
|
|
GxsCommentTreeWidget(QWidget *parent = 0);
|
2013-03-11 20:53:15 +00:00
|
|
|
void setup(RsTokenService *token_service, RsGxsCommentService *comment_service);
|
2012-08-01 01:47:53 +00:00
|
|
|
|
2012-11-25 21:50:45 +00:00
|
|
|
void requestComments(const RsGxsGrpMsgIdPair& threadId);
|
|
|
|
void getCurrentMsgId(RsGxsMessageId& parentId);
|
2012-11-30 18:54:25 +00:00
|
|
|
void applyRankings(std::map<RsGxsMessageId, uint32_t>& positions);
|
2012-08-01 01:47:53 +00:00
|
|
|
|
2012-11-25 21:50:45 +00:00
|
|
|
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
2013-03-13 00:33:14 +00:00
|
|
|
void setVoteId(const RsGxsId &voterId);
|
2012-08-01 01:47:53 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2012-11-25 21:50:45 +00: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-08-01 01:47:53 +00:00
|
|
|
|
2012-11-25 21:50:45 +00:00
|
|
|
void clearItems();
|
|
|
|
void completeItems();
|
2012-08-01 01:47:53 +00:00
|
|
|
|
2012-11-25 21:50:45 +00:00
|
|
|
void acknowledgeComment(const uint32_t& token);
|
|
|
|
void loadThread(const uint32_t &token);
|
2012-08-01 01:47:53 +00:00
|
|
|
|
2012-11-25 21:50:45 +00:00
|
|
|
void addItem(std::string itemId, std::string parentId, QTreeWidgetItem *item);
|
2012-08-01 01:47:53 +00:00
|
|
|
|
2012-11-25 21:50:45 +00:00
|
|
|
public slots:
|
|
|
|
void customPopUpMenu(const QPoint& point);
|
2012-11-30 18:54:25 +00:00
|
|
|
void setCurrentMsgId(QTreeWidgetItem* current, QTreeWidgetItem* previous);
|
2012-08-01 01:47:53 +00:00
|
|
|
|
|
|
|
|
2012-11-25 21:50:45 +00:00
|
|
|
void makeComment();
|
2012-11-30 18:54:25 +00:00
|
|
|
void replyToComment();
|
2012-08-01 01:47:53 +00:00
|
|
|
|
2013-03-13 00:33:14 +00:00
|
|
|
void voteUp();
|
|
|
|
void voteDown();
|
|
|
|
|
|
|
|
void showReputation();
|
|
|
|
void markInteresting();
|
|
|
|
void markSpammer();
|
|
|
|
void banUser();
|
|
|
|
|
2012-11-25 21:50:45 +00:00
|
|
|
protected:
|
|
|
|
|
2013-03-13 00:33:14 +00:00
|
|
|
void vote(const RsGxsGroupId &groupId, const RsGxsMessageId &threadId,
|
|
|
|
const RsGxsMessageId &parentId, const RsGxsId &authorId, bool up);
|
|
|
|
|
2012-11-25 21:50:45 +00:00
|
|
|
/* Data */
|
|
|
|
RsGxsGrpMsgIdPair mThreadId;
|
|
|
|
RsGxsMessageId mCurrentMsgId;
|
2013-03-13 00:33:14 +00:00
|
|
|
RsGxsId mVoterId;
|
2012-11-25 21:50:45 +00:00
|
|
|
|
|
|
|
std::map<std::string, QTreeWidgetItem *> mLoadingMap;
|
|
|
|
std::multimap<std::string, QTreeWidgetItem *> mPendingInsertMap;
|
2012-08-01 01:47:53 +00:00
|
|
|
|
2012-11-25 21:50:45 +00:00
|
|
|
TokenQueue *mTokenQueue;
|
2013-03-11 20:53:15 +00:00
|
|
|
RsTokenService *mRsTokenService;
|
|
|
|
RsGxsCommentService *mCommentService;
|
2012-08-01 01:47:53 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|