2012-11-27 23:21:20 +00:00
|
|
|
#ifndef GXSFORUMTHREADWIDGET_H
|
|
|
|
#define GXSFORUMTHREADWIDGET_H
|
|
|
|
|
2017-02-09 14:49:43 +01:00
|
|
|
#include <QMap>
|
|
|
|
|
2014-05-04 22:59:06 +00:00
|
|
|
#include "gui/gxs/GxsMessageFrameWidget.h"
|
2015-05-02 18:50:34 +00:00
|
|
|
#include <retroshare/rsgxsforums.h>
|
2015-05-03 12:28:08 +00:00
|
|
|
#include "gui/gxs/GxsIdDetails.h"
|
2012-11-27 23:21:20 +00:00
|
|
|
|
|
|
|
class QTreeWidgetItem;
|
|
|
|
class RSTreeWidgetItemCompareRole;
|
|
|
|
class RsGxsForumMsg;
|
2012-12-09 02:32:47 +00:00
|
|
|
class GxsForumsFillThread;
|
2014-04-14 22:36:10 +00:00
|
|
|
class RsGxsForumGroup;
|
2012-11-27 23:21:20 +00:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class GxsForumThreadWidget;
|
|
|
|
}
|
|
|
|
|
2015-03-13 19:33:37 +00:00
|
|
|
class GxsForumThreadWidget : public GxsMessageFrameWidget
|
2012-11-27 23:21:20 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
Q_PROPERTY(QColor textColorRead READ textColorRead WRITE setTextColorRead)
|
|
|
|
Q_PROPERTY(QColor textColorUnread READ textColorUnread WRITE setTextColorUnread)
|
|
|
|
Q_PROPERTY(QColor textColorUnreadChildren READ textColorUnreadChildren WRITE setTextColorUnreadChildren)
|
|
|
|
Q_PROPERTY(QColor textColorNotSubscribed READ textColorNotSubscribed WRITE setTextColorNotSubscribed)
|
|
|
|
Q_PROPERTY(QColor textColorMissing READ textColorMissing WRITE setTextColorMissing)
|
|
|
|
|
|
|
|
public:
|
2014-03-17 20:56:06 +00:00
|
|
|
explicit GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget *parent = NULL);
|
2012-11-27 23:21:20 +00:00
|
|
|
~GxsForumThreadWidget();
|
2012-12-04 16:06:21 +00:00
|
|
|
|
|
|
|
QColor textColorRead() const { return mTextColorRead; }
|
|
|
|
QColor textColorUnread() const { return mTextColorUnread; }
|
|
|
|
QColor textColorUnreadChildren() const { return mTextColorUnreadChildren; }
|
|
|
|
QColor textColorNotSubscribed() const { return mTextColorNotSubscribed; }
|
|
|
|
QColor textColorMissing() const { return mTextColorMissing; }
|
2012-11-27 23:21:20 +00:00
|
|
|
|
|
|
|
void setTextColorRead(QColor color) { mTextColorRead = color; }
|
|
|
|
void setTextColorUnread(QColor color) { mTextColorUnread = color; }
|
|
|
|
void setTextColorUnreadChildren(QColor color) { mTextColorUnreadChildren = color; }
|
|
|
|
void setTextColorNotSubscribed(QColor color) { mTextColorNotSubscribed = color; }
|
|
|
|
void setTextColorMissing(QColor color) { mTextColorMissing = color; }
|
|
|
|
|
2014-10-25 23:52:33 +00:00
|
|
|
/* GxsMessageFrameWidget */
|
2015-03-13 19:33:37 +00:00
|
|
|
virtual void groupIdChanged();
|
2014-05-04 22:59:06 +00:00
|
|
|
virtual QString groupName(bool withUnreadCount);
|
|
|
|
virtual QIcon groupIcon();
|
2014-10-25 23:52:33 +00:00
|
|
|
virtual bool navigate(const RsGxsMessageId& msgId);
|
2015-03-14 21:13:28 +00:00
|
|
|
virtual bool isLoading();
|
2014-10-25 23:52:33 +00:00
|
|
|
|
2012-12-09 02:32:47 +00:00
|
|
|
unsigned int newCount() { return mNewCount; }
|
|
|
|
unsigned int unreadCount() { return mUnreadCount; }
|
|
|
|
|
2017-02-06 00:11:26 +01:00
|
|
|
QTreeWidgetItem *convertMsgToThreadWidget(const RsGxsForumMsg &msg, bool useChildTS, uint32_t filterColumn, QTreeWidgetItem *parent);
|
2014-03-17 20:56:06 +00:00
|
|
|
QTreeWidgetItem *generateMissingItem(const RsGxsMessageId &msgId);
|
2012-12-09 02:32:47 +00:00
|
|
|
|
2012-11-27 23:21:20 +00:00
|
|
|
// Callback for all Loads.
|
|
|
|
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
2018-06-25 23:08:10 +02:00
|
|
|
virtual void blank();
|
2012-11-27 23:21:20 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
bool eventFilter(QObject *obj, QEvent *ev);
|
|
|
|
void changeEvent(QEvent *e);
|
2015-03-14 21:13:28 +00:00
|
|
|
|
|
|
|
/* RsGxsUpdateBroadcastWidget */
|
2013-07-19 09:48:51 +00:00
|
|
|
virtual void updateDisplay(bool complete);
|
2012-11-27 23:21:20 +00:00
|
|
|
|
2015-03-14 21:13:28 +00:00
|
|
|
/* GxsMessageFrameWidget */
|
|
|
|
virtual void setAllMessagesReadDo(bool read, uint32_t &token);
|
2015-10-10 18:27:15 -04:00
|
|
|
|
2012-11-27 23:21:20 +00:00
|
|
|
private slots:
|
|
|
|
/** Create the context popup menu and it's submenus */
|
|
|
|
void threadListCustomPopupMenu(QPoint point);
|
2015-12-06 23:01:23 +01:00
|
|
|
void contextMenuTextBrowser(QPoint point);
|
2012-11-27 23:21:20 +00:00
|
|
|
|
|
|
|
void changedThread();
|
2017-02-09 21:49:24 +01:00
|
|
|
void changedVersion();
|
2012-11-27 23:21:20 +00:00
|
|
|
void clickedThread (QTreeWidgetItem *item, int column);
|
|
|
|
|
2017-02-03 12:48:51 +01:00
|
|
|
void reply_with_private_message();
|
2015-11-19 12:05:52 +01:00
|
|
|
void replytoforummessage();
|
2017-02-03 12:48:51 +01:00
|
|
|
void editforummessage();
|
2015-11-19 12:05:52 +01:00
|
|
|
|
2012-11-27 23:21:20 +00:00
|
|
|
void replyMessageData(const RsGxsForumMsg &msg);
|
2017-02-03 12:48:51 +01:00
|
|
|
void editForumMessageData(const RsGxsForumMsg &msg);
|
2015-11-19 12:05:52 +01:00
|
|
|
void replyForumMessageData(const RsGxsForumMsg &msg);
|
2016-12-27 20:42:47 +01:00
|
|
|
void showAuthorInPeople(const RsGxsForumMsg& msg);
|
|
|
|
|
2015-12-06 23:01:23 +01:00
|
|
|
void saveImage();
|
2015-11-19 12:05:52 +01:00
|
|
|
|
2012-11-27 23:21:20 +00:00
|
|
|
|
|
|
|
//void print();
|
|
|
|
//void printpreview();
|
|
|
|
|
|
|
|
//void removemessage();
|
|
|
|
void markMsgAsRead();
|
|
|
|
void markMsgAsReadChildren();
|
|
|
|
void markMsgAsUnread();
|
|
|
|
void markMsgAsUnreadChildren();
|
|
|
|
|
|
|
|
void copyMessageLink();
|
2016-12-27 20:42:47 +01:00
|
|
|
void showInPeopleTab();
|
2012-11-27 23:21:20 +00:00
|
|
|
|
|
|
|
/* handle splitter */
|
|
|
|
void togglethreadview();
|
|
|
|
|
2014-07-07 11:18:20 +00:00
|
|
|
void subscribeGroup(bool subscribe);
|
2012-11-27 23:21:20 +00:00
|
|
|
void createthread();
|
2018-08-30 11:48:37 +02:00
|
|
|
void togglePinUpPost();
|
2012-11-27 23:21:20 +00:00
|
|
|
void createmessage();
|
|
|
|
|
|
|
|
void previousMessage();
|
|
|
|
void nextMessage();
|
|
|
|
void nextUnreadMessage();
|
|
|
|
void downloadAllFiles();
|
|
|
|
|
|
|
|
void changedViewBox();
|
2016-12-24 17:29:53 +01:00
|
|
|
void flagperson();
|
2012-11-27 23:21:20 +00:00
|
|
|
|
|
|
|
void filterColumnChanged(int column);
|
|
|
|
void filterItems(const QString &text);
|
|
|
|
|
|
|
|
void fillThreadFinished();
|
2012-12-09 02:32:47 +00:00
|
|
|
void fillThreadProgress(int current, int count);
|
|
|
|
void fillThreadStatus(QString text);
|
2012-11-27 23:21:20 +00:00
|
|
|
|
|
|
|
private:
|
2014-11-27 22:45:34 +00:00
|
|
|
void insertMessageData(const RsGxsForumMsg &msg);
|
2012-11-27 23:21:20 +00:00
|
|
|
|
|
|
|
void insertThreads();
|
2014-11-27 22:45:34 +00:00
|
|
|
void insertMessage();
|
2012-11-27 23:21:20 +00:00
|
|
|
|
|
|
|
void fillThreads(QList<QTreeWidgetItem *> &threadList, bool expandNewMessages, QList<QTreeWidgetItem*> &itemToExpand);
|
|
|
|
void fillChildren(QTreeWidgetItem *parentItem, QTreeWidgetItem *newParentItem, bool expandNewMessages, QList<QTreeWidgetItem*> &itemToExpand);
|
|
|
|
|
|
|
|
int getSelectedMsgCount(QList<QTreeWidgetItem*> *pRows, QList<QTreeWidgetItem*> *pRowsRead, QList<QTreeWidgetItem*> *pRowsUnread);
|
|
|
|
void setMsgReadStatus(QList<QTreeWidgetItem*> &rows, bool read);
|
|
|
|
void markMsgAsReadUnread(bool read, bool children, bool forum);
|
|
|
|
void calculateIconsAndFonts(QTreeWidgetItem *item = NULL);
|
|
|
|
void calculateIconsAndFonts(QTreeWidgetItem *item, bool &hasReadChilddren, bool &hasUnreadChilddren);
|
2012-12-09 02:32:47 +00:00
|
|
|
void calculateUnreadCount();
|
2012-11-27 23:21:20 +00:00
|
|
|
|
|
|
|
void togglethreadview_internal();
|
|
|
|
|
|
|
|
bool filterItem(QTreeWidgetItem *item, const QString &text, int filterColumn);
|
|
|
|
|
|
|
|
void processSettings(bool bLoad);
|
|
|
|
|
2014-11-27 22:45:34 +00:00
|
|
|
void requestGroupData();
|
|
|
|
void loadGroupData(const uint32_t &token);
|
2015-05-02 18:50:34 +00:00
|
|
|
void insertGroupData();
|
2015-05-03 12:28:08 +00:00
|
|
|
static void loadAuthorIdCallback(GxsIdDetailsType type, const RsIdentityDetails &details, QObject *object, const QVariant &/*data*/);
|
|
|
|
|
2014-11-27 22:45:34 +00:00
|
|
|
void requestMessageData(const RsGxsGrpMsgIdPair &msgId);
|
2017-02-03 12:48:51 +01:00
|
|
|
void requestMsgData_ReplyWithPrivateMessage(const RsGxsGrpMsgIdPair &msgId);
|
2016-12-27 20:42:47 +01:00
|
|
|
void requestMsgData_ShowAuthorInPeople(const RsGxsGrpMsgIdPair &msgId);
|
2015-11-19 12:05:52 +01:00
|
|
|
void requestMsgData_ReplyForumMessage(const RsGxsGrpMsgIdPair &msgId);
|
2017-02-03 12:48:51 +01:00
|
|
|
void requestMsgData_EditForumMessage(const RsGxsGrpMsgIdPair &msgId);
|
2016-12-27 20:42:47 +01:00
|
|
|
|
|
|
|
void loadMessageData(const uint32_t &token);
|
|
|
|
void loadMsgData_ReplyMessage(const uint32_t &token);
|
2015-11-19 12:05:52 +01:00
|
|
|
void loadMsgData_ReplyForumMessage(const uint32_t &token);
|
2017-02-03 12:48:51 +01:00
|
|
|
void loadMsgData_EditForumMessage(const uint32_t &token);
|
2016-12-27 20:42:47 +01:00
|
|
|
void loadMsgData_ShowAuthorInPeople(const uint32_t &token);
|
2016-12-27 21:13:37 +01:00
|
|
|
void loadMsgData_SetAuthorOpinion(const uint32_t &token, RsReputations::Opinion opinion);
|
2014-11-27 22:45:34 +00:00
|
|
|
|
|
|
|
private:
|
2014-03-17 20:56:06 +00:00
|
|
|
RsGxsGroupId mLastForumID;
|
|
|
|
RsGxsMessageId mThreadId;
|
2017-02-09 18:45:55 +01:00
|
|
|
RsGxsMessageId mOrigThreadId;
|
2015-05-02 18:50:34 +00:00
|
|
|
RsGxsForumGroup mForumGroup;
|
2013-07-04 22:51:43 +00:00
|
|
|
QString mForumDescription;
|
2012-11-27 23:21:20 +00:00
|
|
|
int mSubscribeFlags;
|
2015-10-24 00:22:55 -04:00
|
|
|
int mSignFlags;
|
2012-11-27 23:21:20 +00:00
|
|
|
bool mInProcessSettings;
|
|
|
|
bool mInMsgAsReadUnread;
|
|
|
|
int mLastViewType;
|
|
|
|
RSTreeWidgetItemCompareRole *mThreadCompareRole;
|
2012-12-09 02:32:47 +00:00
|
|
|
GxsForumsFillThread *mFillThread;
|
|
|
|
unsigned int mUnreadCount;
|
|
|
|
unsigned int mNewCount;
|
2012-11-27 23:21:20 +00:00
|
|
|
|
2015-03-13 19:33:37 +00:00
|
|
|
uint32_t mTokenTypeGroupData;
|
|
|
|
uint32_t mTokenTypeInsertThreads;
|
|
|
|
uint32_t mTokenTypeMessageData;
|
|
|
|
uint32_t mTokenTypeReplyMessage;
|
2015-11-19 12:05:52 +01:00
|
|
|
uint32_t mTokenTypeReplyForumMessage;
|
2017-02-03 12:48:51 +01:00
|
|
|
uint32_t mTokenTypeEditForumMessage;
|
2016-12-27 20:42:47 +01:00
|
|
|
uint32_t mTokenTypeShowAuthorInPeople;
|
2016-12-24 17:29:53 +01:00
|
|
|
uint32_t mTokenTypeNegativeAuthor;
|
|
|
|
uint32_t mTokenTypePositiveAuthor;
|
|
|
|
uint32_t mTokenTypeNeutralAuthor;
|
2015-03-13 19:33:37 +00:00
|
|
|
|
2012-11-27 23:21:20 +00:00
|
|
|
/* Color definitions (for standard see qss.default) */
|
|
|
|
QColor mTextColorRead;
|
|
|
|
QColor mTextColorUnread;
|
|
|
|
QColor mTextColorUnreadChildren;
|
|
|
|
QColor mTextColorNotSubscribed;
|
|
|
|
QColor mTextColorMissing;
|
|
|
|
|
2014-10-25 23:52:33 +00:00
|
|
|
RsGxsMessageId mNavigatePendingMsgId;
|
2014-11-27 22:45:34 +00:00
|
|
|
QList<RsGxsMessageId> mIgnoredMsgId;
|
2014-10-25 23:52:33 +00:00
|
|
|
|
2017-02-09 14:49:43 +01:00
|
|
|
QMap<RsGxsMessageId,QVector<QPair<time_t,RsGxsMessageId> > > mPostVersions ; // holds older versions of posts
|
|
|
|
|
2015-10-09 18:51:16 -04:00
|
|
|
Ui::GxsForumThreadWidget *ui;
|
2012-11-27 23:21:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // GXSFORUMTHREADWIDGET_H
|