mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
rss : show the number of NONREAD news (local test succeeded, need tests)
rss : clean the file rss.h rss : display the site favicon (local test succeeded, need tests) bug that i've noticed but not fixed : _ something create qt_temp files without delete them _ in dl list, columns disappear
This commit is contained in:
parent
e4915260e7
commit
7edc89638f
@ -13,21 +13,12 @@
|
|||||||
<string>Torrent addition dialog</string>
|
<string>Torrent addition dialog</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
|
<property name="margin" >
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="fileNameLbl" >
|
<widget class="QLabel" name="fileNameLbl" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
@ -57,21 +48,12 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" >
|
<layout class="QHBoxLayout" >
|
||||||
|
<property name="margin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="savePathTxt" />
|
<widget class="QLineEdit" name="savePathTxt" />
|
||||||
</item>
|
</item>
|
||||||
@ -126,21 +108,12 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" >
|
<layout class="QHBoxLayout" >
|
||||||
|
<property name="margin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation" >
|
<property name="orientation" >
|
||||||
|
@ -28,14 +28,10 @@
|
|||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QMutexLocker>
|
#include <QMutexLocker>
|
||||||
#include <QWaitCondition>
|
#include <QWaitCondition>
|
||||||
|
#include <curl/curl.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cc++/common.h>
|
|
||||||
#include "misc.h"
|
|
||||||
|
|
||||||
#ifdef CCXX_NAMESPACES
|
#include "misc.h"
|
||||||
using namespace std;
|
|
||||||
using namespace ost;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class downloadThread : public QThread {
|
class downloadThread : public QThread {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -45,11 +41,9 @@ class downloadThread : public QThread {
|
|||||||
QMutex mutex;
|
QMutex mutex;
|
||||||
QWaitCondition condition;
|
QWaitCondition condition;
|
||||||
bool abort;
|
bool abort;
|
||||||
URLStream url_stream;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void downloadFinished(const QString& url, const QString& file_path);
|
void downloadFinished(const QString& url, const QString& file_path, int return_code, const QString& errorBuffer);
|
||||||
void downloadFailure(const QString& url, const QString& reason);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
downloadThread(QObject* parent) : QThread(parent){
|
downloadThread(QObject* parent) : QThread(parent){
|
||||||
@ -79,33 +73,6 @@ class downloadThread : public QThread {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString errorCodeToString(URLStream::Error status){
|
|
||||||
switch(status){
|
|
||||||
case URLStream::errUnreachable:
|
|
||||||
return tr("Host is unreachable");
|
|
||||||
case URLStream::errMissing:
|
|
||||||
return tr("File was not found (404)");
|
|
||||||
case URLStream::errDenied:
|
|
||||||
return tr("Connection was denied");
|
|
||||||
case URLStream::errInvalid:
|
|
||||||
return tr("Url is invalid");
|
|
||||||
case URLStream::errForbidden:
|
|
||||||
return tr("Connection forbidden (403)");
|
|
||||||
case URLStream::errUnauthorized:
|
|
||||||
return tr("Connection was not authorized (401)");
|
|
||||||
case URLStream::errRelocated:
|
|
||||||
return tr("Content has moved (301)");
|
|
||||||
case URLStream::errFailure:
|
|
||||||
return tr("Connection failure");
|
|
||||||
case URLStream::errTimeout:
|
|
||||||
return tr("Connection was timed out");
|
|
||||||
case URLStream::errInterface:
|
|
||||||
return tr("Incorrect network interface");
|
|
||||||
default:
|
|
||||||
return tr("Unknown error");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void run(){
|
void run(){
|
||||||
forever{
|
forever{
|
||||||
@ -117,41 +84,80 @@ class downloadThread : public QThread {
|
|||||||
QString url = url_list.takeFirst();
|
QString url = url_list.takeFirst();
|
||||||
mutex.unlock();
|
mutex.unlock();
|
||||||
qDebug("In Download thread RUN, mutex unlocked (got url)");
|
qDebug("In Download thread RUN, mutex unlocked (got url)");
|
||||||
// XXX: Trick to get a unique filename
|
CURL *curl;
|
||||||
QString filePath;
|
QString filePath;
|
||||||
QTemporaryFile *tmpfile = new QTemporaryFile();
|
int return_code, response;
|
||||||
|
// XXX: Trick to get a unique filename
|
||||||
|
QTemporaryFile *tmpfile = new QTemporaryFile;
|
||||||
if (tmpfile->open()) {
|
if (tmpfile->open()) {
|
||||||
filePath = tmpfile->fileName();
|
filePath = tmpfile->fileName();
|
||||||
}
|
}
|
||||||
delete tmpfile;
|
delete tmpfile;
|
||||||
QFile dest_file(filePath);
|
if(abort)
|
||||||
if(!dest_file.open(QIODevice::WriteOnly | QIODevice::Text)){
|
return;
|
||||||
std::cerr << "Error: could't create temporary file: " << (const char*)filePath.toUtf8() << '\n';
|
FILE *file = fopen((const char*)filePath.toUtf8(), "w");
|
||||||
continue;
|
if(!file){
|
||||||
|
std::cerr << "Error: could not open temporary file...\n";
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
URLStream::Error status = url_stream.get((const char*)url.toUtf8());
|
// Initilization required by libcurl
|
||||||
if(status){
|
curl = curl_easy_init();
|
||||||
// Failure
|
if(!curl){
|
||||||
QString error_msg = QString(misc::toString(status).c_str());
|
std::cerr << "Error: Failed to init curl...\n";
|
||||||
qDebug("Download failed for %s, reason: %s", (const char*)url.toUtf8(), (const char*)error_msg.toUtf8());
|
fclose(file);
|
||||||
url_stream.close();
|
return;
|
||||||
emit downloadFailure(url, errorCodeToString(status));
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
qDebug("Downloading %s...", (const char*)url.toUtf8());
|
// Set url to download
|
||||||
char cbuf[1024];
|
curl_easy_setopt(curl, CURLOPT_URL, url.toLocal8Bit().constData());
|
||||||
int len;
|
qDebug("Url: %s", url.toLocal8Bit().constData());
|
||||||
while(!url_stream.eof()) {
|
// Define our callback to get called when there's data to be written
|
||||||
url_stream.read(cbuf, sizeof(cbuf));
|
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, misc::my_fwrite);
|
||||||
len = url_stream.gcount();
|
// Set destination file
|
||||||
if(len > 0){
|
curl_easy_setopt(curl, CURLOPT_WRITEDATA, file);
|
||||||
dest_file.write(cbuf, len);
|
// Some SSL mambo jambo
|
||||||
}
|
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
|
||||||
|
// Disable progress meter
|
||||||
|
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1);
|
||||||
|
// Any kind of authentication
|
||||||
|
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
|
||||||
|
//curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
|
||||||
|
// Auto referrer
|
||||||
|
curl_easy_setopt(curl, CURLOPT_AUTOREFERER, 1);
|
||||||
|
// Follow redirections
|
||||||
|
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
|
||||||
|
// Enable cookies
|
||||||
|
curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "");
|
||||||
|
// We want error message:
|
||||||
|
char errorBuffer[CURL_ERROR_SIZE];
|
||||||
|
errorBuffer[0]=0; /* prevent junk from being output */
|
||||||
|
return_code = curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorBuffer);
|
||||||
|
if(return_code){
|
||||||
|
std::cerr << "Error: failed to set error buffer in curl\n";
|
||||||
|
fclose(file);
|
||||||
|
QFile::remove(filePath);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
dest_file.close();
|
unsigned short retries = 0;
|
||||||
url_stream.close();
|
bool to_many_users = false;
|
||||||
emit downloadFinished(url, filePath);
|
do{
|
||||||
qDebug("In Download thread RUN, signal emitted");
|
// Perform Download
|
||||||
|
return_code = curl_easy_perform(curl);
|
||||||
|
// We want HTTP response code
|
||||||
|
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response);
|
||||||
|
qDebug("HTTP response code: %d", response);
|
||||||
|
if(response/100 == 5){
|
||||||
|
to_many_users = true;
|
||||||
|
++retries;
|
||||||
|
SleeperThread::msleep(1000);
|
||||||
|
}
|
||||||
|
}while(to_many_users && retries < 10 && response!=0);
|
||||||
|
// Cleanup
|
||||||
|
curl_easy_cleanup(curl);
|
||||||
|
// Close tmp file
|
||||||
|
fclose(file);
|
||||||
|
emit downloadFinished(url, filePath, return_code, QString(errorBuffer));
|
||||||
|
qDebug("In Download thread RUN, signal emitted, ErrorBuffer: %s", errorBuffer);
|
||||||
}else{
|
}else{
|
||||||
qDebug("In Download thread RUN, mutex still locked (no urls) -> sleeping");
|
qDebug("In Download thread RUN, mutex still locked (no urls) -> sleeping");
|
||||||
condition.wait(&mutex);
|
condition.wait(&mutex);
|
||||||
|
@ -13,21 +13,12 @@
|
|||||||
<string>Torrent Properties</string>
|
<string>Torrent Properties</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
|
<property name="margin" >
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="torrentContent" >
|
<widget class="QTabWidget" name="torrentContent" >
|
||||||
<property name="currentIndex" >
|
<property name="currentIndex" >
|
||||||
@ -38,21 +29,12 @@
|
|||||||
<string>Main infos</string>
|
<string>Main infos</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
|
<property name="margin" >
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="fileName" >
|
<widget class="QLabel" name="fileName" >
|
||||||
<property name="maximumSize" >
|
<property name="maximumSize" >
|
||||||
@ -99,55 +81,28 @@
|
|||||||
<string>Torrent infos</string>
|
<string>Torrent infos</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
|
<property name="margin" >
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" >
|
<layout class="QHBoxLayout" >
|
||||||
|
<property name="margin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
|
<property name="margin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="savePath_lbl" >
|
<widget class="QLabel" name="savePath_lbl" >
|
||||||
<property name="minimumSize" >
|
<property name="minimumSize" >
|
||||||
@ -234,21 +189,12 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
|
<property name="margin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="save_path" >
|
<widget class="QLabel" name="save_path" >
|
||||||
<property name="minimumSize" >
|
<property name="minimumSize" >
|
||||||
@ -330,7 +276,9 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox" >
|
<widget class="QGroupBox" name="groupBox" >
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy" >
|
||||||
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
|
<sizepolicy>
|
||||||
|
<hsizetype>0</hsizetype>
|
||||||
|
<vsizetype>0</vsizetype>
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@ -356,55 +304,28 @@
|
|||||||
<string>Current session</string>
|
<string>Current session</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
|
<property name="margin" >
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" >
|
<layout class="QHBoxLayout" >
|
||||||
|
<property name="margin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
|
<property name="margin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_5" >
|
<widget class="QLabel" name="label_5" >
|
||||||
<property name="font" >
|
<property name="font" >
|
||||||
@ -481,21 +402,12 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
|
<property name="margin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="upTotal" >
|
<widget class="QLabel" name="upTotal" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
@ -569,25 +481,18 @@
|
|||||||
<string>Trackers</string>
|
<string>Trackers</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
|
<property name="margin" >
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_2" >
|
<widget class="QGroupBox" name="groupBox_2" >
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy" >
|
||||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
<sizepolicy>
|
||||||
|
<hsizetype>0</hsizetype>
|
||||||
|
<vsizetype>0</vsizetype>
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@ -613,38 +518,20 @@
|
|||||||
<string>Tracker</string>
|
<string>Tracker</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
|
<property name="margin" >
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" >
|
<layout class="QHBoxLayout" >
|
||||||
|
<property name="margin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_9" >
|
<widget class="QLabel" name="label_9" >
|
||||||
<property name="font" >
|
<property name="font" >
|
||||||
@ -665,25 +552,18 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
|
<property name="margin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QListWidget" name="trackersURLS" >
|
<widget class="QListWidget" name="trackersURLS" >
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy" >
|
||||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
<sizepolicy>
|
||||||
|
<hsizetype>0</hsizetype>
|
||||||
|
<vsizetype>0</vsizetype>
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@ -692,21 +572,12 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" >
|
<layout class="QHBoxLayout" >
|
||||||
|
<property name="margin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation" >
|
<property name="orientation" >
|
||||||
@ -777,21 +648,12 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
|
<property name="margin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation" >
|
<property name="orientation" >
|
||||||
@ -862,21 +724,12 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" >
|
<layout class="QHBoxLayout" >
|
||||||
|
<property name="margin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_10" >
|
<widget class="QLabel" name="label_10" >
|
||||||
<property name="font" >
|
<property name="font" >
|
||||||
@ -906,21 +759,12 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" >
|
<layout class="QHBoxLayout" >
|
||||||
|
<property name="margin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_2" >
|
<widget class="QLabel" name="label_2" >
|
||||||
<property name="maximumSize" >
|
<property name="maximumSize" >
|
||||||
@ -983,21 +827,12 @@
|
|||||||
<string>Torrent content</string>
|
<string>Torrent content</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
|
<property name="margin" >
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_4" >
|
<widget class="QLabel" name="label_4" >
|
||||||
<property name="font" >
|
<property name="font" >
|
||||||
@ -1071,21 +906,12 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" >
|
<layout class="QHBoxLayout" >
|
||||||
|
<property name="margin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation" >
|
<property name="orientation" >
|
||||||
|
39
src/rss.h
39
src/rss.h
@ -142,33 +142,15 @@ class RssStream : public QObject{
|
|||||||
QFile::remove(filePath);
|
QFile::remove(filePath);
|
||||||
}
|
}
|
||||||
filePath = file_path;
|
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;
|
|
||||||
// }
|
|
||||||
openRss();
|
openRss();
|
||||||
emit refreshFinished(url, NEWS);
|
emit refreshFinished(url, NEWS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void displayIcon(const QString&, const QString& file_path, int, const QString&) {
|
// display the icon in the rss window
|
||||||
/*if(QFile::exists(iconPath) && iconPath!=":/Icons/rss.png") {
|
void displayIcon(const QString&, const QString& file_path, int return_code, const QString&) {
|
||||||
QFile::remove(iconPath);
|
|
||||||
}
|
|
||||||
iconPath = file_path;
|
iconPath = file_path;
|
||||||
|
|
||||||
// XXX : remove it when we manage to dl the iconPath
|
|
||||||
//iconPath = ":/Icons/rss.png";
|
|
||||||
//iconPath = "/tmp/favicon.gif";
|
|
||||||
|
|
||||||
|
|
||||||
if(return_code){
|
if(return_code){
|
||||||
// Download failed
|
// Download failed
|
||||||
qDebug("(download failure) "+iconPath.toUtf8());
|
|
||||||
if(QFile::exists(iconPath) && iconPath!=":/Icons/rss.png") {
|
if(QFile::exists(iconPath) && iconPath!=":/Icons/rss.png") {
|
||||||
QFile::remove(iconPath);
|
QFile::remove(iconPath);
|
||||||
}
|
}
|
||||||
@ -177,8 +159,7 @@ class RssStream : public QObject{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
openIcon();
|
openIcon();
|
||||||
emit refreshFinished(url, ICON);*/
|
emit refreshFinished(url, ICON);
|
||||||
qDebug("******************Icone downloaded"+file_path.toUtf8());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -193,7 +174,7 @@ class RssStream : public QObject{
|
|||||||
downloaderRss->downloadUrl(url);
|
downloaderRss->downloadUrl(url);
|
||||||
// XXX: remove it when gif can be displayed
|
// XXX: remove it when gif can be displayed
|
||||||
iconPath = ":/Icons/rss.png";
|
iconPath = ":/Icons/rss.png";
|
||||||
//getIcon();
|
getIcon();
|
||||||
lastRefresh.start();
|
lastRefresh.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,6 +246,15 @@ class RssStream : public QObject{
|
|||||||
return listItem.size();
|
return listItem.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned short getNbNonRead() const{
|
||||||
|
int i=0, nbnonread=0;
|
||||||
|
for(i=0; i<listItem.size(); i++) {
|
||||||
|
if(!listItem.at(i)->isRead())
|
||||||
|
nbnonread++;
|
||||||
|
}
|
||||||
|
return nbnonread;
|
||||||
|
}
|
||||||
|
|
||||||
QList<RssItem*> getListItem() const{
|
QList<RssItem*> getListItem() const{
|
||||||
return listItem;
|
return listItem;
|
||||||
}
|
}
|
||||||
@ -285,13 +275,12 @@ class RssStream : public QObject{
|
|||||||
read = true;
|
read = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME : always return an empty file
|
// download the icon from the adress
|
||||||
void getIcon() {
|
void getIcon() {
|
||||||
QUrl siteUrl(url);
|
QUrl siteUrl(url);
|
||||||
QString iconUrl = "http://"+siteUrl.host()+"/favicon.ico";
|
QString iconUrl = "http://"+siteUrl.host()+"/favicon.ico";
|
||||||
connect(downloaderIcon, SIGNAL(downloadFinished(const QString&, const QString&, int, const QString&)), this, SLOT(displayIcon(const QString&, const QString&, int, const QString&)));
|
connect(downloaderIcon, SIGNAL(downloadFinished(const QString&, const QString&, int, const QString&)), this, SLOT(displayIcon(const QString&, const QString&, int, const QString&)));
|
||||||
downloaderIcon->downloadUrl(iconUrl);
|
downloaderIcon->downloadUrl(iconUrl);
|
||||||
qDebug("******************Icone "+iconUrl.toUtf8());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -239,7 +239,7 @@
|
|||||||
}
|
}
|
||||||
// on click, show the age of the stream
|
// on click, show the age of the stream
|
||||||
if(type == LATENCY) {
|
if(type == LATENCY) {
|
||||||
unsigned short nbitem = rssmanager.getStream(i)->getListSize();
|
unsigned short nbitem = rssmanager.getStream(i)->getNbNonRead();
|
||||||
listStreams->topLevelItem(i)->setText(0,rssmanager.getStream(i)->getAlias().toUtf8()+" ("+QString::number(nbitem,10).toUtf8()+")");
|
listStreams->topLevelItem(i)->setText(0,rssmanager.getStream(i)->getAlias().toUtf8()+" ("+QString::number(nbitem,10).toUtf8()+")");
|
||||||
if(nbitem==0)
|
if(nbitem==0)
|
||||||
listStreams->topLevelItem(i)->setData(0,Qt::ForegroundRole, QVariant(QColor("red")));
|
listStreams->topLevelItem(i)->setData(0,Qt::ForegroundRole, QVariant(QColor("red")));
|
||||||
|
Loading…
Reference in New Issue
Block a user