mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-14 16:57:55 +00:00
rss : try to use dynamic icon before streams names
This commit is contained in:
parent
191ac5eeac
commit
3fa88436c3
@ -121,6 +121,7 @@
|
|||||||
if(rssmanager.getNbStream()>0) {
|
if(rssmanager.getNbStream()>0) {
|
||||||
textBrowser->clear();
|
textBrowser->clear();
|
||||||
listNews->clear();
|
listNews->clear();
|
||||||
|
listStreams->item(index)->setData(Qt::DecorationRole, QVariant(QIcon(":/Icons/refresh.png")));
|
||||||
rssmanager.refresh(index);
|
rssmanager.refresh(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,6 +130,9 @@
|
|||||||
void RSSImp::refreshAllStreams() {
|
void RSSImp::refreshAllStreams() {
|
||||||
textBrowser->clear();
|
textBrowser->clear();
|
||||||
listNews->clear();
|
listNews->clear();
|
||||||
|
unsigned short nbstream = rssmanager.getNbStream();
|
||||||
|
for(unsigned short i=0; i<nbstream; i++)
|
||||||
|
listStreams->item(i)->setData(Qt::DecorationRole, QVariant(QIcon(":/Icons/refresh.png")));
|
||||||
rssmanager.refreshAll();
|
rssmanager.refreshAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +162,7 @@
|
|||||||
listNews->clear();
|
listNews->clear();
|
||||||
refreshNewsList();
|
refreshNewsList();
|
||||||
}
|
}
|
||||||
updateAllStreamsName();
|
//updateAllStreamsName();
|
||||||
}
|
}
|
||||||
|
|
||||||
// fills the newsList
|
// fills the newsList
|
||||||
@ -181,12 +185,12 @@
|
|||||||
void RSSImp::refreshTextBrowser() {
|
void RSSImp::refreshTextBrowser() {
|
||||||
if(listStreams->currentRow()>=0 && listNews->currentRow()>=0) {
|
if(listStreams->currentRow()>=0 && listNews->currentRow()>=0) {
|
||||||
RssItem* currentitem = rssmanager.getStream(listStreams->currentRow())->getItem(listNews->currentRow());
|
RssItem* currentitem = rssmanager.getStream(listStreams->currentRow())->getItem(listNews->currentRow());
|
||||||
textBrowser->setHtml(currentitem->getTitle()+" : \n"+currentitem->getDescription()+"\n"+currentitem->getImage());
|
textBrowser->setHtml(currentitem->getTitle()+" : \n"+currentitem->getDescription());
|
||||||
currentitem->setRead();
|
currentitem->setRead();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// show the number of news for a stream
|
// show the number of news for a stream, his status and an icon
|
||||||
void RSSImp::updateStreamName(const unsigned short& i) {
|
void RSSImp::updateStreamName(const unsigned short& i) {
|
||||||
unsigned short nbitem = rssmanager.getStream(i)->getListSize();
|
unsigned short nbitem = rssmanager.getStream(i)->getListSize();
|
||||||
listStreams->item(i)->setText(rssmanager.getStream(i)->getAlias()+" ("+QString::number(nbitem,10).toUtf8()+")");
|
listStreams->item(i)->setText(rssmanager.getStream(i)->getAlias()+" ("+QString::number(nbitem,10).toUtf8()+")");
|
||||||
@ -198,6 +202,7 @@
|
|||||||
listStreams->item(i)->setData(Qt::ForegroundRole, QVariant(QColor("green")));
|
listStreams->item(i)->setData(Qt::ForegroundRole, QVariant(QColor("green")));
|
||||||
if(!rssmanager.getStream(i)->isRead())
|
if(!rssmanager.getStream(i)->isRead())
|
||||||
listStreams->item(i)->setData(Qt::BackgroundRole, QVariant(QColor(0, 255, 0, 20)));
|
listStreams->item(i)->setData(Qt::BackgroundRole, QVariant(QColor(0, 255, 0, 20)));
|
||||||
|
listStreams->item(i)->setData(Qt::DecorationRole, QVariant(QIcon(":/Icons/rss.png")));
|
||||||
if(listStreams->currentRow()==i) {
|
if(listStreams->currentRow()==i) {
|
||||||
listNews->clear();
|
listNews->clear();
|
||||||
refreshNewsList();
|
refreshNewsList();
|
||||||
@ -205,7 +210,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// show the number of news for each stream
|
// show the number of news for each stream
|
||||||
void RSSImp::updateAllStreamsName() {
|
/*void RSSImp::updateAllStreamsName() {
|
||||||
unsigned short nbstream = rssmanager.getNbStream();
|
unsigned short nbstream = rssmanager.getNbStream();
|
||||||
for(unsigned short i=0; i<nbstream; i++) {
|
for(unsigned short i=0; i<nbstream; i++) {
|
||||||
unsigned short nbitem = rssmanager.getStream(i)->getListSize();
|
unsigned short nbitem = rssmanager.getStream(i)->getListSize();
|
||||||
@ -225,7 +230,7 @@
|
|||||||
listNews->clear();
|
listNews->clear();
|
||||||
refreshNewsList();
|
refreshNewsList();
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
RSSImp::RSSImp() : QWidget(){
|
RSSImp::RSSImp() : QWidget(){
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
@ -242,7 +247,7 @@
|
|||||||
refreshStreamList();
|
refreshStreamList();
|
||||||
refreshTextBrowser();
|
refreshTextBrowser();
|
||||||
// force the first alias-refresh
|
// force the first alias-refresh
|
||||||
QTimer::singleShot(10000, this, SLOT(updateAllStreamsName()));
|
//QTimer::singleShot(10000, this, SLOT(updateAllStreamsName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
RSSImp::~RSSImp(){
|
RSSImp::~RSSImp(){
|
||||||
|
@ -47,7 +47,7 @@ class RSSImp : public QWidget, public Ui::RSS{
|
|||||||
void refreshStream();
|
void refreshStream();
|
||||||
void createStream();
|
void createStream();
|
||||||
void updateStreamName(const unsigned short&);
|
void updateStreamName(const unsigned short&);
|
||||||
void updateAllStreamsName();
|
//void updateAllStreamsName();
|
||||||
void refreshAllStreams();
|
void refreshAllStreams();
|
||||||
void refreshStreamList();
|
void refreshStreamList();
|
||||||
void refreshNewsList();
|
void refreshNewsList();
|
||||||
|
Loading…
Reference in New Issue
Block a user