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