Add zoom control functions to viewer

This commit is contained in:
Felix Kauselmann 2015-12-02 15:43:31 +01:00
parent acc912a765
commit e188216f50
2 changed files with 44 additions and 0 deletions

View File

@ -372,6 +372,45 @@ void Viewer::updateContentSize()
content->update(); //TODO, it shouldn't be neccesary
}
void Viewer::increaseZoomFactor()
{
zoom += 0.1;
if (zoom > 5)
{
zoom = 5;
}
updateContentSize();
notificationsLabel->setText(QString::number(getZoomFactor()*100)+"%");
notificationsLabel->flash();
}
void Viewer::decreaseZoomFactor()
{
zoom -= 0.1;
if (zoom < 0.1)
zoom = 0.1;
updateContentSize();
notificationsLabel->setText(QString::number(getZoomFactor()*100)+"%");
notificationsLabel->flash();
}
qreal Viewer::getZoomFactor()
{
//this function is a placeholder for future refactoring work
return zoom;
}
void Viewer::setZoomFactor(qreal z)
{
//this function is mostly used to reset the zoom after a fitmode switch
if (z > 5)
zoom = 5;
else if (z < 0.1)
zoom = 0.1;
else
zoom = z;
// updateContentSize()
}
void Viewer::updateVerticalScrollBar()
{
if(direction > 0)

View File

@ -37,6 +37,11 @@ class NotificationsLabelWidget;
public:
bool fullscreen; //TODO, change by the right use of windowState();
public slots:
void increaseZoomFactor();
void decreaseZoomFactor();
void setZoomFactor(qreal);
qreal getZoomFactor();
void prepareForOpening();
void open(QString pathFile, int atPage = -1);
void open(QString pathFile, const ComicDB & comic);