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

@ -12,7 +12,12 @@
Configuration::Configuration()
{
//read configuration
//load("/YACReader.conf");
//load("/YACReader.conf");
}
QSettings *Configuration::getSettings()
{
return settings;
}
/*Configuration::Configuration(const Configuration & conf)

View File

@ -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);}

View File

@ -32,6 +32,7 @@ GoToFlowToolBar::GoToFlowToolBar(QWidget * parent)
" border-radius: 1px;"
"}"
);
connect(slider, &QSlider::valueChanged, this, [&](int v) { emit(setCenter(v)); });
pageHint = new QLabel("<b>" + tr("Page : ") + "</b>",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());
}

View File

@ -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);

View File

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

View File

@ -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()