- Added .ico support, which is really useful for RSS favicons. We use libMagick++ in order to convert ICO icons to PNG. If this library is not installed, qBittorrent will still compile but this feature will be disabled.

This commit is contained in:
Christophe Dumez 2007-08-29 09:22:21 +00:00
parent 19c606e067
commit 99268bfc06
7 changed files with 170 additions and 2 deletions

View File

@ -28,6 +28,8 @@ Dependencies:
- python >= 2.3 (previous might work - not tested): needed by search engine.
- libmagick++ (advised, not required)
NOTE FOR GNOME USERS:
- qt4-qtconfig package is advised when using Plastique style (default)
or just change qBittorrent style to Cleanlooks (GNOME like)

4
TODO
View File

@ -9,7 +9,6 @@
// Harder
- Display a progress bar that really displays the pieces we have (like in eMule)
- .ico support (unsupported by Qt4.3 Free edition)
// Waiting for libtorrent
- File selection in a torrent in compact mode
@ -38,6 +37,7 @@
- Allow to disable UPnP/NAT-PMP/LSD in options?
- Allow to automatically delete torrents when they reach a given ratio (in options) : easy
- Allow to limit the number of downloading torrents simultaneously (other are paused until a download finishes)
- Add "Mark all as read" feature for RSS
// in v1.0.0 (partial) - WIP
- Check storage st creation + hasher in torrent creation
@ -48,6 +48,7 @@
- write a patch for file_priority(int index), actual_size();
- valgrind --tool=memcheck --leak-check=full src/qbittorrent (Looks ok)
* beta 6
- clean rss icons on exit
- Translations update (IN PROGRESS)
- Wait for some bug fixes in libtorrent :
- Number of seeds non null for finished torrent (Ticket #122)
@ -73,6 +74,7 @@ LANGUAGES UPDATED:
beta5->beta6 changelog:
- FEATURE: Split download tab from GUI class and cleaned up code
- FEATURE: A lot of code optimization
- FEATURE: Added support for .ico format (useful for RSS favicons)
- BUGFIX: Made torrent deletion from hard-drive safer
- BUGFIX: Fixed a bug when switching from finished to downloading list
- BUGFIX: Showing checking progress for paused torrents too

86
configure vendored
View File

@ -24,6 +24,9 @@ Dependency options:
--with-libboost-inc=[path] Path to libboost include files
--with-libcommoncpp2-inc=[path] Path to libcommoncpp2 include files
--with-libcommoncpp2-lib=[path] Path to libcommoncpp2 library files
--disable-libmagick Disable use of libmagick
--with-libmagick-inc=[path] Path to libmagick++ include files
--with-libmagick-lib=[path] Path to libmagick++ library files
EOT
}
@ -170,6 +173,21 @@ while [ $# -gt 0 ]; do
shift
;;
--disable-libmagick)
QC_DISABLE_libmagick="Y"
shift
;;
--with-libmagick-inc=*)
QC_WITH_LIBMAGICK_INC=$optarg
shift
;;
--with-libmagick-lib=*)
QC_WITH_LIBMAGICK_LIB=$optarg
shift
;;
--verbose)
QC_DEBUG="Y"
shift
@ -197,6 +215,9 @@ echo QC_WITH_LIBTORRENT_STATIC_LIB=$QC_WITH_LIBTORRENT_STATIC_LIB
echo QC_WITH_LIBBOOST_INC=$QC_WITH_LIBBOOST_INC
echo QC_WITH_LIBCOMMONCPP2_INC=$QC_WITH_LIBCOMMONCPP2_INC
echo QC_WITH_LIBCOMMONCPP2_LIB=$QC_WITH_LIBCOMMONCPP2_LIB
echo QC_DISABLE_libmagick=$QC_DISABLE_libmagick
echo QC_WITH_LIBMAGICK_INC=$QC_WITH_LIBMAGICK_INC
echo QC_WITH_LIBMAGICK_LIB=$QC_WITH_LIBMAGICK_LIB
echo
fi
@ -500,6 +521,65 @@ public:
return true;
}
};
#line 1 "libmagick.qcm"
/*
-----BEGIN QCMOD-----
name: libmagick
arg: with-libmagick-inc=[path], Path to libmagick++ include files
arg: with-libmagick-lib=[path], Path to libmagick++ library files
-----END QCMOD-----
*/
class qc_libmagick : public ConfObj
{
public:
qc_libmagick(Conf *c) : ConfObj(c) {}
QString name() const { return "ImageMagick library (libmagick++)"; }
QString shortname() const { return "libmagick++"; }
bool exec(){
QString s;
s = conf->getenv("QC_WITH_LIBMAGICK_INC");
if(!s.isEmpty()) {
if(!conf->checkHeader(s, "Magick++.h")) {
return false;
}
}else{
QStringList sl;
sl << "/usr/include";
sl << "/usr/local/include";
bool found = false;
foreach(s, sl){
if(conf->checkHeader(s, "Magick++.h")){
found = true;
break;
}
}
if(!found) {
return false;
}
}
conf->addIncludePath(s);
s = conf->getenv("QC_WITH_LIBMAGICK_LIB");
if(!s.isEmpty()) {
if(!QFile::exists(s+QString("libMagick++.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("libMagick++.so"))){
found = true;
}
}
if(!found) return false;
conf->addLib(QString("-L") + s);
}
return true;
}
};
#line 1 "python.qcm"
/*
-----BEGIN QCMOD-----
@ -535,6 +615,9 @@ cat >$1/modules_new.cpp <<EOT
o = new qc_libcommoncpp2(conf);
o->required = true;
o->disabled = false;
o = new qc_libmagick(conf);
o->required = false;
o->disabled = false;
o = new qc_python(conf);
o->required = true;
o->disabled = false;
@ -1470,6 +1553,9 @@ export QC_WITH_LIBTORRENT_STATIC_LIB
export QC_WITH_LIBBOOST_INC
export QC_WITH_LIBCOMMONCPP2_INC
export QC_WITH_LIBCOMMONCPP2_LIB
export QC_DISABLE_libmagick
export QC_WITH_LIBMAGICK_INC
export QC_WITH_LIBMAGICK_LIB
export QC_DEBUG
rm -rf .qconftemp
(

View File

@ -14,6 +14,9 @@
<dep type='libcommoncpp2'>
<required/>
</dep>
<dep type='libmagick'>
<optional/>
</dep>
<dep type='python'>
<required/>
</dep>

58
qcm/libmagick.qcm Normal file
View File

@ -0,0 +1,58 @@
/*
-----BEGIN QCMOD-----
name: libmagick
arg: with-libmagick-inc=[path], Path to libmagick++ include files
arg: with-libmagick-lib=[path], Path to libmagick++ library files
-----END QCMOD-----
*/
class qc_libmagick : public ConfObj
{
public:
qc_libmagick(Conf *c) : ConfObj(c) {}
QString name() const { return "ImageMagick library (libmagick++)"; }
QString shortname() const { return "libmagick++"; }
bool exec(){
QString s;
s = conf->getenv("QC_WITH_LIBMAGICK_INC");
if(!s.isEmpty()) {
if(!conf->checkHeader(s, "Magick++.h")) {
return false;
}
}else{
QStringList sl;
sl << "/usr/include";
sl << "/usr/local/include";
bool found = false;
foreach(s, sl){
if(conf->checkHeader(s, "Magick++.h")){
found = true;
break;
}
}
if(!found) {
return false;
}
}
conf->addIncludePath(s);
s = conf->getenv("QC_WITH_LIBMAGICK_LIB");
if(!s.isEmpty()) {
if(!QFile::exists(s+QString("libMagick++.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("libMagick++.so"))){
found = true;
}
}
if(!found) return false;
conf->addLib(QString("-L") + s);
}
return true;
}
};

View File

@ -41,6 +41,11 @@
#include "misc.h"
#include "downloadThread.h"
#ifndef NO_MAGICK
#include <Magick++.h>
using namespace Magick;
#endif
class RssManager;
class RssStream;
class RssItem;
@ -384,6 +389,18 @@ class RssManager : public QObject{
if(url.endsWith("favicon.ico")){
// Icon downloaded
QImage fileIcon;
#ifndef NO_MAGICK
try{
QFile::copy(path, path+".ico");
Image image(QDir::cleanPath(path+".ico").toUtf8().data());
// Convert to PNG since we can't read ICO format
image.magick("PNG");
image.write(path.toUtf8().data());
QFile::remove(path+".ico");
}catch(Magick::Exception &error_){
qDebug("favicon conversion to PNG failure: %s", error_.what());
}
#endif
if(fileIcon.load(path)) {
QList<RssStream*> res = findFeedsWithIcon(url);
RssStream* stream;

View File

@ -31,7 +31,7 @@ QMAKE_CXXFLAGS_RELEASE += -fwrapv -O2
QMAKE_CXXFLAGS_DEBUG += -fwrapv -O1
CONFIG += link_pkgconfig
PKGCONFIG += libtorrent libccext2 libccgnu2
PKGCONFIG += libtorrent libccext2 libccgnu2 ImageMagick++
QT += network xml
DEFINES += QT_NO_CAST_TO_ASCII