libmygpo-qt: drop qt4 & add qt6 support

This commit is contained in:
Raven 2025-01-13 11:29:55 +06:00
parent 954d03f963
commit 01f81d23da
12 changed files with 947 additions and 55 deletions

View File

@ -0,0 +1,54 @@
From 0d76d960727018bddf04c6cc89552af69aaa7e55 Mon Sep 17 00:00:00 2001
From: Andreas Sturmlechner <andreas.sturmlechner@gmail.com>
Date: Sun, 15 Apr 2018 22:20:34 +0200
Subject: [PATCH 01/10] Add missing Qt5Network, Qt5Test, make BUILD_WITH_QT4
more strict
---
CMakeLists.txt | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2a1f652..eb006d9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,25 +5,25 @@ project( libmygpo-qt )
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" )
-option(BUILD_WITH_QT4 "Build libmygpo-qt with Qt4 no matter if Qt5 was found" OFF)
+option(BUILD_WITH_QT4 "Build libmygpo-qt with Qt4" OFF)
if( NOT BUILD_WITH_QT4 )
- find_package(Qt5Core QUIET)
- if( Qt5Core_DIR )
- set(MYGPO_QT_VERSION_SUFFIX 5)
-
- macro(qt_wrap_cpp)
- qt5_wrap_cpp(${ARGN})
- endmacro()
+ if( MYGPO_BUILD_TESTS )
+ find_package(Qt5 REQUIRED COMPONENTS Core Network Test CONFIG)
+ else()
+ find_package(Qt5 REQUIRED COMPONENTS Core Network CONFIG)
endif()
+ set(MYGPO_QT_VERSION_SUFFIX 5)
+
+ macro(qt_wrap_cpp)
+ qt5_wrap_cpp(${ARGN})
+ endmacro()
# 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 )
+else()
message(STATUS "Could not find Qt5, searching for Qt4 instead...")
message(STATUS "Qt4 Support is deprecated, building with Qt4 is no longer officially supported")
if( MYGPO_BUILD_TESTS )
--
2.47.0

View File

