@@ -452,6 +452,18 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
452452 addDockWidget ( Qt::LeftDockWidgetArea, mBrowserWidget );
453453 mBrowserWidget ->hide ();
454454
455+ // create the GPS tool on starting QGIS - this is like the Browser
456+ mpGpsWidget = new QgsGPSInformationWidget ( mMapCanvas );
457+ // create the dock widget
458+ mpGpsDock = new QDockWidget ( tr ( " GPS Information" ), this );
459+ mpGpsDock->setObjectName ( " GPSInformation" );
460+ mpGpsDock->setAllowedAreas ( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
461+ addDockWidget ( Qt::LeftDockWidgetArea, mpGpsDock );
462+ // add to the Panel submenu
463+ // now add our widget to the dock - ownership of the widget is passed to the dock
464+ mpGpsDock->setWidget ( mpGpsWidget );
465+ mpGpsDock->hide ();
466+
455467 mInternalClipboard = new QgsClipboard; // create clipboard
456468 mQgisInterface = new QgisAppInterface ( this ); // create the interfce
457469
@@ -630,6 +642,8 @@ QgisApp::~QgisApp()
630642
631643 delete mPythonUtils ;
632644
645+ delete mpGpsWidget;
646+
633647 deletePrintComposers ();
634648 removeAnnotationItems ();
635649
@@ -729,11 +743,6 @@ void QgisApp::readSettings()
729743 {
730744 showTileScale ();
731745 }
732- // Restore state of GPS Tracker
733- if ( settings.value ( " /gps/widgetEnabled" , false ).toBool () )
734- {
735- showGpsTool ();
736- }
737746}
738747
739748
@@ -830,7 +839,6 @@ void QgisApp::createActions()
830839 connect ( mActionSetLayerCRS , SIGNAL ( triggered () ), this , SLOT ( setLayerCRS () ) );
831840 connect ( mActionSetProjectCRSFromLayer , SIGNAL ( triggered () ), this , SLOT ( setProjectCRSFromLayer () ) );
832841 connect ( mActionTileScale , SIGNAL ( triggered () ), this , SLOT ( showTileScale () ) );
833- connect ( mActionGpsTool , SIGNAL ( triggered () ), this , SLOT ( showGpsTool () ) );
834842 connect ( mActionLayerProperties , SIGNAL ( triggered () ), this , SLOT ( layerProperties () ) );
835843 connect ( mActionLayerSubsetString , SIGNAL ( triggered () ), this , SLOT ( layerSubsetString () ) );
836844 connect ( mActionAddToOverview , SIGNAL ( triggered () ), this , SLOT ( isInOverview () ) );
@@ -1871,17 +1879,6 @@ void QgisApp::saveWindowState()
18711879 settings.setValue ( " /UI/tileScaleEnabled" , false );
18721880 }
18731881
1874- // Persist state of GPS Tracker
1875- if ( mpGpsWidget )
1876- {
1877- settings.setValue ( " /gps/widgetEnabled" , true );
1878- delete mpGpsWidget;
1879- }
1880- else
1881- {
1882- settings.setValue ( " /gps/widgetEnabled" , false );
1883- }
1884-
18851882 QgsPluginRegistry::instance ()->unloadAll ();
18861883}
18871884
@@ -4518,28 +4515,6 @@ void QgisApp::setProjectCRSFromLayer()
45184515 mMapCanvas ->refresh ();
45194516}
45204517
4521- void QgisApp::showGpsTool ()
4522- {
4523- if ( !mpGpsWidget )
4524- {
4525- mpGpsWidget = new QgsGPSInformationWidget ( mMapCanvas );
4526- // create the dock widget
4527- mpGpsDock = new QDockWidget ( tr ( " GPS Information" ), this );
4528- mpGpsDock->setObjectName ( " GPSInformation" );
4529- mpGpsDock->setAllowedAreas ( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
4530- addDockWidget ( Qt::LeftDockWidgetArea, mpGpsDock );
4531- // add to the Panel submenu
4532- mPanelMenu ->addAction ( mpGpsDock->toggleViewAction () );
4533- // now add our widget to the dock - ownership of the widget is passed to the dock
4534- mpGpsDock->setWidget ( mpGpsWidget );
4535- mpGpsWidget->show ();
4536- }
4537- else
4538- {
4539- mpGpsDock->setVisible ( mpGpsDock->isHidden () );
4540- }
4541- }
4542-
45434518void QgisApp::showTileScale ()
45444519{
45454520 if ( !mpTileScaleWidget )
0 commit comments