- 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

@ -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