kdeplasma-addons: use QImageReader::size() to determine image size instead of KFileMetaInfo

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-03-08 21:48:28 +02:00
parent d31375d172
commit da2a2acb0a
3 changed files with 11 additions and 14 deletions

View file

@ -15,9 +15,9 @@
#include <QDir>
#include <QThreadPool>
#include <QUuid>
#include <QImageReader>
#include <KDebug>
#include <KFileMetaInfo>
#include <KGlobal>
#include <KIO/PreviewJob>
#include <KProgressDialog>
@ -192,12 +192,11 @@ QSize BackgroundListModel::bestSize(Plasma::Package *package) const
return QSize();
}
KFileMetaInfo info(image, KFileMetaInfo::TechnicalInfo);
QSize size(info.item("http://freedesktop.org/standards/xesam/1.0/core#width").value().toInt(),
info.item("http://freedesktop.org/standards/xesam/1.0/core#height").value().toInt());
//backup solution if strigi does not work
QImageReader imagereader(image);
QSize size = imagereader.size();
// backup solution if image handler does not provide size option
if (size.width() == 0 || size.height() == 0) {
// kDebug() << "fall back to QImage, check your strigi";
// kDebug() << "fall back to ImageSizeFinder";
ImageSizeFinder *finder = new ImageSizeFinder(image);
connect(finder, SIGNAL(sizeFound(QString,QSize)), this,
SLOT(sizeFound(QString,QSize)));

View file

@ -14,13 +14,13 @@
#include <QPixmap>
#include <QRunnable>
#include <QThread>
#include <QEventLoop>
#include <KDirWatch>
#include <KFileItem>
#include <Plasma/Wallpaper>
#include <QEventLoop>
class KProgressDialog;
namespace Plasma

View file

@ -12,9 +12,9 @@
#include <QCoreApplication>
#include <QFile>
#include <QDir>
#include <QImageReader>
#include <KDebug>
#include <KFileMetaInfo>
#include <KGlobal>
#include <KIO/PreviewJob>
#include <KProgressDialog>
@ -145,13 +145,11 @@ QSize BackgroundListModel::bestSize(Plasma::Package *package) const
return QSize();
}
KFileMetaInfo info(image, KFileMetaInfo::TechnicalInfo);
QSize size(info.item(QLatin1String("http://freedesktop.org/standards/xesam/1.0/core#width")).value().toInt(),
info.item(QLatin1String("http://freedesktop.org/standards/xesam/1.0/core#height")).value().toInt());
//backup solution if strigi does not work
QImageReader imagereader(image);
QSize size = imagereader.size();
// backup solution if image handler does not provide size option
if (size.width() == 0 || size.height() == 0) {
kDebug() << "fall back to QImage, check your strigi";
kDebug() << "fall back to QImage";
size = QImage(image).size();
}