mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
Add zoom control functions to viewer
This commit is contained in:
parent
acc912a765
commit
e188216f50
@ -372,6 +372,45 @@ void Viewer::updateContentSize()
|
|||||||
content->update(); //TODO, it shouldn't be neccesary
|
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()
|
void Viewer::updateVerticalScrollBar()
|
||||||
{
|
{
|
||||||
if(direction > 0)
|
if(direction > 0)
|
||||||
|
@ -37,6 +37,11 @@ class NotificationsLabelWidget;
|
|||||||
public:
|
public:
|
||||||
bool fullscreen; //TODO, change by the right use of windowState();
|
bool fullscreen; //TODO, change by the right use of windowState();
|
||||||
public slots:
|
public slots:
|
||||||
|
void increaseZoomFactor();
|
||||||
|
void decreaseZoomFactor();
|
||||||
|
void setZoomFactor(qreal);
|
||||||
|
qreal getZoomFactor();
|
||||||
|
|
||||||
void prepareForOpening();
|
void prepareForOpening();
|
||||||
void open(QString pathFile, int atPage = -1);
|
void open(QString pathFile, int atPage = -1);
|
||||||
void open(QString pathFile, const ComicDB & comic);
|
void open(QString pathFile, const ComicDB & comic);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user