Reader: Add option to show covers as single pages in double page mode

This commit is contained in:
Felix Kauselmann 2020-09-03 15:12:57 +02:00
parent ce90796aed
commit 5bb6ab276a
5 changed files with 27 additions and 0 deletions

View File

@ -10,6 +10,7 @@ Version counting is based on semantic versioning (Major.Feature.Patch)
### YACReader ### YACReader
* Image enlargement/stretching can now be disabled for fit * Image enlargement/stretching can now be disabled for fit
to width and height to width and height
* New option to show covers as single pages in double page mode (enabled by default)
### YACReaderLibrary ### YACReaderLibrary
* update QsLog logger to version 2.1, snapshot 46b643d5bcbc * update QsLog logger to version 2.1, snapshot 46b643d5bcbc

View File

@ -146,6 +146,19 @@ OptionsDialog::OptionsDialog(QWidget *parent)
scaleLayout->addWidget(scaleCheckbox); scaleLayout->addWidget(scaleCheckbox);
scaleBox->setLayout(scaleLayout); scaleBox->setLayout(scaleLayout);
layoutImageV->addWidget(scaleBox); 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(); layoutImageV->addStretch();
pageGeneral->setLayout(layoutGeneral); pageGeneral->setLayout(layoutGeneral);
@ -236,6 +249,7 @@ void OptionsDialog::restoreOptions(QSettings *settings)
gammaS->setValue(settings->value(GAMMA, 100).toInt()); gammaS->setValue(settings->value(GAMMA, 100).toInt());
scaleCheckbox->setChecked(settings->value(ENLARGE_IMAGES, true).toBool()); scaleCheckbox->setChecked(settings->value(ENLARGE_IMAGES, true).toBool());
coverSPCheckBox->setChecked(settings->value(COVER_IS_SP, true).toBool());
} }
void OptionsDialog::updateColor(const QColor &color) void OptionsDialog::updateColor(const QColor &color)

View File

@ -26,6 +26,7 @@ private:
QCheckBox *quickNavi; QCheckBox *quickNavi;
QCheckBox *disableShowOnMouseOver; QCheckBox *disableShowOnMouseOver;
QCheckBox *scaleCheckbox; QCheckBox *scaleCheckbox;
QCheckBox *coverSPCheckBox;
QLabel *magGlassSizeLabel; QLabel *magGlassSizeLabel;

View File

@ -11,6 +11,7 @@
#include "comic_db.h" #include "comic_db.h"
#include "yacreader_global_gui.h" #include "yacreader_global_gui.h"
#include "configuration.h"
template<class T> template<class T>
inline const T &kClamp(const T &x, const T &low, const T &high) inline const T &kClamp(const T &x, const T &low, const T &high)
@ -544,6 +545,9 @@ QPixmap *Render::getCurrentDoubleMangaPage()
bool Render::currentPageIsDoublePage() 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()) { if (buffer[currentPageBufferedIndex]->isNull() || buffer[currentPageBufferedIndex + 1]->isNull()) {
return false; return false;
} }
@ -583,6 +587,12 @@ bool Render::nextPageIsDoublePage()
bool Render::previousPageIsDoublePage() 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()) { if (buffer[currentPageBufferedIndex - 1]->isNull() || buffer[currentPageBufferedIndex - 2]->isNull()) {
return false; return false;
} }

View File

@ -22,6 +22,7 @@
#define START_TO_TRAY "START_TO_TRAY" #define START_TO_TRAY "START_TO_TRAY"
#define DOUBLE_PAGE "DOUBLE_PAGE" #define DOUBLE_PAGE "DOUBLE_PAGE"
#define DOUBLE_MANGA_PAGE "DOUBLE_MANGA_PAGE" #define DOUBLE_MANGA_PAGE "DOUBLE_MANGA_PAGE"
#define COVER_IS_SP "COVER_IS_SP"
#define BACKGROUND_COLOR "BACKGROUND_COLOR" #define BACKGROUND_COLOR "BACKGROUND_COLOR"
#define ALWAYS_ON_TOP "ALWAYS_ON_TOP" #define ALWAYS_ON_TOP "ALWAYS_ON_TOP"
#define SHOW_TOOLBARS "SHOW_TOOLBARS" #define SHOW_TOOLBARS "SHOW_TOOLBARS"