Skip to content

Commit 9e2652e

Browse files
author
timlinux
committed
Fix issue where gps tracker was not being restored properly on subsequent qgis launches. Also wrapped some more conditional qwt bits
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12711 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 3b89436 commit 9e2652e

File tree

2 files changed

+24
-23
lines changed

2 files changed

+24
-23
lines changed

src/app/qgisapp.cpp

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,11 @@ QgisApp::QgisApp( QSplashScreen *splash, QWidget * parent, Qt::WFlags fl )
330330
: QMainWindow( parent, fl ),
331331
mSplash( splash ),
332332
mPythonConsole( NULL ),
333-
mPythonUtils( NULL ),
333+
mPythonUtils( NULL )
334+
#ifdef HAVE_QWT
335+
,
334336
mpGpsWidget( NULL )
337+
#endif
335338
{
336339
if ( smInstance )
337340
{
@@ -2080,15 +2083,7 @@ void QgisApp::saveRecentProjectPath( QString projectPath, QSettings & settings )
20802083
// Persist the list
20812084
settings.setValue( "/UI/recentProjectsList", mRecentProjectPaths );
20822085

2083-
// Persist state of GPS Tracker
2084-
if ( mpGpsWidget )
2085-
{
2086-
settings.setValue( "/gps/widgetEnabled", true );
2087-
}
2088-
else
2089-
{
2090-
settings.setValue( "/gps/widgetEnabled", false );
2091-
}
2086+
20922087
// Update menu list of paths
20932088
updateRecentProjectPaths();
20942089

@@ -2104,6 +2099,19 @@ void QgisApp::saveWindowState()
21042099
// store window geometry
21052100
settings.setValue( "/UI/geometry", saveGeometry() );
21062101

2102+
#if HAVE_QWT
2103+
// Persist state of GPS Tracker
2104+
if ( mpGpsWidget )
2105+
{
2106+
settings.setValue( "/gps/widgetEnabled", true );
2107+
delete mpGpsWidget;
2108+
}
2109+
else
2110+
{
2111+
settings.setValue( "/gps/widgetEnabled", false );
2112+
}
2113+
#endif
2114+
21072115
QgsPluginRegistry::instance()->unloadAll();
21082116
}
21092117

@@ -2134,18 +2142,6 @@ void QgisApp::restoreWindowState()
21342142
QgsDebugMsg( "restore of UI geometry failed" );
21352143
}
21362144

2137-
#ifdef HAVE_QWT
2138-
// Persist state of GPS Tracker
2139-
if ( mpGpsWidget )
2140-
{
2141-
settings.setValue( "/gps/widgetEnabled", true );
2142-
delete mpGpsWidget;
2143-
}
2144-
else
2145-
{
2146-
settings.setValue( "/gps/widgetEnabled", false );
2147-
}
2148-
#endif
21492145
}
21502146
///////////// END OF GUI SETUP ROUTINES ///////////////
21512147

src/app/qgisapp.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ class QDomDocument;
7070
#include "qgsconfig.h"
7171
#include "qgsfeature.h"
7272
#include "qgspoint.h"
73+
#ifdef HAVE_QWT
7374
class QgsGPSInformationWidget;
75+
#endif
7476

7577
/*! \class QgisApp
7678
* \brief Main window for the Qgis application
@@ -902,7 +904,9 @@ class QgisApp : public QMainWindow
902904
// docks ------------------------------------------
903905
QDockWidget *mLegendDock;
904906
QDockWidget *mOverviewDock;
907+
#ifdef HAVE_QWT
905908
QDockWidget *mpGpsDock;
909+
#endif
906910

907911
#ifdef Q_WS_MAC
908912
//! Window menu action to select this window
@@ -1050,9 +1054,10 @@ class QgisApp : public QMainWindow
10501054

10511055
int mLastComposerId;
10521056

1057+
#ifdef HAVE_QWT
10531058
//! Persistent GPS toolbox
10541059
QgsGPSInformationWidget * mpGpsWidget;
1055-
1060+
#endif
10561061
//! project changed
10571062
void projectChanged( const QDomDocument & );
10581063
};

0 commit comments

Comments
 (0)