summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/zoombar.cpp9
-rw-r--r--src/zoombar.h2
2 files changed, 9 insertions, 2 deletions
diff --git a/src/zoombar.cpp b/src/zoombar.cpp
index 55006b48..a895466a 100644
--- a/src/zoombar.cpp
+++ b/src/zoombar.cpp
@@ -47,7 +47,6 @@
#include <QtGui/QSlider>
#include <QtGui/QToolButton>
-
ZoomBar::ZoomBar(QWidget *parent)
: QWidget(parent)
,m_zoomIn(new QToolButton(this))
@@ -72,6 +71,9 @@ ZoomBar::ZoomBar(QWidget *parent)
QLabel *label = new QLabel(i18n("Zoom:"));
layout->addWidget(label);
+ //Show the current zoom percentage of the page
+ m_percentage = new QLabel(i18nc("percentage of the website zoom", "100%"), this);
+
m_zoomSlider->setTracking(true);
m_zoomSlider->setRange(1, 19); // divide by 10 to obtain a qreal for zoomFactor()
m_zoomSlider->setValue(10);
@@ -85,9 +87,10 @@ ZoomBar::ZoomBar(QWidget *parent)
// layout->setSpacing(0);
// layout->setMargin(0);
layout->addWidget(m_zoomOut);
- layout->addWidget(m_zoomSlider);
+ layout->addWidget(m_zoomSlider, 8);
layout->addWidget(m_zoomIn);
layout->addWidget(m_zoomNormal);
+ layout->addWidget(m_percentage, 5);
layout->addStretch();
@@ -131,6 +134,7 @@ void ZoomBar::show()
{
emit visibilityChanged(true);
QWidget::show();
+ m_zoomSlider->setValue(Application::instance()->mainWindow()->currentTab()->view()->zoomFactor()*10);
}
}
@@ -176,6 +180,7 @@ void ZoomBar::updateSlider(int webview)
void ZoomBar::setValue(int value)
{
m_zoomSlider->setValue(value);
+ m_percentage->setText(i18nc("percentage of the website zoom", "%1%", QString::number(value*10)));
// Don't allox max +1 values
Application::instance()->mainWindow()->currentTab()->view()->setZoomFactor(QVariant(m_zoomSlider->value()).toReal() / 10);
}
diff --git a/src/zoombar.h b/src/zoombar.h
index d45aab19..533946f8 100644
--- a/src/zoombar.h
+++ b/src/zoombar.h
@@ -34,6 +34,7 @@
// Qt Includes
#include <QtGui/QWidget>
+#include <QLabel>
// Forward Declarations
class MainWindow;
@@ -70,6 +71,7 @@ private:
QToolButton *m_zoomOut;
QToolButton *m_zoomNormal;
QSlider *m_zoomSlider;
+ QLabel *m_percentage;
};
#endif