2008-06-20 08:43:23 -04: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
|
2009-09-12 06:55:40 -04:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
2008-06-20 08:43:23 -04:00
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
****************************************************************/
|
|
|
|
|
|
|
|
#ifndef _CHANNEL_FEED_DIALOG_H
|
|
|
|
#define _CHANNEL_FEED_DIALOG_H
|
|
|
|
|
2010-10-06 20:17:42 -04:00
|
|
|
#include <retroshare/rschannels.h>
|
2010-10-17 10:43:49 -04:00
|
|
|
#include <QStandardItemModel>
|
2012-04-21 09:00:17 -04:00
|
|
|
#include <QThread>
|
2010-10-25 16:46:26 -04:00
|
|
|
#include <map>
|
2010-10-06 20:17:42 -04:00
|
|
|
|
2008-06-20 08:43:23 -04:00
|
|
|
#include "mainpage.h"
|
2010-07-23 07:55:21 -04:00
|
|
|
#include "RsAutoUpdatePage.h"
|
|
|
|
|
2008-06-20 08:43:23 -04:00
|
|
|
#include "ui_ChannelFeed.h"
|
|
|
|
|
|
|
|
#include "gui/feeds/FeedHolder.h"
|
|
|
|
|
2008-06-24 00:36:45 -04:00
|
|
|
class ChanMsgItem;
|
2010-12-26 19:15:25 -05:00
|
|
|
class QTreeWidgetItem;
|
2012-04-21 09:00:17 -04:00
|
|
|
class ChannelFillThread;
|
2008-06-24 00:36:45 -04:00
|
|
|
|
2010-07-23 07:55:21 -04:00
|
|
|
class ChannelFeed : public RsAutoUpdatePage, public FeedHolder, private Ui::ChannelFeed
|
2008-06-20 08:43:23 -04:00
|
|
|
{
|
2010-10-06 20:17:42 -04:00
|
|
|
Q_OBJECT
|
2008-06-20 08:43:23 -04:00
|
|
|
|
|
|
|
public:
|
2010-10-06 20:17:42 -04:00
|
|
|
/** Default Constructor */
|
|
|
|
ChannelFeed(QWidget *parent = 0);
|
|
|
|
/** Default Destructor */
|
2011-01-04 15:19:45 -05:00
|
|
|
~ChannelFeed();
|
2008-06-20 08:43:23 -04:00
|
|
|
|
2012-08-05 16:12:55 -04:00
|
|
|
virtual UserNotify *getUserNotify(QObject *parent);
|
|
|
|
|
2012-10-08 19:06:34 -04:00
|
|
|
/* FeedHolder */
|
|
|
|
virtual QScrollArea *getScrollArea();
|
2010-07-23 07:55:21 -04:00
|
|
|
virtual void deleteFeedItem(QWidget *item, uint32_t type);
|
|
|
|
virtual void openChat(std::string peerId);
|
2013-03-15 17:02:43 -04:00
|
|
|
virtual void openComments(uint32_t /*type*/ , const RsGxsGroupId & /*grpId */, const RsGxsMessageId & /*msgId*/, const QString & /*title */);
|
2010-07-23 07:55:21 -04:00
|
|
|
|
2011-04-19 15:42:44 -04:00
|
|
|
bool navigate(const std::string& channelId, const std::string& msgId);
|
|
|
|
|
2010-07-23 07:55:21 -04:00
|
|
|
/* overloaded from RsAuthUpdatePage */
|
|
|
|
virtual void updateDisplay();
|
2008-06-20 08:43:23 -04:00
|
|
|
|
2008-06-24 00:36:45 -04:00
|
|
|
private slots:
|
2010-07-23 07:55:21 -04:00
|
|
|
void channelListCustomPopupMenu( QPoint point );
|
2010-12-26 19:15:25 -05:00
|
|
|
void selectChannel(const QString &id);
|
2008-06-24 00:36:45 -04:00
|
|
|
|
2010-10-06 20:17:42 -04:00
|
|
|
void createChannel();
|
|
|
|
|
|
|
|
void subscribeChannel();
|
|
|
|
void unsubscribeChannel();
|
|
|
|
void setAllAsReadClicked();
|
2011-04-07 18:10:10 -04:00
|
|
|
void toggleAutoDownload();
|
2008-06-24 00:36:45 -04:00
|
|
|
|
2010-10-06 20:17:42 -04:00
|
|
|
void createMsg();
|
2010-01-18 16:02:16 -05:00
|
|
|
|
2010-07-23 07:55:21 -04:00
|
|
|
void showChannelDetails();
|
|
|
|
void restoreChannelKeys();
|
|
|
|
void editChannelDetail();
|
|
|
|
void shareKey();
|
2011-04-19 15:42:44 -04:00
|
|
|
void copyChannelLink();
|
2008-07-04 10:41:24 -04:00
|
|
|
|
2010-10-06 20:17:42 -04:00
|
|
|
void channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status);
|
2008-06-24 00:36:45 -04:00
|
|
|
|
2012-04-21 09:00:17 -04:00
|
|
|
void generateMassData();
|
|
|
|
|
|
|
|
void fillThreadFinished();
|
2012-04-24 11:34:22 -04:00
|
|
|
void fillThreadAddMsg(const QString &channelId, const QString &channelMsgId, int current, int count);
|
2012-04-21 09:00:17 -04:00
|
|
|
|
2010-10-06 20:17:42 -04:00
|
|
|
private:
|
|
|
|
void updateChannelList();
|
|
|
|
void updateChannelMsgs();
|
|
|
|
void updateMessageSummaryList(const std::string &channelId);
|
2009-09-12 06:55:40 -04:00
|
|
|
|
2011-01-04 15:19:45 -05:00
|
|
|
void processSettings(bool load);
|
|
|
|
|
2011-04-19 15:42:44 -04:00
|
|
|
void setAutoDownloadButton(bool autoDl);
|
|
|
|
|
2010-10-06 20:17:42 -04:00
|
|
|
std::string mChannelId; /* current Channel */
|
2008-06-24 00:36:45 -04:00
|
|
|
|
2010-10-06 20:17:42 -04:00
|
|
|
/* Layout Pointers */
|
|
|
|
QBoxLayout *mMsgLayout;
|
2009-09-12 06:55:40 -04:00
|
|
|
|
2012-04-21 09:00:17 -04:00
|
|
|
QList<ChanMsgItem *> mChanMsgItems;
|
2010-10-25 16:46:26 -04:00
|
|
|
std::map<std::string, uint32_t> mChanSearchScore; //chanId, score
|
2008-06-24 00:36:45 -04:00
|
|
|
|
2010-12-26 19:15:25 -05:00
|
|
|
QTreeWidgetItem *ownChannels;
|
|
|
|
QTreeWidgetItem *subcribedChannels;
|
|
|
|
QTreeWidgetItem *popularChannels;
|
|
|
|
QTreeWidgetItem *otherChannels;
|
2012-04-21 09:00:17 -04:00
|
|
|
|
|
|
|
ChannelFillThread *fillThread;
|
2010-10-17 10:43:49 -04:00
|
|
|
};
|
2008-06-20 08:43:23 -04:00
|
|
|
|
2012-04-21 09:00:17 -04:00
|
|
|
class ChannelFillThread : public QThread
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChannelFillThread(ChannelFeed *parent, const std::string &channelId);
|
|
|
|
~ChannelFillThread();
|
2008-06-20 08:43:23 -04:00
|
|
|
|
2012-04-21 09:00:17 -04:00
|
|
|
void run();
|
|
|
|
void stop();
|
|
|
|
bool wasStopped() { return stopped; }
|
|
|
|
|
|
|
|
signals:
|
2012-04-24 11:34:22 -04:00
|
|
|
void addMsg(const QString &channelId, const QString &channelMsgId, int current, int count);
|
2012-04-21 09:00:17 -04:00
|
|
|
|
|
|
|
public:
|
|
|
|
std::string channelId;
|
|
|
|
|
|
|
|
private:
|
|
|
|
volatile bool stopped;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|