Skip to content
Permalink
Browse files

Better typing for variables in configuration options

  • Loading branch information
m-kuhn committed Oct 30, 2017
1 parent 257f442 commit ec27839aff3f5bba450dccdbc5b301e042d59c24
Showing with 14 additions and 14 deletions.
  1. +14 −14 src/app/qgsoptions.cpp
@@ -319,17 +319,17 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
connect( mBtnMoveHelpDown, &QAbstractButton::clicked, this, &QgsOptions::moveHelpPathDown );

//Network timeout
mNetworkTimeoutSpinBox->setValue( mSettings->value( QStringLiteral( "/qgis/networkAndProxy/networkTimeout" ), "60000" ).toInt() );
mNetworkTimeoutSpinBox->setValue( mSettings->value( QStringLiteral( "/qgis/networkAndProxy/networkTimeout" ), 60000 ).toInt() );
leUserAgent->setText( mSettings->value( QStringLiteral( "/qgis/networkAndProxy/userAgent" ), "Mozilla/5.0" ).toString() );

// WMS capabilities expiry time
mDefaultCapabilitiesExpirySpinBox->setValue( mSettings->value( QStringLiteral( "/qgis/defaultCapabilitiesExpiry" ), "24" ).toInt() );
mDefaultCapabilitiesExpirySpinBox->setValue( mSettings->value( QStringLiteral( "/qgis/defaultCapabilitiesExpiry" ), 24 ).toInt() );

// WMS/WMS-C tile expiry time
mDefaultTileExpirySpinBox->setValue( mSettings->value( QStringLiteral( "/qgis/defaultTileExpiry" ), "24" ).toInt() );
mDefaultTileExpirySpinBox->setValue( mSettings->value( QStringLiteral( "/qgis/defaultTileExpiry" ), 24 ).toInt() );

// WMS/WMS-C default max retry in case of tile request errors
mDefaultTileMaxRetrySpinBox->setValue( mSettings->value( QStringLiteral( "/qgis/defaultTileMaxRetry" ), "3" ).toInt() );
mDefaultTileMaxRetrySpinBox->setValue( mSettings->value( QStringLiteral( "/qgis/defaultTileMaxRetry" ), 3 ).toInt() );

// Proxy stored authentication configurations
mAuthSettings->setDataprovider( QStringLiteral( "proxy" ) );
@@ -338,20 +338,20 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
mAuthSettings->setWarningText( mAuthSettings->formattedWarning( QgsAuthSettingsWidget::UserSettings ) );

//Web proxy settings
grpProxy->setChecked( mSettings->value( QStringLiteral( "proxy/proxyEnabled" ), "0" ).toBool() );
leProxyHost->setText( mSettings->value( QStringLiteral( "proxy/proxyHost" ), "" ).toString() );
leProxyPort->setText( mSettings->value( QStringLiteral( "proxy/proxyPort" ), "" ).toString() );
grpProxy->setChecked( mSettings->value( QStringLiteral( "proxy/proxyEnabled" ), false ).toBool() );
leProxyHost->setText( mSettings->value( QStringLiteral( "proxy/proxyHost" ), QString() ).toString() );
leProxyPort->setText( mSettings->value( QStringLiteral( "proxy/proxyPort" ), QString() ).toString() );

mAuthSettings->setPassword( mSettings->value( QStringLiteral( "proxy/proxyPassword" ), "" ).toString() );
mAuthSettings->setUsername( mSettings->value( QStringLiteral( "proxy/proxyUser" ), "" ).toString() );
mAuthSettings->setPassword( mSettings->value( QStringLiteral( "proxy/proxyPassword" ), QString() ).toString() );
mAuthSettings->setUsername( mSettings->value( QStringLiteral( "proxy/proxyUser" ), QString() ).toString() );

//available proxy types
mProxyTypeComboBox->insertItem( 0, QStringLiteral( "DefaultProxy" ) );
mProxyTypeComboBox->insertItem( 1, QStringLiteral( "Socks5Proxy" ) );
mProxyTypeComboBox->insertItem( 2, QStringLiteral( "HttpProxy" ) );
mProxyTypeComboBox->insertItem( 3, QStringLiteral( "HttpCachingProxy" ) );
mProxyTypeComboBox->insertItem( 4, QStringLiteral( "FtpCachingProxy" ) );
QString settingProxyType = mSettings->value( QStringLiteral( "proxy/proxyType" ), "DefaultProxy" ).toString();
QString settingProxyType = mSettings->value( QStringLiteral( "proxy/proxyType" ), QStringLiteral( "DefaultProxy" ) ).toString();
mProxyTypeComboBox->setCurrentIndex( mProxyTypeComboBox->findText( settingProxyType ) );

//URLs excluded not going through proxies
@@ -368,7 +368,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti

// cache settings
mCacheDirectory->setText( mSettings->value( QStringLiteral( "cache/directory" ) ).toString() );
mCacheDirectory->setPlaceholderText( QDir( QgsApplication::qgisSettingsDirPath() ).canonicalPath() + QDir::separator() + "cache" );
mCacheDirectory->setPlaceholderText( QDir( QgsApplication::qgisSettingsDirPath() ).canonicalPath() + QDir::separator() + QStringLiteral( "cache" ) );
mCacheSize->setMinimum( 0 );
mCacheSize->setMaximum( std::numeric_limits<int>::max() );
mCacheSize->setSingleStep( 1024 );
@@ -421,7 +421,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
cmbScanItemsInBrowser->clear();
cmbScanItemsInBrowser->addItem( tr( "Check file contents" ), "contents" ); // 0
cmbScanItemsInBrowser->addItem( tr( "Check extension" ), "extension" ); // 1
int index = cmbScanItemsInBrowser->findData( mSettings->value( QStringLiteral( "/qgis/scanItemsInBrowser2" ), "" ) );
int index = cmbScanItemsInBrowser->findData( mSettings->value( QStringLiteral( "/qgis/scanItemsInBrowser2" ), QString() ) );
if ( index == -1 ) index = 1;
cmbScanItemsInBrowser->setCurrentIndex( index );

@@ -431,7 +431,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
// cmbScanZipInBrowser->addItem( tr( "Passthru" ) ); // 1 - removed
cmbScanZipInBrowser->addItem( tr( "Basic scan" ), QVariant( "basic" ) );
cmbScanZipInBrowser->addItem( tr( "Full scan" ), QVariant( "full" ) );
index = cmbScanZipInBrowser->findData( mSettings->value( QStringLiteral( "/qgis/scanZipInBrowser2" ), "" ) );
index = cmbScanZipInBrowser->findData( mSettings->value( QStringLiteral( "/qgis/scanZipInBrowser2" ), QString() ) );
if ( index == -1 ) index = 1;
cmbScanZipInBrowser->setCurrentIndex( index );

@@ -883,7 +883,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
//
QString mySystemLocale = QLocale::system().name();
lblSystemLocale->setText( tr( "Detected active locale on your system: %1" ).arg( mySystemLocale ) );
QString myUserLocale = mSettings->value( QStringLiteral( "locale/userLocale" ), "" ).toString();
QString myUserLocale = mSettings->value( QStringLiteral( "locale/userLocale" ), QString() ).toString();
QStringList myI18nList = i18nList();
Q_FOREACH ( const QString &l, myI18nList )
{

0 comments on commit ec27839

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