Browse Source

- COSMETIC: Redesigned RSS tab to improve usability

adaptive-webui-19844
Christophe Dumez 16 years ago
parent
commit
7e252d3fbd
  1. 1
      Changelog
  2. BIN
      src/Icons/oxygen/view-refresh.png
  3. BIN
      src/Icons/refresh.png
  4. 2
      src/icons.qrc
  5. 200
      src/rss.ui
  6. 128
      src/rss_imp.cpp
  7. 8
      src/rss_imp.h

1
Changelog

@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
- FEATURE: RSS Feeds URLs can now be copied to clipboard
- FEATURE: If a torrent contains a torrent file, process downloaded torrent file too
- BUGFIX: torrent resume code rewrited
- COSMETIC: Redesigned RSS tab to improve usability
* Sun Aug 21 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.4.1
- BUGFIX: Fix problems when changing save path (if using temporary download folder)

BIN
src/Icons/oxygen/view-refresh.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
src/Icons/refresh.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 948 B

2
src/icons.qrc

@ -3,7 +3,6 @@ @@ -3,7 +3,6 @@
<file>Icons/gnome-shutdown.png</file>
<file>Icons/rss32.png</file>
<file>Icons/money.png</file>
<file>Icons/refresh.png</file>
<file>Icons/sphere2.png</file>
<file>Icons/downarrow.png</file>
<file>Icons/url.png</file>
@ -74,6 +73,7 @@ @@ -74,6 +73,7 @@
<file>Icons/flags/italy.png</file>
<file>Icons/flags/south_korea.png</file>
<file>Icons/flags/japan.png</file>
<file>Icons/oxygen/view-refresh.png</file>
<file>Icons/oxygen/file.png</file>
<file>Icons/oxygen/time.png</file>
<file>Icons/oxygen/edit-paste.png</file>

200
src/rss.ui

