Browse Source

- Fixed some bugs in rss

adaptive-webui-19844
Christophe Dumez 18 years ago
parent
commit
4473b7917b
  1. 3
      Changelog
  2. 12
      src/rss.h
  3. 3
      src/rss_imp.cpp

3
Changelog

@ -1,5 +1,6 @@
* Unknown - Christophe Dumez <chris@qbittorrent.org> - v0.10.0 * Unknown - Christophe Dumez <chris@qbittorrent.org> - v0.10.0
- FEATURE: Added UPnP port forwarding support - FEATURE: Added UPnP / NAT-PMP port forwarding support
- FEATURE: Added RSS support
- FEATURE: Finished torrents are moved to another tab - FEATURE: Finished torrents are moved to another tab
- FEATURE: Display more infos about the torrent in its properties - FEATURE: Display more infos about the torrent in its properties
- FEATURE: Allow the user to edit torrents' trackers - FEATURE: Allow the user to edit torrents' trackers

12
src/rss.h

@ -320,6 +320,8 @@ class RssManager{
settings.beginGroup("Rss"); settings.beginGroup("Rss");
streamListUrl = settings.value("streamList").toStringList(); streamListUrl = settings.value("streamList").toStringList();
streamListAlias = settings.value("streamAlias").toStringList(); streamListAlias = settings.value("streamAlias").toStringList();
//XXX: Maybe check that both list have same size?
qDebug("NB RSS streams loaded: %d", streamListUrl.size());
settings.endGroup(); settings.endGroup();
unsigned int streamListUrlSize = streamListUrl.size(); unsigned int streamListUrlSize = streamListUrl.size();
for(unsigned int i=0; i<streamListUrlSize; ++i){ for(unsigned int i=0; i<streamListUrlSize; ++i){
@ -344,13 +346,15 @@ class RssManager{
streamList.append(stream); streamList.append(stream);
streamListUrl.append(stream->getUrl()); streamListUrl.append(stream->getUrl());
streamListAlias.append(stream->getUrl()); streamListAlias.append(stream->getUrl());
}else{
qDebug("Not adding the Rss stream because it is already in the list");
} }
} }
// add a stream to the manager // add a stream to the manager
void addStream(QString url){ void addStream(QString url){
// completion of the address // completion of the address
if(!url.endsWith(".xml")){ if(!url.endsWith(".xml")) {
if(url.endsWith("/")) { if(url.endsWith("/")) {
url.append("rss.xml"); url.append("rss.xml");
} else { } else {
@ -362,6 +366,8 @@ class RssManager{
streamList.append(new RssStream(url)); streamList.append(new RssStream(url));
streamListUrl.append(url); streamListUrl.append(url);
streamListAlias.append(url); streamListAlias.append(url);
}else {
qDebug("Not adding the Rss stream because it is already in the list");
} }
} }
@ -419,11 +425,11 @@ class RssManager{
} }
// return the position index of a stream, if the manager owns it // return the position index of a stream, if the manager owns it
short hasStream(RssStream* stream) const{ int hasStream(RssStream* stream) const{
return hasStream(stream->getUrl()); return hasStream(stream->getUrl());
} }
bool hasStream(const QString& url) const{ int hasStream(const QString& url) const{
return streamListUrl.indexOf(url); return streamListUrl.indexOf(url);
} }

3
src/rss_imp.cpp

@ -160,7 +160,8 @@
if(rssmanager.getNbStream()>0) { if(rssmanager.getNbStream()>0) {
RssStream* currentstream = rssmanager.getStream(listStreams->currentRow()); RssStream* currentstream = rssmanager.getStream(listStreams->currentRow());
listNews->clear(); listNews->clear();
for(int i=0; i<currentstream->getListSize(); i++) { unsigned int currentStreamSize = currentstream->getListSize();
for(unsigned int i=0; i<currentStreamSize; ++i) {
new QListWidgetItem(currentstream->getItem(i)->getTitle(), listNews); new QListWidgetItem(currentstream->getItem(i)->getTitle(), listNews);
} }
} }

Loading…
Cancel
Save