@ -0,0 +1,153 @@
From 42e19dcb6b7c07460f05aa1d4586d5c76236c6d0 Mon Sep 17 00:00:00 2001
From: Tuomas Nurmi <tuomas@norsumanageri.org>
Date: Mon, 8 Jul 2024 17:03:32 +0300
Subject: [PATCH] Minimal changes to make Qt6 compilation possible
Untested. Compiles, with a bunch of deprecation warnings.
There's likely room for improvement all around.
---
CMakeLists.txt | 24 +++++++++---------------
libmygpo-qt.pc.in | 1 -
src/CMakeLists.txt | 4 ++--
src/DeviceList.cpp | 2 +-
tests/CMakeLists.txt | 12 +++++++++---
5 files changed, 21 insertions(+), 22 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8a79ddc..920e841 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,10 +5,10 @@ project( libmygpo-qt )
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" )
-option(BUILD_WITH_QT4 "Build libmygpo-qt with Qt4" OFF)
+option(BUILD_WITH_QT6 "Build libmygpo-qt with Qt6" OFF)
option(MYGPO_BUILD_TESTS "Build all unit tests" ON)
-if( NOT BUILD_WITH_QT4 )
+if( NOT BUILD_WITH_QT6 )
if( MYGPO_BUILD_TESTS )
find_package(Qt5 REQUIRED COMPONENTS Core Network Test CONFIG)
else()
@@ -23,27 +23,21 @@ if( NOT BUILD_WITH_QT4 )
# pkg-config names of QtCore and QtNetwork are Qt5Core and Qt5Network for
# Qt5
set(MYGPO_QT_MAJOR_VERSION "5")
- set(MYGPO_QT4_QJSON_DEP "")
else()
- message(STATUS "Could not find Qt5, searching for Qt4 instead...")
- message(STATUS "Qt4 Support is deprecated, building with Qt4 is no longer officially supported")
+ message(STATUS "Could not find Qt5, searching for Qt6 instead...")
if( MYGPO_BUILD_TESTS )
- find_package( Qt4 COMPONENTS QtCore QtNetwork QtTest REQUIRED )
+ find_package( Qt6 COMPONENTS Core Network Test REQUIRED )
else( MYGPO_BUILD_TESTS )
- find_package( Qt4 COMPONENTS QtCore QtNetwork REQUIRED )
+ find_package( Qt6 COMPONENTS Core Network REQUIRED )
endif()
- set( QT_DONT_USE_QTGUI TRUE )
- include( ${QT_USE_FILE} )
+ set(MYGPO_QT_VERSION_SUFFIX 6)
macro(qt_wrap_cpp)
- qt4_wrap_cpp(${ARGN})
+ qt6_wrap_cpp(${ARGN})
endmacro()
- set(MYGPO_QT_MAJOR_VERSION "")
- set(MYGPO_QT4_QJSON_DEP "Requires.private: QJson")
+ set(MYGPO_QT_MAJOR_VERSION "6")
- # QJson is only required for Qt4
- find_package(QJSON REQUIRED)
endif()
# Don't use absolute path in Mygpo-qtTargets-$buildType.cmake
@@ -51,7 +45,7 @@ endif()
# set(QT_USE_IMPORTED_TARGETS TRUE)
set( MYGPO_QT_VERSION_MAJOR "1" )
-set( MYGPO_QT_VERSION_MINOR "1" )
+set( MYGPO_QT_VERSION_MINOR "2" )
set( MYGPO_QT_VERSION_PATCH "0" )
set( MYGPO_QT_VERSION "${MYGPO_QT_VERSION_MAJOR}.${MYGPO_QT_VERSION_MINOR}.${MYGPO_QT_VERSION_PATCH}" )
diff --git a/libmygpo-qt.pc.in b/libmygpo-qt.pc.in
index 8403e48..520bd52 100644
--- a/libmygpo-qt.pc.in
+++ b/libmygpo-qt.pc.in
@@ -8,6 +8,5 @@ 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: 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 --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 253e81e..9d1989c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -81,10 +81,10 @@ add_library( ${MYGPO_QT_TARGET_NAME} SHARED ${LIBMYGPO_QT_SRC} ${LIBMYGPO_QT_MOC
set_target_properties( ${MYGPO_QT_TARGET_NAME} PROPERTIES VERSION ${MYGPO_QT_VERSION} SOVERSION ${MYGPO_QT_SONAME} DEFINE_SYMBOL MYGPO_MAKEDLL)
-if( NOT BUILD_WITH_QT4 )
+if( NOT BUILD_WITH_QT6 )
target_link_libraries( ${MYGPO_QT_TARGET_NAME} Qt5::Core Qt5::Network)
else()
- target_link_libraries( ${MYGPO_QT_TARGET_NAME} ${QT_QTCORE_LIBRARY} ${QT_QTNETWORK_LIBRARY} ${QJSON_LIBRARIES})
+ target_link_libraries( ${MYGPO_QT_TARGET_NAME} Qt6::Core Qt6::Network)
endif()
install( TARGETS ${MYGPO_QT_TARGET_NAME} EXPORT ${MYGPO_QT_TARGET_NAME}Export DESTINATION ${LIB_INSTALL_DIR} )
diff --git a/src/DeviceList.cpp b/src/DeviceList.cpp
index e972318..92e29cc 100644
--- a/src/DeviceList.cpp
+++ b/src/DeviceList.cpp
@@ -64,7 +64,7 @@ bool DeviceListPrivate::parse( const QVariant& data )
DevicePtr ptr( new Device( var, this ) );
m_devicesList.append( ptr );
QVariant v;
- v.setValue<DevicePtr>( ptr );
+ v.setValue<DevicePtr>( QSharedPointer<mygpo::Device>(ptr) );
devList.append( v );
}
m_devices = devList;
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 4f77158..ce63689 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -11,14 +11,18 @@ include_directories( ${QJSON_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CU
# UrlBuilder library
add_library( UrlBuilder ${TESTOBJECTS_SRCDIR}/UrlBuilder.cpp ${TESTOBJECTS_SRCDIR}/Config.cpp )
-if( NOT BUILD_WITH_QT4 )
+if( NOT BUILD_WITH_QT6 )
target_link_libraries( UrlBuilder Qt5::Core )
+else()
+ target_link_libraries( UrlBuilder Qt6::Core )
endif()
# JSONCreator library
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})
-if( NOT BUILD_WITH_QT4 )
+if( NOT BUILD_WITH_QT6 )
target_link_libraries( JsonCreator Qt5::Core Qt5::Network )
+else()
+ target_link_libraries( JsonCreator Qt6::Core Qt6::Network )
endif()
set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} )
@@ -29,8 +33,10 @@ macro(add_libmygpo_test _source)
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})
- if( NOT BUILD_WITH_QT4 )
+ if( NOT BUILD_WITH_QT6 )
target_link_libraries(${_name} Qt5::Network Qt5::Test)
+ else()
+ target_link_libraries(${_name} Qt6::Network Qt6::Test)
endif()
endmacro(add_libmygpo_test)

View File

