[Marble-commits] KDE/kdeedu/marble/src/plugins/render/routing
Dennis Nienhüser
earthwings at gentoo.org
Sun Sep 12 22:39:57 CEST 2010
SVN commit 1174565 by nienhueser:
Position tracking can be toggled from the routing plugin. As a nice side effect, the Current Location tab is not needed anymore on ssd (except for showing position status messages).
M +21 -3 RoutingPlugin.cpp
M +4 -1 RoutingPlugin.h
M +78 -16 RoutingWidgetSmall.ui
--- trunk/KDE/kdeedu/marble/src/plugins/render/routing/RoutingPlugin.cpp #1174564:1174565
@@ -30,6 +30,7 @@
#include "ViewportParams.h"
#include "MarbleDataFacade.h"
#include "GeoDataCoordinates.h"
+#include "PluginManager.h"
#include <QtGui/QWidget>
#include <QtCore/QRect>
@@ -174,7 +175,7 @@
// disconnect signals
disconnect( m_marbleWidget->model()->positionTracking(), SIGNAL( positionProviderPluginChanged( PositionProviderPlugin* ) ),
- this, SLOT( setNavigationMenuDisabled( PositionProviderPlugin* ) ) );
+ this, SLOT( updateButtonStates( PositionProviderPlugin* ) ) );
disconnect( m_routingWidgetSmall->navigationButton, SIGNAL( clicked( bool ) ),
this, SLOT( showNavigationMenu() ) );
@@ -199,7 +200,7 @@
connect( m_marbleWidget->model()->positionTracking(), SIGNAL( positionProviderPluginChanged( PositionProviderPlugin* ) ),
- this, SLOT( setNavigationMenuDisabled( PositionProviderPlugin* ) ) );
+ this, SLOT( updateButtonStates( PositionProviderPlugin* ) ) );
connect( m_routingWidgetSmall->navigationButton, SIGNAL( clicked( bool ) ),
this, SLOT( showNavigationMenu() ) );
@@ -210,6 +211,8 @@
connect( m_routingWidgetSmall->routingButton, SIGNAL( clicked( bool ) ),
this, SLOT( showRoutingItem( bool ) ) );
+ connect( m_routingWidgetSmall->gpsButton, SIGNAL( clicked( bool ) ),
+ this, SLOT( togglePositionTracking( bool ) ) );
connect( m_routingWidgetSmall->zoomInButton, SIGNAL( clicked() ),
m_marbleWidget, SLOT( zoomIn() ) );
connect( m_routingWidgetSmall->zoomOutButton, SIGNAL( clicked() ),
@@ -575,11 +578,26 @@
m_adjustNavigation->setRecenter( Disabled );
}
-void RoutingPlugin::setNavigationMenuDisabled( PositionProviderPlugin *activePlugin )
+void RoutingPlugin::updateButtonStates( PositionProviderPlugin *activePlugin )
{
m_navigationMenu->setEnabled( activePlugin != 0 );
+ m_routingWidgetSmall->gpsButton->setChecked( activePlugin != 0 );
}
+void RoutingPlugin::togglePositionTracking( bool enabled )
+{
+ PositionProviderPlugin* plugin = 0;
+ if ( enabled ) {
+ PluginManager* pluginManager = m_marbleWidget->model()->pluginManager();
+ QList<PositionProviderPlugin*> plugins = pluginManager->createPositionProviderPlugins();
+ if ( plugins.size() > 0 ) {
+ plugin = plugins.takeFirst();
+ }
+ qDeleteAll( plugins );
+ }
+ dataFacade()->positionTracking()->setPositionProviderPlugin( plugin );
+}
+
Q_EXPORT_PLUGIN2( RoutingPlugin, Marble::RoutingPlugin )
#include "RoutingPlugin.moc"
--- trunk/KDE/kdeedu/marble/src/plugins/render/routing/RoutingPlugin.h #1174564:1174565
@@ -143,8 +143,11 @@
/**
* disables the navigation menu if Position Tracking is disabled
*/
- void setNavigationMenuDisabled( PositionProviderPlugin *activePlugin );
+ void updateButtonStates( PositionProviderPlugin *activePlugin );
+ /** Activate or deactivate position tracking */
+ void togglePositionTracking( bool enabled );
+
private:
/**
--- trunk/KDE/kdeedu/marble/src/plugins/render/routing/RoutingWidgetSmall.ui #1174564:1174565
@@ -6,26 +6,32 @@
<rect>
<x>0</x>
<y>0</y>
- <width>208</width>
- <height>54</height>
+ <width>213</width>
+ <height>45</height>
</rect>
</property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="windowTitle">
<string>RoutingWidget</string>
</property>
<widget class="QToolButton" name="navigationButton">
<property name="geometry">
<rect>
- <x>10</x>
- <y>10</y>
- <width>41</width>
+ <x>44</x>
+ <y>2</y>
+ <width>39</width>
<height>41</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
+ <horstretch>32</horstretch>
+ <verstretch>32</verstretch>
</sizepolicy>
</property>
<property name="mouseTracking">
@@ -72,12 +78,18 @@
<widget class="QToolButton" name="routingButton">
<property name="geometry">
<rect>
- <x>60</x>
- <y>10</y>
- <width>41</width>
+ <x>87</x>
+ <y>2</y>
+ <width>40</width>
<height>41</height>
</rect>
</property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>32</horstretch>
+ <verstretch>32</verstretch>
+ </sizepolicy>
+ </property>
<property name="toolTip">
<string>Routing Information</string>
</property>
@@ -101,12 +113,18 @@
<widget class="QToolButton" name="zoomInButton">
<property name="geometry">
<rect>
- <x>160</x>
- <y>10</y>
- <width>41</width>
+ <x>174</x>
+ <y>2</y>
+ <width>39</width>
<height>41</height>
</rect>
</property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>32</horstretch>
+ <verstretch>32</verstretch>
+ </sizepolicy>
+ </property>
<property name="toolTip">
<string>zoom in</string>
</property>
@@ -133,12 +151,18 @@
<widget class="QToolButton" name="zoomOutButton">
<property name="geometry">
<rect>
- <x>110</x>
- <y>10</y>
- <width>41</width>
+ <x>131</x>
+ <y>2</y>
+ <width>39</width>
<height>41</height>
</rect>
</property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>32</horstretch>
+ <verstretch>32</verstretch>
+ </sizepolicy>
+ </property>
<property name="toolTip">
<string>zoom out</string>
</property>
@@ -162,7 +186,45 @@
<bool>false</bool>
</property>
</widget>
+ <widget class="QToolButton" name="gpsButton">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>2</y>
+ <width>40</width>
+ <height>41</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>32</horstretch>
+ <verstretch>32</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>Toggle GPS</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="../../../marble.qrc">
+ <normaloff>:/icons/gps.png</normaloff>:/icons/gps.png</iconset>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
</widget>
+ </widget>
<resources>
<include location="routing.qrc"/>
<include location="../../../marble.qrc"/>
More information about the Marble-commits
mailing list