Browse Source

rss : improvements of the qtreeview

adaptive-webui-19844
Arnaud Demaiziere 18 years ago
parent
commit
06378e09be
  1. BIN
      src/Icons/description.png
  2. BIN
      src/Icons/sphere.png
  3. BIN
      src/Icons/sphere2.png
  4. BIN
      src/Icons/time.png
  5. BIN
      src/Icons/url.png
  6. 9
      src/icons.qrc
  7. 4
      src/rss.h
  8. 34
      src/rss_imp.cpp
  9. 4
      src/rss_imp.h

BIN
src/Icons/description.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 821 B

BIN
src/Icons/sphere.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

BIN
src/Icons/sphere2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

BIN
src/Icons/time.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 513 B

BIN
src/Icons/url.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 629 B

9
src/icons.qrc

@ -20,14 +20,19 @@ @@ -20,14 +20,19 @@
<file>Icons/splash.png</file>
<file>Icons/home.png</file>
<file>Icons/uparrow.png</file>
<file>Icons/rss.png</file>
<file>Icons/downarrow.png</file>
<file>Icons/connection.png</file>
<file>Icons/add_file.png</file>
<file>Icons/refresh.png</file>
<file>Icons/rss.png</file>
<file>Icons/add_folder.png</file>
<file>Icons/add_file.png</file>
<file>Icons/loading.png</file>
<file>Icons/exec.png</file>
<file>Icons/sphere.png</file>
<file>Icons/url.png</file>
<file>Icons/time.png</file>
<file>Icons/description.png</file>
<file>Icons/sphere2.png</file>
<file>Icons/flags/portugal.png</file>
<file>Icons/flags/france.png</file>
<file>Icons/flags/ukraine.png</file>

4
src/rss.h

@ -274,6 +274,10 @@ class RssStream : public QObject{ @@ -274,6 +274,10 @@ class RssStream : public QObject{
return lastRefresh.elapsed();
}
QString getLastRefresh() const{
return QString::number(lastRefresh.hour())+"h"+QString::number(lastRefresh.minute())+"m";
}
bool isRead() const {
return read;
}

34
src/rss_imp.cpp

@ -71,13 +71,14 @@ @@ -71,13 +71,14 @@
rssmanager.getStream(getNumStreamSelected())->setRead();
// update the color of the stream, is it old ?
updateStreamName(getNumStreamSelected(), LATENCY);
refreshNewsList();
refreshNewsList();
}
}
// 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")));
listNews->item(listNews->currentRow())->setData(Qt::DecorationRole, QVariant(QIcon(":/Icons/sphere.png")));
refreshTextBrowser();
}
@ -176,7 +177,17 @@ @@ -176,7 +177,17 @@
for(unsigned short i=0; i<nbstream; i++) {
QTreeWidgetItem* stream = new QTreeWidgetItem(listStreams);
QTreeWidgetItem* description = new QTreeWidgetItem(stream);
QTreeWidgetItem* url = new QTreeWidgetItem(stream);
QTreeWidgetItem* time = new QTreeWidgetItem(stream);
description->setText(0, tr("no description avalaible"));
url->setText(0, rssmanager.getStream(i)->getUrl());
time->setText(0, tr("no refresh"));
description->setData(0,Qt::DecorationRole, QVariant(QIcon(":/Icons/description.png")));
url->setData(0,Qt::DecorationRole, QVariant(QIcon(":/Icons/url.png")));
time->setData(0,Qt::DecorationRole, QVariant(QIcon(":/Icons/time.png")));
description->setData(0,Qt::ForegroundRole, QVariant(QColor("grey")));
url->setData(0,Qt::ForegroundRole, QVariant(QColor("grey")));
time->setData(0,Qt::ForegroundRole, QVariant(QColor("grey")));
updateStreamName(i, NEWS);
}
}
@ -189,8 +200,14 @@ @@ -189,8 +200,14 @@
unsigned short currentStreamSize = currentstream->getListSize();
for(unsigned short i=0; i<currentStreamSize; ++i) {
new QListWidgetItem(currentstream->getItem(i)->getTitle(), listNews);
if(currentstream->getItem(i)->isRead())
if(currentstream->getItem(i)->isRead()){
listNews->item(i)->setData(Qt::ForegroundRole, QVariant(QColor("grey")));
listNews->item(i)->setData(Qt::DecorationRole, QVariant(QIcon(":/Icons/sphere.png")));
}
else {
listNews->item(i)->setData(Qt::DecorationRole, QVariant(QIcon(":/Icons/sphere2.png")));
listNews->item(i)->setData(Qt::ForegroundRole, QVariant(QColor("blue")));
}
if(i%2==0)
listNews->item(i)->setData(Qt::BackgroundRole, QVariant(QColor(0, 255, 255, 20)));
}
@ -242,15 +259,26 @@ @@ -242,15 +259,26 @@
refreshNewsList();
}
listStreams->topLevelItem(i)->setData(0,Qt::DecorationRole, QVariant(QIcon(rssmanager.getStream(i)->getIconPath())));
listStreams->topLevelItem(i)->child(0)->setText(0, rssmanager.getStream(i)->getDescription());
// update description and display last refresh
if(rssmanager.getStream(i)->getDescription()!="")
listStreams->topLevelItem(i)->child(DESCRIPTION_CHILD)->setText(0, rssmanager.getStream(i)->getDescription());
listStreams->topLevelItem(i)->child(TIME_CHILD)->setText(0, rssmanager.getStream(i)->getLastRefresh());
}
}
RSSImp::RSSImp() : QWidget(){
setupUi(this);
// icons of bottom buttons
addStream_button->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/add.png")));
delStream_button->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/remove.png")));
refreshAll_button->setIcon(QIcon(QString::fromUtf8(":/Icons/exec.png")));
// icons of right-click menu
actionDelete->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/remove.png")));
actionRename->setIcon(QIcon(QString::fromUtf8(":/Icons/log.png")));
actionRefresh->setIcon(QIcon(QString::fromUtf8(":/Icons/refresh.png")));
actionCreate->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/add.png")));
actionRefreshAll->setIcon(QIcon(QString::fromUtf8(":/Icons/refresh.png")));
connect(listStreams, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayRSSListMenu(const QPoint&)));
connect(actionDelete, SIGNAL(triggered()), this, SLOT(deleteStream()));
connect(actionRename, SIGNAL(triggered()), this, SLOT(renameStream()));

4
src/rss_imp.h

@ -28,6 +28,10 @@ @@ -28,6 +28,10 @@
#include "rss.h"
#include "GUI.h"
#define DESCRIPTION_CHILD 0
#define URL_CHILD 1
#define TIME_CHILD 2
class RSSImp : public QWidget, public Ui::RSS{
Q_OBJECT

Loading…
Cancel
Save