add command line option to skip the version check at startup

--noversioncheck or -V are recognized
This commit is contained in:
Sebastian Dietrich 2016-02-14 22:28:24 +01:00
parent 25a727a05a
commit 8359bfe40c
5 changed files with 13 additions and 7 deletions

View File

@ -119,6 +119,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[--noversioncheck]\tdon't check for new version of QGIS at startup"
<< "\t[--noplugins]\tdon't restore plugins on startup\n"
<< "\t[--nocustomization]\tdon't apply GUI customization\n"
<< "\t[--customizationfile]\tuse the given ini file as GUI customization\n"
@ -476,6 +477,7 @@ int main( int argc, char *argv[] )
int mySnapshotHeight = 600;
bool myHideSplash = false;
bool mySkipVersionCheck = false;
#if defined(ANDROID)
QgsDebugMsg( QString( "Android: Splash hidden" ) );
myHideSplash = true;
@ -543,6 +545,10 @@ int main( int argc, char *argv[] )
{
myHideSplash = true;
}
else if ( arg == "--noversioncheck" || arg == "-V" )
{
mySkipVersionCheck = true;
}
else if ( arg == "--noplugins" || arg == "-P" )
{
myRestorePlugins = false;
@ -1032,7 +1038,7 @@ int main( int argc, char *argv[] )
// this should be done in QgsApplication::init() but it doesn't know the settings dir.
QgsApplication::setMaxThreads( QSettings().value( "/qgis/max_threads", -1 ).toInt() );
QgisApp *qgis = new QgisApp( mypSplash, myRestorePlugins ); // "QgisApp" used to find canonical instance
QgisApp *qgis = new QgisApp( mypSplash, myRestorePlugins, mySkipVersionCheck ); // "QgisApp" used to find canonical instance
qgis->setObjectName( "QgisApp" );
myApp.connect(

View File

@ -531,7 +531,7 @@ static bool cmpByText_( QAction* a, QAction* b )
QgisApp *QgisApp::smInstance = nullptr;
// constructor starts here
QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent, Qt::WindowFlags fl )
QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCheck, QWidget * parent, Qt::WindowFlags fl )
: QMainWindow( parent, fl )
, mNonEditMapTool( nullptr )
, mScaleLabel( nullptr )
@ -639,7 +639,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
// what type of project to auto-open
mProjOpen = settings.value( "/qgis/projOpenAtLaunch", 0 ).toInt();
mWelcomePage = new QgsWelcomePage;
mWelcomePage = new QgsWelcomePage( skipVersionCheck );
mCentralContainer = new QStackedWidget;
mCentralContainer->insertWidget( 0, mMapCanvas );

View File

@ -134,7 +134,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
Q_OBJECT
public:
//! Constructor
QgisApp( QSplashScreen *splash, bool restorePlugins = true, QWidget *parent = nullptr, Qt::WindowFlags fl = Qt::Window );
QgisApp( QSplashScreen *splash, bool restorePlugins = true, bool skipVersionCheck = false, QWidget *parent = nullptr, Qt::WindowFlags fl = Qt::Window );
//! Constructor for unit tests
QgisApp();
//! Destructor

View File

@ -24,7 +24,7 @@
#include <QListView>
#include <QSettings>
QgsWelcomePage::QgsWelcomePage( QWidget* parent )
QgsWelcomePage::QgsWelcomePage( bool skipVersionCheck, QWidget* parent )
: QWidget( parent )
{
QSettings settings;
@ -60,7 +60,7 @@ QgsWelcomePage::QgsWelcomePage( QWidget* parent )
mVersionInformation->setVisible( false );
mVersionInfo = new QgsVersionInfo();
if ( !QgsApplication::isRunningFromBuildDir() && settings.value( "/qgis/checkVersion", true ).toBool() )
if ( !QgsApplication::isRunningFromBuildDir() && settings.value( "/qgis/checkVersion", true ).toBool() && !skipVersionCheck )
{
connect( mVersionInfo, SIGNAL( versionInfoAvailable() ), this, SLOT( versionInfoReceived() ) );
mVersionInfo->checkVersion();

View File

@ -28,7 +28,7 @@ class QgsWelcomePage : public QWidget
Q_OBJECT
public:
explicit QgsWelcomePage( QWidget* parent = nullptr );
explicit QgsWelcomePage( bool skipVersionCheck = false, QWidget* parent = nullptr );
~QgsWelcomePage();