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

List:       kde-commits
Subject:    branches/KDE/4.2/kdeedu/marble/src/lib
From:       Torsten Rahn <tackat () kde ! org>
Date:       2009-02-07 17:43:20
Message-ID: 1234028600.860338.5957.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 922866 by rahn:


 - Fixing up MarbleWidget::m_popupmenu a bit (needs further work)
 - Fixing functional regression of the CenterSun feature



 M  +22 -10    MarbleWidget.cpp  


--- branches/KDE/4.2/kdeedu/marble/src/lib/MarbleWidget.cpp #922865:922866
@@ -210,19 +210,31 @@
 
     m_widget->connect( m_physics, SIGNAL( valueChanged( qreal ) ),
                         m_widget, SLOT( updateAnimation( qreal ) ) );
+
+    m_widget->connect( m_model->sunLocator(), SIGNAL( centerSun() ),
+                        m_widget, SLOT( centerSun() ) );
 }
 
 void MarbleWidgetPrivate::_q_initGui() {
-    m_popupmenu    = new MarbleWidgetPopupMenu( m_widget, m_model );
-
     // Handle mouse and keyboard input.
-    m_inputhandler = 0;
     m_widget->setInputHandler( new MarbleWidgetDefaultInputHandler );
     m_widget->setMouseTracking( true );
 
     // The interface to the measure tool consists of a RMB popup menu
     // and some signals.
     MeasureTool  *measureTool = m_map->measureTool();
+
+    // Connect the inputHandler and the measure tool to the popup menu
+    // FIXME: This needs REFACTORING, as a custom input handler is will likely want to have 
+    // a different popup menu.
+    if ( !m_popupmenu ) {
+        m_popupmenu    = new MarbleWidgetPopupMenu( m_widget, m_model );
+    }
+    m_widget->connect( m_inputhandler, SIGNAL( lmbRequest( int, int ) ),
+                       m_popupmenu,    SLOT( showLmbMenu( int, int ) ) );
+    m_widget->connect( m_inputhandler, SIGNAL( rmbRequest( int, int ) ),
+                       m_popupmenu,    SLOT( showRmbMenu( int, int ) ) );
+
     m_widget->connect( m_popupmenu, SIGNAL( addMeasurePoint( qreal, qreal ) ),
                        measureTool, SLOT( addMeasurePoint( qreal, qreal ) ) );
     m_widget->connect( m_popupmenu, SIGNAL( removeMeasurePoints() ),
@@ -253,10 +265,7 @@
     if ( d->m_inputhandler ) {
         d->m_inputhandler->init( this );
         installEventFilter( d->m_inputhandler );
-        connect( d->m_inputhandler, SIGNAL( lmbRequest( int, int ) ),
-                 d->m_popupmenu,    SLOT( showLmbMenu( int, int ) ) );
-        connect( d->m_inputhandler, SIGNAL( rmbRequest( int, int ) ),
-                 d->m_popupmenu,    SLOT( showRmbMenu( int, int ) ) );
+
         connect( d->m_inputhandler, SIGNAL( mouseClickScreenPosition( int, int) ),
                  this,              SLOT( notifyMouseClick( int, int ) ) );
 
@@ -1272,7 +1281,6 @@
     qreal  lat = sunLocator->getLat();
     centerOn( lon, lat );
 
-    qDebug() << "centering on Sun at" << lat << lon;
     disableInput();
 }
 
@@ -1283,14 +1291,18 @@
 
 void MarbleWidget::enableInput()
 {
-    if ( !d->m_inputhandler ) 
+    if ( !d->m_inputhandler ) {
         setInputHandler( new MarbleWidgetDefaultInputHandler );
+    }
+    else {
+        installEventFilter( d->m_inputhandler );
+    }
 }
 
 void MarbleWidget::disableInput()
 {
     qDebug() << "MarbleWidget::disableInput";
-    setInputHandler( 0 );
+    removeEventFilter( d->m_inputhandler );
     setCursor( Qt::ArrowCursor );
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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