[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdeedu/marble
From:       Inge Wallin <inge () lysator ! liu ! se>
Date:       2007-06-02 9:36:10
Message-ID: 1180776970.122508.30367.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 670636 by ingwa:

Show zoom level in the status bar

 M  +10 -0     ChangeLog  
 M  +18 -1     src/KdeMainWindow.cpp  
 M  +10 -0     src/KdeMainWindow.h  
 M  +2 -0      src/katlascontrol.h  
 M  +5 -0      src/lib/MarbleWidget.h  


--- trunk/KDE/kdeedu/marble/ChangeLog #670635:670636
@@ -1,3 +1,13 @@
+2007-06-02  Inge Wallin  <inge@lysator.liu.se>
+
+	Show zoom level in the status bar
+	* src/KdeMainWindow.cpp (showZoom): new slot
+	(createStatusBar): create zoom label
+	(MainWindow): Show initial zoom level
+	* src/katlascontrol.h (marbleWidget): New method
+	* src/lib/MarbleWidget.h (zoom): New method.
+	
+
 2007-05-31  Inge Wallin  <inge@lysator.liu.se>
 
 	Remove worthless APIDOX
--- trunk/KDE/kdeedu/marble/src/KdeMainWindow.cpp #670635:670636
@@ -13,6 +13,7 @@
 
 #include <QClipboard>
 //#include <QtGui/QMessageBox>
+#include <QtGui/QLabel>
 #include <QtGui/QPrintDialog>
 #include <QtGui/QPrinter>
 #include <QtGui/QPainter>
@@ -39,7 +40,11 @@
 
     setupActions();
 
+    // Create the statusbar and populate it with initial data.
     createStatusBar();
+    connect( m_katlascontrol->marbleWidget(), SIGNAL( zoomChanged( int ) ),
+             this,                            SLOT( showZoom( int ) ) );
+    showZoom( m_katlascontrol->marbleWidget()->zoom() );
 }
 
 
@@ -80,9 +85,21 @@
 
 void MainWindow::createStatusBar()
 {
-    statusBar()->showMessage( i18n( "Ready" ) );
+    // This hides the normal statusbar contents until clearMessage() is called.
+    //statusBar()->showMessage( i18n( "Ready" ) );
+
+    m_zoomLabel = new QLabel();
+    statusBar()->addWidget(m_zoomLabel);
 }
 
+
+void MainWindow::showZoom(int zoom)
+{
+    m_zoomLabel->setText( QString( "Zoom: %1" ).arg( zoom, 4 ) );
+}
+
+
+
 void MainWindow::exportMapScreenShot()
 {
     QPixmap  mapPixmap = m_katlascontrol->mapScreenShot();
--- trunk/KDE/kdeedu/marble/src/KdeMainWindow.h #670635:670636
@@ -12,10 +12,14 @@
 #ifndef MAINWINDOW_H
 #define MAINWINDOW_H
  
+
 #include <KXmlGuiWindow>
 #include <KAction>
 
 #include "katlascontrol.h"
+
+class QLabel;
+
  
 class MainWindow : public KXmlGuiWindow
 {
@@ -28,6 +32,9 @@
     void  setupActions();
     void  createStatusBar();
 
+ public slots:
+    void  showZoom(int zoom);
+
  private slots:
     void  exportMapScreenShot();
     void  printMapScreenShot();
@@ -37,6 +44,9 @@
     // All the functionality is provided by this widget.
     KAtlasControl  *m_katlascontrol;
 
+    // Zoom label for the statusbar.
+    QLabel         *m_zoomLabel;
+
     // Actions for the GUI.
     KAction        *m_exportMapAction;
     KAction        *m_printMapAction;
--- trunk/KDE/kdeedu/marble/src/katlascontrol.h #670635:670636
@@ -34,6 +34,8 @@
     KAtlasControl(QWidget *);
     virtual ~KAtlasControl(){};
 
+    MarbleWidget * marbleWidget() const { return m_marbleWidget; }
+
     void zoomIn();
     void zoomOut();
     void moveLeft();
--- trunk/KDE/kdeedu/marble/src/lib/MarbleWidget.h #670635:670636
@@ -90,6 +90,11 @@
     const QRegion  activeRegion();
 
     /**
+     * @brief Return the current zoom level.
+     */
+    int  zoom() const { return m_logzoom; }
+
+    /**
      * @brief Get the earth coordinates corresponding to a pixel in the widget.
      * @param x      the x coordinate of the pixel
      * @param y      the y coordinate of the pixel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic