mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
Add quick navigation mode
This commit is contained in:
parent
3c01f4ee7d
commit
c8102dded5
@ -49,6 +49,8 @@ void Configuration::load(QSettings * settings)
|
|||||||
settings->setValue(ALWAYS_ON_TOP,false);
|
settings->setValue(ALWAYS_ON_TOP,false);
|
||||||
if(!settings->contains(SHOW_TOOLBARS))
|
if(!settings->contains(SHOW_TOOLBARS))
|
||||||
settings->setValue(SHOW_TOOLBARS, true);
|
settings->setValue(SHOW_TOOLBARS, true);
|
||||||
|
if(!settings->contains(QUICK_NAVI_MODE))
|
||||||
|
settings->setValue(QUICK_NAVI_MODE, true);
|
||||||
//old fit stuff
|
//old fit stuff
|
||||||
/*if(!settings->contains(FIT))
|
/*if(!settings->contains(FIT))
|
||||||
settings->setValue(FIT,false);
|
settings->setValue(FIT,false);
|
||||||
|
@ -108,6 +108,7 @@ using namespace YACReader;
|
|||||||
void setLastVersionCheck(const QDate & date){ settings->setValue(LAST_VERSION_CHECK,date);}
|
void setLastVersionCheck(const QDate & date){ settings->setValue(LAST_VERSION_CHECK,date);}
|
||||||
int getNumDaysBetweenVersionChecks() {return settings->value(NUM_DAYS_BETWEEN_VERSION_CHECKS,1).toInt();}
|
int getNumDaysBetweenVersionChecks() {return settings->value(NUM_DAYS_BETWEEN_VERSION_CHECKS,1).toInt();}
|
||||||
void setNumDaysBetweenVersionChecks(int days) {return settings->setValue(NUM_DAYS_BETWEEN_VERSION_CHECKS,days);}
|
void setNumDaysBetweenVersionChecks(int days) {return settings->setValue(NUM_DAYS_BETWEEN_VERSION_CHECKS,days);}
|
||||||
|
bool getQuickNaviMode(){return settings->value(QUICK_NAVI_MODE).toBool();}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -214,16 +214,13 @@ void GoToFlow::setFlowType(FlowType flowType)
|
|||||||
flow->setFlowType(flowType);
|
flow->setFlowType(flowType);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GoToFlow::updateSize() //TODO : fix. it doesn't work.
|
|
||||||
{
|
|
||||||
imageSize = Configuration::getConfiguration().getGotoSlideSize();
|
|
||||||
flow->setSlideSize(imageSize);
|
|
||||||
resize(static_cast<int>(5*imageSize.width()),static_cast<int>(imageSize.height()*1.7));
|
|
||||||
}
|
|
||||||
|
|
||||||
void GoToFlow::updateConfig(QSettings * settings)
|
void GoToFlow::updateConfig(QSettings * settings)
|
||||||
{
|
{
|
||||||
Q_UNUSED(settings)
|
Q_UNUSED(settings)
|
||||||
|
imageSize = Configuration::getConfiguration().getGotoSlideSize();
|
||||||
|
flow->setFlowType(Configuration::getConfiguration().getFlowType());
|
||||||
|
resize(5*imageSize.width(), toolBar->height() + imageSize.height()*1.7);
|
||||||
|
updateSize();
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//SlideInitializer
|
//SlideInitializer
|
||||||
|
@ -61,7 +61,6 @@ private slots:
|
|||||||
void setNumSlides(unsigned int slides);
|
void setNumSlides(unsigned int slides);
|
||||||
void setImageReady(int index,const QByteArray & image);
|
void setImageReady(int index,const QByteArray & image);
|
||||||
void setFlowType(FlowType flowType);
|
void setFlowType(FlowType flowType);
|
||||||
void updateSize();
|
|
||||||
void updateConfig(QSettings * settings);
|
void updateConfig(QSettings * settings);
|
||||||
signals:
|
signals:
|
||||||
void goToPage(unsigned int page);
|
void goToPage(unsigned int page);
|
||||||
|
@ -77,11 +77,6 @@ void GoToFlowGL::setImageReady(int index,const QByteArray & imageData)
|
|||||||
flow->imagesReady[index] = true;
|
flow->imagesReady[index] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GoToFlowGL::updateSize()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void GoToFlowGL::updateConfig(QSettings * settings)
|
void GoToFlowGL::updateConfig(QSettings * settings)
|
||||||
{
|
{
|
||||||
Performance performance = medium;
|
Performance performance = medium;
|
||||||
@ -102,45 +97,45 @@ void GoToFlowGL::updateConfig(QSettings * settings)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
imageSize = Configuration::getConfiguration().getGotoSlideSize();
|
||||||
|
resize(5*imageSize.width(), toolBar->height() + imageSize.height()*1.7);
|
||||||
|
updateSize();
|
||||||
|
|
||||||
flow->setPerformance(performance);
|
flow->setPerformance(performance);
|
||||||
|
|
||||||
switch (settings->value(FLOW_TYPE_GL).toInt())
|
switch (settings->value(FLOW_TYPE_GL).toInt())
|
||||||
{
|
{
|
||||||
case 0:
|
case FlowType::CoverFlowLike:
|
||||||
flow->setPreset(presetYACReaderFlowClassicConfig);
|
flow->setPreset(presetYACReaderFlowClassicConfig);
|
||||||
return;
|
break;
|
||||||
case 1:
|
case FlowType::Strip:
|
||||||
flow->setPreset(presetYACReaderFlowStripeConfig);
|
flow->setPreset(presetYACReaderFlowStripeConfig);
|
||||||
return;
|
break;
|
||||||
case 2:
|
case FlowType::StripOverlapped:
|
||||||
flow->setPreset(presetYACReaderFlowOverlappedStripeConfig);
|
flow->setPreset(presetYACReaderFlowOverlappedStripeConfig);
|
||||||
return;
|
break;
|
||||||
case 3:
|
case FlowType::Modern:
|
||||||
flow->setPreset(defaultYACReaderFlowConfig);
|
flow->setPreset(defaultYACReaderFlowConfig);
|
||||||
return;
|
break;
|
||||||
case 4:
|
case FlowType::Roulette:
|
||||||
flow->setPreset(pressetYACReaderFlowDownConfig);
|
flow->setPreset(pressetYACReaderFlowDownConfig);
|
||||||
return;
|
break;
|
||||||
|
case FlowType::Custom:
|
||||||
|
flow->setCF_RX(settings->value(X_ROTATION).toInt());
|
||||||
|
flow->setCF_Y(settings->value(Y_POSITION).toInt());
|
||||||
|
flow->setX_Distance(settings->value(COVER_DISTANCE).toInt());
|
||||||
|
flow->setCenter_Distance(settings->value(CENTRAL_DISTANCE).toInt());
|
||||||
|
flow->setCF_Z(settings->value(ZOOM_LEVEL).toInt());
|
||||||
|
flow->setY_Distance(settings->value(Y_COVER_OFFSET).toInt());
|
||||||
|
flow->setZ_Distance(settings->value(Z_COVER_OFFSET).toInt());
|
||||||
|
flow->setRotation(settings->value(COVER_ROTATION).toInt());
|
||||||
|
flow->setFadeOutDist(settings->value(FADE_OUT_DIST).toInt());
|
||||||
|
flow->setLightStrenght(settings->value(LIGHT_STRENGTH).toInt());
|
||||||
|
flow->setMaxAngle(settings->value(MAX_ANGLE).toInt());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
if (Configuration::getConfiguration().getQuickNaviMode())
|
||||||
|
flow->setFadeOutDist(20);
|
||||||
//custom config
|
|
||||||
|
|
||||||
flow->setCF_RX(settings->value(X_ROTATION).toInt());
|
|
||||||
flow->setCF_Y(settings->value(Y_POSITION).toInt());
|
|
||||||
flow->setX_Distance(settings->value(COVER_DISTANCE).toInt());
|
|
||||||
flow->setCenter_Distance(settings->value(CENTRAL_DISTANCE).toInt());
|
|
||||||
flow->setCF_Z(settings->value(ZOOM_LEVEL).toInt());
|
|
||||||
flow->setY_Distance(settings->value(Y_COVER_OFFSET).toInt());
|
|
||||||
flow->setZ_Distance(settings->value(Z_COVER_OFFSET).toInt());
|
|
||||||
flow->setRotation(settings->value(COVER_ROTATION).toInt());
|
|
||||||
flow->setFadeOutDist(settings->value(FADE_OUT_DIST).toInt());
|
|
||||||
flow->setLightStrenght(settings->value(LIGHT_STRENGTH).toInt());
|
|
||||||
flow->setMaxAngle(settings->value(MAX_ANGLE).toInt());
|
|
||||||
|
|
||||||
/* flow->setVisibility(settings->value("visibilityDistance").toInt());
|
|
||||||
flow->setLightStrenght(settings->value("lightStrength").toInt())*/;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GoToFlowGL::keyPressEvent(QKeyEvent* event)
|
void GoToFlowGL::keyPressEvent(QKeyEvent* event)
|
||||||
|
@ -23,7 +23,6 @@ public:
|
|||||||
void setFlowType(FlowType flowType);
|
void setFlowType(FlowType flowType);
|
||||||
void setNumSlides(unsigned int slides);
|
void setNumSlides(unsigned int slides);
|
||||||
void setImageReady(int index,const QByteArray & image);
|
void setImageReady(int index,const QByteArray & image);
|
||||||
void updateSize();
|
|
||||||
|
|
||||||
void updateConfig(QSettings * settings);
|
void updateConfig(QSettings * settings);
|
||||||
|
|
||||||
|
@ -6,20 +6,17 @@
|
|||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
|
||||||
#include "goto_flow_toolbar.h"
|
#include "goto_flow_toolbar.h"
|
||||||
|
#include "configuration.h"
|
||||||
|
|
||||||
GoToFlowWidget::GoToFlowWidget(QWidget * parent)
|
GoToFlowWidget::GoToFlowWidget(QWidget * parent)
|
||||||
:QWidget(parent)
|
:QWidget(parent)
|
||||||
{
|
{
|
||||||
mainLayout = new QVBoxLayout;
|
mainLayout = new QVBoxLayout;
|
||||||
|
|
||||||
mainLayout->setMargin(0);
|
mainLayout->setMargin(0);
|
||||||
mainLayout->setSpacing(0);
|
mainLayout->setSpacing(0);
|
||||||
|
|
||||||
toolBar = new GoToFlowToolBar(this);
|
toolBar = new GoToFlowToolBar(this);
|
||||||
|
|
||||||
mainLayout->setMargin(0);
|
|
||||||
mainLayout->setSpacing(0);
|
|
||||||
|
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
|
||||||
//toolBar->installEventFilter(this);
|
//toolBar->installEventFilter(this);
|
||||||
@ -54,6 +51,15 @@ void GoToFlowWidget::keyPressEvent(QKeyEvent* event)
|
|||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GoToFlowWidget::updateSize()
|
||||||
|
{
|
||||||
|
// called by parent in resizeEvent
|
||||||
|
// no need to update width when QuickNaviMode disabled
|
||||||
|
// height is set in updateConfig
|
||||||
|
if (Configuration::getConfiguration().getQuickNaviMode() && parentWidget() != nullptr)
|
||||||
|
resize(parentWidget()->width(),height());
|
||||||
|
}
|
||||||
|
|
||||||
/*bool GoToFlowWidget::eventFilter(QObject * target, QEvent * event)
|
/*bool GoToFlowWidget::eventFilter(QObject * target, QEvent * event)
|
||||||
{
|
{
|
||||||
if(event->type() == QEvent::KeyPress)
|
if(event->type() == QEvent::KeyPress)
|
||||||
|
@ -27,7 +27,7 @@ public slots:
|
|||||||
virtual void setFlowType(FlowType flowType) = 0;
|
virtual void setFlowType(FlowType flowType) = 0;
|
||||||
virtual void setNumSlides(unsigned int slides) = 0;
|
virtual void setNumSlides(unsigned int slides) = 0;
|
||||||
virtual void setImageReady(int index,const QByteArray & image) = 0;
|
virtual void setImageReady(int index,const QByteArray & image) = 0;
|
||||||
virtual void updateSize() = 0;
|
virtual void updateSize();
|
||||||
virtual void updateConfig(QSettings * settings) = 0;
|
virtual void updateConfig(QSettings * settings) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -104,6 +104,8 @@ OptionsDialog::OptionsDialog(QWidget * parent)
|
|||||||
gammaS->setTracking(false);
|
gammaS->setTracking(false);
|
||||||
connect(gammaS,SIGNAL(valueChanged(int)),this,SLOT(gammaChanged(int)));
|
connect(gammaS,SIGNAL(valueChanged(int)),this,SLOT(gammaChanged(int)));
|
||||||
//connect(brightnessS,SIGNAL(valueChanged(int)),this,SIGNAL(changedOptions()));
|
//connect(brightnessS,SIGNAL(valueChanged(int)),this,SIGNAL(changedOptions()));
|
||||||
|
|
||||||
|
quickNavi = new QCheckBox(tr("Quick Navigation Mode"));
|
||||||
|
|
||||||
QHBoxLayout * buttons = new QHBoxLayout();
|
QHBoxLayout * buttons = new QHBoxLayout();
|
||||||
buttons->addStretch();
|
buttons->addStretch();
|
||||||
@ -122,6 +124,7 @@ OptionsDialog::OptionsDialog(QWidget * parent)
|
|||||||
layoutFlow->addWidget(gl);
|
layoutFlow->addWidget(gl);
|
||||||
layoutFlow->addWidget(useGL);
|
layoutFlow->addWidget(useGL);
|
||||||
#endif
|
#endif
|
||||||
|
layoutFlow->addWidget(quickNavi);
|
||||||
layoutFlow->addStretch();
|
layoutFlow->addStretch();
|
||||||
layoutImage->addWidget(new QLabel(tr("Brightness")),0,0);
|
layoutImage->addWidget(new QLabel(tr("Brightness")),0,0);
|
||||||
layoutImage->addWidget(new QLabel(tr("Contrast")),1,0);
|
layoutImage->addWidget(new QLabel(tr("Contrast")),1,0);
|
||||||
@ -191,6 +194,7 @@ void OptionsDialog::saveOptions()
|
|||||||
|
|
||||||
settings->setValue(BACKGROUND_COLOR,colorDialog->currentColor());
|
settings->setValue(BACKGROUND_COLOR,colorDialog->currentColor());
|
||||||
//settings->setValue(FIT_TO_WIDTH_RATIO,fitToWidthRatioS->sliderPosition()/100.0);
|
//settings->setValue(FIT_TO_WIDTH_RATIO,fitToWidthRatioS->sliderPosition()/100.0);
|
||||||
|
settings->setValue(QUICK_NAVI_MODE,quickNavi->isChecked());
|
||||||
|
|
||||||
YACReaderOptionsDialog::saveOptions();
|
YACReaderOptionsDialog::saveOptions();
|
||||||
}
|
}
|
||||||
@ -221,6 +225,8 @@ void OptionsDialog::restoreOptions(QSettings * settings)
|
|||||||
updateColor(settings->value(BACKGROUND_COLOR).value<QColor>());
|
updateColor(settings->value(BACKGROUND_COLOR).value<QColor>());
|
||||||
//fitToWidthRatioS->setSliderPosition(settings->value(FIT_TO_WIDTH_RATIO).toFloat()*100);
|
//fitToWidthRatioS->setSliderPosition(settings->value(FIT_TO_WIDTH_RATIO).toFloat()*100);
|
||||||
|
|
||||||
|
quickNavi->setChecked(settings->value(QUICK_NAVI_MODE).toBool());
|
||||||
|
|
||||||
brightnessS->setValue(settings->value(BRIGHTNESS,0).toInt());
|
brightnessS->setValue(settings->value(BRIGHTNESS,0).toInt());
|
||||||
contrastS->setValue(settings->value(CONTRAST,100).toInt());
|
contrastS->setValue(settings->value(CONTRAST,100).toInt());
|
||||||
gammaS->setValue(settings->value(GAMMA,100).toInt());
|
gammaS->setValue(settings->value(GAMMA,100).toInt());
|
||||||
|
@ -23,6 +23,7 @@ Q_OBJECT
|
|||||||
//QLabel * pathLabel;
|
//QLabel * pathLabel;
|
||||||
QLineEdit * pathEdit;
|
QLineEdit * pathEdit;
|
||||||
QPushButton * pathFindButton;
|
QPushButton * pathFindButton;
|
||||||
|
QCheckBox * quickNavi;
|
||||||
|
|
||||||
QLabel * magGlassSizeLabel;
|
QLabel * magGlassSizeLabel;
|
||||||
|
|
||||||
|
@ -587,7 +587,8 @@ void Viewer::wheelEvent(QWheelEvent * event)
|
|||||||
void Viewer::resizeEvent(QResizeEvent * event)
|
void Viewer::resizeEvent(QResizeEvent * event)
|
||||||
{
|
{
|
||||||
updateContentSize();
|
updateContentSize();
|
||||||
goToFlow->move(QPoint((width()-goToFlow->width())/2,height()-goToFlow->height()));
|
goToFlow->updateSize();
|
||||||
|
goToFlow->move((width()-goToFlow->width())/2,height()-goToFlow->height());
|
||||||
informationLabel->updatePosition();
|
informationLabel->updatePosition();
|
||||||
QScrollArea::resizeEvent(event);
|
QScrollArea::resizeEvent(event);
|
||||||
}
|
}
|
||||||
@ -865,7 +866,6 @@ void Viewer::updateOptions()
|
|||||||
goToFlow->setFlowType(Configuration::getConfiguration().getFlowType());
|
goToFlow->setFlowType(Configuration::getConfiguration().getFlowType());
|
||||||
updateBackgroundColor(Configuration::getConfiguration().getBackgroundColor());
|
updateBackgroundColor(Configuration::getConfiguration().getBackgroundColor());
|
||||||
updateContentSize();
|
updateContentSize();
|
||||||
//goToFlow->updateSize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::updateBackgroundColor(const QColor & color)
|
void Viewer::updateBackgroundColor(const QColor & color)
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#define CONTRAST "CONTRAST"
|
#define CONTRAST "CONTRAST"
|
||||||
#define GAMMA "GAMMA"
|
#define GAMMA "GAMMA"
|
||||||
#define SHOW_INFO "SHOW_INFO"
|
#define SHOW_INFO "SHOW_INFO"
|
||||||
|
#define QUICK_NAVI_MODE "QUICK_NAVI_MODE"
|
||||||
|
|
||||||
#define FLOW_TYPE_GL "FLOW_TYPE_GL"
|
#define FLOW_TYPE_GL "FLOW_TYPE_GL"
|
||||||
#define Y_POSITION "Y_POSITION"
|
#define Y_POSITION "Y_POSITION"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user