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>
|
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"
|
|
|
|
|
2010-10-17 10:43:49 -04:00
|
|
|
|
|
|
|
|
2009-09-12 06:55:40 -04:00
|
|
|
#define OWN 0
|
|
|
|
#define SUBSCRIBED 1
|
|
|
|
#define POPULAR 2
|
|
|
|
#define OTHER 3
|
|
|
|
|
2008-06-24 00:36:45 -04:00
|
|
|
class ChanMsgItem;
|
2010-07-23 14:52:58 -04:00
|
|
|
class QStandardItemModel;
|
2010-10-06 20:17:42 -04:00
|
|
|
class QStandardItem;
|
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 */
|
2008-06-20 08:43:23 -04:00
|
|
|
|
|
|
|
|
2010-07-23 07:55:21 -04:00
|
|
|
virtual void deleteFeedItem(QWidget *item, uint32_t type);
|
|
|
|
virtual void openChat(std::string peerId);
|
|
|
|
|
|
|
|
/* overloaded from RsAuthUpdatePage */
|
|
|
|
virtual void updateDisplay();
|
2008-06-20 08:43:23 -04:00
|
|
|
|
2008-06-24 00:36:45 -04:00
|
|
|
public slots:
|
2010-10-06 20:17:42 -04:00
|
|
|
void selectChannel(QModelIndex index);
|
2008-06-24 00:36:45 -04:00
|
|
|
|
|
|
|
private slots:
|
2010-07-23 07:55:21 -04:00
|
|
|
void channelListCustomPopupMenu( QPoint point );
|
2008-06-24 00:36:45 -04:00
|
|
|
|
2010-10-06 20:17:42 -04:00
|
|
|
void createChannel();
|
|
|
|
|
|
|
|
void channelSelection();
|
2008-06-24 00:36:45 -04:00
|
|
|
|
2010-10-06 20:17:42 -04:00
|
|
|
void subscribeChannel();
|
|
|
|
void unsubscribeChannel();
|
|
|
|
void setAllAsReadClicked();
|
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();
|
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);
|
2010-10-25 16:46:26 -04:00
|
|
|
void filterRegExpChanged();
|
2010-10-17 10:43:49 -04:00
|
|
|
void finishSearching();
|
2008-06-24 00:36:45 -04:00
|
|
|
|
2010-10-06 20:17:42 -04:00
|
|
|
private:
|
2010-11-06 20:02:51 -04:00
|
|
|
void highlightPrivateKeys(int group);
|
2010-10-06 20:17:42 -04:00
|
|
|
void updateChannelList();
|
|
|
|
void fillChannelList(int channelItem, std::list<ChannelInfo> &channelInfos);
|
2010-10-25 16:46:26 -04:00
|
|
|
void filterChannelList(std::list<ChannelInfo>&);
|
2010-10-06 20:17:42 -04:00
|
|
|
void updateChannelMsgs();
|
|
|
|
void updateMessageSummaryList(const std::string &channelId);
|
2009-09-12 06:55:40 -04:00
|
|
|
|
2010-10-06 20:17:42 -04:00
|
|
|
QStandardItemModel *model;
|
2008-06-24 00:36:45 -04:00
|
|
|
|
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
|
|
|
|
2010-10-06 20:17:42 -04:00
|
|
|
std::list<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-10-06 20:17:42 -04:00
|
|
|
QFont mChannelFont;
|
|
|
|
QFont itemFont;
|
2008-06-20 08:43:23 -04:00
|
|
|
};
|
|
|
|
|
2010-10-17 10:43:49 -04:00
|
|
|
class QChannelItem : public QStandardItem
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
QChannelItem();
|
|
|
|
virtual ~QChannelItem();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* reimplementing comparison operator so QChannelItems can be ordered in terms
|
|
|
|
* of occurences of property searchText in its data columns
|
|
|
|
*/
|
|
|
|
bool operator<(const QStandardItem& other) const;
|
|
|
|
|
|
|
|
};
|
2008-06-20 08:43:23 -04:00
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|