diff --git a/qgis.1 b/qgis.1 index ead81a047779..6b82222c9d25 100644 --- a/qgis.1 +++ b/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 diff --git a/src/app/main.cpp b/src/app/main.cpp index 605e407ad39d..e1750fe3096a 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -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" ); ///////////////////////////////////////////////////////////////////// diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp index 2c77214b23e3..7f74007f33a2 100644 --- a/src/app/qgisapp.cpp +++ b/src/app/qgisapp.cpp @@ -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(); diff --git a/src/app/qgisapp.h b/src/app/qgisapp.h index a602801dfe17..40871c426dfc 100644 --- a/src/app/qgisapp.h +++ b/src/app/qgisapp.h @@ -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(); /**