diff --git a/YACReader/configuration.cpp b/YACReader/configuration.cpp index c36054a2..4be384d7 100644 --- a/YACReader/configuration.cpp +++ b/YACReader/configuration.cpp @@ -12,7 +12,12 @@ Configuration::Configuration() { //read configuration - //load("/YACReader.conf"); + //load("/YACReader.conf"); +} + +QSettings *Configuration::getSettings() +{ + return settings; } /*Configuration::Configuration(const Configuration & conf) diff --git a/YACReader/configuration.h b/YACReader/configuration.h index ec5932c9..6d27227d 100644 --- a/YACReader/configuration.h +++ b/YACReader/configuration.h @@ -51,6 +51,7 @@ using namespace YACReader; static Configuration configuration; return configuration; }; + QSettings *getSettings(); void load(QSettings * settings); QString getDefaultPath() { return settings->value(PATH).toString(); } void setDefaultPath(QString defaultPath){settings->setValue(PATH,defaultPath);} diff --git a/YACReader/goto_flow_toolbar.cpp b/YACReader/goto_flow_toolbar.cpp index 2aedede1..4043f568 100644 --- a/YACReader/goto_flow_toolbar.cpp +++ b/YACReader/goto_flow_toolbar.cpp @@ -32,6 +32,7 @@ GoToFlowToolBar::GoToFlowToolBar(QWidget * parent) " border-radius: 1px;" "}" ); + connect(slider, &QSlider::valueChanged, this, [&](int v) { emit(setCenter(v)); }); pageHint = new QLabel("" + tr("Page : ") + "",this); @@ -85,19 +86,11 @@ GoToFlowToolBar::GoToFlowToolBar(QWidget * parent) naviLayout->addWidget(slider); naviLayout->addWidget(goToButton); - switchLayout(); + updateOptions(); setFixedHeight(50); } -void GoToFlowToolBar::switchLayout() -{ - if (Configuration::getConfiguration().getQuickNaviMode()) - setCurrentIndex(1); - else - setCurrentIndex(0); -} - void GoToFlowToolBar::paintEvent(QPaintEvent *) { QPainter painter(this); @@ -130,5 +123,15 @@ void GoToFlowToolBar::goTo() void GoToFlowToolBar::centerSlide() { if(edit->text().toInt()!=0) - emit(setCenter(edit->text().toInt()-1)); + emit(setCenter(edit->text().toInt()-1)); +} + +void GoToFlowToolBar::updateOptions() +{ + if (Configuration::getConfiguration().getQuickNaviMode()) + setCurrentIndex(1); + else + setCurrentIndex(0); + + slider->setInvertedAppearance(Configuration::getConfiguration().getDoubleMangaPage()); } diff --git a/YACReader/goto_flow_toolbar.h b/YACReader/goto_flow_toolbar.h index 803026c0..417a466a 100644 --- a/YACReader/goto_flow_toolbar.h +++ b/YACReader/goto_flow_toolbar.h @@ -25,12 +25,13 @@ class GoToFlowToolBar : public QStackedWidget public: GoToFlowToolBar(QWidget * parent = 0); - void switchLayout(); + public slots: void setPage(int pageNumber); void setTop(int numPages); void goTo(); void centerSlide(); + void updateOptions(); signals: void setCenter(unsigned int); void goTo(unsigned int); diff --git a/YACReader/goto_flow_widget.cpp b/YACReader/goto_flow_widget.cpp index 6714a733..acb31468 100644 --- a/YACReader/goto_flow_widget.cpp +++ b/YACReader/goto_flow_widget.cpp @@ -54,7 +54,7 @@ void GoToFlowWidget::keyPressEvent(QKeyEvent* event) void GoToFlowWidget::updateConfig(QSettings * settings) { Q_UNUSED(settings) - toolBar->switchLayout(); + toolBar->updateOptions(); } void GoToFlowWidget::updateSize() diff --git a/YACReader/viewer.cpp b/YACReader/viewer.cpp index 0e64f3bf..8fb45728 100644 --- a/YACReader/viewer.cpp +++ b/YACReader/viewer.cpp @@ -962,8 +962,10 @@ void Viewer::doubleMangaPageSwitch() { doubleMangaPage = !doubleMangaPage; render->doubleMangaPageSwitch(); - Configuration::getConfiguration().setDoubleMangaPage(doubleMangaPage); + Configuration &config = Configuration::getConfiguration(); + config.setDoubleMangaPage(doubleMangaPage); goToFlow->setFlowRightToLeft(doubleMangaPage); + goToFlow->updateConfig(config.getSettings()); } void Viewer::resetContent()