2014-05-04 22:59:06 +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_CHANNELPOSTSWIDGET_H
|
|
|
|
#define _GXS_CHANNELPOSTSWIDGET_H
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
#include "gui/gxs/GxsMessageFrameWidget.h"
|
|
|
|
|
|
|
|
#include "gui/feeds/FeedHolder.h"
|
|
|
|
|
|
|
|
#include "util/TokenQueue.h"
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class GxsChannelPostsWidget;
|
|
|
|
}
|
|
|
|
|
|
|
|
//class ChanMsgItem;
|
|
|
|
class GxsChannelPostItem;
|
|
|
|
class QTreeWidgetItem;
|
|
|
|
class UIStateHelper;
|
|
|
|
class QBoxLayout;
|
|
|
|
|
|
|
|
class GxsChannelPostsWidget : public GxsMessageFrameWidget, public TokenResponse, public FeedHolder
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
/** Default Constructor */
|
|
|
|
GxsChannelPostsWidget(const RsGxsGroupId &channelId, QWidget *parent = 0);
|
|
|
|
/** Default Destructor */
|
|
|
|
~GxsChannelPostsWidget();
|
|
|
|
|
|
|
|
/* GxsMessageFrameWidget */
|
|
|
|
virtual RsGxsGroupId groupId() { return mChannelId; }
|
|
|
|
virtual void setGroupId(const RsGxsGroupId &channelId);
|
|
|
|
virtual QString groupName(bool withUnreadCount);
|
|
|
|
virtual QIcon groupIcon();
|
|
|
|
virtual void setAllMessagesRead(bool read);
|
|
|
|
|
|
|
|
/* FeedHolder */
|
|
|
|
virtual QScrollArea *getScrollArea();
|
|
|
|
virtual void deleteFeedItem(QWidget *item, uint32_t type);
|
|
|
|
virtual void openChat(const RsPeerId& peerId);
|
|
|
|
virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title);
|
|
|
|
|
|
|
|
/* NEW GXS FNS */
|
|
|
|
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void updateDisplay(bool complete);
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void createMsg();
|
2014-07-05 18:33:11 +00:00
|
|
|
void toggleAutoDownload();
|
|
|
|
void subscribeGroup(bool subscribe);
|
2014-05-27 06:57:45 +00:00
|
|
|
void filterChanged(int filter);
|
|
|
|
void filterItems(const QString& text);
|
2014-05-04 22:59:06 +00:00
|
|
|
|
|
|
|
//void fillThreadFinished();
|
|
|
|
//void fillThreadAddMsg(const QString &channelId, const QString &channelMsgId, int current, int count);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void processSettings(bool load);
|
|
|
|
|
2014-07-05 18:33:11 +00:00
|
|
|
void setAutoDownload(bool autoDl);
|
2014-05-05 21:53:47 +00:00
|
|
|
void clearPosts();
|
2014-05-04 22:59:06 +00:00
|
|
|
|
|
|
|
/* NEW GXS FNS */
|
2014-07-22 15:04:36 +00:00
|
|
|
void requestGroupData();
|
2014-05-04 22:59:06 +00:00
|
|
|
void loadGroupData(const uint32_t &token);
|
|
|
|
|
2014-07-22 15:04:36 +00:00
|
|
|
void requestPosts();
|
2014-05-04 22:59:06 +00:00
|
|
|
void loadPosts(const uint32_t &token);
|
|
|
|
|
2014-07-22 15:04:36 +00:00
|
|
|
void requestRelatedPosts(const std::vector<RsGxsMessageId> &msgIds);
|
2014-05-05 21:53:47 +00:00
|
|
|
void loadRelatedPosts(const uint32_t &token);
|
|
|
|
|
2014-05-04 22:59:06 +00:00
|
|
|
void insertChannelDetails(const RsGxsChannelGroup &group);
|
2014-05-05 21:53:47 +00:00
|
|
|
void insertChannelPosts(std::vector<RsGxsChannelPost> &posts, bool related);
|
2014-05-04 22:59:06 +00:00
|
|
|
|
|
|
|
void acknowledgeMessageUpdate(const uint32_t &token);
|
|
|
|
|
2014-05-27 06:57:45 +00:00
|
|
|
bool filterItem(GxsChannelPostItem *pItem, const QString &text, const int filter);
|
|
|
|
|
2014-05-04 22:59:06 +00:00
|
|
|
RsGxsGroupId mChannelId; /* current Channel */
|
2014-07-06 19:25:51 +00:00
|
|
|
int mSubscribeFlags;
|
2014-05-04 22:59:06 +00:00
|
|
|
TokenQueue *mChannelQueue;
|
|
|
|
|
|
|
|
/* Layout Pointers */
|
|
|
|
QBoxLayout *mMsgLayout;
|
|
|
|
|
|
|
|
//QList<ChanMsgItem *> mChanMsgItems;
|
|
|
|
QList<GxsChannelPostItem *> mChannelPostItems;
|
|
|
|
|
2014-07-05 18:33:11 +00:00
|
|
|
QAction *mAutoDownloadAction;
|
2014-05-04 22:59:06 +00:00
|
|
|
|
|
|
|
UIStateHelper *mStateHelper;
|
|
|
|
|
2014-05-27 06:57:45 +00:00
|
|
|
bool mInProcessSettings;
|
|
|
|
|
2014-05-04 22:59:06 +00:00
|
|
|
/* UI - from Designer */
|
|
|
|
Ui::GxsChannelPostsWidget *ui;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|