mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-15 01:33:07 -07:00
- COSMETIC: Redesigned RSS tab to improve usability
This commit is contained in:
parent
2dc9f10bf4
commit
7e252d3fbd
7 changed files with 180 additions and 203 deletions
|
@ -8,6 +8,7 @@
|
||||||
- FEATURE: RSS Feeds URLs can now be copied to clipboard
|
- FEATURE: RSS Feeds URLs can now be copied to clipboard
|
||||||
- FEATURE: If a torrent contains a torrent file, process downloaded torrent file too
|
- FEATURE: If a torrent contains a torrent file, process downloaded torrent file too
|
||||||
- BUGFIX: torrent resume code rewrited
|
- BUGFIX: torrent resume code rewrited
|
||||||
|
- COSMETIC: Redesigned RSS tab to improve usability
|
||||||
|
|
||||||
* Sun Aug 21 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.4.1
|
* Sun Aug 21 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.4.1
|
||||||
- BUGFIX: Fix problems when changing save path (if using temporary download folder)
|
- BUGFIX: Fix problems when changing save path (if using temporary download folder)
|
||||||
|
|
BIN
src/Icons/oxygen/view-refresh.png
Normal file
BIN
src/Icons/oxygen/view-refresh.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 948 B |
|
@ -3,7 +3,6 @@
|
||||||
<file>Icons/gnome-shutdown.png</file>
|
<file>Icons/gnome-shutdown.png</file>
|
||||||
<file>Icons/rss32.png</file>
|
<file>Icons/rss32.png</file>
|
||||||
<file>Icons/money.png</file>
|
<file>Icons/money.png</file>
|
||||||
<file>Icons/refresh.png</file>
|
|
||||||
<file>Icons/sphere2.png</file>
|
<file>Icons/sphere2.png</file>
|
||||||
<file>Icons/downarrow.png</file>
|
<file>Icons/downarrow.png</file>
|
||||||
<file>Icons/url.png</file>
|
<file>Icons/url.png</file>
|
||||||
|
@ -74,6 +73,7 @@
|
||||||
<file>Icons/flags/italy.png</file>
|
<file>Icons/flags/italy.png</file>
|
||||||
<file>Icons/flags/south_korea.png</file>
|
<file>Icons/flags/south_korea.png</file>
|
||||||
<file>Icons/flags/japan.png</file>
|
<file>Icons/flags/japan.png</file>
|
||||||
|
<file>Icons/oxygen/view-refresh.png</file>
|
||||||
<file>Icons/oxygen/file.png</file>
|
<file>Icons/oxygen/file.png</file>
|
||||||
<file>Icons/oxygen/time.png</file>
|
<file>Icons/oxygen/time.png</file>
|
||||||
<file>Icons/oxygen/edit-paste.png</file>
|
<file>Icons/oxygen/edit-paste.png</file>
|
||||||
|
|
244
src/rss.ui
244
src/rss.ui
|
@ -13,20 +13,88 @@
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Search</string>
|
<string>Search</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSplitter" name="splitter_h">
|
<widget class="QSplitter" name="splitter_h">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="layoutWidget">
|
<widget class="QWidget" name="">
|
||||||
<layout class="QVBoxLayout">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<property name="spacing">
|
<item>
|
||||||
<number>6</number>
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
</property>
|
<item>
|
||||||
<property name="margin">
|
<widget class="QToolButton" name="newFeedButton">
|
||||||
<number>0</number>
|
<property name="text">
|
||||||
</property>
|
<string>New subscription</string>
|
||||||
|
</property>
|
||||||
|
<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="QToolButton" name="markReadButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Mark items read</string>
|
||||||
|
</property>
|
||||||
|
<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="QToolButton" name="updateAllButton">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>32</width>
|
||||||
|
<height>32</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Refresh RSS streams</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<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>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolButtonStyle">
|
||||||
|
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<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>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTreeWidget" name="listStreams">
|
<widget class="QTreeWidget" name="listStreams">
|
||||||
<property name="contextMenuPolicy">
|
<property name="contextMenuPolicy">
|
||||||
|
@ -50,111 +118,7 @@
|
||||||
</column>
|
</column>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<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>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>32</width>
|
|
||||||
<height>32</height>
|
|
||||||
</size>
|
|
||||||
</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>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>32</width>
|
|
||||||
<height>32</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="addStream_button">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>32</width>
|
|
||||||
<height>32</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Add a new RSS stream</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>55</width>
|
|
||||||
<height>32</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<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>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
<zorder>listStreams</zorder>
|
|
||||||
<zorder></zorder>
|
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="layoutWidget">
|
<widget class="QWidget" name="layoutWidget">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
@ -196,34 +160,64 @@ p, li { white-space: pre-wrap; }
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</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">
|
<property name="text">
|
||||||
<string>Delete</string>
|
<string>Delete feed</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</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">
|
<property name="text">
|
||||||
<string>Rename</string>
|
<string>Rename feed</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</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">
|
<property name="text">
|
||||||
<string>Refresh</string>
|
<string>Update feed</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</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">
|
<property name="text">
|
||||||
<string>Add RSS stream</string>
|
<string>New subscription</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</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">
|
<property name="text">
|
||||||
<string>Refresh all streams</string>
|
<string>Update all feeds</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Update all feeds</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</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">
|
<property name="text">
|
||||||
<string>Mark all as read</string>
|
<string>Mark items read</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Mark items read</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionDownload_torrent">
|
<action name="actionDownload_torrent">
|
||||||
|
|
128
src/rss_imp.cpp
128
src/rss_imp.cpp
|
@ -43,17 +43,21 @@
|
||||||
#include "bittorrent.h"
|
#include "bittorrent.h"
|
||||||
|
|
||||||
// display a right-click menu
|
// 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);
|
QMenu myFinishedListMenu(this);
|
||||||
QList<QTreeWidgetItem*> selectedItems = listStreams->selectedItems();
|
QList<QTreeWidgetItem*> selectedItems = listStreams->selectedItems();
|
||||||
if(selectedItems.size() > 0) {
|
if(selectedItems.size() > 0) {
|
||||||
myFinishedListMenu.addAction(actionRefresh);
|
myFinishedListMenu.addAction(actionUpdate_feed);
|
||||||
myFinishedListMenu.addAction(actionMark_all_as_read);
|
myFinishedListMenu.addAction(actionMark_items_read);
|
||||||
myFinishedListMenu.addSeparator();
|
myFinishedListMenu.addSeparator();
|
||||||
myFinishedListMenu.addAction(actionDelete);
|
|
||||||
if(selectedItems.size() == 1) {
|
if(selectedItems.size() == 1) {
|
||||||
myFinishedListMenu.addAction(actionRename);
|
myFinishedListMenu.addAction(actionRename_feed);
|
||||||
}
|
}
|
||||||
|
myFinishedListMenu.addAction(actionDelete_feed);
|
||||||
myFinishedListMenu.addSeparator();
|
myFinishedListMenu.addSeparator();
|
||||||
myFinishedListMenu.addAction(actionCopy_feed_URL);
|
myFinishedListMenu.addAction(actionCopy_feed_URL);
|
||||||
if(selectedItems.size() == 1) {
|
if(selectedItems.size() == 1) {
|
||||||
|
@ -62,8 +66,8 @@ void RSSImp::displayRSSListMenu(const QPoint&){
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
myFinishedListMenu.addAction(actionCreate);
|
myFinishedListMenu.addAction(actionNew_subscription);
|
||||||
myFinishedListMenu.addAction(actionRefreshAll);
|
myFinishedListMenu.addAction(actionUpdate_all_feeds);
|
||||||
}
|
}
|
||||||
myFinishedListMenu.exec(QCursor::pos());
|
myFinishedListMenu.exec(QCursor::pos());
|
||||||
}
|
}
|
||||||
|
@ -79,8 +83,36 @@ void RSSImp::displayItemsListMenu(const QPoint&){
|
||||||
}
|
}
|
||||||
|
|
||||||
// add a stream by a button
|
// add a stream by a button
|
||||||
void RSSImp::on_addStream_button_clicked() {
|
void RSSImp::on_newFeedButton_clicked() {
|
||||||
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete a stream by a button
|
// delete a stream by a button
|
||||||
|
@ -112,8 +144,12 @@ void RSSImp::on_delStream_button_clicked() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// refresh all streams by a button
|
// refresh all streams by a button
|
||||||
void RSSImp::on_refreshAll_button_clicked() {
|
void RSSImp::on_updateAllButton_clicked() {
|
||||||
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::downloadTorrent() {
|
void RSSImp::downloadTorrent() {
|
||||||
|
@ -174,7 +210,7 @@ void RSSImp::showFeedDownloader() {
|
||||||
new FeedDownloaderDlg(this, item->text(1), rssmanager->getFeed(item->text(1))->getAliasOrUrl(), BTSession);
|
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();
|
QList<QTreeWidgetItem*> selectedItems = listStreams->selectedItems();
|
||||||
QTreeWidgetItem* item;
|
QTreeWidgetItem* item;
|
||||||
foreach(item, selectedItems){
|
foreach(item, selectedItems){
|
||||||
|
@ -187,15 +223,6 @@ void RSSImp::on_actionMark_all_as_read_triggered() {
|
||||||
refreshNewsList(listStreams->currentItem());
|
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() {
|
void RSSImp::fillFeedsList() {
|
||||||
QList<RssStream*> feeds = rssmanager->getRssFeeds();
|
QList<RssStream*> feeds = rssmanager->getRssFeeds();
|
||||||
RssStream* stream;
|
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("<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() {
|
void RSSImp::updateLastRefreshedTimeForStreams() {
|
||||||
unsigned int nbFeeds = listStreams->topLevelItemCount();
|
unsigned int nbFeeds = listStreams->topLevelItemCount();
|
||||||
for(unsigned int i=0; i<nbFeeds; ++i){
|
for(unsigned int i=0; i<nbFeeds; ++i){
|
||||||
|
@ -361,18 +355,6 @@ RSSImp::RSSImp(bittorrent *BTSession) : QWidget(), BTSession(BTSession){
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
selectedFeedUrl = QString::null;
|
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)
|
// Hide second column (url)
|
||||||
listStreams->hideColumn(1);
|
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(listStreams, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayRSSListMenu(const QPoint&)));
|
||||||
connect(listNews, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayItemsListMenu(const QPoint&)));
|
connect(listNews, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayItemsListMenu(const QPoint&)));
|
||||||
|
|
||||||
connect(actionDelete, SIGNAL(triggered()), this, SLOT(on_delStream_button_clicked()));
|
// Feeds list actions
|
||||||
connect(actionRename, SIGNAL(triggered()), this, SLOT(renameStream()));
|
connect(actionDelete_feed, SIGNAL(triggered()), this, SLOT(on_delStream_button_clicked()));
|
||||||
connect(actionRefresh, SIGNAL(triggered()), this, SLOT(refreshSelectedStreams()));
|
connect(actionRename_feed, SIGNAL(triggered()), this, SLOT(renameStream()));
|
||||||
connect(actionCreate, SIGNAL(triggered()), this, SLOT(createStream()));
|
connect(actionUpdate_feed, SIGNAL(triggered()), this, SLOT(refreshSelectedStreams()));
|
||||||
connect(actionRefreshAll, SIGNAL(triggered()), this, SLOT(refreshAllStreams()));
|
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(actionCopy_feed_URL, SIGNAL(triggered()), this, SLOT(copySelectedFeedsURL()));
|
||||||
connect(actionRSS_feed_downloader, SIGNAL(triggered()), this, SLOT(showFeedDownloader()));
|
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(actionOpen_news_URL, SIGNAL(triggered()), this, SLOT(openNewsUrl()));
|
||||||
connect(actionDownload_torrent, SIGNAL(triggered()), this, SLOT(downloadTorrent()));
|
connect(actionDownload_torrent, SIGNAL(triggered()), this, SLOT(downloadTorrent()));
|
||||||
|
|
||||||
|
|
|
@ -51,15 +51,14 @@ class RSSImp : public QWidget, public Ui::RSS{
|
||||||
void on_delStream_button_clicked();
|
void on_delStream_button_clicked();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void on_addStream_button_clicked();
|
void on_newFeedButton_clicked();
|
||||||
void on_refreshAll_button_clicked();
|
void on_updateAllButton_clicked();
|
||||||
|
void on_markReadButton_clicked();
|
||||||
void displayRSSListMenu(const QPoint&);
|
void displayRSSListMenu(const QPoint&);
|
||||||
void displayItemsListMenu(const QPoint&);
|
void displayItemsListMenu(const QPoint&);
|
||||||
void renameStream();
|
void renameStream();
|
||||||
void refreshSelectedStreams();
|
void refreshSelectedStreams();
|
||||||
void copySelectedFeedsURL();
|
void copySelectedFeedsURL();
|
||||||
void createStream();
|
|
||||||
void refreshAllStreams();
|
|
||||||
void refreshNewsList(QTreeWidgetItem* item);
|
void refreshNewsList(QTreeWidgetItem* item);
|
||||||
void refreshTextBrowser(QListWidgetItem *);
|
void refreshTextBrowser(QListWidgetItem *);
|
||||||
void updateLastRefreshedTimeForStreams();
|
void updateLastRefreshedTimeForStreams();
|
||||||
|
@ -70,7 +69,6 @@ class RSSImp : public QWidget, public Ui::RSS{
|
||||||
void fillFeedsList();
|
void fillFeedsList();
|
||||||
void selectFirstFeed();
|
void selectFirstFeed();
|
||||||
void updateFeedNbNews(QString url);
|
void updateFeedNbNews(QString url);
|
||||||
void on_actionMark_all_as_read_triggered();
|
|
||||||
void saveSlidersPosition();
|
void saveSlidersPosition();
|
||||||
void restoreSlidersPosition();
|
void restoreSlidersPosition();
|
||||||
void showFeedDownloader();
|
void showFeedDownloader();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue