36 : QDialog( parent, fl )
38 , mServiceName( serviceName )
39 , mOriginalConnName( connectionName )
44 if ( mServiceName.startsWith( QLatin1String(
"qgis/" ) ) )
51 mServiceName = mServiceName.split(
'-' ).last().toUpper();
59 connect( buttonBox, &QDialogButtonBox::helpRequested,
this, &QgsNewHttpConnection::showHelp );
61 QString connectionType = mServiceName;
62 if ( mServiceName == QLatin1String(
"WMS" ) )
64 connectionType = QStringLiteral(
"WMS/WMTS" );
66 setWindowTitle( tr(
"Create a New %1 Connection" ).arg( connectionType ) );
68 txtName->setValidator(
new QRegularExpressionValidator( QRegularExpression(
"[^\\/]+" ), txtName ) );
77 cmbTilePixelRatio->clear();
83 cmbVersion->addItem( tr(
"Maximum" ) );
84 cmbVersion->addItem( tr(
"1.0" ) );
85 cmbVersion->addItem( tr(
"1.1" ) );
86 cmbVersion->addItem( tr(
"2.0" ) );
87 cmbVersion->addItem( tr(
"OGC API - Features" ) );
89 static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
90 this, &QgsNewHttpConnection::wfsVersionCurrentIndexChanged );
92 cmbFeaturePaging->clear();
93 cmbFeaturePaging->addItem( tr(
"Default (trust server capabilities)" ) );
94 cmbFeaturePaging->addItem( tr(
"Enabled" ) );
95 cmbFeaturePaging->addItem( tr(
"Disabled" ) );
96 connect( cmbFeaturePaging,
97 static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
98 this, &QgsNewHttpConnection::wfsFeaturePagingCurrentIndexChanged );
100 if ( !connectionName.isEmpty() )
105 txtName->setText( connectionName );
106 const QStringList detailParameters { mServiceName.toLower(), connectionName };
117 mWfsVersionDetectButton->setDisabled( txtUrl->text().isEmpty() );
121 mWmsOptionsGroupBox->setVisible(
false );
122 mGroupBox->layout()->removeWidget( mWmsOptionsGroupBox );
126 mWfsOptionsGroupBox->setVisible(
false );
127 mGroupBox->layout()->removeWidget( mWfsOptionsGroupBox );
131 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)" ) );
136 cbxIgnoreGetMapURI->setText( tr(
"Ignore GetCoverage URI reported in capabilities" ) );
137 cbxWmsIgnoreAxisOrientation->setText( tr(
"Ignore axis orientation" ) );
140 mWmsOptionsGroupBox->setTitle( tr(
"WCS Options" ) );
142 cbxIgnoreGetFeatureInfoURI->setVisible(
false );
143 mGroupBox->layout()->removeWidget( cbxIgnoreGetFeatureInfoURI );
145 sbFeatureCount->setVisible(
false );
146 mGroupBox->layout()->removeWidget( sbFeatureCount );
147 lblFeatureCount->setVisible(
false );
148 mGroupBox->layout()->removeWidget( lblFeatureCount );
150 cmbDpiMode->setVisible(
false );
151 mGroupBox->layout()->removeWidget( cmbDpiMode );
152 lblDpiMode->setVisible(
false );
153 mGroupBox->layout()->removeWidget( lblDpiMode );
154 cmbTilePixelRatio->setVisible(
false );
155 mGroupBox->layout()->removeWidget( cmbTilePixelRatio );
156 lblTilePixelRatio->setVisible(
false );
157 mGroupBox->layout()->removeWidget( lblTilePixelRatio );
163 mTestConnectionButton->hide();
164 mGroupBox->layout()->removeWidget( mTestConnectionButton );
169 mAuthGroupBox->hide();
170 mGroupBox->layout()->removeWidget( mAuthGroupBox );
173 const int w = width();
175 resize( w, height() );
177 connect( txtName, &QLineEdit::textChanged,
this, &QgsNewHttpConnection::nameChanged );
178 connect( txtUrl, &QLineEdit::textChanged,
this, &QgsNewHttpConnection::urlChanged );
180 buttonBox->button( QDialogButtonBox::Ok )->setDisabled(
true );
181 connect( txtName, &QLineEdit::textChanged,
this, &QgsNewHttpConnection::updateOkButtonState );
182 connect( txtUrl, &QLineEdit::textChanged,
this, &QgsNewHttpConnection::updateOkButtonState );
184 nameChanged( connectionName );
311 QStringList detailsParameters = { mServiceName.toLower(), mOriginalConnName };
325 cmbDpiMode->setCurrentIndex( cmbDpiMode->findData(
static_cast<int>( dpiMode ) ) );
327 cmbTilePixelRatio->setCurrentIndex( cmbTilePixelRatio->findData(
static_cast<int>( tilePixelRatio ) ) );
333 if ( version == QLatin1String(
"1.0.0" ) )
335 else if ( version == QLatin1String(
"1.1.0" ) )
337 else if ( version == QLatin1String(
"2.0.0" ) )
339 else if ( version == QLatin1String(
"OGC_API_FEATURES" ) )
341 cmbVersion->setCurrentIndex( versionIdx );
344 wfsVersionCurrentIndexChanged( versionIdx );
352 if ( pagingEnabled == QLatin1String(
"enabled" ) )
354 else if ( pagingEnabled == QLatin1String(
"disabled" ) )
393 const QString newConnectionName = txtName->text();
401 if ( !mOriginalConnName.isNull() && mOriginalConnName != newConnectionName )
407 QStringList detailsParameters = {mServiceName.toLower(), newConnectionName};
441 QString version = QStringLiteral(
"auto" );
442 switch ( cmbVersion->currentIndex() )
445 version = QStringLiteral(
"auto" );
448 version = QStringLiteral(
"1.0.0" );
451 version = QStringLiteral(
"1.1.0" );
454 version = QStringLiteral(
"2.0.0" );
457 version = QStringLiteral(
"OGC_API_FEATURES" );
464 QString pagingEnabled = QStringLiteral(
"default" );
465 switch ( cmbFeaturePaging->currentIndex() )
468 pagingEnabled = QStringLiteral(
"default" );
471 pagingEnabled = QStringLiteral(
"enabled" );
474 pagingEnabled = QStringLiteral(
"disabled" );
480 QStringList credentialsParameters = {mServiceName.toLower(), newConnectionName};
485 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.