Make the new quick navigation go to flow 'manga mode aware'.

This commit is contained in:
Luis Ángel San Martín
2016-10-30 11:53:27 +01:00
parent 74812fe705
commit 9b3cc92cb0
6 changed files with 26 additions and 14 deletions

View File

@ -15,6 +15,11 @@ Configuration::Configuration()
//load("/YACReader.conf"); //load("/YACReader.conf");
} }
QSettings *Configuration::getSettings()
{
return settings;
}
/*Configuration::Configuration(const Configuration & conf) /*Configuration::Configuration(const Configuration & conf)
{ {
//nothing //nothing

View File

@ -51,6 +51,7 @@ using namespace YACReader;
static Configuration configuration; static Configuration configuration;
return configuration; return configuration;
}; };
QSettings *getSettings();
void load(QSettings * settings); void load(QSettings * settings);
QString getDefaultPath() { return settings->value(PATH).toString(); } QString getDefaultPath() { return settings->value(PATH).toString(); }
void setDefaultPath(QString defaultPath){settings->setValue(PATH,defaultPath);} void setDefaultPath(QString defaultPath){settings->setValue(PATH,defaultPath);}

View File

@ -32,6 +32,7 @@ GoToFlowToolBar::GoToFlowToolBar(QWidget * parent)
" border-radius: 1px;" " border-radius: 1px;"
"}" "}"
); );
connect(slider, &QSlider::valueChanged, this, [&](int v) { emit(setCenter(v)); }); connect(slider, &QSlider::valueChanged, this, [&](int v) { emit(setCenter(v)); });
pageHint = new QLabel("<b>" + tr("Page : ") + "</b>",this); pageHint = new QLabel("<b>" + tr("Page : ") + "</b>",this);
@ -85,19 +86,11 @@ GoToFlowToolBar::GoToFlowToolBar(QWidget * parent)
naviLayout->addWidget(slider); naviLayout->addWidget(slider);
naviLayout->addWidget(goToButton); naviLayout->addWidget(goToButton);
switchLayout(); updateOptions();
setFixedHeight(50); setFixedHeight(50);
} }
void GoToFlowToolBar::switchLayout()
{
if (Configuration::getConfiguration().getQuickNaviMode())
setCurrentIndex(1);
else
setCurrentIndex(0);
}
void GoToFlowToolBar::paintEvent(QPaintEvent *) void GoToFlowToolBar::paintEvent(QPaintEvent *)
{ {
QPainter painter(this); QPainter painter(this);
@ -132,3 +125,13 @@ void GoToFlowToolBar::centerSlide()
if(edit->text().toInt()!=0) 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());
}

View File

@ -25,12 +25,13 @@ class GoToFlowToolBar : public QStackedWidget
public: public:
GoToFlowToolBar(QWidget * parent = 0); GoToFlowToolBar(QWidget * parent = 0);
void switchLayout();
public slots: public slots:
void setPage(int pageNumber); void setPage(int pageNumber);
void setTop(int numPages); void setTop(int numPages);
void goTo(); void goTo();
void centerSlide(); void centerSlide();
void updateOptions();
signals: signals:
void setCenter(unsigned int); void setCenter(unsigned int);
void goTo(unsigned int); void goTo(unsigned int);

View File

@ -54,7 +54,7 @@ void GoToFlowWidget::keyPressEvent(QKeyEvent* event)
void GoToFlowWidget::updateConfig(QSettings * settings) void GoToFlowWidget::updateConfig(QSettings * settings)
{ {
Q_UNUSED(settings) Q_UNUSED(settings)
toolBar->switchLayout(); toolBar->updateOptions();
} }
void GoToFlowWidget::updateSize() void GoToFlowWidget::updateSize()

View File

@ -962,8 +962,10 @@ void Viewer::doubleMangaPageSwitch()
{ {
doubleMangaPage = !doubleMangaPage; doubleMangaPage = !doubleMangaPage;
render->doubleMangaPageSwitch(); render->doubleMangaPageSwitch();
Configuration::getConfiguration().setDoubleMangaPage(doubleMangaPage); Configuration &config = Configuration::getConfiguration();
config.setDoubleMangaPage(doubleMangaPage);
goToFlow->setFlowRightToLeft(doubleMangaPage); goToFlow->setFlowRightToLeft(doubleMangaPage);
goToFlow->updateConfig(config.getSettings());
} }
void Viewer::resetContent() void Viewer::resetContent()