[QGIS Commit] r15559 - in trunk/qgis/src: app ui
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Tue Mar 22 04:47:46 EDT 2011
Author: jef
Date: 2011-03-22 01:47:46 -0700 (Tue, 22 Mar 2011)
New Revision: 15559
Modified:
trunk/qgis/src/app/qgsmanageconnectionsdialog.cpp
trunk/qgis/src/app/qgsnewhttpconnection.cpp
trunk/qgis/src/app/qgswmssourceselect.cpp
trunk/qgis/src/ui/qgsnewhttpconnectionbase.ui
trunk/qgis/src/ui/qgswmssourceselectbase.ui
Log:
[FEATURE] move option to ignore GetMap and GetFeatureInfo URI from WMS GetCapabilities to connection
Modified: trunk/qgis/src/app/qgsmanageconnectionsdialog.cpp
===================================================================
--- trunk/qgis/src/app/qgsmanageconnectionsdialog.cpp 2011-03-22 08:45:52 UTC (rev 15558)
+++ trunk/qgis/src/app/qgsmanageconnectionsdialog.cpp 2011-03-22 08:47:46 UTC (rev 15559)
@@ -286,6 +286,8 @@
QDomElement el = doc.createElement( "wms" );
el.setAttribute( "name", connections[ i ] );
el.setAttribute( "url", settings.value( path + connections[ i ] + "/url", "" ).toString() );
+ el.setAttribute( "ignoreGetMapURI", settings.value( path + connections[i] + "/ignoreGetMapURI", false ).toBool() ? "true" : "false" );
+ el.setAttribute( "ignoreGetFeatureInfoURI", settings.value( path + connections[i] + "/ignoreGetFeatureInfoURI", false ).toBool() ? "true" : "false" );
path = "/Qgis/WMS/";
el.setAttribute( "username", settings.value( path + connections[ i ] + "/username", "" ).toString() );
@@ -423,6 +425,8 @@
// no dups detected or overwrite is allowed
settings.beginGroup( "/Qgis/connections-wms" );
settings.setValue( QString( "/" + connectionName + "/url" ) , child.attribute( "url" ) );
+ settings.setValue( QString( "/" + connectionName + "/ignoreGetMapURI" ), child.attribute( "ignoreGetMapURI" ) == "true" );
+ settings.setValue( QString( "/" + connectionName + "/ignoreGetFeatureInfoURI" ), child.attribute( "ignoreGetFeatureInfoURI" ) == "true" );
settings.endGroup();
if ( !child.attribute( "username" ).isEmpty() )
Modified: trunk/qgis/src/app/qgsnewhttpconnection.cpp
===================================================================
--- trunk/qgis/src/app/qgsnewhttpconnection.cpp 2011-03-22 08:45:52 UTC (rev 15558)
+++ trunk/qgis/src/app/qgsnewhttpconnection.cpp 2011-03-22 08:47:46 UTC (rev 15559)
@@ -41,6 +41,18 @@
QString credentialsKey = "/Qgis/WMS/" + 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() );
}
@@ -96,6 +108,12 @@
url.setEncodedQueryItems( params );
settings.setValue( key + "/url", url.toString() );
+ if ( mBaseKey == "/Qgis/connections-wms/" )
+ {
+ settings.setValue( key + "/ignoreGetMapURI", cbxIgnoreGetMapURI->isChecked() );
+ settings.setValue( key + "/ignoreGetFeatureInfoURI", cbxIgnoreGetFeatureInfoURI->isChecked() );
+ }
+
settings.setValue( credentialsKey + "/username", txtUserName->text() );
settings.setValue( credentialsKey + "/password", txtPassword->text() );
Modified: trunk/qgis/src/app/qgswmssourceselect.cpp
===================================================================
--- trunk/qgis/src/app/qgswmssourceselect.cpp 2011-03-22 08:45:52 UTC (rev 15558)
+++ trunk/qgis/src/app/qgswmssourceselect.cpp 2011-03-22 08:47:46 UTC (rev 15559)
@@ -68,9 +68,6 @@
mAddButton->setEnabled( false );
populateConnectionList();
- cbxIgnoreGetMap->setEnabled( false );
- cbxIgnoreGetFeatureInfo->setEnabled( false );
-
QHBoxLayout *layout = new QHBoxLayout;
mImageFormatGroup = new QButtonGroup;
@@ -411,57 +408,6 @@
lstLayers->expandItem( lstLayers->topLevelItem( 0 ) );
}
- if ( wmsProvider->baseUrl() != wmsProvider->getMapUrl() )
- {
- QApplication::setOverrideCursor( Qt::ArrowCursor );
-
- if ( QMessageBox::information( this,
- tr( "WMS Provider" ),
- tr( "Advertised GetMap URL\n\n %2\n\nis different from GetCapabilities URL\n\n %1\n\n"
- "This might be an server configuration error. Should the URL be used?" )
- .arg( wmsProvider->baseUrl() )
- .arg( wmsProvider->getMapUrl() ),
- QMessageBox::Yes | QMessageBox::No ) == QMessageBox::Yes )
- {
- cbxIgnoreGetMap->setChecked( false );
- }
- else
- {
- cbxIgnoreGetMap->setChecked( true );
- }
- cbxIgnoreGetMap->setEnabled( true );
-
- QApplication::restoreOverrideCursor();
- }
- else
- {
- cbxIgnoreGetMap->setEnabled( false );
- cbxIgnoreGetMap->setChecked( false );
- }
-
- if ( wmsProvider->baseUrl() != wmsProvider->getFeatureInfoUrl() )
- {
- QApplication::setOverrideCursor( Qt::ArrowCursor );
-
- if ( QMessageBox::information( this,
- tr( "WMS Provider" ),
- tr( "Advertised GetFeatureInfo URL\n\n %2\n\nis different from GetCapabilities URL\n\n %1\n\n"
- "This might be an server configuration error. Should the URL be used?" )
- .arg( wmsProvider->baseUrl() )
- .arg( wmsProvider->getFeatureInfoUrl() ),
- QMessageBox::Yes | QMessageBox::No ) == QMessageBox::Yes )
- {
- cbxIgnoreGetFeatureInfo->setChecked( false );
- }
- else
- {
- cbxIgnoreGetFeatureInfo->setChecked( true );
- }
- cbxIgnoreGetFeatureInfo->setEnabled( true );
-
- QApplication::restoreOverrideCursor();
- }
-
return true;
}
@@ -475,12 +421,9 @@
QString credentialsKey = "/Qgis/WMS/" + cmbConnections->currentText();
QStringList connStringParts;
- QString part;
- connStringParts += settings.value( key + "/url" ).toString();
-
mConnName = cmbConnections->currentText();
- mConnectionInfo = connStringParts.join( " " );
+ mConnectionInfo = settings.value( key + "/url" ).toString();
// Check for credentials and prepend to the connection info
QString username = settings.value( credentialsKey + "/username" ).toString();
@@ -495,7 +438,30 @@
mConnectionInfo = "username=" + username + ",password=" + password + ",url=" + mConnectionInfo;
}
+ bool ignoreGetMap = settings.value( key + "/ignoreGetMapURI", false ).toBool();
+ bool ignoreGetFeatureInfo = settings.value( key + "/ignoreGetFeatureInfoURI", false ).toBool();
+ if ( ignoreGetMap || ignoreGetFeatureInfo )
+ {
+ QString connArgs = "ignoreUrl=";
+ if ( ignoreGetMap )
+ {
+ connArgs += "GetMap";
+ if ( ignoreGetFeatureInfo )
+ connArgs += ";";
+ }
+ if ( ignoreGetFeatureInfo )
+ connArgs += "GetFeatureInfo";
+ if ( mConnectionInfo.startsWith( "username=" ) )
+ {
+ mConnectionInfo.prepend( connArgs + "," );
+ }
+ else
+ {
+ mConnectionInfo.prepend( connArgs + ",url=" );
+ }
+ }
+
QgsDebugMsg( QString( "Connection info: '%1'." ).arg( mConnectionInfo ) );
@@ -572,31 +538,6 @@
}
}
- if ( cbxIgnoreGetMap->isChecked() || cbxIgnoreGetFeatureInfo->isChecked() )
- {
- QString connArgs = "ignoreUrl=";
-
- if ( cbxIgnoreGetMap->isChecked() )
- {
- connArgs += "GetMap";
- if ( cbxIgnoreGetFeatureInfo->isChecked() )
- connArgs += ";GetFeatureInfo";
- }
- else
- {
- connArgs += "GetFeatureInfo";
- }
-
- if ( connInfo.startsWith( "username=" ) || connInfo.startsWith( "tiled=" ) )
- {
- connInfo.prepend( connArgs + "," );
- }
- else
- {
- connInfo.prepend( connArgs + ",url=" );
- }
- }
-
QgisApp::instance()->addRasterLayer( connInfo,
leLayerName->text().isEmpty() ? layers.join( "/" ) : leLayerName->text(),
"wms", layers, styles, format, crs );
@@ -823,7 +764,7 @@
}
}
- gbCRS->setTitle( tr( "Coordinate Reference System (%n available)", "crs count", mCRSs.count() ) );
+ gbCRS->setTitle( tr( "Options (%n coordinate reference systems available)", "crs count", mCRSs.count() ) );
btnChangeSpatialRefSys->setDisabled( mCRSs.isEmpty() );
if ( !layers.isEmpty() && !mCRSs.isEmpty() )
Modified: trunk/qgis/src/ui/qgsnewhttpconnectionbase.ui
===================================================================
--- trunk/qgis/src/ui/qgsnewhttpconnectionbase.ui 2011-03-22 08:45:52 UTC (rev 15558)
+++ trunk/qgis/src/ui/qgsnewhttpconnectionbase.ui 2011-03-22 08:47:46 UTC (rev 15559)
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>512</width>
- <height>254</height>
+ <width>507</width>
+ <height>322</height>
</rect>
</property>
<property name="windowTitle">
@@ -20,44 +20,19 @@
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
+ <item row="2" column="0">
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
<item row="0" column="0">
<widget class="QGroupBox" name="GroupBox1">
<property name="title">
<string>Connection details</string>
</property>
<layout class="QGridLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="TextLabel1_2">
- <property name="text">
- <string>Name</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- <property name="margin">
- <number>5</number>
- </property>
- <property name="buddy">
- <cstring>txtName</cstring>
- </property>
- </widget>
- </item>
- <item row="0" column="1" colspan="4">
- <widget class="QLineEdit" name="txtName">
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Name of the new connection</string>
- </property>
- <property name="frame">
- <bool>true</bool>
- </property>
- </widget>
- </item>
<item row="1" column="0">
<widget class="QLabel" name="TextLabel1">
<property name="text">
@@ -71,14 +46,7 @@
</property>
</widget>
</item>
- <item row="1" column="1" colspan="4">
- <widget class="QLineEdit" name="txtUrl">
- <property name="toolTip">
- <string>HTTP address of the Web Map Server</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0" colspan="5">
+ <item row="4" column="0" colspan="3">
<widget class="QLabel" name="label">
<property name="text">
<string>If the service requires basic authentication, enter a user name and optional password</string>
@@ -91,7 +59,17 @@
</property>
</widget>
</item>
- <item row="3" column="0" colspan="2">
+ <item row="6" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Password</string>
+ </property>
+ <property name="buddy">
+ <cstring>txtPassword</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>&User name</string>
@@ -101,57 +79,76 @@
</property>
</widget>
</item>
- <item row="3" column="2">
- <widget class="QLineEdit" name="txtUserName">
- <property name="maximumSize">
- <size>
- <width>120</width>
- <height>16777215</height>
- </size>
- </property>
- </widget>
- </item>
- <item row="3" column="3">
- <widget class="QLabel" name="label_3">
+ <item row="0" column="0">
+ <widget class="QLabel" name="TextLabel1_2">
<property name="text">
- <string>Password</string>
+ <string>Name</string>
</property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ <property name="margin">
+ <number>5</number>
+ </property>
<property name="buddy">
- <cstring>txtPassword</cstring>
+ <cstring>txtName</cstring>
</property>
</widget>
</item>
- <item row="3" column="4">
- <widget class="QLineEdit" name="txtPassword">
- <property name="maximumSize">
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="txtName">
+ <property name="minimumSize">
<size>
- <width>120</width>
- <height>120</height>
+ <width>0</width>
+ <height>0</height>
</size>
</property>
+ <property name="toolTip">
+ <string>Name of the new connection</string>
+ </property>
+ <property name="frame">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="txtUrl">
+ <property name="toolTip">
+ <string>HTTP address of the Web Map Server</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <widget class="QLineEdit" name="txtUserName"/>
+ </item>
+ <item row="6" column="1">
+ <widget class="QLineEdit" name="txtPassword">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
+ <item row="8" column="0" colspan="2">
+ <widget class="QCheckBox" name="cbxIgnoreGetFeatureInfoURI">
+ <property name="text">
+ <string>Ignore GetFeatureInfo URI reported in capabilities</string>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="0" colspan="2">
+ <widget class="QCheckBox" name="cbxIgnoreGetMapURI">
+ <property name="text">
+ <string>Ignore GetMap URI reported in capabilities</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
- <item row="1" column="0">
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<tabstops>
- <tabstop>txtName</tabstop>
- <tabstop>txtUrl</tabstop>
- <tabstop>txtUserName</tabstop>
- <tabstop>txtPassword</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/>
Modified: trunk/qgis/src/ui/qgswmssourceselectbase.ui
===================================================================
--- trunk/qgis/src/ui/qgswmssourceselectbase.ui 2011-03-22 08:45:52 UTC (rev 15558)
+++ trunk/qgis/src/ui/qgswmssourceselectbase.ui 2011-03-22 08:47:46 UTC (rev 15559)
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>767</width>
+ <width>773</width>
<height>539</height>
</rect>
</property>
@@ -223,30 +223,6 @@
</property>
</widget>
</item>
- <item row="2" column="0" colspan="3">
- <layout class="QHBoxLayout">
- <item>
- <widget class="QCheckBox" name="cbxIgnoreGetMap">
- <property name="toolTip">
- <string>Use base url instead of advertised GetFeatureInfo URL</string>
- </property>
- <property name="text">
- <string>Ignore GetMap URL</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="cbxIgnoreGetFeatureInfo">
- <property name="toolTip">
- <string>Use base url instead of advertised GetFeatureInfo URL</string>
- </property>
- <property name="text">
- <string>Ignore GetFeatureInfo URL</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
</layout>
</widget>
</item>
@@ -445,8 +421,6 @@
<tabstop>lstLayers</tabstop>
<tabstop>leLayerName</tabstop>
<tabstop>btnChangeSpatialRefSys</tabstop>
- <tabstop>cbxIgnoreGetMap</tabstop>
- <tabstop>cbxIgnoreGetFeatureInfo</tabstop>
<tabstop>mLayerUpButton</tabstop>
<tabstop>mLayerDownButton</tabstop>
<tabstop>mLayerOrderTreeWidget</tabstop>
More information about the QGIS-commit
mailing list