Add zoom and fit to page modes to scaling

This commit is contained in:
Felix Kauselmann 2014-11-30 17:37:07 +01:00
parent b8ba1e5b70
commit 5bf074758f
3 changed files with 20 additions and 1 deletions

View File

@ -60,8 +60,12 @@ using namespace YACReader;
void setGotoSlideSize(const QSize & gss) { settings->setValue(GO_TO_FLOW_SIZE,gss);}
float getZoomLevel() { return settings->value(ZOOM_LEVEL).toFloat();}
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);}
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);}
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();}

View File

@ -316,7 +316,13 @@ void Viewer::updateContentSize()
{
if(Configuration::getConfiguration().getAdjustToFullSize())
{
content->resize(currentPage->width(),currentPage->height());
content->resize(currentPage->size());
}
else if(Configuration::getConfiguration().getFitToPage())
{
QSize pagefit=currentPage->size();
pagefit.scale(size(), Qt::KeepAspectRatio);
content->resize(pagefit);
}
else
{
@ -343,6 +349,13 @@ void Viewer::updateContentSize()
}
}
if(Configuration::getConfiguration().getPageZoomLevel())
{
QSize pagesize=content->size();
pagesize.scale(content->width()*Configuration::getConfiguration().getPageZoomLevel(), content->height(), Qt::KeepAspectRatio);
content->resize(pagesize);
}
if(devicePixelRatio()>1)//only in retina display
{
QPixmap page = currentPage->scaled(content->width()*devicePixelRatio(), content->height()*devicePixelRatio(), Qt::KeepAspectRatio, Qt::SmoothTransformation);

View File

@ -14,10 +14,12 @@
#define PATH "PATH"
#define MAG_GLASS_SIZE "MAG_GLASS_SIZE"
#define ZOOM_LEVEL "ZOOM_LEVEL"
#define PAGE_ZOOM_LEVEL "PAGE_ZOOM_LEVEL"
#define SLIDE_SIZE "SLIDE_SIZE"
#define GO_TO_FLOW_SIZE "GO_TO_FLOW_SIZE"
#define FLOW_TYPE_SW "FLOW_TYPE_SW"
#define FIT "FIT"
#define PAGEFIT "PAGEFIT"
#define FLOW_TYPE "FLOW_TYPE"
#define FULLSCREEN "FULLSCREEN"
#define FIT_TO_WIDTH_RATIO "FIT_TO_WIDTH_RATIO"