Skip to content

Commit

Permalink
use standard "Referer" field in the new WMS connection dialog instead of
Browse files Browse the repository at this point in the history
custom field in the WMS options group
  • Loading branch information
alexbruy committed Apr 23, 2020
1 parent 7fcdbca commit 3dd44e4
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 91 deletions.
12 changes: 2 additions & 10 deletions src/gui/qgsnewhttpconnection.cpp
Expand Up @@ -129,15 +129,9 @@ QgsNewHttpConnection::QgsNewHttpConnection( QWidget *parent, ConnectionTypes typ
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 ( !( flags & FlagShowTestConnection ) )
{
mTestConnectionButton->hide();
Expand Down Expand Up @@ -328,7 +322,7 @@ void QgsNewHttpConnection::updateServiceSpecificSettings()
// Enable/disable these items per WFS versions
wfsVersionCurrentIndexChanged( versionIdx );

txtReferer->setText( settings.value( wmsKey + "/referer" ).toString() );
mRefererLineEdit->setText( settings.value( wmsKey + "/referer" ).toString() );
txtMaxNumFeatures->setText( settings.value( wfsKey + "/maxnumfeatures" ).toString() );

// Only default to paging enabled if WFS 2.0.0 or higher
Expand All @@ -337,8 +331,6 @@ void QgsNewHttpConnection::updateServiceSpecificSettings()
cbxWfsFeaturePaging->setChecked( pagingEnabled );
}



// Mega ewwww. all this is taken from Qt's QUrl::setEncodedPath compatibility helper.
// (I can't see any way to port the below code to NOT require this).

Expand Down Expand Up @@ -503,7 +495,7 @@ void QgsNewHttpConnection::accept()

settings.setValue( wmsKey + "/dpiMode", dpiMode );

settings.setValue( wmsKey + "/referer", txtReferer->text() );
settings.setValue( wmsKey + "/referer", mRefererLineEdit->text() );
}
if ( mTypes & ConnectionWms )
{
Expand Down
5 changes: 3 additions & 2 deletions src/providers/wms/qgswmssourceselect.cpp
Expand Up @@ -173,7 +173,8 @@ void QgsWMSSourceSelect::populateConnectionList()

void QgsWMSSourceSelect::btnNew_clicked()
{
QgsNewHttpConnection *nc = new QgsNewHttpConnection( this );
QgsNewHttpConnection *nc = new QgsNewHttpConnection( this, QgsNewHttpConnection::ConnectionWms, QStringLiteral( "qgis/connections-wms/" ), QString(), QgsNewHttpConnection::FlagShowHttpSettings );


if ( nc->exec() )
{
Expand All @@ -186,7 +187,7 @@ void QgsWMSSourceSelect::btnNew_clicked()

void QgsWMSSourceSelect::btnEdit_clicked()
{
QgsNewHttpConnection *nc = new QgsNewHttpConnection( this, QgsNewHttpConnection::ConnectionWms, QStringLiteral( "qgis/connections-wms/" ), cmbConnections->currentText() );
QgsNewHttpConnection *nc = new QgsNewHttpConnection( this, QgsNewHttpConnection::ConnectionWms, QStringLiteral( "qgis/connections-wms/" ), cmbConnections->currentText(), QgsNewHttpConnection::FlagShowHttpSettings );

if ( nc->exec() )
{
Expand Down
140 changes: 61 additions & 79 deletions src/ui/qgsnewhttpconnectionbase.ui
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>448</width>
<height>828</height>
<height>761</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -103,67 +103,54 @@
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="cbxIgnoreGetFeatureInfoURI">
<widget class="QCheckBox" name="cbxWmsIgnoreAxisOrientation">
<property name="text">
<string>Ignore GetFeatureInfo URI reported in capabilities</string>
<string>Ignore axis orientation (WMS 1.3/WMTS)</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="cbxIgnoreGetMapURI">
<widget class="QCheckBox" name="cbxIgnoreGetFeatureInfoURI">
<property name="text">
<string>Ignore GetMap/GetTile URI reported in capabilities</string>
<string>Ignore GetFeatureInfo URI reported in capabilities</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="cbxWmsIgnoreAxisOrientation">
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="cbxIgnoreGetMapURI">
<property name="text">
<string>Ignore axis orientation (WMS 1.3/WMTS)</string>
<string>Ignore GetMap/GetTile URI reported in capabilities</string>
</property>
</widget>
</item>
<item row="10" column="0" colspan="2">
<item row="9" column="0" colspan="2">
<widget class="QCheckBox" name="cbxSmoothPixmapTransform">
<property name="text">
<string>Smooth pixmap transform</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="cbxWmsInvertAxisOrientation">
<property name="text">
<string>Invert axis orientation</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblDpiMode">
<property name="text">
<string>DPI-&amp;Mode</string>
</property>
<property name="buddy">
<cstring>cmbDpiMode</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="txtReferer"/>
<widget class="QComboBox" name="cmbDpiMode"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lblReferer">
<widget class="QLabel" name="lblDpiMode">
<property name="text">
<string>&amp;Referer</string>
<string>DPI-&amp;Mode</string>
</property>
<property name="buddy">
<cstring>txtReferer</cstring>
<cstring>cmbDpiMode</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="cmbDpiMode"/>
</item>
<item row="5" column="0" colspan="2">
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="cbxWmsIgnoreReportedLayerExtents">
<property name="text">
<string>Ignore reported layer extents</string>
Expand All @@ -173,36 +160,26 @@
</layout>
</widget>
</item>
<item row="6" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0" colspan="2">
<widget class="QGroupBox" name="mWfsOptionsGroupBox">
<property name="title">
<string>WFS Options</string>
</property>
<layout class="QGridLayout" name="gridLayout1">
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="cbxWfsIgnoreAxisOrientation">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="lblVersion">
<property name="text">
<string>Ignore axis orientation (WFS 1.1/WFS 2.0)</string>
<string>Version</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="cbxWfsInvertAxisOrientation">
<item row="0" column="1">
<widget class="QComboBox" name="cmbVersion"/>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="mWfsVersionDetectButton">
<property name="text">
<string>Invert axis orientation</string>
<string>Detect</string>
</property>
</widget>
</item>
Expand All @@ -213,35 +190,35 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lblVersion">
<item row="1" column="1" colspan="2">
<widget class="QLineEdit" name="txtMaxNumFeatures">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter a number to limit the maximum number of features retrieved per feature request. If let to empty, no limit is set.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lblPageSize">
<property name="text">
<string>Version</string>
<string>Page size</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="txtMaxNumFeatures">
<item row="3" column="1" colspan="2">
<widget class="QLineEdit" name="txtPageSize">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter a number to limit the maximum number of features retrieved per feature request. If let to empty, no limit is set.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter a number to limit the maximum number of features retrieved in a single GetFeature request when paging is enabled. If let to empty, server default will apply.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="layoutWfsVersion">
<item>
<widget class="QComboBox" name="cmbVersion"/>
</item>
<item>
<widget class="QPushButton" name="mWfsVersionDetectButton">
<property name="text">
<string>Detect</string>
</property>
</widget>
</item>
</layout>
<item row="4" column="0" colspan="3">
<widget class="QCheckBox" name="cbxWfsIgnoreAxisOrientation">
<property name="text">
<string>Ignore axis orientation (WFS 1.1/WFS 2.0)</string>
</property>
</widget>
</item>
<item row="2" column="0">
<item row="2" column="0" colspan="3">
<widget class="QCheckBox" name="cbxWfsFeaturePaging">
<property name="text">
<string>Enable feature paging</string>
Expand All @@ -251,17 +228,10 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lblPageSize">
<item row="5" column="0" colspan="3">
<widget class="QCheckBox" name="cbxWfsInvertAxisOrientation">
<property name="text">
<string>Page size</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="txtPageSize">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter a number to limit the maximum number of features retrieved in a single GetFeature request when paging is enabled. If let to empty, server default will apply.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>Invert axis orientation</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -325,6 +295,19 @@
</layout>
</widget>
</item>
<item row="6" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
Expand Down Expand Up @@ -362,7 +345,6 @@
<tabstop>txtPageSize</tabstop>
<tabstop>cbxWfsIgnoreAxisOrientation</tabstop>
<tabstop>cbxWfsInvertAxisOrientation</tabstop>
<tabstop>txtReferer</tabstop>
<tabstop>cmbDpiMode</tabstop>
<tabstop>cbxIgnoreGetMapURI</tabstop>
<tabstop>cbxIgnoreGetFeatureInfoURI</tabstop>
Expand Down

0 comments on commit 3dd44e4

Please sign in to comment.