Hello community,
here is the log from the commit of package libmygpo-qt for openSUSE:Factory checked in at 2018-02-28 20:00:07
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libmygpo-qt (Old)
and /work/SRC/openSUSE:Factory/.libmygpo-qt.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libmygpo-qt"
Wed Feb 28 20:00:07 2018 rev:14 rq:580241 version:1.0.9
Changes:
--------
--- /work/SRC/openSUSE:Factory/libmygpo-qt/libmygpo-qt.changes 2013-04-22 14:08:58.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.libmygpo-qt.new/libmygpo-qt.changes 2018-02-28 20:00:13.305413203 +0100
@@ -1,0 +2,14 @@
+Mon Feb 26 09:09:44 UTC 2018 - wbauer@tmo.at
+
+- Update to 1.0.9:
+ * Different header installation directories for the qt4 & qt5
+ version
+ * Bugfix: Top level include_install_dir is now respected
+ * Support for QJson 0.7
+ * Default to https instead of http
+ * Bugfix: Allow setting the server URL
+ Changes in 1.0.8:
+ * Support for building the library with Qt5
+ * Support for the "Get All Subscriptions" API endpoint
+
+-------------------------------------------------------------------
Old:
----
libmygpo-qt.1.0.7.tar.gz
New:
----
libmygpo-qt.1.0.9.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libmygpo-qt.spec ++++++
--- /var/tmp/diff_new_pack.mTOkOt/_old 2018-02-28 20:00:14.933354298 +0100
+++ /var/tmp/diff_new_pack.mTOkOt/_new 2018-02-28 20:00:14.941354009 +0100
@@ -17,7 +17,7 @@
Name: libmygpo-qt
-Version: 1.0.7
+Version: 1.0.9
Release: 0
Summary: Qt Library that wraps the gpodder.net Web API
License: LGPL-2.1+
++++++ libmygpo-qt.1.0.7.tar.gz -> libmygpo-qt.1.0.9.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/CMakeLists.txt new/libmygpo-qt.1.0.9/CMakeLists.txt
--- old/libmygpo-qt.1.0.7/CMakeLists.txt 2013-01-19 12:48:52.000000000 +0100
+++ new/libmygpo-qt.1.0.9/CMakeLists.txt 2016-09-16 13:02:54.000000000 +0200
@@ -5,20 +5,56 @@
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII" )
-# Don't use absolute path in Mygpo-qtTargets-$buildType.cmake
-# (This will have no effect with CMake < 2.8)
-set(QT_USE_IMPORTED_TARGETS TRUE)
+option(BUILD_WITH_QT4 "Build libmygpo-qt with Qt4 no matter if Qt5 was found" ON)
-find_package( Qt4 COMPONENTS QtCore QtNetwork QtTest REQUIRED )
-set( QT_DONT_USE_QTGUI TRUE )
+if( NOT BUILD_WITH_QT4 )
+ find_package(Qt5Core QUIET)
+ if( Qt5Core_DIR )
+ message(STATUS "Found Qt5! Be aware that Qt5-support is still experimental and not officially supported!")
+ set(MYGPO_QT_VERSION_SUFFIX 5)
+
+ macro(qt_wrap_cpp)
+ qt5_wrap_cpp(${ARGN})
+ endmacro()
+ endif()
+
+ # pkg-config names of QtCore and QtNetwork are Qt5Core and Qt5Network for
+ # Qt5
+ set(MYGPO_QT_MAJOR_VERSION "5")
+ set(MYGPO_QT4_QJSON_DEP "")
+endif()
+
+if( NOT Qt5Core_DIR )
+ message(STATUS "Could not find Qt5, searching for Qt4 instead...")
+ if( MYGPO_BUILD_TESTS )
+ find_package( Qt4 COMPONENTS QtCore QtNetwork QtTest REQUIRED )
+ else( MYGPO_BUILD_TESTS )
+ find_package( Qt4 COMPONENTS QtCore QtNetwork REQUIRED )
+ endif()
+ set( QT_DONT_USE_QTGUI TRUE )
+ include( ${QT_USE_FILE} )
-find_package(QJSON REQUIRED)
+ macro(qt5_use_modules)
+ endmacro()
-include( ${QT_USE_FILE} )
+ macro(qt_wrap_cpp)
+ qt4_wrap_cpp(${ARGN})
+ endmacro()
+
+ set(MYGPO_QT_MAJOR_VERSION "")
+ set(MYGPO_QT4_QJSON_DEP "Requires.private: QJson")
+
+ # QJson is only required for Qt4
+ find_package(QJSON REQUIRED)
+endif()
+
+# Don't use absolute path in Mygpo-qtTargets-$buildType.cmake
+# (This will have no effect with CMake < 2.8)
+# set(QT_USE_IMPORTED_TARGETS TRUE)
set( MYGPO_QT_VERSION_MAJOR "1" )
set( MYGPO_QT_VERSION_MINOR "0" )
-set( MYGPO_QT_VERSION_PATCH "7" )
+set( MYGPO_QT_VERSION_PATCH "9" )
set( MYGPO_QT_VERSION "${MYGPO_QT_VERSION_MAJOR}.${MYGPO_QT_VERSION_MINOR}.${MYGPO_QT_VERSION_PATCH}" )
set( MYGPO_QT_SONAME "${MYGPO_QT_VERSION_MAJOR}")
@@ -62,7 +98,7 @@
set(LIB_SUFFIX "" CACHE STRING "The directories where to install libraries to")
set(LIB_INSTALL_DIR lib${LIB_SUFFIX} )
set(LIB_DIR_PKGCONF "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}")
-set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include/mygpo-qt" CACHE PATH "The directory the headers are installed in")
+set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include/mygpo-qt${MYGPO_QT_VERSION_SUFFIX}" CACHE PATH "The directory the headers are installed in")
set(CMAKECONFIG_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/mygpo-qt )
if( APPLE )
@@ -97,12 +133,14 @@
FIND_PACKAGE(PkgConfig)
IF (PKG_CONFIG_FOUND)
CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/libmygpo-qt.pc.in
- ${CMAKE_CURRENT_BINARY_DIR}/libmygpo-qt.pc
+ ${CMAKE_CURRENT_BINARY_DIR}/libmygpo-qt${MYGPO_QT_VERSION_SUFFIX}.pc
@ONLY)
- INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/libmygpo-qt.pc DESTINATION lib${LIB_SUFFIX}/pkgconfig)
+ INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/libmygpo-qt${MYGPO_QT_VERSION_SUFFIX}.pc DESTINATION lib${LIB_SUFFIX}/pkgconfig)
ENDIF (PKG_CONFIG_FOUND)
ENDIF (NOT WIN32)
+set(MYGPO_QT_TARGET_NAME mygpo-qt${MYGPO_QT_VERSION_SUFFIX} CACHE INTERNAL "" FORCE )
+
add_subdirectory( src )
if(MYGPO_BUILD_TESTS)
add_subdirectory( tests )
@@ -114,7 +152,7 @@
# This file contains add_library(bar IMPORTED) statements for each target in the export set, so
# when loaded later on cmake will create "imported" library targets from these, which can be used
# in many ways in the same way as a normal library target created via a normal add_library().
-install(EXPORT mygpo-qtExport DESTINATION ${CMAKECONFIG_INSTALL_DIR} FILE Mygpo-qtTargets.cmake )
+install(EXPORT ${MYGPO_QT_TARGET_NAME}Export DESTINATION ${CMAKECONFIG_INSTALL_DIR} FILE Mygpo-qt${MYGPO_QT_VERSION_SUFFIX}Targets.cmake )
# figure out the relative path from the installed Config.cmake file to the install prefix (which may be at
# runtime different from the chosen CMAKE_INSTALL_PREFIX if under Windows the package was installed anywhere)
@@ -124,12 +162,12 @@
# Create a BarConfig.cmake file. <name>Config.cmake files are searched by find_package()
# automatically. We configure that file so that we can put any information we want in it,
# e.g. version numbers, include directories, etc.
-configure_file(Mygpo-qtConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/Mygpo-qtConfig.cmake @ONLY )
+configure_file(Mygpo-qtConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/Mygpo-qt${MYGPO_QT_VERSION_SUFFIX}Config.cmake @ONLY )
# Additionally, when cmake has found a BarConfig.cmake, it can check for a BarConfigVersion.cmake
# in the same directory when figuring out the version of the package when a version
# has been specified in the find_package() call, e.g. find_package(Bar 1.0)
-configure_file(Mygpo-qtConfigVersion.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/Mygpo-qtConfigVersion.cmake @ONLY )
+configure_file(Mygpo-qtConfigVersion.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/Mygpo-qt${MYGPO_QT_VERSION_SUFFIX}ConfigVersion.cmake @ONLY )
# Install these two files into the same directory as the generated exports-file.
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Mygpo-qtConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/Mygpo-qtConfigVersion.cmake DESTINATION ${CMAKECONFIG_INSTALL_DIR} )
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Mygpo-qt${MYGPO_QT_VERSION_SUFFIX}Config.cmake ${CMAKE_CURRENT_BINARY_DIR}/Mygpo-qt${MYGPO_QT_VERSION_SUFFIX}ConfigVersion.cmake DESTINATION ${CMAKECONFIG_INSTALL_DIR} )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/README new/libmygpo-qt.1.0.9/README
--- old/libmygpo-qt.1.0.7/README 2013-04-13 11:53:12.000000000 +0200
+++ new/libmygpo-qt.1.0.9/README 2016-09-16 13:02:54.000000000 +0200
@@ -6,7 +6,7 @@
=== Copyright & License ===
-Copyright 2010 - 2013 Stefan Derkits (stefan@derkits.at) , Christian Wagner (christian.wagner86@gmx.at) & Felix Winter (ixos01@gmail.com)
+Copyright 2010 - 2014 Stefan Derkits (stefan@derkits.at) , Christian Wagner (christian.wagner86@gmx.at) & Felix Winter (ixos01@gmail.com)
See COPYING File for License
@@ -20,6 +20,16 @@
-) Cmake 2.6 or higher
-) QJson
+=== Qt5 Support ===
+
+libmygpo-qt version 1.0.8 supports also building the library with Qt5. The API is the same as in the Qt4 library. To build the library with Qt5 add "-DBUILD_WITH_QT4=OFF" to your CMake
+command line. Please note that Qt5 support is still experimental. If you find anything to not work with Qt5, please report a bug.
+
+==== Qt5 Requirements ===
+
+-) CMake 2.8.9 or higher
+-) Qt 5.2 or higher
+
=== Links ===
Homepage: http://wiki.gpodder.org/wiki/Libmygpo-qt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/example/Makefile new/libmygpo-qt.1.0.9/example/Makefile
--- old/libmygpo-qt.1.0.7/example/Makefile 2012-07-20 13:58:50.000000000 +0200
+++ new/libmygpo-qt.1.0.9/example/Makefile 2016-09-16 13:02:54.000000000 +0200
@@ -1,6 +1,6 @@
CC=g++
-CFLAGS=-c -g -Wall $(shell pkg-config QtGui QtCore QtNetwork libmygpo-qt --cflags)
-LIBS= $(shell pkg-config QtGui QtCore QtNetwork libmygpo-qt --libs)
+CFLAGS=-c -g -Wall $(shell pkg-config libmygpo-qt --cflags)
+LIBS= $(shell pkg-config libmygpo-qt --libs)
SRCDIR=src
all: main
@@ -8,6 +8,10 @@
main: $(SRCDIR)/main.o
$(CC) $(SRCDIR)/main.o -o main $(LIBS)
+qt5:
+ $(CC) -c -I/home/horrendus/kde/include/mygpo-qt -I/usr/include/qt5/QtCore -I/usr/include/qt5 -I/usr/include/qt5/QtNetwork -fPIC $(SRCDIR)/main.cpp -o $(SRCDIR)/main_qt5.o
+ $(CC) $(SRCDIR)/main_qt5.o -o main -L/home/horrendus/kde/lib -lmygpo-qt -lQt5Network -lQt5Core
+
$(SRCDIR)/main.o: $(SRCDIR)/main.cpp
$(CC) $(CFLAGS) $(SRCDIR)/main.cpp -o $(SRCDIR)/main.o
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/example/src/.kdev_include_paths new/libmygpo-qt.1.0.9/example/src/.kdev_include_paths
--- old/libmygpo-qt.1.0.7/example/src/.kdev_include_paths 2012-07-20 13:58:49.000000000 +0200
+++ new/libmygpo-qt.1.0.9/example/src/.kdev_include_paths 1970-01-01 01:00:00.000000000 +0100
@@ -1,5 +0,0 @@
-/home/t95012/src/libmygpo-qt/example/src/
-home/t95012/kde/include/mygpo-qt/
-/usr/include/qt4/QtCore/
-/usr/include/qt4/QtGui/
-/usr/include/qt4/QtNetwork/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/example/src/main.cpp new/libmygpo-qt.1.0.9/example/src/main.cpp
--- old/libmygpo-qt.1.0.7/example/src/main.cpp 2013-04-13 11:52:16.000000000 +0200
+++ new/libmygpo-qt.1.0.9/example/src/main.cpp 2016-09-16 13:02:54.000000000 +0200
@@ -21,8 +21,8 @@
***************************************************************************/
#include <QCoreApplication>
-#include <QtGui>
#include <QEventLoop>
+#include <QDebug>
#include
#include
@@ -462,7 +462,17 @@
qDebug() << "TagList2 size: " << tagList2->list().size();
qDebug() << "";
- qDebug() << "AddRemoveResult";
+
+ reply = req.downloadSubscriptionsJson( "ase23" );
+
+ loop.connect(reply, SIGNAL(finished()), SLOT(quit()));
+ loop.connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(quit()));
+ loop.exec();
+
+ printTitle(QLatin1String("Downloading subscriptions (JSON) [subscriptionsJson(\"ase23\")]"));
+ qDebug() << reply->readAll();
+ qDebug();
+ //qDebug() << "AddRemoveResult";
/*QList<QUrl> add2;
QList<QUrl> remove2;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/libmygpo-qt.pc.in new/libmygpo-qt.1.0.9/libmygpo-qt.pc.in
--- old/libmygpo-qt.1.0.7/libmygpo-qt.pc.in 2013-01-19 12:48:52.000000000 +0100
+++ new/libmygpo-qt.1.0.9/libmygpo-qt.pc.in 2016-09-16 13:02:54.000000000 +0200
@@ -3,11 +3,11 @@
libdir=@LIB_DIR_PKGCONF@
includedir=@INCLUDE_INSTALL_DIR@
-Name: libmygpo-qt
+Name: libmygpo-qt@MYGPO_QT_VERSION_SUFFIX@
Description: libmygpo-qt is a C++/Qt Library that wraps the gpodder.net WebAPI
URL: http://wiki.gpodder.org/wiki/Libmygpo-qt
Version: @MYGPO_QT_VERSION@
-Requires: QtCore QtNetwork
-Requires.private: QJson
-Libs: -L${libdir} -lmygpo-qt
-Cflags: -I${includedir}
\ No newline at end of file
+Requires: Qt@MYGPO_QT_MAJOR_VERSION@Core Qt@MYGPO_QT_MAJOR_VERSION@Network
+@MYGPO_QT4_QJSON_DEP@
+Libs: -L${libdir} -lmygpo-qt@MYGPO_QT_VERSION_SUFFIX@
+Cflags: -I${includedir}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/src/AddRemoveResult.cpp new/libmygpo-qt.1.0.9/src/AddRemoveResult.cpp
--- old/libmygpo-qt.1.0.7/src/AddRemoveResult.cpp 2013-04-13 11:36:25.000000000 +0200
+++ new/libmygpo-qt.1.0.9/src/AddRemoveResult.cpp 2016-09-16 13:02:54.000000000 +0200
@@ -20,11 +20,11 @@
* USA *
***************************************************************************/
-#include
-
#include "AddRemoveResult.h"
#include "AddRemoveResult_p.h"
+#include "qjsonwrapper/Json.h"
+
using namespace mygpo;
AddRemoveResultPrivate::AddRemoveResultPrivate( AddRemoveResult* qq, QNetworkReply* reply ) : q( qq ), m_reply( reply ), m_error( QNetworkReply::NoError )
@@ -64,7 +64,6 @@
bool AddRemoveResultPrivate::parse( const QVariant& data )
{
- QJson::Parser parser;
if( !data.canConvert( QVariant::Map ) )
return false;
QVariantMap resultMap = data.toMap();
@@ -78,9 +77,8 @@
bool AddRemoveResultPrivate::parse( const QByteArray& data )
{
- QJson::Parser parser;
bool ok;
- QVariant variant = parser.parse( data, &ok );
+ QVariant variant = QJsonWrapper::parseJson( data, &ok );
if( ok )
{
ok = ( parse( variant ) );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/src/ApiRequest.cpp new/libmygpo-qt.1.0.9/src/ApiRequest.cpp
--- old/libmygpo-qt.1.0.7/src/ApiRequest.cpp 2013-04-13 11:36:43.000000000 +0200
+++ new/libmygpo-qt.1.0.9/src/ApiRequest.cpp 2016-09-16 13:02:54.000000000 +0200
@@ -1,6 +1,6 @@
/***************************************************************************
* This file is part of libmygpo-qt *
-* Copyright (c) 2010 - 2013 Stefan Derkits *
+* Copyright (c) 2010 - 2014 Stefan Derkits *
* Copyright (c) 2010 - 2011 Christian Wagner *
* Copyright (c) 2010 - 2011 Felix Winter *
* *
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/src/ApiRequest.h new/libmygpo-qt.1.0.9/src/ApiRequest.h
--- old/libmygpo-qt.1.0.7/src/ApiRequest.h 2013-04-13 12:07:43.000000000 +0200
+++ new/libmygpo-qt.1.0.9/src/ApiRequest.h 2016-09-16 13:02:54.000000000 +0200
@@ -1,6 +1,6 @@
/***************************************************************************
* This file is part of libmygpo-qt *
-* Copyright (c) 2010 - 2013 Stefan Derkits *
+* Copyright (c) 2010 - 2014 Stefan Derkits *
* Copyright (c) 2010 - 2011 Christian Wagner *
* Copyright (c) 2010 - 2011 Felix Winter *
* *
@@ -84,7 +84,7 @@
*/
QNetworkReply* suggestionsOpml( uint count );
- QNetworkReply* downloadSubscriptionsOpml( const QString& username, const QString& device );
+ QNetworkReply* downloadSubscriptionsOpml( const QString& username, const QString& device = QString() );
/**
* Returns the TXT Result for the Simple API Call "Downloading Podcast Toplists"
@@ -111,7 +111,7 @@
*/
QNetworkReply* suggestionsTxt( uint count );
- QNetworkReply* downloadSubscriptionsTxt( const QString& username, const QString& device );
+ QNetworkReply* downloadSubscriptionsTxt( const QString& username, const QString& device = QString() );
/**
* Returns the TXT Result for the Simple API Call "Downloading Podcast Toplists"
@@ -153,9 +153,9 @@
*
*/
PodcastListPtr suggestions( uint count );
-
- QNetworkReply* downloadSubscriptionsJson( const QString& username, const QString& device );
-
+
+ QNetworkReply* downloadSubscriptionsJson( const QString& username, const QString& device = QString() );
+
//ADVANCED API
/**
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/src/CMakeLists.txt new/libmygpo-qt.1.0.9/src/CMakeLists.txt
--- old/libmygpo-qt.1.0.7/src/CMakeLists.txt 2013-01-19 12:48:52.000000000 +0100
+++ new/libmygpo-qt.1.0.9/src/CMakeLists.txt 2016-09-16 13:02:54.000000000 +0200
@@ -1,5 +1,5 @@
-include_directories( ${QT_INCLUDES} ${QJSON_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} )
+include_directories( ${QJSON_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} )
set ( LIBMYGPO_QT_SRC
Config.cpp
@@ -21,6 +21,7 @@
DeviceUpdates.cpp
DeviceList.cpp
Device.cpp
+ qjsonwrapper/Json.cpp
)
set ( LIBMYGPO_QT_MOC_H
@@ -74,12 +75,14 @@
AddRemoveResult.h
)
-QT4_WRAP_CPP(LIBMYGPO_QT_MOC_SRC ${LIBMYGPO_QT_MOC_H} )
+QT_WRAP_CPP(LIBMYGPO_QT_MOC_SRC ${LIBMYGPO_QT_MOC_H} )
-add_library( mygpo-qt SHARED ${LIBMYGPO_QT_SRC} ${LIBMYGPO_QT_MOC_SRC} )
+add_library( ${MYGPO_QT_TARGET_NAME} SHARED ${LIBMYGPO_QT_SRC} ${LIBMYGPO_QT_MOC_SRC} )
-target_link_libraries( mygpo-qt ${QJSON_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTNETWORK_LIBRARY} )
-set_target_properties( mygpo-qt PROPERTIES VERSION ${MYGPO_QT_VERSION} SOVERSION ${MYGPO_QT_SONAME} DEFINE_SYMBOL MYGPO_MAKEDLL)
-install( TARGETS mygpo-qt EXPORT mygpo-qtExport DESTINATION lib${LIB_SUFFIX} )
+target_link_libraries( ${MYGPO_QT_TARGET_NAME} ${QJSON_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTNETWORK_LIBRARY} )
+set_target_properties( ${MYGPO_QT_TARGET_NAME} PROPERTIES VERSION ${MYGPO_QT_VERSION} SOVERSION ${MYGPO_QT_SONAME} DEFINE_SYMBOL MYGPO_MAKEDLL)
+qt5_use_modules( ${MYGPO_QT_TARGET_NAME} Core Network )
-install( FILES ${LIBMYGPO_QT_INSTALL_H} DESTINATION include/mygpo-qt COMPONENT Devel )
+install( TARGETS ${MYGPO_QT_TARGET_NAME} EXPORT ${MYGPO_QT_TARGET_NAME}Export DESTINATION ${LIB_INSTALL_DIR} )
+
+install( FILES ${LIBMYGPO_QT_INSTALL_H} DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/src/Config.cpp new/libmygpo-qt.1.0.9/src/Config.cpp
--- old/libmygpo-qt.1.0.7/src/Config.cpp 2013-04-13 11:37:45.000000000 +0200
+++ new/libmygpo-qt.1.0.9/src/Config.cpp 2016-09-16 13:02:54.000000000 +0200
@@ -29,7 +29,7 @@
Config* Config::s_instance = 0;
-ConfigPrivate::ConfigPrivate( Config* qq ) : q( qq ), m_mygpoBaseUrl( QUrl( QLatin1String( "http://gpodder.net" ) ) ), m_userAgentPrefix( QString() )
+ConfigPrivate::ConfigPrivate( Config* qq ) : q( qq ), m_mygpoBaseUrl( QUrl( QLatin1String( "https://gpodder.net" ) ) ), m_userAgentPrefix( QString() )
{
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/src/DeviceList.cpp new/libmygpo-qt.1.0.9/src/DeviceList.cpp
--- old/libmygpo-qt.1.0.7/src/DeviceList.cpp 2012-07-20 13:58:51.000000000 +0200
+++ new/libmygpo-qt.1.0.9/src/DeviceList.cpp 2016-09-16 13:02:54.000000000 +0200
@@ -22,7 +22,7 @@
#include "DeviceList_p.h"
-#include
+#include "qjsonwrapper/Json.h"
using namespace mygpo;
@@ -73,9 +73,8 @@
bool DeviceListPrivate::parse( const QByteArray& data )
{
- QJson::Parser parser;
bool ok;
- QVariant variant = parser.parse( data, &ok );
+ QVariant variant = QJsonWrapper::parseJson( data, &ok );
if( ok )
{
ok = ( parse( variant ) );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/src/DeviceSyncResult.cpp new/libmygpo-qt.1.0.9/src/DeviceSyncResult.cpp
--- old/libmygpo-qt.1.0.7/src/DeviceSyncResult.cpp 2013-04-13 11:44:06.000000000 +0200
+++ new/libmygpo-qt.1.0.9/src/DeviceSyncResult.cpp 2016-09-16 13:02:54.000000000 +0200
@@ -20,7 +20,7 @@
#include "DeviceSyncResult_p.h"
-#include
+#include "qjsonwrapper/Json.h"
using namespace mygpo;
@@ -85,9 +85,8 @@
bool DeviceSyncResultPrivate::parse( const QByteArray& data )
{
- QJson::Parser parser;
bool ok;
- QVariant variant = parser.parse( data, &ok );
+ QVariant variant = QJsonWrapper::parseJson( data, &ok );
if( ok )
{
ok = ( parse( variant ) );
@@ -108,7 +107,7 @@
emit q->parseError();
}
}
- m_reply->deleteLater();
+ m_reply->deleteLater();
}
void DeviceSyncResultPrivate::error( QNetworkReply::NetworkError error )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/src/DeviceUpdates.cpp new/libmygpo-qt.1.0.9/src/DeviceUpdates.cpp
--- old/libmygpo-qt.1.0.7/src/DeviceUpdates.cpp 2013-04-13 11:45:45.000000000 +0200
+++ new/libmygpo-qt.1.0.9/src/DeviceUpdates.cpp 2016-09-16 13:02:54.000000000 +0200
@@ -22,7 +22,7 @@
#include "DeviceUpdates_p.h"
-#include
+#include "qjsonwrapper/Json.h"
using namespace mygpo;
@@ -102,9 +102,8 @@
bool DeviceUpdatesPrivate::parse( const QByteArray& data )
{
- QJson::Parser parser;
bool ok;
- QVariant variant = parser.parse( data, &ok );
+ QVariant variant = QJsonWrapper::parseJson( data, &ok );
if( ok )
{
ok = ( parse( variant ) );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/src/Episode.cpp new/libmygpo-qt.1.0.9/src/Episode.cpp
--- old/libmygpo-qt.1.0.7/src/Episode.cpp 2013-04-13 11:46:03.000000000 +0200
+++ new/libmygpo-qt.1.0.9/src/Episode.cpp 2016-09-16 13:02:54.000000000 +0200
@@ -22,7 +22,7 @@
#include "Episode_p.h"
-#include
+#include "qjsonwrapper/Json.h"
using namespace mygpo;
@@ -115,9 +115,8 @@
bool EpisodePrivate::parse ( const QByteArray& data )
{
- QJson::Parser parser;
bool ok;
- QVariant variant = parser.parse ( data, &ok );
+ QVariant variant = QJsonWrapper::parseJson( data, &ok );
if ( ok )
{
if ( !parse ( variant ) ) return false;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/src/EpisodeAction.cpp new/libmygpo-qt.1.0.9/src/EpisodeAction.cpp
--- old/libmygpo-qt.1.0.7/src/EpisodeAction.cpp 2013-04-13 11:46:19.000000000 +0200
+++ new/libmygpo-qt.1.0.9/src/EpisodeAction.cpp 2016-09-16 13:02:54.000000000 +0200
@@ -22,7 +22,7 @@
#include "EpisodeAction_p.h"
-#include
+#include "qjsonwrapper/Json.h"
using namespace mygpo;
@@ -163,9 +163,8 @@
bool EpisodeActionPrivate::parse( const QByteArray& data )
{
- QJson::Parser parser;
bool ok;
- QVariant variant = parser.parse( data, &ok );
+ QVariant variant = QJsonWrapper::parseJson( data, &ok );
if( ok )
{
if( !parse( variant ) ) return false;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/src/EpisodeActionList.cpp new/libmygpo-qt.1.0.9/src/EpisodeActionList.cpp
--- old/libmygpo-qt.1.0.7/src/EpisodeActionList.cpp 2013-04-13 11:46:38.000000000 +0200
+++ new/libmygpo-qt.1.0.9/src/EpisodeActionList.cpp 2016-09-16 13:02:54.000000000 +0200
@@ -22,7 +22,7 @@
#include "EpisodeActionList_p.h"
-#include
+#include "qjsonwrapper/Json.h"
using namespace mygpo;
@@ -88,9 +88,8 @@
bool EpisodeActionListPrivate::parse( const QByteArray& data )
{
- QJson::Parser parser;
bool ok;
- QVariant variant = parser.parse( data, &ok );
+ QVariant variant = QJsonWrapper::parseJson( data, &ok );
if( ok )
{
ok = ( parse( variant ) );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/src/EpisodeList.cpp new/libmygpo-qt.1.0.9/src/EpisodeList.cpp
--- old/libmygpo-qt.1.0.7/src/EpisodeList.cpp 2013-04-13 11:46:56.000000000 +0200
+++ new/libmygpo-qt.1.0.9/src/EpisodeList.cpp 2016-09-16 13:02:54.000000000 +0200
@@ -22,7 +22,7 @@
#include "EpisodeList_p.h"
-#include
+#include "qjsonwrapper/Json.h"
using namespace mygpo;
@@ -71,9 +71,8 @@
bool EpisodeListPrivate::parse( const QByteArray& data )
{
- QJson::Parser parser;
bool ok;
- QVariant variant = parser.parse( data, &ok );
+ QVariant variant = QJsonWrapper::parseJson( data, &ok );
if( ok )
{
ok = ( parse( variant ) );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/src/JsonCreator.cpp new/libmygpo-qt.1.0.9/src/JsonCreator.cpp
--- old/libmygpo-qt.1.0.7/src/JsonCreator.cpp 2013-04-13 11:47:19.000000000 +0200
+++ new/libmygpo-qt.1.0.9/src/JsonCreator.cpp 2016-09-16 13:02:54.000000000 +0200
@@ -20,47 +20,44 @@
* USA *
***************************************************************************/
-#include <QVariant>
+//#include <QVariant>
#include <QList>
#include <QUrl>
#include <QString>
#include <QDateTime>
-#include
-
#include "JsonCreator.h"
+#include "qjsonwrapper/Json.h"
+
using namespace mygpo;
static qulonglong c_maxlonglong = (2^64)-1;
QByteArray JsonCreator::addRemoveSubsToJSON( const QList< QUrl >& add, const QList< QUrl >& remove )
{
- QJson::Serializer serializer;
QVariantMap jsonData;
QVariant addVar( urlListToQVariantList( add ) );
QVariant removeVar( urlListToQVariantList( remove ) );
jsonData.insert( QString( QLatin1String( "add" ) ), addVar );
jsonData.insert( QString( QLatin1String( "remove" ) ), removeVar );
- QByteArray jsonByteArray = serializer.serialize( QVariant( jsonData ) );
+ QByteArray jsonByteArray = QJsonWrapper::toJson( QVariant( jsonData ) );
return jsonByteArray;
}
QByteArray JsonCreator::saveSettingsToJSON( const QMap< QString, QVariant >& set, const QList< QString >& remove )
{
- QJson::Serializer serializer;
QVariantMap jsonData;
//QVariant setVar(stringMapToQVariantMap(set));
QVariant removeVar( stringListToQVariantList( remove ) );
jsonData.insert( QString( QLatin1String( "set" ) ), set );
jsonData.insert( QString( QLatin1String( "remove" ) ), removeVar );
- QByteArray jsonByteArray = serializer.serialize( QVariant( jsonData ) );
+ QByteArray jsonByteArray = QJsonWrapper::toJson( QVariant( jsonData ) );
return jsonByteArray;
}
QByteArray JsonCreator::episodeActionListToJSON( const QList<EpisodeActionPtr>& episodeActions )
{
- QJson::Serializer serializer;
QVariantList jsonData;
foreach( const EpisodeActionPtr episodeAction, episodeActions )
@@ -68,19 +65,18 @@
jsonData.append( episodeActionToQVariantMap( episodeAction ) );
}
- QByteArray jsonByteArray = serializer.serialize( QVariant( jsonData ) );
+ QByteArray jsonByteArray = QJsonWrapper::toJson( QVariant( jsonData ) );
return jsonByteArray;
}
QByteArray JsonCreator::renameDeviceStringToJSON( const QString& caption, const QString& type )
{
- QJson::Serializer serializer;
QVariantMap jsonData;
QVariant captionVar( caption );
QVariant typeVar( type );
jsonData.insert( QString( QLatin1String( "caption" ) ), captionVar );
jsonData.insert( QString( QLatin1String( "type" ) ), typeVar );
- QByteArray jsonByteArray = serializer.serialize( QVariant( jsonData ) );
+ QByteArray jsonByteArray = QJsonWrapper::toJson( QVariant( jsonData ) );
return jsonByteArray;
}
@@ -130,7 +126,7 @@
jsonStr.append(syncVar);
jsonStr.append(QLatin1String(" ,\"stop-synchronize\" : "));
jsonStr.append(stopVar);
- jsonStr.append(QLatin1String(" }\n"));
+ jsonStr.append(QLatin1String(" }"));
return jsonStr.toLocal8Bit();
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/src/Podcast.cpp new/libmygpo-qt.1.0.9/src/Podcast.cpp
--- old/libmygpo-qt.1.0.7/src/Podcast.cpp 2013-04-13 11:47:36.000000000 +0200
+++ new/libmygpo-qt.1.0.9/src/Podcast.cpp 2016-09-16 13:02:54.000000000 +0200
@@ -22,7 +22,7 @@
#include "Podcast_p.h"
-#include
+#include "qjsonwrapper/Json.h"
using namespace mygpo;
@@ -181,9 +181,8 @@
bool PodcastPrivate::parse( const QByteArray& data )
{
- QJson::Parser parser;
bool ok;
- QVariant variant = parser.parse( data, &ok );
+ QVariant variant = QJsonWrapper::parseJson( data, &ok );
if ( ok )
{
if ( !parse( variant ) ) return false;
@@ -197,8 +196,6 @@
void PodcastPrivate::parseData()
{
- //parsen und signal senden
- QJson::Parser parser;
if ( parse( m_reply->readAll( ) ) )
{
emit q->finished();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/src/PodcastList.cpp new/libmygpo-qt.1.0.9/src/PodcastList.cpp
--- old/libmygpo-qt.1.0.7/src/PodcastList.cpp 2013-04-13 11:48:52.000000000 +0200
+++ new/libmygpo-qt.1.0.9/src/PodcastList.cpp 2016-09-16 13:02:54.000000000 +0200
@@ -22,7 +22,7 @@
#include "PodcastList_p.h"
-#include
+#include "qjsonwrapper/Json.h"
using namespace mygpo;
@@ -71,9 +71,8 @@
bool PodcastListPrivate::parse( const QByteArray& data )
{
- QJson::Parser parser;
bool ok;
- QVariant variant = parser.parse( data, &ok );
+ QVariant variant = QJsonWrapper::parseJson( data, &ok );
if( ok )
{
ok = ( parse( variant ) );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/src/RequestHandler.cpp new/libmygpo-qt.1.0.9/src/RequestHandler.cpp
--- old/libmygpo-qt.1.0.7/src/RequestHandler.cpp 2013-04-13 11:49:24.000000000 +0200
+++ new/libmygpo-qt.1.0.9/src/RequestHandler.cpp 2016-09-16 13:02:54.000000000 +0200
@@ -77,5 +77,5 @@
void RequestHandler::addUserAgent( QNetworkRequest &request )
{
- request.setRawHeader("User-Agent", Config::instance()->userAgent().toAscii() );
+ request.setRawHeader("User-Agent", Config::instance()->userAgent().toLatin1() );
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/src/Settings.cpp new/libmygpo-qt.1.0.9/src/Settings.cpp
--- old/libmygpo-qt.1.0.7/src/Settings.cpp 2013-04-13 11:49:36.000000000 +0200
+++ new/libmygpo-qt.1.0.9/src/Settings.cpp 2016-09-16 13:02:54.000000000 +0200
@@ -22,7 +22,7 @@
#include "Settings_p.h"
-#include
+#include "qjsonwrapper/Json.h"
using namespace mygpo;
@@ -49,9 +49,8 @@
bool SettingsPrivate::parse( const QByteArray& data )
{
- QJson::Parser parser;
bool ok;
- QVariant variant = parser.parse( data, &ok );
+ QVariant variant = QJsonWrapper::parseJson( data, &ok );
if( ok )
{
ok = ( parse( variant ) );
@@ -63,7 +62,6 @@
{
if( m_reply->error() == QNetworkReply::NoError )
{
- QJson::Parser parser;
if( parse( m_reply->readAll() ) )
{
emit q->finished();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/src/TagList.cpp new/libmygpo-qt.1.0.9/src/TagList.cpp
--- old/libmygpo-qt.1.0.7/src/TagList.cpp 2013-04-13 11:50:19.000000000 +0200
+++ new/libmygpo-qt.1.0.9/src/TagList.cpp 2016-09-16 13:02:54.000000000 +0200
@@ -22,7 +22,7 @@
#include "TagList_p.h"
-#include
+#include "qjsonwrapper/Json.h"
using namespace mygpo;
@@ -70,9 +70,8 @@
bool TagListPrivate::parse( const QByteArray& data )
{
- QJson::Parser parser;
bool ok;
- QVariant variant = parser.parse( data, &ok );
+ QVariant variant = QJsonWrapper::parseJson( data, &ok );
if( ok )
{
ok = ( parse( variant ) );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/src/UrlBuilder.cpp new/libmygpo-qt.1.0.9/src/UrlBuilder.cpp
--- old/libmygpo-qt.1.0.7/src/UrlBuilder.cpp 2013-04-13 11:51:26.000000000 +0200
+++ new/libmygpo-qt.1.0.9/src/UrlBuilder.cpp 2016-09-16 13:02:54.000000000 +0200
@@ -30,7 +30,6 @@
using namespace mygpo;
-const QString UrlBuilder::s_server = Config::instance()->mygpoBaseUrl().toString();
const QString UrlBuilder::s_api2 = QLatin1String( "/api/2" );
const QString UrlBuilder::s_api1 = QLatin1String( "/api/1" );
@@ -58,92 +57,110 @@
QString UrlBuilder::getToplistUrl( uint i, Format f )
{
QString numString = QString::number(( i == 0 ) ? 1 : i );
- return s_server % QLatin1String( "/toplist/" ) % numString % getFormatExtension( f );
+ return Config::instance()->mygpoBaseUrl().toString() %
+ QLatin1String( "/toplist/" ) % numString % getFormatExtension( f );
}
QString UrlBuilder::getSuggestionsUrl( uint i, Format f )
{
QString numString = QString::number(( i == 0 ) ? 1 : i );
- return s_server % QLatin1String( "/suggestions/" ) % numString % getFormatExtension( f );
+ return Config::instance()->mygpoBaseUrl().toString() %
+ QLatin1String( "/suggestions/" ) % numString % getFormatExtension( f );
}
QString UrlBuilder::getPodcastSearchUrl( const QString& query, Format f )
{
- return s_server % QLatin1String( "/search" ) % getFormatExtension( f ) % QLatin1String( "?q=" ) % query;
+ return Config::instance()->mygpoBaseUrl().toString() %
+ QLatin1String( "/search" ) % getFormatExtension( f ) % QLatin1String( "?q=" ) % query;
}
QString UrlBuilder::getSubscriptionsUrl( const QString& username, const QString& device, UrlBuilder::Format f)
{
- return s_server % QLatin1String( "/subscriptions/" ) % username % QLatin1String( "/" ) % device % getFormatExtension( f );
+ QString deviceString = device.isNull() ? QString(QLatin1String("")) : (QLatin1String( "/" ) % device);
+ return Config::instance()->mygpoBaseUrl().toString() %
+ QLatin1String( "/subscriptions/" ) % username % deviceString % getFormatExtension( f );
}
QString UrlBuilder::getTopTagsUrl( uint i )
{
QString numString = QString::number(( i == 0 ) ? 1 : i );
- return s_server % s_api2 % QLatin1String( "/tags/" ) % numString % QLatin1String( ".json" );
+ return Config::instance()->mygpoBaseUrl().toString() %
+ s_api2 % QLatin1String( "/tags/" ) % numString % QLatin1String( ".json" );
}
QString UrlBuilder::getPodcastsOfTagUrl( const QString& tag, uint i )
{
QString numString = QString::number(( i == 0 ) ? 1 : i );
- return s_server % s_api2 % QLatin1String( "/tag/" ) % tag % QLatin1String( "/" ) % numString % QLatin1String( ".json" );
+ return Config::instance()->mygpoBaseUrl().toString() %
+ s_api2 % QLatin1String( "/tag/" ) % tag % QLatin1String( "/" ) % numString % QLatin1String( ".json" );
}
QString UrlBuilder::getPodcastDataUrl( const QString& url )
{
- return s_server % s_api2 % QLatin1String( "/data/podcast" ) % QLatin1String( ".json" ) % QLatin1String( "?url=" ) % url;
+ return Config::instance()->mygpoBaseUrl().toString() %
+ s_api2 % QLatin1String( "/data/podcast" ) % QLatin1String( ".json" ) % QLatin1String( "?url=" ) % url;
}
QString UrlBuilder::getEpisodeDataUrl( const QString& podcastUrl, const QString& episodeUrl )
{
- return s_server % s_api2 % QLatin1String( "/data/episode" ) % QLatin1String( ".json" ) % QLatin1String( "?podcast=" ) % podcastUrl % QLatin1String( "&url=" ) % episodeUrl;
+ return Config::instance()->mygpoBaseUrl().toString() %
+ s_api2 % QLatin1String( "/data/episode" ) % QLatin1String( ".json" ) % QLatin1String( "?podcast=" ) % podcastUrl % QLatin1String( "&url=" ) % episodeUrl;
}
QString UrlBuilder::getFavEpisodesUrl( const QString& username )
{
- return s_server % s_api2 % QLatin1String( "/favorites/" ) % username % QLatin1String( ".json" );
+ return Config::instance()->mygpoBaseUrl().toString() %
+ s_api2 % QLatin1String( "/favorites/" ) % username % QLatin1String( ".json" );
}
QString UrlBuilder::getAddRemoveSubUrl( const QString& username, const QString& deviceId )
{
- return s_server % s_api2 % QLatin1String( "/subscriptions/" ) % username % QLatin1String( "/" ) % deviceId % QLatin1String( ".json" );
+ return Config::instance()->mygpoBaseUrl().toString() %
+ s_api2 % QLatin1String( "/subscriptions/" ) % username % QLatin1String( "/" ) % deviceId % QLatin1String( ".json" );
}
QString UrlBuilder::getAccountSettingsUrl( const QString& username )
{
- return s_server % s_api2 % QLatin1String( "/settings/" ) % username % QLatin1String( "/account" ) % QLatin1String( ".json" );
+ return Config::instance()->mygpoBaseUrl().toString() %
+ s_api2 % QLatin1String( "/settings/" ) % username % QLatin1String( "/account" ) % QLatin1String( ".json" );
}
QString UrlBuilder::getDeviceSettingsUrl( const QString& username, const QString& deviceId )
{
- return s_server % s_api2 % QLatin1String( "/settings/" ) % username % QLatin1String( "/device" ) % QLatin1String( ".json" ) % QLatin1String( "?device=" ) % deviceId;
+ return Config::instance()->mygpoBaseUrl().toString() %
+ s_api2 % QLatin1String( "/settings/" ) % username % QLatin1String( "/device" ) % QLatin1String( ".json" ) % QLatin1String( "?device=" ) % deviceId;
}
QString UrlBuilder::getPodcastSettingsUrl( const QString& username, const QString& podcastUrl )
{
- return s_server % s_api2 % QLatin1String( "/settings/" ) % username % QLatin1String( "/podcast" ) % QLatin1String( ".json" ) % QLatin1String( "?podcast=" ) % podcastUrl;
+ return Config::instance()->mygpoBaseUrl().toString() %
+ s_api2 % QLatin1String( "/settings/" ) % username % QLatin1String( "/podcast" ) % QLatin1String( ".json" ) % QLatin1String( "?podcast=" ) % podcastUrl;
}
QString UrlBuilder::getEpisodeSettingsUrl( const QString& username, const QString& podcastUrl, const QString& episodeUrl )
{
- return s_server % s_api2 % QLatin1String( "/settings/" ) % username % QLatin1String( "/episode" ) % QLatin1String( ".json" ) % QLatin1String( "?podcast=" ) % podcastUrl % QLatin1String( "&episode=" ) % episodeUrl;
+ return Config::instance()->mygpoBaseUrl().toString() %
+ s_api2 % QLatin1String( "/settings/" ) % username % QLatin1String( "/episode" ) % QLatin1String( ".json" ) % QLatin1String( "?podcast=" ) % podcastUrl % QLatin1String( "&episode=" ) % episodeUrl;
}
QString UrlBuilder::getDeviceListUrl( const QString& username )
{
- return s_server % s_api2 % QLatin1String( "/devices/" ) % username % QLatin1String( ".json" ) ;
+ return Config::instance()->mygpoBaseUrl().toString() %
+ s_api2 % QLatin1String( "/devices/" ) % username % QLatin1String( ".json" ) ;
}
QString UrlBuilder::getDeviceUpdatesUrl( const QString& username, const QString& deviceId, qulonglong timestamp )
{
QString numString = QString::number( timestamp );
- return s_server % s_api2 % QLatin1String( "/updates/" ) % username % QLatin1String( "/" ) % deviceId % QLatin1String( ".json?since=" ) % numString;
+ return Config::instance()->mygpoBaseUrl().toString() %
+ s_api2 % QLatin1String( "/updates/" ) % username % QLatin1String( "/" ) % deviceId % QLatin1String( ".json?since=" ) % numString;
}
QString UrlBuilder::getRenameDeviceUrl( const QString& username, const QString& deviceId )
{
- return s_server % s_api2 % QLatin1String( "/devices/" ) % username % QLatin1String( "/" ) % deviceId % QLatin1String( ".json" );
+ return Config::instance()->mygpoBaseUrl().toString() %
+ s_api2 % QLatin1String( "/devices/" ) % username % QLatin1String( "/" ) % deviceId % QLatin1String( ".json" );
}
QString UrlBuilder::getEpisodeActionsUrl( const QString& username, const bool aggregated )
@@ -154,7 +171,8 @@
else
agg = QLatin1String( "" );
- return s_server % s_api2 % QLatin1String( "/episodes/" ) % username % QLatin1String( ".json" ) % agg;
+ return Config::instance()->mygpoBaseUrl().toString() %
+ s_api2 % QLatin1String( "/episodes/" ) % username % QLatin1String( ".json" ) % agg;
}
QString UrlBuilder::getEpisodeActionsUrlByPodcast( const QString& username, const QString& podcastUrl, const bool aggregated )
@@ -165,7 +183,8 @@
else
agg = QLatin1String( "" );
- return s_server % s_api2 % QLatin1String( "/episodes/" ) % username % QLatin1String( ".json?podcast=" ) % podcastUrl % agg;
+ return Config::instance()->mygpoBaseUrl().toString() %
+ s_api2 % QLatin1String( "/episodes/" ) % username % QLatin1String( ".json?podcast=" ) % podcastUrl % agg;
}
QString UrlBuilder::getEpisodeActionsUrlByDevice( const QString& username, const QString& deviceId, bool aggregated )
@@ -176,33 +195,39 @@
else
agg = QLatin1String( "" );
- return s_server % s_api2 % QLatin1String( "/episodes/" ) % username % QLatin1String( ".json?device=" ) % deviceId % agg;
+ return Config::instance()->mygpoBaseUrl().toString() %
+ s_api2 % QLatin1String( "/episodes/" ) % username % QLatin1String( ".json?device=" ) % deviceId % agg;
}
QString UrlBuilder::getEpisodeActionsUrlByTimestamp( const QString& username, qulonglong since )
{
QString numString = QString::number( since );
- return s_server % s_api2 % QLatin1String( "/episodes/" ) % username % QLatin1String( ".json?since=" ) % numString;
+ return Config::instance()->mygpoBaseUrl().toString() %
+ s_api2 % QLatin1String( "/episodes/" ) % username % QLatin1String( ".json?since=" ) % numString;
}
QString UrlBuilder::getEpisodeActionsUrlByPodcastAndTimestamp( const QString& username, const QString& podcastUrl, qulonglong since )
{
QString numString = QString::number( since );
- return s_server % s_api2 % QLatin1String( "/episodes/" ) % username % QLatin1String( ".json?podcast=" ) % podcastUrl % QLatin1String( "&since=" ) % numString;
+ return Config::instance()->mygpoBaseUrl().toString() %
+ s_api2 % QLatin1String( "/episodes/" ) % username % QLatin1String( ".json?podcast=" ) % podcastUrl % QLatin1String( "&since=" ) % numString;
}
QString UrlBuilder::getEpisodeActionsUrlByDeviceAndTimestamp( const QString& username, const QString& deviceId, qulonglong since )
{
QString numString = QString::number( since );
- return s_server % s_api2 % QLatin1String( "/episodes/" ) % username % QLatin1String( ".json?device=" ) % deviceId % QLatin1String( "&since=" ) % numString;
+ return Config::instance()->mygpoBaseUrl().toString() %
+ s_api2 % QLatin1String( "/episodes/" ) % username % QLatin1String( ".json?device=" ) % deviceId % QLatin1String( "&since=" ) % numString;
}
QString UrlBuilder::getUploadEpisodeActionsUrl( const QString& username )
{
- return s_server % s_api2 % QLatin1String( "/episodes/" ) % username % QLatin1String( ".json" );
+ return Config::instance()->mygpoBaseUrl().toString() %
+ s_api2 % QLatin1String( "/episodes/" ) % username % QLatin1String( ".json" );
}
QString UrlBuilder::getDeviceSynchronizationStatusUrl ( const QString& username )
{
- return s_server % s_api2 % QLatin1String( "/sync-devices/" ) % username % QLatin1String( ".json" );
+ return Config::instance()->mygpoBaseUrl().toString() %
+ s_api2 % QLatin1String( "/sync-devices/" ) % username % QLatin1String( ".json" );
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/src/UrlBuilder.h new/libmygpo-qt.1.0.9/src/UrlBuilder.h
--- old/libmygpo-qt.1.0.7/src/UrlBuilder.h 2013-04-13 11:51:21.000000000 +0200
+++ new/libmygpo-qt.1.0.9/src/UrlBuilder.h 2016-09-16 13:02:54.000000000 +0200
@@ -137,7 +137,6 @@
private:
UrlBuilder() {};
UrlBuilder( const UrlBuilder& ) {};
- static const QString s_server;
static const QString s_api2;
static const QString s_api1;
};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/src/qjsonwrapper/Json.cpp new/libmygpo-qt.1.0.9/src/qjsonwrapper/Json.cpp
--- old/libmygpo-qt.1.0.7/src/qjsonwrapper/Json.cpp 1970-01-01 01:00:00.000000000 +0100
+++ new/libmygpo-qt.1.0.9/src/qjsonwrapper/Json.cpp 2016-09-16 13:02:54.000000000 +0200
@@ -0,0 +1,128 @@
+/* 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"
+
+// Qt version specific includes
+#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
+ #include <QJsonDocument>
+ #include <QMetaProperty>
+#else
+ #include
+ #include
+ #include
+#endif
+
+namespace QJsonWrapper
+{
+
+QVariantMap
+qobject2qvariant( const QObject* object )
+{
+#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
+ QVariantMap map;
+ if ( object == NULL )
+ {
+ return map;
+ }
+
+ const QMetaObject* metaObject = object->metaObject();
+ for ( int i = 0; i < metaObject->propertyCount(); ++i )
+ {
+ QMetaProperty metaproperty = metaObject->property( i );
+ if ( metaproperty.isReadable() )
+ {
+ map[ QLatin1String( metaproperty.name() ) ] = object->property( metaproperty.name() );
+ }
+ }
+ return map;
+#else
+ return QJson::QObjectHelper::qobject2qvariant( object );
+#endif
+}
+
+
+void
+qvariant2qobject( const QVariantMap& variant, QObject* object )
+{
+#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
+ 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 ( value.canConvert( property.type() ) )
+ {
+ value.convert( property.type() );
+ object->setProperty( iter.key().toLatin1(), value );
+ } else if ( QString( QLatin1String("QVariant") ).compare( QLatin1String( property.typeName() ) ) == 0 ) {
+ object->setProperty( iter.key().toLatin1(), value );
+ }
+ }
+ }
+#else
+ QJson::QObjectHelper::qvariant2qobject( variant, object );
+#endif
+}
+
+
+QVariant
+parseJson( const QByteArray& jsonData, bool* ok )
+{
+#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
+ QJsonParseError error;
+ QJsonDocument doc = QJsonDocument::fromJson( jsonData, &error );
+ if ( ok != NULL )
+ {
+ *ok = ( error.error == QJsonParseError::NoError );
+ }
+ return doc.toVariant();
+#else
+ QJson::Parser p;
+ return p.parse( jsonData, ok );
+#endif
+}
+
+
+QByteArray
+toJson( const QVariant &variant, bool* ok )
+{
+#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
+ QJsonDocument doc = QJsonDocument::fromVariant( variant );
+ if ( ok != NULL )
+ {
+ *ok = !doc.isNull();
+ }
+ return doc.toJson( QJsonDocument::Compact );
+#else
+ QJson::Serializer serializer;
+ QByteArray ret = serializer.serialize( variant );
+ if ( ok != NULL )
+ {
+ *ok = !ret.isNull();
+ }
+ return ret;
+#endif
+}
+
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/src/qjsonwrapper/Json.h new/libmygpo-qt.1.0.9/src/qjsonwrapper/Json.h
--- old/libmygpo-qt.1.0.7/src/qjsonwrapper/Json.h 1970-01-01 01:00:00.000000000 +0100
+++ new/libmygpo-qt.1.0.9/src/qjsonwrapper/Json.h 2016-09-16 13:02:54.000000000 +0200
@@ -0,0 +1,36 @@
+/* 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.
+ */
+
+#pragma once
+#ifndef QJSONWRAPPER_JSON_H
+#define QJSONWRAPPER_JSON_H
+
+#include <QVariant>
+
+namespace QJsonWrapper
+{
+ QVariantMap qobject2qvariant( const QObject* object );
+ void qvariant2qobject( const QVariantMap& variant, QObject* object );
+ QVariant parseJson( const QByteArray& jsonData, bool* ok = 0 );
+ QByteArray toJson( const QVariant &variant, bool* ok = 0 );
+}
+
+#endif // QJSONWRAPPER_JSON_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/templates/Template.cpp new/libmygpo-qt.1.0.9/templates/Template.cpp
--- old/libmygpo-qt.1.0.7/templates/Template.cpp 1970-01-01 01:00:00.000000000 +0100
+++ new/libmygpo-qt.1.0.9/templates/Template.cpp 2016-09-16 13:02:54.000000000 +0200
@@ -0,0 +1,22 @@
+/***************************************************************************
+* This file is part of libmygpo-qt *
+* Copyright (c) 2010 - 2011 Stefan Derkits *
+* Copyright (c) 2010 - 2011 Christian Wagner *
+* Copyright (c) 2010 - 2011 Felix Winter *
+* *
+* This library is free software; you can redistribute it and/or *
+* modify it under the terms of the GNU Lesser General Public *
+* License as published by the Free Software Foundation; either *
+* version 2.1 of the License, or (at your option) any later version. *
+* *
+* This library is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+* Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public *
+* License along with this library; if not, write to the Free Software *
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 *
+* USA *
+***************************************************************************/
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/templates/Template.h new/libmygpo-qt.1.0.9/templates/Template.h
--- old/libmygpo-qt.1.0.7/templates/Template.h 1970-01-01 01:00:00.000000000 +0100
+++ new/libmygpo-qt.1.0.9/templates/Template.h 2016-09-16 13:02:54.000000000 +0200
@@ -0,0 +1,26 @@
+/***************************************************************************
+* This file is part of libmygpo-qt *
+* Copyright (c) 2010 - 2011 Stefan Derkits *
+* Copyright (c) 2010 - 2011 Christian Wagner *
+* Copyright (c) 2010 - 2011 Felix Winter *
+* *
+* This library is free software; you can redistribute it and/or *
+* modify it under the terms of the GNU Lesser General Public *
+* License as published by the Free Software Foundation; either *
+* version 2.1 of the License, or (at your option) any later version. *
+* *
+* This library is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+* Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public *
+* License along with this library; if not, write to the Free Software *
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 *
+* USA *
+***************************************************************************/
+
+#ifndef TEMPLATE_H
+#define TEMPLATE_H
+
+#endif // TEMPLATE_H
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/tests/CMakeLists.txt new/libmygpo-qt.1.0.9/tests/CMakeLists.txt
--- old/libmygpo-qt.1.0.7/tests/CMakeLists.txt 2013-01-19 12:48:52.000000000 +0100
+++ new/libmygpo-qt.1.0.9/tests/CMakeLists.txt 2016-09-16 13:02:54.000000000 +0200
@@ -7,26 +7,29 @@
set ( TESTOBJECTS_SRCDIR ${CMAKE_CURRENT_SOURCE_DIR}/../src )
-include_directories( ${QT_INCLUDES} ${QJSON_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/../src ${TESTOBJECTS_SRCDIR} )
+include_directories( ${QJSON_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/../src ${TESTOBJECTS_SRCDIR} )
# UrlBuilder library
add_library( UrlBuilder ${TESTOBJECTS_SRCDIR}/UrlBuilder.cpp ${TESTOBJECTS_SRCDIR}/Config.cpp )
+qt5_use_modules( UrlBuilder Core )
# JSONCreator library
-QT4_WRAP_CPP(LIBMYGPO_QT_MOC_SRC ${TESTOBJECTS_SRCDIR}/EpisodeAction.h ${TESTOBJECTS_SRCDIR}/EpisodeAction_p.h )
-add_library( JsonCreator ${TESTOBJECTS_SRCDIR}/JsonCreator.cpp ${TESTOBJECTS_SRCDIR}/EpisodeAction.cpp ${LIBMYGPO_QT_MOC_SRC})
+QT_WRAP_CPP(LIBMYGPO_QT_MOC_SRC ${TESTOBJECTS_SRCDIR}/EpisodeAction.h ${TESTOBJECTS_SRCDIR}/EpisodeAction_p.h )
+add_library( JsonCreator ${TESTOBJECTS_SRCDIR}/JsonCreator.cpp ${TESTOBJECTS_SRCDIR}/EpisodeAction.cpp ${TESTOBJECTS_SRCDIR}/qjsonwrapper/Json.cpp ${LIBMYGPO_QT_MOC_SRC})
+qt5_use_modules( JsonCreator Core Network )
set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} )
macro(add_libmygpo_test _source)
get_filename_component(_name ${_source} NAME_WE)
- QT4_WRAP_CPP(${_name}_MOC_SRC ${_name}.h)
+ QT_WRAP_CPP(${_name}_MOC_SRC ${_name}.h)
add_executable(${_name} ${_source} ${${_name}_MOC_SRC})
target_link_libraries(${_name} ${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} ${QT_QTNETWORK_LIBRARY})
add_test(${_name}-test ${EXECUTABLE_OUTPUT_PATH}/${_name})
+ qt5_use_modules(${_name} Network Test)
endmacro(add_libmygpo_test)
add_libmygpo_test( UrlBuilderTest.cpp )
target_link_libraries( UrlBuilderTest UrlBuilder)
add_libmygpo_test( JsonCreatorTest.cpp )
-target_link_libraries( JsonCreatorTest JsonCreator ${QJSON_LIBRARIES} )
\ No newline at end of file
+target_link_libraries( JsonCreatorTest JsonCreator ${QJSON_LIBRARIES} )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/tests/JsonCreatorTest.cpp new/libmygpo-qt.1.0.9/tests/JsonCreatorTest.cpp
--- old/libmygpo-qt.1.0.7/tests/JsonCreatorTest.cpp 2013-01-19 12:48:52.000000000 +0100
+++ new/libmygpo-qt.1.0.9/tests/JsonCreatorTest.cpp 2016-09-16 13:02:54.000000000 +0200
@@ -57,12 +57,13 @@
QList<QUrl> add;
QList<QUrl> remove;
QByteArray output;
-
+
// test with empty lists
output = JsonCreator::addRemoveSubsToJSON(add, remove);
+ QString outString1 = QString::fromLatin1( output ).replace( QLatin1String(" "), QLatin1String("") );
+ QString expected1( QLatin1String( "{\"add\":[],\"remove\":[]}" ) );
+ QCOMPARE(outString1, expected1 );
- QCOMPARE(output, QByteArray("{ \"add\" : [ ], \"remove\" : [ ] }"));
-
// test with full lists
add.append(QUrl(QLatin1String("http://example.com/feed.rss")));
add.append(QUrl(QLatin1String("http://example.org/podcast.php")));
@@ -70,8 +71,9 @@
remove.append(QUrl(QLatin1String("http://example.org/podcast.php")));
output = JsonCreator::addRemoveSubsToJSON(add, remove);
-
- QCOMPARE(output, QByteArray("{ \"add\" : [ \"http://example.com/feed.rss\", \"http://example.org/podcast.php\" ], \"remove\" : [ \"http://example.org/podcast.php\" ] }"));
+ QString outString2 = QString::fromLatin1( output ).replace( QLatin1String(" "), QLatin1String("") );
+ QString expected2( QLatin1String("{\"add\":[\"http://example.com/feed.rss\",\"http://example.org/podcast.php\"],\"remove\":[\"http://example.org/podcast.php\"]}"));
+ QCOMPARE(outString2, expected2 );
}
void JsonCreatorTest::testSaveSettingsToJSON()
@@ -82,9 +84,11 @@
// test with empty map/list
output = JsonCreator::saveSettingsToJSON(set, remove);
+ QString outString1 = QString::fromLatin1( output ).replace( QLatin1String(" "), QLatin1String("") );
+ QString expected1( QLatin1String( "{\"remove\":[],\"set\":{}}" ) );
+
+ QCOMPARE( outString1, expected1 );
- QCOMPARE(output, QByteArray("{ \"remove\" : [ ], \"set\" : { } }"));
-
// test with different settings (String, DateTime, Integer)
set.insert(QLatin1String("setting4"), QLatin1String("stringvalue"));
set.insert(QLatin1String("setting5"), QDateTime::fromString(QLatin1String("M1d1y9800:01:02"),
@@ -95,9 +99,11 @@
remove.append(QLatin1String("setting2"));
output = JsonCreator::saveSettingsToJSON(set, remove);
+ QString outString2 = QString::fromLatin1( output ).replace( QLatin1String(" "), QLatin1String("") );
+ QString expected2( QLatin1String( "{\"remove\":[\"setting1\",\"setting2\"],\"set\":{\"setting4\":\"stringvalue\",\"setting5\":\"1998-01-01T00:01:02\",\"setting6\":4}}" ) );
+
+ QCOMPARE( outString2, expected2 );
- QCOMPARE(output, QByteArray("{ \"remove\" : [ \"setting1\", \"setting2\" ], \"set\" : { \"setting4\" : \"stringvalue\", \"setting5\" : \"1998-01-01T00:01:02\", \"setting6\" : 4 } }"));
-
}
void JsonCreatorTest::testEpisodeActionListToJSON()
@@ -107,8 +113,9 @@
// test with empty list
output = JsonCreator::episodeActionListToJSON(episodeActions);
-
- QCOMPARE(output, QByteArray("[ ]"));
+ QString outString1 = QString::fromLatin1( output ).replace( QLatin1String(" "), QLatin1String("") );
+ QString expected1( QLatin1String( "[]" ) );
+ QCOMPARE( outString1, expected1 );
// test with some values
@@ -125,8 +132,10 @@
episodeActions << episode << episode2 << episode3 << episode4 << episode5 << episode6;
output = JsonCreator::episodeActionListToJSON(episodeActions);
-
- QCOMPARE(output, QByteArray("[ { \"action\" : \"download\", \"device\" : \"device1\", \"episode\" : \"http://episode.url\", \"podcast\" : \"http://podcast.url\", \"timestamp\" : \"1998-01-01T00:01:02\" }, { \"action\" : \"delete\", \"device\" : \"device3\", \"episode\" : \"http://episode2.url\", \"podcast\" : \"http://podcast2.url\", \"timestamp\" : \"1920-01-01T12:01:02\" }, { \"action\" : \"new\", \"device\" : \"foodev\", \"episode\" : \"http://www.podtrac.com\", \"podcast\" : \"http://leo.am\", \"timestamp\" : \"1998-01-01T00:01:02\" }, { \"action\" : \"play\", \"device\" : \"foodev\", \"episode\" : \"http://www.podtrac.com\", \"podcast\" : \"http://leo.am\", \"timestamp\" : \"1920-01-01T12:01:02\" }, { \"action\" : \"play\", \"device\" : \"foodev\", \"episode\" : \"http://www.podtrac.com\", \"podcast\" : \"http://leo.am\", \"position\" : 123, \"started\" : 10, \"timestamp\" : \"1998-01-01T00:01:02\", \"total\" : 321 }, { \"action\" : \"play\", \"device\" : \"foodev\", \"episode\" : \"http://www.podtrac.com\", \"podcast\" : \"http://leo.am\", \"position\" : 10, \"timestamp\" : \"1998-01-01T00:01:02\" } ]"));
+ QString outString2 = QString::fromLatin1( output ).replace( QLatin1String(" "), QLatin1String("") );
+ QString expected2( QLatin1String( "[{\"action\":\"download\",\"device\":\"device1\",\"episode\":\"http://episode.url\",\"podcast\":\"http://podcast.url\",\"timestamp\":\"1998-01-01T00:01:02\"},{\"action\":\"delete\",\"device\":\"device3\",\"episode\":\"http://episode2.url\",\"podcast\":\"http://podcast2.url\",\"timestamp\":\"1920-01-01T12:01:02\"},{\"action\":\"new\",\"device\":\"foodev\",\"episode\":\"http://www.podtrac.com\",\"podcast\":\"http://leo.am\",\"timestamp\":\"1998-01-01T00:01:02\"},{\"action\":\"play\",\"device\":\"foodev\",\"episode\":\"http://www.podtrac.com\",\"podcast\":\"http://leo.am\",\"timestamp\":\"1920-01-01T12:01:02\" },{\"action\":\"play\",\"device\":\"foodev\",\"episode\":\"http://www.podtrac.com\",\"podcast\":\"http://leo.am\",\"position\":123,\"started\":10,\"timestamp\":\"1998-01-01T00:01:02\",\"total\":321},{\"action\":\"play\",\"device\":\"foodev\",\"episode\":\"http://www.podtrac.com\",\"podcast\":\"http://leo.am\",\"position\":10,\"timestamp\":\"1998-01-01T00:01:02\"}]" ) );
+
+ QCOMPARE(outString2, expected2 );
}
void JsonCreatorTest::testRenameDeviceStringToJSON()
@@ -137,17 +146,21 @@
// test with empty values
output = JsonCreator::renameDeviceStringToJSON(caption, type);
+ QString outString1 = QString::fromLatin1( output ).replace( QLatin1String(" "), QLatin1String("") );
+ QString expected1( QLatin1String( "{\"caption\":\"\",\"type\":\"\"}" ) );
- QCOMPARE(output, QByteArray("{ \"caption\" : \"\", \"type\" : \"\" }"));
+ QCOMPARE(outString1, expected1 );
// test with some values
caption = QLatin1String("caption1");
type = QLatin1String("type1");
output = JsonCreator::renameDeviceStringToJSON(caption, type);
+ QString outString2 = QString::fromLatin1( output ).replace( QLatin1String(" "), QLatin1String("") );
+ QString expected2( QLatin1String( "{\"caption\":\"caption1\",\"type\":\"type1\"}" ) );
+
+ QCOMPARE( outString2, expected2 );
- QCOMPARE(output, QByteArray("{ \"caption\" : \"caption1\", \"type\" : \"type1\" }"));
-
}
void JsonCreatorTest::testDeviceSynchronizationListsToJSON()
@@ -163,7 +176,9 @@
// test with empty lists
output = JsonCreator::deviceSynchronizationListsToJSON(sync, stopSync);
- QCOMPARE(output, QByteArray("{\"synchronize\" : [ ] ,\"stop-synchronize\" : [ ] }\n"));
+ QString outString1 = QString::fromLatin1( output ).replace( QLatin1String(" "), QLatin1String("") );
+ QString expected1( QLatin1String( "{\"synchronize\":[],\"stop-synchronize\":[]}" ) );
+ QCOMPARE( outString1, expected1 );
// test with full lists
sync1.append(QLatin1String("foo"));
@@ -183,7 +198,9 @@
stopSync.append(QLatin1String("stop3"));
output = JsonCreator::deviceSynchronizationListsToJSON(sync, stopSync);
- QCOMPARE(output, QByteArray("{\"synchronize\" : [[\"foo\",\"bar\"],[\"foobar\",\"barfoo\",\"foobarfoo\",\"foobar4\"],[ ]] ,\"stop-synchronize\" : [\"stop1\",\"stop2\",\"stop3\"] }\n"));
+ QString outString2 = QString::fromLatin1( output ).replace( QLatin1String(" "), QLatin1String("") );
+ QString expected2( QLatin1String( "{\"synchronize\":[[\"foo\",\"bar\"],[\"foobar\",\"barfoo\",\"foobarfoo\",\"foobar4\"],[]],\"stop-synchronize\":[\"stop1\",\"stop2\",\"stop3\"]}" ) );
+ QCOMPARE( outString2, expected2 );
}
QTEST_MAIN(JsonCreatorTest)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/tests/UrlBuilderTest.cpp new/libmygpo-qt.1.0.9/tests/UrlBuilderTest.cpp
--- old/libmygpo-qt.1.0.7/tests/UrlBuilderTest.cpp 2012-07-20 13:58:51.000000000 +0200
+++ new/libmygpo-qt.1.0.9/tests/UrlBuilderTest.cpp 2016-09-16 13:02:54.000000000 +0200
@@ -24,7 +24,7 @@
using namespace mygpo;
-UrlBuilderTest::UrlBuilderTest() :m_server(QLatin1String("http://gpodder.net")),
+UrlBuilderTest::UrlBuilderTest() :m_server(QLatin1String("https://gpodder.net")),
m_api2(QLatin1String( "/api/2" )) {
}
@@ -262,4 +262,19 @@
m_server + m_api2 + QLatin1String("/subscriptions/ÖÄÜ/!\"§$%$&/()=?ß{}Ä.json"));
}
+/**
+* Tests for getSubscriptionsUrl()
+*/
+void UrlBuilderTest::testGetSubscriptionUrl()
+{
+ QCOMPARE(UrlBuilder::getSubscriptionsUrl(QLatin1String("user123"), QLatin1String("device456"), UrlBuilder::JSON),
+ m_server + QLatin1String("/subscriptions/user123/device456.json"));
+}
+
+void UrlBuilderTest::testGetSubscriptionUrlWithoutDevice()
+{
+ QCOMPARE(UrlBuilder::getSubscriptionsUrl(QLatin1String("user"), QString(), UrlBuilder::OPML),
+ m_server + QLatin1String("/subscriptions/user.opml"));
+}
+
QTEST_MAIN(UrlBuilderTest)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmygpo-qt.1.0.7/tests/UrlBuilderTest.h new/libmygpo-qt.1.0.9/tests/UrlBuilderTest.h
--- old/libmygpo-qt.1.0.7/tests/UrlBuilderTest.h 2012-07-20 13:58:51.000000000 +0200
+++ new/libmygpo-qt.1.0.9/tests/UrlBuilderTest.h 2016-09-16 13:02:54.000000000 +0200
@@ -109,6 +109,12 @@
void testGetAddRemoveSubUrlEmpty();
void testGetAddRemoveSubUrlSpecialCharacters();
+ /**
+ * Tests for getSubscriptionsUrl()
+ */
+ void testGetSubscriptionUrl();
+ void testGetSubscriptionUrlWithoutDevice();
+
/** These constans must be equal to the constants defined for UrlBuilder */
private:
const QString m_server;