Skip to content
Permalink
Browse files

add command line option to skip the version check at startup

--noversioncheck or -V are recognized
  • Loading branch information
SebDieBln committed Feb 14, 2016
1 parent 25a727a commit 8359bfe40cf7fa3cee130280d2f56a422b4c3510
Showing with 13 additions and 7 deletions.
  1. +7 −1 src/app/main.cpp
  2. +2 −2 src/app/qgisapp.cpp
  3. +1 −1 src/app/qgisapp.h
  4. +2 −2 src/app/qgswelcomepage.cpp
  5. +1 −1 src/app/qgswelcomepage.h
@@ -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(
@@ -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 );
@@ -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
@@ -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();
@@ -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();

0 comments on commit 8359bfe

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