35 : QDialog( parent, fl )
37 , mServiceName( serviceName )
38 , mOriginalConnName( connectionName )
43 if ( mServiceName.startsWith( QLatin1String(
"qgis/" ) ) )
50 mServiceName = mServiceName.split(
'-' ).last().toUpper();
58 connect( buttonBox, &QDialogButtonBox::helpRequested,
this, &QgsNewHttpConnection::showHelp );
60 QString connectionType = mServiceName;
61 if ( mServiceName == QLatin1String(
"WMS" ) )
63 connectionType = QStringLiteral(
"WMS/WMTS" );
65 setWindowTitle( tr(
"Create a New %1 Connection" ).arg( connectionType ) );
67 txtName->setValidator(
new QRegularExpressionValidator( QRegularExpression(
"[^\\/]+" ), txtName ) );
76 cmbTilePixelRatio->clear();
82 cmbVersion->addItem( tr(
"Maximum" ) );
83 cmbVersion->addItem( tr(
"1.0" ) );
84 cmbVersion->addItem( tr(
"1.1" ) );
85 cmbVersion->addItem( tr(
"2.0" ) );
86 cmbVersion->addItem( tr(
"OGC API - Features" ) );
88 static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
89 this, &QgsNewHttpConnection::wfsVersionCurrentIndexChanged );
91 cmbFeaturePaging->clear();
92 cmbFeaturePaging->addItem( tr(
"Default (trust server capabilities)" ) );
93 cmbFeaturePaging->addItem( tr(
"Enabled" ) );
94 cmbFeaturePaging->addItem( tr(
"Disabled" ) );
95 connect( cmbFeaturePaging,
96 static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
97 this, &QgsNewHttpConnection::wfsFeaturePagingCurrentIndexChanged );
99 if ( !connectionName.isEmpty() )
104 txtName->setText( connectionName );
105 const QStringList detailParameters { mServiceName.toLower(), connectionName };
116 mWfsVersionDetectButton->setDisabled( txtUrl->text().isEmpty() );
120 mWmsOptionsGroupBox->setVisible(
false );
121 mGroupBox->layout()->removeWidget( mWmsOptionsGroupBox );
125 mWfsOptionsGroupBox->setVisible(
false );
126 mGroupBox->layout()->removeWidget( mWfsOptionsGroupBox );
130 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)" ) );
135 cbxIgnoreGetMapURI->setText( tr(
"Ignore GetCoverage URI reported in capabilities" ) );
136 cbxWmsIgnoreAxisOrientation->setText( tr(
"Ignore axis orientation" ) );
139 mWmsOptionsGroupBox->setTitle( tr(
"WCS Options" ) );
141 cbxIgnoreGetFeatureInfoURI->setVisible(
false );
142 mGroupBox->layout()->removeWidget( cbxIgnoreGetFeatureInfoURI );
144 sbFeatureCount->setVisible(
false );
145 mGroupBox->layout()->removeWidget( sbFeatureCount );
146 lblFeatureCount->setVisible(
false );
147 mGroupBox->layout()->removeWidget( lblFeatureCount );
149 cmbDpiMode->setVisible(
false );
150 mGroupBox->layout()->removeWidget( cmbDpiMode );
151 lblDpiMode->setVisible(
false );
152 mGroupBox->layout()->removeWidget( lblDpiMode );
153 cmbTilePixelRatio->setVisible(
false );
154 mGroupBox->layout()->removeWidget( cmbTilePixelRatio );
155 lblTilePixelRatio->setVisible(
false );
156 mGroupBox->layout()->removeWidget( lblTilePixelRatio );
162 mTestConnectionButton->hide();
163 mGroupBox->layout()->removeWidget( mTestConnectionButton );
168 mAuthGroupBox->hide();
169 mGroupBox->layout()->removeWidget( mAuthGroupBox );
172 const int w = width();
174 resize( w, height() );
176 connect( txtName, &QLineEdit::textChanged,
this, &QgsNewHttpConnection::nameChanged );
177 connect( txtUrl, &QLineEdit::textChanged,
this, &QgsNewHttpConnection::urlChanged );
179 buttonBox->button( QDialogButtonBox::Ok )->setDisabled(
true );
180 connect( txtName, &QLineEdit::textChanged,
this, &QgsNewHttpConnection::updateOkButtonState );
181 connect( txtUrl, &QLineEdit::textChanged,
this, &QgsNewHttpConnection::updateOkButtonState );
183 nameChanged( connectionName );
310 QStringList detailsParameters = { mServiceName.toLower(), mOriginalConnName };
324 cmbDpiMode->setCurrentIndex( cmbDpiMode->findData(
static_cast<int>( dpiMode ) ) );
326 cmbTilePixelRatio->setCurrentIndex( cmbTilePixelRatio->findData(
static_cast<int>( tilePixelRatio ) ) );
332 if ( version == QLatin1String(
"1.0.0" ) )
334 else if ( version == QLatin1String(
"1.1.0" ) )
336 else if ( version == QLatin1String(
"2.0.0" ) )
338 else if ( version == QLatin1String(
"OGC_API_FEATURES" ) )
340 cmbVersion->setCurrentIndex( versionIdx );
343 wfsVersionCurrentIndexChanged( versionIdx );
351 if ( pagingEnabled == QLatin1String(
"enabled" ) )
353 else if ( pagingEnabled == QLatin1String(
"disabled" ) )
392 const QString newConnectionName = txtName->text();
400 if ( !mOriginalConnName.isNull() && mOriginalConnName != newConnectionName )
406 QStringList detailsParameters = {mServiceName.toLower(), newConnectionName};
440 QString version = QStringLiteral(
"auto" );
441 switch ( cmbVersion->currentIndex() )
444 version = QStringLiteral(
"auto" );
447 version = QStringLiteral(
"1.0.0" );
450 version = QStringLiteral(
"1.1.0" );
453 version = QStringLiteral(
"2.0.0" );
456 version = QStringLiteral(
"OGC_API_FEATURES" );
463 QString pagingEnabled = QStringLiteral(
"default" );
464 switch ( cmbFeaturePaging->currentIndex() )
467 pagingEnabled = QStringLiteral(
"default" );
470 pagingEnabled = QStringLiteral(
"enabled" );
473 pagingEnabled = QStringLiteral(
"disabled" );
479 QStringList credentialsParameters = {mServiceName.toLower(), newConnectionName};
484 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.