Skip to content
Permalink
Browse files

[qt5 server] deprecate usage of QFtp and remove from Qt5 builds

  • Loading branch information
m-kuhn committed Mar 15, 2016
1 parent 8fc4056 commit 39047221ce43f419ea7fd93e302c6579b32786a5
@@ -34,6 +34,7 @@ cmake \
-DWITH_QTWEBKIT=OFF \
-DWITH_APIDOC=ON \
-DWITH_ASTYLE=ON \
-DWITH_SERVER=ON \
-DENABLE_QT5=ON \
-DCXX_EXTRA_FLAGS="$CLANG_WARNINGS" \
-DPYTHON_LIBRARY=/usr/lib/libpython3.2mu.so \
@@ -31,7 +31,6 @@ SET ( qgis_mapserv_SRCS
qgswcsserver.cpp
qgsmapserviceexception.cpp
qgsmslayercache.cpp
qgsftptransaction.cpp
qgsmslayerbuilder.cpp
qgshostedvdsbuilder.cpp
qgsinterpolationlayerbuilder.cpp
@@ -50,21 +49,32 @@ SET ( qgis_mapserv_SRCS
qgssldconfigparser.cpp
qgsconfigparserutils.cpp
qgsserver.cpp
)
IF("${Qt5Network_VERSION}" VERSION_LESS "5.0.0")
SET (qgis_mapserv_SRCS ${qgis_mapserv_SRCS}
qgsftptransaction.cpp
)
ENDIF("${Qt5Network_VERSION}" VERSION_LESS "5.0.0")


# SET (qgis_mapserv_UIS
# none used
# )

SET (qgis_mapserv_MOC_HDRS
qgsftptransaction.h
qgscapabilitiescache.h
qgsconfigcache.h
qgsmslayercache.h
qgsserverlogger.h
qgsserverstreamingdevice.h
)

IF("${Qt5Network_VERSION}" VERSION_LESS "5.0.0")
SET (qgis_mapserv_MOC_HDRS ${qgis_mapserv_MOC_HDRS}
qgsftptransaction.h
)
ENDIF("${Qt5Network_VERSION}" VERSION_LESS "5.0.0")

SET (qgis_mapserv_RCCS
# not used
#qgis_mapserv.qrc
@@ -17,19 +17,22 @@

#include <QFtp>

/** A class for synchronous ftp access (using QFtp in background)*/
/** A class for synchronous ftp access (using QFtp in background)
*
* @deprecated because of QFtp removal in Qt5.
*/
class QgsFtpTransaction: public QObject
{
Q_OBJECT
public:
QgsFtpTransaction();
Q_DECL_DEPRECATED QgsFtpTransaction();
~QgsFtpTransaction();

/** Transfers the file with the given Url and stores it into ba
@param ftpUrl url of the file to access
@param pointer to buffer to store file contents
@return 0 in case of success*/
int get( const QString& ftpUrl, QByteArray& ba );
Q_DECL_DEPRECATED int get( const QString& ftpUrl, QByteArray& ba );

public slots:
void setFinishedFlag( bool error );
@@ -17,9 +17,12 @@
* *
***************************************************************************/

#include "qgis.h"
#include "qgshttprequesthandler.h"
#if QT_VERSION < 0x050000
#include "qgsftptransaction.h"
#include "qgshttptransaction.h"
#endif
#include "qgsmessagelog.h"
#include "qgsmapserviceexception.h"
#include <QBuffer>
@@ -37,7 +40,7 @@ QgsHttpRequestHandler::QgsHttpRequestHandler( const bool captureOutput )
: QgsRequestHandler()
{
mException = nullptr;
mHeadersSent = FALSE;
mHeadersSent = false;
mCaptureOutput = captureOutput;
}

@@ -165,7 +168,7 @@ void QgsHttpRequestHandler::sendHeaders()
}
addToResponseHeader( "\n" );
mHeaders.clear();
mHeadersSent = TRUE;
mHeadersSent = true;
}

void QgsHttpRequestHandler::sendBody()
@@ -574,6 +577,7 @@ void QgsHttpRequestHandler::requestStringToParameterMap( const QString& request,
}
else if ( key.compare( "SLD", Qt::CaseInsensitive ) == 0 )
{
#if QT_VERSION < 0x050000
QByteArray fileContents;
if ( value.startsWith( "http", Qt::CaseInsensitive ) )
{
@@ -585,18 +589,24 @@ void QgsHttpRequestHandler::requestStringToParameterMap( const QString& request,
}
else if ( value.startsWith( "ftp", Qt::CaseInsensitive ) )
{
Q_NOWARN_DEPRECATED_PUSH;
QgsFtpTransaction ftp;
if ( !ftp.get( value, fileContents ) )
{
continue;
}
value = QUrl::fromPercentEncoding( fileContents );
Q_NOWARN_DEPRECATED_POP;
}
else
{
continue; //only http and ftp supported at the moment
}
value = QUrl::fromPercentEncoding( fileContents );
#else
QgsMessageLog::logMessage( "http and ftp methods not supported with Qt5." );
continue;
#endif

}
parameters.insert( key.toUpper(), value );
@@ -15,9 +15,12 @@
* *
***************************************************************************/

#include "qgis.h"
#include "qgsremotedatasourcebuilder.h"
#if QT_VERSION < 0x050000
#include "qgsftptransaction.h"
#include "qgshttptransaction.h"
#endif
#include "qgslogger.h"
#include "qgsrasterlayer.h"
#include "qgsvectorlayer.h"
@@ -161,6 +164,7 @@ QgsVectorLayer* QgsRemoteDataSourceBuilder::vectorLayerFromRemoteVDS( const QDom

int QgsRemoteDataSourceBuilder::loadData( const QString& url, QByteArray& data ) const
{
#if QT_VERSION < 0x050000
if ( url.startsWith( "http", Qt::CaseInsensitive ) )
{
QgsHttpTransaction http( url );
@@ -172,11 +176,18 @@ int QgsRemoteDataSourceBuilder::loadData( const QString& url, QByteArray& data )
}
else if ( url.startsWith( "ftp", Qt::CaseInsensitive ) )
{
Q_NOWARN_DEPRECATED_PUSH;
QgsFtpTransaction ftp;
if ( ftp.get( url, data ) != 0 )
{
return 1;
}
Q_NOWARN_DEPRECATED_POP;
}
#else
Q_UNUSED( url )
Q_UNUSED( data )
QgsDebugMsg( "http and ftp remote datasources not supported with Qt5" );
#endif
return 0;
}
@@ -17,7 +17,9 @@

#include "qgsdatasourceuri.h"
#include "qgsremoteowsbuilder.h"
#if QT_VERSION < 0x050000
#include "qgshttptransaction.h"
#endif
#include "qgslogger.h"
#include "qgsmslayercache.h"
#include "qgsrasterlayer.h"
@@ -239,6 +241,8 @@ QgsRasterLayer* QgsRemoteOWSBuilder::wcsLayerFromUrl( const QString &url,
{
Q_UNUSED( layerName );
Q_UNUSED( allowCaching );

#if QT_VERSION < 0x050000
QgsDebugMsg( "Entering" );

//write server url and coverage name to a temporary file
@@ -339,7 +343,6 @@ QgsRasterLayer* QgsRemoteOWSBuilder::wcsLayerFromUrl( const QString &url,
wcsRequest += "&BBOX=" + bbox;

QgsDebugMsg( "WCS request is: " + wcsRequest );

//make request and store byte array into temporary file
QgsHttpTransaction httpTransaction( wcsRequest );
QByteArray result;
@@ -355,6 +358,14 @@ QgsRasterLayer* QgsRemoteOWSBuilder::wcsLayerFromUrl( const QString &url,
QgsRasterLayer* rl = new QgsRasterLayer( fileName, layerNameFromUri( fileName ) );
layersToRemove.push_back( rl ); //make sure the layer gets deleted after each request
return rl;
#else
Q_UNUSED( url )
Q_UNUSED( filesToRemove )
Q_UNUSED( layersToRemove )
QgsDebugMsg( "remote http not supported with Qt5" );
return nullptr;
#endif

}

QgsVectorLayer* QgsRemoteOWSBuilder::sosLayer( const QDomElement& remoteOWSElem, const QString& url, const QString& layerName, QList<QgsMapLayer*>& layersToRemove, bool allowCaching ) const
@@ -1403,7 +1403,7 @@ QList<QDomElement> QgsServerProjectParser::publishedComposerElements() const
QDomElement wmsRestrictedComposersElem = propertiesElem.firstChildElement( "WMSRestrictedComposers" );
if ( wmsRestrictedComposersElem.isNull() )
{
for ( unsigned int i = 0; i < composerNodeList.length(); ++i )
for ( int i = 0; i < composerNodeList.size(); ++i )
{
composerElemList.push_back( composerNodeList.at( i ).toElement() );
}

0 comments on commit 3904722

Please sign in to comment.
You can’t perform that action at this time.