@ -0,0 +1,81 @@
From 1b53767b988b339aac8b353327a1542b2a0c0610 Mon Sep 17 00:00:00 2001
From: Andreas Sturmlechner <andreas.sturmlechner@gmail.com>
Date: Sun, 15 Apr 2018 22:29:33 +0200
Subject: [PATCH 02/10] Fix build with Qt 5.11_beta3 (dropping qt5_use_modules)
---
CMakeLists.txt | 3 ---
src/CMakeLists.txt | 8 ++++++--
tests/CMakeLists.txt | 12 +++++++++---
3 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index eb006d9..fa4b0cb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -34,9 +34,6 @@ else()
set( QT_DONT_USE_QTGUI TRUE )
include( ${QT_USE_FILE} )
- macro(qt5_use_modules)
- endmacro()
-
macro(qt_wrap_cpp)
qt4_wrap_cpp(${ARGN})
endmacro()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 802125b..253e81e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -79,9 +79,13 @@ QT_WRAP_CPP(LIBMYGPO_QT_MOC_SRC ${LIBMYGPO_QT_MOC_H} )
add_library( ${MYGPO_QT_TARGET_NAME} SHARED ${LIBMYGPO_QT_SRC} ${LIBMYGPO_QT_MOC_SRC} )
-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 )
+
+if( NOT BUILD_WITH_QT4 )
+ target_link_libraries( ${MYGPO_QT_TARGET_NAME} Qt5::Core Qt5::Network)
+else()
+ target_link_libraries( ${MYGPO_QT_TARGET_NAME} ${QT_QTCORE_LIBRARY} ${QT_QTNETWORK_LIBRARY} ${QJSON_LIBRARIES})
+endif()
install( TARGETS ${MYGPO_QT_TARGET_NAME} EXPORT ${MYGPO_QT_TARGET_NAME}Export DESTINATION ${LIB_INSTALL_DIR} )
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index a3e3223..4f77158 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -11,11 +11,15 @@ include_directories( ${QJSON_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CU
# UrlBuilder library
add_library( UrlBuilder ${TESTOBJECTS_SRCDIR}/UrlBuilder.cpp ${TESTOBJECTS_SRCDIR}/Config.cpp )
-qt5_use_modules( UrlBuilder Core )
+if( NOT BUILD_WITH_QT4 )
+ target_link_libraries( UrlBuilder Qt5::Core )
+endif()
# JSONCreator library
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 )
+if( NOT BUILD_WITH_QT4 )
+ target_link_libraries( JsonCreator Qt5::Core Qt5::Network )
+endif()
set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} )
@@ -25,7 +29,9 @@ macro(add_libmygpo_test _source)
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)
+ if( NOT BUILD_WITH_QT4 )
+ target_link_libraries(${_name} Qt5::Network Qt5::Test)
+ endif()
endmacro(add_libmygpo_test)
add_libmygpo_test( UrlBuilderTest.cpp )
--
2.47.0

View File

@ -0,0 +1,33 @@
From 843cb11ef80353af76e02eaf2a344ec79707c13f Mon Sep 17 00:00:00 2001
From: Jonas Kvinge <jonas@jkvinge.net>
Date: Wed, 14 Jul 2021 21:57:37 +0200
Subject: [PATCH 03/10] Move MYGPO_BUILD_TESTS option
---
CMakeLists.txt | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fa4b0cb..d27435f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,6 +6,7 @@ set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/mo
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII" )
option(BUILD_WITH_QT4 "Build libmygpo-qt with Qt4" OFF)
+option(MYGPO_BUILD_TESTS "Build all unit tests" ON)
if( NOT BUILD_WITH_QT4 )
if( MYGPO_BUILD_TESTS )
@@ -77,8 +78,6 @@ if (CMAKE_COMPILER_IS_GNUCXX)
endif()
endif(CMAKE_COMPILER_IS_GNUCXX)
-option(MYGPO_BUILD_TESTS "Build all unit tests" ON)
-
if(MYGPO_BUILD_TESTS)
INCLUDE(CTest)
enable_testing()
--
2.47.0

View File

@ -0,0 +1,22 @@
From 70adbf91675ce70cbdd46478bb2867f705e7df0d Mon Sep 17 00:00:00 2001
From: Jonas Kvinge <jonas@jkvinge.net>
Date: Wed, 14 Jul 2021 22:04:13 +0200
Subject: [PATCH 04/10] Update the minimum required cmake version to 3.0
---
CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fa4b0cb..786ff44 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required( VERSION 2.8.9 FATAL_ERROR )
+cmake_minimum_required( VERSION 3.0 FATAL_ERROR )
project( libmygpo-qt )
--
2.47.0

View File

