diff --git a/YACReader/configuration.h b/YACReader/configuration.h index a1024621..513f129d 100644 --- a/YACReader/configuration.h +++ b/YACReader/configuration.h @@ -81,6 +81,8 @@ public: void setNumDaysBetweenVersionChecks(int days) { return settings->setValue(NUM_DAYS_BETWEEN_VERSION_CHECKS, days); } bool getQuickNaviMode() { return settings->value(QUICK_NAVI_MODE).toBool(); } bool getDisableShowOnMouseOver() { return settings->value(DISABLE_MOUSE_OVER_GOTO_FLOW).toBool(); } + bool getDoNotTurnPageOnScroll() { return settings->value(DO_NOT_TURN_PAGE_ON_SCROLL, false).toBool(); } + bool getUseSingleScrollStepToTurnPage() { return settings->value(USE_SINGLE_SCROLL_STEP_TO_TURN_PAGE, false).toBool(); } }; #endif diff --git a/YACReader/options_dialog.cpp b/YACReader/options_dialog.cpp index 5ea3890a..1df919fa 100644 --- a/YACReader/options_dialog.cpp +++ b/YACReader/options_dialog.cpp @@ -22,18 +22,23 @@ OptionsDialog::OptionsDialog(QWidget *parent) : YACReaderOptionsDialog(parent) { - auto tabWidget = new QTabWidget(); auto layout = new QVBoxLayout(this); + // GENERAL ------------------------------------------- + QWidget *pageGeneral = new QWidget(); - QWidget *pageFlow = new QWidget(); - QWidget *pageImage = new QWidget(); auto layoutGeneral = new QVBoxLayout(); - auto layoutFlow = new QVBoxLayout(); - auto layoutImageV = new QVBoxLayout(); - auto layoutImage = new QGridLayout(); + + QGroupBox *pathBox = new QGroupBox(tr("My comics path")); + + auto path = new QHBoxLayout(); + path->addWidget(pathEdit = new QLineEdit()); + path->addWidget(pathFindButton = new QPushButton(QIcon(":/images/find_folder.png"), "")); + pathBox->setLayout(path); + + connect(pathFindButton, &QAbstractButton::clicked, this, &OptionsDialog::findFolder); QGroupBox *slideSizeBox = new QGroupBox(tr("\"Go to flow\" size")); // slideSizeLabel = new QLabel(,this); @@ -46,15 +51,6 @@ OptionsDialog::OptionsDialog(QWidget *parent) slideLayout->addWidget(slideSize); slideSizeBox->setLayout(slideLayout); - QGroupBox *pathBox = new QGroupBox(tr("My comics path")); - - auto path = new QHBoxLayout(); - path->addWidget(pathEdit = new QLineEdit()); - path->addWidget(pathFindButton = new QPushButton(QIcon(":/images/find_folder.png"), "")); - pathBox->setLayout(path); - - connect(pathFindButton, &QAbstractButton::clicked, this, &OptionsDialog::findFolder); - auto colorSelection = new QHBoxLayout; backgroundColor = new QLabel(); QPalette pal = backgroundColor->palette(); @@ -75,6 +71,57 @@ OptionsDialog::OptionsDialog(QWidget *parent) connect(selectBackgroundColorButton, &QAbstractButton::clicked, colorDialog, &QWidget::show); colorBox->setLayout(colorSelection); + auto scrollBox = new QGroupBox(tr("Scroll behaviour")); + auto scrollLayout = new QVBoxLayout; + + doNotTurnPageOnScroll = new QCheckBox(tr("Do not turn page using scroll")); + useSingleScrollStepToTurnPage = new QCheckBox(tr("Use single scroll step to turn page")); + + scrollLayout->addWidget(doNotTurnPageOnScroll); + scrollLayout->addWidget(useSingleScrollStepToTurnPage); + + scrollBox->setLayout(scrollLayout); + + layoutGeneral->addWidget(pathBox); + layoutGeneral->addWidget(slideSizeBox); + // layoutGeneral->addWidget(fitBox); + layoutGeneral->addWidget(colorBox); + layoutGeneral->addWidget(scrollBox); + layoutGeneral->addWidget(shortcutsBox); + layoutGeneral->addStretch(); + + // GENERAL END --------------------------------------- + + // PAGE FLOW ----------------------------------------- + + QWidget *pageFlow = new QWidget(); + auto layoutFlow = new QVBoxLayout(); + + quickNavi = new QCheckBox(tr("Quick Navigation Mode")); + disableShowOnMouseOver = new QCheckBox(tr("Disable mouse over activation")); + + layoutFlow->addWidget(sw); +#ifndef NO_OPENGL + layoutFlow->addWidget(gl); + layoutFlow->addWidget(useGL); +#endif + layoutFlow->addWidget(quickNavi); + layoutFlow->addWidget(disableShowOnMouseOver); + layoutFlow->addStretch(); + + // disable vSyncCheck +#ifndef NO_OPENGL + gl->vSyncCheck->hide(); +#endif + + // PAGE FLOW END ------------------------------------- + + // IMAGE ADJUSTMENTS --------------------------------- + + QWidget *pageImage = new QWidget(); + auto layoutImageV = new QVBoxLayout(); + auto layoutImage = new QGridLayout(); + brightnessS = new YACReaderSpinSliderWidget(this, true); brightnessS->setRange(0, 100); // brightnessS->setText(tr("Brightness")); @@ -94,31 +141,6 @@ OptionsDialog::OptionsDialog(QWidget *parent) connect(gammaS, &YACReaderSpinSliderWidget::valueChanged, this, &OptionsDialog::gammaChanged); // connect(brightnessS,SIGNAL(valueChanged(int)),this,SIGNAL(changedOptions())); - quickNavi = new QCheckBox(tr("Quick Navigation Mode")); - disableShowOnMouseOver = new QCheckBox(tr("Disable mouse over activation")); - - auto buttons = new QHBoxLayout(); - buttons->addStretch(); - buttons->addWidget(new QLabel(tr("Restart is needed"))); - buttons->addWidget(accept); - buttons->addWidget(cancel); - - layoutGeneral->addWidget(pathBox); - layoutGeneral->addWidget(slideSizeBox); - // layoutGeneral->addWidget(fitBox); - layoutGeneral->addWidget(colorBox); - layoutGeneral->addWidget(shortcutsBox); - layoutGeneral->addStretch(); - - layoutFlow->addWidget(sw); -#ifndef NO_OPENGL - layoutFlow->addWidget(gl); - layoutFlow->addWidget(useGL); -#endif - layoutFlow->addWidget(quickNavi); - layoutFlow->addWidget(disableShowOnMouseOver); - layoutFlow->addStretch(); - layoutImage->addWidget(new QLabel(tr("Brightness")), 0, 0); layoutImage->addWidget(new QLabel(tr("Contrast")), 1, 0); layoutImage->addWidget(new QLabel(tr("Gamma")), 2, 0); @@ -161,6 +183,8 @@ OptionsDialog::OptionsDialog(QWidget *parent) layoutImageV->addWidget(doublePageBox); layoutImageV->addStretch(); + // IMAGE ADJUSTMENTS END ----------------------------- + pageGeneral->setLayout(layoutGeneral); pageFlow->setLayout(layoutFlow); pageImage->setLayout(layoutImageV); @@ -170,16 +194,17 @@ OptionsDialog::OptionsDialog(QWidget *parent) tabWidget->addTab(pageImage, tr("Image adjustment")); layout->addWidget(tabWidget); + + auto buttons = new QHBoxLayout(); + buttons->addStretch(); + buttons->addWidget(new QLabel(tr("Restart is needed"))); + buttons->addWidget(accept); + buttons->addWidget(cancel); + layout->addLayout(buttons); setLayout(layout); - // disable vSyncCheck -#ifndef NO_OPENGL - gl->vSyncCheck->hide(); -#endif - // restoreOptions(); //load options - // resize(400,0); setModal(true); setWindowTitle(tr("Options")); @@ -196,7 +221,6 @@ void OptionsDialog::findFolder() void OptionsDialog::saveOptions() { - settings->setValue(GO_TO_FLOW_SIZE, QSize(static_cast(slideSize->sliderPosition() / SLIDE_ASPECT_RATIO), slideSize->sliderPosition())); if (sw->radio1->isChecked()) @@ -213,6 +237,9 @@ void OptionsDialog::saveOptions() settings->setValue(QUICK_NAVI_MODE, quickNavi->isChecked()); settings->setValue(DISABLE_MOUSE_OVER_GOTO_FLOW, disableShowOnMouseOver->isChecked()); + settings->setValue(DO_NOT_TURN_PAGE_ON_SCROLL, doNotTurnPageOnScroll->isChecked()); + settings->setValue(USE_SINGLE_SCROLL_STEP_TO_TURN_PAGE, useSingleScrollStepToTurnPage->isChecked()); + YACReaderOptionsDialog::saveOptions(); } @@ -250,6 +277,9 @@ void OptionsDialog::restoreOptions(QSettings *settings) scaleCheckbox->setChecked(settings->value(ENLARGE_IMAGES, true).toBool()); coverSPCheckBox->setChecked(settings->value(COVER_IS_SP, true).toBool()); + + doNotTurnPageOnScroll->setChecked(settings->value(DO_NOT_TURN_PAGE_ON_SCROLL, false).toBool()); + useSingleScrollStepToTurnPage->setChecked(settings->value(USE_SINGLE_SCROLL_STEP_TO_TURN_PAGE, false).toBool()); } void OptionsDialog::updateColor(const QColor &color) diff --git a/YACReader/options_dialog.h b/YACReader/options_dialog.h index d1af00b4..92b7177e 100644 --- a/YACReader/options_dialog.h +++ b/YACReader/options_dialog.h @@ -41,6 +41,9 @@ private: QLabel *backgroundColor; QPushButton *selectBackgroundColorButton; + QCheckBox *doNotTurnPageOnScroll; + QCheckBox *useSingleScrollStepToTurnPage; + QColorDialog *colorDialog; YACReaderSpinSliderWidget *brightnessS; diff --git a/YACReader/viewer.cpp b/YACReader/viewer.cpp index 23ad54db..ba8a8206 100644 --- a/YACReader/viewer.cpp +++ b/YACReader/viewer.cpp @@ -696,8 +696,11 @@ void Viewer::wheelEvent(QWheelEvent *event) return; } - if ((delta.y() < 0) && (verticalScrollBar()->sliderPosition() == verticalScrollBar()->maximum())) { - if (wheelStop || verticalScrollBar()->maximum() == verticalScrollBar()->minimum()) { + auto turnPageOnScroll = !Configuration::getConfiguration().getDoNotTurnPageOnScroll(); + auto getUseSingleScrollStepToTurnPage = Configuration::getConfiguration().getUseSingleScrollStepToTurnPage(); + + if ((delta.y() < 0) && (verticalScrollBar()->sliderPosition() == verticalScrollBar()->maximum()) && turnPageOnScroll) { + if (wheelStop || getUseSingleScrollStepToTurnPage || verticalScrollBar()->maximum() == verticalScrollBar()->minimum()) { if (getMovement(event) == Forward) { next(); verticalScroller->stop(); @@ -708,8 +711,8 @@ void Viewer::wheelEvent(QWheelEvent *event) } else wheelStop = true; } else { - if ((delta.y() > 0) && (verticalScrollBar()->sliderPosition() == verticalScrollBar()->minimum())) { - if (wheelStop || verticalScrollBar()->maximum() == verticalScrollBar()->minimum()) { + if ((delta.y() > 0) && (verticalScrollBar()->sliderPosition() == verticalScrollBar()->minimum()) && turnPageOnScroll) { + if (wheelStop || getUseSingleScrollStepToTurnPage || verticalScrollBar()->maximum() == verticalScrollBar()->minimum()) { if (getMovement(event) == Backward) { prev(); verticalScroller->stop(); diff --git a/common/yacreader_global_gui.h b/common/yacreader_global_gui.h index 0e492a8a..3c951396 100644 --- a/common/yacreader_global_gui.h +++ b/common/yacreader_global_gui.h @@ -33,6 +33,8 @@ #define QUICK_NAVI_MODE "QUICK_NAVI_MODE" #define DISABLE_MOUSE_OVER_GOTO_FLOW "DISABLE_MOUSE_OVER_GOTO_FLOW" #define ENLARGE_IMAGES "ENLARGE_IMAGES" +#define DO_NOT_TURN_PAGE_ON_SCROLL "DO_NOT_TURN_PAGE_ON_SCROLL" +#define USE_SINGLE_SCROLL_STEP_TO_TURN_PAGE "USE_SINGLE_SCROLL_STEP_TO_TURN_PAGE" #define FLOW_TYPE_GL "FLOW_TYPE_GL" #define Y_POSITION "Y_POSITION"