diff --git a/debian/copyright b/debian/copyright index d57b985763b..c1b61bbf12f 100644 --- a/debian/copyright +++ b/debian/copyright @@ -753,10 +753,6 @@ Files: src/app/qtmain_android.cpp Copyright: 2009-2011, BogDan Vatra License: BSD-3-Clause -Files: src/auth/oauth2/qjsonwrapper/* -Copyright: 2014, Uwe L. Korn -License: MIT - Files: src/core/pal/* Copyright: 2008, Maxence Laurent, MIS-TIC, HEIG-VD License: GPL-3+ diff --git a/external/qjsonwrapper/Json.cpp b/external/qjsonwrapper/Json.cpp deleted file mode 100644 index e8a602e2f18..00000000000 --- a/external/qjsonwrapper/Json.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/* Copyright 2014, Uwe L. Korn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#include "Json.h" - -#include -#include -#include - -namespace QJsonWrapper -{ - - QVariantMap - qobject2qvariant( const QObject *object ) - { - QVariantMap map; - if ( !object ) - { - return map; - } - - const QMetaObject *metaObject = object->metaObject(); - for ( int i = 0; i < metaObject->propertyCount(); ++i ) - { - QMetaProperty metaproperty = metaObject->property( i ); - if ( metaproperty.isReadable() ) - { - QVariant val = object->property( metaproperty.name() ); -#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) - if ( ( val.metaType().flags() & QMetaType::IsEnumeration ) ) - { - val.convert( QMetaType::Int ); - } -#endif - map[ QLatin1String( metaproperty.name() ) ] = val; - } - } - return map; - } - - - void - qvariant2qobject( const QVariantMap &variant, QObject *object ) - { - for ( QVariantMap::const_iterator iter = variant.begin(); iter != variant.end(); ++iter ) - { - QVariant property = object->property( iter.key().toLatin1() ); - Q_ASSERT( property.isValid() ); - if ( property.isValid() ) - { - QVariant value = iter.value(); -#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) - const QVariant::Type propertyType = property.type(); -#else - const QMetaType propertyType = property.metaType(); -#endif - if ( value.canConvert( propertyType ) ) - { - value.convert( propertyType ); - object->setProperty( iter.key().toLatin1(), value ); - } - else if ( QString( QLatin1String( "QVariant" ) ).compare( QLatin1String( property.typeName() ) ) == 0 ) - { - object->setProperty( iter.key().toLatin1(), value ); - } - } - } - } - - - QVariant - parseJson( const QByteArray &jsonData, bool *ok, QByteArray *errorString ) - { - QJsonParseError error; - QJsonDocument doc = QJsonDocument::fromJson( jsonData, &error ); - if ( ok ) - { - *ok = ( error.error == QJsonParseError::NoError ); - } - if ( errorString && !ok ) - { - *errorString = error.errorString().toUtf8(); - } - return doc.toVariant(); - } - - - QByteArray - toJson( const QVariant &variant, bool *ok, QByteArray *errorString, bool indented ) - { - QVariant _variant = variant; - if ( variant.type() == QVariant::Hash ) - { - // QJsonDocument cannot deal with QVariantHash, so convert. - const QVariantHash hash = variant.toHash(); - QVariantMap map; - QHashIterator it( hash ); - while ( it.hasNext() ) - { - it.next(); - map.insert( it.key(), it.value() ); - } - _variant = map; - } - - QJsonDocument doc = QJsonDocument::fromVariant( _variant ); - if ( ok ) - { - *ok = !doc.isNull(); - } - if ( errorString && !ok ) - { - *errorString = QByteArray( "Failed to convert from variant" ); - } - return doc.toJson( indented ? QJsonDocument::Indented : QJsonDocument::Compact ); - } - -} diff --git a/external/qjsonwrapper/Json.h b/external/qjsonwrapper/Json.h deleted file mode 100644 index 1871913243d..00000000000 --- a/external/qjsonwrapper/Json.h +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright 2014, Uwe L. Korn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - - -#define SIP_NO_FILE - - -#pragma once -#ifndef QJSONWRAPPER_JSON_H -#define QJSONWRAPPER_JSON_H - -#include - -namespace QJsonWrapper -{ - - /** - * Convert a QObject instance to a QVariantMap by adding its properties - * as key-value pairs. - * - * @param object Object that shall be "serialised" - * @return All properties of the object stored as QVariantMap - */ - QVariantMap qobject2qvariant( const QObject *object ); - - /** - * Write out all key-value pairs into the respective properties of the - * given object. - * - * @param variant The key-value pairs that shall be stored in the object. - * @param object The destiation object where we store the key-value pairs of the map as properties. - */ - void qvariant2qobject( const QVariantMap &variant, QObject *object ); - - /** - * Parse the JSON string and return the result as a QVariant. - * - * @param jsonData The string containing the data as JSON. - * @param ok Set to TRUE if the conversion was successful, otherwise FALSE. - * @param errorString Any error string produced during parsing - * @return After a successful conversion the parsed data either as QVariantMap or QVariantList. - */ - QVariant parseJson( const QByteArray &jsonData, bool *ok = nullptr, QByteArray *errorString = nullptr ); - - /** - * Convert a QVariant to a JSON representation. - * - * This function will accept Strings, Number, QVariantList and QVariantMaps - * as input types. Although Qt5's JSON implementation itself does not - * support the serialisation of QVariantHash, we will convert a QVariantHash - * to a QVariantMap but it is suggest to convert all QVariantHash to - * QVariantMap in your code than passing them here. - * - * @param variant The data to be serialised. - * @param ok Set to TRUE if the conversion was successful, otherwise FALSE. - * @param errorString Any error string produced during conversion - * @param indented Whether to indent resultant JSON code - * @return After a successful serialisation the data of the QVariant represented as JSON. - */ - QByteArray toJson( const QVariant &variant, bool *ok = nullptr, QByteArray *errorString = nullptr, bool indented = false ); -} - -#endif // QJSONWRAPPER_JSON_H diff --git a/external/qjsonwrapper/LICENSE b/external/qjsonwrapper/LICENSE deleted file mode 100644 index e10c5981e22..00000000000 --- a/external/qjsonwrapper/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Uwe L. Korn - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/external/qjsonwrapper/README.md b/external/qjsonwrapper/README.md deleted file mode 100644 index c4eb21b2743..00000000000 --- a/external/qjsonwrapper/README.md +++ /dev/null @@ -1,7 +0,0 @@ -qjson-qt5json-wrapper -===================== - -Wrapper library for wrapping QJson and Qt5's Json implementation behind a simple common interface - - -https://github.com/xhochy/qjson-qt5json-wrapper diff --git a/src/auth/oauth2/CMakeLists.txt b/src/auth/oauth2/CMakeLists.txt index 15cf48ea501..5f993144637 100644 --- a/src/auth/oauth2/CMakeLists.txt +++ b/src/auth/oauth2/CMakeLists.txt @@ -52,14 +52,12 @@ set(AUTH_OAUTH2_SRCS core/qgso2.cpp core/qgsauthoauth2config.cpp core/qgsauthoauth2method.cpp - ${CMAKE_SOURCE_DIR}/external/qjsonwrapper/Json.cpp ) set(AUTH_OAUTH2_HDRS core/qgsauthoauth2config.h core/qgsauthoauth2method.h core/qgso2.h - ${CMAKE_SOURCE_DIR}/external/qjsonwrapper/Json.h ) if(WITH_INTERNAL_O2) @@ -124,7 +122,6 @@ else() endif() target_include_directories(authmethod_oauth2_a PRIVATE - ${CMAKE_SOURCE_DIR}/external/qjsonwrapper ${CMAKE_SOURCE_DIR}/src/auth/oauth2/core ) if (WITH_GUI) @@ -145,7 +142,6 @@ else() add_library(authmethod_oauth2 MODULE ${AUTH_OAUTH2_SRCS} ${AUTH_OAUTH2_HDRS} ${AUTH_OAUTH2_RCCS} ${AUTH_OAUTH2_UIS_H}) target_include_directories(authmethod_oauth2 PRIVATE - ${CMAKE_SOURCE_DIR}/external/qjsonwrapper ${CMAKE_SOURCE_DIR}/src/auth/oauth2/core )