@ -13,110 +13,46 @@ @@ -13,110 +13,46 @@
<property name="windowTitle">
<string>Search</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QSplitter" name="splitter_h">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<widget class="QWidget" name="">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QTreeWidget" name="listStreams">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="columnCount">
<number>2</number>
</property>
<column>
<property name="text">
<string>RSS streams:</string>
</property>
</column>
<column>
<property name="text">
<string>2</string>
</property>
</column>
</widget>
</item>
<item>
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="delStream_button">
<property name="minimumSize">
<size>
<width>55</width>
<height>32</height>
</size>
</property>
<property name="toolTip">
<string>Delete selected streams</string>
</property>
<widget class="QToolButton" name="newFeedButton">
<property name="text">
<string/>
<string>New subscription</string>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
<property name="icon">
<iconset resource="icons.qrc">
<normaloff>:/Icons/oxygen/subscribe.png</normaloff>:/Icons/oxygen/subscribe.png</iconset>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="refreshAll_button">
<property name="minimumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="toolTip">
<string>Refresh RSS streams</string>
</property>
<widget class="QToolButton" name="markReadButton">
<property name="text">
<string/>
<string>Mark items read</string>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
<property name="icon">
<iconset resource="icons.qrc">
<normaloff>:/Icons/oxygen/button_ok.png</normaloff>:/Icons/oxygen/button_ok.png</iconset>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="addStream_button">
<widget class="QToolButton" name="updateAllButton">
<property name="minimumSize">
<size>
<width>32</width>
@ -124,17 +60,24 @@ @@ -124,17 +60,24 @@
</size>
</property>
<property name="toolTip">
<string>Add a new RSS stream</string>
<string>Refresh RSS streams</string>
</property>
<property name="text">
<string/>
<string>Update all</string>
</property>
<property name="icon">
<iconset resource="icons.qrc">
<normaloff>:/Icons/oxygen/view-refresh.png</normaloff>:/Icons/oxygen/view-refresh.png</iconset>
</property>
<property name="iconSize">
<size>
<width>55</width>
<height>32</height>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
</widget>
</item>
<item>
@ -152,9 +95,30 @@ @@ -152,9 +95,30 @@
</item>
</layout>
</item>
<item>
<widget class="QTreeWidget" name="listStreams">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="columnCount">
<number>2</number>
</property>
<column>
<property name="text">
<string>RSS streams:</string>
</property>
</column>
<column>
<property name="text">
<string>2</string>
</property>
</column>
</widget>
</item>
</layout>
<zorder>listStreams</zorder>
<zorder></zorder>
</widget>
<widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="verticalLayout">
@ -196,34 +160,64 @@ p, li { white-space: pre-wrap; } @@ -196,34 +160,64 @@ p, li { white-space: pre-wrap; }
</widget>
</item>
</layout>
<action name="actionDelete">
<action name="actionDelete_feed">
<property name="icon">
<iconset resource="icons.qrc">
<normaloff>:/Icons/oxygen/unsubscribe16.png</normaloff>:/Icons/oxygen/unsubscribe16.png</iconset>
</property>
<property name="text">
<string>Delete</string>
<string>Delete feed</string>
</property>
</action>
<action name="actionRename">
<action name="actionRename_feed">
<property name="icon">
<iconset resource="icons.qrc">
<normaloff>:/Icons/oxygen/edit_clear.png</normaloff>:/Icons/oxygen/edit_clear.png</iconset>
</property>
<property name="text">
<string>Rename</string>
<string>Rename feed</string>
</property>
</action>
<action name="actionRefresh">
<action name="actionUpdate_feed">
<property name="icon">
<iconset resource="icons.qrc">
<normaloff>:/Icons/oxygen/view-refresh.png</normaloff>:/Icons/oxygen/view-refresh.png</iconset>
</property>
<property name="text">
<string>Refresh</string>
<string>Update feed</string>
</property>
</action>
<action name="actionCreate">
<action name="actionNew_subscription">
<property name="icon">
<iconset resource="icons.qrc">
<normaloff>:/Icons/oxygen/subscribe16.png</normaloff>:/Icons/oxygen/subscribe16.png</iconset>
</property>
<property name="text">
<string>Add RSS stream</string>
<string>New subscription</string>
</property>
</action>
<action name="actionRefreshAll">
<action name="actionUpdate_all_feeds">
<property name="icon">
<iconset resource="icons.qrc">
<normaloff>:/Icons/oxygen/view-refresh.png</normaloff>:/Icons/oxygen/view-refresh.png</iconset>
</property>
<property name="text">
<string>Refresh all streams</string>
<string>Update all feeds</string>
</property>
<property name="toolTip">
<string>Update all feeds</string>
</property>
</action>
<action name="actionMark_all_as_read">
<action name="actionMark_items_read">
<property name="icon">
<iconset resource="icons.qrc">
<normaloff>:/Icons/oxygen/button_ok.png</normaloff>:/Icons/oxygen/button_ok.png</iconset>
</property>
<property name="text">
<string>Mark all as read</string>
<string>Mark items read</string>
</property>
<property name="toolTip">
<string>Mark items read</string>
</property>
</action>
<action name="actionDownload_torrent">

128
src/rss_imp.cpp

