[Marble-commits] KDE/kdeedu/marble/src
Dennis Nienhüser
earthwings at gentoo.org
Tue Oct 26 21:52:08 CEST 2010
SVN commit 1190059 by nienhueser:
When a position tracking plugin was active at shutdown time, save that information and activate it again at the next start.
BUG: 254800
M +28 -0 QtMainWindow.cpp
M +23 -1 lib/CurrentLocationWidget.cpp
M +1 -1 lib/CurrentLocationWidget.h
M +3 -0 marble.kcfg
M +25 -0 marble_part.cpp
--- trunk/KDE/kdeedu/marble/src/QtMainWindow.cpp #1190058:1190059
@@ -62,6 +62,9 @@
#include "routing/RoutingManager.h"
#include "routing/RoutingProfilesModel.h"
#include "routing/RoutingWidget.h"
+#include "PositionTracking.h"
+#include "PositionProviderPlugin.h"
+#include "PluginManager.h"
// For zoom buttons on Maemo
#ifdef Q_WS_MAEMO_5
@@ -979,6 +982,23 @@
}
settings.endGroup();
+ settings.beginGroup( "Plugins");
+ QString positionProvider = settings.value( "activePositionTrackingPlugin", QString() ).toString();
+ if ( !positionProvider.isEmpty() ) {
+ PositionTracking* tracking = m_controlView->marbleWidget()->model()->positionTracking();
+ PluginManager* pluginManager = m_controlView->marbleWidget()->model()->pluginManager();
+ QList<PositionProviderPlugin*> plugins = pluginManager->createPositionProviderPlugins();
+ foreach( PositionProviderPlugin* plugin, plugins ) {
+ if ( plugin->nameId() == positionProvider ) {
+ plugins.removeOne( plugin );
+ tracking->setPositionProviderPlugin( plugin );
+ break;
+ }
+ qDeleteAll( plugins );
+ }
+ }
+ settings.endGroup();
+
// The config dialog has to read settings.
m_configDialog->readSettings();
@@ -1068,6 +1088,14 @@
}
settings.endGroup();
+ settings.beginGroup( "Plugins");
+ QString positionProvider;
+ PositionTracking* tracking = m_controlView->marbleWidget()->model()->positionTracking();
+ if ( tracking && tracking->positionProviderPlugin() ) {
+ positionProvider = tracking->positionProviderPlugin()->nameId();
+ }
+ settings.setValue( "activePositionTrackingPlugin", positionProvider );
+
// The config dialog has to write settings.
m_configDialog->writeSettings();
--- trunk/KDE/kdeedu/marble/src/lib/CurrentLocationWidget.cpp #1190058:1190059
@@ -49,7 +49,7 @@
void centerOnCurrentLocation();
void updateRecenterComboBox( int centerMode );
void updateAutoZoomCheckBox( bool autoZoom );
-
+ void updateActivePositionProvider( PositionProviderPlugin* );
};
CurrentLocationWidget::CurrentLocationWidget( QWidget *parent, Qt::WindowFlags f )
@@ -95,6 +95,9 @@
disconnect( d->m_widget->model()->positionTracking(),
SIGNAL( gpsLocation( GeoDataCoordinates, qreal ) ),
this, SLOT( receiveGpsCoordinates( GeoDataCoordinates, qreal ) ) );
+ disconnect( d->m_widget->model()->positionTracking(),
+ SIGNAL( positionProviderPluginChanged( PositionProviderPlugin* ) ),
+ this, SLOT( updateActivePositionProvider( PositionProviderPlugin* ) ) );
disconnect( d->m_currentLocationUi.positionTrackingComboBox, SIGNAL( currentIndexChanged( QString ) ),
this, SLOT( changePositionProvider( QString ) ) );
disconnect( d->m_currentLocationUi.locationLabel, SIGNAL( linkActivated( QString ) ),
@@ -112,6 +115,9 @@
connect( d->m_widget->model()->positionTracking(),
SIGNAL( gpsLocation( GeoDataCoordinates, qreal ) ),
this, SLOT( receiveGpsCoordinates( GeoDataCoordinates, qreal ) ) );
+ connect( d->m_widget->model()->positionTracking(),
+ SIGNAL( positionProviderPluginChanged( PositionProviderPlugin* ) ),
+ this, SLOT( updateActivePositionProvider( PositionProviderPlugin* ) ) );
connect( d->m_currentLocationUi.positionTrackingComboBox, SIGNAL( currentIndexChanged( QString ) ),
this, SLOT( changePositionProvider( QString ) ) );
connect( d->m_currentLocationUi.locationLabel, SIGNAL( linkActivated( QString ) ),
@@ -155,6 +161,22 @@
m_currentLocationUi.locationLabel->setText( html );
}
+void CurrentLocationWidgetPrivate::updateActivePositionProvider( PositionProviderPlugin *plugin )
+{
+ m_currentLocationUi.positionTrackingComboBox->blockSignals( true );
+ if ( !plugin ) {
+ m_currentLocationUi.positionTrackingComboBox->setCurrentIndex( 0 );
+ } else {
+ for( int i=0; i<m_currentLocationUi.positionTrackingComboBox->count(); ++i ) {
+ if ( m_currentLocationUi.positionTrackingComboBox->itemText( i ) == plugin->guiString() ) {
+ m_currentLocationUi.positionTrackingComboBox->setCurrentIndex( i );
+ break;
+ }
+ }
+ }
+ m_currentLocationUi.positionTrackingComboBox->blockSignals( false );
+}
+
void CurrentLocationWidget::receiveGpsCoordinates( const GeoDataCoordinates &position, qreal speed )
{
d->m_currentPosition = position;
--- trunk/KDE/kdeedu/marble/src/lib/CurrentLocationWidget.h #1190058:1190059
@@ -71,7 +71,7 @@
*/
Q_PRIVATE_SLOT( d, void updateAutoZoomCheckBox( bool autoZoom ) )
-
+ Q_PRIVATE_SLOT( d, void updateActivePositionProvider( PositionProviderPlugin* ) );
};
}
--- trunk/KDE/kdeedu/marble/src/marble.kcfg #1190058:1190059
@@ -237,6 +237,9 @@
<entry name="pluginVisible" type="IntList">
<label>List of toggles for making plugins visible.</label>
</entry>
+ <entry name="activePositionTrackingPlugin" type="String">
+ <label>The position tracking plugin used to determine the current location</label>
+ </entry>
</group>
<group name="StatusBar">
<entry key="showPositionLabel" type="Bool" >
--- trunk/KDE/kdeedu/marble/src/marble_part.cpp #1190058:1190059
@@ -79,6 +79,9 @@
#include "ViewportParams.h"
#include "MarbleClock.h"
#include "routing/RoutingManager.h"
+#include "PositionTracking.h"
+#include "PositionProviderPlugin.h"
+#include "PluginManager.h"
// Marble non-library classes
#include "ControlView.h"
@@ -482,6 +485,21 @@
m_controlView->marbleWidget()->model()->routingManager()->profilesModel()->loadDefaultProfiles();
}
+ QString positionProvider = MarbleSettings::activePositionTrackingPlugin();
+ if ( !positionProvider.isEmpty() ) {
+ PositionTracking* tracking = m_controlView->marbleWidget()->model()->positionTracking();
+ PluginManager* pluginManager = m_controlView->marbleWidget()->model()->pluginManager();
+ QList<PositionProviderPlugin*> plugins = pluginManager->createPositionProviderPlugins();
+ foreach( PositionProviderPlugin* plugin, plugins ) {
+ if ( plugin->nameId() == positionProvider ) {
+ plugins.removeOne( plugin );
+ tracking->setPositionProviderPlugin( plugin );
+ break;
+ }
+ qDeleteAll( plugins );
+ }
+ }
+
readStatusBarSettings();
updateSettings();
@@ -615,6 +633,13 @@
MarbleSettings::setPluginVisible( pluginVisible );
MarbleSettings::setPluginNameId( pluginNameId );
+ QString positionProvider;
+ PositionTracking* tracking = m_controlView->marbleWidget()->model()->positionTracking();
+ if ( tracking && tracking->positionProviderPlugin() ) {
+ positionProvider = tracking->positionProviderPlugin()->nameId();
+ }
+ MarbleSettings::setActivePositionTrackingPlugin( positionProvider );
+
MarbleSettings::setLockFloatItemPositions( m_lockFloatItemsAct->isChecked() );
writeStatusBarSettings();
More information about the Marble-commits
mailing list