mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-03-09 03:41:16 +00:00
rss : improvements of the qtreeview
This commit is contained in:
parent
2c6b66a834
commit
06378e09be
BIN
src/Icons/description.png
Normal file
BIN
src/Icons/description.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 821 B |
BIN
src/Icons/sphere.png
Normal file
BIN
src/Icons/sphere.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 337 B |
BIN
src/Icons/sphere2.png
Normal file
BIN
src/Icons/sphere2.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 379 B |
BIN
src/Icons/time.png
Normal file
BIN
src/Icons/time.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 513 B |
BIN
src/Icons/url.png
Normal file
BIN
src/Icons/url.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 629 B |
@ -20,14 +20,19 @@
|
|||||||
<file>Icons/splash.png</file>
|
<file>Icons/splash.png</file>
|
||||||
<file>Icons/home.png</file>
|
<file>Icons/home.png</file>
|
||||||
<file>Icons/uparrow.png</file>
|
<file>Icons/uparrow.png</file>
|
||||||
<file>Icons/rss.png</file>
|
|
||||||
<file>Icons/downarrow.png</file>
|
<file>Icons/downarrow.png</file>
|
||||||
<file>Icons/connection.png</file>
|
<file>Icons/connection.png</file>
|
||||||
<file>Icons/add_file.png</file>
|
|
||||||
<file>Icons/refresh.png</file>
|
<file>Icons/refresh.png</file>
|
||||||
|
<file>Icons/rss.png</file>
|
||||||
<file>Icons/add_folder.png</file>
|
<file>Icons/add_folder.png</file>
|
||||||
|
<file>Icons/add_file.png</file>
|
||||||
<file>Icons/loading.png</file>
|
<file>Icons/loading.png</file>
|
||||||
<file>Icons/exec.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/portugal.png</file>
|
||||||
<file>Icons/flags/france.png</file>
|
<file>Icons/flags/france.png</file>
|
||||||
<file>Icons/flags/ukraine.png</file>
|
<file>Icons/flags/ukraine.png</file>
|
||||||
|
@ -274,6 +274,10 @@ class RssStream : public QObject{
|
|||||||
return lastRefresh.elapsed();
|
return lastRefresh.elapsed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString getLastRefresh() const{
|
||||||
|
return QString::number(lastRefresh.hour())+"h"+QString::number(lastRefresh.minute())+"m";
|
||||||
|
}
|
||||||
|
|
||||||
bool isRead() const {
|
bool isRead() const {
|
||||||
return read;
|
return read;
|
||||||
}
|
}
|
||||||
|
@ -71,13 +71,14 @@
|
|||||||
rssmanager.getStream(getNumStreamSelected())->setRead();
|
rssmanager.getStream(getNumStreamSelected())->setRead();
|
||||||
// update the color of the stream, is it old ?
|
// update the color of the stream, is it old ?
|
||||||
updateStreamName(getNumStreamSelected(), LATENCY);
|
updateStreamName(getNumStreamSelected(), LATENCY);
|
||||||
refreshNewsList();
|
refreshNewsList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// display the content of a new when clicked on it
|
// display the content of a new when clicked on it
|
||||||
void RSSImp::on_listNews_clicked() {
|
void RSSImp::on_listNews_clicked() {
|
||||||
listNews->item(listNews->currentRow())->setData(Qt::ForegroundRole, QVariant(QColor("grey")));
|
listNews->item(listNews->currentRow())->setData(Qt::ForegroundRole, QVariant(QColor("grey")));
|
||||||
|
listNews->item(listNews->currentRow())->setData(Qt::DecorationRole, QVariant(QIcon(":/Icons/sphere.png")));
|
||||||
refreshTextBrowser();
|
refreshTextBrowser();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,7 +177,17 @@
|
|||||||
for(unsigned short i=0; i<nbstream; i++) {
|
for(unsigned short i=0; i<nbstream; i++) {
|
||||||
QTreeWidgetItem* stream = new QTreeWidgetItem(listStreams);
|
QTreeWidgetItem* stream = new QTreeWidgetItem(listStreams);
|
||||||
QTreeWidgetItem* description = new QTreeWidgetItem(stream);
|
QTreeWidgetItem* description = new QTreeWidgetItem(stream);
|
||||||
|
QTreeWidgetItem* url = new QTreeWidgetItem(stream);
|
||||||
|
QTreeWidgetItem* time = new QTreeWidgetItem(stream);
|
||||||
description->setText(0, tr("no description avalaible"));
|
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);
|
updateStreamName(i, NEWS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -189,8 +200,14 @@
|
|||||||
unsigned short currentStreamSize = currentstream->getListSize();
|
unsigned short currentStreamSize = currentstream->getListSize();
|
||||||
for(unsigned short i=0; i<currentStreamSize; ++i) {
|
for(unsigned short i=0; i<currentStreamSize; ++i) {
|
||||||
new QListWidgetItem(currentstream->getItem(i)->getTitle(), listNews);
|
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::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)
|
if(i%2==0)
|
||||||
listNews->item(i)->setData(Qt::BackgroundRole, QVariant(QColor(0, 255, 255, 20)));
|
listNews->item(i)->setData(Qt::BackgroundRole, QVariant(QColor(0, 255, 255, 20)));
|
||||||
}
|
}
|
||||||
@ -242,15 +259,26 @@
|
|||||||
refreshNewsList();
|
refreshNewsList();
|
||||||
}
|
}
|
||||||
listStreams->topLevelItem(i)->setData(0,Qt::DecorationRole, QVariant(QIcon(rssmanager.getStream(i)->getIconPath())));
|
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(){
|
RSSImp::RSSImp() : QWidget(){
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
// icons of bottom buttons
|
||||||
addStream_button->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/add.png")));
|
addStream_button->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/add.png")));
|
||||||
delStream_button->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/remove.png")));
|
delStream_button->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/remove.png")));
|
||||||
refreshAll_button->setIcon(QIcon(QString::fromUtf8(":/Icons/exec.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(listStreams, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayRSSListMenu(const QPoint&)));
|
||||||
connect(actionDelete, SIGNAL(triggered()), this, SLOT(deleteStream()));
|
connect(actionDelete, SIGNAL(triggered()), this, SLOT(deleteStream()));
|
||||||
connect(actionRename, SIGNAL(triggered()), this, SLOT(renameStream()));
|
connect(actionRename, SIGNAL(triggered()), this, SLOT(renameStream()));
|
||||||
|
@ -28,6 +28,10 @@
|
|||||||
#include "rss.h"
|
#include "rss.h"
|
||||||
#include "GUI.h"
|
#include "GUI.h"
|
||||||
|
|
||||||
|
#define DESCRIPTION_CHILD 0
|
||||||
|
#define URL_CHILD 1
|
||||||
|
#define TIME_CHILD 2
|
||||||
|
|
||||||
class RSSImp : public QWidget, public Ui::RSS{
|
class RSSImp : public QWidget, public Ui::RSS{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user