@ -43,17 +43,21 @@ @@ -43,17 +43,21 @@
#include "bittorrent.h"
// display a right-click menu
void RSSImp::displayRSSListMenu(const QPoint&){
void RSSImp::displayRSSListMenu(const QPoint& pos){
if(!listStreams->indexAt(pos).isValid()) {
// No item under the mouse, clear selection
listStreams->clearSelection();
}
QMenu myFinishedListMenu(this);
QList<QTreeWidgetItem*> selectedItems = listStreams->selectedItems();
if(selectedItems.size() > 0) {
myFinishedListMenu.addAction(actionRefresh);
myFinishedListMenu.addAction(actionMark_all_as_read);
myFinishedListMenu.addAction(actionUpdate_feed);
myFinishedListMenu.addAction(actionMark_items_read);
myFinishedListMenu.addSeparator();
myFinishedListMenu.addAction(actionDelete);
if(selectedItems.size() == 1) {
myFinishedListMenu.addAction(actionRename);
myFinishedListMenu.addAction(actionRename_feed);
}
myFinishedListMenu.addAction(actionDelete_feed);
myFinishedListMenu.addSeparator();
myFinishedListMenu.addAction(actionCopy_feed_URL);
if(selectedItems.size() == 1) {
@ -62,8 +66,8 @@ void RSSImp::displayRSSListMenu(const QPoint&){ @@ -62,8 +66,8 @@ void RSSImp::displayRSSListMenu(const QPoint&){
}
}else{
myFinishedListMenu.addAction(actionCreate);
myFinishedListMenu.addAction(actionRefreshAll);
myFinishedListMenu.addAction(actionNew_subscription);
myFinishedListMenu.addAction(actionUpdate_all_feeds);
}
myFinishedListMenu.exec(QCursor::pos());
}
@ -79,8 +83,36 @@ void RSSImp::displayItemsListMenu(const QPoint&){ @@ -79,8 +83,36 @@ void RSSImp::displayItemsListMenu(const QPoint&){
}
// add a stream by a button
void RSSImp::on_addStream_button_clicked() {
createStream();
void RSSImp::on_newFeedButton_clicked() {
bool ok;
QString clip_txt = qApp->clipboard()->text();
QString default_url = "http://";
if(clip_txt.startsWith("http://", Qt::CaseInsensitive) || clip_txt.startsWith("https://", Qt::CaseInsensitive) || clip_txt.startsWith("ftp://", Qt::CaseInsensitive)) {
default_url = clip_txt;
}
QString newUrl = QInputDialog::getText(this, tr("Please type a rss stream url"), tr("Stream URL:"), QLineEdit::Normal, default_url, &ok);
if(ok) {
newUrl = newUrl.trimmed();
if(!newUrl.isEmpty()){
RssStream *stream = rssmanager->addStream(newUrl);
if(stream == 0){
// Already existing
QMessageBox::warning(this, tr("qBittorrent"),
tr("This rss feed is already in the list."),
QMessageBox::Ok);
return;
}
QTreeWidgetItem* item = new QTreeWidgetItem(listStreams);
item->setText(0, stream->getAliasOrUrl() + QString::fromUtf8(" (0)"));
item->setText(1, stream->getUrl());
item->setData(0,Qt::DecorationRole, QVariant(QIcon(":/Icons/loading.png")));
item->setToolTip(0, QString::fromUtf8("<b>")+tr("Description:")+QString::fromUtf8("</b> ")+stream->getDescription()+QString::fromUtf8("<br/><b>")+tr("url:")+QString::fromUtf8("</b> ")+stream->getUrl()+QString::fromUtf8("<br/><b>")+tr("Last refresh:")+QString::fromUtf8("</b> ")+stream->getLastRefreshElapsedString());
if(listStreams->topLevelItemCount() == 1)
selectFirstFeed();
rssmanager->refresh(newUrl);
rssmanager->saveStreamList();
}
}
}
// delete a stream by a button
@ -112,8 +144,12 @@ void RSSImp::on_delStream_button_clicked() { @@ -112,8 +144,12 @@ void RSSImp::on_delStream_button_clicked() {
}
// refresh all streams by a button
void RSSImp::on_refreshAll_button_clicked() {
refreshAllStreams();
void RSSImp::on_updateAllButton_clicked() {
unsigned int nbFeeds = listStreams->topLevelItemCount();
for(unsigned int i=0; i<nbFeeds; ++i)
listStreams->topLevelItem(i)->setData(0,Qt::DecorationRole, QVariant(QIcon(":/Icons/loading.png")));
rssmanager->refreshAll();
updateLastRefreshedTimeForStreams();
}
void RSSImp::downloadTorrent() {
@ -174,7 +210,7 @@ void RSSImp::showFeedDownloader() { @@ -174,7 +210,7 @@ void RSSImp::showFeedDownloader() {
new FeedDownloaderDlg(this, item->text(1), rssmanager->getFeed(item->text(1))->getAliasOrUrl(), BTSession);
}
void RSSImp::on_actionMark_all_as_read_triggered() {
void RSSImp::on_markReadButton_clicked() {
QList<QTreeWidgetItem*> selectedItems = listStreams->selectedItems();
QTreeWidgetItem* item;
foreach(item, selectedItems){
@ -187,15 +223,6 @@ void RSSImp::on_actionMark_all_as_read_triggered() { @@ -187,15 +223,6 @@ void RSSImp::on_actionMark_all_as_read_triggered() {
refreshNewsList(listStreams->currentItem());
}
//right-click somewhere, refresh all the streams
void RSSImp::refreshAllStreams() {
unsigned int nbFeeds = listStreams->topLevelItemCount();
for(unsigned int i=0; i<nbFeeds; ++i)
listStreams->topLevelItem(i)->setData(0,Qt::DecorationRole, QVariant(QIcon(":/Icons/loading.png")));
rssmanager->refreshAll();
updateLastRefreshedTimeForStreams();
}
void RSSImp::fillFeedsList() {
QList<RssStream*> feeds = rssmanager->getRssFeeds();
RssStream* stream;
@ -208,39 +235,6 @@ void RSSImp::fillFeedsList() { @@ -208,39 +235,6 @@ void RSSImp::fillFeedsList() {
}
}
//right-click, register a new stream
void RSSImp::createStream() {
bool ok;
QString clip_txt = qApp->clipboard()->text();
QString default_url = "http://";
if(clip_txt.startsWith("http://", Qt::CaseInsensitive) || clip_txt.startsWith("https://", Qt::CaseInsensitive) || clip_txt.startsWith("ftp://", Qt::CaseInsensitive)) {
default_url = clip_txt;
}
QString newUrl = QInputDialog::getText(this, tr("Please type a rss stream url"), tr("Stream URL:"), QLineEdit::Normal, default_url, &ok);
if(ok) {
newUrl = newUrl.trimmed();
if(!newUrl.isEmpty()){
RssStream *stream = rssmanager->addStream(newUrl);
if(stream == 0){
// Already existing
QMessageBox::warning(this, tr("qBittorrent"),
tr("This rss feed is already in the list."),
QMessageBox::Ok);
return;
}
QTreeWidgetItem* item = new QTreeWidgetItem(listStreams);
item->setText(0, stream->getAliasOrUrl() + QString::fromUtf8(" (0)"));
item->setText(1, stream->getUrl());
item->setData(0,Qt::DecorationRole, QVariant(QIcon(":/Icons/loading.png")));
item->setToolTip(0, QString::fromUtf8("<b>")+tr("Description:")+QString::fromUtf8("</b> ")+stream->getDescription()+QString::fromUtf8("<br/><b>")+tr("url:")+QString::fromUtf8("</b> ")+stream->getUrl()+QString::fromUtf8("<br/><b>")+tr("Last refresh:")+QString::fromUtf8("</b> ")+stream->getLastRefreshElapsedString());
if(listStreams->topLevelItemCount() == 1)
selectFirstFeed();
rssmanager->refresh(newUrl);
rssmanager->saveStreamList();
}
}
}
void RSSImp::updateLastRefreshedTimeForStreams() {
unsigned int nbFeeds = listStreams->topLevelItemCount();
for(unsigned int i=0; i<nbFeeds; ++i){
@ -361,18 +355,6 @@ RSSImp::RSSImp(bittorrent *BTSession) : QWidget(), BTSession(BTSession){ @@ -361,18 +355,6 @@ RSSImp::RSSImp(bittorrent *BTSession) : QWidget(), BTSession(BTSession){
setupUi(this);
selectedFeedUrl = QString::null;
// icons of bottom buttons
addStream_button->setIcon(QIcon(QString::fromUtf8(":/Icons/oxygen/subscribe.png")));
delStream_button->setIcon(QIcon(QString::fromUtf8(":/Icons/oxygen/unsubscribe.png")));
refreshAll_button->setIcon(QIcon(QString::fromUtf8(":/Icons/refresh.png")));
actionMark_all_as_read->setIcon(QIcon(QString::fromUtf8(":/Icons/oxygen/button_ok.png")));
// icons of right-click menu
actionDelete->setIcon(QIcon(QString::fromUtf8(":/Icons/oxygen/unsubscribe16.png")));
actionRename->setIcon(QIcon(QString::fromUtf8(":/Icons/oxygen/log.png")));
actionRefresh->setIcon(QIcon(QString::fromUtf8(":/Icons/refresh.png")));
actionCreate->setIcon(QIcon(QString::fromUtf8(":/Icons/oxygen/subscribe16.png")));
actionRefreshAll->setIcon(QIcon(QString::fromUtf8(":/Icons/refresh.png")));
// Hide second column (url)
listStreams->hideColumn(1);
@ -384,14 +366,16 @@ RSSImp::RSSImp(bittorrent *BTSession) : QWidget(), BTSession(BTSession){ @@ -384,14 +366,16 @@ RSSImp::RSSImp(bittorrent *BTSession) : QWidget(), BTSession(BTSession){
connect(listStreams, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayRSSListMenu(const QPoint&)));
connect(listNews, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayItemsListMenu(const QPoint&)));
connect(actionDelete, SIGNAL(triggered()), this, SLOT(on_delStream_button_clicked()));
connect(actionRename, SIGNAL(triggered()), this, SLOT(renameStream()));
connect(actionRefresh, SIGNAL(triggered()), this, SLOT(refreshSelectedStreams()));
connect(actionCreate, SIGNAL(triggered()), this, SLOT(createStream()));
connect(actionRefreshAll, SIGNAL(triggered()), this, SLOT(refreshAllStreams()));
// Feeds list actions
connect(actionDelete_feed, SIGNAL(triggered()), this, SLOT(on_delStream_button_clicked()));
connect(actionRename_feed, SIGNAL(triggered()), this, SLOT(renameStream()));
connect(actionUpdate_feed, SIGNAL(triggered()), this, SLOT(refreshSelectedStreams()));
connect(actionNew_subscription, SIGNAL(triggered()), this, SLOT(on_newFeedButton_clicked()));
connect(actionUpdate_all_feeds, SIGNAL(triggered()), this, SLOT(on_updateAllButton_clicked()));
connect(actionCopy_feed_URL, SIGNAL(triggered()), this, SLOT(copySelectedFeedsURL()));
connect(actionRSS_feed_downloader, SIGNAL(triggered()), this, SLOT(showFeedDownloader()));
connect(actionMark_items_read, SIGNAL(triggered()), this, SLOT(on_markReadButton_clicked()));
// News list actions
connect(actionOpen_news_URL, SIGNAL(triggered()), this, SLOT(openNewsUrl()));
connect(actionDownload_torrent, SIGNAL(triggered()), this, SLOT(downloadTorrent()));

8
src/rss_imp.h

@ -51,15 +51,14 @@ class RSSImp : public QWidget, public Ui::RSS{ @@ -51,15 +51,14 @@ class RSSImp : public QWidget, public Ui::RSS{
void on_delStream_button_clicked();
protected slots:
void on_addStream_button_clicked();
void on_refreshAll_button_clicked();
void on_newFeedButton_clicked();
void on_updateAllButton_clicked();
void on_markReadButton_clicked();
void displayRSSListMenu(const QPoint&);
void displayItemsListMenu(const QPoint&);
void renameStream();
void refreshSelectedStreams();
void copySelectedFeedsURL();
void createStream();
void refreshAllStreams();
void refreshNewsList(QTreeWidgetItem* item);
void refreshTextBrowser(QListWidgetItem *);
void updateLastRefreshedTimeForStreams();
@ -70,7 +69,6 @@ class RSSImp : public QWidget, public Ui::RSS{ @@ -70,7 +69,6 @@ class RSSImp : public QWidget, public Ui::RSS{
void fillFeedsList();
void selectFirstFeed();
void updateFeedNbNews(QString url);
void on_actionMark_all_as_read_triggered();
void saveSlidersPosition();
void restoreSlidersPosition();
void showFeedDownloader();

Loading…
Cancel
Save