added key share list to channels

fixed problem with other channels not showing except top 5

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3005 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2010-05-25 22:53:35 +00:00
parent cf785bb8a3
commit 84da8eb074
5 changed files with 313 additions and 83 deletions

View file

@ -321,37 +321,14 @@ void ChannelFeed::updateChannelList()
}
uint32_t i = 0;
uint32_t popLimit = 0;
std::multimap<uint32_t, std::string>::reverse_iterator rit;
for(rit = popMap.rbegin(); ((rit != popMap.rend()) && (i < popCount)); rit++, i++)
for(rit = popMap.rbegin(); rit != popMap.rend(); rit++)
{
popIds.push_back(rit->second);
}
if (rit != popMap.rend())
{
popLimit = rit->first;
}
for(it = channelList.begin(); it != channelList.end(); it++)
{
/* ignore the ones we've done already */
uint32_t flags = it->channelFlags;
if (flags & RS_DISTRIB_ADMIN)
{
continue;
}
else if (flags & RS_DISTRIB_SUBSCRIBED)
{
continue;
}
else
{
if (it->pop < popLimit)
{
otherIds.push_back(it->channelId);
}
if(i < popCount){
popIds.push_back(rit->second);
i++;
}else{
otherIds.push_back(rit->second);
}
}
@ -606,14 +583,25 @@ void ChannelFeed::updateChannelListOther(std::list<std::string> &ids)
QStandardItem *chNameItem = new QStandardItem();
QStandardItem *chPopItem = new QStandardItem();
QStandardItem *chIdItem = new QStandardItem();
chNameItem->setSizeHint( QSize( 22,22 ) );
ChannelInfo ci;
if (rsChannels && rsChannels->getChannelInfo(*iit, ci)) {
chNameItem->setData(QVariant(QString::fromStdWString(ci.channelName)), Qt::DisplayRole);
chPopItem->setData(QVariant(QString::fromStdString(ci.channelId)), Qt::DisplayRole);
chIdItem->setData(QVariant(QString::fromStdString(ci.channelId)), Qt::DisplayRole);
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);
}
/* set Popularity icon */
int popcount = ci.pop;