Browse Source

rss : color try

adaptive-webui-19844
Arnaud Demaiziere 18 years ago
parent
commit
d5aea98f80
  1. 14
      src/rss_imp.cpp
  2. 2
      src/rss_imp.h

14
src/rss_imp.cpp

@ -69,6 +69,7 @@ @@ -69,6 +69,7 @@
// display the content of a new when clicked on it
void RSSImp::on_listNews_clicked() {
listNews->item(listNews->currentRow())->setData(Qt::ForegroundRole, QVariant(QColor("grey")));
refreshTextBrowser();
}
@ -166,6 +167,8 @@ @@ -166,6 +167,8 @@
unsigned int currentStreamSize = currentstream->getListSize();
for(unsigned int i=0; i<currentStreamSize; ++i) {
new QListWidgetItem(currentstream->getItem(i)->getTitle(), listNews);
if(currentstream->getItem(i)->isRead())
listNews->item(i)->setData(Qt::ForegroundRole, QVariant(QColor("grey")));
}
}
}
@ -181,7 +184,16 @@ @@ -181,7 +184,16 @@
// show the number of news for each stream
void RSSImp::updateStreamsName(const int& i) {
listStreams->item(i)->setText(rssmanager.getStream(i)->getAlias()+" ("+QString::number(rssmanager.getStream(i)->getListSize(),10).toUtf8()+")");
unsigned short nbitem = rssmanager.getStream(i)->getListSize();
listStreams->item(i)->setText(rssmanager.getStream(i)->getAlias()+" ("+QString::number(nbitem,10).toUtf8()+")");
// FIXME : the 2st conditions are incorrect
if(nbitem==0)
listStreams->item(i)->setData(Qt::ForegroundRole, QVariant(QColor("grey")));
else if(rssmanager.getStream(i)->getLastRefreshElapsed()>REFRESH_MAX_LATENCY)
listStreams->item(i)->setData(Qt::ForegroundRole, QVariant(QColor("red")));
else
listStreams->item(i)->setData(Qt::ForegroundRole, QVariant(QColor("green")));
//qDebug(QString::number(nbitem).toUtf8()+"//"+QString::number(rssmanager.getStream(i)->getLastRefreshElapsed()).toUtf8());
int currentStream = listStreams->currentRow();
listStreams->setCurrentRow(currentStream);
if(currentStream>=0) {

2
src/rss_imp.h

@ -21,6 +21,8 @@ @@ -21,6 +21,8 @@
#ifndef __RSS_IMP_H__
#define __RSS_IMP_H__
#define REFRESH_MAX_LATENCY 6000
#include <QTimer>
#include "ui_rss.h"
#include "rss.h"

Loading…
Cancel
Save