@ -0,0 +1,34 @@
From dab4844b8c516e99805b88f02df69e1b0bc11da2 Mon Sep 17 00:00:00 2001
From: Bart De Vries <bart@mogwai.be>
Date: Wed, 28 Jul 2021 23:33:43 +0200
Subject: [PATCH 05/10] Fix parsing of timestamp for EpisodeAction
I don't know the entire history of the API, but the current timestamp
that is returned by gpodder.net is in ISO 8601 format. The libmygpo-qt
implementation was trying to convert this string directly into
qulonglong which would fail, and therefore always return 0.
Presumably, the timestamp was previously returned as seconds-since-epoch,
but changed at some point in time.
---
src/EpisodeAction.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/EpisodeAction.cpp b/src/EpisodeAction.cpp
index 95536be..59aa96b 100644
--- a/src/EpisodeAction.cpp
+++ b/src/EpisodeAction.cpp
@@ -118,7 +118,10 @@ bool EpisodeActionPrivate::parse( const QVariant& data )
if( episodeActionMap.contains( QLatin1String( "timestamp" ) ) )
{
s = episodeActionMap.value( QLatin1String( "timestamp" ) );
- m_timestamp = s.toULongLong();
+ // timestamp is provided in ISO 8601 format, to be converted to qulonglong
+ // when the server generates the timestamp, it will contain extra
+ // sub-second resolution, which we need to cut off first before converting
+ m_timestamp = static_cast<qulonglong>(QDateTime::fromString(s.toString().section(QLatin1String("."), 0, 0), QLatin1String("yyyy-MM-dd'T'hh:mm:ss")).toMSecsSinceEpoch() / 1000);
}
else
{
--
2.47.0

View File

@ -0,0 +1,27 @@
From b40cf4eded0c9b0a9feffa3f51919b086b4257f5 Mon Sep 17 00:00:00 2001
From: Bart De Vries <bart@mogwai.be>
Date: Thu, 2 Sep 2021 14:24:40 +0200
Subject: [PATCH 06/10] Fix timestamp sent to gpodder.net to correspond to UTC
According to the gpodder.net API, this timestamp is supposed to be sent
as UTC time.
---
src/JsonCreator.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/JsonCreator.cpp b/src/JsonCreator.cpp
index 9c4f0bc..0c0a5ec 100644
--- a/src/JsonCreator.cpp
+++ b/src/JsonCreator.cpp
@@ -192,7 +192,7 @@ QVariantMap JsonCreator::episodeActionToQVariantMap( const EpisodeActionPtr epis
time.addMSecs(episodeAction->timestamp() % 1000 );
dateTime.setTime(time);
#endif
- map.insert( QLatin1String( "timestamp" ), dateTime.toString(Qt::ISODate) );
+ map.insert( QLatin1String( "timestamp" ), dateTime.toUTC().toString(Qt::ISODate) );
}
if( actionType == EpisodeAction::Play )
{
--
2.47.0

View File

@ -0,0 +1,32 @@
From b02f23ec8c20eb32351a02bf47a584261074d3f5 Mon Sep 17 00:00:00 2001
From: Bart De Vries <bart@mogwai.be>
Date: Wed, 29 Sep 2021 11:32:50 +0200
Subject: [PATCH 07/10] Fix removeList of DeviceUpdates
The gpodder.net server returns the list of subscriptions to be removed
under the "rem" tag, not "remove" as the API documentation seems to
suggest. Hence, libmygpo-qt is not picking up any subscription
removals.
As reference, see gpodder.net server source code (line 73):
https://github.com/gpodder/mygpo/blob/master/mygpo/api/advanced/updates.py
---
src/DeviceUpdates.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/DeviceUpdates.cpp b/src/DeviceUpdates.cpp
index 04653c5..2a8e80f 100644
--- a/src/DeviceUpdates.cpp
+++ b/src/DeviceUpdates.cpp
@@ -93,7 +93,7 @@ bool DeviceUpdatesPrivate::parse( const QVariant& data )
return false;
QVariantMap varMap = data.toMap();
m_add = varMap.value( QLatin1String( "add" ) );
- m_remove = varMap.value( QLatin1String( "remove" ) );
+ m_remove = varMap.value( QLatin1String( "rem" ) );
m_update = varMap.value( QLatin1String( "updates" ) );
if( varMap.value( QLatin1String( "timestamp" ) ).canConvert( QVariant::LongLong ) )
m_timestamp = varMap.value( QLatin1String( "timestamp" ) ).toLongLong();
--
2.47.0

View File

@ -0,0 +1,40 @@
From 5f58afe75dea5acf79a22666beb897c024354bd0 Mon Sep 17 00:00:00 2001
From: Tuomas Nurmi <tuomas@norsumanageri.org>
Date: Mon, 8 Jul 2024 16:35:56 +0300
Subject: [PATCH 08/10] Use c/c++ library-defined ULLONG_MAX instead of manual
calculation
---
src/EpisodeAction.cpp | 2 +-
src/JsonCreator.cpp | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/EpisodeAction.cpp b/src/EpisodeAction.cpp
index 59aa96b..e7d595d 100644
--- a/src/EpisodeAction.cpp
+++ b/src/EpisodeAction.cpp
@@ -26,7 +26,7 @@
using namespace mygpo;
-static qulonglong c_maxlonglong = (2^64)-1;
+static qulonglong c_maxlonglong = ULLONG_MAX;
EpisodeActionPrivate::EpisodeActionPrivate( EpisodeAction* qq, const QVariant& variant, QObject* parent ) : QObject( parent ), q( qq )
{
diff --git a/src/JsonCreator.cpp b/src/JsonCreator.cpp
index 0c0a5ec..f50540e 100644
--- a/src/JsonCreator.cpp
+++ b/src/JsonCreator.cpp
@@ -32,7 +32,7 @@
using namespace mygpo;
-static qulonglong c_maxlonglong = (2^64)-1;
+static qulonglong c_maxlonglong = ULLONG_MAX;
QByteArray JsonCreator::addRemoveSubsToJSON( const QList< QUrl >& add, const QList< QUrl >& remove )
{
--
2.47.0

View File

@ -0,0 +1,355 @@
From ef1c1c1b2c36eaa21f73fc095cd801c15e6e736d Mon Sep 17 00:00:00 2001
From: Tuomas Nurmi <tuomas@norsumanageri.org>
Date: Mon, 8 Jul 2024 16:42:07 +0300
Subject: [PATCH 09/10] Update signals and slots to use Q_SIGNALS and Q_SLOTS
When including in projects with KDE Frameworks 5.85+, signals and slots keywords
don't work by default anymore and cause compilation to fail with default setup.
---
src/AddRemoveResult.h | 2 +-
src/AddRemoveResult_p.h | 4 ++--
src/DeviceList.h | 2 +-
src/DeviceList_p.h | 2 +-
src/DeviceSyncResult.h | 2 +-
src/DeviceSyncResult_p.h | 2 +-
src/DeviceUpdates.h | 2 +-
src/DeviceUpdates_p.h | 2 +-
src/Episode.h | 2 +-
src/EpisodeActionList.h | 2 +-
src/EpisodeActionList_p.h | 2 +-
src/EpisodeList.h | 2 +-
src/EpisodeList_p.h | 2 +-
src/Episode_p.h | 2 +-
src/Podcast.h | 2 +-
src/PodcastList.h | 2 +-
src/PodcastList_p.h | 2 +-
src/Podcast_p.h | 2 +-
src/Settings.h | 2 +-
src/Settings_p.h | 2 +-
src/TagList.h | 2 +-
src/TagList_p.h | 2 +-
tests/JsonCreatorTest.h | 2 +-
tests/UrlBuilderTest.h | 2 +-
24 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/src/AddRemoveResult.h b/src/AddRemoveResult.h
index cd31846..fc46b37 100644
--- a/src/AddRemoveResult.h
+++ b/src/AddRemoveResult.h
@@ -52,7 +52,7 @@ private:
Q_DISABLE_COPY( AddRemoveResult )
AddRemoveResultPrivate* const d;
friend class AddRemoveResultPrivate;
-signals:
+Q_SIGNALS:
/**Gets emitted when the data is ready to read*/
void finished();
/**Gets emitted when an parse error ocurred*/
diff --git a/src/AddRemoveResult_p.h b/src/AddRemoveResult_p.h
index cd17cdc..999e8be 100644
--- a/src/AddRemoveResult_p.h
+++ b/src/AddRemoveResult_p.h
@@ -49,11 +49,11 @@ private:
bool parse( const QVariant& data );
bool parse( const QByteArray& data );
-private slots:
+private Q_SLOTS:
void parseData();
void error( QNetworkReply::NetworkError error );
};
}
-#endif //ADDREMOVERESULT_PRIVATE_H
\ No newline at end of file
+#endif //ADDREMOVERESULT_PRIVATE_H
diff --git a/src/DeviceList.h b/src/DeviceList.h
index 04109fe..4e12ee7 100644
--- a/src/DeviceList.h
+++ b/src/DeviceList.h
@@ -49,7 +49,7 @@ private:
Q_DISABLE_COPY( DeviceList )
DeviceListPrivate* const d;
friend class DeviceListPrivate;
-signals:
+Q_SIGNALS:
/**Gets emitted when the data is ready to read*/
void finished();
/**Gets emitted when an parse error ocurred*/
diff --git a/src/DeviceList_p.h b/src/DeviceList_p.h
index 91dfd26..c908b92 100644
--- a/src/DeviceList_p.h
+++ b/src/DeviceList_p.h
@@ -47,7 +47,7 @@ private:
bool parse( const QVariant& data );
bool parse( const QByteArray& data );
-private slots:
+private Q_SLOTS:
void parseData();
void error( QNetworkReply::NetworkError error );
};
diff --git a/src/DeviceSyncResult.h b/src/DeviceSyncResult.h
index 82925d2..6cab821 100644
--- a/src/DeviceSyncResult.h
+++ b/src/DeviceSyncResult.h
@@ -50,7 +50,7 @@ private:
Q_DISABLE_COPY( DeviceSyncResult )
DeviceSyncResultPrivate* const d;
friend class DeviceSyncResultPrivate;
-signals:
+Q_SIGNALS:
/**Gets emitted when the data is ready to read*/
void finished();
/**Gets emitted when an parse error ocurred*/
diff --git a/src/DeviceSyncResult_p.h b/src/DeviceSyncResult_p.h
index 8bcca95..8e980a1 100644
--- a/src/DeviceSyncResult_p.h
+++ b/src/DeviceSyncResult_p.h
@@ -47,7 +47,7 @@ private:
bool parse( const QVariant& data );
bool parse( const QByteArray& data );
-private slots:
+private Q_SLOTS:
void parseData();
void error( QNetworkReply::NetworkError error );
diff --git a/src/DeviceUpdates.h b/src/DeviceUpdates.h
index a1308f5..324902e 100644
--- a/src/DeviceUpdates.h
+++ b/src/DeviceUpdates.h
@@ -56,7 +56,7 @@ private:
Q_DISABLE_COPY( DeviceUpdates )
DeviceUpdatesPrivate* const d;
friend class DeviceUpdatesPrivate;
-signals:
+Q_SIGNALS:
/**Gets emitted when the data is ready to read*/
void finished();
/**Gets emitted when an parse error ocurred*/
diff --git a/src/DeviceUpdates_p.h b/src/DeviceUpdates_p.h
index 18197b3..b8c5b43 100644
--- a/src/DeviceUpdates_p.h
+++ b/src/DeviceUpdates_p.h
@@ -56,7 +56,7 @@ private:
bool parse( const QVariant& data );
bool parse( const QByteArray& data );
-private slots:
+private Q_SLOTS:
void parseData();
void error( QNetworkReply::NetworkError error );
diff --git a/src/Episode.h b/src/Episode.h
index 7121f78..12699b1 100644
--- a/src/Episode.h
+++ b/src/Episode.h
@@ -77,7 +77,7 @@ private:
Q_DISABLE_COPY( Episode )
EpisodePrivate* const d;
friend class EpisodePrivate;
-signals:
+Q_SIGNALS:
/**Gets emitted when the data is ready to read*/
void finished();
/**Gets emitted when an parse error ocurred*/
diff --git a/src/EpisodeActionList.h b/src/EpisodeActionList.h
index 416b536..0372e23 100644
--- a/src/EpisodeActionList.h
+++ b/src/EpisodeActionList.h
@@ -52,7 +52,7 @@ public:
private:
EpisodeActionListPrivate* const d;
friend class EpisodeActionListPrivate;
-signals:
+Q_SIGNALS:
/**Gets emitted when the data is ready to read*/
void finished();
/**Gets emitted when an parse error ocurred*/
diff --git a/src/EpisodeActionList_p.h b/src/EpisodeActionList_p.h
index 0e93e9c..6f82d4f 100644
--- a/src/EpisodeActionList_p.h
+++ b/src/EpisodeActionList_p.h
@@ -50,7 +50,7 @@ private:
bool parse( const QVariant& data );
bool parse( const QByteArray& data );
-private slots:
+private Q_SLOTS:
void parseData();
void error( QNetworkReply::NetworkError error );
diff --git a/src/EpisodeList.h b/src/EpisodeList.h
index b75e33d..bddbf8e 100644
--- a/src/EpisodeList.h
+++ b/src/EpisodeList.h
@@ -49,7 +49,7 @@ public:
private:
EpisodeListPrivate* const d;
friend class EpisodeListPrivate;
-signals:
+Q_SIGNALS:
/**Gets emitted when the data is ready to read*/
void finished();
/**Gets emitted when an parse error ocurred*/
diff --git a/src/EpisodeList_p.h b/src/EpisodeList_p.h
index f8153ee..5442702 100644
--- a/src/EpisodeList_p.h
+++ b/src/EpisodeList_p.h
@@ -46,7 +46,7 @@ private:
bool parse( const QVariant& data );
bool parse( const QByteArray& data );
-private slots:
+private Q_SLOTS:
void parseData();
void error( QNetworkReply::NetworkError error );
diff --git a/src/Episode_p.h b/src/Episode_p.h
index 2b84f78..e8c2359 100644
--- a/src/Episode_p.h
+++ b/src/Episode_p.h
@@ -60,7 +60,7 @@ private:
QNetworkReply::NetworkError m_error;
bool parse ( const QVariant& data );
bool parse ( const QByteArray& data );
-private slots:
+private Q_SLOTS:
void parseData();
void error ( QNetworkReply::NetworkError error );
diff --git a/src/Podcast.h b/src/Podcast.h
index 9905c9a..b5889cf 100644
--- a/src/Podcast.h
+++ b/src/Podcast.h
@@ -66,7 +66,7 @@ private:
PodcastPrivate* const d;
friend class PodcastPrivate;
bool m_copy; //true if this object was created by the copy-ctor
-signals:
+Q_SIGNALS:
/**Gets emitted when the data is ready to read*/
void finished();
/**Gets emitted when an parse error ocurred*/
diff --git a/src/PodcastList.h b/src/PodcastList.h
index e650736..38e956c 100644
--- a/src/PodcastList.h
+++ b/src/PodcastList.h
@@ -50,7 +50,7 @@ private:
PodcastListPrivate* const d;
friend class PodcastListPrivate;
-signals:
+Q_SIGNALS:
/**Gets emitted when the data is ready to read*/
void finished();
/**Gets emitted when an parse error ocurred*/
diff --git a/src/PodcastList_p.h b/src/PodcastList_p.h
index 07706c1..9647c3f 100644
--- a/src/PodcastList_p.h
+++ b/src/PodcastList_p.h
@@ -45,7 +45,7 @@ private:
bool parse( const QVariant& data );
bool parse( const QByteArray& data );
-private slots:
+private Q_SLOTS:
void parseData();
void error( QNetworkReply::NetworkError error );
};
diff --git a/src/Podcast_p.h b/src/Podcast_p.h
index 83cbed9..025f7eb 100644
--- a/src/Podcast_p.h
+++ b/src/Podcast_p.h
@@ -61,7 +61,7 @@ private:
bool parse( const QVariant& data );
bool parse( const QByteArray& data );
-private slots:
+private Q_SLOTS:
void parseData();
void error( QNetworkReply::NetworkError error );
};
diff --git a/src/Settings.h b/src/Settings.h
index 0c8c2fd..34acdaf 100644
--- a/src/Settings.h
+++ b/src/Settings.h
@@ -50,7 +50,7 @@ private:
Q_DISABLE_COPY( Settings )
SettingsPrivate* d;
friend class SettingsPrivate;
-signals:
+Q_SIGNALS:
/**Gets emitted when the data is ready to read*/
void finished();
/**Gets emitted when an parse error ocurred*/
diff --git a/src/Settings_p.h b/src/Settings_p.h
index 8de1b76..df26cc2 100644
--- a/src/Settings_p.h
+++ b/src/Settings_p.h
@@ -47,7 +47,7 @@ private:
bool parse( const QVariant& data );
bool parse( const QByteArray& data );
-private slots:
+private Q_SLOTS:
void parseData();
void error( QNetworkReply::NetworkError error );
diff --git a/src/TagList.h b/src/TagList.h
index f641307..8847f14 100644
--- a/src/TagList.h
+++ b/src/TagList.h
@@ -48,7 +48,7 @@ private:
Q_DISABLE_COPY( TagList )
TagListPrivate* const d;
friend class TagListPrivate;
-signals:
+Q_SIGNALS:
/**Gets emitted when the data is ready to read*/
void finished();
/**Gets emitted when an parse error ocurred*/
diff --git a/src/TagList_p.h b/src/TagList_p.h
index 5320241..0f01f2b 100644
--- a/src/TagList_p.h
+++ b/src/TagList_p.h
@@ -46,7 +46,7 @@ private:
bool parse( const QVariant& data );
bool parse( const QByteArray& data );
-private slots:
+private Q_SLOTS:
void parseData();
void error( QNetworkReply::NetworkError error );
};
diff --git a/tests/JsonCreatorTest.h b/tests/JsonCreatorTest.h
index 0f49f5c..eed2117 100644
--- a/tests/JsonCreatorTest.h
+++ b/tests/JsonCreatorTest.h
@@ -36,7 +36,7 @@ class JsonCreatorTest : public QObject {
public:
JsonCreatorTest();
virtual ~JsonCreatorTest();
-private slots:
+private Q_SLOTS:
void initTestCase();
void cleanupTestCase();
void init();
diff --git a/tests/UrlBuilderTest.h b/tests/UrlBuilderTest.h
index 91fd9d0..cbcf7cd 100644
--- a/tests/UrlBuilderTest.h
+++ b/tests/UrlBuilderTest.h
@@ -36,7 +36,7 @@ class UrlBuilderTest : public QObject {
public:
UrlBuilderTest();
virtual ~UrlBuilderTest();
-private slots:
+private Q_SLOTS:
void initTestCase();
void cleanupTestCase();
void init();
--
2.47.0

View File

@ -0,0 +1,23 @@
From 643562dd72e0ecbaddaf1700da84c5f037ca817d Mon Sep 17 00:00:00 2001
From: Tuomas Nurmi <tuomas@norsumanageri.org>
Date: Mon, 8 Jul 2024 16:44:03 +0300
Subject: [PATCH 10/10] Bump minimum CMake version to avoid a warning during
configuration
---
CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1a8c8e3..8a79ddc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required( VERSION 3.0 FATAL_ERROR )
+cmake_minimum_required( VERSION 3.5 FATAL_ERROR )
project( libmygpo-qt )
--
2.47.0

View File

@ -1,34 +1,35 @@
%bcond_without qt5
%bcond_without qt6
# TODO: upstream qt4 support is deprecated, conditionalize qt4 support
# in hopes of removing in soonish
%if 0%{?rhel} <= 7
%global qt4 1
%endif
%undefine __cmake_in_source_build
Name: libmygpo-qt
Summary: Qt4 Library that wraps the gpodder.net Web API
Summary: Qt Library that wraps the gpodder.net Web API
Version: 1.1.0
Release: 3%{?dist}
Release: 4%{?dist}
License: LGPLv2+
#Url: http://wiki.gpodder.org/wiki/Libmygpo-qt
URL: https://github.com/gpodder/libmygpo-qt/
Source0: https://github.com/gpodder/libmygpo-qt/archive/%{version}/%{name}-%{version}.tar.gz
Patch1: 0001-Add-missing-Qt5Network-Qt5Test-make-BUILD_WITH_QT4-m.patch
Patch2: 0002-Fix-build-with-Qt-5.11_beta3-dropping-qt5_use_module.patch
Patch3: 0003-Move-MYGPO_BUILD_TESTS-option.patch
Patch4: 0004-Update-the-minimum-required-cmake-version-to-3.0.patch
Patch5: 0005-Fix-parsing-of-timestamp-for-EpisodeAction.patch
Patch6: 0006-Fix-timestamp-sent-to-gpodder.net-to-correspond-to-U.patch
Patch7: 0007-Fix-removeList-of-DeviceUpdates.patch
Patch8: 0008-Use-c-c-library-defined-ULLONG_MAX-instead-of-manual.patch
Patch9: 0009-Update-signals-and-slots-to-use-Q_SIGNALS-and-Q_SLOT.patch
Patch10: 0010-Bump-minimum-CMake-version-to-avoid-a-warning-during.patch
# https://github.com/gpodder/libmygpo-qt/pull/23
Patch20: 0001-Minimal-changes-to-make-Qt6-compilation-possible.patch
BuildRequires: clang >= 19.0
BuildRequires: cmake
BuildRequires: doxygen
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Network)
%if 0%{?qt4}
BuildRequires: automoc4
BuildRequires: pkgconfig(QJson)
BuildRequires: pkgconfig(QtCore)
BuildRequires: pkgconfig(QtNetwork)
BuildRequires: pkgconfig(QtTest)
%endif
%description
libmygpo-qt is a Qt4 Library that wraps the gpodder.net Web API,
@ -40,8 +41,13 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
%{summary}.
%if %{with qt5}
%package -n libmygpo-qt5
Summary: Qt5 Library that wraps the gpodder.net Web API
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Gui)
BuildRequires: pkgconfig(Qt5Network)
%description -n libmygpo-qt5
libmygpo-qt5 is a Qt5 Library that wraps the gpodder.net Web API,
http://wiki.gpodder.org/wiki/Web_Services/API_2
@ -51,72 +57,86 @@ Summary: Development files for libmygpo-qt5
Requires: libmygpo-qt5%{?_isa} = %{version}-%{release}
%description -n libmygpo-qt5-devel
%{summary}.
%endif
%if %{with qt5}
%package -n libmygpo-qt6
Summary: Qt6 Library that wraps the gpodder.net Web API
BuildRequires: pkgconfig(Qt6Core)
BuildRequires: pkgconfig(Qt6Gui)
BuildRequires: pkgconfig(Qt6Network)
%description -n libmygpo-qt6
libmygpo-qt6 is a Qt6 Library that wraps the gpodder.net Web API,
http://wiki.gpodder.org/wiki/Web_Services/API_2
%package -n libmygpo-qt6-devel
Summary: Development files for libmygpo-qt6
Requires: libmygpo-qt6%{?_isa} = %{version}-%{release}
%description -n libmygpo-qt6-devel
%{summary}.
%endif
%prep
%autosetup -p1
%build
%if 0%{?qt4}
%global _vpath_builddir %{_target_platform}
%{cmake} \
-DBUILD_WITH_QT4:BOOL=ON \
-DINCLUDE_INSTALL_DIR:PATH=%{_qt4_headerdir}/mygpo-qt \
-DLIB_INSTALL_DIR:PATH=%{_qt4_libdir}/mygpo-qt
%cmake_build
%endif
export CC=clang
export CXX=clang++
%if %{with qt5}
%global _vpath_builddir %{_target_platform}-qt5
%{cmake} \
-DBUILD_WITH_QT4:BOOL=OFF \
-DBUILD_WITH_QT6:BOOL=OFF \
-DINCLUDE_INSTALL_DIR:PATH=%{_qt5_headerdir}/mygpo-qt \
-DLIB_INSTALL_DIR:PATH=%{_qt5_libdir}/mygpo-qt
%cmake_build
%endif
%if %{with qt6}
%global _vpath_builddir %{_target_platform}-qt6
%{cmake} \
-DBUILD_WITH_QT6:BOOL=ON \
-DINCLUDE_INSTALL_DIR:PATH=%{_qt6_headerdir}/mygpo-qt \
-DLIB_INSTALL_DIR:PATH=%{_qt6_libdir}/mygpo-qt
%cmake_build
%endif
%install
%if 0%{?qt4}
%global _vpath_builddir %{_target_platform}
%cmake_install
%endif
%if %{with qt5}
%global _vpath_builddir %{_target_platform}-qt5
%cmake_install
%endif
%if %{with qt6}
%global _vpath_builddir %{_target_platform}-qt6
%cmake_install
%endif
%check
%if 0%{?qt4}
export PKG_CONFIG_PATH=%{buildroot}%{_qt4_libdir}/pkgconfig
test "$(pkg-config --modversion libmygpo-qt)" = "%{version}"
export CTEST_OUTPUT_ON_FAILURE=1
# test 2 currently fails on i686, poke upstream -- rex
make test -C %{_target_platform} ||:
%endif
%if %{with qt5}
export PKG_CONFIG_PATH=%{buildroot}%{_qt5_libdir}/pkgconfig
test "$(pkg-config --modversion libmygpo-qt5)" = "%{version}"
export CTEST_OUTPUT_ON_FAILURE=1
# test 2 currently fails on i686, poke upstream -- rex
make test -C %{_target_platform}-qt5 ||:
%if 0%{?qt4}
%ldconfig_scriptlets
%files
%doc AUTHORS LICENSE README
%{_qt4_libdir}/libmygpo-qt.so.1*
%files devel
%{_qt4_headerdir}/mygpo-qt/
%{_qt4_libdir}/libmygpo-qt.so
%{_qt4_libdir}/pkgconfig/libmygpo-qt.pc
%{_qt4_libdir}/cmake/mygpo-qt/
%endif
%if %{with qt6}
export PKG_CONFIG_PATH=%{buildroot}%{_qt6_libdir}/pkgconfig
test "$(pkg-config --modversion libmygpo-qt6)" = "%{version}"
export CTEST_OUTPUT_ON_FAILURE=1
# test 2 currently fails on i686, poke upstream -- rex
make test -C %{_target_platform}-qt6 ||:
%endif
%if %{with qt5}
%ldconfig_scriptlets -n libmygpo-qt5
%files -n libmygpo-qt5
@ -128,9 +148,27 @@ make test -C %{_target_platform}-qt5 ||:
%{_qt5_libdir}/libmygpo-qt5.so
%{_qt5_libdir}/pkgconfig/libmygpo-qt5.pc
%{_qt5_libdir}/cmake/mygpo-qt5/
%endif
%if %{with qt6}
%ldconfig_scriptlets -n libmygpo-qt6
%files -n libmygpo-qt6
%doc AUTHORS LICENSE README
%{_qt6_libdir}/libmygpo-qt6.so.1*
%files -n libmygpo-qt6-devel
%{_qt6_headerdir}/mygpo-qt/
%{_qt6_libdir}/libmygpo-qt6.so
%{_qt6_libdir}/pkgconfig/libmygpo-qt6.pc
%{_qt6_libdir}/cmake/mygpo-qt6/
%endif
%changelog
* Mon Jan 13 2025 Raven <raven@sysadmins.ws> - 1.1.0-4
- drop qt4 support
- build with qt6
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild