mirror of
https://github.com/YACReader/yacreader
synced 2025-05-25 18:00:46 -04:00
Make import ComicInfo.XML from new comics optional
It is disabled by default.
This commit is contained in:
parent
f8d89f7c14
commit
150d27c3ad
@ -18,6 +18,7 @@ Version counting is based on semantic versioning (Major.Feature.Patch)
|
||||
* Fixed selected folder restoration after folder updates.
|
||||
* Better support for HDPI screens (SVG icons).
|
||||
* Add option to delete metadata from comics.
|
||||
* Importing ComicInfo.XML is now optional and disabled by default, you can change the behavior in Settings -> General.
|
||||
|
||||
### Server
|
||||
* Add webui status page (reachable by navigating to server::port/webui)
|
||||
|
@ -10,8 +10,8 @@ using namespace YACReader;
|
||||
|
||||
bool InitialComicInfoExtractor::crash = false;
|
||||
|
||||
InitialComicInfoExtractor::InitialComicInfoExtractor(QString fileSource, QString target, int coverPage)
|
||||
: _fileSource(fileSource), _target(target), _numPages(0), _coverPage(coverPage), _xmlInfoData()
|
||||
InitialComicInfoExtractor::InitialComicInfoExtractor(QString fileSource, QString target, int coverPage, bool getXMLMetadata)
|
||||
: _fileSource(fileSource), _target(target), _numPages(0), _coverPage(coverPage), getXMLMetadata(getXMLMetadata), _xmlInfoData()
|
||||
{
|
||||
}
|
||||
|
||||
@ -101,16 +101,17 @@ void InitialComicInfoExtractor::extract()
|
||||
|
||||
QList<QString> order = archive.getFileNames();
|
||||
|
||||
// Try to find embeded XML info (ComicRack or ComicTagger)
|
||||
if (getXMLMetadata) {
|
||||
// Try to find embeded XML info (ComicRack or ComicTagger)
|
||||
auto infoIndex = 0;
|
||||
for (auto &fileName : order) {
|
||||
if (fileName.endsWith(".xml", Qt::CaseInsensitive)) {
|
||||
_xmlInfoData = archive.getRawDataAtIndex(infoIndex);
|
||||
break;
|
||||
}
|
||||
|
||||
auto infoIndex = 0;
|
||||
for (auto &fileName : order) {
|
||||
if (fileName.endsWith(".xml", Qt::CaseInsensitive)) {
|
||||
_xmlInfoData = archive.getRawDataAtIndex(infoIndex);
|
||||
break;
|
||||
infoIndex++;
|
||||
}
|
||||
|
||||
infoIndex++;
|
||||
}
|
||||
|
||||
//--------------------------
|
||||
|
@ -9,7 +9,7 @@ class InitialComicInfoExtractor : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
InitialComicInfoExtractor(QString fileSource, QString target = "", int coverPage = 1);
|
||||
InitialComicInfoExtractor(QString fileSource, QString target = "", int coverPage = 1, bool getXMLMetadata = false);
|
||||
|
||||
private:
|
||||
QString _fileSource;
|
||||
@ -19,6 +19,7 @@ private:
|
||||
QPair<int, int> _coverSize;
|
||||
QImage _cover;
|
||||
int _coverPage;
|
||||
int getXMLMetadata;
|
||||
static bool crash;
|
||||
QByteArray _xmlInfoData;
|
||||
void saveCover(const QString &path, const QImage &cover);
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include "pdf_comic.h"
|
||||
#include "yacreader_global.h"
|
||||
|
||||
#include "yacreader_global_gui.h"
|
||||
|
||||
#include "QsLog.h"
|
||||
|
||||
#include <algorithm>
|
||||
@ -26,8 +28,8 @@ using namespace std;
|
||||
using namespace YACReader;
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
LibraryCreator::LibraryCreator()
|
||||
: creation(false), partialUpdate(false)
|
||||
LibraryCreator::LibraryCreator(QSettings *settings)
|
||||
: creation(false), partialUpdate(false), settings(settings)
|
||||
{
|
||||
_nameFilter << Comic::comicExtensions;
|
||||
}
|
||||
@ -301,7 +303,7 @@ void LibraryCreator::insertComic(const QString &relativePath, const QFileInfo &f
|
||||
QPair<int, int> originalCoverSize = { 0, 0 };
|
||||
bool exists = checkCover(hash);
|
||||
|
||||
YACReader::InitialComicInfoExtractor ie(QDir::cleanPath(fileInfo.absoluteFilePath()), _target + "/covers/" + hash + ".jpg", comic.info.coverPage.toInt());
|
||||
YACReader::InitialComicInfoExtractor ie(QDir::cleanPath(fileInfo.absoluteFilePath()), _target + "/covers/" + hash + ".jpg", comic.info.coverPage.toInt(), settings->value(IMPORT_COMIC_INFO_XML_METADATA, false).toBool());
|
||||
|
||||
if (!(comic.hasCover() && exists)) {
|
||||
ie.extract();
|
||||
|
@ -22,7 +22,7 @@ class LibraryCreator : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LibraryCreator();
|
||||
LibraryCreator(QSettings *settings);
|
||||
void createLibrary(const QString &source, const QString &target);
|
||||
void updateLibrary(const QString &source, const QString &target);
|
||||
void updateFolder(const QString &source, const QString &target, const QString &folder, const QModelIndex &dest);
|
||||
@ -54,6 +54,7 @@ private:
|
||||
bool creation;
|
||||
bool partialUpdate;
|
||||
QModelIndex folderDestinationModelIndex;
|
||||
QSettings *settings;
|
||||
|
||||
signals:
|
||||
void finished();
|
||||
|
@ -167,7 +167,7 @@ void LibraryWindow::setupUI()
|
||||
|
||||
setUnifiedTitleAndToolBarOnMac(true);
|
||||
|
||||
libraryCreator = new LibraryCreator();
|
||||
libraryCreator = new LibraryCreator(settings);
|
||||
packageManager = new PackageManager();
|
||||
xmlInfoLibraryScanner = new XMLInfoLibraryScanner();
|
||||
|
||||
|
@ -50,13 +50,13 @@ OptionsDialog::OptionsDialog(QWidget *parent)
|
||||
trayIconCheckbox = new QCheckBox(tr("Close to tray"));
|
||||
startToTrayCheckbox = new QCheckBox(tr("Start into the system tray"));
|
||||
|
||||
connect(trayIconCheckbox, &QCheckBox::clicked,
|
||||
connect(trayIconCheckbox, &QCheckBox::clicked, this,
|
||||
[=](bool checked) {
|
||||
settings->setValue(CLOSE_TO_TRAY, checked);
|
||||
startToTrayCheckbox->setEnabled(checked);
|
||||
emit optionsChanged();
|
||||
});
|
||||
connect(startToTrayCheckbox, &QCheckBox::clicked,
|
||||
connect(startToTrayCheckbox, &QCheckBox::clicked, this,
|
||||
[=](bool checked) {
|
||||
settings->setValue(START_TO_TRAY, checked);
|
||||
});
|
||||
@ -74,6 +74,18 @@ OptionsDialog::OptionsDialog(QWidget *parent)
|
||||
|
||||
connect(apiKeyButton, &QAbstractButton::clicked, this, &OptionsDialog::editApiKey);
|
||||
|
||||
auto comicInfoXMLBox = new QGroupBox(tr("ComicInfo.xml legacy support"));
|
||||
|
||||
comicInfoXMLCheckbox = new QCheckBox(tr("Import metada from ComicInfo.xml when adding new comics"));
|
||||
connect(comicInfoXMLCheckbox, &QCheckBox::clicked, this,
|
||||
[=](bool checked) {
|
||||
settings->setValue(IMPORT_COMIC_INFO_XML_METADATA, checked);
|
||||
});
|
||||
|
||||
auto comicInfoXMLBoxLayout = new QVBoxLayout();
|
||||
comicInfoXMLBoxLayout->addWidget(comicInfoXMLCheckbox);
|
||||
comicInfoXMLBox->setLayout(comicInfoXMLBoxLayout);
|
||||
|
||||
// grid view background config
|
||||
useBackgroundImageCheck = new QCheckBox(tr("Enable background image"));
|
||||
|
||||
@ -139,6 +151,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
|
||||
generalLayout->addWidget(trayIconBox);
|
||||
generalLayout->addWidget(shortcutsBox);
|
||||
generalLayout->addWidget(apiKeyBox);
|
||||
generalLayout->addWidget(comicInfoXMLBox);
|
||||
generalLayout->addStretch();
|
||||
|
||||
tabWidget->addTab(generalW, tr("General"));
|
||||
@ -172,6 +185,8 @@ void OptionsDialog::restoreOptions(QSettings *settings)
|
||||
startToTrayCheckbox->setChecked(settings->value(START_TO_TRAY, false).toBool());
|
||||
startToTrayCheckbox->setEnabled(trayIconCheckbox->isChecked());
|
||||
|
||||
comicInfoXMLCheckbox->setChecked(settings->value(IMPORT_COMIC_INFO_XML_METADATA, false).toBool());
|
||||
|
||||
bool useBackgroundImage = settings->value(USE_BACKGROUND_IMAGE_IN_GRID_VIEW, true).toBool();
|
||||
|
||||
useBackgroundImageCheck->setChecked(useBackgroundImage);
|
||||
|
@ -37,6 +37,7 @@ private:
|
||||
QCheckBox *displayContinueReadingBannerCheck;
|
||||
QCheckBox *trayIconCheckbox;
|
||||
QCheckBox *startToTrayCheckbox;
|
||||
QCheckBox *comicInfoXMLCheckbox;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -71,6 +71,7 @@
|
||||
#define BLUR_RADIUS_BACKGROUND_IMAGE_IN_GRID_VIEW "BLUR_RADIUS_BACKGROUND_IMAGE_IN_GRID_VIEW"
|
||||
#define USE_SELECTED_COMIC_COVER_AS_BACKGROUND_IMAGE_IN_GRID_VIEW "USE_SELECTED_COMIC_COVER_AS_BACKGROUND_IMAGE_IN_GRID_VIEW"
|
||||
#define DISPLAY_CONTINUE_READING_IN_GRID_VIEW "DISPLAY_CONTINUE_READING_IN_GRID_VIEW"
|
||||
#define IMPORT_COMIC_INFO_XML_METADATA "IMPORT_COMIC_INFO_XML_METADATA"
|
||||
|
||||
namespace YACReader {
|
||||
|
||||
|
@ -60,6 +60,9 @@ YACReader::WhatsNewDialog::WhatsNewDialog(QWidget *parent)
|
||||
" • Fixed selected folder restoration after folder updates.<br/>"
|
||||
" • Add option to delete metadata from comics.<br/>"
|
||||
" • Better support for HDPI screens (SVG icons).<br/>"
|
||||
" • Importing ComicInfo.XML is now optional, you can change the behavior in Settings -> General.<br/>"
|
||||
"<br/>"
|
||||
"NOTE: Importing metadata from ComicInfo.XML in now disabled by default, if you want you can enable it Settings -> General.<br/>"
|
||||
"<br/>"
|
||||
"I hope you enjoy the new update. Please, if you like YACReader consider to become a patron in <a href=\"https://www.patreon.com/yacreader\" style=\"color:#E8B800;\">Patreon</a> or donate some money using <a href=\"https://www.paypal.com/donate?business=5TAMNQCDDMVP8&item_name=Support+YACReader\" style=\"color:#E8B800;\">Pay-Pal</a> and help keeping the project alive. Remember that there is an iOS version available in the <a href=\"https://apps.apple.com/app/id635717885\" style=\"color:#E8B800;\">Apple App Store</a>.");
|
||||
QFont textLabelFont("Arial", 15, QFont::Light);
|
||||
|
Loading…
Reference in New Issue
Block a user