mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
- Improved a lot downloading from url using libcommoncpp2 instead of libcurl
- TODO soon: - Updated configure file - Add url download error handling
This commit is contained in:
parent
347b03d699
commit
7c8677d787
7 changed files with 61 additions and 93 deletions
25
src/rss.h
25
src/rss.h
|
@ -137,21 +137,21 @@ class RssStream : public QObject{
|
|||
|
||||
public slots :
|
||||
// read and store the downloaded rss' informations
|
||||
void processDownloadedFile(const QString&, const QString& file_path, int return_code, const QString&) {
|
||||
void processDownloadedFile(const QString&, const QString& file_path) {
|
||||
// delete the former file
|
||||
if(QFile::exists(filePath)) {
|
||||
QFile::remove(filePath);
|
||||
}
|
||||
filePath = file_path;
|
||||
if(return_code){
|
||||
// Download failed
|
||||
qDebug("(download failure) "+file_path.toUtf8());
|
||||
if(QFile::exists(filePath)) {
|
||||
QFile::remove(filePath);
|
||||
}
|
||||
emit refreshFinished(url, NEWS);
|
||||
return;
|
||||
}
|
||||
// if(return_code){
|
||||
// // Download failed
|
||||
// qDebug("(download failure) "+file_path.toUtf8());
|
||||
// if(QFile::exists(filePath)) {
|
||||
// QFile::remove(filePath);
|
||||
// }
|
||||
// emit refreshFinished(url, NEWS);
|
||||
// return;
|
||||
// }
|
||||
openRss();
|
||||
emit refreshFinished(url, NEWS);
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ class RssStream : public QObject{
|
|||
read = true;
|
||||
downloaderRss = new downloadThread(this);
|
||||
downloaderIcon = new downloadThread(this);
|
||||
connect(downloaderRss, SIGNAL(downloadFinished(const QString&, const QString&, int, const QString&)), this, SLOT(processDownloadedFile(const QString&, const QString&, int, const QString&)));
|
||||
connect(downloaderRss, SIGNAL(downloadFinished(const QString&, const QString&)), this, SLOT(processDownloadedFile(const QString&, const QString&)));
|
||||
downloaderRss->downloadUrl(url);
|
||||
// XXX: remove it when gif can be displayed
|
||||
iconPath = ":/Icons/rss.png";
|
||||
|
@ -216,7 +216,6 @@ class RssStream : public QObject{
|
|||
}
|
||||
|
||||
void refresh() {
|
||||
connect(downloaderRss, SIGNAL(downloadFinished(const QString&, const QString&, int, const QString&)), this, SLOT(processDownloadedFile(const QString&, const QString&, int, const QString&)));
|
||||
downloaderRss->downloadUrl(url);
|
||||
lastRefresh.start();
|
||||
}
|
||||
|
@ -276,7 +275,7 @@ class RssStream : public QObject{
|
|||
|
||||
QString getLastRefresh() const{
|
||||
return QString::number(lastRefresh.hour())+"h"+QString::number(lastRefresh.minute())+"m";
|
||||
}
|
||||
}
|
||||
|
||||
bool isRead() const {
|
||||
return read;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue