2012-11-27 18:21:20 -05:00
|
|
|
#ifndef GXSFORUMTHREADWIDGET_H
|
|
|
|
#define GXSFORUMTHREADWIDGET_H
|
|
|
|
|
2014-05-04 18:59:06 -04:00
|
|
|
#include "gui/gxs/GxsMessageFrameWidget.h"
|
2015-05-02 14:50:34 -04:00
|
|
|
#include <retroshare/rsgxsforums.h>
|
2015-05-03 08:28:08 -04:00
|
|
|
#include "gui/gxs/GxsIdDetails.h"
|
2012-11-27 18:21:20 -05:00
|
|
|
|
|
|
|
class QTreeWidgetItem;
|
|
|
|
class RSTreeWidgetItemCompareRole;
|
|
|
|
class RsGxsForumMsg;
|
2012-12-08 21:32:47 -05:00
|
|
|
class GxsForumsFillThread;
|
2014-04-14 18:36:10 -04:00
|
|
|
class RsGxsForumGroup;
|
2012-11-27 18:21:20 -05:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class GxsForumThreadWidget;
|
|
|
|
}
|
|
|
|
|
2015-03-13 15:33:37 -04:00
|
|
|
class GxsForumThreadWidget : public GxsMessageFrameWidget
|
2012-11-27 18:21:20 -05: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 16:56:06 -04:00
|
|
|
explicit GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget *parent = NULL);
|
2012-11-27 18:21:20 -05:00
|
|
|
~GxsForumThreadWidget();
|
2012-12-04 11:06:21 -05: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 18:21:20 -05: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 19:52:33 -04:00
|
|
|
/* GxsMessageFrameWidget */
|
2015-03-13 15:33:37 -04:00
|
|
|
virtual void groupIdChanged();
|
2014-05-04 18:59:06 -04:00
|
|
|
virtual QString groupName(bool withUnreadCount);
|
|
|
|
virtual QIcon groupIcon();
|
2014-10-25 19:52:33 -04:00
|
|
|
virtual bool navigate(const RsGxsMessageId& msgId);
|
2015-03-14 17:13:28 -04:00
|
|
|
virtual bool isLoading();
|
2014-10-25 19:52:33 -04:00
|
|
|
|
2012-12-08 21:32:47 -05:00
|
|
|
unsigned int newCount() { return mNewCount; }
|
|
|
|
unsigned int unreadCount() { return mUnreadCount; }
|
|
|
|
|
2016-08-06 05:57:20 -04:00
|
|
|
QTreeWidgetItem *convertMsgToThreadWidget(const RsGxsForumMsg &msg, bool useChildTS, uint32_t filterColumn, QTreeWidgetItem *parent = NULL);
|
2014-03-17 16:56:06 -04:00
|
|
|
QTreeWidgetItem *generateMissingItem(const RsGxsMessageId &msgId);
|
2012-12-08 21:32:47 -05:00
|
|
|
|
2012-11-27 18:21:20 -05:00
|
|
|
// Callback for all Loads.
|
|
|
|
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool eventFilter(QObject *obj, QEvent *ev);
|
|
|
|
void changeEvent(QEvent *e);
|
2015-03-14 17:13:28 -04:00
|
|
|
|
|
|
|
/* RsGxsUpdateBroadcastWidget */
|
2013-07-19 05:48:51 -04:00
|
|
|
virtual void updateDisplay(bool complete);
|
2012-11-27 18:21:20 -05:00
|
|
|
|
2015-03-14 17:13:28 -04:00
|
|
|
/* GxsMessageFrameWidget */
|
|
|
|
virtual void setAllMessagesReadDo(bool read, uint32_t &token);
|
2015-10-10 18:27:15 -04:00
|
|
|
|
2012-11-27 18:21:20 -05:00
|
|
|
private slots:
|
|
|
|
/** Create the context popup menu and it's submenus */
|
|
|
|
void threadListCustomPopupMenu(QPoint point);
|
2015-12-06 17:01:23 -05:00
|
|
|
void contextMenuTextBrowser(QPoint point);
|
2012-11-27 18:21:20 -05:00
|
|
|
|
|
|
|
void changedThread();
|
|
|
|
void clickedThread (QTreeWidgetItem *item, int column);
|
|
|
|
|
|
|
|
void replytomessage();
|
2015-11-19 06:05:52 -05:00
|
|
|
void replytoforummessage();
|
|
|
|
|
2012-11-27 18:21:20 -05:00
|
|
|
void replyMessageData(const RsGxsForumMsg &msg);
|
2015-11-19 06:05:52 -05:00
|
|
|
void replyForumMessageData(const RsGxsForumMsg &msg);
|
|
|
|
|
2015-12-06 17:01:23 -05:00
|
|
|
void saveImage();
|
2015-11-19 06:05:52 -05:00
|
|
|
|
2012-11-27 18:21:20 -05:00
|
|
|
|
|
|
|
//void print();
|
|
|
|
//void printpreview();
|
|
|
|
|
|
|
|
//void removemessage();
|
|
|
|
void markMsgAsRead();
|
|
|
|
void markMsgAsReadChildren();
|
|
|
|
void markMsgAsUnread();
|
|
|
|
void markMsgAsUnreadChildren();
|
|
|
|
|
|
|
|
void copyMessageLink();
|
|
|
|
|
|
|
|
/* handle splitter */
|
|
|
|
void togglethreadview();
|
|
|
|
|
2014-07-07 07:18:20 -04:00
|
|
|
void subscribeGroup(bool subscribe);
|
2012-11-27 18:21:20 -05:00
|
|
|
void createthread();
|
|
|
|
void createmessage();
|
|
|
|
|
|
|
|
void previousMessage();
|
|
|
|
void nextMessage();
|
|
|
|
void nextUnreadMessage();
|
|
|
|
void downloadAllFiles();
|
|
|
|
|
|
|
|
void changedViewBox();
|
2015-10-09 18:51:16 -04:00
|
|
|
void flagpersonasbad();
|
2012-11-27 18:21:20 -05:00
|
|
|
|
|
|
|
void filterColumnChanged(int column);
|
|
|
|
void filterItems(const QString &text);
|
|
|
|
|
|
|
|
void fillThreadFinished();
|
2012-12-08 21:32:47 -05:00
|
|
|
void fillThreadProgress(int current, int count);
|
|
|
|
void fillThreadStatus(QString text);
|
2012-11-27 18:21:20 -05:00
|
|
|
|
|
|
|
private:
|
2014-11-27 17:45:34 -05:00
|
|
|
void insertMessageData(const RsGxsForumMsg &msg);
|
2012-11-27 18:21:20 -05:00
|
|
|
|
|
|
|
void insertThreads();
|
2014-11-27 17:45:34 -05:00
|
|
|
void insertMessage();
|
2012-11-27 18:21:20 -05: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-08 21:32:47 -05:00
|
|
|
void calculateUnreadCount();
|
2012-11-27 18:21:20 -05:00
|
|
|
|
|
|
|
void togglethreadview_internal();
|
|
|
|
|
|
|
|
bool filterItem(QTreeWidgetItem *item, const QString &text, int filterColumn);
|
|
|
|
|
|
|
|
void processSettings(bool bLoad);
|
|
|
|
|
2014-11-27 17:45:34 -05:00
|
|
|
void requestGroupData();
|
|
|
|
void loadGroupData(const uint32_t &token);
|
2015-05-02 14:50:34 -04:00
|
|
|
void insertGroupData();
|
2015-05-03 08:28:08 -04:00
|
|
|
static void loadAuthorIdCallback(GxsIdDetailsType type, const RsIdentityDetails &details, QObject *object, const QVariant &/*data*/);
|
|
|
|
|
2014-11-27 17:45:34 -05:00
|
|
|
void requestMessageData(const RsGxsGrpMsgIdPair &msgId);
|
|
|
|
void loadMessageData(const uint32_t &token);
|
|
|
|
void requestMsgData_ReplyMessage(const RsGxsGrpMsgIdPair &msgId);
|
|
|
|
void loadMsgData_ReplyMessage(const uint32_t &token);
|
2015-11-19 06:05:52 -05:00
|
|
|
|
|
|
|
void requestMsgData_ReplyForumMessage(const RsGxsGrpMsgIdPair &msgId);
|
|
|
|
void loadMsgData_ReplyForumMessage(const uint32_t &token);
|
|
|
|
void loadMsgData_BanAuthor(const uint32_t &token);
|
2014-11-27 17:45:34 -05:00
|
|
|
|
|
|
|
private:
|
2014-03-17 16:56:06 -04:00
|
|
|
RsGxsGroupId mLastForumID;
|
|
|
|
RsGxsMessageId mThreadId;
|
2015-05-02 14:50:34 -04:00
|
|
|
RsGxsForumGroup mForumGroup;
|
2013-07-04 18:51:43 -04:00
|
|
|
QString mForumDescription;
|
2012-11-27 18:21:20 -05:00
|
|
|
int mSubscribeFlags;
|
2015-10-24 00:22:55 -04:00
|
|
|
int mSignFlags;
|
2012-11-27 18:21:20 -05:00
|
|
|
bool mInProcessSettings;
|
|
|
|
bool mInMsgAsReadUnread;
|
|
|
|
int mLastViewType;
|
|
|
|
RSTreeWidgetItemCompareRole *mThreadCompareRole;
|
2012-12-08 21:32:47 -05:00
|
|
|
GxsForumsFillThread *mFillThread;
|
|
|
|
unsigned int mUnreadCount;
|
|
|
|
unsigned int mNewCount;
|
2012-11-27 18:21:20 -05:00
|
|
|
|
2015-03-13 15:33:37 -04:00
|
|
|
uint32_t mTokenTypeGroupData;
|
|
|
|
uint32_t mTokenTypeInsertThreads;
|
|
|
|
uint32_t mTokenTypeMessageData;
|
|
|
|
uint32_t mTokenTypeReplyMessage;
|
2015-11-19 06:05:52 -05:00
|
|
|
uint32_t mTokenTypeReplyForumMessage;
|
2015-10-11 10:00:11 -04:00
|
|
|
uint32_t mTokenTypeBanAuthor;
|
2015-03-13 15:33:37 -04:00
|
|
|
|
2012-11-27 18:21:20 -05:00
|
|
|
/* Color definitions (for standard see qss.default) */
|
|
|
|
QColor mTextColorRead;
|
|
|
|
QColor mTextColorUnread;
|
|
|
|
QColor mTextColorUnreadChildren;
|
|
|
|
QColor mTextColorNotSubscribed;
|
|
|
|
QColor mTextColorMissing;
|
|
|
|
|
2014-10-25 19:52:33 -04:00
|
|
|
RsGxsMessageId mNavigatePendingMsgId;
|
2014-11-27 17:45:34 -05:00
|
|
|
QList<RsGxsMessageId> mIgnoredMsgId;
|
2014-10-25 19:52:33 -04:00
|
|
|
|
2015-10-09 18:51:16 -04:00
|
|
|
Ui::GxsForumThreadWidget *ui;
|
2012-11-27 18:21:20 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // GXSFORUMTHREADWIDGET_H
|