Skip to content
Permalink
Browse files

[FEATURE] Added --noplugins command line options to avoid restoring t…

…he plugins. Useful when a plugin misbehaves and causes QGIS to crash during startup.

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13076 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder
wonder committed Mar 19, 2010
1 parent 178abd5 commit 22962edb299ec419f3d4fb871b6649cd61e2da41
Showing with 28 additions and 6 deletions.
  1. +8 −2 qgis.1
  2. +12 −1 src/app/main.cpp
  3. +7 −2 src/app/qgisapp.cpp
  4. +1 −1 src/app/qgisapp.h
10 qgis.1
@@ -1,4 +1,4 @@
.TH QGIS 1 "April 13, 2008"
.TH QGIS 1 "March 19, 2010"
.SH NAME
qgis \- Quantum GIS Geographic Information System
.SH SYNOPSIS
@@ -14,6 +14,8 @@ qgis \- Quantum GIS Geographic Information System
.B " [--extent"
.I xmin,ymin,xmax,ymax]
.br
.B " [--noplugins]"
.br
.B " [--help]"
.br
.B " [file]..."
@@ -65,7 +67,11 @@ are symbolized, and the view extent is restored.
.B \--extent xmin,ymin,xmax,ymax
Set initial map extent by passing coordinates of that rectangle.
.TP
.B \--help
.B \--noplugins
.br
Don't restore plugins on startup. Useful if some third-party plugins make QGIS crash during startup.
.TP
.B \--help
.br
Display brief usage help.
.TP
@@ -92,6 +92,7 @@ void usage( std::string const & appName )
<< "\t[--project projectfile]\tload the given QGIS project\n"
<< "\t[--extent xmin,ymin,xmax,ymax]\tset initial map extent\n"
<< "\t[--nologo]\thide splash screen\n"
<< "\t[--noplugins]\tdon't restore plugins on startup\n"
<< "\t[--optionspath path]\tuse the given QSettings path\n"
<< "\t[--help]\t\tthis text\n\n"
<< " FILES:\n"
@@ -267,6 +268,7 @@ int main( int argc, char *argv[] )
int mySnapshotHeight = 600;

bool myHideSplash = false;
bool myRestorePlugins = true;

// This behaviour will set initial extent of map canvas, but only if
// there are no command line arguments. This gives a usable map
@@ -296,6 +298,7 @@ int main( int argc, char *argv[] )
/* These options set a flag. */
{"help", no_argument, 0, '?'},
{"nologo", no_argument, 0, 'n'},
{"noplugins", no_argument, 0, 'P'},
/* These options don't set a flag.
* We distinguish them by their indices. */
{"snapshot", required_argument, 0, 's'},
@@ -354,6 +357,10 @@ int main( int argc, char *argv[] )
myProjectFileName = QDir::convertSeparators( QFileInfo( QFile::decodeName( optarg ) ).absoluteFilePath() );
break;

case 'P':
myRestorePlugins = false;
break;

case 'e':
myInitialExtent = optarg;
break;
@@ -402,6 +409,10 @@ int main( int argc, char *argv[] )
{
myHideSplash = true;
}
else if ( arg == "--noplugins" || arg == "-P" )
{
myRestorePlugins = false;
}
else if ( i + 1 < argc && ( arg == "--snapshot" || arg == "-s" ) )
{
mySnapshotFileName = QDir::convertSeparators( QFileInfo( QFile::decodeName( argv[++i] ) ).absoluteFilePath() );
@@ -615,7 +626,7 @@ int main( int argc, char *argv[] )
}
#endif

QgisApp *qgis = new QgisApp( mypSplash ); // "QgisApp" used to find canonical instance
QgisApp *qgis = new QgisApp( mypSplash, myRestorePlugins ); // "QgisApp" used to find canonical instance
qgis->setObjectName( "QgisApp" );

/////////////////////////////////////////////////////////////////////
@@ -327,7 +327,7 @@ static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )
QgisApp *QgisApp::smInstance = 0;

// constructor starts here
QgisApp::QgisApp( QSplashScreen *splash, QWidget * parent, Qt::WFlags fl )
QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent, Qt::WFlags fl )
: QMainWindow( parent, fl ),
mSplash( splash ),
mPythonUtils( NULL )
@@ -425,7 +425,12 @@ QgisApp::QgisApp( QSplashScreen *splash, QWidget * parent, Qt::WFlags fl )
mSplash->showMessage( tr( "Restoring loaded plugins" ), Qt::AlignHCenter | Qt::AlignBottom );
qApp->processEvents();
QgsPluginRegistry::instance()->setQgisInterface( mQgisInterface );
QgsPluginRegistry::instance()->restoreSessionPlugins( QgsApplication::pluginPath() );
if ( restorePlugins )
{
// Restoring of plugins can be disabled with --noplugins command line option
// because some plugins may cause QGIS to crash during startup
QgsPluginRegistry::instance()->restoreSessionPlugins( QgsApplication::pluginPath() );
}

mSplash->showMessage( tr( "Initializing file filters" ), Qt::AlignHCenter | Qt::AlignBottom );
qApp->processEvents();
@@ -81,7 +81,7 @@ class QgisApp : public QMainWindow
Q_OBJECT
public:
//! Constructor
QgisApp( QSplashScreen *splash, QWidget * parent = 0, Qt::WFlags fl = Qt::Window );
QgisApp( QSplashScreen *splash, bool restorePlugins = true, QWidget * parent = 0, Qt::WFlags fl = Qt::Window );
//! Destructor
~QgisApp();
/**

0 comments on commit 22962ed

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