[Marble-commits] KDE/kdeedu/marble/src
Andrew Manson
g.real.ate at gmail.com
Sun Jul 12 20:55:19 CEST 2009
SVN commit 995442 by mansona:
Cleaning up the Marble Widget disableInput and enableInput functions
M +18 -28 lib/MarbleWidget.cpp
M +1 -4 lib/MarbleWidget.h
M +1 -1 lib/SunLocator.cpp
M +1 -1 lib/SunLocator.h
M +4 -0 plugins/render/osmannotate/OsmAnnotatePlugin.cpp
--- trunk/KDE/kdeedu/marble/src/lib/MarbleWidget.cpp #995441:995442
@@ -207,7 +207,7 @@
m_logZoom = 0;
m_widget->connect( m_model->sunLocator(), SIGNAL( reenableWidgetInput() ),
- m_widget, SLOT( enableInput() ) );
+ m_widget, SLOT( setInputEnabled( bool ) ) );
m_widget->connect( m_model->sunLocator(), SIGNAL( updateStars() ),
m_widget, SLOT( update() ) );
@@ -231,7 +231,7 @@
// m_enableInputAction->set
m_widget->connect( m_enableInputAction, SIGNAL(toggled(bool)),
- m_widget, SLOT(enableInput(bool)) );
+ m_widget, SLOT( setInputEnabled(bool)) );
m_widget->connect( m_model, SIGNAL( pluginSettingsChanged() ),
m_widget, SIGNAL( pluginSettingsChanged() ) );
@@ -1230,7 +1230,7 @@
qreal lat = sunLocator->getLat();
centerOn( lon, lat );
- disableInput();
+ setInputEnabled( false );
}
SunLocator* MarbleWidget::sunLocator()
@@ -1238,37 +1238,27 @@
return d->m_model->sunLocator();
}
-void MarbleWidget::disableInput( bool in )
+void MarbleWidget::setInputEnabled( bool enabled )
{
- if( in ) {
- disableInput();
- } else {
- enableInput();
+ //if input is set as enabled
+ if ( enabled )
+ {
+ if ( !d->m_inputhandler ) {
+ setInputHandler( new MarbleWidgetDefaultInputHandler );
+ }
+ else {
+ installEventFilter( d->m_inputhandler );
+ }
}
-}
-void MarbleWidget::enableInput( bool in )
-{
- disableInput( !in );
-}
-
-void MarbleWidget::enableInput()
-{
- if ( !d->m_inputhandler ) {
- setInputHandler( new MarbleWidgetDefaultInputHandler );
+ else // input is disabled
+ {
+ qDebug() << "MarbleWidget::disableInput";
+ removeEventFilter( d->m_inputhandler );
+ setCursor( Qt::ArrowCursor );
}
- else {
- installEventFilter( d->m_inputhandler );
- }
}
-void MarbleWidget::disableInput()
-{
- qDebug() << "MarbleWidget::disableInput";
- removeEventFilter( d->m_inputhandler );
- setCursor( Qt::ArrowCursor );
-}
-
void MarbleWidget::setProxy( const QString& proxyHost, const quint16 proxyPort, const QString& user, const QString& password )
{
d->m_proxyHost = proxyHost;
--- trunk/KDE/kdeedu/marble/src/lib/MarbleWidget.h #995441:995442
@@ -572,10 +572,7 @@
void updateSun();
void centerSun();
- void disableInput(bool);
- void enableInput( bool );
- void enableInput();
- void disableInput();
+ void setInputEnabled( bool );
// void repaintMap();
/**
--- trunk/KDE/kdeedu/marble/src/lib/SunLocator.cpp #995441:995442
@@ -272,7 +272,7 @@
updatePosition();
emit centerSun();
} else
- emit reenableWidgetInput();
+ emit enableWidgetInput( true );
}
void SunLocator::setPlanet(Planet *planet)
--- trunk/KDE/kdeedu/marble/src/lib/SunLocator.h #995441:995442
@@ -70,7 +70,7 @@
void updateStars();
void updateSun();
void centerSun();
- void reenableWidgetInput();
+ void enableWidgetInput( bool );
private:
void updatePosition();
--- trunk/KDE/kdeedu/marble/src/plugins/render/osmannotate/OsmAnnotatePlugin.cpp #995441:995442
@@ -112,6 +112,8 @@
widgetInitalised= false;
tmp_lineString = 0;
m_document = 0;
+ m_addPlacemark =0;
+ m_drawPolygon = 0;
}
bool OsmAnnotatePlugin::isInitialized () const
@@ -253,6 +255,7 @@
// deal with adding a placemark
if ( mouseEvent->button() == Qt::LeftButton
+ && m_addPlacemark
&& m_addPlacemark->isChecked() )
{
//Add a placemark on the screen
@@ -278,6 +281,7 @@
// deal with drawing a polygon
if ( mouseEvent->button() == Qt::LeftButton
+ && m_drawPolygon
&& m_drawPolygon->isChecked() )
{
qreal lon, lat;
More information about the Marble-commits
mailing list