undo misplaced changeset

This commit is contained in:
Felix Kauselmann
2015-09-08 10:53:01 +02:00
parent ced8b4e38e
commit ceb4e81e3c
5 changed files with 25 additions and 48 deletions

View File

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