38 : QDialog( parent, fl )
40 , mServiceName( serviceName )
41 , mOriginalConnName( connectionName )
46 if ( mServiceName.startsWith( QLatin1String(
"qgis/" ) ) )
53 mServiceName = mServiceName.split(
'-' ).last().toUpper();
61 connect( buttonBox, &QDialogButtonBox::helpRequested,
this, &QgsNewHttpConnection::showHelp );
63 QString connectionType = mServiceName;
64 if ( mServiceName == QLatin1String(
"WMS" ) )
66 connectionType = QStringLiteral(
"WMS/WMTS" );
68 setWindowTitle( tr(
"Create a New %1 Connection" ).arg( connectionType ) );
70 txtName->setValidator(
new QRegularExpressionValidator( QRegularExpression(
"[^\\/]+" ), txtName ) );
79 cmbTilePixelRatio->clear();
85 cmbVersion->addItem( tr(
"Maximum" ) );
86 cmbVersion->addItem( tr(
"1.0" ) );
87 cmbVersion->addItem( tr(
"1.1" ) );
88 cmbVersion->addItem( tr(
"2.0" ) );
89 cmbVersion->addItem( tr(
"OGC API - Features" ) );
90 connect( cmbVersion,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsNewHttpConnection::wfsVersionCurrentIndexChanged );
92 mComboWfsFeatureMode->clear();
93 mComboWfsFeatureMode->addItem( tr(
"Default" ), QStringLiteral(
"default" ) );
94 mComboWfsFeatureMode->addItem( tr(
"Simple Features" ), QStringLiteral(
"simpleFeatures" ) );
95 mComboWfsFeatureMode->addItem( tr(
"Complex Features" ), QStringLiteral(
"complexFeatures" ) );
99 mComboHttpMethod->setCurrentIndex( mComboHttpMethod->findData( QVariant::fromValue(
Qgis::HttpMethod::Get ) ) );
101 cmbFeaturePaging->clear();
102 cmbFeaturePaging->addItem( tr(
"Default (trust server capabilities)" ) );
103 cmbFeaturePaging->addItem( tr(
"Enabled" ) );
104 cmbFeaturePaging->addItem( tr(
"Disabled" ) );
105 connect( cmbFeaturePaging,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsNewHttpConnection::wfsFeaturePagingCurrentIndexChanged );
109 if ( !connectionName.isEmpty() )
114 txtName->setText( connectionName );
115 const QStringList detailParameters { mServiceName.toLower(), connectionName };
126 mWfsVersionDetectButton->setDisabled( txtUrl->text().isEmpty() );
130 mWmsOptionsGroupBox->setVisible(
false );
131 mGroupBox->layout()->removeWidget( mWmsOptionsGroupBox );
135 mWfsOptionsGroupBox->setVisible(
false );
136 mGroupBox->layout()->removeWidget( mWfsOptionsGroupBox );
140 txtUrl->setToolTip( tr(
"HTTP address of the WFS service, or landing page of a OGC API service<br>(an ending slash might be needed for some OGC API servers)" ) );
145 cbxIgnoreGetMapURI->setText( tr(
"Ignore GetCoverage URI reported in capabilities" ) );
146 cbxWmsIgnoreAxisOrientation->setText( tr(
"Ignore axis orientation" ) );
149 mWmsOptionsGroupBox->setTitle( tr(
"WCS Options" ) );
151 cbxIgnoreGetFeatureInfoURI->setVisible(
false );
152 mWmsOptionsGroupBox->layout()->removeWidget( cbxIgnoreGetFeatureInfoURI );
154 sbFeatureCount->setVisible(
false );
155 mWmsOptionsGroupBox->layout()->removeWidget( sbFeatureCount );
156 lblFeatureCount->setVisible(
false );
157 mWmsOptionsGroupBox->layout()->removeWidget( lblFeatureCount );
159 cmbDpiMode->setVisible(
false );
160 mWmsOptionsGroupBox->layout()->removeWidget( cmbDpiMode );
161 lblDpiMode->setVisible(
false );
162 mWmsOptionsGroupBox->layout()->removeWidget( lblDpiMode );
163 cmbTilePixelRatio->setVisible(
false );
164 mWmsOptionsGroupBox->layout()->removeWidget( cmbTilePixelRatio );
165 lblTilePixelRatio->setVisible(
false );
166 mWmsOptionsGroupBox->layout()->removeWidget( lblTilePixelRatio );
172 mTestConnectionButton->hide();
173 mGroupBox->layout()->removeWidget( mTestConnectionButton );
178 mAuthGroupBox->hide();
179 mGroupBox->layout()->removeWidget( mAuthGroupBox );
182 connect( txtName, &QLineEdit::textChanged,
this, &QgsNewHttpConnection::nameChanged );
183 connect( txtUrl, &QLineEdit::textChanged,
this, &QgsNewHttpConnection::urlChanged );
185 buttonBox->button( QDialogButtonBox::Ok )->setDisabled(
true );
186 connect( txtName, &QLineEdit::textChanged,
this, &QgsNewHttpConnection::updateOkButtonState );
187 connect( txtUrl, &QLineEdit::textChanged,
this, &QgsNewHttpConnection::updateOkButtonState );
189 nameChanged( connectionName );
312 QStringList detailsParameters = { mServiceName.toLower(), mOriginalConnName };
326 cmbDpiMode->setCurrentIndex( cmbDpiMode->findData(
static_cast<int>( dpiMode ) ) );
328 cmbTilePixelRatio->setCurrentIndex( cmbTilePixelRatio->findData(
static_cast<int>( tilePixelRatio ) ) );
334 if ( version == QLatin1String(
"1.0.0" ) )
336 else if ( version == QLatin1String(
"1.1.0" ) )
338 else if ( version == QLatin1String(
"2.0.0" ) )
340 else if ( version == QLatin1String(
"OGC_API_FEATURES" ) )
342 cmbVersion->setCurrentIndex( versionIdx );
345 wfsVersionCurrentIndexChanged( versionIdx );
353 if ( pagingEnabled == QLatin1String(
"enabled" ) )
355 else if ( pagingEnabled == QLatin1String(
"disabled" ) )
361 mComboWfsFeatureMode->setCurrentIndex( std::max( mComboWfsFeatureMode->findData( wfsFeatureMode ), 0 ) );
401 const QString newConnectionName = txtName->text();
409 if ( !mOriginalConnName.isNull() && mOriginalConnName != newConnectionName )
415 QStringList detailsParameters = { mServiceName.toLower(), newConnectionName };
449 QString version = QStringLiteral(
"auto" );
450 switch ( cmbVersion->currentIndex() )
453 version = QStringLiteral(
"auto" );
456 version = QStringLiteral(
"1.0.0" );
459 version = QStringLiteral(
"1.1.0" );
462 version = QStringLiteral(
"2.0.0" );
465 version = QStringLiteral(
"OGC_API_FEATURES" );
473 QString pagingEnabled = QStringLiteral(
"default" );
474 switch ( cmbFeaturePaging->currentIndex() )
477 pagingEnabled = QStringLiteral(
"default" );
480 pagingEnabled = QStringLiteral(
"enabled" );
483 pagingEnabled = QStringLiteral(
"disabled" );
488 const QString featureMode = mComboWfsFeatureMode->currentData().toString();
492 QStringList credentialsParameters = { mServiceName.toLower(), newConnectionName };
497 if ( mHttpHeaders->isVisible() )
T value(const QString &dynamicKeyPart=QString()) const
Returns settings value.
bool setValue(const T &value, const QString &dynamicKeyPart=QString()) const
Set settings value.
bool exists(const QString &dynamicKeyPart=QString()) const
Returns true if the settings is contained in the underlying QSettings.