mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
Make sure we always have a valid fit mode, even if someone or something screws with the config
This commit is contained in:
parent
142c962a9a
commit
84607127fe
@ -320,7 +320,7 @@ void Viewer::updateContentSize()
|
|||||||
{
|
{
|
||||||
content->resize(currentPage->size());
|
content->resize(currentPage->size());
|
||||||
}
|
}
|
||||||
if(Configuration::getConfiguration().getFitMode()=="full_page")
|
else if(Configuration::getConfiguration().getFitMode()=="full_page")
|
||||||
{
|
{
|
||||||
QSize pagefit=currentPage->size();
|
QSize pagefit=currentPage->size();
|
||||||
pagefit.scale(size(), Qt::KeepAspectRatio);
|
pagefit.scale(size(), Qt::KeepAspectRatio);
|
||||||
@ -329,7 +329,7 @@ void Viewer::updateContentSize()
|
|||||||
|
|
||||||
//float aspectRatio = (float)currentPage->width()/currentPage->height();
|
//float aspectRatio = (float)currentPage->width()/currentPage->height();
|
||||||
//Fit to width
|
//Fit to width
|
||||||
if(Configuration::getConfiguration().getFitMode()=="to_width")
|
else if(Configuration::getConfiguration().getFitMode()=="to_width")
|
||||||
{
|
{
|
||||||
QSize pagefit=currentPage->size();
|
QSize pagefit=currentPage->size();
|
||||||
pagefit.scale(width(), 0, Qt::KeepAspectRatioByExpanding);
|
pagefit.scale(width(), 0, Qt::KeepAspectRatioByExpanding);
|
||||||
@ -356,13 +356,21 @@ void Viewer::updateContentSize()
|
|||||||
else
|
else
|
||||||
content->resize(static_cast<int>(height()*aspectRatio),height());
|
content->resize(static_cast<int>(height()*aspectRatio),height());
|
||||||
}*/
|
}*/
|
||||||
if(Configuration::getConfiguration().getFitMode()=="to_height")
|
else if(Configuration::getConfiguration().getFitMode()=="to_height")
|
||||||
{
|
{
|
||||||
QSize pagefit=currentPage->size();
|
QSize pagefit=currentPage->size();
|
||||||
pagefit.scale(0, height(), Qt::KeepAspectRatioByExpanding);
|
pagefit.scale(0, height(), Qt::KeepAspectRatioByExpanding);
|
||||||
content->resize(pagefit);
|
content->resize(pagefit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else //if everything else fails use full_page
|
||||||
|
{
|
||||||
|
Configuration::getConfiguration().setFitMode("full_page");
|
||||||
|
QSize pagefit=currentPage->size();
|
||||||
|
pagefit.scale(size(), Qt::KeepAspectRatio);
|
||||||
|
content->resize(pagefit);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Configuration::getConfiguration().getPageZoomLevel())
|
if(Configuration::getConfiguration().getPageZoomLevel())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user