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.
|
|
|
|
****************************************************************/
|
|
|
|
#include <QtGui>
|
|
|
|
|
2008-06-24 00:36:45 -04:00
|
|
|
#include <iostream>
|
2008-11-02 10:20:42 -05:00
|
|
|
#include <algorithm>
|
2008-06-24 00:36:45 -04:00
|
|
|
|
|
|
|
#include "rsiface/rschannels.h"
|
|
|
|
|
2008-06-20 08:43:23 -04:00
|
|
|
#include "ChannelFeed.h"
|
2010-01-29 20:13:03 -05:00
|
|
|
|
2008-06-20 08:43:23 -04:00
|
|
|
#include "gui/feeds/ChanMsgItem.h"
|
|
|
|
|
2010-05-02 07:43:04 -04:00
|
|
|
#include "gui/channels/CreateChannel.h"
|
2010-01-19 19:29:40 -05:00
|
|
|
#include "gui/channels/ChannelDetails.h"
|
2010-01-29 20:13:03 -05:00
|
|
|
#include "gui/channels/CreateChannelMsg.h"
|
2010-06-04 18:52:01 -04:00
|
|
|
#include "gui/channels/EditChanDetails.h"
|
2008-06-24 00:36:45 -04:00
|
|
|
|
2009-09-12 06:55:40 -04:00
|
|
|
#include "gui/ChanGroupDelegate.h"
|
2008-06-24 00:36:45 -04:00
|
|
|
|
2010-05-14 09:06:58 -04:00
|
|
|
#define CHAN_DEFAULT_IMAGE ":/images/channels.png"
|
|
|
|
|
2008-07-09 05:53:47 -04:00
|
|
|
/****
|
|
|
|
* #define CHAN_DEBUG
|
|
|
|
***/
|
2008-06-24 00:36:45 -04:00
|
|
|
|
2008-06-20 08:43:23 -04:00
|
|
|
/** Constructor */
|
|
|
|
ChannelFeed::ChannelFeed(QWidget *parent)
|
|
|
|
: MainPage (parent)
|
|
|
|
{
|
2008-06-24 00:36:45 -04:00
|
|
|
/* Invoke the Qt Designer generated object setup routine */
|
|
|
|
setupUi(this);
|
2008-06-20 08:43:23 -04:00
|
|
|
|
2010-01-04 20:49:58 -05:00
|
|
|
connect(actionCreate_Channel, SIGNAL(triggered()), this, SLOT(createChannel()));
|
2010-01-18 16:02:16 -05:00
|
|
|
connect(postButton, SIGNAL(clicked()), this, SLOT(createMsg()));
|
2008-07-04 10:41:24 -04:00
|
|
|
connect(subscribeButton, SIGNAL( clicked( void ) ), this, SLOT( subscribeChannel ( void ) ) );
|
|
|
|
connect(unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeChannel ( void ) ) );
|
2008-06-20 08:43:23 -04:00
|
|
|
|
2008-06-24 00:36:45 -04:00
|
|
|
/*************** Setup Left Hand Side (List of Channels) ****************/
|
2008-06-20 08:43:23 -04:00
|
|
|
|
2009-09-12 06:55:40 -04:00
|
|
|
mChannelId = "";
|
2010-03-05 06:58:35 -05:00
|
|
|
model = new QStandardItemModel(0, 3, this);
|
2009-09-12 06:55:40 -04:00
|
|
|
model->setHeaderData(0, Qt::Horizontal, tr("Name"), Qt::DisplayRole);
|
2010-03-05 06:58:35 -05:00
|
|
|
model->setHeaderData(1, Qt::Horizontal, tr("Popularity"), Qt::DisplayRole);
|
|
|
|
model->setHeaderData(2, Qt::Horizontal, tr("ID"), Qt::DisplayRole);
|
2009-09-12 06:55:40 -04:00
|
|
|
|
|
|
|
treeView->setModel(model);
|
|
|
|
treeView->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
|
|
|
|
|
|
|
treeView->setItemDelegate(new ChanGroupDelegate());
|
|
|
|
treeView->setRootIsDecorated(false);
|
2008-06-24 00:36:45 -04:00
|
|
|
|
2009-09-12 06:55:40 -04:00
|
|
|
// hide header and id column
|
|
|
|
treeView->setHeaderHidden(true);
|
2010-03-05 06:58:35 -05:00
|
|
|
treeView->hideColumn(2);
|
|
|
|
|
|
|
|
/* Set header resize modes and initial section sizes TreeView*/
|
|
|
|
QHeaderView * _header = treeView->header () ;
|
|
|
|
_header->setResizeMode ( 1, QHeaderView::Custom);
|
|
|
|
_header->resizeSection ( 0, 190 );
|
|
|
|
_header->resizeSection ( 1, 22 );
|
|
|
|
_header->resizeSection ( 2, 22 );
|
2009-09-14 19:27:05 -04:00
|
|
|
|
|
|
|
QStandardItem *item1 = new QStandardItem(tr("Own Channels"));
|
|
|
|
QStandardItem *item2 = new QStandardItem(tr("Subscribed Channels"));
|
|
|
|
QStandardItem *item3 = new QStandardItem(tr("Popular Channels"));
|
|
|
|
QStandardItem *item4 = new QStandardItem(tr("Other Channels"));
|
2009-09-12 06:55:40 -04:00
|
|
|
|
|
|
|
model->appendRow(item1);
|
|
|
|
model->appendRow(item2);
|
|
|
|
model->appendRow(item3);
|
|
|
|
model->appendRow(item4);
|
|
|
|
|
2009-09-12 15:32:54 -04:00
|
|
|
connect(treeView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(selectChannel(const QModelIndex &)));
|
2009-09-12 06:55:40 -04:00
|
|
|
connect(treeView, SIGNAL(activated(const QModelIndex &)), this, SLOT(toggleSelection(const QModelIndex &)));
|
2010-01-19 19:29:40 -05:00
|
|
|
connect(treeView, SIGNAL(customContextMenuRequested( QPoint ) ), this, SLOT( channelListCustomPopupMenu( QPoint ) ) );
|
2009-09-12 06:55:40 -04:00
|
|
|
|
|
|
|
//added from ahead
|
2008-06-24 00:36:45 -04:00
|
|
|
updateChannelList();
|
2009-09-12 06:55:40 -04:00
|
|
|
|
2009-09-13 12:33:59 -04:00
|
|
|
mChannelFont = QFont("MS SANS SERIF", 22);
|
2009-09-14 19:27:05 -04:00
|
|
|
nameLabel->setFont(mChannelFont);
|
2009-09-13 12:33:59 -04:00
|
|
|
|
2009-09-14 19:27:05 -04:00
|
|
|
nameLabel->setMinimumWidth(20);
|
2010-01-29 20:13:03 -05:00
|
|
|
|
|
|
|
// set ChannelList Font
|
2009-09-14 19:27:05 -04:00
|
|
|
itemFont = QFont("ARIAL", 10);
|
|
|
|
itemFont.setBold(true);
|
|
|
|
item1->setFont(itemFont);
|
|
|
|
item2->setFont(itemFont);
|
|
|
|
item3->setFont(itemFont);
|
|
|
|
item4->setFont(itemFont);
|
2010-01-29 20:13:03 -05:00
|
|
|
|
|
|
|
// set ChannelList Foreground Color
|
2009-09-15 20:01:09 -04:00
|
|
|
item1->setForeground(QBrush(QColor(79, 79, 79)));
|
|
|
|
item2->setForeground(QBrush(QColor(79, 79, 79)));
|
|
|
|
item3->setForeground(QBrush(QColor(79, 79, 79)));
|
|
|
|
item4->setForeground(QBrush(QColor(79, 79, 79)));
|
2010-01-04 20:49:58 -05:00
|
|
|
|
2010-01-29 20:13:03 -05:00
|
|
|
// Setup Channel Menu:
|
2010-01-04 20:49:58 -05:00
|
|
|
QMenu *channelmenu = new QMenu();
|
|
|
|
channelmenu->addAction(actionCreate_Channel);
|
|
|
|
channelmenu->addSeparator();
|
|
|
|
channelpushButton->setMenu(channelmenu);
|
2009-09-15 20:01:09 -04:00
|
|
|
|
2009-09-14 19:27:05 -04:00
|
|
|
|
2008-06-24 00:36:45 -04:00
|
|
|
QTimer *timer = new QTimer(this);
|
|
|
|
timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate()));
|
|
|
|
timer->start(1000);
|
2008-06-20 08:43:23 -04:00
|
|
|
}
|
|
|
|
|
2010-01-19 19:29:40 -05:00
|
|
|
void ChannelFeed::channelListCustomPopupMenu( QPoint point )
|
|
|
|
{
|
2010-05-04 20:05:36 -04:00
|
|
|
ChannelInfo ci;
|
|
|
|
if (!rsChannels->getChannelInfo(mChannelId, ci))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-01-19 19:29:40 -05:00
|
|
|
QMenu contextMnu( this );
|
|
|
|
|
2010-03-05 06:58:35 -05:00
|
|
|
postchannelAct = new QAction(QIcon(":/images/mail_reply.png"), tr( "Post to Channel" ), this );
|
2010-02-28 16:59:39 -05:00
|
|
|
connect( postchannelAct , SIGNAL( triggered() ), this, SLOT( createMsg() ) );
|
|
|
|
|
2010-03-05 06:58:35 -05:00
|
|
|
subscribechannelAct = new QAction(QIcon(":/images/edit_add24.png"), tr( "Subscribe to Channel" ), this );
|
2010-02-28 16:59:39 -05:00
|
|
|
connect( subscribechannelAct , SIGNAL( triggered() ), this, SLOT( subscribeChannel() ) );
|
|
|
|
|
2010-03-05 06:58:35 -05:00
|
|
|
unsubscribechannelAct = new QAction(QIcon(":/images/cancel.png"), tr( "Unsubscribe to Channel" ), this );
|
2010-02-28 16:59:39 -05:00
|
|
|
connect( unsubscribechannelAct , SIGNAL( triggered() ), this, SLOT( unsubscribeChannel() ) );
|
|
|
|
|
2010-03-05 06:58:35 -05:00
|
|
|
channeldetailsAct = new QAction(QIcon(":/images/info16.png"), tr( "Show Channel Details" ), this );
|
2010-01-19 19:29:40 -05:00
|
|
|
connect( channeldetailsAct , SIGNAL( triggered() ), this, SLOT( showChannelDetails() ) );
|
|
|
|
|
2010-05-19 18:43:07 -04:00
|
|
|
restoreKeysAct = new QAction(QIcon(":/images/settings16.png"), tr("Restore Publish Rights for Channel" ), this );
|
|
|
|
connect( restoreKeysAct , SIGNAL( triggered() ), this, SLOT( restoreChannelKeys() ) );
|
|
|
|
|
2010-06-04 18:52:01 -04:00
|
|
|
editChannelDetailAct = new QAction(QIcon(":/images/settings16.png"), tr("Edit Channel Details"), this);
|
|
|
|
connect( editChannelDetailAct, SIGNAL( triggered() ), this, SLOT( editChannelDetail() ) );
|
|
|
|
|
|
|
|
if(ci.channelFlags & (RS_DISTRIB_PUBLISH | RS_DISTRIB_ADMIN)){
|
|
|
|
contextMnu.addAction( postchannelAct );
|
|
|
|
contextMnu.addSeparator();
|
|
|
|
contextMnu.addAction( channeldetailsAct );
|
|
|
|
contextMnu.addAction( editChannelDetailAct);
|
|
|
|
}
|
|
|
|
else if (ci.channelFlags & RS_DISTRIB_PUBLISH)
|
2010-02-28 16:59:39 -05:00
|
|
|
{
|
|
|
|
contextMnu.addAction( postchannelAct );
|
|
|
|
contextMnu.addSeparator();
|
|
|
|
contextMnu.addAction( channeldetailsAct );
|
|
|
|
}
|
|
|
|
else if (ci.channelFlags & RS_DISTRIB_SUBSCRIBED)
|
|
|
|
{
|
2010-05-19 18:43:07 -04:00
|
|
|
|
2010-02-28 16:59:39 -05:00
|
|
|
contextMnu.addAction( unsubscribechannelAct );
|
|
|
|
contextMnu.addSeparator();
|
2010-05-19 18:43:07 -04:00
|
|
|
contextMnu.addAction( channeldetailsAct );
|
|
|
|
contextMnu.addAction( restoreKeysAct );
|
2010-02-28 16:59:39 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-05-19 18:43:07 -04:00
|
|
|
|
2010-02-28 16:59:39 -05:00
|
|
|
contextMnu.addAction( subscribechannelAct );
|
|
|
|
contextMnu.addSeparator();
|
|
|
|
contextMnu.addAction( channeldetailsAct );
|
2010-05-19 18:43:07 -04:00
|
|
|
contextMnu.addAction( restoreKeysAct );
|
2010-02-28 16:59:39 -05:00
|
|
|
}
|
2010-01-19 19:29:40 -05:00
|
|
|
|
2010-05-14 16:55:44 -04:00
|
|
|
contextMnu.exec(QCursor::pos());
|
2010-01-19 19:29:40 -05:00
|
|
|
}
|
2008-06-20 08:43:23 -04:00
|
|
|
|
2008-06-24 00:36:45 -04:00
|
|
|
void ChannelFeed::createChannel()
|
|
|
|
{
|
2010-05-04 20:05:36 -04:00
|
|
|
CreateChannel cf (this);
|
2009-08-14 07:49:15 -04:00
|
|
|
|
2010-05-04 20:05:36 -04:00
|
|
|
cf.setWindowTitle(tr("Create a new Channel"));
|
|
|
|
cf.ui.labelicon->setPixmap(QPixmap(":/images/add_channel64.png"));
|
2009-12-21 18:55:52 -05:00
|
|
|
QString titleStr("<span style=\"font-size:24pt; font-weight:500;"
|
|
|
|
"color:#32CD32;\">%1</span>");
|
2010-05-04 20:05:36 -04:00
|
|
|
cf.ui.textlabelcreatforums->setText( titleStr.arg( tr("New Channel") ) ) ;
|
|
|
|
cf.exec();
|
2008-06-24 00:36:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void ChannelFeed::channelSelection()
|
|
|
|
{
|
|
|
|
/* which item was selected? */
|
|
|
|
|
|
|
|
|
|
|
|
/* update mChannelId */
|
|
|
|
|
|
|
|
updateChannelMsgs();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************************/
|
|
|
|
/*************************************************************************************/
|
|
|
|
/*************************************************************************************/
|
2008-06-20 08:43:23 -04:00
|
|
|
|
|
|
|
void ChannelFeed::deleteFeedItem(QWidget *item, uint32_t type)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChannelFeed::openChat(std::string peerId)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-06-04 18:52:01 -04:00
|
|
|
void ChannelFeed::editChannelDetail(){
|
|
|
|
|
|
|
|
EditChanDetails editUi(this, 0, mChannelId);
|
|
|
|
editUi.exec();
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-01-18 16:02:16 -05:00
|
|
|
void ChannelFeed::createMsg()
|
|
|
|
{
|
|
|
|
if (mChannelId == "")
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
CreateChannelMsg *msgDialog = new CreateChannelMsg(mChannelId);
|
|
|
|
|
|
|
|
msgDialog->show();
|
2010-05-04 20:05:36 -04:00
|
|
|
|
|
|
|
/* window will destroy itself! */
|
2010-01-18 16:02:16 -05:00
|
|
|
}
|
|
|
|
|
2008-06-24 00:36:45 -04:00
|
|
|
void ChannelFeed::selectChannel( std::string cId)
|
|
|
|
{
|
|
|
|
mChannelId = cId;
|
|
|
|
|
|
|
|
updateChannelMsgs();
|
|
|
|
}
|
|
|
|
|
2010-05-19 18:43:07 -04:00
|
|
|
void ChannelFeed::restoreChannelKeys(){
|
|
|
|
|
|
|
|
rsChannels->channelRestoreKeys(mChannelId);
|
|
|
|
}
|
|
|
|
|
2009-09-12 06:55:40 -04:00
|
|
|
void ChannelFeed::selectChannel(const QModelIndex &index)
|
|
|
|
{
|
|
|
|
int row = index.row();
|
|
|
|
int col = index.column();
|
2010-03-05 06:58:35 -05:00
|
|
|
if (col != 2) {
|
|
|
|
QModelIndex sibling = index.sibling(row, 2);
|
2009-09-12 06:55:40 -04:00
|
|
|
if (sibling.isValid())
|
|
|
|
mChannelId = sibling.data().toString().toStdString();
|
|
|
|
} else
|
|
|
|
mChannelId = index.data().toString().toStdString();
|
|
|
|
updateChannelMsgs();
|
|
|
|
}
|
|
|
|
|
2008-06-24 00:36:45 -04:00
|
|
|
void ChannelFeed::checkUpdate()
|
|
|
|
{
|
|
|
|
std::list<std::string> chanIds;
|
|
|
|
std::list<std::string>::iterator it;
|
|
|
|
if (!rsChannels)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (rsChannels->channelsChanged(chanIds))
|
|
|
|
{
|
|
|
|
/* update Forums List */
|
|
|
|
updateChannelList();
|
|
|
|
|
|
|
|
it = std::find(chanIds.begin(), chanIds.end(), mChannelId);
|
|
|
|
if (it != chanIds.end())
|
|
|
|
{
|
|
|
|
updateChannelMsgs();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChannelFeed::updateChannelList()
|
|
|
|
{
|
|
|
|
|
|
|
|
std::list<ChannelInfo> channelList;
|
|
|
|
std::list<ChannelInfo>::iterator it;
|
|
|
|
if (!rsChannels)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
rsChannels->getChannelList(channelList);
|
|
|
|
|
|
|
|
/* get the ids for our lists */
|
|
|
|
std::list<std::string> adminIds;
|
|
|
|
std::list<std::string> subIds;
|
|
|
|
std::list<std::string> popIds;
|
|
|
|
std::list<std::string> otherIds;
|
|
|
|
std::multimap<uint32_t, std::string> popMap;
|
|
|
|
|
|
|
|
for(it = channelList.begin(); it != channelList.end(); it++)
|
|
|
|
{
|
|
|
|
/* sort it into Publish (Own), Subscribed, Popular and Other */
|
|
|
|
uint32_t flags = it->channelFlags;
|
|
|
|
|
|
|
|
if (flags & RS_DISTRIB_ADMIN)
|
|
|
|
{
|
|
|
|
adminIds.push_back(it->channelId);
|
|
|
|
}
|
|
|
|
else if (flags & RS_DISTRIB_SUBSCRIBED)
|
|
|
|
{
|
|
|
|
subIds.push_back(it->channelId);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* rate the others by popularity */
|
|
|
|
popMap.insert(std::make_pair(it->pop, it->channelId));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* iterate backwards through popMap - take the top 5 or 10% of list */
|
|
|
|
uint32_t popCount = 5;
|
|
|
|
if (popCount < popMap.size() / 10)
|
|
|
|
{
|
|
|
|
popCount = popMap.size() / 10;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t i = 0;
|
|
|
|
std::multimap<uint32_t, std::string>::reverse_iterator rit;
|
2010-05-25 18:53:35 -04:00
|
|
|
for(rit = popMap.rbegin(); rit != popMap.rend(); rit++)
|
2008-06-24 00:36:45 -04:00
|
|
|
{
|
2010-05-25 18:53:35 -04:00
|
|
|
if(i < popCount){
|
|
|
|
popIds.push_back(rit->second);
|
|
|
|
i++;
|
|
|
|
}else{
|
|
|
|
otherIds.push_back(rit->second);
|
2008-06-24 00:36:45 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* now we have our lists ---> update entries */
|
|
|
|
|
|
|
|
updateChannelListOwn(adminIds);
|
|
|
|
updateChannelListSub(subIds);
|
|
|
|
updateChannelListPop(popIds);
|
|
|
|
updateChannelListOther(otherIds);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChannelFeed::updateChannelListOwn(std::list<std::string> &ids)
|
|
|
|
{
|
2010-01-29 20:13:03 -05:00
|
|
|
std::list<std::string>::iterator iit;
|
|
|
|
|
|
|
|
/* remove rows with groups before adding new ones */
|
|
|
|
model->item(OWN)->removeRows(0, model->item(OWN)->rowCount());
|
|
|
|
|
|
|
|
for (iit = ids.begin(); iit != ids.end(); iit ++) {
|
2008-07-09 05:53:47 -04:00
|
|
|
#ifdef CHAN_DEBUG
|
2009-09-12 06:55:40 -04:00
|
|
|
std::cerr << "ChannelFeed::updateChannelListOwn(): " << *iit << std::endl;
|
2008-07-09 05:53:47 -04:00
|
|
|
#endif
|
2009-09-12 06:55:40 -04:00
|
|
|
QStandardItem *ownGroup = model->item(OWN);
|
|
|
|
QList<QStandardItem *> channel;
|
2010-05-14 12:33:35 -04:00
|
|
|
QStandardItem *chNameItem = new QStandardItem();
|
2010-05-02 07:43:04 -04:00
|
|
|
QStandardItem *chPopItem = new QStandardItem();
|
|
|
|
QStandardItem *chIdItem = new QStandardItem();
|
2010-05-17 17:20:11 -04:00
|
|
|
chNameItem->setSizeHint( QSize( 22,22 ) );
|
2009-09-12 06:55:40 -04:00
|
|
|
|
|
|
|
ChannelInfo ci;
|
|
|
|
if (rsChannels && rsChannels->getChannelInfo(*iit, ci)) {
|
2010-05-14 12:33:35 -04:00
|
|
|
chNameItem->setData(QVariant(QString::fromStdWString(ci.channelName)), Qt::DisplayRole);
|
2010-05-02 07:43:04 -04:00
|
|
|
//chPopItem->setData(QVariant(QString::number(ci.pop)), Qt::DisplayRole);
|
|
|
|
chIdItem->setData(QVariant(QString::fromStdString(ci.channelId)), Qt::DisplayRole);
|
2010-05-14 12:33:35 -04:00
|
|
|
chNameItem->setToolTip(tr("Popularity: %1\nFetches: %2\nAvailable: %3").arg(QString::number(ci.pop)).arg(9999).arg(9999));
|
|
|
|
|
|
|
|
if(ci.pngImageLen != 0){
|
|
|
|
|
|
|
|
QPixmap chanImage;
|
|
|
|
chanImage.loadFromData(ci.pngChanImage, ci.pngImageLen, "PNG");
|
|
|
|
chNameItem->setData(QIcon(chanImage), Qt::DecorationRole);
|
|
|
|
}else{
|
|
|
|
QPixmap defaulImage(CHAN_DEFAULT_IMAGE);
|
|
|
|
chNameItem->setData(QIcon(defaulImage), Qt::DecorationRole);
|
|
|
|
}
|
2010-03-05 06:58:35 -05:00
|
|
|
|
|
|
|
int popcount = ci.pop;
|
|
|
|
/* set Popularity icon */
|
|
|
|
if (popcount == 0)
|
|
|
|
{
|
2010-05-02 07:43:04 -04:00
|
|
|
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_0.png")), Qt::DecorationRole);
|
2010-03-05 06:58:35 -05:00
|
|
|
}
|
|
|
|
else if (popcount < 2)
|
|
|
|
{
|
2010-05-02 07:43:04 -04:00
|
|
|
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_1.png")), Qt::DecorationRole);
|
2010-03-05 06:58:35 -05:00
|
|
|
}
|
|
|
|
else if (popcount < 4)
|
|
|
|
{
|
2010-05-02 07:43:04 -04:00
|
|
|
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_2.png")), Qt::DecorationRole);
|
2010-03-05 06:58:35 -05:00
|
|
|
}
|
|
|
|
else if (popcount < 8)
|
|
|
|
{
|
2010-05-02 07:43:04 -04:00
|
|
|
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_3.png")), Qt::DecorationRole);
|
2010-03-05 06:58:35 -05:00
|
|
|
}
|
|
|
|
else if (popcount < 16) {
|
2010-05-02 07:43:04 -04:00
|
|
|
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_4.png")), Qt::DecorationRole);
|
2010-03-05 06:58:35 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-05-02 07:43:04 -04:00
|
|
|
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_5.png")), Qt::DecorationRole);
|
2010-03-05 06:58:35 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-12 06:55:40 -04:00
|
|
|
} else {
|
2010-05-14 12:33:35 -04:00
|
|
|
chNameItem->setData(QVariant(QString("Unknown Channel")), Qt::DisplayRole);
|
2010-05-02 07:43:04 -04:00
|
|
|
chPopItem->setData(QVariant(QString::fromStdString(*iit)), Qt::DisplayRole);
|
2010-05-14 12:33:35 -04:00
|
|
|
chNameItem->setToolTip("Unknown Channel\nNo Description");
|
2009-09-12 06:55:40 -04:00
|
|
|
}
|
2010-03-05 06:58:35 -05:00
|
|
|
|
2010-05-14 12:33:35 -04:00
|
|
|
channel.append(chNameItem);
|
2010-05-02 07:43:04 -04:00
|
|
|
channel.append(chPopItem);
|
|
|
|
channel.append(chIdItem);
|
2009-09-12 06:55:40 -04:00
|
|
|
ownGroup->appendRow(channel);
|
2008-06-24 00:36:45 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChannelFeed::updateChannelListSub(std::list<std::string> &ids)
|
|
|
|
{
|
2010-01-29 20:13:03 -05:00
|
|
|
std::list<std::string>::iterator iit;
|
|
|
|
|
|
|
|
/* remove rows with groups before adding new ones */
|
|
|
|
model->item(SUBSCRIBED)->removeRows(0, model->item(SUBSCRIBED)->rowCount());
|
|
|
|
|
|
|
|
for (iit = ids.begin(); iit != ids.end(); iit ++) {
|
2008-07-09 05:53:47 -04:00
|
|
|
#ifdef CHAN_DEBUG
|
2009-09-12 06:55:40 -04:00
|
|
|
std::cerr << "ChannelFeed::updateChannelListSub(): " << *iit << std::endl;
|
2008-07-09 05:53:47 -04:00
|
|
|
#endif
|
2009-09-12 06:55:40 -04:00
|
|
|
QStandardItem *ownGroup = model->item(SUBSCRIBED);
|
|
|
|
QList<QStandardItem *> channel;
|
2010-05-14 12:33:35 -04:00
|
|
|
QStandardItem *chNameItem = new QStandardItem();
|
2010-05-02 07:43:04 -04:00
|
|
|
QStandardItem *chPopItem = new QStandardItem();
|
|
|
|
QStandardItem *chIdItem = new QStandardItem();
|
2010-05-17 17:20:11 -04:00
|
|
|
chNameItem->setSizeHint( QSize( 22,22 ) );
|
2009-09-12 06:55:40 -04:00
|
|
|
|
|
|
|
ChannelInfo ci;
|
|
|
|
if (rsChannels && rsChannels->getChannelInfo(*iit, ci)) {
|
2010-05-14 12:33:35 -04:00
|
|
|
chNameItem->setData(QVariant(QString::fromStdWString(ci.channelName)), Qt::DisplayRole);
|
2010-05-02 07:43:04 -04:00
|
|
|
chIdItem->setData(QVariant(QString::fromStdString(ci.channelId)), Qt::DisplayRole);
|
2010-05-14 12:33:35 -04:00
|
|
|
chNameItem->setToolTip(tr("Popularity: %1\nFetches: %2\nAvailable: %3").arg(QString::number(ci.pop)).arg(9999).arg(9999));
|
|
|
|
|
|
|
|
if(ci.pngImageLen != 0){
|
|
|
|
|
|
|
|
QPixmap chanImage;
|
|
|
|
chanImage.loadFromData(ci.pngChanImage, ci.pngImageLen, "PNG");
|
|
|
|
chNameItem->setData(QIcon(chanImage), Qt::DecorationRole);
|
|
|
|
}else{
|
|
|
|
QPixmap defaulImage(CHAN_DEFAULT_IMAGE);
|
|
|
|
chNameItem->setData(QIcon(defaulImage), Qt::DecorationRole);
|
|
|
|
}
|
2010-05-02 07:43:04 -04:00
|
|
|
|
|
|
|
/* set Popularity icon */
|
|
|
|
int popcount = ci.pop;
|
|
|
|
|
|
|
|
if (popcount == 0)
|
|
|
|
{
|
|
|
|
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_0.png")), Qt::DecorationRole);
|
|
|
|
}
|
|
|
|
else if (popcount < 2)
|
|
|
|
{
|
|
|
|
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_1.png")), Qt::DecorationRole);
|
|
|
|
}
|
|
|
|
else if (popcount < 4)
|
|
|
|
{
|
|
|
|
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_2.png")), Qt::DecorationRole);
|
|
|
|
}
|
|
|
|
else if (popcount < 8)
|
|
|
|
{
|
|
|
|
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_3.png")), Qt::DecorationRole);
|
|
|
|
}
|
2010-05-17 17:20:11 -04:00
|
|
|
else if (popcount < 16)
|
|
|
|
{
|
2010-05-02 07:43:04 -04:00
|
|
|
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_4.png")), Qt::DecorationRole);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_5.png")), Qt::DecorationRole);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
2010-05-14 12:33:35 -04:00
|
|
|
chNameItem->setData(QVariant(QString("Unknown Channel")), Qt::DisplayRole);
|
2010-05-02 07:43:04 -04:00
|
|
|
chPopItem->setData(QVariant(QString::fromStdString(*iit)), Qt::DisplayRole);
|
2010-05-14 12:33:35 -04:00
|
|
|
chNameItem->setToolTip("Unknown Channel\nNo Description");
|
2010-05-02 07:43:04 -04:00
|
|
|
}
|
2008-06-24 00:36:45 -04:00
|
|
|
|
2010-05-14 12:33:35 -04:00
|
|
|
channel.append(chNameItem);
|
2010-05-02 07:43:04 -04:00
|
|
|
channel.append(chPopItem);
|
|
|
|
channel.append(chIdItem);
|
2009-09-12 06:55:40 -04:00
|
|
|
ownGroup->appendRow(channel);
|
2008-06-24 00:36:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChannelFeed::updateChannelListPop(std::list<std::string> &ids)
|
|
|
|
{
|
2010-01-29 20:13:03 -05:00
|
|
|
std::list<std::string>::iterator iit;
|
|
|
|
|
|
|
|
/* remove rows with groups before adding new ones */
|
|
|
|
model->item(POPULAR)->removeRows(0, model->item(POPULAR)->rowCount());
|
|
|
|
|
|
|
|
for (iit = ids.begin(); iit != ids.end(); iit ++) {
|
2008-07-09 05:53:47 -04:00
|
|
|
#ifdef CHAN_DEBUG
|
2009-09-12 06:55:40 -04:00
|
|
|
std::cerr << "ChannelFeed::updateChannelListPop(): " << *iit << std::endl;
|
2008-07-09 05:53:47 -04:00
|
|
|
#endif
|
2009-09-12 06:55:40 -04:00
|
|
|
QStandardItem *ownGroup = model->item(POPULAR);
|
|
|
|
QList<QStandardItem *> channel;
|
2010-05-02 07:43:04 -04:00
|
|
|
QStandardItem *chNameItem = new QStandardItem();
|
|
|
|
QStandardItem *chPopItem = new QStandardItem();
|
|
|
|
QStandardItem *chIdItem = new QStandardItem();
|
2010-05-17 17:20:11 -04:00
|
|
|
chNameItem->setSizeHint( QSize( 22,22 ) );
|
2009-09-12 06:55:40 -04:00
|
|
|
|
|
|
|
ChannelInfo ci;
|
|
|
|
if (rsChannels && rsChannels->getChannelInfo(*iit, ci)) {
|
2010-05-02 07:43:04 -04:00
|
|
|
chNameItem->setData(QVariant(QString::fromStdWString(ci.channelName)), Qt::DisplayRole);
|
|
|
|
chIdItem->setData(QVariant(QString::fromStdString(ci.channelId)), Qt::DisplayRole);
|
2010-05-14 12:33:35 -04:00
|
|
|
chNameItem->setToolTip(tr("Popularity: %1\nFetches: %2\nAvailable: %3").arg(QString::number(ci.pop)).arg(9999).arg(9999));
|
|
|
|
|
|
|
|
if(ci.pngImageLen != 0){
|
|
|
|
|
|
|
|
QPixmap chanImage;
|
|
|
|
chanImage.loadFromData(ci.pngChanImage, ci.pngImageLen, "PNG");
|
|
|
|
chNameItem->setData(QIcon(chanImage), Qt::DecorationRole);
|
|
|
|
}else{
|
|
|
|
QPixmap defaulImage(CHAN_DEFAULT_IMAGE);
|
|
|
|
chNameItem->setData(QIcon(defaulImage), Qt::DecorationRole);
|
|
|
|
}
|
2008-06-24 00:36:45 -04:00
|
|
|
|
2010-05-02 07:43:04 -04:00
|
|
|
/* set Popularity icon */
|
|
|
|
int popcount = ci.pop;
|
|
|
|
|
|
|
|
if (popcount == 0)
|
|
|
|
{
|
|
|
|
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_0.png")), Qt::DecorationRole);
|
|
|
|
}
|
|
|
|
else if (popcount < 2)
|
|
|
|
{
|
|
|
|
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_1.png")), Qt::DecorationRole);
|
|
|
|
}
|
|
|
|
else if (popcount < 4)
|
|
|
|
{
|
|
|
|
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_2.png")), Qt::DecorationRole);
|
|
|
|
}
|
|
|
|
else if (popcount < 8)
|
|
|
|
{
|
|
|
|
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_3.png")), Qt::DecorationRole);
|
|
|
|
}
|
|
|
|
else if (popcount < 16) {
|
|
|
|
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_4.png")), Qt::DecorationRole);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_5.png")), Qt::DecorationRole);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
chNameItem->setData(QVariant(QString("Unknown Channel")), Qt::DisplayRole);
|
|
|
|
chPopItem->setData(QVariant(QString::fromStdString(*iit)), Qt::DisplayRole);
|
|
|
|
chNameItem->setToolTip("Unknown Channel\nNo Description");
|
|
|
|
}
|
|
|
|
|
|
|
|
channel.append(chNameItem);
|
|
|
|
channel.append(chPopItem);
|
|
|
|
channel.append(chIdItem);
|
2009-09-12 06:55:40 -04:00
|
|
|
ownGroup->appendRow(channel);
|
2008-06-24 00:36:45 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChannelFeed::updateChannelListOther(std::list<std::string> &ids)
|
|
|
|
{
|
2010-01-29 20:13:03 -05:00
|
|
|
std::list<std::string>::iterator iit;
|
|
|
|
|
|
|
|
/* remove rows with groups before adding new ones */
|
|
|
|
model->item(OTHER)->removeRows(0, model->item(OTHER)->rowCount());
|
|
|
|
|
|
|
|
for (iit = ids.begin(); iit != ids.end(); iit ++) {
|
2008-07-09 05:53:47 -04:00
|
|
|
#ifdef CHAN_DEBUG
|
2009-09-12 06:55:40 -04:00
|
|
|
std::cerr << "ChannelFeed::updateChannelListOther(): " << *iit << std::endl;
|
2008-07-09 05:53:47 -04:00
|
|
|
#endif
|
2009-09-12 06:55:40 -04:00
|
|
|
QStandardItem *ownGroup = model->item(OTHER);
|
|
|
|
QList<QStandardItem *> channel;
|
2010-05-02 07:43:04 -04:00
|
|
|
QStandardItem *chNameItem = new QStandardItem();
|
|
|
|
QStandardItem *chPopItem = new QStandardItem();
|
|
|
|
QStandardItem *chIdItem = new QStandardItem();
|
2010-05-25 18:53:35 -04:00
|
|
|
chNameItem->setSizeHint( QSize( 22,22 ) );
|
2009-09-12 06:55:40 -04:00
|
|
|
|
|
|
|
ChannelInfo ci;
|
|
|
|
if (rsChannels && rsChannels->getChannelInfo(*iit, ci)) {
|
2010-05-02 07:43:04 -04:00
|
|
|
chNameItem->setData(QVariant(QString::fromStdWString(ci.channelName)), Qt::DisplayRole);
|
2010-05-25 18:53:35 -04:00
|
|
|
chIdItem->setData(QVariant(QString::fromStdString(ci.channelId)), Qt::DisplayRole);
|
2010-05-02 07:43:04 -04:00
|
|
|
chNameItem->setToolTip(tr("Popularity: %1\nFetches: %2\nAvailable: %3"
|
2009-09-12 06:55:40 -04:00
|
|
|
).arg(QString::number(ci.pop)).arg(9999).arg(9999));
|
2008-06-24 00:36:45 -04:00
|
|
|
|
2010-05-25 18:53:35 -04:00
|
|
|
if(ci.pngImageLen != 0){
|
|
|
|
|
|
|
|
QPixmap chanImage;
|
|
|
|
chanImage.loadFromData(ci.pngChanImage, ci.pngImageLen, "PNG");
|
|
|
|
chNameItem->setData(QIcon(chanImage), Qt::DecorationRole);
|
|
|
|
}else{
|
|
|
|
QPixmap defaulImage(CHAN_DEFAULT_IMAGE);
|
|
|
|
chNameItem->setData(QIcon(defaulImage), Qt::DecorationRole);
|
|
|
|
}
|
|
|
|
|
2010-05-02 07:43:04 -04:00
|
|
|
/* set Popularity icon */
|
|
|
|
int popcount = ci.pop;
|
|
|
|
|
|
|
|
if (popcount == 0)
|
|
|
|
{
|
|
|
|
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_0.png")), Qt::DecorationRole);
|
|
|
|
}
|
|
|
|
else if (popcount < 2)
|
|
|
|
{
|
|
|
|
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_1.png")), Qt::DecorationRole);
|
|
|
|
}
|
|
|
|
else if (popcount < 4)
|
|
|
|
{
|
|
|
|
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_2.png")), Qt::DecorationRole);
|
|
|
|
}
|
|
|
|
else if (popcount < 8)
|
|
|
|
{
|
|
|
|
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_3.png")), Qt::DecorationRole);
|
|
|
|
}
|
|
|
|
else if (popcount < 16) {
|
|
|
|
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_4.png")), Qt::DecorationRole);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_5.png")), Qt::DecorationRole);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
chNameItem->setData(QVariant(QString("Unknown Channel")), Qt::DisplayRole);
|
|
|
|
chPopItem->setData(QVariant(QString::fromStdString(*iit)), Qt::DisplayRole);
|
|
|
|
chNameItem->setToolTip("Unknown Channel\nNo Description");
|
|
|
|
}
|
|
|
|
|
|
|
|
channel.append(chNameItem);
|
|
|
|
channel.append(chPopItem);
|
|
|
|
channel.append(chIdItem);
|
2009-09-12 06:55:40 -04:00
|
|
|
ownGroup->appendRow(channel);
|
2008-06-24 00:36:45 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChannelFeed::updateChannelMsgs()
|
|
|
|
{
|
|
|
|
if (!rsChannels)
|
|
|
|
return;
|
|
|
|
|
|
|
|
ChannelInfo ci;
|
|
|
|
if (!rsChannels->getChannelInfo(mChannelId, ci))
|
|
|
|
{
|
|
|
|
postButton->setEnabled(false);
|
|
|
|
subscribeButton->setEnabled(false);
|
|
|
|
unsubscribeButton->setEnabled(false);
|
|
|
|
nameLabel->setText("No Channel Selected");
|
2010-05-21 11:50:29 -04:00
|
|
|
iconLabel->setPixmap(QPixmap(":/images/channels.png"));
|
2009-09-19 17:13:33 -04:00
|
|
|
iconLabel->setEnabled(false);
|
2008-06-24 00:36:45 -04:00
|
|
|
return;
|
|
|
|
}
|
2009-09-13 14:47:13 -04:00
|
|
|
|
2010-05-14 09:06:58 -04:00
|
|
|
if(ci.pngImageLen != 0){
|
|
|
|
|
|
|
|
QPixmap chanImage;
|
|
|
|
chanImage.loadFromData(ci.pngChanImage, ci.pngImageLen, "PNG");
|
|
|
|
iconLabel->setPixmap(chanImage);
|
2010-05-21 11:50:29 -04:00
|
|
|
iconLabel->setStyleSheet("QLabel{border: 3px solid white;}");
|
2010-05-14 09:06:58 -04:00
|
|
|
}else{
|
|
|
|
QPixmap defaulImage(CHAN_DEFAULT_IMAGE);
|
|
|
|
iconLabel->setPixmap(defaulImage);
|
2010-05-21 11:50:29 -04:00
|
|
|
iconLabel->setStyleSheet("QLabel{border: 2px solid white;border-radius: 10px;}");
|
2010-05-14 09:06:58 -04:00
|
|
|
}
|
2009-09-19 17:13:33 -04:00
|
|
|
iconLabel->setEnabled(true);
|
2010-05-14 09:06:58 -04:00
|
|
|
|
2009-09-13 14:47:13 -04:00
|
|
|
/* set textcolor for Channel name */
|
|
|
|
QString channelStr("<span style=\"font-size:22pt; font-weight:500;"
|
|
|
|
"color:#4F4F4F;\">%1</span>");
|
|
|
|
|
|
|
|
/* set Channel name */
|
|
|
|
QString cname = QString::fromStdWString(ci.channelName);
|
|
|
|
nameLabel->setText(channelStr.arg(cname));
|
2008-06-24 00:36:45 -04:00
|
|
|
|
|
|
|
/* do buttons */
|
|
|
|
if (ci.channelFlags & RS_DISTRIB_SUBSCRIBED)
|
|
|
|
{
|
|
|
|
subscribeButton->setEnabled(false);
|
|
|
|
unsubscribeButton->setEnabled(true);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
subscribeButton->setEnabled(true);
|
|
|
|
unsubscribeButton->setEnabled(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ci.channelFlags & RS_DISTRIB_PUBLISH)
|
|
|
|
{
|
|
|
|
postButton->setEnabled(true);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
postButton->setEnabled(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* replace all the messages with new ones */
|
|
|
|
std::list<ChanMsgItem *>::iterator mit;
|
|
|
|
for(mit = mChanMsgItems.begin(); mit != mChanMsgItems.end(); mit++)
|
|
|
|
{
|
|
|
|
delete (*mit);
|
|
|
|
}
|
|
|
|
mChanMsgItems.clear();
|
|
|
|
|
|
|
|
std::list<ChannelMsgSummary> msgs;
|
|
|
|
std::list<ChannelMsgSummary>::iterator it;
|
|
|
|
|
|
|
|
rsChannels->getChannelMsgList(mChannelId, msgs);
|
|
|
|
|
|
|
|
for(it = msgs.begin(); it != msgs.end(); it++)
|
|
|
|
{
|
|
|
|
ChanMsgItem *cmi = new ChanMsgItem(this, 0, mChannelId, it->msgId, true);
|
|
|
|
|
|
|
|
mChanMsgItems.push_back(cmi);
|
2010-01-29 18:13:58 -05:00
|
|
|
verticalLayout_2->addWidget(cmi);
|
2008-06-24 00:36:45 -04:00
|
|
|
}
|
|
|
|
}
|
2008-06-20 08:43:23 -04:00
|
|
|
|
2008-07-04 10:41:24 -04:00
|
|
|
|
|
|
|
void ChannelFeed::unsubscribeChannel()
|
|
|
|
{
|
2008-07-09 05:53:47 -04:00
|
|
|
#ifdef CHAN_DEBUG
|
2008-07-04 10:41:24 -04:00
|
|
|
std::cerr << "ChannelFeed::unsubscribeChannel()";
|
|
|
|
std::cerr << std::endl;
|
|
|
|
#endif
|
|
|
|
if (rsChannels)
|
|
|
|
{
|
|
|
|
rsChannels->channelSubscribe(mChannelId, false);
|
|
|
|
}
|
|
|
|
updateChannelMsgs();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ChannelFeed::subscribeChannel()
|
|
|
|
{
|
2008-07-09 05:53:47 -04:00
|
|
|
#ifdef CHAN_DEBUG
|
2008-07-04 10:41:24 -04:00
|
|
|
std::cerr << "ChannelFeed::subscribeChannel()";
|
|
|
|
std::cerr << std::endl;
|
|
|
|
#endif
|
|
|
|
if (rsChannels)
|
|
|
|
{
|
|
|
|
rsChannels->channelSubscribe(mChannelId, true);
|
|
|
|
}
|
|
|
|
updateChannelMsgs();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-12 06:55:40 -04:00
|
|
|
void ChannelFeed::toggleSelection(const QModelIndex &index)
|
|
|
|
{
|
|
|
|
QItemSelectionModel *selectionModel = treeView->selectionModel();
|
|
|
|
if (index.child(0, 0).isValid())
|
|
|
|
selectionModel->select(index, QItemSelectionModel::Toggle);
|
|
|
|
}
|
2010-01-04 20:49:58 -05:00
|
|
|
|
2010-01-19 19:29:40 -05:00
|
|
|
void ChannelFeed::showChannelDetails()
|
|
|
|
{
|
|
|
|
if (mChannelId == "")
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!rsChannels)
|
|
|
|
return;
|
|
|
|
|
2010-05-04 20:05:36 -04:00
|
|
|
ChannelDetails channelui (this);
|
2010-01-19 19:29:40 -05:00
|
|
|
|
2010-05-04 20:05:36 -04:00
|
|
|
channelui.showDetails(mChannelId);
|
|
|
|
channelui.exec();
|
2010-01-19 19:29:40 -05:00
|
|
|
}
|