Hello,

Our Student at Google Code-In, Furkan, already completed this task:
http://www.google-melange.com/gci/task/show/google/gci2010/kde/t129157984557

It adds the current zoom percentage of the website to the zoombar.
I attached his patch (which can also be found in the link above).

To me code looks good, and (pretty important:) it also works, I’d just need the 
OK of one of you, so that I can approve his work :-)

Greetings
diff --git a/src/zoombar.cpp b/src/zoombar.cpp
index 55006b4..4c0eff9 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))
@@ -71,6 +70,7 @@ ZoomBar::ZoomBar(QWidget *parent)
     // label
     QLabel *label = new QLabel(i18n("Zoom:"));
     layout->addWidget(label);
+    percentage = new QLabel(i18nc("start percentage", "100%"),this);//Show the current zoom percentage of the page
 
     m_zoomSlider->setTracking(true);
     m_zoomSlider->setRange(1, 19);      // divide by 10 to obtain a qreal for zoomFactor()
@@ -85,9 +85,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(percentage,5);
 
     layout->addStretch();
 
@@ -131,6 +132,7 @@ void ZoomBar::show()
     {
         emit visibilityChanged(true);
         QWidget::show();
+	m_zoomSlider->setValue(Application::instance()->mainWindow()->currentTab()->view()->zoomFactor()*10);
     }
 }
 
@@ -176,6 +178,7 @@ void ZoomBar::updateSlider(int webview)
 void ZoomBar::setValue(int value)
 {
     m_zoomSlider->setValue(value);
+    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 d45aab1..c0760a4 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 *percentage;
 };
 
 #endif
_______________________________________________
rekonq mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/rekonq

Reply via email to