2013-03-15 17:02:43 -04:00
|
|
|
/*
|
|
|
|
* Retroshare Gxs Feed Item
|
2013-03-11 16:53:15 -04:00
|
|
|
*
|
2013-03-15 17:02:43 -04:00
|
|
|
* Copyright 2012-2013 by Robert Fernie.
|
2013-03-11 16:53:15 -04:00
|
|
|
*
|
2013-03-15 17:02:43 -04:00
|
|
|
* 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.
|
2013-03-11 16:53:15 -04:00
|
|
|
*
|
2013-03-15 17:02:43 -04:00
|
|
|
* 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.
|
2013-03-11 16:53:15 -04:00
|
|
|
*
|
2013-03-15 17:02:43 -04:00
|
|
|
* 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".
|
|
|
|
*
|
|
|
|
*/
|
2013-03-11 16:53:15 -04:00
|
|
|
|
|
|
|
#ifndef _GXS_CHANNEL_POST_ITEM_H
|
|
|
|
#define _GXS_CHANNEL_POST_ITEM_H
|
|
|
|
|
2014-07-27 14:29:35 -04:00
|
|
|
#include <QMetaType>
|
|
|
|
|
2013-03-11 16:53:15 -04:00
|
|
|
#include <retroshare/rsgxschannels.h>
|
2013-03-15 17:02:43 -04:00
|
|
|
#include "gui/gxs/GxsFeedItem.h"
|
2013-03-11 16:53:15 -04:00
|
|
|
|
2014-05-05 19:25:17 -04:00
|
|
|
namespace Ui {
|
|
|
|
class GxsChannelPostItem;
|
|
|
|
}
|
|
|
|
|
2013-03-11 16:53:15 -04:00
|
|
|
class FeedHolder;
|
|
|
|
class SubFileItem;
|
|
|
|
|
2014-05-05 19:25:17 -04:00
|
|
|
class GxsChannelPostItem : public GxsFeedItem
|
2013-03-11 16:53:15 -04:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2014-08-01 10:49:58 -04:00
|
|
|
GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate);
|
2014-11-17 19:49:21 -05:00
|
|
|
GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelGroup &group, const RsGxsChannelPost &post, bool isHome, bool autoUpdate);
|
|
|
|
GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost &post, bool isHome, bool autoUpdate);
|
2014-05-05 19:25:17 -04:00
|
|
|
virtual ~GxsChannelPostItem();
|
2013-03-15 17:02:43 -04:00
|
|
|
|
2014-11-17 19:49:21 -05:00
|
|
|
bool setGroup(const RsGxsChannelGroup &group, bool doFill = true);
|
|
|
|
bool setPost(const RsGxsChannelPost &post, bool doFill = true);
|
2014-07-27 14:29:35 -04:00
|
|
|
|
2013-03-11 16:53:15 -04:00
|
|
|
void setFileCleanUpWarning(uint32_t time_left);
|
|
|
|
|
2014-11-19 07:40:42 -05:00
|
|
|
QString getTitleLabel();
|
|
|
|
QString getMsgLabel();
|
2014-05-27 02:57:45 -04:00
|
|
|
const std::list<SubFileItem *> &getFileItems() {return mFileItems; }
|
|
|
|
|
2015-02-22 05:10:34 -05:00
|
|
|
bool isUnread() const ;
|
|
|
|
|
2014-05-27 02:57:45 -04:00
|
|
|
protected:
|
2015-06-17 14:59:12 -04:00
|
|
|
/* FeedItem */
|
|
|
|
virtual void doExpand(bool open);
|
|
|
|
virtual void expandFill(bool first);
|
|
|
|
|
2014-11-17 19:49:21 -05:00
|
|
|
/* GxsGroupFeedItem */
|
|
|
|
virtual QString groupName();
|
|
|
|
virtual void loadGroup(const uint32_t &token);
|
2014-07-26 19:52:45 -04:00
|
|
|
virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_CHANNEL; }
|
2014-11-17 19:49:21 -05:00
|
|
|
|
|
|
|
/* GxsFeedItem */
|
|
|
|
virtual void loadMessage(const uint32_t &token);
|
2014-07-26 19:52:45 -04:00
|
|
|
virtual QString messageName();
|
2013-03-11 16:53:15 -04:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
/* default stuff */
|
|
|
|
void toggle();
|
|
|
|
void readAndClearItem();
|
|
|
|
void download();
|
|
|
|
void play();
|
2013-03-15 17:02:43 -04:00
|
|
|
void loadComments();
|
2013-03-11 16:53:15 -04:00
|
|
|
|
|
|
|
void readToggled(bool checked);
|
|
|
|
|
2013-03-15 17:02:43 -04:00
|
|
|
void unsubscribeChannel();
|
2013-03-11 16:53:15 -04:00
|
|
|
void updateItem();
|
|
|
|
|
2014-04-04 09:55:00 -04:00
|
|
|
void makeUpVote();
|
|
|
|
void makeDownVote();
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void vote(const RsGxsGrpMsgIdPair& msgId, bool up);
|
|
|
|
|
2013-03-11 16:53:15 -04:00
|
|
|
private:
|
|
|
|
void setup();
|
2014-11-17 19:49:21 -05:00
|
|
|
void fill();
|
2015-06-17 14:59:12 -04:00
|
|
|
void fillExpandFrame();
|
2014-05-06 16:55:30 -04:00
|
|
|
void setReadStatus(bool isNew, bool isUnread);
|
|
|
|
|
2014-11-17 19:49:21 -05:00
|
|
|
private:
|
|
|
|
bool mInFill;
|
2014-11-19 07:40:42 -05:00
|
|
|
bool mCloseOnRead;
|
2013-03-11 16:53:15 -04:00
|
|
|
|
2014-11-17 19:49:21 -05:00
|
|
|
RsGxsChannelGroup mGroup;
|
2013-03-15 17:02:43 -04:00
|
|
|
RsGxsChannelPost mPost;
|
2013-03-11 16:53:15 -04:00
|
|
|
|
2014-05-05 19:34:28 -04:00
|
|
|
std::list<SubFileItem*> mFileItems;
|
2014-05-05 19:25:17 -04:00
|
|
|
|
|
|
|
/** Qt Designer generated object */
|
|
|
|
Ui::GxsChannelPostItem *ui;
|
2013-03-11 16:53:15 -04:00
|
|
|
};
|
|
|
|
|
2014-07-27 14:29:35 -04:00
|
|
|
Q_DECLARE_METATYPE(RsGxsChannelPost)
|
|
|
|
|
2013-03-11 16:53:15 -04:00
|
|
|
#endif
|