diff --git a/Changelog b/Changelog index f3cdbd5ca..56d9e7cbf 100644 --- a/Changelog +++ b/Changelog @@ -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 - v1.4.1 - BUGFIX: Fix problems when changing save path (if using temporary download folder) diff --git a/src/Icons/oxygen/view-refresh.png b/src/Icons/oxygen/view-refresh.png new file mode 100644 index 000000000..afa2a9d77 Binary files /dev/null and b/src/Icons/oxygen/view-refresh.png differ diff --git a/src/Icons/refresh.png b/src/Icons/refresh.png deleted file mode 100644 index 0e156dc8e..000000000 Binary files a/src/Icons/refresh.png and /dev/null differ diff --git a/src/icons.qrc b/src/icons.qrc index 9808eb6e3..358f61c1e 100644 --- a/src/icons.qrc +++ b/src/icons.qrc @@ -3,7 +3,6 @@ Icons/gnome-shutdown.png Icons/rss32.png Icons/money.png - Icons/refresh.png Icons/sphere2.png Icons/downarrow.png Icons/url.png @@ -74,6 +73,7 @@ Icons/flags/italy.png Icons/flags/south_korea.png Icons/flags/japan.png + Icons/oxygen/view-refresh.png Icons/oxygen/file.png Icons/oxygen/time.png Icons/oxygen/edit-paste.png diff --git a/src/rss.ui b/src/rss.ui index fba0605a8..febb7d24f 100644 --- a/src/rss.ui +++ b/src/rss.ui @@ -13,110 +13,46 @@ Search - + Qt::Horizontal - - - - 6 - - - 0 - + + - - - Qt::CustomContextMenu - - - QAbstractItemView::ExtendedSelection - - - 2 - - - - RSS streams: - - - - - 2 - - - - - - - - 6 - - - 0 - + - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 55 - 32 - - - - Delete selected streams - + - + New subscription - - - 32 - 32 - + + + :/Icons/oxygen/subscribe.png:/Icons/oxygen/subscribe.png + + + Qt::ToolButtonTextUnderIcon - - - - 32 - 32 - - - - Refresh RSS streams - + - + Mark items read - - - 32 - 32 - + + + :/Icons/oxygen/button_ok.png:/Icons/oxygen/button_ok.png + + + Qt::ToolButtonTextUnderIcon - + 32 @@ -124,17 +60,24 @@ - Add a new RSS stream + Refresh RSS streams - + Update all + + + + :/Icons/oxygen/view-refresh.png:/Icons/oxygen/view-refresh.png - 55 - 32 + 24 + 24 + + Qt::ToolButtonTextUnderIcon + @@ -152,9 +95,30 @@ + + + + Qt::CustomContextMenu + + + QAbstractItemView::ExtendedSelection + + + 2 + + + + RSS streams: + + + + + 2 + + + + - listStreams - @@ -196,34 +160,64 @@ p, li { white-space: pre-wrap; } - + + + + :/Icons/oxygen/unsubscribe16.png:/Icons/oxygen/unsubscribe16.png + - Delete + Delete feed - + + + + :/Icons/oxygen/edit_clear.png:/Icons/oxygen/edit_clear.png + - Rename + Rename feed - + + + + :/Icons/oxygen/view-refresh.png:/Icons/oxygen/view-refresh.png + - Refresh + Update feed - + + + + :/Icons/oxygen/subscribe16.png:/Icons/oxygen/subscribe16.png + - Add RSS stream + New subscription - + + + + :/Icons/oxygen/view-refresh.png:/Icons/oxygen/view-refresh.png + - Refresh all streams + Update all feeds + + + Update all feeds - + + + + :/Icons/oxygen/button_ok.png:/Icons/oxygen/button_ok.png + - Mark all as read + Mark items read + + + Mark items read diff --git a/src/rss_imp.cpp b/src/rss_imp.cpp index c7a9e42ac..fdda79856 100644 --- a/src/rss_imp.cpp +++ b/src/rss_imp.cpp @@ -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 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&){ } }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&){ } // 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("")+tr("Description:")+QString::fromUtf8(" ")+stream->getDescription()+QString::fromUtf8("
")+tr("url:")+QString::fromUtf8(" ")+stream->getUrl()+QString::fromUtf8("
")+tr("Last refresh:")+QString::fromUtf8(" ")+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() { } // 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; itopLevelItem(i)->setData(0,Qt::DecorationRole, QVariant(QIcon(":/Icons/loading.png"))); + rssmanager->refreshAll(); + updateLastRefreshedTimeForStreams(); } void RSSImp::downloadTorrent() { @@ -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 selectedItems = listStreams->selectedItems(); QTreeWidgetItem* item; foreach(item, selectedItems){ @@ -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; itopLevelItem(i)->setData(0,Qt::DecorationRole, QVariant(QIcon(":/Icons/loading.png"))); - rssmanager->refreshAll(); - updateLastRefreshedTimeForStreams(); -} - void RSSImp::fillFeedsList() { QList feeds = rssmanager->getRssFeeds(); RssStream* stream; @@ -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("")+tr("Description:")+QString::fromUtf8(" ")+stream->getDescription()+QString::fromUtf8("
")+tr("url:")+QString::fromUtf8(" ")+stream->getUrl()+QString::fromUtf8("
")+tr("Last refresh:")+QString::fromUtf8(" ")+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; isetIcon(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){ 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())); diff --git a/src/rss_imp.h b/src/rss_imp.h index f36358a81..f8177663e 100644 --- a/src/rss_imp.h +++ b/src/rss_imp.h @@ -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{ void fillFeedsList(); void selectFirstFeed(); void updateFeedNbNews(QString url); - void on_actionMark_all_as_read_triggered(); void saveSlidersPosition(); void restoreSlidersPosition(); void showFeedDownloader();