mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-15 10:54:22 -05:00
Added Popularity view as icons to display for each channel
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2487 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
eccd429f42
commit
4afa46cb82
@ -62,9 +62,10 @@ ChannelFeed::ChannelFeed(QWidget *parent)
|
||||
/*************** Setup Left Hand Side (List of Channels) ****************/
|
||||
|
||||
mChannelId = "";
|
||||
model = new QStandardItemModel(0, 2, this);
|
||||
model = new QStandardItemModel(0, 3, this);
|
||||
model->setHeaderData(0, Qt::Horizontal, tr("Name"), Qt::DisplayRole);
|
||||
model->setHeaderData(1, Qt::Horizontal, tr("ID"), Qt::DisplayRole);
|
||||
model->setHeaderData(1, Qt::Horizontal, tr("Popularity"), Qt::DisplayRole);
|
||||
model->setHeaderData(2, Qt::Horizontal, tr("ID"), Qt::DisplayRole);
|
||||
|
||||
treeView->setModel(model);
|
||||
treeView->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
@ -74,7 +75,14 @@ ChannelFeed::ChannelFeed(QWidget *parent)
|
||||
|
||||
// hide header and id column
|
||||
treeView->setHeaderHidden(true);
|
||||
treeView->hideColumn(1);
|
||||
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 );
|
||||
|
||||
QStandardItem *item1 = new QStandardItem(tr("Own Channels"));
|
||||
QStandardItem *item2 = new QStandardItem(tr("Subscribed Channels"));
|
||||
@ -129,16 +137,16 @@ void ChannelFeed::channelListCustomPopupMenu( QPoint point )
|
||||
QMenu contextMnu( this );
|
||||
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
|
||||
|
||||
QAction *postchannelAct = new QAction(QIcon(":/images/mail_reply.png"), tr( "Post to Channel" ), this );
|
||||
postchannelAct = new QAction(QIcon(":/images/mail_reply.png"), tr( "Post to Channel" ), this );
|
||||
connect( postchannelAct , SIGNAL( triggered() ), this, SLOT( createMsg() ) );
|
||||
|
||||
QAction *subscribechannelAct = new QAction(QIcon(":/images/edit_add24.png"), tr( "Subscribe to Channel" ), this );
|
||||
subscribechannelAct = new QAction(QIcon(":/images/edit_add24.png"), tr( "Subscribe to Channel" ), this );
|
||||
connect( subscribechannelAct , SIGNAL( triggered() ), this, SLOT( subscribeChannel() ) );
|
||||
|
||||
QAction *unsubscribechannelAct = new QAction(QIcon(":/images/cancel.png"), tr( "Unsubscribe to Channel" ), this );
|
||||
unsubscribechannelAct = new QAction(QIcon(":/images/cancel.png"), tr( "Unsubscribe to Channel" ), this );
|
||||
connect( unsubscribechannelAct , SIGNAL( triggered() ), this, SLOT( unsubscribeChannel() ) );
|
||||
|
||||
QAction *channeldetailsAct = new QAction(QIcon(":/images/info16.png"), tr( "Show Channel Details" ), this );
|
||||
channeldetailsAct = new QAction(QIcon(":/images/info16.png"), tr( "Show Channel Details" ), this );
|
||||
connect( channeldetailsAct , SIGNAL( triggered() ), this, SLOT( showChannelDetails() ) );
|
||||
|
||||
contextMnu.clear();
|
||||
@ -250,8 +258,8 @@ void ChannelFeed::selectChannel(const QModelIndex &index)
|
||||
{
|
||||
int row = index.row();
|
||||
int col = index.column();
|
||||
if (col != 1) {
|
||||
QModelIndex sibling = index.sibling(row, 1);
|
||||
if (col != 2) {
|
||||
QModelIndex sibling = index.sibling(row, 2);
|
||||
if (sibling.isValid())
|
||||
mChannelId = sibling.data().toString().toStdString();
|
||||
} else
|
||||
@ -383,13 +391,43 @@ void ChannelFeed::updateChannelListOwn(std::list<std::string> &ids)
|
||||
QList<QStandardItem *> channel;
|
||||
QStandardItem *item1 = new QStandardItem();
|
||||
QStandardItem *item2 = new QStandardItem();
|
||||
QStandardItem *item3 = new QStandardItem();
|
||||
|
||||
ChannelInfo ci;
|
||||
if (rsChannels && rsChannels->getChannelInfo(*iit, ci)) {
|
||||
item1->setData(QVariant(QString::fromStdWString(ci.channelName)), Qt::DisplayRole);
|
||||
item2->setData(QVariant(QString::fromStdString(ci.channelId)), Qt::DisplayRole);
|
||||
//item2->setData(QVariant(QString::number(ci.pop)), Qt::DisplayRole);
|
||||
item3->setData(QVariant(QString::fromStdString(ci.channelId)), Qt::DisplayRole);
|
||||
item1->setToolTip(tr("Popularity: %1\nFetches: %2\nAvailable: %3"
|
||||
).arg(QString::number(ci.pop)).arg(9999).arg(9999));
|
||||
|
||||
int popcount = ci.pop;
|
||||
/* set Popularity icon */
|
||||
if (popcount == 0)
|
||||
{
|
||||
item2->setData(QIcon(QString::fromUtf8(":/images/hot_0.png")), Qt::DecorationRole);
|
||||
}
|
||||
else if (popcount < 2)
|
||||
{
|
||||
item2->setData(QIcon(QString::fromUtf8(":/images/hot_1.png")), Qt::DecorationRole);
|
||||
}
|
||||
else if (popcount < 4)
|
||||
{
|
||||
item2->setData(QIcon(QString::fromUtf8(":/images/hot_2.png")), Qt::DecorationRole);
|
||||
}
|
||||
else if (popcount < 8)
|
||||
{
|
||||
item2->setData(QIcon(QString::fromUtf8(":/images/hot_3.png")), Qt::DecorationRole);
|
||||
}
|
||||
else if (popcount < 16) {
|
||||
item2->setData(QIcon(QString::fromUtf8(":/images/hot_4.png")), Qt::DecorationRole);
|
||||
}
|
||||
else
|
||||
{
|
||||
item2->setData(QIcon(QString::fromUtf8(":/images/hot_5.png")), Qt::DecorationRole);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
item1->setData(QVariant(QString("Unknown Channel")), Qt::DisplayRole);
|
||||
item2->setData(QVariant(QString::fromStdString(*iit)), Qt::DisplayRole);
|
||||
@ -398,6 +436,7 @@ void ChannelFeed::updateChannelListOwn(std::list<std::string> &ids)
|
||||
|
||||
channel.append(item1);
|
||||
channel.append(item2);
|
||||
channel.append(item3);
|
||||
ownGroup->appendRow(channel);
|
||||
}
|
||||
}
|
||||
|
@ -95,6 +95,11 @@ private:
|
||||
QFont mChannelFont;
|
||||
QFont itemFont;
|
||||
|
||||
QAction* postchannelAct;
|
||||
QAction* subscribechannelAct;
|
||||
QAction* unsubscribechannelAct;
|
||||
QAction* channeldetailsAct;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -209,6 +209,12 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>19</width>
|
||||
<height>19</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -200,6 +200,12 @@
|
||||
<file>images/hide_frame.png</file>
|
||||
<file>images/highlight.png</file>
|
||||
<file>images/hi16-app-ktorrent.png</file>
|
||||
<file>images/hot_0.png</file>
|
||||
<file>images/hot_1.png</file>
|
||||
<file>images/hot_2.png</file>
|
||||
<file>images/hot_3.png</file>
|
||||
<file>images/hot_4.png</file>
|
||||
<file>images/hot_5.png</file>
|
||||
<file>images/image16.png</file>
|
||||
<file>images/info16.png</file>
|
||||
<file>images/im-user.png</file>
|
||||
|
BIN
retroshare-gui/src/gui/images/hot_0.png
Normal file
BIN
retroshare-gui/src/gui/images/hot_0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 291 B |
BIN
retroshare-gui/src/gui/images/hot_1.png
Normal file
BIN
retroshare-gui/src/gui/images/hot_1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 312 B |
BIN
retroshare-gui/src/gui/images/hot_2.png
Normal file
BIN
retroshare-gui/src/gui/images/hot_2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 333 B |
BIN
retroshare-gui/src/gui/images/hot_3.png
Normal file
BIN
retroshare-gui/src/gui/images/hot_3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 318 B |
BIN
retroshare-gui/src/gui/images/hot_4.png
Normal file
BIN
retroshare-gui/src/gui/images/hot_4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 318 B |
BIN
retroshare-gui/src/gui/images/hot_5.png
Normal file
BIN
retroshare-gui/src/gui/images/hot_5.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 318 B |
Loading…
Reference in New Issue
Block a user