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 mGroupBox->layout()->removeWidget( cbxIgnoreGetFeatureInfoURI );
154 sbFeatureCount->setVisible(
false );
155 mGroupBox->layout()->removeWidget( sbFeatureCount );
156 lblFeatureCount->setVisible(
false );
157 mGroupBox->layout()->removeWidget( lblFeatureCount );
159 cmbDpiMode->setVisible(
false );
160 mGroupBox->layout()->removeWidget( cmbDpiMode );
161 lblDpiMode->setVisible(
false );
162 mGroupBox->layout()->removeWidget( lblDpiMode );
163 cmbTilePixelRatio->setVisible(
false );
164 mGroupBox->layout()->removeWidget( cmbTilePixelRatio );
165 lblTilePixelRatio->setVisible(
false );
166 mGroupBox->layout()->removeWidget( lblTilePixelRatio );
172 mTestConnectionButton->hide();
173 mGroupBox->layout()->removeWidget( mTestConnectionButton );
178 mAuthGroupBox->hide();
179 mGroupBox->layout()->removeWidget( mAuthGroupBox );
182 const int w = width();
184 resize( w, height() );
186 connect( txtName, &QLineEdit::textChanged,
this, &QgsNewHttpConnection::nameChanged );
187 connect( txtUrl, &QLineEdit::textChanged,
this, &QgsNewHttpConnection::urlChanged );
189 buttonBox->button( QDialogButtonBox::Ok )->setDisabled(
true );
190 connect( txtName, &QLineEdit::textChanged,
this, &QgsNewHttpConnection::updateOkButtonState );
191 connect( txtUrl, &QLineEdit::textChanged,
this, &QgsNewHttpConnection::updateOkButtonState );
193 nameChanged( connectionName );
316 QStringList detailsParameters = { mServiceName.toLower(), mOriginalConnName };
330 cmbDpiMode->setCurrentIndex( cmbDpiMode->findData(
static_cast<int>( dpiMode ) ) );
332 cmbTilePixelRatio->setCurrentIndex( cmbTilePixelRatio->findData(
static_cast<int>( tilePixelRatio ) ) );
338 if ( version == QLatin1String(
"1.0.0" ) )
340 else if ( version == QLatin1String(
"1.1.0" ) )
342 else if ( version == QLatin1String(
"2.0.0" ) )
344 else if ( version == QLatin1String(
"OGC_API_FEATURES" ) )
346 cmbVersion->setCurrentIndex( versionIdx );
349 wfsVersionCurrentIndexChanged( versionIdx );
357 if ( pagingEnabled == QLatin1String(
"enabled" ) )
359 else if ( pagingEnabled == QLatin1String(
"disabled" ) )
365 mComboWfsFeatureMode->setCurrentIndex( std::max( mComboWfsFeatureMode->findData( wfsFeatureMode ), 0 ) );
400 const QString newConnectionName = txtName->text();
408 if ( !mOriginalConnName.isNull() && mOriginalConnName != newConnectionName )
414 QStringList detailsParameters = { mServiceName.toLower(), newConnectionName };
448 QString version = QStringLiteral(
"auto" );
449 switch ( cmbVersion->currentIndex() )
452 version = QStringLiteral(
"auto" );
455 version = QStringLiteral(
"1.0.0" );
458 version = QStringLiteral(
"1.1.0" );
461 version = QStringLiteral(
"2.0.0" );
464 version = QStringLiteral(
"OGC_API_FEATURES" );
472 QString pagingEnabled = QStringLiteral(
"default" );
473 switch ( cmbFeaturePaging->currentIndex() )
476 pagingEnabled = QStringLiteral(
"default" );
479 pagingEnabled = QStringLiteral(
"enabled" );
482 pagingEnabled = QStringLiteral(
"disabled" );
487 const QString featureMode = mComboWfsFeatureMode->currentData().toString();
491 QStringList credentialsParameters = { mServiceName.toLower(), newConnectionName };
496 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.