|
25 | 25 | #include <QRegExp>
|
26 | 26 | #include <QRegExpValidator>
|
27 | 27 |
|
28 |
| -QgsNewHttpConnection::QgsNewHttpConnection( QWidget *parent, ConnectionTypes types, const QString &baseKey, const QString &connectionName, Qt::WindowFlags fl ) |
| 28 | +QgsNewHttpConnection::QgsNewHttpConnection( QWidget *parent, ConnectionTypes types, const QString &baseKey, const QString &connectionName, QgsNewHttpConnection::Flags flags, Qt::WindowFlags fl ) |
29 | 29 | : QDialog( parent, fl )
|
30 | 30 | , mTypes( types )
|
31 | 31 | , mBaseKey( baseKey )
|
@@ -76,8 +76,23 @@ QgsNewHttpConnection::QgsNewHttpConnection( QWidget *parent, ConnectionTypes typ
|
76 | 76 | txtUrl->setText( settings.value( key + "/url" ).toString() );
|
77 | 77 |
|
78 | 78 | cbxIgnoreGetMapURI->setChecked( settings.value( key + "/ignoreGetMapURI", false ).toBool() );
|
79 |
| - cbxIgnoreAxisOrientation->setChecked( settings.value( key + "/ignoreAxisOrientation", false ).toBool() ); |
80 |
| - cbxInvertAxisOrientation->setChecked( settings.value( key + "/invertAxisOrientation", false ).toBool() ); |
| 79 | + if ( mTypes & ConnectionWfs && mTypes & ConnectionWms ) |
| 80 | + { |
| 81 | + cbxWfsIgnoreAxisOrientation->setChecked( settings.value( key + "/wfs/ignoreAxisOrientation", false ).toBool() ); |
| 82 | + cbxWfsInvertAxisOrientation->setChecked( settings.value( key + "/wfs/invertAxisOrientation", false ).toBool() ); |
| 83 | + cbxWmsIgnoreAxisOrientation->setChecked( settings.value( key + "/wms/ignoreAxisOrientation", false ).toBool() ); |
| 84 | + cbxWmsInvertAxisOrientation->setChecked( settings.value( key + "/wms/invertAxisOrientation", false ).toBool() ); |
| 85 | + } |
| 86 | + else if ( mTypes & ConnectionWfs ) |
| 87 | + { |
| 88 | + cbxWfsIgnoreAxisOrientation->setChecked( settings.value( key + "/ignoreAxisOrientation", false ).toBool() ); |
| 89 | + cbxWfsInvertAxisOrientation->setChecked( settings.value( key + "/invertAxisOrientation", false ).toBool() ); |
| 90 | + } |
| 91 | + else |
| 92 | + { |
| 93 | + cbxWmsIgnoreAxisOrientation->setChecked( settings.value( key + "/ignoreAxisOrientation", false ).toBool() ); |
| 94 | + cbxWmsInvertAxisOrientation->setChecked( settings.value( key + "/invertAxisOrientation", false ).toBool() ); |
| 95 | + } |
81 | 96 | cbxIgnoreGetFeatureInfoURI->setChecked( settings.value( key + "/ignoreGetFeatureInfoURI", false ).toBool() );
|
82 | 97 | cbxSmoothPixmapTransform->setChecked( settings.value( key + "/smoothPixmapTransform", false ).toBool() );
|
83 | 98 |
|
@@ -126,75 +141,65 @@ QgsNewHttpConnection::QgsNewHttpConnection( QWidget *parent, ConnectionTypes typ
|
126 | 141 | }
|
127 | 142 | }
|
128 | 143 |
|
129 |
| - if ( !( mTypes & ConnectionWms ) ) |
| 144 | + if ( !( mTypes & ConnectionWms ) && !( mTypes & ConnectionWcs ) ) |
130 | 145 | {
|
131 |
| - if ( !( mTypes & ConnectionWcs ) && |
132 |
| - !( mTypes & ConnectionWfs ) ) |
133 |
| - { |
134 |
| - cbxIgnoreAxisOrientation->setVisible( false ); |
135 |
| - cbxInvertAxisOrientation->setVisible( false ); |
136 |
| - mGroupBox->layout()->removeWidget( cbxIgnoreAxisOrientation ); |
137 |
| - mGroupBox->layout()->removeWidget( cbxInvertAxisOrientation ); |
138 |
| - } |
139 |
| - |
140 |
| - if ( mTypes & ConnectionWfs ) |
141 |
| - { |
142 |
| - cbxIgnoreAxisOrientation->setText( tr( "Ignore axis orientation (WFS 1.1/WFS 2.0)" ) ); |
143 |
| - } |
| 146 | + mWmsOptionsGroupBox->setVisible( false ); |
| 147 | + mGroupBox->layout()->removeWidget( mWmsOptionsGroupBox ); |
| 148 | + } |
| 149 | + if ( !( mTypes & ConnectionWfs ) ) |
| 150 | + { |
| 151 | + mWfsOptionsGroupBox->setVisible( false ); |
| 152 | + mGroupBox->layout()->removeWidget( mWfsOptionsGroupBox ); |
| 153 | + } |
144 | 154 |
|
145 |
| - if ( mTypes & ConnectionWcs ) |
146 |
| - { |
147 |
| - cbxIgnoreGetMapURI->setText( tr( "Ignore GetCoverage URI reported in capabilities" ) ); |
148 |
| - cbxIgnoreAxisOrientation->setText( tr( "Ignore axis orientation" ) ); |
149 |
| - } |
150 |
| - else |
| 155 | + if ( mTypes & ConnectionWcs ) |
| 156 | + { |
| 157 | + cbxIgnoreGetMapURI->setText( tr( "Ignore GetCoverage URI reported in capabilities" ) ); |
| 158 | + cbxWmsIgnoreAxisOrientation->setText( tr( "Ignore axis orientation" ) ); |
| 159 | + if ( !( mTypes & ConnectionWms ) ) |
151 | 160 | {
|
152 |
| - cbxIgnoreGetMapURI->setVisible( false ); |
153 |
| - cbxSmoothPixmapTransform->setVisible( false ); |
154 |
| - mGroupBox->layout()->removeWidget( cbxIgnoreGetMapURI ); |
155 |
| - mGroupBox->layout()->removeWidget( cbxSmoothPixmapTransform ); |
156 |
| - } |
| 161 | + mWmsOptionsGroupBox->setTitle( tr( "WCS Options" ) ); |
157 | 162 |
|
158 |
| - cbxIgnoreGetFeatureInfoURI->setVisible( false ); |
159 |
| - mGroupBox->layout()->removeWidget( cbxIgnoreGetFeatureInfoURI ); |
| 163 | + cbxIgnoreGetFeatureInfoURI->setVisible( false ); |
| 164 | + mGroupBox->layout()->removeWidget( cbxIgnoreGetFeatureInfoURI ); |
160 | 165 |
|
161 |
| - cmbDpiMode->setVisible( false ); |
162 |
| - mGroupBox->layout()->removeWidget( cmbDpiMode ); |
163 |
| - lblDpiMode->setVisible( false ); |
164 |
| - mGroupBox->layout()->removeWidget( lblDpiMode ); |
| 166 | + cmbDpiMode->setVisible( false ); |
| 167 | + mGroupBox->layout()->removeWidget( cmbDpiMode ); |
| 168 | + lblDpiMode->setVisible( false ); |
| 169 | + mGroupBox->layout()->removeWidget( lblDpiMode ); |
165 | 170 |
|
166 |
| - txtReferer->setVisible( false ); |
167 |
| - mGroupBox->layout()->removeWidget( txtReferer ); |
168 |
| - lblReferer->setVisible( false ); |
169 |
| - mGroupBox->layout()->removeWidget( lblReferer ); |
| 171 | + txtReferer->setVisible( false ); |
| 172 | + mGroupBox->layout()->removeWidget( txtReferer ); |
| 173 | + lblReferer->setVisible( false ); |
| 174 | + mGroupBox->layout()->removeWidget( lblReferer ); |
| 175 | + } |
170 | 176 | }
|
171 | 177 |
|
172 |
| - if ( !( mTypes & ConnectionWfs ) ) |
| 178 | + |
| 179 | + if ( !( flags & FlagShowTestConnection ) ) |
173 | 180 | {
|
174 |
| - lblVersion->setVisible( false ); |
175 |
| - cmbVersion->setVisible( false ); |
176 |
| - mGroupBox->layout()->removeWidget( cmbVersion ); |
177 |
| - lblMaxNumFeatures->setVisible( false ); |
178 |
| - mGroupBox->layout()->removeWidget( lblMaxNumFeatures ); |
179 |
| - txtMaxNumFeatures->setVisible( false ); |
180 |
| - mGroupBox->layout()->removeWidget( txtMaxNumFeatures ); |
| 181 | + mTestConnectionButton->hide(); |
| 182 | + mGroupBox->layout()->removeWidget( mTestConnectionButton ); |
181 | 183 | }
|
182 | 184 |
|
183 | 185 | // Adjust height
|
184 | 186 | int w = width();
|
185 | 187 | adjustSize();
|
186 | 188 | resize( w, height() );
|
187 | 189 |
|
188 |
| - on_txtName_textChanged( connectionName ); |
| 190 | + connect( txtName, &QLineEdit::textChanged, this, &QgsNewHttpConnection::nameChanged ); |
| 191 | + connect( txtUrl, &QLineEdit::textChanged, this, &QgsNewHttpConnection::urlChanged ); |
| 192 | + |
| 193 | + nameChanged( connectionName ); |
189 | 194 | }
|
190 | 195 |
|
191 |
| -void QgsNewHttpConnection::on_txtName_textChanged( const QString &text ) |
| 196 | +void QgsNewHttpConnection::nameChanged( const QString &text ) |
192 | 197 | {
|
193 | 198 | Q_UNUSED( text );
|
194 | 199 | buttonBox->button( QDialogButtonBox::Ok )->setDisabled( txtName->text().isEmpty() || txtUrl->text().isEmpty() );
|
195 | 200 | }
|
196 | 201 |
|
197 |
| -void QgsNewHttpConnection::on_txtUrl_textChanged( const QString &text ) |
| 202 | +void QgsNewHttpConnection::urlChanged( const QString &text ) |
198 | 203 | {
|
199 | 204 | Q_UNUSED( text );
|
200 | 205 | buttonBox->button( QDialogButtonBox::Ok )->setDisabled( txtName->text().isEmpty() || txtUrl->text().isEmpty() );
|
@@ -258,12 +263,22 @@ void QgsNewHttpConnection::accept()
|
258 | 263 |
|
259 | 264 | settings.setValue( key + "/url", url.toString() );
|
260 | 265 |
|
261 |
| - if ( mBaseKey == QLatin1String( "qgis/connections-wms/" ) || |
262 |
| - mBaseKey == QLatin1String( "qgis/connections-wcs/" ) || |
263 |
| - mBaseKey == QLatin1String( "qgis/connections-wfs/" ) ) |
| 266 | + if ( mTypes & ConnectionWfs && mTypes & ConnectionWms ) |
| 267 | + { |
| 268 | + settings.setValue( key + "/wfs/ignoreAxisOrientation", cbxWfsIgnoreAxisOrientation->isChecked() ); |
| 269 | + settings.setValue( key + "/wms/ignoreAxisOrientation", cbxWmsIgnoreAxisOrientation->isChecked() ); |
| 270 | + settings.setValue( key + "/wfs/invertAxisOrientation", cbxWfsInvertAxisOrientation->isChecked() ); |
| 271 | + settings.setValue( key + "/wms/invertAxisOrientation", cbxWmsInvertAxisOrientation->isChecked() ); |
| 272 | + } |
| 273 | + else if ( mTypes & ConnectionWfs ) |
| 274 | + { |
| 275 | + settings.setValue( key + "/ignoreAxisOrientation", cbxWfsIgnoreAxisOrientation->isChecked() ); |
| 276 | + settings.setValue( key + "/invertAxisOrientation", cbxWfsInvertAxisOrientation->isChecked() ); |
| 277 | + } |
| 278 | + else |
264 | 279 | {
|
265 |
| - settings.setValue( key + "/ignoreAxisOrientation", cbxIgnoreAxisOrientation->isChecked() ); |
266 |
| - settings.setValue( key + "/invertAxisOrientation", cbxInvertAxisOrientation->isChecked() ); |
| 280 | + settings.setValue( key + "/ignoreAxisOrientation", cbxWmsIgnoreAxisOrientation->isChecked() ); |
| 281 | + settings.setValue( key + "/invertAxisOrientation", cbxWmsInvertAxisOrientation->isChecked() ); |
267 | 282 | }
|
268 | 283 |
|
269 | 284 | if ( mBaseKey == QLatin1String( "qgis/connections-wms/" ) || mBaseKey == QLatin1String( "qgis/connections-wcs/" ) )
|
|
0 commit comments