QgsNewHttpConnection::QgsNewHttpConnection( QWidget *parent, const QString& baseKey, const QString& connName, Qt::WFlags fl ): QDialog( parent, fl ), mBaseKey( baseKey ), mOriginalConnName( connName ) { setupUi( this ); // It would be obviously much better to use mBaseKey also for credentials, // but for some strange reason a different hardcoded key was used instead. // WFS and WMS credentials were mixed with the same key WMS. // Only WMS and WFS providers are using QgsNewHttpConnection at this moment // using connection-wms and connection-wfs -> parse credential key fro it. mCredentialsBaseKey = mBaseKey.split( '-' ).last().toUpper(); if ( !connName.isEmpty() ) { // populate the dialog with the information stored for the connection // populate the fields with the stored setting parameters QSettings settings; QString key = mBaseKey + connName; QString credentialsKey = "/Qgis/" + mCredentialsBaseKey + "/" + connName; txtName->setText( connName ); txtUrl->setText( settings.value( key + "/url" ).toString() ); if ( mBaseKey == "/Qgis/connections-wms/" ) { cbxIgnoreGetMapURI->setChecked( settings.value( key + "/ignoreGetMapURI", false ).toBool() ); cbxIgnoreGetFeatureInfoURI->setChecked( settings.value( key + "/ignoreGetFeatureInfoURI", false ).toBool() ); } else { cbxIgnoreGetMapURI->setVisible( false ); cbxIgnoreGetFeatureInfoURI->setVisible( false ); } txtUserName->setText( settings.value( credentialsKey + "/username" ).toString() ); txtPassword->setText( settings.value( credentialsKey + "/password" ).toString() ); } on_txtName_textChanged( connName ); }
QgsNewHttpConnection::QgsNewHttpConnection( QWidget *parent, const QString& baseKey, const QString& connName, Qt::WFlags fl ): QDialog( parent, fl ), mBaseKey( baseKey ), mOriginalConnName( connName ) { setupUi( this ); QString service = baseKey.mid( 18, 3 ).toUpper(); setWindowTitle( tr( "Create a new %1 connection" ).arg( service ) ); // It would be obviously much better to use mBaseKey also for credentials, // but for some strange reason a different hardcoded key was used instead. // WFS and WMS credentials were mixed with the same key WMS. // Only WMS and WFS providers are using QgsNewHttpConnection at this moment // using connection-wms and connection-wfs -> parse credential key fro it. mCredentialsBaseKey = mBaseKey.split( '-' ).last().toUpper(); if ( !connName.isEmpty() ) { // populate the dialog with the information stored for the connection // populate the fields with the stored setting parameters QSettings settings; QString key = mBaseKey + connName; QString credentialsKey = "/Qgis/" + mCredentialsBaseKey + "/" + connName; txtName->setText( connName ); txtUrl->setText( settings.value( key + "/url" ).toString() ); cbxIgnoreGetMapURI->setChecked( settings.value( key + "/ignoreGetMapURI", false ).toBool() ); cbxIgnoreAxisOrientation->setChecked( settings.value( key + "/ignoreAxisOrientation", false ).toBool() ); cbxInvertAxisOrientation->setChecked( settings.value( key + "/invertAxisOrientation", false ).toBool() ); cbxIgnoreGetFeatureInfoURI->setChecked( settings.value( key + "/ignoreGetFeatureInfoURI", false ).toBool() ); cbxSmoothPixmapTransform->setChecked( settings.value( key + "/smoothPixmapTransform", false ).toBool() ); txtReferer->setText( settings.value( key + "/referer" ).toString() ); txtUserName->setText( settings.value( credentialsKey + "/username" ).toString() ); txtPassword->setText( settings.value( credentialsKey + "/password" ).toString() ); } if ( mBaseKey != "/Qgis/connections-wms/" ) { if ( mBaseKey == "/Qgis/connections-wcs/" ) { cbxIgnoreGetMapURI->setText( tr( "Ignore GetCoverage URI reported in capabilities" ) ); cbxIgnoreAxisOrientation->setText( tr( "Ignore axis orientation" ) ); } else { cbxIgnoreGetMapURI->setVisible( false ); cbxIgnoreAxisOrientation->setVisible( false ); cbxInvertAxisOrientation->setVisible( false ); mGroupBox->layout()->removeWidget( cbxIgnoreGetMapURI ); mGroupBox->layout()->removeWidget( cbxIgnoreAxisOrientation ); mGroupBox->layout()->removeWidget( cbxInvertAxisOrientation ); } cbxIgnoreGetFeatureInfoURI->setVisible( false ); mGroupBox->layout()->removeWidget( cbxIgnoreGetFeatureInfoURI ); txtReferer->setVisible( false ); mGroupBox->layout()->removeWidget( txtReferer ); lblReferer->setVisible( false ); mGroupBox->layout()->removeWidget( lblReferer ); // Adjust height int w = width(); adjustSize(); resize( w, height() ); } on_txtName_textChanged( connName ); }
QgsNewHttpConnection::QgsNewHttpConnection( QWidget *parent, const QString& baseKey, const QString& connName, Qt::WindowFlags fl ) : QDialog( parent, fl ) , mBaseKey( baseKey ) , mOriginalConnName( connName ) , mAuthConfigSelect( nullptr ) { setupUi( this ); QString service = baseKey.mid( 18, 3 ).toUpper(); setWindowTitle( tr( "Create a new %1 connection" ).arg( service ) ); // It would be obviously much better to use mBaseKey also for credentials, // but for some strange reason a different hardcoded key was used instead. // WFS and WMS credentials were mixed with the same key WMS. // Only WMS and WFS providers are using QgsNewHttpConnection at this moment // using connection-wms and connection-wfs -> parse credential key fro it. mCredentialsBaseKey = mBaseKey.split( '-' ).last().toUpper(); txtName->setValidator( new QRegExpValidator( QRegExp( "[^\\/]+" ), txtName ) ); cmbDpiMode->clear(); cmbDpiMode->addItem( tr( "all" ) ); cmbDpiMode->addItem( tr( "off" ) ); cmbDpiMode->addItem( tr( "QGIS" ) ); cmbDpiMode->addItem( tr( "UMN" ) ); cmbDpiMode->addItem( tr( "GeoServer" ) ); cmbVersion->clear(); cmbVersion->addItem( tr( "Auto-detect" ) ); cmbVersion->addItem( tr( "1.0" ) ); cmbVersion->addItem( tr( "1.1" ) ); cmbVersion->addItem( tr( "2.0" ) ); mAuthConfigSelect = new QgsAuthConfigSelect( this ); tabAuth->insertTab( 1, mAuthConfigSelect, tr( "Configurations" ) ); if ( !connName.isEmpty() ) { // populate the dialog with the information stored for the connection // populate the fields with the stored setting parameters QSettings settings; QString key = mBaseKey + connName; QString credentialsKey = "/Qgis/" + mCredentialsBaseKey + '/' + connName; txtName->setText( connName ); txtUrl->setText( settings.value( key + "/url" ).toString() ); cbxIgnoreGetMapURI->setChecked( settings.value( key + "/ignoreGetMapURI", false ).toBool() ); cbxIgnoreAxisOrientation->setChecked( settings.value( key + "/ignoreAxisOrientation", false ).toBool() ); cbxInvertAxisOrientation->setChecked( settings.value( key + "/invertAxisOrientation", false ).toBool() ); cbxIgnoreGetFeatureInfoURI->setChecked( settings.value( key + "/ignoreGetFeatureInfoURI", false ).toBool() ); cbxSmoothPixmapTransform->setChecked( settings.value( key + "/smoothPixmapTransform", false ).toBool() ); int dpiIdx; switch ( settings.value( key + "/dpiMode", 7 ).toInt() ) { case 0: // off dpiIdx = 1; break; case 1: // QGIS dpiIdx = 2; break; case 2: // UMN dpiIdx = 3; break; case 4: // GeoServer dpiIdx = 4; break; default: // other => all dpiIdx = 0; break; } cmbDpiMode->setCurrentIndex( dpiIdx ); QString version = settings.value( key + "/version" ).toString(); int versionIdx = 0; // AUTO if ( version == "1.0.0" ) versionIdx = 1; else if ( version == "1.1.0" ) versionIdx = 2; else if ( version == "2.0.0" ) versionIdx = 3; cmbVersion->setCurrentIndex( versionIdx ); txtReferer->setText( settings.value( key + "/referer" ).toString() ); txtMaxNumFeatures->setText( settings.value( key + "/maxnumfeatures" ).toString() ); txtUserName->setText( settings.value( credentialsKey + "/username" ).toString() ); txtPassword->setText( settings.value( credentialsKey + "/password" ).toString() ); QString authcfg = settings.value( credentialsKey + "/authcfg" ).toString(); mAuthConfigSelect->setConfigId( authcfg ); if ( !authcfg.isEmpty() ) { tabAuth->setCurrentIndex( tabAuth->indexOf( mAuthConfigSelect ) ); } } if ( mBaseKey != "/Qgis/connections-wms/" ) { if ( mBaseKey != "/Qgis/connections-wcs/" && mBaseKey != "/Qgis/connections-wfs/" ) { cbxIgnoreAxisOrientation->setVisible( false ); cbxInvertAxisOrientation->setVisible( false ); mGroupBox->layout()->removeWidget( cbxIgnoreAxisOrientation ); mGroupBox->layout()->removeWidget( cbxInvertAxisOrientation ); } if ( mBaseKey == "/Qgis/connections-wfs/" ) { cbxIgnoreAxisOrientation->setText( tr( "Ignore axis orientation (WFS 1.1/WFS 2.0)" ) ); } if ( mBaseKey == "/Qgis/connections-wcs/" ) { cbxIgnoreGetMapURI->setText( tr( "Ignore GetCoverage URI reported in capabilities" ) ); cbxIgnoreAxisOrientation->setText( tr( "Ignore axis orientation" ) ); } else { cbxIgnoreGetMapURI->setVisible( false ); cbxSmoothPixmapTransform->setVisible( false ); mGroupBox->layout()->removeWidget( cbxIgnoreGetMapURI ); mGroupBox->layout()->removeWidget( cbxSmoothPixmapTransform ); } cbxIgnoreGetFeatureInfoURI->setVisible( false ); mGroupBox->layout()->removeWidget( cbxIgnoreGetFeatureInfoURI ); cmbDpiMode->setVisible( false ); mGroupBox->layout()->removeWidget( cmbDpiMode ); lblDpiMode->setVisible( false ); mGroupBox->layout()->removeWidget( lblDpiMode ); txtReferer->setVisible( false ); mGroupBox->layout()->removeWidget( txtReferer ); lblReferer->setVisible( false ); mGroupBox->layout()->removeWidget( lblReferer ); } if ( mBaseKey != "/Qgis/connections-wfs/" ) { cmbVersion->setVisible( false ); mGroupBox->layout()->removeWidget( cmbVersion ); lblMaxNumFeatures->setVisible( false ); mGroupBox->layout()->removeWidget( lblMaxNumFeatures ); txtMaxNumFeatures->setVisible( false ); mGroupBox->layout()->removeWidget( txtMaxNumFeatures ); } // Adjust height int w = width(); adjustSize(); resize( w, height() ); on_txtName_textChanged( connName ); }