Skip to content
Permalink
Browse files

Merge pull request #2790 from SebDieBln/ImproveVersionCheck

[Bugfix] Improve version check (refs #14022)
  • Loading branch information
jef-n committed Feb 15, 2016
2 parents 3600046 + 8359bfe commit bd3bbc4707736f9d5c4ac6ac1554984d3b1edc50
@@ -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
@@ -590,6 +590,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl ) :
mLegendGroupsBoldChkBx->setChecked( mSettings->value( "/qgis/legendGroupsBold", false ).toBool() );
cbxHideSplash->setChecked( mSettings->value( "/qgis/hideSplash", false ).toBool() );
cbxShowTips->setChecked( mSettings->value( QString( "/qgis/showTips%1" ).arg( QGis::QGIS_VERSION_INT / 100 ), true ).toBool() );
cbxCheckVersion->setChecked( mSettings->value( "/qgis/checkVersion", true ).toBool() );
cbxAttributeTableDocked->setChecked( mSettings->value( "/qgis/dockAttributeTable", false ).toBool() );
cbxSnappingOptionsDocked->setChecked( mSettings->value( "/qgis/dockSnapping", false ).toBool() );
cbxAddPostgisDC->setChecked( mSettings->value( "/qgis/addPostgisDC", false ).toBool() );
@@ -1131,6 +1132,7 @@ void QgsOptions::saveOptions()
mSettings->setValue( "/qgis/legendGroupsBold", mLegendGroupsBoldChkBx->isChecked() );
mSettings->setValue( "/qgis/hideSplash", cbxHideSplash->isChecked() );
mSettings->setValue( QString( "/qgis/showTips%1" ).arg( QGis::QGIS_VERSION_INT / 100 ), cbxShowTips->isChecked() );
mSettings->setValue( "/qgis/checkVersion", cbxCheckVersion->isChecked() );
mSettings->setValue( "/qgis/dockAttributeTable", cbxAttributeTableDocked->isChecked() );
mSettings->setValue( "/qgis/attributeTableBehaviour", cmbAttrTableBehaviour->itemData( cmbAttrTableBehaviour->currentIndex() ) );
mSettings->setValue( "/qgis/attributeTableRowCache", spinBoxAttrTableRowCache->value() );
@@ -78,7 +78,7 @@ void QgsVersionInfo::versionReplyFinished()
mErrorString = tr( "Connection refused - server may be down" );
break;
case QNetworkReply::HostNotFoundError:
mErrorString = tr( "The host name qgis.org could not be resolved. Check your DNS settings or contact your system administrator." );
mErrorString = tr( "The host name %1 could not be resolved. Check your DNS settings or contact your system administrator." ).arg( reply->request().url().host() );
break;
case QNetworkReply::NoError:
mErrorString = "";
@@ -24,9 +24,11 @@
#include <QListView>
#include <QSettings>

QgsWelcomePage::QgsWelcomePage( QWidget* parent )
QgsWelcomePage::QgsWelcomePage( bool skipVersionCheck, QWidget* parent )
: QWidget( parent )
{
QSettings settings;

QVBoxLayout* mainLayout = new QVBoxLayout;
mainLayout->setMargin( 0 );
setLayout( mainLayout );
@@ -58,7 +60,7 @@ QgsWelcomePage::QgsWelcomePage( QWidget* parent )
mVersionInformation->setVisible( false );

mVersionInfo = new QgsVersionInfo();
if ( !QgsApplication::isRunningFromBuildDir() )
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();

@@ -619,11 +619,37 @@
</item>
<item>
<widget class="QCheckBox" name="cbxShowTips">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Show tips at start up</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_2">
<property name="minimumSize">
<size>
<width>12</width>
<height>0</height>
</size>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbxCheckVersion">
<property name="text">
<string>Check QGIS version at startup</string>
</property>
</widget>
</item>
</layout>
</item>
<item>

0 comments on commit bd3bbc4

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