mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
undo misplaced changeset
This commit is contained in:
parent
ced8b4e38e
commit
ceb4e81e3c
@ -33,8 +33,8 @@ void Configuration::load(QSettings * settings)
|
||||
settings->setValue(MAG_GLASS_SIZE,QSize(350,175));
|
||||
if(!settings->contains(ZOOM_LEVEL))
|
||||
settings->setValue(MAG_GLASS_SIZE,QSize(350,175));
|
||||
//if(!settings->contains(FIT))
|
||||
// settings->setValue(FIT,false);
|
||||
if(!settings->contains(FIT))
|
||||
settings->setValue(FIT,false);
|
||||
if(!settings->contains(FLOW_TYPE))
|
||||
settings->setValue(FLOW_TYPE,0);
|
||||
if(!settings->contains(FULLSCREEN))
|
||||
@ -47,8 +47,8 @@ void Configuration::load(QSettings * settings)
|
||||
settings->setValue(MAXIMIZED,false);
|
||||
if(!settings->contains(DOUBLE_PAGE))
|
||||
settings->setValue(DOUBLE_PAGE,false);
|
||||
//if(!settings->contains(ADJUST_TO_FULL_SIZE))
|
||||
// settings->setValue(ADJUST_TO_FULL_SIZE,false);
|
||||
if(!settings->contains(ADJUST_TO_FULL_SIZE))
|
||||
settings->setValue(ADJUST_TO_FULL_SIZE,false);
|
||||
if(!settings->contains(BACKGROUND_COLOR))
|
||||
settings->setValue(BACKGROUND_COLOR,QColor(40,40,40));
|
||||
if(!settings->contains(ALWAYS_ON_TOP))
|
||||
|
@ -62,19 +62,10 @@ using namespace YACReader;
|
||||
void setZoomLevel(float zl) { settings->setValue(ZOOM_LEVEL,zl);}
|
||||
float getPageZoomLevel() { return settings->value(PAGE_ZOOM_LEVEL).toFloat();}
|
||||
void setPageZoomLevel(float zl) { settings->setValue(PAGE_ZOOM_LEVEL,zl);}
|
||||
/*
|
||||
//Old fitting modes
|
||||
bool getAdjustToWidth() {return settings->value(FIT).toBool();}
|
||||
void setAdjustToWidth(bool atw=true) {settings->setValue(FIT,atw);}
|
||||
bool getFitToPage() {return settings->value(PAGEFIT).toBool();}
|
||||
void setFitToPage(bool b=true) {settings->setValue(PAGEFIT,b);}
|
||||
bool getAdjustToFullSize(){return settings->value(ADJUST_TO_FULL_SIZE).toBool();}
|
||||
void setAdjustToFullSize(bool b){settings->setValue(ADJUST_TO_FULL_SIZE,b);}
|
||||
*/
|
||||
|
||||
QString getFitMode() { return settings->value(FITMODE).toString(); }
|
||||
void setFitMode ( QString fitMode ){settings->setValue(FITMODE, fitMode);}
|
||||
|
||||
FlowType getFlowType(){return (FlowType)settings->value(FLOW_TYPE_SW).toInt();}
|
||||
void setFlowType(FlowType type){settings->setValue(FLOW_TYPE_SW,type);}
|
||||
bool getFullScreen(){return settings->value(FULLSCREEN).toBool();}
|
||||
@ -91,6 +82,8 @@ using namespace YACReader;
|
||||
void setDoublePage(bool b){settings->setValue(DOUBLE_PAGE,b);}
|
||||
bool getDoubleMangaPage(){return settings->value(DOUBLE_MANGA_PAGE).toBool();}
|
||||
void setDoubleMangaPage(bool b){settings->setValue(DOUBLE_MANGA_PAGE,b);}
|
||||
bool getAdjustToFullSize(){return settings->value(ADJUST_TO_FULL_SIZE).toBool();}
|
||||
void setAdjustToFullSize(bool b){settings->setValue(ADJUST_TO_FULL_SIZE,b);}
|
||||
QColor getBackgroundColor(){return settings->value(BACKGROUND_COLOR).value<QColor>();}
|
||||
void setBackgroundColor(const QColor& color){settings->value(BACKGROUND_COLOR,color);}
|
||||
bool getAlwaysOnTop(){return settings->value(ALWAYS_ON_TOP).toBool();}
|
||||
|
@ -987,30 +987,21 @@ void MainWindowViewer::showToolBars()
|
||||
}
|
||||
void MainWindowViewer::fitToWidth()
|
||||
{
|
||||
Configuration::getConfiguration().setFitMode("to_width");
|
||||
Configuration::getConfiguration().setPageZoomLevel(1);
|
||||
viewer->updatePage();
|
||||
/*
|
||||
Configuration & conf = Configuration::getConfiguration();
|
||||
if(!conf.getAdjustToWidth())
|
||||
{
|
||||
conf.setAdjustToWidth(true);
|
||||
viewer->updatePage();
|
||||
}
|
||||
*/
|
||||
}
|
||||
void MainWindowViewer::fitToHeight()
|
||||
{
|
||||
Configuration::getConfiguration().setFitMode("to_height");
|
||||
Configuration::getConfiguration().setPageZoomLevel(1);
|
||||
viewer->updatePage();
|
||||
/*
|
||||
Configuration & conf = Configuration::getConfiguration();
|
||||
if(conf.getAdjustToWidth())
|
||||
{
|
||||
conf.setAdjustToWidth(false);
|
||||
viewer->updatePage();
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindowViewer::checkNewVersion()
|
||||
@ -1214,9 +1205,8 @@ void MainWindowViewer::toggleFitToWidthSlider()
|
||||
|
||||
void MainWindowViewer::changeFit()
|
||||
{
|
||||
//TODO: this is depreceated
|
||||
Configuration & conf = Configuration::getConfiguration();
|
||||
//conf.setAdjustToWidth(!conf.getAdjustToWidth());
|
||||
conf.setAdjustToWidth(!conf.getAdjustToWidth());
|
||||
viewer->updatePage();
|
||||
}
|
||||
|
||||
@ -1425,17 +1415,13 @@ void MainWindowViewer::alwaysOnTopSwitch()
|
||||
|
||||
void MainWindowViewer::adjustToFullSizeSwitch()
|
||||
{
|
||||
//Configuration::getConfiguration().setAdjustToFullSize(!Configuration::getConfiguration().getAdjustToFullSize());
|
||||
Configuration::getConfiguration().setFitMode("full_size");
|
||||
Configuration::getConfiguration().setPageZoomLevel(1);
|
||||
Configuration::getConfiguration().setAdjustToFullSize(!Configuration::getConfiguration().getAdjustToFullSize());
|
||||
viewer->updatePage();
|
||||
}
|
||||
|
||||
void MainWindowViewer::fitToPageSwitch()
|
||||
{
|
||||
//Configuration::getConfiguration().setFitToPage(!Configuration::getConfiguration().getFitToPage());
|
||||
Configuration::getConfiguration().setFitMode("full_page");
|
||||
Configuration::getConfiguration().setPageZoomLevel(1);
|
||||
Configuration::getConfiguration().setFitToPage(!Configuration::getConfiguration().getFitToPage());
|
||||
viewer->updatePage();
|
||||
}
|
||||
|
||||
|
@ -328,22 +328,21 @@ void Viewer::updateContentSize()
|
||||
//there is an image to resize
|
||||
if(currentPage !=0 && !currentPage->isNull())
|
||||
{
|
||||
if(!Configuration::getConfiguration().getFitMode().isNull())
|
||||
if(Configuration::getConfiguration().getAdjustToFullSize())
|
||||
{
|
||||
content->resize(currentPage->size());
|
||||
}
|
||||
else if(Configuration::getConfiguration().getFitToPage())
|
||||
{
|
||||
QSize pagefit=currentPage->size();
|
||||
pagefit.scale(size(), Qt::KeepAspectRatio);
|
||||
content->resize(pagefit);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(Configuration::getConfiguration().getFitMode()=="full_size")
|
||||
{
|
||||
content->resize(currentPage->size());
|
||||
}
|
||||
if(Configuration::getConfiguration().getFitMode()=="full_page")
|
||||
{
|
||||
QSize pagefit=currentPage->size();
|
||||
pagefit.scale(size(), Qt::KeepAspectRatio);
|
||||
content->resize(pagefit);
|
||||
}
|
||||
|
||||
//float aspectRatio = (float)currentPage->width()/currentPage->height();
|
||||
//Fit to width
|
||||
if(Configuration::getConfiguration().getFitMode()=="to_width")
|
||||
if(Configuration::getConfiguration().getAdjustToWidth())
|
||||
{
|
||||
QSize pagefit=currentPage->size();
|
||||
pagefit.scale(width(), 0, Qt::KeepAspectRatioByExpanding);
|
||||
@ -370,7 +369,7 @@ void Viewer::updateContentSize()
|
||||
else
|
||||
content->resize(static_cast<int>(height()*aspectRatio),height());
|
||||
}*/
|
||||
if(Configuration::getConfiguration().getFitMode()=="to_height")
|
||||
else
|
||||
{
|
||||
QSize pagefit=currentPage->size();
|
||||
pagefit.scale(0, height(), Qt::KeepAspectRatioByExpanding);
|
||||
@ -388,6 +387,7 @@ void Viewer::updateContentSize()
|
||||
|
||||
if(devicePixelRatio()>1)//only in retina display
|
||||
{
|
||||
qDebug() << "Retina Display detected" << "devicePixelRatio:" << devicePixelRatio();
|
||||
QPixmap page = currentPage->scaled(content->width()*devicePixelRatio(), content->height()*devicePixelRatio(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
page.setDevicePixelRatio(devicePixelRatio());
|
||||
content->setPixmap(page);
|
||||
@ -919,8 +919,7 @@ void Viewer::mouseReleaseEvent ( QMouseEvent * event )
|
||||
|
||||
void Viewer::updateFitToWidthRatio(float ratio)
|
||||
{
|
||||
//Configuration::getConfiguration().setAdjustToWidth(true);
|
||||
Configuration::getConfiguration().setFitMode("to_width");
|
||||
Configuration::getConfiguration().setAdjustToWidth(true);
|
||||
adjustToWidthRatio = ratio;
|
||||
updateContentSize();
|
||||
}
|
||||
|
@ -21,7 +21,6 @@
|
||||
#define FLOW_TYPE_SW "FLOW_TYPE_SW"
|
||||
#define FIT "FIT"
|
||||
#define PAGEFIT "PAGEFIT"
|
||||
#define FITMODE "FITMODE"
|
||||
#define FLOW_TYPE "FLOW_TYPE"
|
||||
#define FULLSCREEN "FULLSCREEN"
|
||||
#define FIT_TO_WIDTH_RATIO "FIT_TO_WIDTH_RATIO"
|
||||
|
Loading…
x
Reference in New Issue
Block a user