summaryrefslogtreecommitdiff
path: root/src/webtab/webtab.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-10-16 19:36:37 +0200
committerAndrea Diamantini <adjam7@gmail.com>2012-12-10 02:48:05 +0100
commit3e97b8f91c33f6b49a93c59b0bcb267fe47554f9 (patch)
treeb0eff0bf036b4d9c1b98f0efd066b8ea7619b7c1 /src/webtab/webtab.cpp
parentRe-enable the restore on crash message bar :) (diff)
downloadrekonq-3e97b8f91c33f6b49a93c59b0bcb267fe47554f9.tar.xz
Zoom actionis restored, yeah! :D
Diffstat (limited to 'src/webtab/webtab.cpp')
-rw-r--r--src/webtab/webtab.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/webtab/webtab.cpp b/src/webtab/webtab.cpp
index 549fa285..036f62c0 100644
--- a/src/webtab/webtab.cpp
+++ b/src/webtab/webtab.cpp
@@ -68,6 +68,7 @@ WebTab::WebTab(QWidget *parent)
, m_webView(0)
, m_progress(0)
, m_part(0)
+ , m_zoomFactor(10)
{
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
@@ -350,3 +351,46 @@ void WebTab::printFrame()
delete printDialog;
}
}
+
+
+void WebTab::zoomIn()
+{
+ if (m_zoomFactor == 50)
+ {
+ emit infoToShow(i18n("Max zoom reached: ") + QString::number(m_zoomFactor * 10) + QL1S("%"));
+ return;
+ }
+
+ if (m_zoomFactor >= 20)
+ m_zoomFactor+=5;
+ else
+ m_zoomFactor++;
+
+ m_webView->setZoomFactor(QVariant(m_zoomFactor).toReal() / 10);
+
+ emit infoToShow(i18n("Zooming: ") + QString::number(m_zoomFactor * 10) + QL1S("%"));
+}
+
+
+void WebTab::zoomOut()
+{
+ if (m_zoomFactor == 1)
+ {
+ emit infoToShow(i18n("Min zoom reached: ") + QString::number(m_zoomFactor * 10) + QL1S("%"));
+ return;
+ }
+
+ m_zoomFactor--;
+ m_webView->setZoomFactor(QVariant(m_zoomFactor).toReal() / 10);
+
+ emit infoToShow(i18n("Zooming: ") + QString::number(m_zoomFactor * 10) + QL1S("%"));
+}
+
+
+void WebTab::zoomDefault()
+{
+ m_zoomFactor = 10;
+ m_webView->setZoomFactor(QVariant(m_zoomFactor).toReal() / 10);
+
+ emit infoToShow(i18n("Default zoom: ") + QString::number(m_zoomFactor * 10) + QL1S("%"));
+}