summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPanagiotis Papadopoulos <pano_90@gmx.net>2010-12-08 17:27:44 +0100
committerPanagiotis Papadopoulos <pano_90@gmx.net>2010-12-08 17:27:44 +0100
commit55344f49d92409105d1339536de3172fe6c2b0c6 (patch)
tree83d6fa7992403a301208dddfeeb3e0cff57fe47e /src
parentSVN_SILENT made messages (.desktop file) (diff)
downloadrekonq-55344f49d92409105d1339536de3172fe6c2b0c6.tar.xz
merge first Google Code-In submission:
add the percentage of the website’s zoom to the zoombar http://www.google-melange.com/gci/task/show/google/gci2010/kde/t129157984557 slightly changed the attached patch, (e.g. percentage -> m_percentage) as noted on the mailinglist
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