Skip to content

Commit

Permalink
- got rid of libMagick++ dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Christophe Dumez committed Nov 4, 2008
1 parent 3164337 commit 2aea2a0
Show file tree
Hide file tree
Showing 10 changed files with 677 additions and 252 deletions.
5 changes: 5 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ Contributors:
* Ishan Arora <[email protected]>
* Grigis Gaëtan <[email protected]>

Code from other projects:
* files src/ico.cpp src/ico.h
copyright: Malte Starostik <[email protected]>
license: LGPL

Images Authors:
* files: src/Icons/*.png
copyright: Gnome Icon Theme
Expand Down
1 change: 1 addition & 0 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- FEATURE: Allow to force rechecking torrents
- FEATURE: Added support for 2 new extensions (uTorrent metadata and smart ban plugin)
- FEATURE: Allow to change the save path of torrents after addition
- FEATURE: Got rid of libmagick++ dependency

* Unknown - Christophe Dumez <[email protected]> - v1.2.1
- BUGFIX: Fixed possible crash when deleting a torrent permanently
Expand Down
107 changes: 0 additions & 107 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ Dependency options:
--with-libboost-inc=[path] Path to libboost include files
--with-libcurl-inc=[path] Path to libcurl include files
--with-libcurl-lib=[path] Path to libcurl 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
--disable-libzzip Disable use of libzzip
--with-libzzip-inc=[path] Path to libzzip++ include files
--with-libzzip-lib=[path] Path to libzzip++ library files
Expand Down Expand Up @@ -178,21 +175,6 @@ 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
;;

--disable-libzzip)
QC_DISABLE_libzzip="Y"
shift
Expand Down Expand Up @@ -235,9 +217,6 @@ echo QC_WITH_LIBTORRENT_STATIC_LIB=$QC_WITH_LIBTORRENT_STATIC_LIB
echo QC_WITH_LIBBOOST_INC=$QC_WITH_LIBBOOST_INC
echo QC_WITH_LIBCURL_INC=$QC_WITH_LIBCURL_INC
echo QC_WITH_LIBCURL_LIB=$QC_WITH_LIBCURL_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 QC_DISABLE_libzzip=$QC_DISABLE_libzzip
echo QC_WITH_LIBZZIP_INC=$QC_WITH_LIBZZIP_INC
echo QC_WITH_LIBZZIP_LIB=$QC_WITH_LIBZZIP_LIB
Expand Down Expand Up @@ -553,86 +532,6 @@ 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-----
*/
#include <QProcess>
class qc_libmagick : public ConfObj
{
public:
qc_libmagick(Conf *c) : ConfObj(c) {}
QString name() const { return "ImageMagick library (libmagick++)"; }
QString shortname() const { return "libmagick++"; }
QString checkString() const {
if(!conf->getenv("QC_DISABLE_libmagick").isEmpty())
return "";
return ConfObj::checkString();
}
bool exec(){
if(!conf->getenv("QC_DISABLE_libmagick").isEmpty())
return false;
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(!conf->checkLibrary(s, "Magick++")) {
return false;
}
}else{
QStringList sl;
sl << "/usr/lib/";
sl << "/usr/lib64/";
sl << "/usr/local/lib/";
sl << "/usr/local/lib64/";
bool found = false;
foreach(s, sl){
if(conf->checkLibrary(s, "Magick++")) {
found = true;
break;
}
}
if(!found)
return false;
}
conf->addLib(QString("-L") + s);
QProcess magickConfig;
QStringList params;
params << "--libs";
magickConfig.start("Magick++-config", params, QIODevice::ReadOnly);
magickConfig.waitForStarted();
magickConfig.waitForFinished();
QByteArray result = magickConfig.readAll();
result = result.replace("\n", "");
conf->addLib(result.data());
conf->addDefine("HAVE_MAGICK");
return true;
}
};
#line 1 "libzzip.qcm"
/*
-----BEGIN QCMOD-----
Expand Down Expand Up @@ -720,9 +619,6 @@ cat >$1/modules_new.cpp <<EOT
o = new qc_libcurl(conf);
o->required = true;
o->disabled = false;
o = new qc_libmagick(conf);
o->required = false;
o->disabled = false;
o = new qc_libzzip(conf);
o->required = false;
o->disabled = false;
Expand Down Expand Up @@ -1677,9 +1573,6 @@ export QC_WITH_LIBTORRENT_STATIC_LIB
export QC_WITH_LIBBOOST_INC
export QC_WITH_LIBCURL_INC
export QC_WITH_LIBCURL_LIB
export QC_DISABLE_libmagick
export QC_WITH_LIBMAGICK_INC
export QC_WITH_LIBMAGICK_LIB
export QC_DISABLE_libzzip
export QC_WITH_LIBZZIP_INC
export QC_WITH_LIBZZIP_LIB
Expand Down
1 change: 0 additions & 1 deletion qbittorrent.qc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@
<dep type='libcurl'>
<required/>
</dep>
<dep type='libmagick'/>
<dep type='libzzip'/>
</qconf>
19 changes: 0 additions & 19 deletions src/engineSelectDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@
#include <QDropEvent>
#include <QInputDialog>

#ifdef HAVE_MAGICK
#include <Magick++.h>
using namespace Magick;
#endif

#ifdef HAVE_ZZIP
#include <zzip/zzip.h>
#endif
Expand Down Expand Up @@ -611,20 +606,6 @@ void engineSelectDlg::processDownloadedFile(QString url, QString filePath) {
if(url.endsWith("favicon.ico", Qt::CaseInsensitive)){
// Icon downloaded
QImage fileIcon;
#ifdef HAVE_MAGICK
try{
QFile::copy(filePath, filePath+".ico");
Image image(QDir::cleanPath(filePath+".ico").toUtf8().data());
// Convert to PNG since we can't read ICO format
image.magick("PNG");
// Resize to 16x16px
image.sample(Geometry(16, 16));
image.write(filePath.toUtf8().data());
QFile::remove(filePath+".ico");
}catch(Magick::Exception &error_){
qDebug("favicon conversion to PNG failure: %s", error_.what());
}
#endif
if(fileIcon.load(filePath)) {
QList<QTreeWidgetItem*> items = findItemsWithUrl(url);
QTreeWidgetItem *item;
Expand Down
Loading

0 comments on commit 2aea2a0

Please sign in to comment.