mirror of
https://github.com/YACReader/yacreader
synced 2025-07-19 05:24:57 -04:00
Add support for loading custom comic images
This commit is contained in:
@ -404,12 +404,7 @@ ComicInfo &ComicInfo::operator=(const ComicInfo &comicInfo)
|
||||
|
||||
QPixmap ComicInfo::getCover(const QString &basePath)
|
||||
{
|
||||
if (cover.isNull()) {
|
||||
cover.load(YACReader::LibraryPaths::coverPath(basePath, hash));
|
||||
}
|
||||
QPixmap c;
|
||||
c.convertFromImage(cover);
|
||||
return c;
|
||||
return QPixmap(YACReader::LibraryPaths::coverPath(basePath, hash));
|
||||
}
|
||||
|
||||
QStringList ComicInfo::getWriters()
|
||||
|
@ -84,7 +84,7 @@ public:
|
||||
|
||||
QVariant comicVineID; // string
|
||||
|
||||
QImage cover;
|
||||
// QImage cover;
|
||||
|
||||
QVariant lastTimeOpened; // integer/date
|
||||
QVariant coverSizeRatio; // h/w
|
||||
@ -189,8 +189,6 @@ public:
|
||||
|
||||
Q_PROPERTY(QVariant comicVineID MEMBER comicVineID CONSTANT)
|
||||
|
||||
Q_PROPERTY(QImage cover MEMBER cover CONSTANT)
|
||||
|
||||
Q_PROPERTY(QVariant lastTimeOpened MEMBER lastTimeOpened CONSTANT)
|
||||
|
||||
Q_PROPERTY(QVariant coverSizeRatio MEMBER coverSizeRatio CONSTANT)
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
#include <QtCore>
|
||||
#include <QAction>
|
||||
#include <QImageReader>
|
||||
#include <QFileDialog>
|
||||
|
||||
using namespace YACReader;
|
||||
|
||||
@ -99,3 +101,13 @@ QPixmap YACReader::hdpiPixmap(const QString &file, QSize size)
|
||||
{
|
||||
return QIcon(file).pixmap(size);
|
||||
}
|
||||
|
||||
QString YACReader::imageFileLoader(QWidget *parent)
|
||||
{
|
||||
QString supportedImageFormatsString;
|
||||
for (const QByteArray &format : QImageReader::supportedImageFormats()) {
|
||||
supportedImageFormatsString += QString("*.%1 ").arg(QString(format));
|
||||
}
|
||||
|
||||
return QFileDialog::getOpenFileName(parent, QObject::tr("Select custom cover"), QDir::homePath(), QObject::tr("Images (%1)").arg(supportedImageFormatsString));
|
||||
}
|
||||
|
@ -112,6 +112,6 @@ QString addExtensionToIconPath(const QString &path);
|
||||
QString addExtensionToIconPathInToolbar(const QString &path);
|
||||
QAction *actionWithCustomIcon(const QIcon &icon, QAction *action);
|
||||
QPixmap hdpiPixmap(const QString &file, QSize size);
|
||||
|
||||
QString imageFileLoader(QWidget *parent);
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user