diff --git a/src/core/qgsowsconnection.cpp b/src/core/qgsowsconnection.cpp index be7adfc4b5e..645a3ed23ef 100644 --- a/src/core/qgsowsconnection.cpp +++ b/src/core/qgsowsconnection.cpp @@ -45,8 +45,6 @@ QgsOwsConnection::QgsOwsConnection( const QString &service, const QString &connN QString key = "qgis/connections-" + mService.toLower() + '/' + mConnName; QString credentialsKey = "qgis/" + mService + '/' + mConnName; - QStringList connStringParts; - mConnectionInfo = settings.value( key + "/url" ).toString(); mUri.setParam( QStringLiteral( "url" ), settings.value( key + "/url" ).toString() ); @@ -67,10 +65,19 @@ QgsOwsConnection::QgsOwsConnection( const QString &service, const QString &connN } mConnectionInfo.append( ",authcfg=" + authcfg ); + QString referer = settings.value( key + "/referer" ).toString(); + if ( !referer.isEmpty() ) + { + mUri.setParam( QStringLiteral( "referer" ), referer ); + } + bool ignoreGetMap = settings.value( key + "/ignoreGetMapURI", false ).toBool(); bool ignoreGetFeatureInfo = settings.value( key + "/ignoreGetFeatureInfoURI", false ).toBool(); bool ignoreAxisOrientation = settings.value( key + "/ignoreAxisOrientation", false ).toBool(); bool invertAxisOrientation = settings.value( key + "/invertAxisOrientation", false ).toBool(); + bool smoothPixmapTransform = settings.value( key + "/smoothPixmapTransform", false ).toBool(); + QString dpiMode = settings.value( key + "/dpiMode", "all" ).toString(); + if ( ignoreGetMap ) { mUri.setParam( QStringLiteral( "IgnoreGetMapUrl" ), QStringLiteral( "1" ) ); @@ -87,6 +94,14 @@ QgsOwsConnection::QgsOwsConnection( const QString &service, const QString &connN { mUri.setParam( QStringLiteral( "InvertAxisOrientation" ), QStringLiteral( "1" ) ); } + if ( smoothPixmapTransform ) + { + mUri.setParam( QStringLiteral( "SmoothPixmapTransform" ), QStringLiteral( "1" ) ); + } + if ( !dpiMode.isEmpty() ) + { + mUri.setParam( QStringLiteral( "dpiMode" ), dpiMode ); + } QgsDebugMsg( QString( "encoded uri: '%1'." ).arg( QString( mUri.encodedUri() ) ) ); } diff --git a/src/providers/wms/CMakeLists.txt b/src/providers/wms/CMakeLists.txt index bfc67551956..b6fab8cddc5 100644 --- a/src/providers/wms/CMakeLists.txt +++ b/src/providers/wms/CMakeLists.txt @@ -12,7 +12,6 @@ SET (WMS_SRCS SET (WMS_MOC_HDRS qgswmscapabilities.h qgswmsprovider.h - qgswmsconnection.h qgswmsdataitems.h ) diff --git a/src/providers/wms/qgswmsconnection.cpp b/src/providers/wms/qgswmsconnection.cpp index 18c708f472e..de3535cba1e 100644 --- a/src/providers/wms/qgswmsconnection.cpp +++ b/src/providers/wms/qgswmsconnection.cpp @@ -26,80 +26,11 @@ #include "qgswmsconnection.h" #include "qgsnetworkaccessmanager.h" #include "qgssettings.h" +#include "qgsowsconnection.h" QgsWMSConnection::QgsWMSConnection( const QString &connName ) - : mConnName( connName ) + : QgsOwsConnection( QStringLiteral( "WMS" ), connName ) { - QgsDebugMsg( "theConnName = " + connName ); - - QgsSettings settings; - - QString key = "qgis/connections-wms/" + mConnName; - QString credentialsKey = "qgis/WMS/" + mConnName; - - QStringList connStringParts; - - mUri.setParam( QStringLiteral( "url" ), settings.value( key + "/url" ).toString() ); - - // Check for credentials and prepend to the connection info - QString username = settings.value( credentialsKey + "/username" ).toString(); - QString password = settings.value( credentialsKey + "/password" ).toString(); - if ( !username.isEmpty() ) - { - mUri.setParam( QStringLiteral( "username" ), username ); - mUri.setParam( QStringLiteral( "password" ), password ); - } - - QString authcfg = settings.value( credentialsKey + "/authcfg" ).toString(); - if ( !authcfg.isEmpty() ) - { - mUri.setParam( QStringLiteral( "authcfg" ), authcfg ); - } - - QString referer = settings.value( key + "/referer" ).toString(); - if ( !referer.isEmpty() ) - { - mUri.setParam( QStringLiteral( "referer" ), referer ); - } - - bool ignoreGetMap = settings.value( key + "/ignoreGetMapURI", false ).toBool(); - bool ignoreGetFeatureInfo = settings.value( key + "/ignoreGetFeatureInfoURI", false ).toBool(); - bool ignoreAxisOrientation = settings.value( key + "/ignoreAxisOrientation", false ).toBool(); - bool invertAxisOrientation = settings.value( key + "/invertAxisOrientation", false ).toBool(); - bool smoothPixmapTransform = settings.value( key + "/smoothPixmapTransform", false ).toBool(); - QString dpiMode = settings.value( key + "/dpiMode", "all" ).toString(); - - if ( ignoreGetMap ) - { - mUri.setParam( QStringLiteral( "IgnoreGetMapUrl" ), QStringLiteral( "1" ) ); - } - - if ( ignoreGetFeatureInfo ) - { - mUri.setParam( QStringLiteral( "IgnoreGetFeatureInfoUrl" ), QStringLiteral( "1" ) ); - } - - if ( ignoreAxisOrientation ) - { - mUri.setParam( QStringLiteral( "IgnoreAxisOrientation" ), QStringLiteral( "1" ) ); - } - - if ( invertAxisOrientation ) - { - mUri.setParam( QStringLiteral( "InvertAxisOrientation" ), QStringLiteral( "1" ) ); - } - - if ( smoothPixmapTransform ) - { - mUri.setParam( QStringLiteral( "SmoothPixmapTransform" ), QStringLiteral( "1" ) ); - } - - if ( !dpiMode.isEmpty() ) - { - mUri.setParam( QStringLiteral( "dpiMode" ), dpiMode ); - } - - QgsDebugMsg( QString( "encodedUri: '%1'." ).arg( QString( mUri.encodedUri() ) ) ); } QgsWMSConnection::~QgsWMSConnection() @@ -107,11 +38,6 @@ QgsWMSConnection::~QgsWMSConnection() } -QgsDataSourceUri QgsWMSConnection::uri() -{ - return mUri; -} - QStringList QgsWMSConnection::connectionList() { QgsSettings settings; diff --git a/src/providers/wms/qgswmsconnection.h b/src/providers/wms/qgswmsconnection.h index 3ab9f515e27..b6005890e1f 100644 --- a/src/providers/wms/qgswmsconnection.h +++ b/src/providers/wms/qgswmsconnection.h @@ -18,16 +18,14 @@ #ifndef QGSWMSCONNECTION_H #define QGSWMSCONNECTION_H -#include "qgsdatasourceuri.h" - +#include "qgsowsconnection.h" #include /*! * \brief Connections management */ -class QgsWMSConnection : public QObject +class QgsWMSConnection : public QgsOwsConnection { - Q_OBJECT public: //! Constructor @@ -42,10 +40,6 @@ class QgsWMSConnection : public QObject static QString selectedConnection(); static void setSelectedConnection( const QString &name ); - public: - QString mConnName; - QgsDataSourceUri uri(); - QgsDataSourceUri mUri; }; #endif // QGSWMSCONNECTION_H