diff --git a/CHANGELOG.md b/CHANGELOG.md index 96a27f3f..ee500acc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Version counting is based on semantic versioning (Major.Feature.Patch) ### YACReader * Image enlargement/stretching can now be disabled for fit to width and height +* New option to show covers as single pages in double page mode (enabled by default) ### YACReaderLibrary * update QsLog logger to version 2.1, snapshot 46b643d5bcbc diff --git a/YACReader/options_dialog.cpp b/YACReader/options_dialog.cpp index 5bc07407..e69c727b 100644 --- a/YACReader/options_dialog.cpp +++ b/YACReader/options_dialog.cpp @@ -146,6 +146,19 @@ OptionsDialog::OptionsDialog(QWidget *parent) scaleLayout->addWidget(scaleCheckbox); scaleBox->setLayout(scaleLayout); layoutImageV->addWidget(scaleBox); + + auto doublePageBox = new QGroupBox(tr("Double Page options")); + auto doublePageBoxLayout = new QVBoxLayout(); + coverSPCheckBox = new QCheckBox(tr("Show covers as single page")); + connect(coverSPCheckBox, &QCheckBox::clicked, + [=](bool checked) { + settings->setValue(COVER_IS_SP, checked); + emit(changedImageOptions()); + }); + + doublePageBoxLayout->addWidget(coverSPCheckBox); + doublePageBox->setLayout(doublePageBoxLayout); + layoutImageV->addWidget(doublePageBox); layoutImageV->addStretch(); pageGeneral->setLayout(layoutGeneral); @@ -236,6 +249,7 @@ void OptionsDialog::restoreOptions(QSettings *settings) gammaS->setValue(settings->value(GAMMA, 100).toInt()); scaleCheckbox->setChecked(settings->value(ENLARGE_IMAGES, true).toBool()); + coverSPCheckBox->setChecked(settings->value(COVER_IS_SP, true).toBool()); } void OptionsDialog::updateColor(const QColor &color) diff --git a/YACReader/options_dialog.h b/YACReader/options_dialog.h index 56935a8e..3c278b74 100644 --- a/YACReader/options_dialog.h +++ b/YACReader/options_dialog.h @@ -26,6 +26,7 @@ private: QCheckBox *quickNavi; QCheckBox *disableShowOnMouseOver; QCheckBox *scaleCheckbox; + QCheckBox *coverSPCheckBox; QLabel *magGlassSizeLabel; diff --git a/YACReader/render.cpp b/YACReader/render.cpp index f89b6932..58501767 100644 --- a/YACReader/render.cpp +++ b/YACReader/render.cpp @@ -11,6 +11,7 @@ #include "comic_db.h" #include "yacreader_global_gui.h" +#include "configuration.h" template inline const T &kClamp(const T &x, const T &low, const T &high) @@ -544,6 +545,9 @@ QPixmap *Render::getCurrentDoubleMangaPage() bool Render::currentPageIsDoublePage() { + if (currentIndex == 0 && Configuration::getConfiguration().getSettings()->value(COVER_IS_SP, true).toBool()) { + return false; + } if (buffer[currentPageBufferedIndex]->isNull() || buffer[currentPageBufferedIndex + 1]->isNull()) { return false; } @@ -583,6 +587,12 @@ bool Render::nextPageIsDoublePage() bool Render::previousPageIsDoublePage() { + qWarning("Previous page is doublepage!"); + qWarning("%d", currentIndex); + qWarning("%d", currentPageBufferedIndex); + if (currentIndex == 2 && Configuration::getConfiguration().getSettings()->value(COVER_IS_SP, true).toBool()) { + return false; + } if (buffer[currentPageBufferedIndex - 1]->isNull() || buffer[currentPageBufferedIndex - 2]->isNull()) { return false; } diff --git a/common/yacreader_global_gui.h b/common/yacreader_global_gui.h index 8280c28e..6b949437 100644 --- a/common/yacreader_global_gui.h +++ b/common/yacreader_global_gui.h @@ -22,6 +22,7 @@ #define START_TO_TRAY "START_TO_TRAY" #define DOUBLE_PAGE "DOUBLE_PAGE" #define DOUBLE_MANGA_PAGE "DOUBLE_MANGA_PAGE" +#define COVER_IS_SP "COVER_IS_SP" #define BACKGROUND_COLOR "BACKGROUND_COLOR" #define ALWAYS_ON_TOP "ALWAYS_ON_TOP" #define SHOW_TOOLBARS "SHOW_TOOLBARS"