Skip to content
Permalink
Browse files

correctly unload Globe plugin (fix #4185)

  • Loading branch information
alexbruy committed Aug 28, 2013
1 parent 6a9a58f commit bc63fcd374f1ad4d707bbe5eadfe59222366d37c
Showing with 10 additions and 5 deletions.
  1. +9 −5 src/plugins/globe/globe_plugin.cpp
  2. +1 −0 src/plugins/globe/globe_plugin.h
@@ -194,25 +194,25 @@ void GlobePlugin::initGui()
// Create the action for tool
mQActionPointer = new QAction( QIcon( ":/globe/globe.png" ), tr( "Launch Globe" ), this );
mQActionSettingsPointer = new QAction( QIcon( ":/globe/globe.png" ), tr( "Globe Settings" ), this );
QAction* actionUnload = new QAction( tr( "Unload Globe" ), this );
mQActionUnload = new QAction( tr( "Unload Globe" ), this );

// Set the what's this text
mQActionPointer->setWhatsThis( tr( "Overlay data on a 3D globe" ) );
mQActionSettingsPointer->setWhatsThis( tr( "Settings for 3D globe" ) );
actionUnload->setWhatsThis( tr( "Unload globe" ) );
mQActionUnload->setWhatsThis( tr( "Unload globe" ) );

// Connect actions
connect( mQActionPointer, SIGNAL( triggered() ), this, SLOT( run() ) );
connect( mQActionSettingsPointer, SIGNAL( triggered() ), this, SLOT( settings() ) );
connect( actionUnload, SIGNAL( triggered() ), this, SLOT( reset() ) );
connect( mQActionUnload, SIGNAL( triggered() ), this, SLOT( reset() ) );

// Add the icon to the toolbar
mQGisIface->addToolBarIcon( mQActionPointer );

//Add menu
mQGisIface->addPluginToMenu( tr( "&Globe" ), mQActionPointer );
mQGisIface->addPluginToMenu( tr( "&Globe" ), mQActionSettingsPointer );
mQGisIface->addPluginToMenu( tr( "&Globe" ), actionUnload );
mQGisIface->addPluginToMenu( tr( "&Globe" ), mQActionUnload );

connect( mQGisIface->mapCanvas() , SIGNAL( extentsChanged() ),
this, SLOT( extentsChanged() ) );
@@ -778,8 +778,12 @@ void GlobePlugin::unload()
{
reset();
// remove the GUI
mQGisIface->removePluginMenu( "&Globe", mQActionPointer );
mQGisIface->removePluginMenu( tr( "&Globe" ), mQActionPointer );
mQGisIface->removePluginMenu( tr( "&Globe" ), mQActionSettingsPointer );
mQGisIface->removePluginMenu( tr( "&Globe" ), mQActionUnload );

mQGisIface->removeToolBarIcon( mQActionPointer );

delete mQActionPointer;
}

@@ -125,6 +125,7 @@ class GlobePlugin : public QObject, public QgisPlugin
QAction * mQActionPointer;
//!pointer to the qaction for this plugin
QAction * mQActionSettingsPointer;
QAction * mQActionUnload;
//! OSG Viewer
osgViewer::Viewer* mOsgViewer;
//! QT viewer widget

0 comments on commit bc63fcd

Please sign in to comment.
You can’t perform that action at this time.