mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
- 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:
parent
19c606e067
commit
99268bfc06
7 changed files with 170 additions and 2 deletions
17
src/rss.h
17
src/rss.h
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue