mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 04:24:23 +00:00
- Updated configure file to check for libcommoncpp2 instead of libcurl
- Used downloadThread in search plugin update instead of libcurl (no more gui freeze by the same occasion) - Still need to handle download from urls errors and use fallback url in search plugin update (before beta2)
This commit is contained in:
parent
7c8677d787
commit
2fd0de082c
@ -33,6 +33,7 @@
|
|||||||
- BUGFIX: Fixed a crash when filtering all the files in a torrent
|
- BUGFIX: Fixed a crash when filtering all the files in a torrent
|
||||||
- BUGFIX: Reload torrent only when necessary (properties)
|
- BUGFIX: Reload torrent only when necessary (properties)
|
||||||
- BUGFIX: qBittorrent is not exiting anymore when a dialog is closed and main window is hidden
|
- BUGFIX: qBittorrent is not exiting anymore when a dialog is closed and main window is hidden
|
||||||
|
- BUGFIX: Search plugin update is not making the GUI freeze anymore (moved to a thread)
|
||||||
- COSMETIC: Redesigned torrent properties a little
|
- COSMETIC: Redesigned torrent properties a little
|
||||||
- COSMETIC: Redesigned options a little
|
- COSMETIC: Redesigned options a little
|
||||||
- COSMETIC: Display more logs messages concerning features
|
- COSMETIC: Display more logs messages concerning features
|
||||||
|
2
INSTALL
2
INSTALL
@ -24,7 +24,7 @@ Dependencies:
|
|||||||
|
|
||||||
- libboost: libboost-filesystem, libboost-date-time, libboost-thread, libboost-serialization
|
- libboost: libboost-filesystem, libboost-date-time, libboost-thread, libboost-serialization
|
||||||
|
|
||||||
- libcurl
|
- libcommoncpp2
|
||||||
|
|
||||||
- python >= 2.3 (previous might work - not tested): needed by search engine.
|
- python >= 2.3 (previous might work - not tested): needed by search engine.
|
||||||
|
|
||||||
|
4
README
4
README
@ -1,9 +1,9 @@
|
|||||||
qBittorrent - A BitTorrent client in Qt4.2
|
qBittorrent - A BitTorrent client in Qt4
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
********************************
|
********************************
|
||||||
qBittorrent is a bittorrent client programmed in C++ / Qt4.2 that use
|
qBittorrent is a bittorrent client programmed in C++ / Qt4 that use
|
||||||
libtorrent (sometimes called rb_libtorrent) by Arvid Norberg.
|
libtorrent (sometimes called rb_libtorrent) by Arvid Norberg.
|
||||||
|
|
||||||
It aims to be a good alternative to all other bittorrent clients
|
It aims to be a good alternative to all other bittorrent clients
|
||||||
|
3
TODO
3
TODO
@ -18,7 +18,6 @@
|
|||||||
// Unsure
|
// Unsure
|
||||||
- Azureus spoofing to prevent ban from trackers?
|
- Azureus spoofing to prevent ban from trackers?
|
||||||
- Web interface?
|
- Web interface?
|
||||||
- Use downloader class to download search plugin updates
|
|
||||||
- Allow to set upload limit for each torrent
|
- Allow to set upload limit for each torrent
|
||||||
- Option to shutdown computer when downloads are finished
|
- Option to shutdown computer when downloads are finished
|
||||||
- Add a torrent scheduler
|
- Add a torrent scheduler
|
||||||
@ -43,7 +42,7 @@
|
|||||||
- Allow to hide columns (gtsoul)
|
- Allow to hide columns (gtsoul)
|
||||||
- Complete documentation and english translation
|
- Complete documentation and english translation
|
||||||
* beta2
|
* beta2
|
||||||
- Fix configure file for libcommoncpp
|
- Handle downloadFromUrl errors (Display a messagebox to catch user's attention)
|
||||||
- Wait for some bug fixes in libtorrent :
|
- Wait for some bug fixes in libtorrent :
|
||||||
- upload/download limit per torrent
|
- upload/download limit per torrent
|
||||||
- ipfilter crash
|
- ipfilter crash
|
||||||
|
90
configure
vendored
90
configure
vendored
@ -10,20 +10,19 @@ Usage: $0 [OPTION]...
|
|||||||
This script creates necessary configuration files to build/install.
|
This script creates necessary configuration files to build/install.
|
||||||
|
|
||||||
Main options:
|
Main options:
|
||||||
--prefix=[path] Base path for build/install. Default: /usr/local
|
--prefix=[path] Base path for build/install. Default: /usr/local
|
||||||
--bindir=[path] Directory for binaries. Default: PREFIX/bin
|
--bindir=[path] Directory for binaries. Default: PREFIX/bin
|
||||||
--datadir=[path] Directory for data. Default: PREFIX/share
|
--qtdir=[path] Directory where Qt is installed.
|
||||||
--qtdir=[path] Directory where Qt is installed.
|
--verbose Show extra configure output.
|
||||||
--verbose Show extra configure output.
|
--help This help text.
|
||||||
--help This help text.
|
|
||||||
|
|
||||||
Dependency options:
|
Dependency options:
|
||||||
--with-libtorrent-inc=[path] Path to libtorrent include files
|
--with-libtorrent-inc=[path] Path to libtorrent include files
|
||||||
--with-libtorrent-lib=[path] Path to libtorrent library files
|
--with-libtorrent-lib=[path] Path to libtorrent library files
|
||||||
--with-libtorrent-static-lib=[path] Path to libtorrent .a file
|
--with-libtorrent-static-lib=[path] Path to libtorrent .a file
|
||||||
--with-libboost-inc=[path] Path to libboost include files
|
--with-libboost-inc=[path] Path to libboost include files
|
||||||
--with-libcurl-inc=[path] Path to libcurl include files
|
--with-libcommoncpp2-inc=[path] Path to libcommoncpp2 include files
|
||||||
--with-libcurl-lib=[path] Path to libcurl library files
|
--with-libcommoncpp2-lib=[path] Path to libcommoncpp2 library files
|
||||||
|
|
||||||
EOT
|
EOT
|
||||||
}
|
}
|
||||||
@ -130,11 +129,6 @@ while [ $# -gt 0 ]; do
|
|||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
|
||||||
--datadir=*)
|
|
||||||
DATADIR=$optarg
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
|
|
||||||
--qtdir=*)
|
--qtdir=*)
|
||||||
EX_QTDIR=$optarg
|
EX_QTDIR=$optarg
|
||||||
shift
|
shift
|
||||||
@ -160,13 +154,13 @@ while [ $# -gt 0 ]; do
|
|||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
|
||||||
--with-libcurl-inc=*)
|
--with-libcommoncpp2-inc=*)
|
||||||
QC_WITH_LIBCURL_INC=$optarg
|
QC_WITH_LIBCOMMONCPP2_INC=$optarg
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
|
||||||
--with-libcurl-lib=*)
|
--with-libcommoncpp2-lib=*)
|
||||||
QC_WITH_LIBCURL_LIB=$optarg
|
QC_WITH_LIBCOMMONCPP2_LIB=$optarg
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@ -181,7 +175,6 @@ done
|
|||||||
|
|
||||||
PREFIX=${PREFIX:-/usr/local}
|
PREFIX=${PREFIX:-/usr/local}
|
||||||
BINDIR=${BINDIR:-$PREFIX/bin}
|
BINDIR=${BINDIR:-$PREFIX/bin}
|
||||||
DATADIR=${DATADIR:-$PREFIX/share}
|
|
||||||
|
|
||||||
echo "Configuring qbittorrent ..."
|
echo "Configuring qbittorrent ..."
|
||||||
|
|
||||||
@ -189,14 +182,13 @@ if [ "$QC_DEBUG" = "Y" ]; then
|
|||||||
echo
|
echo
|
||||||
echo PREFIX=$PREFIX
|
echo PREFIX=$PREFIX
|
||||||
echo BINDIR=$BINDIR
|
echo BINDIR=$BINDIR
|
||||||
echo DATADIR=$DATADIR
|
|
||||||
echo EX_QTDIR=$EX_QTDIR
|
echo EX_QTDIR=$EX_QTDIR
|
||||||
echo QC_WITH_LIBTORRENT_INC=$QC_WITH_LIBTORRENT_INC
|
echo QC_WITH_LIBTORRENT_INC=$QC_WITH_LIBTORRENT_INC
|
||||||
echo QC_WITH_LIBTORRENT_LIB=$QC_WITH_LIBTORRENT_LIB
|
echo QC_WITH_LIBTORRENT_LIB=$QC_WITH_LIBTORRENT_LIB
|
||||||
echo QC_WITH_LIBTORRENT_STATIC_LIB=$QC_WITH_LIBTORRENT_STATIC_LIB
|
echo QC_WITH_LIBTORRENT_STATIC_LIB=$QC_WITH_LIBTORRENT_STATIC_LIB
|
||||||
echo QC_WITH_LIBBOOST_INC=$QC_WITH_LIBBOOST_INC
|
echo QC_WITH_LIBBOOST_INC=$QC_WITH_LIBBOOST_INC
|
||||||
echo QC_WITH_LIBCURL_INC=$QC_WITH_LIBCURL_INC
|
echo QC_WITH_LIBCOMMONCPP2_INC=$QC_WITH_LIBCOMMONCPP2_INC
|
||||||
echo QC_WITH_LIBCURL_LIB=$QC_WITH_LIBCURL_LIB
|
echo QC_WITH_LIBCOMMONCPP2_LIB=$QC_WITH_LIBCOMMONCPP2_LIB
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -417,65 +409,68 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#line 1 "libcurl.qcm"
|
#line 1 "libcommoncpp2.qcm"
|
||||||
/*
|
/*
|
||||||
-----BEGIN QCMOD-----
|
-----BEGIN QCMOD-----
|
||||||
name: libcurl
|
name: libcommoncpp2
|
||||||
arg: with-libcurl-inc=[path], Path to libcurl include files
|
arg: with-libcommoncpp2-inc=[path], Path to libcommoncpp2 include files
|
||||||
arg: with-libcurl-lib=[path], Path to libcurl library files
|
arg: with-libcommoncpp2-lib=[path], Path to libcommoncpp2 library files
|
||||||
-----END QCMOD-----
|
-----END QCMOD-----
|
||||||
*/
|
*/
|
||||||
class qc_libcurl : public ConfObj
|
class qc_libcommoncpp2 : public ConfObj
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
qc_libcurl(Conf *c) : ConfObj(c) {}
|
qc_libcommoncpp2(Conf *c) : ConfObj(c) {}
|
||||||
QString name() const { return "libcurl"; }
|
QString name() const { return "GNU Common C++"; }
|
||||||
QString shortname() const { return "libcurl"; }
|
QString shortname() const { return "libcommoncpp2"; }
|
||||||
bool exec(){
|
bool exec(){
|
||||||
QString s;
|
QString s;
|
||||||
s = conf->getenv("QC_WITH_LIBCURL_INC");
|
s = conf->getenv("QC_WITH_LIBCOMMONCPP2_INC");
|
||||||
if(!s.isEmpty()) {
|
if(!s.isEmpty()) {
|
||||||
if(!conf->checkHeader(s, "curl/curl.h")) {
|
if(!conf->checkHeader(s, "cc++/common.h")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
QStringList sl;
|
QStringList sl;
|
||||||
sl << "/usr/include";
|
sl << "/usr/include";
|
||||||
sl << "/usr/local/include";
|
sl << "/usr/local/include";
|
||||||
bool found = false;
|
bool found = false;
|
||||||
foreach(s, sl){
|
foreach(s, sl){
|
||||||
if(conf->checkHeader(s, "curl/curl.h")){
|
if(conf->checkHeader(s, "cc++/common.h")){
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!found) {
|
if(!found) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
conf->addIncludePath(s);
|
conf->addIncludePath(s);
|
||||||
|
|
||||||
s = conf->getenv("QC_WITH_LIBCURL_LIB");
|
s = conf->getenv("QC_WITH_LIBCOMMONCPP2_LIB");
|
||||||
if(!s.isEmpty()) {
|
if(!s.isEmpty()) {
|
||||||
if(!conf->checkLibrary(s, "curl")) {
|
if(!QFile::exists(s+QString("libccext2.so")))
|
||||||
return false;
|
return false;
|
||||||
}
|
if(!QFile::exists(s+QString("libccgnu2.so")))
|
||||||
conf->addLib(QString("-L") + s);
|
return false;
|
||||||
|
conf->addLib(QString("-L") + s);
|
||||||
}else{
|
}else{
|
||||||
QStringList sl;
|
QStringList sl;
|
||||||
sl << "/usr/lib/";
|
sl << "/usr/lib/";
|
||||||
sl << "/usr/local/lib/";
|
sl << "/usr/local/lib/";
|
||||||
bool found = false;
|
bool found = false;
|
||||||
foreach(s, sl){
|
foreach(s, sl){
|
||||||
if(conf->checkLibrary(s, "curl")){
|
if(QFile::exists(s+QString("libccext2.so"))){
|
||||||
found = true;
|
if(QFile::exists(s+QString("libccgnu2.so"))){
|
||||||
break;
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!found) return false;
|
if(!found) return false;
|
||||||
conf->addLib(QString("-L") + s);
|
conf->addLib(QString("-L") + s);
|
||||||
}
|
}
|
||||||
conf->addLib("-lcurl");
|
conf->addLib("-lccext2 -lccgnu2");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -511,7 +506,7 @@ cat >$1/modules_new.cpp <<EOT
|
|||||||
o = new qc_libboost(conf);
|
o = new qc_libboost(conf);
|
||||||
o->required = true;
|
o->required = true;
|
||||||
o->disabled = false;
|
o->disabled = false;
|
||||||
o = new qc_libcurl(conf);
|
o = new qc_libcommoncpp2(conf);
|
||||||
o->required = true;
|
o->required = true;
|
||||||
o->disabled = false;
|
o->disabled = false;
|
||||||
o = new qc_python(conf);
|
o = new qc_python(conf);
|
||||||
@ -1441,14 +1436,13 @@ EOT
|
|||||||
|
|
||||||
export PREFIX
|
export PREFIX
|
||||||
export BINDIR
|
export BINDIR
|
||||||
export DATADIR
|
|
||||||
export EX_QTDIR
|
export EX_QTDIR
|
||||||
export QC_WITH_LIBTORRENT_INC
|
export QC_WITH_LIBTORRENT_INC
|
||||||
export QC_WITH_LIBTORRENT_LIB
|
export QC_WITH_LIBTORRENT_LIB
|
||||||
export QC_WITH_LIBTORRENT_STATIC_LIB
|
export QC_WITH_LIBTORRENT_STATIC_LIB
|
||||||
export QC_WITH_LIBBOOST_INC
|
export QC_WITH_LIBBOOST_INC
|
||||||
export QC_WITH_LIBCURL_INC
|
export QC_WITH_LIBCOMMONCPP2_INC
|
||||||
export QC_WITH_LIBCURL_LIB
|
export QC_WITH_LIBCOMMONCPP2_LIB
|
||||||
export QC_DEBUG
|
export QC_DEBUG
|
||||||
rm -rf .qconftemp
|
rm -rf .qconftemp
|
||||||
(
|
(
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<dep type='libboost'>
|
<dep type='libboost'>
|
||||||
<required/>
|
<required/>
|
||||||
</dep>
|
</dep>
|
||||||
<dep type='libcurl'>
|
<dep type='libcommoncpp2'>
|
||||||
<required/>
|
<required/>
|
||||||
</dep>
|
</dep>
|
||||||
<dep type='python'>
|
<dep type='python'>
|
||||||
|
64
qcm/libcommoncpp2.qcm
Normal file
64
qcm/libcommoncpp2.qcm
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
-----BEGIN QCMOD-----
|
||||||
|
name: libcommoncpp2
|
||||||
|
arg: with-libcommoncpp2-inc=[path], Path to libcommoncpp2 include files
|
||||||
|
arg: with-libcommoncpp2-lib=[path], Path to libcommoncpp2 library files
|
||||||
|
-----END QCMOD-----
|
||||||
|
*/
|
||||||
|
class qc_libcommoncpp2 : public ConfObj
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
qc_libcommoncpp2(Conf *c) : ConfObj(c) {}
|
||||||
|
QString name() const { return "GNU Common C++"; }
|
||||||
|
QString shortname() const { return "libcommoncpp2"; }
|
||||||
|
bool exec(){
|
||||||
|
QString s;
|
||||||
|
s = conf->getenv("QC_WITH_LIBCOMMONCPP2_INC");
|
||||||
|
if(!s.isEmpty()) {
|
||||||
|
if(!conf->checkHeader(s, "cc++/common.h")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
QStringList sl;
|
||||||
|
sl << "/usr/include";
|
||||||
|
sl << "/usr/local/include";
|
||||||
|
bool found = false;
|
||||||
|
foreach(s, sl){
|
||||||
|
if(conf->checkHeader(s, "cc++/common.h")){
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!found) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
conf->addIncludePath(s);
|
||||||
|
|
||||||
|
s = conf->getenv("QC_WITH_LIBCOMMONCPP2_LIB");
|
||||||
|
if(!s.isEmpty()) {
|
||||||
|
if(!QFile::exists(s+QString("libccext2.so")))
|
||||||
|
return false;
|
||||||
|
if(!QFile::exists(s+QString("libccgnu2.so")))
|
||||||
|
return false;
|
||||||
|
conf->addLib(QString("-L") + s);
|
||||||
|
}else{
|
||||||
|
QStringList sl;
|
||||||
|
sl << "/usr/lib/";
|
||||||
|
sl << "/usr/local/lib/";
|
||||||
|
bool found = false;
|
||||||
|
foreach(s, sl){
|
||||||
|
if(QFile::exists(s+QString("libccext2.so"))){
|
||||||
|
if(QFile::exists(s+QString("libccgnu2.so"))){
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!found) return false;
|
||||||
|
conf->addLib(QString("-L") + s);
|
||||||
|
}
|
||||||
|
conf->addLib("-lccext2 -lccgnu2");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
@ -1,61 +0,0 @@
|
|||||||
/*
|
|
||||||
-----BEGIN QCMOD-----
|
|
||||||
name: libcurl
|
|
||||||
arg: with-libcurl-inc=[path], Path to libcurl include files
|
|
||||||
arg: with-libcurl-lib=[path], Path to libcurl library files
|
|
||||||
-----END QCMOD-----
|
|
||||||
*/
|
|
||||||
class qc_libcurl : public ConfObj
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
qc_libcurl(Conf *c) : ConfObj(c) {}
|
|
||||||
QString name() const { return "libcurl"; }
|
|
||||||
QString shortname() const { return "libcurl"; }
|
|
||||||
bool exec(){
|
|
||||||
QString s;
|
|
||||||
s = conf->getenv("QC_WITH_LIBCURL_INC");
|
|
||||||
if(!s.isEmpty()) {
|
|
||||||
if(!conf->checkHeader(s, "curl/curl.h")) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
QStringList sl;
|
|
||||||
sl << "/usr/include";
|
|
||||||
sl << "/usr/local/include";
|
|
||||||
bool found = false;
|
|
||||||
foreach(s, sl){
|
|
||||||
if(conf->checkHeader(s, "curl/curl.h")){
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!found) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
conf->addIncludePath(s);
|
|
||||||
|
|
||||||
s = conf->getenv("QC_WITH_LIBCURL_LIB");
|
|
||||||
if(!s.isEmpty()) {
|
|
||||||
if(!conf->checkLibrary(s, "curl")) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
conf->addLib(QString("-L") + s);
|
|
||||||
}else{
|
|
||||||
QStringList sl;
|
|
||||||
sl << "/usr/lib/";
|
|
||||||
sl << "/usr/local/lib/";
|
|
||||||
bool found = false;
|
|
||||||
foreach(s, sl){
|
|
||||||
if(conf->checkLibrary(s, "curl")){
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!found) return false;
|
|
||||||
conf->addLib(QString("-L") + s);
|
|
||||||
}
|
|
||||||
conf->addLib("-lcurl");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
@ -128,11 +128,6 @@ class misc : public QObject{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function called by curl to write the data to the file
|
|
||||||
static int my_fwrite(void *buffer, size_t size, size_t nmemb, void *stream){
|
|
||||||
return fwrite(buffer, size, nmemb, (FILE*)stream);
|
|
||||||
}
|
|
||||||
|
|
||||||
static QString findFileInDir(const QString& dir_path, const QString& fileName){
|
static QString findFileInDir(const QString& dir_path, const QString& fileName){
|
||||||
QDir dir(dir_path);
|
QDir dir(dir_path);
|
||||||
if(dir.exists(fileName)){
|
if(dir.exists(fileName)){
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <curl/curl.h>
|
|
||||||
#include <QTemporaryFile>
|
#include <QTemporaryFile>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QDomDocument>
|
#include <QDomDocument>
|
||||||
|
@ -27,12 +27,12 @@
|
|||||||
#include <QSystemTrayIcon>
|
#include <QSystemTrayIcon>
|
||||||
#include <QTemporaryFile>
|
#include <QTemporaryFile>
|
||||||
#include <QSystemTrayIcon>
|
#include <QSystemTrayIcon>
|
||||||
#include <curl/curl.h>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "SearchListDelegate.h"
|
#include "SearchListDelegate.h"
|
||||||
#include "searchEngine.h"
|
#include "searchEngine.h"
|
||||||
#include "bittorrent.h"
|
#include "bittorrent.h"
|
||||||
|
#include "downloadThread.h"
|
||||||
|
|
||||||
#define SEARCH_NAME 0
|
#define SEARCH_NAME 0
|
||||||
#define SEARCH_SIZE 1
|
#define SEARCH_SIZE 1
|
||||||
@ -46,6 +46,8 @@ SearchEngine::SearchEngine(bittorrent *BTSession, QSystemTrayIcon *myTrayIcon, b
|
|||||||
setupUi(this);
|
setupUi(this);
|
||||||
this->BTSession = BTSession;
|
this->BTSession = BTSession;
|
||||||
this->myTrayIcon = myTrayIcon;
|
this->myTrayIcon = myTrayIcon;
|
||||||
|
downloader = new downloadThread(this);
|
||||||
|
connect(downloader, SIGNAL(downloadFinished(const QString&, const QString&)), this, SLOT(novaUpdateDownloaded(const QString&, const QString&)));
|
||||||
// Set Search results list model
|
// Set Search results list model
|
||||||
SearchListModel = new QStandardItemModel(0,5);
|
SearchListModel = new QStandardItemModel(0,5);
|
||||||
SearchListModel->setHeaderData(SEARCH_NAME, Qt::Horizontal, tr("Name", "i.e: file name"));
|
SearchListModel->setHeaderData(SEARCH_NAME, Qt::Horizontal, tr("Name", "i.e: file name"));
|
||||||
@ -110,6 +112,7 @@ SearchEngine::~SearchEngine(){
|
|||||||
delete searchCompleter;
|
delete searchCompleter;
|
||||||
delete SearchListModel;
|
delete SearchListModel;
|
||||||
delete SearchDelegate;
|
delete SearchDelegate;
|
||||||
|
delete downloader;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the color of a row in data model
|
// Set the color of a row in data model
|
||||||
@ -428,98 +431,45 @@ void SearchEngine::updateNova() const{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Download nova.py from qbittorrent.org
|
void SearchEngine::novaUpdateDownloaded(const QString&, const QString& filePath){
|
||||||
// Check if our nova.py is outdated and
|
|
||||||
// ask user for action.
|
|
||||||
void SearchEngine::on_update_nova_button_clicked(){
|
|
||||||
CURL *curl;
|
|
||||||
QString filePath;
|
|
||||||
qDebug("Checking for search plugin updates on qbittorrent.org");
|
|
||||||
// XXX: Trick to get a unique filename
|
|
||||||
QTemporaryFile *tmpfile = new QTemporaryFile;
|
|
||||||
if (tmpfile->open()) {
|
|
||||||
filePath = tmpfile->fileName();
|
|
||||||
}
|
|
||||||
delete tmpfile;
|
|
||||||
FILE *file = fopen((const char*)filePath.toUtf8(), "w");
|
|
||||||
if(!file){
|
|
||||||
std::cerr << "Error: could not open temporary file...\n";
|
|
||||||
}
|
|
||||||
// Initilization required by libcurl
|
|
||||||
curl = curl_easy_init();
|
|
||||||
if(!curl){
|
|
||||||
std::cerr << "Error: Failed to init curl...\n";
|
|
||||||
fclose(file);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Set url to download
|
|
||||||
curl_easy_setopt(curl, CURLOPT_URL, "http://www.dchris.eu/nova/nova.zip");
|
|
||||||
// Define our callback to get called when there's data to be written
|
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, misc::my_fwrite);
|
|
||||||
// Set destination file
|
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, file);
|
|
||||||
// Some SSL mambo jambo
|
|
||||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, FALSE);
|
|
||||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
|
|
||||||
// Perform Download
|
|
||||||
curl_easy_perform(curl); /* ignores error */
|
|
||||||
// Cleanup
|
|
||||||
curl_easy_cleanup(curl);
|
|
||||||
// Close tmp file
|
|
||||||
fclose(file);
|
|
||||||
qDebug("Version on qbittorrent.org: %.2f", getNovaVersion(filePath));
|
|
||||||
float version_on_server = getNovaVersion(filePath);
|
float version_on_server = getNovaVersion(filePath);
|
||||||
if(version_on_server == 0.0){
|
qDebug("Version on qbittorrent.org: %.2f", version_on_server);
|
||||||
//First server is down, try the mirror
|
|
||||||
QFile::remove(filePath);
|
|
||||||
FILE *file = fopen((const char*)filePath.toUtf8(), "w");
|
|
||||||
if(!file){
|
|
||||||
std::cerr << "Error: could not open temporary file...\n";
|
|
||||||
}
|
|
||||||
curl = curl_easy_init();
|
|
||||||
curl_easy_setopt(curl, CURLOPT_URL, "http://hydr0g3n.free.fr/nova/nova.py");
|
|
||||||
// Define our callback to get called when there's data to be written
|
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, misc::my_fwrite);
|
|
||||||
// Set destination file
|
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, file);
|
|
||||||
// Some SSL mambo jambo
|
|
||||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, FALSE);
|
|
||||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
|
|
||||||
// Perform Download
|
|
||||||
curl_easy_perform(curl); /* ignores error */
|
|
||||||
// Cleanup
|
|
||||||
curl_easy_cleanup(curl);
|
|
||||||
// Close tmp file
|
|
||||||
fclose(file);
|
|
||||||
version_on_server = getNovaVersion(filePath);
|
|
||||||
}
|
|
||||||
if(version_on_server > getNovaVersion(misc::qBittorrentPath()+"nova.py")){
|
if(version_on_server > getNovaVersion(misc::qBittorrentPath()+"nova.py")){
|
||||||
if(QMessageBox::question(this,
|
if(QMessageBox::question(this,
|
||||||
tr("Search plugin update -- qBittorrent"),
|
tr("Search plugin update -- qBittorrent"),
|
||||||
tr("Search plugin can be updated, do you want to update it?\n\nChangelog:\n")+getNovaChangelog(filePath),
|
tr("Search plugin can be updated, do you want to update it?\n\nChangelog:\n")+getNovaChangelog(filePath),
|
||||||
tr("&Yes"), tr("&No"),
|
tr("&Yes"), tr("&No"),
|
||||||
QString(), 0, 1)){
|
QString(), 0, 1)){
|
||||||
return;
|
return;
|
||||||
}else{
|
}else{
|
||||||
qDebug("Updating search plugin from qbittorrent.org");
|
qDebug("Updating search plugin from qbittorrent.org");
|
||||||
QFile::remove(misc::qBittorrentPath()+"nova.py");
|
QFile::remove(misc::qBittorrentPath()+"nova.py");
|
||||||
QFile::copy(filePath, misc::qBittorrentPath()+"nova.py");
|
QFile::copy(filePath, misc::qBittorrentPath()+"nova.py");
|
||||||
QFile::Permissions perm=QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner | QFile::ReadUser | QFile::WriteUser | QFile::ExeUser | QFile::ReadGroup | QFile::ReadGroup;
|
QFile::Permissions perm=QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner | QFile::ReadUser | QFile::WriteUser | QFile::ExeUser | QFile::ReadGroup | QFile::ReadGroup;
|
||||||
QFile(misc::qBittorrentPath()+"nova.py").setPermissions(perm);
|
QFile(misc::qBittorrentPath()+"nova.py").setPermissions(perm);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(version_on_server == 0.0){
|
if(version_on_server == 0.0){
|
||||||
QMessageBox::information(this, tr("Search plugin update")+" -- "+tr("qBittorrent"),
|
QMessageBox::information(this, tr("Search plugin update")+" -- "+tr("qBittorrent"),
|
||||||
tr("Sorry, update server is temporarily unavailable."));
|
tr("Sorry, update server is temporarily unavailable."));
|
||||||
}else{
|
}else{
|
||||||
QMessageBox::information(this, tr("Search plugin update -- qBittorrent"),
|
QMessageBox::information(this, tr("Search plugin update -- qBittorrent"),
|
||||||
tr("Your search plugin is already up to date."));
|
tr("Your search plugin is already up to date."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Delete tmp file
|
// Delete tmp file
|
||||||
QFile::remove(filePath);
|
QFile::remove(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Download nova.py from qbittorrent.org
|
||||||
|
// Check if our nova.py is outdated and
|
||||||
|
// ask user for action.
|
||||||
|
void SearchEngine::on_update_nova_button_clicked(){
|
||||||
|
qDebug("Checking for search plugin updates on qbittorrent.org");
|
||||||
|
downloader->downloadUrl("http://www.dchris.eu/nova/nova.zip");
|
||||||
|
//TODO: make use of fallback url: "http://hydr0g3n.free.fr/nova/nova.py"
|
||||||
|
}
|
||||||
|
|
||||||
// Slot called when search is Finished
|
// Slot called when search is Finished
|
||||||
// Search can be finished for 3 reasons :
|
// Search can be finished for 3 reasons :
|
||||||
// Error | Stopped by user | Finished normally
|
// Error | Stopped by user | Finished normally
|
||||||
|
@ -31,6 +31,7 @@ class QStandardItemModel;
|
|||||||
class SearchListDelegate;
|
class SearchListDelegate;
|
||||||
class bittorrent;
|
class bittorrent;
|
||||||
class QSystemTrayIcon;
|
class QSystemTrayIcon;
|
||||||
|
class downloadThread;
|
||||||
|
|
||||||
class SearchEngine : public QWidget, public Ui::search_engine{
|
class SearchEngine : public QWidget, public Ui::search_engine{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -50,6 +51,7 @@ class SearchEngine : public QWidget, public Ui::search_engine{
|
|||||||
bittorrent *BTSession;
|
bittorrent *BTSession;
|
||||||
QSystemTrayIcon *myTrayIcon;
|
QSystemTrayIcon *myTrayIcon;
|
||||||
bool systrayIntegration;
|
bool systrayIntegration;
|
||||||
|
downloadThread *downloader;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SearchEngine(bittorrent *BTSession, QSystemTrayIcon *myTrayIcon, bool systrayIntegration);
|
SearchEngine(bittorrent *BTSession, QSystemTrayIcon *myTrayIcon, bool systrayIntegration);
|
||||||
@ -80,6 +82,7 @@ class SearchEngine : public QWidget, public Ui::search_engine{
|
|||||||
void sortSearchList(int index);
|
void sortSearchList(int index);
|
||||||
void sortSearchListInt(int index, Qt::SortOrder sortOrder);
|
void sortSearchListInt(int index, Qt::SortOrder sortOrder);
|
||||||
void sortSearchListString(int index, Qt::SortOrder sortOrder);
|
void sortSearchListString(int index, Qt::SortOrder sortOrder);
|
||||||
|
void novaUpdateDownloaded(const QString& url, const QString& path);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2,9 +2,6 @@
|
|||||||
LANG_PATH = lang
|
LANG_PATH = lang
|
||||||
ICONS_PATH = Icons
|
ICONS_PATH = Icons
|
||||||
|
|
||||||
LIBS += -lccext2
|
|
||||||
LIBS += -lccgnu2
|
|
||||||
|
|
||||||
#Set the following variable to 1 to enable debug
|
#Set the following variable to 1 to enable debug
|
||||||
DEBUG_MODE = 1
|
DEBUG_MODE = 1
|
||||||
|
|
||||||
@ -30,7 +27,7 @@ contains(DEBUG_MODE, 0){
|
|||||||
|
|
||||||
QMAKE_CXXFLAGS_RELEASE += -fwrapv
|
QMAKE_CXXFLAGS_RELEASE += -fwrapv
|
||||||
QMAKE_CXXFLAGS_DEBUG += -fwrapv
|
QMAKE_CXXFLAGS_DEBUG += -fwrapv
|
||||||
#LIBS += -lcurl -lupnp
|
|
||||||
CONFIG += link_pkgconfig
|
CONFIG += link_pkgconfig
|
||||||
PKGCONFIG += libtorrent
|
PKGCONFIG += libtorrent
|
||||||
QT += network xml
|
QT += network xml
|
||||||
@ -78,7 +75,7 @@ contains(DEBUG_MODE, 0){
|
|||||||
# Windows
|
# Windows
|
||||||
win32 {
|
win32 {
|
||||||
DEFINES += NO_UPNP
|
DEFINES += NO_UPNP
|
||||||
LIBS += -lcurl -ltorrent
|
LIBS += -ltorrent -lccext2 -lccgnu2
|
||||||
}
|
}
|
||||||
|
|
||||||
RESOURCES = icons.qrc \
|
RESOURCES = icons.qrc \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user