diff --git a/cmake_templates/qgsconfig.h.in b/cmake_templates/qgsconfig.h.in index 6eaca0c237d5..b8f0949c9850 100644 --- a/cmake_templates/qgsconfig.h.in +++ b/cmake_templates/qgsconfig.h.in @@ -30,8 +30,6 @@ #define QGIS_LIBEXEC_SUBDIR "${QGIS_LIBEXEC_SUBDIR}" #define QGIS_LIB_SUBDIR "${QGIS_LIB_SUBDIR}" #define QGIS_QML_SUBDIR "${QGIS_QML_SUBDIR}" -#define CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" -#define CMAKE_SOURCE_DIR "${CMAKE_SOURCE_DIR}" #define QGIS_SERVER_MODULE_SUBDIR "${QGIS_SERVER_MODULE_SUBDIR}" @@ -44,8 +42,6 @@ #define QGIS_MACAPP_BUNDLE ${QGIS_MACAPP_BUNDLE} #endif -#define QT_PLUGINS_DIR "${QT_PLUGINS_DIR}" - #define PYTHON_VERSION "${Python_VERSION}" #define PYTHON_VERSION_MAJOR "${Python_VERSION_MAJOR}" #define PYTHON_VERSION_MINOR "${Python_VERSION_MINOR}" diff --git a/python/PyQt6/core/auto_generated/network/qgsnetworkaccessmanager.sip.in b/python/PyQt6/core/auto_generated/network/qgsnetworkaccessmanager.sip.in index 25b6be19976b..93218af3368d 100644 --- a/python/PyQt6/core/auto_generated/network/qgsnetworkaccessmanager.sip.in +++ b/python/PyQt6/core/auto_generated/network/qgsnetworkaccessmanager.sip.in @@ -11,7 +11,6 @@ - class QgsNetworkRequestParameters { %Docstring(signature="appended") diff --git a/python/PyQt6/core/auto_generated/qgsdbquerylog.sip.in b/python/PyQt6/core/auto_generated/qgsdbquerylog.sip.in index a8ce8473683f..6fc5626a0a2a 100644 --- a/python/PyQt6/core/auto_generated/qgsdbquerylog.sip.in +++ b/python/PyQt6/core/auto_generated/qgsdbquerylog.sip.in @@ -51,7 +51,6 @@ Constructor for QgsDatabaseQueryLogEntry. }; - class QgsDatabaseQueryLog: QObject { %Docstring(signature="appended") diff --git a/python/core/auto_generated/network/qgsnetworkaccessmanager.sip.in b/python/core/auto_generated/network/qgsnetworkaccessmanager.sip.in index 6a2e92281786..ee4f07ebd136 100644 --- a/python/core/auto_generated/network/qgsnetworkaccessmanager.sip.in +++ b/python/core/auto_generated/network/qgsnetworkaccessmanager.sip.in @@ -11,7 +11,6 @@ - class QgsNetworkRequestParameters { %Docstring(signature="appended") diff --git a/python/core/auto_generated/qgsdbquerylog.sip.in b/python/core/auto_generated/qgsdbquerylog.sip.in index a8ce8473683f..6fc5626a0a2a 100644 --- a/python/core/auto_generated/qgsdbquerylog.sip.in +++ b/python/core/auto_generated/qgsdbquerylog.sip.in @@ -51,7 +51,6 @@ Constructor for QgsDatabaseQueryLogEntry. }; - class QgsDatabaseQueryLog: QObject { %Docstring(signature="appended") diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index 67018c7afb4d..92092cbfaefe 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -524,6 +524,8 @@ add_library(qgis_app ${LIBRARY_TYPE} ${QGIS_APP_SRCS}) # require c++17 target_compile_features(qgis_app PRIVATE cxx_std_17) +target_compile_definitions(qgis_app PRIVATE "QT_PLUGINS_DIR=\"${QT_PLUGINS_DIR}\"") + target_include_directories(qgis_app PUBLIC ${CMAKE_SOURCE_DIR}/external/nmea diff --git a/src/auth/oauth2/CMakeLists.txt b/src/auth/oauth2/CMakeLists.txt index a9e2cfeddc36..15b3fb2588dc 100644 --- a/src/auth/oauth2/CMakeLists.txt +++ b/src/auth/oauth2/CMakeLists.txt @@ -104,6 +104,7 @@ target_include_directories(authmethod_oauth2_a PUBLIC ${CMAKE_SOURCE_DIR}/src/au # require c++17 target_compile_features(authmethod_oauth2_a PRIVATE cxx_std_17) +target_compile_definitions(authmethod_oauth2_a PRIVATE "CMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\"") target_link_libraries(authmethod_oauth2_a qgis_core) @@ -146,6 +147,7 @@ else() # require c++17 target_compile_features(authmethod_oauth2 PRIVATE cxx_std_17) + target_compile_definitions(authmethod_oauth2 PRIVATE "CMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\"") target_link_libraries(authmethod_oauth2 qgis_core) diff --git a/src/auth/oauth2/core/qgso2.cpp b/src/auth/oauth2/core/qgso2.cpp index d571d7b1b5c6..e467741a687d 100644 --- a/src/auth/oauth2/core/qgso2.cpp +++ b/src/auth/oauth2/core/qgso2.cpp @@ -21,6 +21,7 @@ #include "qgsauthoauth2config.h" #include "qgslogger.h" #include "qgsnetworkaccessmanager.h" +#include "qgssetrequestinitiator_p.h" #include "qgsblockingnetworkrequest.h" #include diff --git a/src/auth/oauth2/gui/qgsauthoauth2edit.cpp b/src/auth/oauth2/gui/qgsauthoauth2edit.cpp index 024d3ee88bc3..f215722c0b44 100644 --- a/src/auth/oauth2/gui/qgsauthoauth2edit.cpp +++ b/src/auth/oauth2/gui/qgsauthoauth2edit.cpp @@ -28,6 +28,7 @@ #include "qgsauthconfigedit.h" #include "qgsmessagelog.h" #include "qgsnetworkaccessmanager.h" +#include "qgssetrequestinitiator_p.h" QgsAuthOAuth2Edit::QgsAuthOAuth2Edit( QWidget *parent ) : QgsAuthMethodEdit( parent ) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 289b6d816777..26fca1e2bf99 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -2573,6 +2573,7 @@ if (${QT_VERSION_BASE}Positioning_FOUND) endif() target_compile_definitions(qgis_core PRIVATE "-DQT_NO_FOREACH") +target_compile_definitions(qgis_core PRIVATE "CMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\"") # clang-tidy if(CLANG_TIDY_EXE) diff --git a/src/core/externalstorage/qgshttpexternalstorage.cpp b/src/core/externalstorage/qgshttpexternalstorage.cpp index 2acf18517953..b13dfe4610da 100644 --- a/src/core/externalstorage/qgshttpexternalstorage.cpp +++ b/src/core/externalstorage/qgshttpexternalstorage.cpp @@ -18,6 +18,7 @@ #include "qgsnetworkcontentfetcherregistry.h" #include "qgsblockingnetworkrequest.h" #include "qgsnetworkaccessmanager.h" +#include "qgssetrequestinitiator_p.h" #include "qgsapplication.h" #include "qgsfeedback.h" diff --git a/src/core/geocoding/qgsgooglemapsgeocoder.cpp b/src/core/geocoding/qgsgooglemapsgeocoder.cpp index 262f871c2b14..caeb5c733a61 100644 --- a/src/core/geocoding/qgsgooglemapsgeocoder.cpp +++ b/src/core/geocoding/qgsgooglemapsgeocoder.cpp @@ -17,6 +17,7 @@ #include "qgsgeocodercontext.h" #include "qgslogger.h" #include "qgsnetworkaccessmanager.h" +#include "qgssetrequestinitiator_p.h" #include "qgsblockingnetworkrequest.h" #include "qgsreadwritelocker.h" #include "qgscoordinatetransform.h" diff --git a/src/core/geocoding/qgsnominatimgeocoder.cpp b/src/core/geocoding/qgsnominatimgeocoder.cpp index 0b26c9213dd1..2b93f7aef71b 100644 --- a/src/core/geocoding/qgsnominatimgeocoder.cpp +++ b/src/core/geocoding/qgsnominatimgeocoder.cpp @@ -18,6 +18,7 @@ #include "qgsgeocodercontext.h" #include "qgslogger.h" #include "qgsnetworkaccessmanager.h" +#include "qgssetrequestinitiator_p.h" #include "qgscoordinatetransform.h" #include #include diff --git a/src/core/network/qgsfiledownloader.cpp b/src/core/network/qgsfiledownloader.cpp index 817622684ce4..431dfd44ef83 100644 --- a/src/core/network/qgsfiledownloader.cpp +++ b/src/core/network/qgsfiledownloader.cpp @@ -15,6 +15,7 @@ #include "qgsfiledownloader.h" #include "qgsnetworkaccessmanager.h" +#include "qgssetrequestinitiator_p.h" #include "qgsapplication.h" #include "qgsauthmanager.h" #include "qgsvariantutils.h" diff --git a/src/core/network/qgsnetworkaccessmanager.h b/src/core/network/qgsnetworkaccessmanager.h index d200cc7c20ca..adcb1cf87446 100644 --- a/src/core/network/qgsnetworkaccessmanager.h +++ b/src/core/network/qgsnetworkaccessmanager.h @@ -38,14 +38,6 @@ class QgsFeedback; class QgsSettingsEntryInteger; -#ifndef SIP_RUN -#include "qgsconfig.h" -constexpr int sFilePrefixLength = CMAKE_SOURCE_DIR[sizeof( CMAKE_SOURCE_DIR ) - 1] == '/' ? sizeof( CMAKE_SOURCE_DIR ) + 1 : sizeof( CMAKE_SOURCE_DIR ); - -#define QgsSetRequestInitiatorClass(request, _class) request.setAttribute( static_cast< QNetworkRequest::Attribute >( QgsNetworkRequestParameters::AttributeInitiatorClass ), _class ); request.setAttribute( static_cast< QNetworkRequest::Attribute >( QgsNetworkRequestParameters::AttributeInitiatorRequestId ), QString(QString( __FILE__ ).mid( sFilePrefixLength ) + ':' + QString::number( __LINE__ ) + " (" + __FUNCTION__ + ")") ); -#define QgsSetRequestInitiatorId(request, str) request.setAttribute( static_cast< QNetworkRequest::Attribute >( QgsNetworkRequestParameters::AttributeInitiatorRequestId ), QString(QString( __FILE__ ).mid( sFilePrefixLength ) + ':' + QString::number( __LINE__ ) + " (" + __FUNCTION__ + "): " + str) ); -#endif - /** * \class QgsNetworkRequestParameters * \ingroup core diff --git a/src/core/network/qgsnetworkcontentfetcher.cpp b/src/core/network/qgsnetworkcontentfetcher.cpp index 479d5b097b71..f192efc7a8fd 100644 --- a/src/core/network/qgsnetworkcontentfetcher.cpp +++ b/src/core/network/qgsnetworkcontentfetcher.cpp @@ -18,6 +18,7 @@ #include "qgsnetworkcontentfetcher.h" #include "qgsnetworkaccessmanager.h" +#include "qgssetrequestinitiator_p.h" #include "qgsmessagelog.h" #include "qgsapplication.h" #include "qgsauthmanager.h" diff --git a/src/core/network/qgsnewsfeedparser.cpp b/src/core/network/qgsnewsfeedparser.cpp index 4511d633066c..480655e038ce 100644 --- a/src/core/network/qgsnewsfeedparser.cpp +++ b/src/core/network/qgsnewsfeedparser.cpp @@ -17,6 +17,7 @@ #include "qgsnetworkcontentfetchertask.h" #include "qgsnetworkcontentfetcher.h" #include "qgsnetworkaccessmanager.h" +#include "qgssetrequestinitiator_p.h" #include "qgsjsonutils.h" #include "qgsmessagelog.h" #include "qgsapplication.h" diff --git a/src/core/network/qgssetrequestinitiator_p.h b/src/core/network/qgssetrequestinitiator_p.h new file mode 100644 index 000000000000..b2cc6d890d68 --- /dev/null +++ b/src/core/network/qgssetrequestinitiator_p.h @@ -0,0 +1,29 @@ +/*************************************************************************** + qgssetrequestinitiator.h - description + ------------------- + begin : 2024-02-10 + copyright : (C) 2024 by Matthias Kuhn + email : matthias@opengis.ch + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef QGSSETREQUESTINITIATOR_P_H +#define QGSSETREQUESTINITIATOR_P_H + +#include "qgsnetworkaccessmanager.h" + +constexpr int sFilePrefixLength = CMAKE_SOURCE_DIR[sizeof( CMAKE_SOURCE_DIR ) - 1] == '/' ? sizeof( CMAKE_SOURCE_DIR ) + 1 : sizeof( CMAKE_SOURCE_DIR ); + +#define QgsSetRequestInitiatorClass(request, _class) request.setAttribute( static_cast< QNetworkRequest::Attribute >( QgsNetworkRequestParameters::AttributeInitiatorClass ), _class ); request.setAttribute( static_cast< QNetworkRequest::Attribute >( QgsNetworkRequestParameters::AttributeInitiatorRequestId ), QString(QString( __FILE__ ).mid( sFilePrefixLength ) + ':' + QString::number( __LINE__ ) + " (" + __FUNCTION__ + ")") ); +#define QgsSetRequestInitiatorId(request, str) request.setAttribute( static_cast< QNetworkRequest::Attribute >( QgsNetworkRequestParameters::AttributeInitiatorRequestId ), QString(QString( __FILE__ ).mid( sFilePrefixLength ) + ':' + QString::number( __LINE__ ) + " (" + __FUNCTION__ + "): " + str) ); + +#define QgsSetCPLHTTPFetchOverriderInitiatorClass(overrider, _class) QgsSetRequestInitiatorClass((overrider), _class) +#endif // QGSSETREQUESTINITIATOR_P_H diff --git a/src/core/pointcloud/qgscopcpointcloudblockrequest.cpp b/src/core/pointcloud/qgscopcpointcloudblockrequest.cpp index c2568c175a94..3e97dd859e5f 100644 --- a/src/core/pointcloud/qgscopcpointcloudblockrequest.cpp +++ b/src/core/pointcloud/qgscopcpointcloudblockrequest.cpp @@ -21,6 +21,7 @@ #include "qgslazdecoder.h" #include "qgsapplication.h" #include "qgsnetworkaccessmanager.h" +#include "qgssetrequestinitiator_p.h" // // QgsCopcPointCloudBlockRequest diff --git a/src/core/pointcloud/qgseptpointcloudblockrequest.cpp b/src/core/pointcloud/qgseptpointcloudblockrequest.cpp index d92bafc47b78..9bcd7b339b5e 100644 --- a/src/core/pointcloud/qgseptpointcloudblockrequest.cpp +++ b/src/core/pointcloud/qgseptpointcloudblockrequest.cpp @@ -22,6 +22,7 @@ #include "qgslazdecoder.h" #include "qgsapplication.h" #include "qgsnetworkaccessmanager.h" +#include "qgssetrequestinitiator_p.h" // // QgsEptPointCloudBlockRequest diff --git a/src/core/pointcloud/qgslazinfo.cpp b/src/core/pointcloud/qgslazinfo.cpp index 31a1d7225c86..fd4f0adb83dc 100644 --- a/src/core/pointcloud/qgslazinfo.cpp +++ b/src/core/pointcloud/qgslazinfo.cpp @@ -20,6 +20,7 @@ #include "qgslogger.h" #include "qgsblockingnetworkrequest.h" #include "qgsnetworkaccessmanager.h" +#include "qgssetrequestinitiator_p.h" #include "lazperf/readers.hpp" diff --git a/src/core/pointcloud/qgsremotecopcpointcloudindex.cpp b/src/core/pointcloud/qgsremotecopcpointcloudindex.cpp index 8bbe8da9db03..3f4df11b97a9 100644 --- a/src/core/pointcloud/qgsremotecopcpointcloudindex.cpp +++ b/src/core/pointcloud/qgsremotecopcpointcloudindex.cpp @@ -37,6 +37,7 @@ #include "qgscachedpointcloudblockrequest.h" #include "qgspointcloudexpression.h" #include "qgsnetworkaccessmanager.h" +#include "qgssetrequestinitiator_p.h" ///@cond PRIVATE diff --git a/src/core/pointcloud/qgsremoteeptpointcloudindex.cpp b/src/core/pointcloud/qgsremoteeptpointcloudindex.cpp index 59a427ff9af0..8a7f5bb3fa7d 100644 --- a/src/core/pointcloud/qgsremoteeptpointcloudindex.cpp +++ b/src/core/pointcloud/qgsremoteeptpointcloudindex.cpp @@ -39,6 +39,7 @@ #include "qgscachedpointcloudblockrequest.h" #include "qgspointcloudexpression.h" #include "qgsnetworkaccessmanager.h" +#include "qgssetrequestinitiator_p.h" ///@cond PRIVATE diff --git a/src/core/providers/arcgis/qgsarcgisrestquery.cpp b/src/core/providers/arcgis/qgsarcgisrestquery.cpp index 2e45a58e42a2..4eda6e1fec37 100644 --- a/src/core/providers/arcgis/qgsarcgisrestquery.cpp +++ b/src/core/providers/arcgis/qgsarcgisrestquery.cpp @@ -17,6 +17,7 @@ #include "qgsarcgisrestutils.h" #include "qgsblockingnetworkrequest.h" #include "qgsnetworkaccessmanager.h" +#include "qgssetrequestinitiator_p.h" #include "qgslogger.h" #include "qgsapplication.h" #include "qgsmessagelog.h" diff --git a/src/core/providers/ogr/qgsogrfeatureiterator.cpp b/src/core/providers/ogr/qgsogrfeatureiterator.cpp index 1b429d2767f0..86e57024df17 100644 --- a/src/core/providers/ogr/qgsogrfeatureiterator.cpp +++ b/src/core/providers/ogr/qgsogrfeatureiterator.cpp @@ -27,6 +27,8 @@ #include "qgssymbol.h" #include "qgsgeometryengine.h" #include "qgsdbquerylog.h" +#include "qgsdbquerylog_p.h" +#include "qgssetrequestinitiator_p.h" #include diff --git a/src/core/providers/ogr/qgsogrprovider.cpp b/src/core/providers/ogr/qgsogrprovider.cpp index 761232758595..33f6c433689e 100644 --- a/src/core/providers/ogr/qgsogrprovider.cpp +++ b/src/core/providers/ogr/qgsogrprovider.cpp @@ -38,6 +38,8 @@ email : sherman at mrcc.com #include "qgsproviderregistry.h" #include "qgsvariantutils.h" #include "qgsjsonutils.h" +#include "qgssetrequestinitiator_p.h" + #include #define CPL_SUPRESS_CPLUSPLUS //#spellok diff --git a/src/core/providers/ogr/qgsogrproviderconnection.cpp b/src/core/providers/ogr/qgsogrproviderconnection.cpp index 48ae01e98f99..667191df92ba 100644 --- a/src/core/providers/ogr/qgsogrproviderconnection.cpp +++ b/src/core/providers/ogr/qgsogrproviderconnection.cpp @@ -25,6 +25,7 @@ #include "qgsfielddomain.h" #include "qgsogrproviderutils.h" #include "qgsdbquerylog.h" +#include "qgsdbquerylog_p.h" #include "qgsprovidersublayerdetails.h" #include "qgsweakrelation.h" #if GDAL_VERSION_NUM < GDAL_COMPUTE_VERSION(3,4,0) diff --git a/src/core/providers/sensorthings/qgssensorthingsprovider.cpp b/src/core/providers/sensorthings/qgssensorthingsprovider.cpp index 1beaf2a24626..4bfad73df2bb 100644 --- a/src/core/providers/sensorthings/qgssensorthingsprovider.cpp +++ b/src/core/providers/sensorthings/qgssensorthingsprovider.cpp @@ -19,6 +19,7 @@ #include "qgssensorthingsutils.h" #include "qgsapplication.h" #include "qgsnetworkaccessmanager.h" +#include "qgssetrequestinitiator_p.h" #include "qgsblockingnetworkrequest.h" #include "qgsthreadingutils.h" #include "qgsreadwritelocker.h" diff --git a/src/core/providers/sensorthings/qgssensorthingsshareddata.cpp b/src/core/providers/sensorthings/qgssensorthingsshareddata.cpp index 1e695cbb1da6..4aca3b27ffe9 100644 --- a/src/core/providers/sensorthings/qgssensorthingsshareddata.cpp +++ b/src/core/providers/sensorthings/qgssensorthingsshareddata.cpp @@ -19,6 +19,7 @@ #include "qgslogger.h" #include "qgsreadwritelocker.h" #include "qgsblockingnetworkrequest.h" +#include "qgssetrequestinitiator_p.h" #include "qgsnetworkaccessmanager.h" #include "qgsjsonutils.h" diff --git a/src/core/providers/sensorthings/qgssensorthingsutils.cpp b/src/core/providers/sensorthings/qgssensorthingsutils.cpp index 64eddcf16c6f..f91f3b77df29 100644 --- a/src/core/providers/sensorthings/qgssensorthingsutils.cpp +++ b/src/core/providers/sensorthings/qgssensorthingsutils.cpp @@ -17,6 +17,7 @@ #include "qgsfield.h" #include "qgsfields.h" #include "qgswkbtypes.h" +#include "qgssetrequestinitiator_p.h" #include "qgsnetworkaccessmanager.h" #include "qgsblockingnetworkrequest.h" #include "qgslogger.h" diff --git a/src/core/qgsabstractcontentcache.cpp b/src/core/qgsabstractcontentcache.cpp index 9d6ebaa447f9..56ab94d7c292 100644 --- a/src/core/qgsabstractcontentcache.cpp +++ b/src/core/qgsabstractcontentcache.cpp @@ -16,6 +16,7 @@ ***************************************************************************/ #include "qgsabstractcontentcache.h" +#include "qgssetrequestinitiator_p.h" // // QgsAbstractContentCacheEntry @@ -39,8 +40,3 @@ void QgsAbstractContentCacheBase::onRemoteContentFetched( const QString &, bool { } - - - - - diff --git a/src/core/qgsabstractcontentcache.h b/src/core/qgsabstractcontentcache.h index ac59b24b69c7..22043074a53b 100644 --- a/src/core/qgsabstractcontentcache.h +++ b/src/core/qgsabstractcontentcache.h @@ -260,177 +260,7 @@ class CORE_EXPORT QgsAbstractContentCache : public QgsAbstractContentCacheBase * be TRUE from GUI based applications (like the main QGIS application) or crashes will result. Only for * use in external scripts or QGIS server. */ - QByteArray getContent( const QString &path, const QByteArray &missingContent, const QByteArray &fetchingContent, bool blocking = false ) const - { - // is it a path to local file? - QFile file( path ); - if ( file.exists() ) - { - if ( file.open( QIODevice::ReadOnly ) ) - { - return file.readAll(); - } - else - { - return missingContent; - } - } - - // maybe it's an embedded base64 string - if ( path.startsWith( QLatin1String( "base64:" ), Qt::CaseInsensitive ) ) - { - const QByteArray base64 = path.mid( 7 ).toLocal8Bit(); // strip 'base64:' prefix - return QByteArray::fromBase64( base64, QByteArray::OmitTrailingEquals ); - } - - // maybe it's a url... - if ( !path.contains( QLatin1String( "://" ) ) ) // otherwise short, relative SVG paths might be considered URLs - { - return missingContent; - } - - const QUrl url( path ); - if ( !url.isValid() ) - { - return missingContent; - } - - // check whether it's a url pointing to a local file - if ( url.scheme().compare( QLatin1String( "file" ), Qt::CaseInsensitive ) == 0 ) - { - file.setFileName( url.toLocalFile() ); - if ( file.exists() ) - { - if ( file.open( QIODevice::ReadOnly ) ) - { - return file.readAll(); - } - } - - // not found... - return missingContent; - } - - const QMutexLocker locker( &mMutex ); - - // already a request in progress for this url - if ( mPendingRemoteUrls.contains( path ) ) - { - // it's a non blocking request so return fetching content - if ( !blocking ) - { - return fetchingContent; - } - - // it's a blocking request so try to find the task and wait for task finished - const auto constActiveTasks = QgsApplication::taskManager()->activeTasks(); - for ( QgsTask *task : constActiveTasks ) - { - // the network content fetcher task's description ends with the path - if ( !task->description().endsWith( path ) ) - { - continue; - } - - // cast task to network content fetcher task - QgsNetworkContentFetcherTask *ncfTask = qobject_cast( task ); - if ( ncfTask ) - { - // wait for task finished - if ( waitForTaskFinished( ncfTask ) ) - { - if ( mRemoteContentCache.contains( path ) ) - { - // We got the file! - return *mRemoteContentCache[ path ]; - } - } - } - // task found, no needs to continue - break; - } - // if no content returns the content is probably in remote content cache - // or a new task will be created - } - - if ( mRemoteContentCache.contains( path ) ) - { - // already fetched this content - phew. Just return what we already got. - return *mRemoteContentCache[ path ]; - } - - mPendingRemoteUrls.insert( path ); - //fire up task to fetch content in background - QNetworkRequest request( url ); - QgsSetRequestInitiatorClass( request, QStringLiteral( "QgsAbstractContentCache<%1>" ).arg( mTypeString ) ); - request.setAttribute( QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache ); - request.setAttribute( QNetworkRequest::CacheSaveControlAttribute, true ); - - QgsNetworkContentFetcherTask *task = new QgsNetworkContentFetcherTask( request ); - connect( task, &QgsNetworkContentFetcherTask::fetched, this, [this, task, path, missingContent] - { - const QMutexLocker locker( &mMutex ); - - QNetworkReply *reply = task->reply(); - if ( !reply ) - { - // canceled - QMetaObject::invokeMethod( const_cast< QgsAbstractContentCacheBase * >( qobject_cast< const QgsAbstractContentCacheBase * >( this ) ), "onRemoteContentFetched", Qt::QueuedConnection, Q_ARG( QString, path ), Q_ARG( bool, false ) ); - return; - } - - if ( reply->error() != QNetworkReply::NoError ) - { - QgsMessageLog::logMessage( tr( "%3 request failed [error: %1 - url: %2]" ).arg( reply->errorString(), path, mTypeString ), mTypeString ); - return; - } - - bool ok = true; - - const QVariant status = reply->attribute( QNetworkRequest::HttpStatusCodeAttribute ); - if ( !QgsVariantUtils::isNull( status ) && status.toInt() >= 400 ) - { - const QVariant phrase = reply->attribute( QNetworkRequest::HttpReasonPhraseAttribute ); - QgsMessageLog::logMessage( tr( "%4 request error [status: %1 - reason phrase: %2] for %3" ).arg( status.toInt() ).arg( phrase.toString(), path, mTypeString ), mTypeString ); - mRemoteContentCache.insert( path, new QByteArray( missingContent ) ); - ok = false; - } - - if ( !checkReply( reply, path ) ) - { - mRemoteContentCache.insert( path, new QByteArray( missingContent ) ); - ok = false; - } - - if ( ok ) - { - // read the content data - const QByteArray ba = reply->readAll(); - - // because of the fragility listed below in waitForTaskFinished, this slot may get called twice. In that case - // the second time will have an empty reply (we've already read it all...) - if ( !ba.isEmpty() ) - mRemoteContentCache.insert( path, new QByteArray( ba ) ); - } - QMetaObject::invokeMethod( const_cast< QgsAbstractContentCacheBase * >( qobject_cast< const QgsAbstractContentCacheBase * >( this ) ), "onRemoteContentFetched", Qt::QueuedConnection, Q_ARG( QString, path ), Q_ARG( bool, true ) ); - } ); - - QgsApplication::taskManager()->addTask( task ); - - // if blocking, wait for finished - if ( blocking ) - { - if ( waitForTaskFinished( task ) ) - { - if ( mRemoteContentCache.contains( path ) ) - { - // We got the file! - return *mRemoteContentCache[ path ]; - } - } - } - return fetchingContent; - } + QByteArray getContent( const QString &path, const QByteArray &missingContent, const QByteArray &fetchingContent, bool blocking = false ) const; void onRemoteContentFetched( const QString &url, bool success ) override { @@ -636,7 +466,7 @@ class CORE_EXPORT QgsAbstractContentCache : public QgsAbstractContentCacheBase { QgsDebugMsgLevel( QStringLiteral( "***Entry:" ), 1 ); entry->dump(); - entry = entry->nextEntry; + entry = static_cast< T * >( entry->nextEntry ); } } diff --git a/src/core/qgsabstractcontentcache_p.h b/src/core/qgsabstractcontentcache_p.h new file mode 100644 index 000000000000..e6c424591b84 --- /dev/null +++ b/src/core/qgsabstractcontentcache_p.h @@ -0,0 +1,197 @@ +/*************************************************************************** + qgsabstractcontentcache_p.h + --------------- + begin : February 2024 + copyright : (C) 2024 by Matthias Kuhn + email : matthias@opengis.ch + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef QGSABSTRACTCONTENTCACHE_P_H +#define QGSABSTRACTCONTENTCACHE_P_H + +#include "qgsabstractcontentcache.h" +#include "qgssetrequestinitiator_p.h" + +template +QByteArray QgsAbstractContentCache::getContent( const QString &path, const QByteArray &missingContent, const QByteArray &fetchingContent, bool blocking ) const +{ + // is it a path to local file? + QFile file( path ); + if ( file.exists() ) + { + if ( file.open( QIODevice::ReadOnly ) ) + { + return file.readAll(); + } + else + { + return missingContent; + } + } + + // maybe it's an embedded base64 string + if ( path.startsWith( QLatin1String( "base64:" ), Qt::CaseInsensitive ) ) + { + const QByteArray base64 = path.mid( 7 ).toLocal8Bit(); // strip 'base64:' prefix + return QByteArray::fromBase64( base64, QByteArray::OmitTrailingEquals ); + } + + // maybe it's a url... + if ( !path.contains( QLatin1String( "://" ) ) ) // otherwise short, relative SVG paths might be considered URLs + { + return missingContent; + } + + const QUrl url( path ); + if ( !url.isValid() ) + { + return missingContent; + } + + // check whether it's a url pointing to a local file + if ( url.scheme().compare( QLatin1String( "file" ), Qt::CaseInsensitive ) == 0 ) + { + file.setFileName( url.toLocalFile() ); + if ( file.exists() ) + { + if ( file.open( QIODevice::ReadOnly ) ) + { + return file.readAll(); + } + } + + // not found... + return missingContent; + } + + const QMutexLocker locker( &mMutex ); + + // already a request in progress for this url + if ( mPendingRemoteUrls.contains( path ) ) + { + // it's a non blocking request so return fetching content + if ( !blocking ) + { + return fetchingContent; + } + + // it's a blocking request so try to find the task and wait for task finished + const auto constActiveTasks = QgsApplication::taskManager()->activeTasks(); + for ( QgsTask *task : constActiveTasks ) + { + // the network content fetcher task's description ends with the path + if ( !task->description().endsWith( path ) ) + { + continue; + } + + // cast task to network content fetcher task + QgsNetworkContentFetcherTask *ncfTask = qobject_cast( task ); + if ( ncfTask ) + { + // wait for task finished + if ( waitForTaskFinished( ncfTask ) ) + { + if ( mRemoteContentCache.contains( path ) ) + { + // We got the file! + return *mRemoteContentCache[ path ]; + } + } + } + // task found, no needs to continue + break; + } + // if no content returns the content is probably in remote content cache + // or a new task will be created + } + + if ( mRemoteContentCache.contains( path ) ) + { + // already fetched this content - phew. Just return what we already got. + return *mRemoteContentCache[ path ]; + } + + mPendingRemoteUrls.insert( path ); + //fire up task to fetch content in background + QNetworkRequest request( url ); + QgsSetRequestInitiatorClass( request, QStringLiteral( "QgsAbstractContentCache<%1>" ).arg( mTypeString ) ); + request.setAttribute( QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache ); + request.setAttribute( QNetworkRequest::CacheSaveControlAttribute, true ); + + QgsNetworkContentFetcherTask *task = new QgsNetworkContentFetcherTask( request ); + connect( task, &QgsNetworkContentFetcherTask::fetched, this, [this, task, path, missingContent] + { + const QMutexLocker locker( &mMutex ); + + QNetworkReply *reply = task->reply(); + if ( !reply ) + { + // canceled + QMetaObject::invokeMethod( const_cast< QgsAbstractContentCacheBase * >( qobject_cast< const QgsAbstractContentCacheBase * >( this ) ), "onRemoteContentFetched", Qt::QueuedConnection, Q_ARG( QString, path ), Q_ARG( bool, false ) ); + return; + } + + if ( reply->error() != QNetworkReply::NoError ) + { + QgsMessageLog::logMessage( tr( "%3 request failed [error: %1 - url: %2]" ).arg( reply->errorString(), path, mTypeString ), mTypeString ); + return; + } + + bool ok = true; + + const QVariant status = reply->attribute( QNetworkRequest::HttpStatusCodeAttribute ); + if ( !QgsVariantUtils::isNull( status ) && status.toInt() >= 400 ) + { + const QVariant phrase = reply->attribute( QNetworkRequest::HttpReasonPhraseAttribute ); + QgsMessageLog::logMessage( tr( "%4 request error [status: %1 - reason phrase: %2] for %3" ).arg( status.toInt() ).arg( phrase.toString(), path, mTypeString ), mTypeString ); + mRemoteContentCache.insert( path, new QByteArray( missingContent ) ); + ok = false; + } + + if ( !checkReply( reply, path ) ) + { + mRemoteContentCache.insert( path, new QByteArray( missingContent ) ); + ok = false; + } + + if ( ok ) + { + // read the content data + const QByteArray ba = reply->readAll(); + + // because of the fragility listed below in waitForTaskFinished, this slot may get called twice. In that case + // the second time will have an empty reply (we've already read it all...) + if ( !ba.isEmpty() ) + mRemoteContentCache.insert( path, new QByteArray( ba ) ); + } + QMetaObject::invokeMethod( const_cast< QgsAbstractContentCacheBase * >( qobject_cast< const QgsAbstractContentCacheBase * >( this ) ), "onRemoteContentFetched", Qt::QueuedConnection, Q_ARG( QString, path ), Q_ARG( bool, true ) ); + } ); + + QgsApplication::taskManager()->addTask( task ); + + // if blocking, wait for finished + if ( blocking ) + { + if ( waitForTaskFinished( task ) ) + { + if ( mRemoteContentCache.contains( path ) ) + { + // We got the file! + return *mRemoteContentCache[ path ]; + } + } + } + return fetchingContent; +} + +#endif // QGSABSTRACTCONTENTCACHE_P_H diff --git a/src/core/qgscplhttpfetchoverrider.h b/src/core/qgscplhttpfetchoverrider.h index bcf4654a7202..3cb64e51c558 100644 --- a/src/core/qgscplhttpfetchoverrider.h +++ b/src/core/qgscplhttpfetchoverrider.h @@ -21,17 +21,13 @@ #include #include #include -#include "qgsnetworkaccessmanager.h" // for QgsSetRequestInitiatorClass +#include "qgis_core.h" #include "cpl_http.h" #include "gdal.h" class QgsFeedback; -#ifndef SIP_RUN -#define QgsSetCPLHTTPFetchOverriderInitiatorClass(overrider, _class) QgsSetRequestInitiatorClass((overrider), _class) -#endif - /** * \ingroup core * \class QgsCPLHTTPFetchOverrider diff --git a/src/core/qgsdbquerylog.h b/src/core/qgsdbquerylog.h index e4eb6b0cb525..d777216192a8 100644 --- a/src/core/qgsdbquerylog.h +++ b/src/core/qgsdbquerylog.h @@ -102,13 +102,6 @@ class CORE_EXPORT QgsDatabaseQueryLogEntry Q_DECLARE_METATYPE( QgsDatabaseQueryLogEntry ); -#ifndef SIP_RUN -#include "qgsconfig.h" -constexpr int sQueryLoggerFilePrefixLength = CMAKE_SOURCE_DIR[sizeof( CMAKE_SOURCE_DIR ) - 1] == '/' ? sizeof( CMAKE_SOURCE_DIR ) + 1 : sizeof( CMAKE_SOURCE_DIR ); -#define QgsSetQueryLogClass(entry, _class) entry.initiatorClass = _class; entry.origin = QString(QString( __FILE__ ).mid( sQueryLoggerFilePrefixLength ) + ':' + QString::number( __LINE__ ) + " (" + __FUNCTION__ + ")"); -#define QGS_QUERY_LOG_ORIGIN QString(QString( __FILE__ ).mid( sQueryLoggerFilePrefixLength ) + ':' + QString::number( __LINE__ ) + " (" + __FUNCTION__ + ")") -#endif - /** * \ingroup core * \class QgsDatabaseQueryLog diff --git a/src/core/qgsdbquerylog_p.h b/src/core/qgsdbquerylog_p.h new file mode 100644 index 000000000000..808efa927370 --- /dev/null +++ b/src/core/qgsdbquerylog_p.h @@ -0,0 +1,24 @@ +/*************************************************************************** + qgsdbquerylog_p.h + ------------ + Date : February 2024 + Copyright : (C) 2024 by Matthias Kuhn + Email : matthias@opengis.ch + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef QGSDBQUERYLOG_P_H +#define QGSDBQUERYLOG_P_H + +#include "qgsconfig.h" +constexpr int sQueryLoggerFilePrefixLength = CMAKE_SOURCE_DIR[sizeof( CMAKE_SOURCE_DIR ) - 1] == '/' ? sizeof( CMAKE_SOURCE_DIR ) + 1 : sizeof( CMAKE_SOURCE_DIR ); +#define QgsSetQueryLogClass(entry, _class) entry.initiatorClass = _class; entry.origin = QString(QString( __FILE__ ).mid( sQueryLoggerFilePrefixLength ) + ':' + QString::number( __LINE__ ) + " (" + __FUNCTION__ + ")"); +#define QGS_QUERY_LOG_ORIGIN QString(QString( __FILE__ ).mid( sQueryLoggerFilePrefixLength ) + ':' + QString::number( __LINE__ ) + " (" + __FUNCTION__ + ")") + +#endif // QGSDBQUERYLOG_P_H diff --git a/src/core/qgsgml.cpp b/src/core/qgsgml.cpp index f22c99c397b1..1f43441ba76d 100644 --- a/src/core/qgsgml.cpp +++ b/src/core/qgsgml.cpp @@ -20,6 +20,7 @@ #include "qgslogger.h" #include "qgsmessagelog.h" #include "qgsnetworkaccessmanager.h" +#include "qgssetrequestinitiator_p.h" #include "qgswkbptr.h" #include "qgsogcutils.h" #include "qgsogrutils.h" diff --git a/src/core/qgsimagecache.cpp b/src/core/qgsimagecache.cpp index 513ebb294735..488f4ac5ae48 100644 --- a/src/core/qgsimagecache.cpp +++ b/src/core/qgsimagecache.cpp @@ -24,6 +24,7 @@ #include "qgsmessagelog.h" #include "qgsnetworkcontentfetchertask.h" #include "qgssettings.h" +#include "qgsabstractcontentcache_p.h" #include #include @@ -513,3 +514,5 @@ QImage QgsImageCache::getFrameFromReader( QImageReader &reader, int frameNumber } return reader.read(); } + +template class QgsAbstractContentCache; diff --git a/src/core/qgssourcecache.cpp b/src/core/qgssourcecache.cpp index 57f1f1bc78b7..4ed833df86b3 100644 --- a/src/core/qgssourcecache.cpp +++ b/src/core/qgssourcecache.cpp @@ -16,6 +16,7 @@ ***************************************************************************/ #include "qgssourcecache.h" +#include "qgsabstractcontentcache_p.h" #include "qgis.h" #include "qgslogger.h" @@ -114,3 +115,5 @@ QString QgsSourceCache::fetchSource( const QString &path, bool &isBroken, bool b return filePath; } + +template class QgsAbstractContentCache; diff --git a/src/core/symbology/qgssvgcache.cpp b/src/core/symbology/qgssvgcache.cpp index f8823a19c6be..99e49597fc47 100644 --- a/src/core/symbology/qgssvgcache.cpp +++ b/src/core/symbology/qgssvgcache.cpp @@ -22,6 +22,7 @@ #include "qgsmessagelog.h" #include "qgssymbollayerutils.h" #include "qgsnetworkcontentfetchertask.h" +#include "qgsabstractcontentcache_p.h" #include #include @@ -855,3 +856,4 @@ QImage QgsSvgCache::imageFromCachedPicture( const QgsSvgCacheEntry &entry ) cons return image; } +template class QgsAbstractContentCache; \ No newline at end of file diff --git a/src/core/tiledscene/qgscesiumtilesdataprovider.cpp b/src/core/tiledscene/qgscesiumtilesdataprovider.cpp index 1f043a5a962c..d76448f28d54 100644 --- a/src/core/tiledscene/qgscesiumtilesdataprovider.cpp +++ b/src/core/tiledscene/qgscesiumtilesdataprovider.cpp @@ -22,6 +22,7 @@ #include "qgsprovidersublayerdetails.h" #include "qgsthreadingutils.h" #include "qgsnetworkaccessmanager.h" +#include "qgssetrequestinitiator_p.h" #include "qgsblockingnetworkrequest.h" #include "qgscesiumutils.h" #include "qgssphere.h" diff --git a/src/core/vectortile/qgsarcgisvectortileservicedataprovider.cpp b/src/core/vectortile/qgsarcgisvectortileservicedataprovider.cpp index 6f4aae4322de..9ce13c98a0fa 100644 --- a/src/core/vectortile/qgsarcgisvectortileservicedataprovider.cpp +++ b/src/core/vectortile/qgsarcgisvectortileservicedataprovider.cpp @@ -18,6 +18,7 @@ #include "qgsapplication.h" #include "qgsblockingnetworkrequest.h" #include "qgsnetworkaccessmanager.h" +#include "qgssetrequestinitiator_p.h" #include "qgsvectortileutils.h" #include "qgsarcgisrestutils.h" #include "qgslogger.h" diff --git a/src/core/vectortile/qgsvectortilelayer.cpp b/src/core/vectortile/qgsvectortilelayer.cpp index 010894628c63..73eecf3990a3 100644 --- a/src/core/vectortile/qgsvectortilelayer.cpp +++ b/src/core/vectortile/qgsvectortilelayer.cpp @@ -23,6 +23,7 @@ #include "qgsvectortileloader.h" #include "qgsvectortileutils.h" #include "qgsnetworkaccessmanager.h" +#include "qgssetrequestinitiator_p.h" #include "qgsdatasourceuri.h" #include "qgslayermetadataformatter.h" #include "qgsblockingnetworkrequest.h" diff --git a/src/core/vectortile/qgsvectortileutils.cpp b/src/core/vectortile/qgsvectortileutils.cpp index 209448d0ef35..1504d09549bd 100644 --- a/src/core/vectortile/qgsvectortileutils.cpp +++ b/src/core/vectortile/qgsvectortileutils.cpp @@ -33,6 +33,7 @@ #include "qgsvectortilerenderer.h" #include "qgsmapboxglstyleconverter.h" #include "qgsnetworkaccessmanager.h" +#include "qgssetrequestinitiator_p.h" #include "qgsblockingnetworkrequest.h" #include "qgsjsonutils.h" diff --git a/src/core/vectortile/qgsxyzvectortiledataprovider.cpp b/src/core/vectortile/qgsxyzvectortiledataprovider.cpp index 37cfff3fde32..c9ffb6bf1c28 100644 --- a/src/core/vectortile/qgsxyzvectortiledataprovider.cpp +++ b/src/core/vectortile/qgsxyzvectortiledataprovider.cpp @@ -19,6 +19,7 @@ #include "qgsvectortileloader.h" #include "qgsvectortileutils.h" #include "qgsnetworkaccessmanager.h" +#include "qgssetrequestinitiator_p.h" #include "qgsapplication.h" #include "qgsauthmanager.h" #include "qgsmessagelog.h" diff --git a/src/crssync/CMakeLists.txt b/src/crssync/CMakeLists.txt index 278272161a98..06fd69c11264 100644 --- a/src/crssync/CMakeLists.txt +++ b/src/crssync/CMakeLists.txt @@ -12,6 +12,8 @@ else () qgis_core ) + target_compile_definitions(crssync PRIVATE "CMAKE_INSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\"") + if(MSVC AND NOT USING_NMAKE) add_custom_target(synccrsdb COMMENT "Running crssync" diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 694a97029165..53f0e1a30173 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -1792,6 +1792,8 @@ if(ENABLE_MODELTEST) target_link_libraries(qgis_gui ${QT_VERSION_BASE}::Test) endif() +# We use private headers from core that need this +target_compile_definitions(qgis_gui PRIVATE "CMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\"") target_compile_definitions(qgis_gui PRIVATE "-DQT_NO_FOREACH") if(WIN32) diff --git a/src/gui/qgshelp.cpp b/src/gui/qgshelp.cpp index 04438a322ce4..080e5a0a1af8 100644 --- a/src/gui/qgshelp.cpp +++ b/src/gui/qgshelp.cpp @@ -23,6 +23,7 @@ #include "qgsexpressioncontextutils.h" #include "qgsblockingnetworkrequest.h" #include "qgsnetworkaccessmanager.h" +#include "qgssetrequestinitiator_p.h" #include #include diff --git a/src/providers/arcgisrest/CMakeLists.txt b/src/providers/arcgisrest/CMakeLists.txt index 5d6627d20b97..ce4a7bb81cac 100644 --- a/src/providers/arcgisrest/CMakeLists.txt +++ b/src/providers/arcgisrest/CMakeLists.txt @@ -31,6 +31,9 @@ target_include_directories(provider_arcgisfeatureserver_a PUBLIC # require c++17 target_compile_features(provider_arcgisfeatureserver_a PRIVATE cxx_std_17) +# We use private headers from core that need this +target_compile_definitions(provider_arcgisfeatureserver_a PRIVATE "CMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\"") + target_link_libraries (provider_arcgisfeatureserver_a qgis_core ${QCA_LIBRARY} @@ -80,6 +83,9 @@ else() # require c++17 target_compile_features(provider_arcgisfeatureserver PRIVATE cxx_std_17) + # We use private headers from core that need this + target_compile_definitions(provider_arcgisfeatureserver PRIVATE "CMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\"") + if (WITH_GUI) target_link_libraries(provider_arcgisfeatureserver qgis_gui @@ -108,6 +114,9 @@ target_include_directories(provider_arcgismapserver_a PUBLIC # require c++17 target_compile_features(provider_arcgismapserver_a PRIVATE cxx_std_17) +# We use private headers from core that need this +target_compile_definitions(provider_arcgismapserver_a PRIVATE "CMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\"") + target_link_libraries (provider_arcgismapserver_a qgis_core ${QCA_LIBRARY} @@ -121,6 +130,8 @@ else() # require c++17 target_compile_features(provider_arcgismapserver PRIVATE cxx_std_17) + # We use private headers from core that need this + target_compile_definitions(provider_arcgismapserver PRIVATE "CMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\"") target_link_libraries(provider_arcgismapserver qgis_core diff --git a/src/providers/arcgisrest/qgsafsshareddata.cpp b/src/providers/arcgisrest/qgsafsshareddata.cpp index 8b9fe47d2e82..416ef85d1cb0 100644 --- a/src/providers/arcgisrest/qgsafsshareddata.cpp +++ b/src/providers/arcgisrest/qgsafsshareddata.cpp @@ -18,6 +18,7 @@ #include "qgsarcgisrestquery.h" #include "qgslogger.h" #include "qgsnetworkaccessmanager.h" +#include "qgssetrequestinitiator_p.h" #include "qgsblockingnetworkrequest.h" #include "qgsreadwritelocker.h" #include "qgsjsonutils.h" diff --git a/src/providers/arcgisrest/qgsamsprovider.cpp b/src/providers/arcgisrest/qgsamsprovider.cpp index 4a40b93f75e7..ff8618be9809 100644 --- a/src/providers/arcgisrest/qgsamsprovider.cpp +++ b/src/providers/arcgisrest/qgsamsprovider.cpp @@ -25,6 +25,7 @@ #include "qgsgeometry.h" #include "qgsapplication.h" #include "qgsnetworkaccessmanager.h" +#include "qgssetrequestinitiator_p.h" #include "qgssettings.h" #include "qgsmessagelog.h" #include "qgsauthmanager.h" diff --git a/src/providers/mssql/CMakeLists.txt b/src/providers/mssql/CMakeLists.txt index 1ee3523c7e4d..995e28e41980 100644 --- a/src/providers/mssql/CMakeLists.txt +++ b/src/providers/mssql/CMakeLists.txt @@ -40,6 +40,11 @@ add_library(provider_mssql MODULE ${MSSQL_SRCS} ${MSSQL_HDRS}) # require c++17 target_compile_features(provider_mssql PRIVATE cxx_std_17) +target_compile_definitions(provider_mssql PRIVATE "CMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\"") + +# We use private headers from core that need this +target_compile_definitions(provider_mssql PRIVATE "CMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\"") + target_link_libraries(provider_mssql qgis_core ${QT_VERSION_BASE}::Sql @@ -58,6 +63,9 @@ add_library (provider_mssql_a STATIC ${MSSQL_SRCS} ${MSSQL_HDRS}) # require c++17 target_compile_features(provider_mssql_a PRIVATE cxx_std_17) +# We use private headers from core that need this +target_compile_definitions(provider_mssql_a PRIVATE "CMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\"") + target_link_libraries (provider_mssql_a qgis_core ${POSTGRES_LIBRARY} diff --git a/src/providers/mssql/qgsmssqlfeatureiterator.cpp b/src/providers/mssql/qgsmssqlfeatureiterator.cpp index bc0d3aa597d6..4df2ed38def2 100644 --- a/src/providers/mssql/qgsmssqlfeatureiterator.cpp +++ b/src/providers/mssql/qgsmssqlfeatureiterator.cpp @@ -21,6 +21,7 @@ #include "qgsmssqltransaction.h" #include "qgslogger.h" #include "qgsdbquerylog.h" +#include "qgsdbquerylog_p.h" #include "qgsexception.h" #include "qgsmssqldatabase.h" #include "qgsgeometryengine.h" diff --git a/src/providers/mssql/qgsmssqlprovider.cpp b/src/providers/mssql/qgsmssqlprovider.cpp index 94048210f0f2..02fc34dee7ca 100644 --- a/src/providers/mssql/qgsmssqlprovider.cpp +++ b/src/providers/mssql/qgsmssqlprovider.cpp @@ -21,6 +21,7 @@ #include "qgsmssqlproviderconnection.h" #include "qgsfeedback.h" #include "qgsdbquerylog.h" +#include "qgsdbquerylog_p.h" #include #include diff --git a/src/providers/mssql/qgsmssqlproviderconnection.cpp b/src/providers/mssql/qgsmssqlproviderconnection.cpp index 5f5fb9baf0bf..4ca5f00347c4 100644 --- a/src/providers/mssql/qgsmssqlproviderconnection.cpp +++ b/src/providers/mssql/qgsmssqlproviderconnection.cpp @@ -28,6 +28,7 @@ #include "qgsfeedback.h" #include "qgsmssqlsqlquerybuilder.h" #include "qgsdbquerylog.h" +#include "qgsdbquerylog_p.h" #include #include diff --git a/src/providers/oracle/qgsoracledataitems.cpp b/src/providers/oracle/qgsoracledataitems.cpp index 230ab4444a83..e753ebb41ad6 100644 --- a/src/providers/oracle/qgsoracledataitems.cpp +++ b/src/providers/oracle/qgsoracledataitems.cpp @@ -22,6 +22,7 @@ #include "qgsmessageoutput.h" #include "qgsvectorlayer.h" #include "qgsdbquerylog.h" +#include "qgsdbquerylog_p.h" #include "qgsvectorlayerexporter.h" #include diff --git a/src/providers/oracle/qgsoraclefeatureiterator.cpp b/src/providers/oracle/qgsoraclefeatureiterator.cpp index b5ce52ff210c..1676c8ddb97c 100644 --- a/src/providers/oracle/qgsoraclefeatureiterator.cpp +++ b/src/providers/oracle/qgsoraclefeatureiterator.cpp @@ -19,6 +19,7 @@ #include "qgsoracleexpressioncompiler.h" #include "qgsoracletransaction.h" #include "qgsdbquerylog.h" +#include "qgsdbquerylog_p.h" #include "qgslogger.h" #include "qgsmessagelog.h" #include "qgsgeometry.h" diff --git a/src/providers/oracle/qgsoracleprovider.cpp b/src/providers/oracle/qgsoracleprovider.cpp index 1a07a94214af..23c226f516e8 100644 --- a/src/providers/oracle/qgsoracleprovider.cpp +++ b/src/providers/oracle/qgsoracleprovider.cpp @@ -28,6 +28,7 @@ #include "qgscoordinatereferencesystem.h" #include "qgslogger.h" #include "qgsdbquerylog.h" +#include "qgsdbquerylog_p.h" #include "qgsprojectstorageguiprovider.h" #include "qgsprojectstorageregistry.h" #include "qgsvectorlayer.h" diff --git a/src/providers/oracle/qgsoracleproviderconnection.cpp b/src/providers/oracle/qgsoracleproviderconnection.cpp index 86e4114b9cca..2e14f286259a 100644 --- a/src/providers/oracle/qgsoracleproviderconnection.cpp +++ b/src/providers/oracle/qgsoracleproviderconnection.cpp @@ -16,6 +16,7 @@ #include "qgsoracleproviderconnection.h" #include "qgsoracleconn.h" #include "qgsdbquerylog.h" +#include "qgsdbquerylog_p.h" #include "qgssettings.h" #include "qgsoracleprovider.h" #include "qgsexception.h" diff --git a/src/providers/oracle/qgsoracletransaction.cpp b/src/providers/oracle/qgsoracletransaction.cpp index 006585f629c6..7e319c1929de 100644 --- a/src/providers/oracle/qgsoracletransaction.cpp +++ b/src/providers/oracle/qgsoracletransaction.cpp @@ -22,6 +22,7 @@ #include "qgis.h" #include "qgsoracleconn.h" #include "qgsdbquerylog.h" +#include "qgsdbquerylog_p.h" QgsOracleTransaction::QgsOracleTransaction( const QString &connString ) : QgsTransaction( connString ) diff --git a/src/providers/postgres/CMakeLists.txt b/src/providers/postgres/CMakeLists.txt index b074d4d845d7..84e3e4b66445 100644 --- a/src/providers/postgres/CMakeLists.txt +++ b/src/providers/postgres/CMakeLists.txt @@ -52,6 +52,7 @@ target_include_directories(provider_postgres_a PUBLIC # require c++17 target_compile_features(provider_postgres_a PRIVATE cxx_std_17) +target_compile_definitions(provider_postgres_a PRIVATE "CMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\"") target_link_libraries (provider_postgres_a qgis_core @@ -77,6 +78,7 @@ if (WITH_GUI) # require c++17 target_compile_features(provider_postgres_gui_a PRIVATE cxx_std_17) + target_compile_definitions(provider_postgres_gui_a PRIVATE "CMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\"") target_link_libraries(provider_postgres_gui_a qgis_gui @@ -110,6 +112,7 @@ target_include_directories(provider_postgresraster_a PUBLIC # require c++17 target_compile_features(provider_postgresraster_a PRIVATE cxx_std_17) +target_compile_definitions(provider_postgresraster_a PRIVATE "CMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\"") target_link_libraries (provider_postgresraster_a qgis_core @@ -151,6 +154,8 @@ else() # require c++17 target_compile_features(provider_postgres PRIVATE cxx_std_17) target_compile_features(provider_postgresraster PRIVATE cxx_std_17) + target_compile_definitions(provider_postgres PRIVATE "CMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\"") + target_compile_definitions(provider_postgresraster PRIVATE "CMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\"") target_link_libraries(provider_postgres qgis_core diff --git a/src/providers/postgres/qgspostgresconn.cpp b/src/providers/postgres/qgspostgresconn.cpp index 10e6ce978387..7b057491a06d 100644 --- a/src/providers/postgres/qgspostgresconn.cpp +++ b/src/providers/postgres/qgspostgresconn.cpp @@ -28,6 +28,7 @@ #include "qgspostgresconnpool.h" #include "qgsvariantutils.h" #include "qgsdbquerylog.h" +#include "qgsdbquerylog_p.h" #include "qgsapplication.h" #include diff --git a/src/providers/postgres/qgspostgresconn.h b/src/providers/postgres/qgspostgresconn.h index e71cbc9b347f..f994684c4267 100644 --- a/src/providers/postgres/qgspostgresconn.h +++ b/src/providers/postgres/qgspostgresconn.h @@ -29,6 +29,7 @@ #include "qgswkbtypes.h" #include "qgsconfig.h" #include "qgsvectordataprovider.h" +#include "qgsdbquerylog_p.h" extern "C" { diff --git a/src/providers/postgres/qgspostgresfeatureiterator.cpp b/src/providers/postgres/qgspostgresfeatureiterator.cpp index 3cc93a1e14b4..ee0f33ce32cd 100644 --- a/src/providers/postgres/qgspostgresfeatureiterator.cpp +++ b/src/providers/postgres/qgspostgresfeatureiterator.cpp @@ -20,6 +20,7 @@ #include "qgspostgrestransaction.h" #include "qgslogger.h" #include "qgsdbquerylog.h" +#include "qgsdbquerylog_p.h" #include "qgsmessagelog.h" #include "qgsexception.h" #include "qgsgeometryengine.h" diff --git a/src/providers/postgres/qgspostgresprovider.cpp b/src/providers/postgres/qgspostgresprovider.cpp index 9541dc0ea55f..ae2933599c20 100644 --- a/src/providers/postgres/qgspostgresprovider.cpp +++ b/src/providers/postgres/qgspostgresprovider.cpp @@ -40,6 +40,7 @@ #include "qgsstringutils.h" #include "qgsjsonutils.h" #include "qgsdbquerylog.h" +#include "qgsdbquerylog_p.h" #include "qgspostgreslayermetadataprovider.h" #include "qgspostgresprovider.h" diff --git a/src/providers/spatialite/CMakeLists.txt b/src/providers/spatialite/CMakeLists.txt index efaad9a47c81..5d6957a2370c 100644 --- a/src/providers/spatialite/CMakeLists.txt +++ b/src/providers/spatialite/CMakeLists.txt @@ -43,6 +43,7 @@ target_link_libraries(provider_spatialite_a # require c++17 target_compile_features(provider_spatialite_a PRIVATE cxx_std_17) +target_compile_definitions(provider_spatialite_a PRIVATE "CMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\"") target_compile_definitions(provider_spatialite_a PRIVATE "-DQT_NO_FOREACH") @@ -68,6 +69,7 @@ if (WITH_GUI) # require c++17 target_compile_features(provider_spatialite_gui_a PRIVATE cxx_std_17) + target_compile_definitions(provider_spatialite_gui_a PRIVATE "CMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\"") target_compile_definitions(provider_spatialite_gui_a PRIVATE "-DQT_NO_FOREACH") @@ -90,6 +92,7 @@ else() # require c++17 target_compile_features(provider_spatialite PRIVATE cxx_std_17) + target_compile_definitions(provider_spatialite PRIVATE "CMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\"") target_compile_definitions(provider_spatialite PRIVATE "-DQT_NO_FOREACH") diff --git a/src/providers/spatialite/qgsspatialitefeatureiterator.cpp b/src/providers/spatialite/qgsspatialitefeatureiterator.cpp index 52d6ddff77e3..b8d180d007be 100644 --- a/src/providers/spatialite/qgsspatialitefeatureiterator.cpp +++ b/src/providers/spatialite/qgsspatialitefeatureiterator.cpp @@ -26,6 +26,7 @@ #include "qgsjsonutils.h" #include "qgsexception.h" #include "qgsgeometryengine.h" +#include "qgsdbquerylog_p.h" QgsSpatiaLiteFeatureIterator::QgsSpatiaLiteFeatureIterator( QgsSpatiaLiteFeatureSource *source, bool ownSource, const QgsFeatureRequest &request ) : QgsAbstractFeatureIteratorFromSource( source, ownSource, request ) diff --git a/src/providers/spatialite/qgsspatialiteprovider.cpp b/src/providers/spatialite/qgsspatialiteprovider.cpp index 8e0e4ca88d67..996cd6fcce93 100644 --- a/src/providers/spatialite/qgsspatialiteprovider.cpp +++ b/src/providers/spatialite/qgsspatialiteprovider.cpp @@ -31,6 +31,7 @@ email : a.furieri@lqt.it #include "qgsspatialitetransaction.h" #include "qgsspatialiteproviderconnection.h" #include "qgsdbquerylog.h" +#include "qgsdbquerylog_p.h" #include "qgsjsonutils.h" #include "qgsvectorlayer.h" diff --git a/src/providers/spatialite/qgsspatialiteproviderconnection.cpp b/src/providers/spatialite/qgsspatialiteproviderconnection.cpp index ebae0ec07c2f..3083da243a60 100644 --- a/src/providers/spatialite/qgsspatialiteproviderconnection.cpp +++ b/src/providers/spatialite/qgsspatialiteproviderconnection.cpp @@ -24,6 +24,7 @@ #include "qgsvectorlayer.h" #include "qgsfeedback.h" #include "qgsdbquerylog.h" +#include "qgsdbquerylog_p.h" #include #include diff --git a/src/providers/wcs/CMakeLists.txt b/src/providers/wcs/CMakeLists.txt index 09d29e14ce71..823a36c7b667 100644 --- a/src/providers/wcs/CMakeLists.txt +++ b/src/providers/wcs/CMakeLists.txt @@ -29,6 +29,8 @@ target_link_libraries(provider_wcs_a # require c++17 target_compile_features(provider_wcs_a PRIVATE cxx_std_17) +# We use private headers from core that need this +target_compile_definitions(provider_wcs_a PRIVATE "CMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\"") target_compile_definitions(provider_wcs_a PRIVATE "-DQT_NO_FOREACH") if (WITH_GUI) @@ -68,6 +70,9 @@ else() # require c++17 target_compile_features(provider_wcs PRIVATE cxx_std_17) + + # We use private headers from core that need this + target_compile_definitions(provider_wcs PRIVATE "CMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\"") target_link_libraries(provider_wcs qgis_core diff --git a/src/providers/wcs/qgswcscapabilities.cpp b/src/providers/wcs/qgswcscapabilities.cpp index d0e45ab858c6..b892af7031b8 100644 --- a/src/providers/wcs/qgswcscapabilities.cpp +++ b/src/providers/wcs/qgswcscapabilities.cpp @@ -30,6 +30,7 @@ #include "qgsrectangle.h" #include "qgscoordinatereferencesystem.h" #include "qgsnetworkaccessmanager.h" +#include "qgssetrequestinitiator_p.h" #include "qgsmessageoutput.h" #include "qgsmessagelog.h" #include "qgsapplication.h" diff --git a/src/providers/wcs/qgswcsprovider.cpp b/src/providers/wcs/qgswcsprovider.cpp index 052a25e63409..6603b39f2e51 100644 --- a/src/providers/wcs/qgswcsprovider.cpp +++ b/src/providers/wcs/qgswcsprovider.cpp @@ -27,6 +27,7 @@ #include "qgsrectangle.h" #include "qgscoordinatereferencesystem.h" #include "qgsnetworkaccessmanager.h" +#include "qgssetrequestinitiator_p.h" #include "qgsnetworkreplyparser.h" #include "qgsmessagelog.h" #include "qgsexception.h" diff --git a/src/providers/wfs/CMakeLists.txt b/src/providers/wfs/CMakeLists.txt index c553d933653e..d08fcabb4f72 100644 --- a/src/providers/wfs/CMakeLists.txt +++ b/src/providers/wfs/CMakeLists.txt @@ -69,6 +69,9 @@ target_link_libraries(provider_wfs_a # require c++17 target_compile_features(provider_wfs_a PRIVATE cxx_std_17) + +# We use private headers from core that need this +target_compile_definitions(provider_wfs_a PRIVATE "CMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\"") target_compile_definitions(provider_wfs_a PRIVATE "-DQT_NO_FOREACH") if (WITH_GUI) @@ -117,6 +120,8 @@ else() # require c++17 target_compile_features(provider_wfs PRIVATE cxx_std_17) + # We use private headers from core that need this + target_compile_definitions(provider_wfs PRIVATE "CMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\"") target_compile_definitions(provider_wfs PRIVATE "-DQT_NO_FOREACH") target_link_libraries (provider_wfs diff --git a/src/providers/wfs/qgsbasenetworkrequest.cpp b/src/providers/wfs/qgsbasenetworkrequest.cpp index f33d74cc3eac..e85149acee87 100644 --- a/src/providers/wfs/qgsbasenetworkrequest.cpp +++ b/src/providers/wfs/qgsbasenetworkrequest.cpp @@ -19,6 +19,7 @@ #include "qgslogger.h" #include "qgsmessagelog.h" #include "qgsnetworkaccessmanager.h" +#include "qgssetrequestinitiator_p.h" #include "qgssettings.h" #include "qgsvariantutils.h" diff --git a/src/providers/wms/CMakeLists.txt b/src/providers/wms/CMakeLists.txt index 267ab85b486c..1a26656f8370 100644 --- a/src/providers/wms/CMakeLists.txt +++ b/src/providers/wms/CMakeLists.txt @@ -55,6 +55,9 @@ endif() target_link_libraries(provider_wms_a qgis_core ) + +# We use private headers from core that need this +target_compile_definitions(provider_wms_a PRIVATE "CMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\"") target_compile_definitions(provider_wms_a PRIVATE "-DQT_NO_FOREACH") if (WITH_GUI) @@ -90,6 +93,8 @@ else() endif() target_compile_definitions(provider_wms PRIVATE "-DQT_NO_FOREACH") + # We use private headers from core that need this + target_compile_definitions(provider_wms PRIVATE "CMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\"") install (TARGETS provider_wms RUNTIME DESTINATION ${QGIS_PLUGIN_DIR} diff --git a/src/providers/wms/qgswmscapabilities.cpp b/src/providers/wms/qgswmscapabilities.cpp index bb0dd0fdbcfe..b586292c4163 100644 --- a/src/providers/wms/qgswmscapabilities.cpp +++ b/src/providers/wms/qgswmscapabilities.cpp @@ -29,6 +29,7 @@ #include "qgslogger.h" #include "qgsmessagelog.h" #include "qgsnetworkaccessmanager.h" +#include "qgssetrequestinitiator_p.h" #include "qgsexception.h" #include "qgstemporalutils.h" #include "qgsunittypes.h" diff --git a/src/providers/wms/qgswmsprovider.cpp b/src/providers/wms/qgswmsprovider.cpp index af8e12d2d6ad..52ffbc11c404 100644 --- a/src/providers/wms/qgswmsprovider.cpp +++ b/src/providers/wms/qgswmsprovider.cpp @@ -39,6 +39,7 @@ #include "qgsmessageoutput.h" #include "qgsmessagelog.h" #include "qgsnetworkaccessmanager.h" +#include "qgssetrequestinitiator_p.h" #include "qgsnetworkreplyparser.h" #include "qgstilecache.h" #include "qgsgdalutils.h"