diff -Nru libkcddb-15.12.3/cmake/FindMusicBrainz5.cmake libkcddb-16.12.1/cmake/FindMusicBrainz5.cmake --- libkcddb-15.12.3/cmake/FindMusicBrainz5.cmake 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/cmake/FindMusicBrainz5.cmake 2016-12-12 00:51:42.000000000 +0000 @@ -10,23 +10,24 @@ # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. -if(MUSICBRAINZ5_INCLUDE_DIRS AND MUSICBRAINZ5_LIBRARIES) - set(MUSICBRAINZ5_FIND_QUIETLY TRUE) -endif(MUSICBRAINZ5_INCLUDE_DIRS AND MUSICBRAINZ5_LIBRARIES) - -IF (NOT WIN32) - # use pkg-config to get the directories and then use these values - # in the FIND_PATH() and FIND_LIBRARY() calls - find_package(PkgConfig) - PKG_SEARCH_MODULE( MUSICBRAINZ5 libmusicbrainz5 ) -ELSE (NOT WIN32) - FIND_PATH( MUSICBRAINZ5_INCLUDE_DIRS musicbrainz5/Disc.h ) - FIND_LIBRARY( MUSICBRAINZ5_LIBRARIES NAMES musicbrainz5 ) -ENDIF (NOT WIN32) +if(MUSICBRAINZ5_INCLUDE_DIR AND MUSICBRAINZ5_LIBRARIES) + set(MUSICBRAINZ5_FIND_QUIETLY TRUE) +endif() + +find_path(MUSICBRAINZ5_INCLUDE_DIR musicbrainz5/Disc.h) + +find_library(MUSICBRAINZ5_LIBRARIES NAMES musicbrainz5cc) +if (NOT MUSICBRAINZ5_LIBRARIES) + find_library(MUSICBRAINZ5_LIBRARIES NAMES musicbrainz5) +endif() include(FindPackageHandleStandardArgs) -find_package_handle_standard_args( MusicBrainz5 DEFAULT_MSG - MUSICBRAINZ5_INCLUDE_DIRS MUSICBRAINZ5_LIBRARIES) +find_package_handle_standard_args(MusicBrainz5 DEFAULT_MSG MUSICBRAINZ5_INCLUDE_DIR MUSICBRAINZ5_LIBRARIES) -MARK_AS_ADVANCED(MUSICBRAINZ5_INCLUDE_DIRS MUSICBRAINZ5_LIBRARIES) +add_library(musicbrainz SHARED IMPORTED) +set_target_properties(musicbrainz PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${MUSICBRAINZ5_INCLUDE_DIR}" + IMPORTED_LOCATION "${MUSICBRAINZ5_LIBRARIES}" +) +mark_as_advanced(MUSICBRAINZ5_INCLUDE_DIR MUSICBRAINZ5_LIBRARIES) diff -Nru libkcddb-15.12.3/CMakeLists.txt libkcddb-16.12.1/CMakeLists.txt --- libkcddb-15.12.3/CMakeLists.txt 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/CMakeLists.txt 2016-12-12 00:51:42.000000000 +0000 @@ -1,41 +1,88 @@ project(libkcddb) -set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) +cmake_minimum_required(VERSION 2.8.12) -find_package(KDE4 REQUIRED) -include(KDE4Defaults) -include(MacroLibrary) -include_directories(${KDE4_INCLUDES}) -include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) - -macro_optional_find_package(MusicBrainz5) -macro_log_feature(MUSICBRAINZ5_FOUND "MusicBrainz5" "A library that provides access to metadata lookup on the MusicBrainz server" "http://www.musicbrainz.org" FALSE "" "Music metadata lookup for KDE multimedia applications through libkcddb. You need version 5.x of libmusicbrainz") +# ECM setup +include(FeatureSummary) +find_package(ECM 5.24.0 NO_MODULE) +set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules") +set(CMAKE_MODULE_PATH "${ECM_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + +include(KDEInstallDirs) +include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) +include(KDECMakeSettings) +include(GenerateExportHeader) +include(ECMSetupVersion) +include(ECMPackageConfigHelpers) +include(ECMGenerateHeaders) + +set(PROJECT_VERSION "16.08.0") +set(KF5_DEP_VERSION "5.24.0") # handled by release scripts +set(REQUIRED_QT_VERSION 5.4.0) + +find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Network Widgets) +find_package(KF5 ${KF5_DEP_VERSION} REQUIRED COMPONENTS Config DocTools Codecs I18n KIO WidgetsAddons) + +ecm_setup_version("5.0.0" + VARIABLE_PREFIX KCDDB + VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kcddb_version.h" + PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5CddbConfigVersion.cmake" + SOVERSION 5 +) + +find_package(MusicBrainz5) +set_package_properties(MusicBrainz5 PROPERTIES + DESCRIPTION "Music metadata lookup for KDE multimedia applications through libkcddb. You need version 5.x of libmusicbrainz" + URL "http://www.musicbrainz.org" + TYPE OPTIONAL + PURPOSE "A library that provides access to metadata lookup on the MusicBrainz server") if(MUSICBRAINZ5_FOUND) set(HAVE_MUSICBRAINZ5 1) - include_directories(${MUSICBRAINZ5_INCLUDE_DIRS}) - - set(libmusicbrainz_SRCS ${libmusicbrainz_SRCS} - musicbrainz/musicbrainzlookup.cpp - musicbrainz/asyncmusicbrainzlookup.cpp) - - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}") -else(MUSICBRAINZ5_FOUND) +else() set(HAVE_MUSICBRAINZ5 0) - set(libmusicbrainz_SRCS) -endif(MUSICBRAINZ5_FOUND) +endif() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-musicbrainz.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-musicbrainz.h ) -add_subdirectory( test ) -add_subdirectory( kcmcddb ) -add_subdirectory( libkcddb ) - -# 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) -# This relative path will be configured into LibkcddbConfig.cmake -file(RELATIVE_PATH relInstallDir ${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/cmake/libkcddb ${CMAKE_INSTALL_PREFIX}) - -configure_file(LibkcddbConfig.cmake.in ${CMAKE_BINARY_DIR}/LibkcddbConfig.cmake @ONLY) -install(FILES ${CMAKE_BINARY_DIR}/LibkcddbConfig.cmake DESTINATION ${LIB_INSTALL_DIR}/cmake/libkcddb) -install(EXPORT LibkcddbTargets DESTINATION ${LIB_INSTALL_DIR}/cmake/libkcddb/ FILE LibkcddbTargets.cmake NAMESPACE KDE::Libkcddb::) +include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) + +add_subdirectory(kcmcddb) +add_subdirectory(libkcddb) + +option(BUILD_TESTING "Build test" OFF) +if(BUILD_TESTING) + find_package(Qt5Test REQUIRED) + add_subdirectory(tests) +endif() + +feature_summary(WHAT PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) + +set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KF5Cddb") +ecm_configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/KF5CddbConfig.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/KF5CddbConfig.cmake" + INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} +) + +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/KF5CddbConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/KF5CddbConfigVersion.cmake" + DESTINATION "${CMAKECONFIG_INSTALL_DIR}" + COMPONENT Devel +) + +install(EXPORT + KF5CddbTargets + DESTINATION "${CMAKECONFIG_INSTALL_DIR}" + FILE KF5CddbTargets.cmake + NAMESPACE KF5:: + COMPONENT Devel +) + +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/kcddb_version.h" + DESTINATION "${KF5_INCLUDE_INSTALL_DIR}" + COMPONENT Devel +) + +feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff -Nru libkcddb-15.12.3/debian/changelog libkcddb-16.12.1/debian/changelog --- libkcddb-15.12.3/debian/changelog 2016-04-14 23:15:53.000000000 +0000 +++ libkcddb-16.12.1/debian/changelog 2017-01-19 16:14:42.000000000 +0000 @@ -1,3 +1,51 @@ +libkcddb (4:16.12.1-0ubuntu1) zesty; urgency=medium + + [ José Manuel Santamaría Lema ] + * Update Vcs-Git fields to use https:// instead of git:// + * Update build depends for KDE Frameworks: + - add extra-cmake-modules, qtbase5-dev, libkf5codecs-dev, libkf5config-dev, + libkf5coreaddons-dev, libkf5i18n-dev, kdoctools-dev, kio-dev, + libkf5widgetsaddons-dev + - remove kde-sc-dev-latest, kdelibs5-dev + * Replace libmusicbrainz5cc.patch with a modern version. + * Rename libkcddb4 as libkf5cddb16 due to soname change. + * Use .../3/debian-qt-kde.mk (meant to be used with Frameworks based + packages) in debian/rules instead of the version 2 (meant to be used + by kdelibs 4 based packages) + * Rename libkcddb-dev as libkf5cddb-dev and update installed files. + * Update kde-config-cddb installed files. + * Drop obsolete kde-config-cddb Breaks/Replaces. + * Add libkf5cddbwidgets16 package. + + [ Clive Johnston ] + * Downgrade libs from 16 to 5 + + [ Rik Mills ] + * New upstream release (16.12.0) + * Update build deps to use new KF5 style names + * New upstream release (16.12.1) + + -- Rik Mills Thu, 19 Jan 2017 16:14:42 +0000 + +libkcddb (4:16.04.3-0ubuntu1) yakkety; urgency=medium + + [ Scarlett Clark ] + * New upstream release. + * Debian merge: No remaining changes. + + [ Philip Muškovac ] + * Update the Vcs URLs now that the repositories are hosted on + Launchpad + + [ Scarlett Clark ] + * New upstream bugfix release + + [ Clive Johnston ] + * New upstream release (16.04.2) + * New upstream release (16.04.3) + + -- José Manuel Santamaría Lema Fri, 30 Sep 2016 06:30:42 +0200 + libkcddb (4:15.12.3-0ubuntu1) xenial; urgency=medium * New upstream bugfix release @@ -5,6 +53,12 @@ -- Scarlett Clark Thu, 14 Apr 2016 16:15:53 -0700 +libkcddb (4:15.12.2-1) UNRELEASED; urgency=medium + + * New upstream release + + -- Rohan Garg Fri, 26 Feb 2016 22:26:16 +0100 + libkcddb (4:15.12.1-0ubuntu1) xenial; urgency=medium [ Clive Johnston ] diff -Nru libkcddb-15.12.3/debian/control libkcddb-16.12.1/debian/control --- libkcddb-15.12.3/debian/control 2016-04-14 23:15:53.000000000 +0000 +++ libkcddb-16.12.1/debian/control 2017-01-19 16:14:42.000000000 +0000 @@ -7,31 +7,47 @@ Maximiliano Curia Build-Depends: cmake, debhelper (>= 9), - kde-sc-dev-latest (>= 4:4.12), - kdelibs5-dev, + extra-cmake-modules (>= 5.28.0~), + libkf5codecs-dev (>= 5.28.0~), + libkf5config-dev (>= 5.28.0~), + libkf5coreaddons-dev (>= 5.28.0~), + libkf5doctools-dev (>= 5.28.0~), + libkf5i18n-dev (>= 5.28.0~), + libkf5kio-dev (>= 5.28.0~), + libkf5widgetsaddons-dev (>= 5.28.0~), libmusicbrainz5-dev (>= 5.1.0+git20150707~), - pkg-kde-tools (>= 0.12) -Standards-Version: 3.9.6 + pkg-kde-tools (>= 0.12), + qtbase5-dev (>= 5.6.1~) +Standards-Version: 3.9.8 Homepage: http://www.kde.org/ -Vcs-Browser: http://anonscm.debian.org/cgit/pkg-kde/applications/libkcddb.git -Vcs-Git: git://anonscm.debian.org/pkg-kde/applications/libkcddb.git +Vcs-Browser: https://code.launchpad.net/~kubuntu-packagers/kubuntu-packaging/+git/libkcddb +Vcs-Git: https://git.launchpad.net/~kubuntu-packagers/kubuntu-packaging/+git/libkcddb -Package: libkcddb4 +Package: libkf5cddb5 Section: libs Architecture: any -Depends: libkcompactdisc4, ${misc:Depends}, ${shlibs:Depends} +Depends: ${misc:Depends}, ${shlibs:Depends} +Description: CDDB library for KDE Platform (runtime) + The KDE Compact Disc DataBase library provides an API for applications using + the KDE Platform to fetch and submit audio CD information over the Internet. + . + This package is part of the KDE multimedia module. + +Package: libkf5cddbwidgets5 +Section: libs +Architecture: any +Depends: ${misc:Depends}, ${shlibs:Depends} Description: CDDB library for KDE Platform (runtime) The KDE Compact Disc DataBase library provides an API for applications using the KDE Platform to fetch and submit audio CD information over the Internet. . This package is part of the KDE multimedia module. -Package: libkcddb-dev +Package: libkf5cddb-dev Section: libdevel Architecture: any -Depends: kdelibs5-dev, - libkcddb4 (= ${binary:Version}), - libqt4-dev, +Depends: libkf5cddb5 (= ${binary:Version}), + libkf5cddbwidgets5 (= ${binary:Version}), ${misc:Depends} Description: CDDB library for KDE Platform (development) The KDE Compact Disc DataBase library provides an API for KDE applications @@ -42,8 +58,6 @@ Package: kde-config-cddb Architecture: any Depends: ${misc:Depends}, ${shlibs:Depends} -Replaces: libkcddb4 (<< 4:4.4.2) -Breaks: libkcddb4 (<< 4:4.4.2) Description: CDDB retrieval configuration This package contains a configuration module for tweaking CDDB retrieval settings for applications using the libkcddb library from the KDE Multimedia @@ -55,7 +69,7 @@ Section: debug Architecture: any Priority: extra -Depends: libkcddb4 (= ${binary:Version}), ${misc:Depends} +Depends: libkf5cddb5 (= ${binary:Version}), ${misc:Depends} Breaks: kdemultimedia-dbg Replaces: kdemultimedia-dbg Description: debugging symbols for libkcddb diff -Nru libkcddb-15.12.3/debian/kde-config-cddb.install libkcddb-16.12.1/debian/kde-config-cddb.install --- libkcddb-15.12.3/debian/kde-config-cddb.install 2016-04-14 23:15:53.000000000 +0000 +++ libkcddb-16.12.1/debian/kde-config-cddb.install 2017-01-19 16:14:42.000000000 +0000 @@ -1,9 +1,5 @@ -usr/lib/kde4/kcm_cddb.so -usr/share/doc/kde/HTML/en/kcontrol/cddbretrieval/common -usr/share/doc/kde/HTML/en/kcontrol/cddbretrieval/index.cache.bz2 -usr/share/doc/kde/HTML/en/kcontrol/cddbretrieval/index.docbook -usr/share/doc/kde/HTML/en/kcontrol/cddbretrieval/kscd13.png -usr/share/doc/kde/HTML/en/kcontrol/cddbretrieval/kscd14.png -usr/share/doc/kde/HTML/en/kcontrol/cddbretrieval/kscd16.png -usr/share/kde4/config.kcfg/libkcddb.kcfg -usr/share/kde4/services/libkcddb.desktop +usr/lib/*/qt5/plugins/kcm_cddb.so +usr/share/config.kcfg/libkcddb5.kcfg +usr/share/config.kcfg/libkcddb5.kcfg +usr/share/doc/HTML/en/kcontrol/cddbretrieval5/* +usr/share/kservices5/libkcddb.desktop diff -Nru libkcddb-15.12.3/debian/libkcddb4.acc libkcddb-16.12.1/debian/libkcddb4.acc --- libkcddb-15.12.3/debian/libkcddb4.acc 2016-04-14 23:15:53.000000000 +0000 +++ libkcddb-16.12.1/debian/libkcddb4.acc 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ - - - - - 4.11.3 - - - - /usr/include/libkcddb - - - - /usr/lib/libkcddb.so - - - diff -Nru libkcddb-15.12.3/debian/libkcddb4.install libkcddb-16.12.1/debian/libkcddb4.install --- libkcddb-15.12.3/debian/libkcddb4.install 2016-04-14 23:15:53.000000000 +0000 +++ libkcddb-16.12.1/debian/libkcddb4.install 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -usr/lib/libkcddb.so.4 -usr/lib/libkcddb.so.4.* diff -Nru libkcddb-15.12.3/debian/libkcddb4.symbols libkcddb-16.12.1/debian/libkcddb4.symbols --- libkcddb-15.12.3/debian/libkcddb4.symbols 2016-04-14 23:15:53.000000000 +0000 +++ libkcddb-16.12.1/debian/libkcddb4.symbols 1970-01-01 00:00:00.000000000 +0000 @@ -1,179 +0,0 @@ -# SymbolsHelper-Confirmed: 4:15.04.1 amd64 -libkcddb.so.4 libkcddb4 #MINVER# - _ZN10ConfigBase10setReplyToERK7QString@Base 4:4.3.4 - _ZN10ConfigBase11setHostnameERK7QString@Base 4:4.3.4 - _ZN10ConfigBase11setSmtpPortEi@Base 4:4.3.4 - _ZN10ConfigBase15setEmailAddressERK7QString@Base 4:4.3.4 - _ZN10ConfigBase15setSmtpHostnameERK7QString@Base 4:4.3.4 - _ZN10ConfigBase15setSmtpUsernameERK7QString@Base 4:4.3.4 - _ZN10ConfigBase16setSubmitAddressERK7QString@Base 4:4.3.4 - _ZN10ConfigBase17setCacheLocationsERK11QStringList@Base 4:4.3.4 - _ZN10ConfigBase17setHttpSubmitPortEi@Base 4:4.3.4 - _ZN10ConfigBase17setUseGlobalEmailEb@Base 4:4.3.4 - _ZN10ConfigBase19setHttpSubmitServerERK7QString@Base 4:4.3.4 - _ZN10ConfigBase21setCacheLookupEnabledEb@Base 4:4.3.4 - _ZN10ConfigBase22setFreedbLookupEnabledEb@Base 4:4.3.4 - _ZN10ConfigBase24setFreedbLookupTransportEi@Base 4:4.3.4 - _ZN10ConfigBase24setFreedbSubmitTransportEi@Base 4:4.3.4 - _ZN10ConfigBase27setMusicBrainzLookupEnabledEb@Base 4:4.3.4 - _ZN10ConfigBase7setPortEi@Base 4:4.3.4 - _ZN10ConfigBaseC1Ev@Base 4:4.3.4 - _ZN10ConfigBaseC2Ev@Base 4:4.3.4 - _ZN10ConfigBaseD0Ev@Base 4:4.3.4 - _ZN10ConfigBaseD1Ev@Base 4:4.3.4 - _ZN10ConfigBaseD2Ev@Base 4:4.3.4 - (optional=gccinternal)_ZN19KCoreConfigSkeleton8ItemEnum7Choice2D1Ev@Base 4:4.8.90 - (optional=gccinternal)_ZN19KCoreConfigSkeleton8ItemEnum7Choice2D2Ev@Base 4:4.8.90 - _ZN5KCDDB12CDInfoDialog10framesTimeEj@Base 4:4.3.4 - _ZN5KCDDB12CDInfoDialog11qt_metacallEN11QMetaObject4CallEiPPv@Base 4:4.3.4 - _ZN5KCDDB12CDInfoDialog11qt_metacastEPKc@Base 4:4.3.4 - _ZN5KCDDB12CDInfoDialog12genreChangedERK7QString@Base 4:4.3.4 - _ZN5KCDDB12CDInfoDialog13artistChangedERK7QString@Base 4:4.3.4 - _ZN5KCDDB12CDInfoDialog13slotNextTrackEv@Base 4:4.3.4 - _ZN5KCDDB12CDInfoDialog16staticMetaObjectE@Base 4:4.3.4 - _ZN5KCDDB12CDInfoDialog17slotTrackSelectedERK11QModelIndex@Base 4:4.5.1 - _ZN5KCDDB12CDInfoDialog18slotChangeEncodingEv@Base 4:4.3.4 - _ZN5KCDDB12CDInfoDialog19slotMultipleArtistsEb@Base 4:4.3.4 - _ZN5KCDDB12CDInfoDialog22slotTrackDoubleClickedERK11QModelIndex@Base 4:4.5.1 - _ZN5KCDDB12CDInfoDialog4playEi@Base 4:4.3.4 - _ZN5KCDDB12CDInfoDialog7Private9SEPARATORE@Base 4:4.3.4 - _ZN5KCDDB12CDInfoDialog7setInfoERKNS_6CDInfoERK5QListIjE@Base 4:4.3.4 - _ZN5KCDDB12CDInfoDialogC1EP7QWidget@Base 4:4.3.4 - _ZN5KCDDB12CDInfoDialogC2EP7QWidget@Base 4:4.3.4 - _ZN5KCDDB12CDInfoDialogD0Ev@Base 4:4.3.4 - _ZN5KCDDB12CDInfoDialogD1Ev@Base 4:4.3.4 - _ZN5KCDDB12CDInfoDialogD2Ev@Base 4:4.3.4 - _ZN5KCDDB14resultToStringENS_6ResultE@Base 4:4.3.4 - _ZN5KCDDB5Cache5storeERK5QListIjERKNS_6CDInfoERKNS_6ConfigE@Base 4:4.3.4 - _ZN5KCDDB5Cache5storeERK5QListIjERKS1_INS_6CDInfoEERKNS_6ConfigE@Base 4:4.3.4 - _ZN5KCDDB5Cache6lookupERK5QListIjERKNS_6ConfigE@Base 4:4.3.4 - _ZN5KCDDB5Sites8readDataERK10QByteArray@Base 4:4.3.4 - _ZN5KCDDB5Sites8siteListEv@Base 4:4.3.4 - _ZN5KCDDB5Sites9parseLineERK7QString@Base 4:4.3.4 - _ZN5KCDDB5SitesC1Ev@Base 4:4.3.4 - _ZN5KCDDB5SitesC2Ev@Base 4:4.3.4 - _ZN5KCDDB6CDInfo10checkTrackEi@Base 4:4.3.4 - _ZN5KCDDB6CDInfo3setENS_4TypeERK8QVariant@Base 4:4.3.4 - _ZN5KCDDB6CDInfo3setERK7QStringRK8QVariant@Base 4:4.3.4 - _ZN5KCDDB6CDInfo4loadERK11QStringList@Base 4:4.3.4 - _ZN5KCDDB6CDInfo4loadERK7QString@Base 4:4.3.4 - _ZN5KCDDB6CDInfo5clearEv@Base 4:4.3.4 - _ZN5KCDDB6CDInfo5trackEi@Base 4:4.3.4 - _ZN5KCDDB6CDInfoC1ERKS0_@Base 4:4.3.4 - _ZN5KCDDB6CDInfoC1Ev@Base 4:4.3.4 - _ZN5KCDDB6CDInfoC2ERKS0_@Base 4:4.3.4 - _ZN5KCDDB6CDInfoC2Ev@Base 4:4.3.4 - _ZN5KCDDB6CDInfoD0Ev@Base 4:4.3.4 - _ZN5KCDDB6CDInfoD1Ev@Base 4:4.3.4 - _ZN5KCDDB6CDInfoD2Ev@Base 4:4.3.4 - _ZN5KCDDB6CDInfoaSERKS0_@Base 4:4.3.4 - _ZN5KCDDB6Client11qt_metacallEN11QMetaObject4CallEiPPv@Base 4:4.3.4 - _ZN5KCDDB6Client11qt_metacastEPKc@Base 4:4.3.4 - _ZN5KCDDB6Client12slotFinishedENS_6ResultE@Base 4:4.3.4 - _ZN5KCDDB6Client15setBlockingModeEb@Base 4:4.3.4 - _ZN5KCDDB6Client16staticMetaObjectE@Base 4:4.3.4 - _ZN5KCDDB6Client17runPendingLookupsEv@Base 4:4.3.4 - _ZN5KCDDB6Client18slotSubmitFinishedENS_6ResultE@Base 4:4.3.4 - _ZN5KCDDB6Client5storeERKNS_6CDInfoERK5QListIjE@Base 4:4.3.4 - _ZN5KCDDB6Client6lookupERK5QListIjE@Base 4:4.3.4 - _ZN5KCDDB6Client6submitERKNS_6CDInfoERK5QListIjE@Base 4:4.3.4 - _ZN5KCDDB6Client8finishedENS_6ResultE@Base 4:4.3.4 - _ZN5KCDDB6ClientC1Ev@Base 4:4.3.4 - _ZN5KCDDB6ClientC2Ev@Base 4:4.3.4 - _ZN5KCDDB6ClientD0Ev@Base 4:4.3.4 - _ZN5KCDDB6ClientD1Ev@Base 4:4.3.4 - _ZN5KCDDB6ClientD2Ev@Base 4:4.3.4 - _ZN5KCDDB6Config17loadEmailSettingsEv@Base 4:4.3.4 - _ZN5KCDDB6Config7reparseEv@Base 4:4.3.4 - _ZN5KCDDB6ConfigC1Ev@Base 4:4.3.4 - _ZN5KCDDB6ConfigC2Ev@Base 4:4.3.4 - (optional=gccinternal)_ZN5KCDDB6ConfigD0Ev@Base 4:4.6.5 - (optional=gccinternal)_ZN5KCDDB6ConfigD1Ev@Base 4:4.6.5 - (optional=gccinternal)_ZN5KCDDB6ConfigD2Ev@Base 4:4.6.5 - _ZN5KCDDB6GenresC1ERKS0_@Base 4:4.3.4 - _ZN5KCDDB6GenresC1Ev@Base 4:4.3.4 - _ZN5KCDDB6GenresC2ERKS0_@Base 4:4.3.4 - _ZN5KCDDB6GenresC2Ev@Base 4:4.3.4 - _ZN5KCDDB6GenresD1Ev@Base 4:4.3.4 - _ZN5KCDDB6GenresD2Ev@Base 4:4.3.4 - _ZN5KCDDB6GenresaSERKS0_@Base 4:4.3.4 - _ZN5KCDDB9TrackInfo3setENS_4TypeERK8QVariant@Base 4:4.3.4 - _ZN5KCDDB9TrackInfo3setERK7QStringRK8QVariant@Base 4:4.3.4 - _ZN5KCDDB9TrackInfo5clearEv@Base 4:4.3.4 - _ZN5KCDDB9TrackInfoC1ERKS0_@Base 4:4.3.4 - _ZN5KCDDB9TrackInfoC1Ev@Base 4:4.3.4 - _ZN5KCDDB9TrackInfoC2ERKS0_@Base 4:4.3.4 - _ZN5KCDDB9TrackInfoC2Ev@Base 4:4.3.4 - _ZN5KCDDB9TrackInfoD0Ev@Base 4:4.3.4 - _ZN5KCDDB9TrackInfoD1Ev@Base 4:4.3.4 - _ZN5KCDDB9TrackInfoD2Ev@Base 4:4.3.4 - _ZN5KCDDB9TrackInfoaSERKS0_@Base 4:4.3.4 - _ZNK10ConfigBase12emailAddressEv@Base 4:4.3.4 - _ZNK10ConfigBase12smtpHostnameEv@Base 4:4.3.4 - _ZNK10ConfigBase12smtpUsernameEv@Base 4:4.3.4 - _ZNK10ConfigBase13submitAddressEv@Base 4:4.3.4 - _ZNK10ConfigBase14cacheLocationsEv@Base 4:4.3.4 - _ZNK10ConfigBase14httpSubmitPortEv@Base 4:4.3.4 - _ZNK10ConfigBase14useGlobalEmailEv@Base 4:4.3.4 - _ZNK10ConfigBase16httpSubmitServerEv@Base 4:4.3.4 - _ZNK10ConfigBase18cacheLookupEnabledEv@Base 4:4.3.4 - _ZNK10ConfigBase19freedbLookupEnabledEv@Base 4:4.3.4 - _ZNK10ConfigBase21freedbLookupTransportEv@Base 4:4.3.4 - _ZNK10ConfigBase21freedbSubmitTransportEv@Base 4:4.3.4 - _ZNK10ConfigBase24musicBrainzLookupEnabledEv@Base 4:4.3.4 - _ZNK10ConfigBase4portEv@Base 4:4.3.4 - _ZNK10ConfigBase7replyToEv@Base 4:4.3.4 - _ZNK10ConfigBase8hostnameEv@Base 4:4.3.4 - _ZNK10ConfigBase8smtpPortEv@Base 4:4.3.4 - _ZNK5KCDDB12CDInfoDialog10metaObjectEv@Base 4:4.3.4 - _ZNK5KCDDB12CDInfoDialog4infoEv@Base 4:4.3.4 - _ZNK5KCDDB6CDInfo14numberOfTracksEv@Base 4:4.3.4 - _ZNK5KCDDB6CDInfo3getENS_4TypeE@Base 4:4.3.4 - _ZNK5KCDDB6CDInfo3getERK7QString@Base 4:4.3.4 - _ZNK5KCDDB6CDInfo5trackEi@Base 4:4.3.4 - _ZNK5KCDDB6CDInfo7isValidEv@Base 4:4.3.4 - _ZNK5KCDDB6CDInfo8toStringEb@Base 4:4.3.4 - _ZNK5KCDDB6CDInfoeqERKS0_@Base 4:4.3.4 - _ZNK5KCDDB6CDInfoneERKS0_@Base 4:4.3.4 - _ZNK5KCDDB6Client10metaObjectEv@Base 4:4.3.4 - _ZNK5KCDDB6Client12blockingModeEv@Base 4:4.3.4 - _ZNK5KCDDB6Client14lookupResponseEv@Base 4:4.3.4 - _ZNK5KCDDB6Client6configEv@Base 4:4.3.4 - _ZNK5KCDDB6Genres8cddbListEv@Base 4:4.3.4 - _ZNK5KCDDB6Genres8i18nListEv@Base 4:4.3.4 - _ZNK5KCDDB6Genres9cddb2i18nERK7QString@Base 4:4.3.4 - _ZNK5KCDDB6Genres9i18n2cddbERK7QString@Base 4:4.3.4 - _ZNK5KCDDB9TrackInfo3getENS_4TypeE@Base 4:4.3.4 - _ZNK5KCDDB9TrackInfo3getERK7QString@Base 4:4.3.4 - _ZNK5KCDDB9TrackInfo8toStringEv@Base 4:4.3.4 - _ZNK5KCDDB9TrackInfoeqERKS0_@Base 4:4.3.4 - _ZNK5KCDDB9TrackInfoneERKS0_@Base 4:4.3.4 - (optional=templinst)_ZNSt4pairIKSsSsED1Ev@Base 4:4.8.90 - (optional=templinst)_ZNSt4pairIKSsSsED2Ev@Base 4:4.8.90 - (optional=templinst)_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_S5_ESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE24_M_get_insert_unique_posERS7_@Base 4:15.04.1 - (optional=templinst)_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_S5_ESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE29_M_get_insert_hint_unique_posESt23_Rb_tree_const_iteratorIS8_ERS7_@Base 4:15.04.1 - (optional=templinst)_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_S5_ESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE8_M_eraseEPSt13_Rb_tree_nodeIS8_E@Base 4:15.04.1 - (optional=templinst)_ZNSt8_Rb_treeISsSt4pairIKSsSsESt10_Select1stIS2_ESt4lessISsESaIS2_EE10_M_insert_EPSt18_Rb_tree_node_baseSA_RKS2_@Base 4:4.10.90 - (optional=templinst|arch=alpha armel armhf hurd-i386 i386 kfreebsd-i386 mips mipsel powerpc ppc64 s390x sparc)_ZNSt8_Rb_treeISsSt4pairIKSsSsESt10_Select1stIS2_ESt4lessISsESaIS2_EE17_M_insert_unique_ESt23_Rb_tree_const_iteratorIS2_ERKS2_@Base 4:4.10.90 - (optional=templinst)_ZNSt8_Rb_treeISsSt4pairIKSsSsESt10_Select1stIS2_ESt4lessISsESaIS2_EE24_M_get_insert_unique_posERS1_@Base 4:4.10.3 - (optional=templinst|arch=amd64 arm64 hppa kfreebsd-amd64 ppc64el x32)_ZNSt8_Rb_treeISsSt4pairIKSsSsESt10_Select1stIS2_ESt4lessISsESaIS2_EE29_M_get_insert_hint_unique_posESt23_Rb_tree_const_iteratorIS2_ERS1_@Base 4:4.10.90 - (optional=templinst)_ZNSt8_Rb_treeISsSt4pairIKSsSsESt10_Select1stIS2_ESt4lessISsESaIS2_EE8_M_eraseEPSt13_Rb_tree_nodeIS2_E@Base 4:4.8.90 - _ZTI10ConfigBase@Base 4:4.3.4 - _ZTIN5KCDDB12CDInfoDialogE@Base 4:4.3.4 - _ZTIN5KCDDB6CDInfoE@Base 4:4.3.4 - _ZTIN5KCDDB6ClientE@Base 4:4.3.4 - _ZTIN5KCDDB6ConfigE@Base 4:4.3.4 - _ZTIN5KCDDB9TrackInfoE@Base 4:4.3.4 - _ZTS10ConfigBase@Base 4:4.3.4 - _ZTSN5KCDDB12CDInfoDialogE@Base 4:4.3.4 - _ZTSN5KCDDB6CDInfoE@Base 4:4.3.4 - _ZTSN5KCDDB6ClientE@Base 4:4.3.4 - _ZTSN5KCDDB6ConfigE@Base 4:4.3.4 - _ZTSN5KCDDB9TrackInfoE@Base 4:4.3.4 - _ZTV10ConfigBase@Base 4:4.3.4 - _ZTVN5KCDDB12CDInfoDialogE@Base 4:4.3.4 - _ZTVN5KCDDB6CDInfoE@Base 4:4.3.4 - _ZTVN5KCDDB6ClientE@Base 4:4.3.4 - _ZTVN5KCDDB6ConfigE@Base 4:4.3.4 - _ZTVN5KCDDB9TrackInfoE@Base 4:4.3.4 - (c++)"non-virtual thunk to KCDDB::CDInfoDialog::~CDInfoDialog()@Base" 4:4.3.4 diff -Nru libkcddb-15.12.3/debian/libkcddb-dev.install libkcddb-16.12.1/debian/libkcddb-dev.install --- libkcddb-15.12.3/debian/libkcddb-dev.install 2016-04-14 23:15:53.000000000 +0000 +++ libkcddb-16.12.1/debian/libkcddb-dev.install 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -usr/include/libkcddb/cdinfo.h -usr/include/libkcddb/cdinfodialog.h -usr/include/libkcddb/client.h -usr/include/libkcddb/configbase.h -usr/include/libkcddb/genres.h -usr/include/libkcddb/kcddb.h -usr/include/libkcddb/kcddb_export.h -usr/include/libkcddb/kcddbconfig.h -usr/lib/cmake/libkcddb/LibkcddbConfig.cmake -usr/lib/cmake/libkcddb/LibkcddbTargets-debian.cmake -usr/lib/cmake/libkcddb/LibkcddbTargets.cmake -usr/lib/libkcddb.so diff -Nru libkcddb-15.12.3/debian/libkf5cddb5.install libkcddb-16.12.1/debian/libkf5cddb5.install --- libkcddb-15.12.3/debian/libkf5cddb5.install 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/debian/libkf5cddb5.install 2017-01-19 16:14:42.000000000 +0000 @@ -0,0 +1,2 @@ +usr/lib/*/libKF5Cddb.so.5 +usr/lib/*/libKF5Cddb.so.5.* diff -Nru libkcddb-15.12.3/debian/libkf5cddb-dev.install libkcddb-16.12.1/debian/libkf5cddb-dev.install --- libkcddb-15.12.3/debian/libkf5cddb-dev.install 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/debian/libkf5cddb-dev.install 2017-01-19 16:14:42.000000000 +0000 @@ -0,0 +1,9 @@ +usr/include/KF5/KCddb/ +usr/include/KF5/kcddb_version.h +usr/lib/*/cmake/KF5Cddb/KF5CddbConfig.cmake +usr/lib/*/cmake/KF5Cddb/KF5CddbConfigVersion.cmake +usr/lib/*/cmake/KF5Cddb/KF5CddbTargets-debian.cmake +usr/lib/*/cmake/KF5Cddb/KF5CddbTargets.cmake +usr/lib/*/libKF5Cddb.so +usr/lib/*/libKF5CddbWidgets.so +usr/lib/*/qt5/mkspecs/modules/qt_KCddb.pri diff -Nru libkcddb-15.12.3/debian/libkf5cddbwidgets5.install libkcddb-16.12.1/debian/libkf5cddbwidgets5.install --- libkcddb-15.12.3/debian/libkf5cddbwidgets5.install 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/debian/libkf5cddbwidgets5.install 2017-01-19 16:14:42.000000000 +0000 @@ -0,0 +1,2 @@ +usr/lib/*/libKF5CddbWidgets.so.5 +usr/lib/*/libKF5CddbWidgets.so.5.* diff -Nru libkcddb-15.12.3/debian/patches/libmusicbrainz5cc.patch libkcddb-16.12.1/debian/patches/libmusicbrainz5cc.patch --- libkcddb-15.12.3/debian/patches/libmusicbrainz5cc.patch 2016-04-14 23:15:53.000000000 +0000 +++ libkcddb-16.12.1/debian/patches/libmusicbrainz5cc.patch 2017-01-19 16:14:42.000000000 +0000 @@ -1,16 +1,13 @@ -Description: Prefer libmusicbrainz5cc to libmusicbrainz5 -Author: Maximiliano Curia -Last-Update: 2015-07-09 -Index: libkcddb/cmake/FindMusicBrainz5.cmake -=================================================================== ---- libkcddb.orig/cmake/FindMusicBrainz5.cmake 2015-09-19 16:23:48.135877796 +0200 -+++ libkcddb/cmake/FindMusicBrainz5.cmake 2015-09-19 16:24:15.822765486 +0200 -@@ -18,7 +18,7 @@ - # use pkg-config to get the directories and then use these values - # in the FIND_PATH() and FIND_LIBRARY() calls - find_package(PkgConfig) -- PKG_SEARCH_MODULE( MUSICBRAINZ5 libmusicbrainz5 ) -+ PKG_SEARCH_MODULE( MUSICBRAINZ5 libmusicbrainz5cc libmusicbrainz5 ) - ELSE (NOT WIN32) - FIND_PATH( MUSICBRAINZ5_INCLUDE_DIRS musicbrainz5/Disc.h ) - FIND_LIBRARY( MUSICBRAINZ5_LIBRARIES NAMES musicbrainz5 ) +Author: José Manuel Santamaría Lema +Forwarded: no, because this patch is distro-specific, inappropiate for upstream +--- a/libkcddb/CMakeLists.txt ++++ b/libkcddb/CMakeLists.txt +@@ -58,7 +58,7 @@ target_link_libraries(KF5Cddb + Qt5::Network) + + if(MUSICBRAINZ5_FOUND) +- target_link_libraries(KF5Cddb PRIVATE musicbrainz) ++ target_link_libraries(KF5Cddb PRIVATE musicbrainz5cc) + endif() + + ki18n_wrap_ui(ui_sources cdinfodialog.ui cdinfoencodingwidget.ui) diff -Nru libkcddb-15.12.3/debian/rules libkcddb-16.12.1/debian/rules --- libkcddb-15.12.3/debian/rules 2016-04-14 23:15:53.000000000 +0000 +++ libkcddb-16.12.1/debian/rules 2017-01-19 16:14:42.000000000 +0000 @@ -1,6 +1,6 @@ #!/usr/bin/make -f -include /usr/share/pkg-kde-tools/qt-kde-team/2/debian-qt-kde.mk +include /usr/share/pkg-kde-tools/qt-kde-team/3/debian-qt-kde.mk override_dh_auto_test: # Disable dh_auto_test at build time diff -Nru libkcddb-15.12.3/kcmcddb/cddbconfigwidget.cpp libkcddb-16.12.1/kcmcddb/cddbconfigwidget.cpp --- libkcddb-15.12.3/kcmcddb/cddbconfigwidget.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/kcmcddb/cddbconfigwidget.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -19,27 +19,20 @@ */ #include "cddbconfigwidget.h" +#include "kcmcddbi18n.h" #include "config-musicbrainz.h" -#include // KDE_NO_DEPRECATED - #include "libkcddb/sites.h" #include "libkcddb/lookup.h" -#include -#include -#include -#include -#include -#include -#ifndef KDE_NO_DEPRECATED -#include -#else -#include -#endif -#include -#include +#include +#include +#include + +#include +#include +#include CDDBConfigWidget::CDDBConfigWidget(QWidget * parent) : QWidget(parent) @@ -60,11 +53,7 @@ QVBoxLayout* gbLayout = new QVBoxLayout(groupBox); gbLayout->setMargin(0); -#ifndef KDE_NO_DEPRECATED - KEditListBox* editListWidget = new KEditListBox(groupBox); -#else KEditListWidget* editListWidget = new KEditListWidget(groupBox); -#endif editListWidget->setCustomEditor(urlReq->customEditor()); editListWidget->setObjectName(QString::fromLatin1("kcfg_cacheLocations")); gbLayout->addWidget(editListWidget); @@ -99,13 +88,13 @@ return; } - QStringList result = KInputDialog::getItemList(i18n("Select mirror"), + QString result = QInputDialog::getItem(this, i18n("Select mirror"), i18n("Select one of these mirrors"), keys.keys(), - QStringList(), false, &ok, this); + 0, false, &ok); - if (ok && result.count() == 1) + if (ok) { - KCDDB::Mirror m = keys[*(result.begin())]; + KCDDB::Mirror m = keys[result]; kcfg_FreedbLookupTransport->setCurrentIndex(m.transport == KCDDB::Lookup::CDDBP ? 0 : 1); kcfg_hostname->setText(m.address); @@ -131,5 +120,3 @@ } // vim:tabstop=2:shiftwidth=2:expandtab:cinoptions=(s,U1,m1 - -#include "cddbconfigwidget.moc" diff -Nru libkcddb-15.12.3/kcmcddb/cddbconfigwidget.h libkcddb-16.12.1/kcmcddb/cddbconfigwidget.h --- libkcddb-15.12.3/kcmcddb/cddbconfigwidget.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/kcmcddb/cddbconfigwidget.h 2016-12-12 00:51:42.000000000 +0000 @@ -30,7 +30,7 @@ CDDBConfigWidget(QWidget * parent = 0); - protected slots: + protected Q_SLOTS: virtual void showMirrorList(); diff -Nru libkcddb-15.12.3/kcmcddb/cddbconfigwidget.ui libkcddb-16.12.1/kcmcddb/cddbconfigwidget.ui --- libkcddb-15.12.3/kcmcddb/cddbconfigwidget.ui 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/kcmcddb/cddbconfigwidget.ui 2016-12-12 00:51:42.000000000 +0000 @@ -82,7 +82,7 @@ - + 0 @@ -132,7 +132,7 @@ - + Show &Mirror List @@ -193,7 +193,7 @@ - + @@ -210,7 +210,7 @@ - + @@ -243,7 +243,7 @@ - + 0 @@ -316,26 +316,6 @@ - - - KIntSpinBox - QSpinBox -
knuminput.h
- 1 -
- - KLineEdit - QLineEdit -
klineedit.h
- 1 -
- - KPushButton - QPushButton -
kpushbutton.h
- 1 -
-
kcfg_hostname kcfg_port diff -Nru libkcddb-15.12.3/kcmcddb/CMakeLists.txt libkcddb-16.12.1/kcmcddb/CMakeLists.txt --- libkcddb-15.12.3/kcmcddb/CMakeLists.txt 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/kcmcddb/CMakeLists.txt 2016-12-12 00:51:42.000000000 +0000 @@ -1,27 +1,25 @@ +add_definitions(-DTRANSLATION_DOMAIN="libkcddb") -include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../libkcddb ${CMAKE_CURRENT_BINARY_DIR}/../libkcddb ) +add_subdirectory(doc) -add_subdirectory ( doc ) +ki18n_wrap_ui(ui_sources cddbconfigwidget.ui) -########### next target ############### +add_library(kcm_cddb MODULE + cddbconfigwidget.cpp + kcmcddb.cpp + ${ui_sources}) -set(kcm_cddb_PART_SRCS cddbconfigwidget.cpp kcmcddb.cpp ) -SET_SOURCE_FILES_PROPERTIES(cddbconfigwidget.cpp PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ui_cddbconfigwidget.h) +set_source_files_properties(cddbconfigwidget.cpp PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ui_cddbconfigwidget.h) +target_link_libraries(kcm_cddb PRIVATE + KF5::ConfigWidgets + KF5::I18n + KF5::KIOCore + KF5::KIOWidgets + KF5::WidgetsAddons + KF5::Cddb +) -kde4_add_ui_files(kcm_cddb_PART_SRCS cddbconfigwidget.ui ) - -kde4_add_plugin(kcm_cddb ${kcm_cddb_PART_SRCS}) - - - -target_link_libraries(kcm_cddb ${KDE4_KIO_LIBS} kcddb) - -install(TARGETS kcm_cddb DESTINATION ${PLUGIN_INSTALL_DIR} ) - - -########### install files ############### - -install( FILES libkcddb.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) - +install(TARGETS kcm_cddb DESTINATION ${PLUGIN_INSTALL_DIR}) +install(FILES libkcddb.desktop DESTINATION ${SERVICES_INSTALL_DIR}) diff -Nru libkcddb-15.12.3/kcmcddb/doc/CMakeLists.txt libkcddb-16.12.1/kcmcddb/doc/CMakeLists.txt --- libkcddb-15.12.3/kcmcddb/doc/CMakeLists.txt 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/kcmcddb/doc/CMakeLists.txt 2016-12-12 00:51:42.000000000 +0000 @@ -1,2 +1 @@ -########### install files ############### -kde4_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR kcontrol/cddbretrieval) +kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR kcontrol/cddbretrieval5) diff -Nru libkcddb-15.12.3/kcmcddb/doc/index.docbook libkcddb-16.12.1/kcmcddb/doc/index.docbook --- libkcddb-15.12.3/kcmcddb/doc/index.docbook 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/kcmcddb/doc/index.docbook 2016-12-12 00:51:42.000000000 +0000 @@ -1,5 +1,5 @@ - diff -Nru libkcddb-15.12.3/kcmcddb/kcmcddb.cpp libkcddb-16.12.1/kcmcddb/kcmcddb.cpp --- libkcddb-15.12.3/kcmcddb/kcmcddb.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/kcmcddb/kcmcddb.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -19,37 +19,34 @@ */ #include "kcmcddb.h" +#include "kcmcddbi18n.h" #include "cddbconfigwidget.h" #include "libkcddb/lookup.h" #include "libkcddb/cache.h" #include "libkcddb/submit.h" -#include -#include -#include - -#include -#include -#include -#include -#include -#include +#include +#include + +#include +#include +#include +#include K_PLUGIN_FACTORY(KCDDBFactory, registerPlugin();) K_EXPORT_PLUGIN(KCDDBFactory( "kcmcddb" )) -CDDBModule::CDDBModule(QWidget *parent, const QVariantList &) - : KCModule(KCDDBFactory::componentData(), parent) +CDDBModule::CDDBModule(QWidget *parent, const QVariantList &args) + : KCModule(parent, args) { - KGlobal::locale()->insertCatalog( QLatin1String( "libkcddb" )); setButtons(Default | Apply | Help); widget_ = new CDDBConfigWidget(this); KCDDB::Config* cfg = new KCDDB::Config(); - cfg->readConfig(); + cfg->load(); addConfig(cfg, widget_); @@ -76,7 +73,7 @@ { KCDDB::Config config; - config.readConfig(); + config.load(); if (config.smtpHostname().isEmpty() || config.emailAddress().isEmpty() || !config.emailAddress().contains(QLatin1String( "@" )) || @@ -91,7 +88,7 @@ "and try again."), i18n("Incorrect Email Settings")); config.setFreedbSubmitTransport(KCDDB::Submit::HTTP); - config.writeConfig(); + config.save(); } } } @@ -118,7 +115,7 @@ KCModule::load(); KCDDB::Config config; - config.readConfig(); + config.load(); updateWidgetsFromConfig(config); } diff -Nru libkcddb-15.12.3/kcmcddb/kcmcddb.h libkcddb-16.12.1/kcmcddb/kcmcddb.h --- libkcddb-15.12.3/kcmcddb/kcmcddb.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/kcmcddb/kcmcddb.h 2016-12-12 00:51:42.000000000 +0000 @@ -20,7 +20,7 @@ #ifndef KCMCDDB_H #define KCMCDDB_H -#include +#include #include "libkcddb/kcddbconfig.h" class CDDBConfigWidget; @@ -32,9 +32,9 @@ public: - CDDBModule(QWidget * parent, const QVariantList &); + CDDBModule(QWidget * parent, const QVariantList & args); - public slots: + public Q_SLOTS: void defaults(); void save(); diff -Nru libkcddb-15.12.3/kcmcddb/kcmcddbi18n.h libkcddb-16.12.1/kcmcddb/kcmcddbi18n.h --- libkcddb-15.12.3/kcmcddb/kcmcddbi18n.h 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/kcmcddb/kcmcddbi18n.h 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,7 @@ +#ifndef KCMCDDBI18N_H +#define KCMCDDBI18N_H + +#define TRANSLATION_DOMAIN "kcmcddb" +#include + +#endif // KCMCDDBI18N_H diff -Nru libkcddb-15.12.3/kcmcddb/libkcddb.desktop libkcddb-16.12.1/kcmcddb/libkcddb.desktop --- libkcddb-15.12.3/kcmcddb/libkcddb.desktop 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/kcmcddb/libkcddb.desktop 2016-12-12 00:51:42.000000000 +0000 @@ -1,5 +1,5 @@ [Desktop Entry] -Exec=kcmshell4 libkcddb +Exec=kcmshell5 libkcddb Icon=media-optical-audio Type=Service ServiceTypes=KCModule @@ -7,7 +7,7 @@ X-KDE-Library=kcm_cddb X-KDE-ParentApp=kcontrol -X-DocPath=kcontrol/cddbretrieval/index.html +X-DocPath=kcontrol/cddbretrieval5/index.html Name=CDDB Retrieval Name[bg]=Изтегляне на данни от CDDB @@ -183,6 +183,7 @@ Keywords[nb]=cddb; Keywords[nds]=CDDB;cddb; Keywords[nl]=cddb; +Keywords[nn]=cddb; Keywords[pl]=cddb; Keywords[pt]=cddb; Keywords[pt_BR]=cddb; diff -Nru libkcddb-15.12.3/KF5CddbConfig.cmake.in libkcddb-16.12.1/KF5CddbConfig.cmake.in --- libkcddb-15.12.3/KF5CddbConfig.cmake.in 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/KF5CddbConfig.cmake.in 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,5 @@ +@PACKAGE_INIT@ + +find_dependency(Qt5Widgets "@REQUIRED_QT_VERSION@") + +include("${CMAKE_CURRENT_LIST_DIR}/KF5CddbTargets.cmake") diff -Nru libkcddb-15.12.3/libkcddb/asynccddbplookup.cpp libkcddb-16.12.1/libkcddb/asynccddbplookup.cpp --- libkcddb-15.12.3/libkcddb/asynccddbplookup.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/asynccddbplookup.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -20,9 +20,7 @@ */ #include "asynccddbplookup.h" - -#include -#include +#include "logging.h" namespace KCDDB { @@ -45,7 +43,8 @@ const TrackOffsetList & trackOffsetList ) { - socket_ = KSocketFactory::connectToHost(QLatin1String( "cddbp" ), hostname, port); + socket_ = new QTcpSocket; + socket_->connectToHost(hostname, port); connect (socket_, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(slotGotError(QAbstractSocket::SocketError))); @@ -77,14 +76,14 @@ void AsyncCDDBPLookup::slotConnectionSuccess() { - kDebug(60010) << "Connection successful"; + qCDebug(LIBKCDDB) << "Connection successful"; state_ = WaitingForGreeting; } void AsyncCDDBPLookup::slotReadyRead() { - kDebug(60010) << "Ready to read. State: " << stateToString(); + qCDebug(LIBKCDDB) << "Ready to read. State: " << stateToString(); while ( Idle != state_ && isConnected() && socket_->canReadLine() ) read(); @@ -337,6 +336,4 @@ } -#include "asynccddbplookup.moc" - // vim:tabstop=2:shiftwidth=2:expandtab:cinoptions=(s,U1,m1 diff -Nru libkcddb-15.12.3/libkcddb/asynccddbplookup.h libkcddb-16.12.1/libkcddb/asynccddbplookup.h --- libkcddb-15.12.3/libkcddb/asynccddbplookup.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/asynccddbplookup.h 2016-12-12 00:51:42.000000000 +0000 @@ -21,7 +21,6 @@ #ifndef KCDDB_ASYNC_CDDBP_LOOKUP_H #define KCDDB_ASYNC_CDDBP_LOOKUP_H - #include "cddbplookup.h" namespace KCDDB @@ -52,12 +51,12 @@ Result lookup( const QString &, uint, const TrackOffsetList & ); - signals: + Q_SIGNALS: void finished( KCDDB::Result ); void quit( Result ); - protected slots: + protected Q_SLOTS: void slotGotError(QAbstractSocket::SocketError error); void slotConnectionSuccess(); diff -Nru libkcddb-15.12.3/libkcddb/asynchttplookup.cpp libkcddb-16.12.1/libkcddb/asynchttplookup.cpp --- libkcddb-15.12.3/libkcddb/asynchttplookup.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/asynchttplookup.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -19,12 +19,9 @@ */ #include "asynchttplookup.h" +#include "logging.h" -#include -#include - -#include -#include +#include namespace KCDDB { @@ -74,7 +71,7 @@ void AsyncHTTPLookup::slotQueryReady() { - kDebug(60010) << "Matches Found: " << matchList_.count(); + qCDebug(LIBKCDDB) << "Matches Found: " << matchList_.count(); if ( Success != result_ ) { @@ -130,7 +127,7 @@ Result AsyncHTTPLookup::fetchURL() { - kDebug(60010) << "About to fetch: " << cgiURL_.url(); + qCDebug(LIBKCDDB) << "About to fetch: " << cgiURL_.url(); KIO::TransferJob* job = KIO::get( cgiURL_, KIO::NoReload, KIO::HideProgressInfo ); @@ -147,6 +144,4 @@ } -#include "asynchttplookup.moc" - // vim:tabstop=2:shiftwidth=2:expandtab:cinoptions=(s,U1,m1 diff -Nru libkcddb-15.12.3/libkcddb/asynchttplookup.h libkcddb-16.12.1/libkcddb/asynchttplookup.h --- libkcddb-15.12.3/libkcddb/asynchttplookup.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/asynchttplookup.h 2016-12-12 00:51:42.000000000 +0000 @@ -41,11 +41,11 @@ CDInfoList lookupResponse() const; - signals: + Q_SIGNALS: void finished( KCDDB::Result ); - protected slots: + protected Q_SLOTS: void slotQueryReady(); void requestCDInfoForMatch(); diff -Nru libkcddb-15.12.3/libkcddb/asynchttpsubmit.cpp libkcddb-16.12.1/libkcddb/asynchttpsubmit.cpp --- libkcddb-15.12.3/libkcddb/asynchttpsubmit.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/asynchttpsubmit.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -19,8 +19,8 @@ #include "asynchttpsubmit.h" -#include -#include +#include +#include namespace KCDDB { @@ -44,7 +44,7 @@ void AsyncHTTPSubmit::slotFinished(KJob* job) { - kDebug() << "Finished"; + qDebug() << "Finished"; if ( job->error()==0 ) emit finished( Success ); @@ -53,4 +53,3 @@ } } -#include "asynchttpsubmit.moc" diff -Nru libkcddb-15.12.3/libkcddb/asynchttpsubmit.h libkcddb-16.12.1/libkcddb/asynchttpsubmit.h --- libkcddb-15.12.3/libkcddb/asynchttpsubmit.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/asynchttpsubmit.h 2016-12-12 00:51:42.000000000 +0000 @@ -32,11 +32,11 @@ AsyncHTTPSubmit(const QString& from, const QString& hostname, uint port); virtual ~AsyncHTTPSubmit(); - signals: + Q_SIGNALS: void finished( KCDDB::Result ); protected: virtual Result runJob(KIO::Job* job); - private slots: + private Q_SLOTS: void slotFinished(KJob*); } ; } diff -Nru libkcddb-15.12.3/libkcddb/asyncsmtpsubmit.cpp libkcddb-16.12.1/libkcddb/asyncsmtpsubmit.cpp --- libkcddb-15.12.3/libkcddb/asyncsmtpsubmit.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/asyncsmtpsubmit.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -18,12 +18,11 @@ */ #include "asyncsmtpsubmit.h" +#include "logging.h" #include "cdinfo.h" - -#include -#include +#include namespace KCDDB { @@ -49,7 +48,7 @@ void AsyncSMTPSubmit::slotDone( KJob* job ) { - kDebug(60010) ; + qCDebug(LIBKCDDB) ; if ( job->error()==0 ) emit finished( Success ); else @@ -57,4 +56,3 @@ } } -#include "asyncsmtpsubmit.moc" diff -Nru libkcddb-15.12.3/libkcddb/asyncsmtpsubmit.h libkcddb-16.12.1/libkcddb/asyncsmtpsubmit.h --- libkcddb-15.12.3/libkcddb/asyncsmtpsubmit.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/asyncsmtpsubmit.h 2016-12-12 00:51:42.000000000 +0000 @@ -38,9 +38,9 @@ const QString& from, const QString& to); virtual ~AsyncSMTPSubmit(); - signals: + Q_SIGNALS: void finished( KCDDB::Result ); - protected slots: + protected Q_SLOTS: void slotDone( KJob * ); protected: virtual Result runJob(KIO::Job* job); diff -Nru libkcddb-15.12.3/libkcddb/cache.cpp libkcddb-16.12.1/libkcddb/cache.cpp --- libkcddb-15.12.3/libkcddb/cache.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/cache.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -24,18 +24,16 @@ #include "kcddbconfig.h" #include "cddb.h" +#include "logging.h" #include "config-musicbrainz.h" #ifdef HAVE_MUSICBRAINZ5 #include "musicbrainz/musicbrainzlookup.h" #endif -#include -#include - -#include -#include -#include +#include +#include +#include namespace KCDDB { @@ -44,7 +42,7 @@ { QString cddbId = CDDB::trackOffsetListToId(offsetList); - kDebug(60010) << "Looking up " << cddbId << " in CDDB cache"; + qCDebug(LIBKCDDB) << "Looking up " << cddbId << " in CDDB cache"; CDInfoList infoList; @@ -104,7 +102,7 @@ else { if (source != QLatin1String( "user" )) - kWarning(60010) << "Unknown source " << source << " for CDInfo"; + qCWarning(LIBKCDDB) << "Unknown source " << source << " for CDInfo"; cacheDir = QLatin1String( "/user/" ); QString id = CDDB::trackOffsetListToId(offsetList); @@ -123,12 +121,12 @@ { if (!dir.mkpath(cacheDir)) { - kWarning(60010) << "Couldn't create cache directory " << cacheDir; + qCWarning(LIBKCDDB) << "Couldn't create cache directory " << cacheDir; return; } } - kDebug(60010) << "Storing " << cacheFile << " in CDDB cache"; + qCDebug(LIBKCDDB) << "Storing " << cacheFile << " in CDDB cache"; QFile f(cacheDir + QLatin1Char( '/' ) + cacheFile); if ( f.open(QIODevice::WriteOnly) ) @@ -139,7 +137,7 @@ f.close(); } } else { - kDebug(60010) << "There's no cache dir defined, not storing it"; + qDebug() << "There's no cache dir defined, not storing it"; } } } diff -Nru libkcddb-15.12.3/libkcddb/cache.h libkcddb-16.12.1/libkcddb/cache.h --- libkcddb-15.12.3/libkcddb/cache.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/cache.h 2016-12-12 00:51:42.000000000 +0000 @@ -22,12 +22,10 @@ #ifndef KCDDB_CACHE_H #define KCDDB_CACHE_H -#include -#include - #include "kcddb.h" #include "cdinfo.h" -#include + +#include namespace KCDDB { diff -Nru libkcddb-15.12.3/libkcddb/categories.cpp libkcddb-16.12.1/libkcddb/categories.cpp --- libkcddb-15.12.3/libkcddb/categories.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/categories.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -8,28 +8,63 @@ #include "categories.h" -#include +#include "kcddbi18n.h" + +class KCDDB::Categories::Private +{ +public: + QStringList cddb; + QStringList i18n; +}; KCDDB::Categories::Categories() + : d(new Private) { // These are only 11 Category values defined by CDDB. See // // http://www.freedb.org/modules.php?name=Sections&sop=viewarticle&artid=26 // - m_cddb << QLatin1String( "blues" ) << QLatin1String( "classical" ) << QLatin1String( "country" ) << + d->cddb << QLatin1String( "blues" ) << QLatin1String( "classical" ) << QLatin1String( "country" ) << QLatin1String( "data" ) << QLatin1String( "folk" ) << QLatin1String( "jazz" ) << QLatin1String( "misc" ) << QLatin1String( "newage" ) << QLatin1String( "reggae" ) << QLatin1String( "rock" ) << QLatin1String( "soundtrack" ); - m_i18n << i18n("Blues") << i18n("Classical") << i18nc("music genre", "Country") << + d->i18n << i18n("Blues") << i18n("Classical") << i18nc("music genre", "Country") << i18n("Data") << i18n("Folk") << i18n("Jazz") << i18n("Miscellaneous") << i18n("New Age") << i18n("Reggae") << i18n("Rock") << i18n("Soundtrack"); } +KCDDB::Categories::~Categories() +{ + delete d; +} + +KCDDB::Categories::Categories(const Categories& other) + :d(new Private) +{ + *d = *other.d; +} + +KCDDB::Categories& KCDDB::Categories::operator=(const Categories& other) +{ + *d = *other.d; + return *this; +} + +const QStringList &KCDDB::Categories::cddbList() const +{ + return d->cddb; +} + +const QStringList &KCDDB::Categories::i18nList() const +{ + return d->i18n; +} + const QString KCDDB::Categories::cddb2i18n(const QString &category) const { - int index = m_cddb.indexOf(category.trimmed()); + int index = d->cddb.indexOf(category.trimmed()); if (index != -1) { - return m_i18n[index]; + return d->i18n[index]; } else { @@ -39,10 +74,10 @@ const QString KCDDB::Categories::i18n2cddb(const QString &category) const { - int index = m_i18n.indexOf(category.trimmed()); + int index = d->i18n.indexOf(category.trimmed()); if (index != -1) { - return m_cddb[index]; + return d->cddb[index]; } else { diff -Nru libkcddb-15.12.3/libkcddb/categories.h libkcddb-16.12.1/libkcddb/categories.h --- libkcddb-15.12.3/libkcddb/categories.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/categories.h 2016-12-12 00:51:42.000000000 +0000 @@ -8,21 +8,26 @@ #ifndef KCDDB_CATEGORIES_H #define KCDDB_CATEGORIES_H -#include -#include +#include +#include +#include namespace KCDDB { /** * Category values defined by CDDB. */ - class Categories + class KCDDB_EXPORT Categories { public: Categories(); + Categories(const Categories&); + ~Categories(); - const QStringList &cddbList() const { return m_cddb; } - const QStringList &i18nList() const { return m_i18n; } + Categories& operator=(const Categories&); + + const QStringList &cddbList() const; + const QStringList &i18nList() const; /** * Lookup the CDDB category, and return the i18n'd version. @@ -34,8 +39,8 @@ */ const QString i18n2cddb(const QString &category) const; private: - QStringList m_cddb; - QStringList m_i18n; + class Private; + Private * const d; }; } diff -Nru libkcddb-15.12.3/libkcddb/cddb.cpp libkcddb-16.12.1/libkcddb/cddb.cpp --- libkcddb-15.12.3/libkcddb/cddb.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/cddb.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -22,12 +22,12 @@ #include "cddb.h" #include "categories.h" +#include "kcddbi18n.h" -#include +#include -#include -#include -#include +#include +#include namespace KCDDB { diff -Nru libkcddb-15.12.3/libkcddb/cddb.h libkcddb-16.12.1/libkcddb/cddb.h --- libkcddb-15.12.3/libkcddb/cddb.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/cddb.h 2016-12-12 00:51:42.000000000 +0000 @@ -22,11 +22,12 @@ #ifndef KCDDB_CDDB_H #define KCDDB_CDDB_H -#include +#include +#include +#include + #include -#include -#include -#include +#include namespace KCDDB { diff -Nru libkcddb-15.12.3/libkcddb/cddbplookup.cpp libkcddb-16.12.1/libkcddb/cddbplookup.cpp --- libkcddb-15.12.3/libkcddb/cddbplookup.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/cddbplookup.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -20,10 +20,9 @@ */ #include "cddbplookup.h" +#include "logging.h" -#include - -#include +#include namespace KCDDB { @@ -90,7 +89,7 @@ void CDDBPLookup::close() { - kDebug(60010) << "Disconnect from server..."; + qCDebug(LIBKCDDB) << "Disconnect from server..."; if ( isConnected() ) { socket_->close(); @@ -104,16 +103,16 @@ if ( 200 == serverStatus ) { - kDebug(60010) << "Server response: read-only"; + qCDebug(LIBKCDDB) << "Server response: read-only"; readOnly_ = true; } else if ( 201 == serverStatus ) { - kDebug(60010) << "Server response: read-write"; + qCDebug(LIBKCDDB) << "Server response: read-write"; } else { - kDebug(60010) << "Server response: bugger off"; + qCDebug(LIBKCDDB) << "Server response: bugger off"; return false; } @@ -127,11 +126,11 @@ if ( ( 200 != serverStatus ) && ( 402 != serverStatus ) ) { - kDebug(60010) << "Handshake was too tight. Letting go."; + qCDebug(LIBKCDDB) << "Handshake was too tight. Letting go."; return false; } - kDebug(60010) << "Handshake was warm and firm"; + qCDebug(LIBKCDDB) << "Handshake was warm and firm"; return true; } @@ -142,11 +141,11 @@ { if ( !isConnected() ) { - kDebug(60010) << "socket status: " << socket_->state(); + qCDebug(LIBKCDDB) << "socket status: " << socket_->state(); return -1; } - kDebug(60010) << "WRITE: [" << line << "]"; + qCDebug(LIBKCDDB) << "WRITE: [" << line << "]"; QByteArray buf(line.toUtf8()); buf.append( '\n' ); diff -Nru libkcddb-15.12.3/libkcddb/cddbplookup.h libkcddb-16.12.1/libkcddb/cddbplookup.h --- libkcddb-15.12.3/libkcddb/cddbplookup.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/cddbplookup.h 2016-12-12 00:51:42.000000000 +0000 @@ -22,10 +22,10 @@ #ifndef KCDDB_CDDBP_LOOKUP_H #define KCDDB_CDDBP_LOOKUP_H -#include - #include "lookup.h" +#include + namespace KCDDB { class CDDBPLookup : public Lookup diff -Nru libkcddb-15.12.3/libkcddb/cdinfo.cpp libkcddb-16.12.1/libkcddb/cdinfo.cpp --- libkcddb-15.12.3/libkcddb/cdinfo.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/cdinfo.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -24,9 +24,10 @@ #include "client.h" #include "cddb.h" +#include "logging.h" -#include -#include +#include +#include #include @@ -119,13 +120,13 @@ void set(const QString& type, const QVariant &d) { - //kDebug() << "set: " << type << ", " << d.toString(); + //qDebug() << "set: " << type << ", " << d.toString(); if(type.contains(QRegExp( QLatin1String( "^T.*_.*$" )) )){ - kDebug(60010) << "Error: custom cdinfo::set data can not start with T and contain a _"; + qCDebug(LIBKCDDB) << "Error: custom cdinfo::set data can not start with T and contain a _"; return; } if(type.toUpper() == QLatin1String( "DTITLE" )){ - kDebug(60010) << "Error: type: DTITLE is reserved and can not be set."; + qCDebug(LIBKCDDB) << "Error: type: DTITLE is reserved and can not be set."; return; } @@ -227,7 +228,7 @@ bool ok; int track = get(QLatin1String( "tracknumber" )).toInt(&ok); if(!ok) - kDebug(60010) << "Warning toString() on a track that doesn't have track number assigned."; + qCDebug(LIBKCDDB) << "Warning toString() on a track that doesn't have track number assigned."; QMap::const_iterator i = d->data.constBegin(); while (i != d->data.constEnd()) { if(i.key() != QLatin1String( "COMMENT" ) && i.key() != QLatin1String( "TITLE" ) && i.key() != QLatin1String( "ARTIST" ) && i.key() != QLatin1String( "TRACKNUMBER" )) { @@ -350,7 +351,7 @@ checkTrack( trackNumber ); QString extt = track(trackNumber).get(Comment).toString(); - track(trackNumber).set(Comment, extt+value ); + track(trackNumber).set(Comment, QVariant(extt + value)); } else if ( key.startsWith(QLatin1String( "T" )) ) { @@ -412,7 +413,7 @@ if ( get(Genre).toString().isEmpty() ) set(Genre, QLatin1String( "Unknown" )); - kDebug(60010) << "Loaded CDInfo for " << get(QLatin1String( "discid" )).toString(); + qCDebug(LIBKCDDB) << "Loaded CDInfo for " << get(QLatin1String( "discid" )).toString(); return true; } @@ -572,7 +573,7 @@ return d->trackInfoList[trackNumber]; else { - kWarning() << "Couldn't find track " << trackNumber; + qWarning() << "Couldn't find track " << trackNumber; return TrackInfo(); } } diff -Nru libkcddb-15.12.3/libkcddb/cdinfodialog.cpp libkcddb-16.12.1/libkcddb/cdinfodialog.cpp --- libkcddb-15.12.3/libkcddb/cdinfodialog.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/cdinfodialog.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -21,15 +21,18 @@ #include "cdinfodialog.h" #include "cdinfoencodingwidget.h" +#include "kcddbi18n.h" #include "ui_cdinfodialog.h" -#include -#include -#include - -#include -#include -#include +#include + +#include +#include +#include +#include +#include +#include +#include using KCDDB::TrackInfo; @@ -59,12 +62,14 @@ QLatin1String CDInfoDialog::Private::SEPARATOR = QLatin1String( " / " ); CDInfoDialog::CDInfoDialog(QWidget* parent) - : KDialog(parent), + : QDialog(parent), d(new Private) { QWidget* w = new QWidget(this); d->ui->setupUi(w); - setMainWidget(w); + + QVBoxLayout* layout = new QVBoxLayout(this); + layout->addWidget(w); d->info.set(QLatin1String( "source" ), QLatin1String( "user" )); @@ -77,10 +82,8 @@ d->ui->m_trackList->setModel(m_trackModel); // We want control over the visibility of this column. See artistChanged(). -// d->ui->m_trackList->setColumnWidthMode(Private::TRACK_ARTIST, Q3ListView::Manual); + d->ui->m_trackList->header()->setSectionResizeMode(Private::TRACK_ARTIST, QHeaderView::Interactive); - // ensure we get our translations - KGlobal::locale()->insertCatalog( QLatin1String( "libkcddb" )); connect( d->ui->m_trackList, SIGNAL(activated(QModelIndex)), this, SLOT(slotTrackSelected(QModelIndex)) ); connect( d->ui->m_trackList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(slotTrackDoubleClicked(QModelIndex)) ); connect( d->ui->m_artist, SIGNAL(textChanged(QString)), this, SLOT(artistChanged(QString)) ); @@ -88,6 +91,11 @@ connect( d->ui->m_multiple, SIGNAL(toggled(bool)), this, SLOT(slotMultipleArtists(bool)) ); connect(d->ui->m_changeEncoding,SIGNAL(clicked()),SLOT(slotChangeEncoding())); + + QDialogButtonBox *bbox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + layout->addWidget(bbox); + connect(bbox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), SLOT(accept())); + connect(bbox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), SLOT(close())); } void CDInfoDialog::slotTrackSelected( const QModelIndex &index ) @@ -100,23 +108,21 @@ { delete d->ui; delete d; - } void CDInfoDialog::slotNextTrack() { -/* QTreeWidgetItem *item = d->ui->m_trackList->itemBelow(d->ui->m_trackList->currentItem()); - if (item) + QModelIndex index = d->ui->m_trackList->indexBelow(d->ui->m_trackList->currentIndex()); + if (index.isValid()) { - - d->ui->m_trackList->setCurrentItem(item);*/ -// d->ui->m_trackList->ensureItemVisible(item); -// } + d->ui->m_trackList->setCurrentIndex(index); + d->ui->m_trackList->scrollTo(index, QTreeView::EnsureVisible); + } } void CDInfoDialog::slotTrackDoubleClicked(const QModelIndex &index) { -// d->ui->m_trackList->editItem(item); + d->ui->m_trackList->edit(index); } void CDInfoDialog::setInfo( const KCDDB::CDInfo &info, const KCDDB::TrackOffsetList &trackStartFrames ) @@ -149,10 +155,10 @@ QList trackItems = QList(); TrackInfo ti(info.track(i)); QStandardItem *trackNumberItem = new QStandardItem(QString().sprintf("%02d", i + 1)); - trackNumberItem->setEditable(FALSE); + trackNumberItem->setEditable(false); trackItems << trackNumberItem; QStandardItem *trackLengthItem = new QStandardItem(framesTime(trackStartFrames[i + 1] - trackStartFrames[i])); - trackLengthItem->setEditable(FALSE); + trackLengthItem->setEditable(false); trackItems << trackLengthItem; QStandardItem *trackTitleItem = new QStandardItem(ti.get(Title).toString()); trackItems << trackTitleItem; @@ -252,7 +258,7 @@ if (!artist.isEmpty()) { m_trackModel->setData(m_trackModel->index(t, Private::TRACK_ARTIST), QString()); QString title = m_trackModel->index(t, Private::TRACK_TITLE).data().toString(); - m_trackModel->setData(m_trackModel->index(t, Private::TRACK_TITLE), artist + Private::SEPARATOR + title); + m_trackModel->setData(m_trackModel->index(t, Private::TRACK_TITLE), QVariant(artist + Private::SEPARATOR + title)); } } d->ui->m_trackList->hideColumn(Private::TRACK_ARTIST); @@ -263,9 +269,8 @@ void CDInfoDialog::slotChangeEncoding() { - KDialog* dialog = new KDialog(this); - dialog->setCaption(i18n("Change Encoding")); - dialog->setButtons( KDialog::Ok | KDialog::Cancel); + QDialog* dialog = new QDialog(this); + dialog->setWindowTitle(i18n("Change Encoding")); dialog->setModal( true ); @@ -281,11 +286,12 @@ KCDDB::CDInfoEncodingWidget* encWidget = new KCDDB::CDInfoEncodingWidget( dialog, d->ui->m_artist->text(),d->ui->m_title->text(), songTitles); - dialog->setMainWidget(encWidget); + QVBoxLayout* layout = new QVBoxLayout(dialog); + layout->addWidget(encWidget); if (dialog->exec()) { - KCharsets* charsets = KGlobal::charsets(); + KCharsets* charsets = KCharsets::charsets(); QTextCodec* codec = charsets->codecForName(charsets->encodingForName(encWidget->selectedEncoding())); d->ui->m_artist->setText(codec->toUnicode(d->ui->m_artist->text().toLatin1())); @@ -307,4 +313,3 @@ } } -#include "cdinfodialog.moc" diff -Nru libkcddb-15.12.3/libkcddb/cdinfodialog.h libkcddb-16.12.1/libkcddb/cdinfodialog.h --- libkcddb-15.12.3/libkcddb/cdinfodialog.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/cdinfodialog.h 2016-12-12 00:51:42.000000000 +0000 @@ -20,18 +20,18 @@ #ifndef KCDDB_CDINFODIALOG_H #define KCDDB_CDINFODIALOG_H -#include -#include -#include +#include +#include +#include -#include +#include class QStandardItemModel; class QModelIndex; namespace KCDDB { - class KCDDB_EXPORT CDInfoDialog : public KDialog + class KCDDB_EXPORT CDInfoDialog : public QDialog { Q_OBJECT public: diff -Nru libkcddb-15.12.3/libkcddb/cdinfodialog.ui libkcddb-16.12.1/libkcddb/cdinfodialog.ui --- libkcddb-15.12.3/libkcddb/cdinfodialog.ui 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/cdinfodialog.ui 2016-12-12 00:51:42.000000000 +0000 @@ -36,7 +36,7 @@ - + Use the name of the artist if there is no title. @@ -60,7 +60,7 @@ - + Write names as "first last", not "last, first". Omit any leading "The". Use "Various" for compilations. @@ -97,7 +97,7 @@ - + false @@ -107,7 +107,7 @@ - + 2100 @@ -121,7 +121,7 @@ - + @@ -144,7 +144,7 @@ - + Avoid custom values, as they will be written to CDDB as-is. @@ -239,29 +239,10 @@ - + - - - KComboBox - QComboBox -
kcombobox.h
-
- - KLineEdit - QLineEdit -
klineedit.h
- 1 -
- - KIntSpinBox - QSpinBox -
knuminput.h
- 1 -
-
m_artist m_title @@ -273,10 +254,10 @@ m_playOrder - libkcddb/cdinfo.h - libkcddb/kcddb.h - libkcddb/categories.h - libkcddb/genres.h + cdinfo.h + kcddb.h + categories.h + genres.h diff -Nru libkcddb-15.12.3/libkcddb/cdinfoencodingwidget.cpp libkcddb-16.12.1/libkcddb/cdinfoencodingwidget.cpp --- libkcddb-15.12.3/libkcddb/cdinfoencodingwidget.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/cdinfoencodingwidget.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -19,10 +19,10 @@ #include "cdinfoencodingwidget.h" -#include -#include -#include -#include +#include "kcddbi18n.h" + +#include +#include namespace KCDDB { @@ -33,7 +33,7 @@ { setupUi(this); - encodingCombo->addItems(KGlobal::charsets()->descriptiveEncodingNames()); + encodingCombo->addItems(KCharsets::charsets()->descriptiveEncodingNames()); slotEncodingChanged(encodingCombo->currentText()); @@ -48,7 +48,7 @@ void CDInfoEncodingWidget::slotEncodingChanged(const QString& encoding) { - KCharsets* charsets = KGlobal::charsets(); + KCharsets* charsets = KCharsets::charsets(); QTextCodec* codec = charsets->codecForName(charsets->encodingForName(encoding)); @@ -67,4 +67,3 @@ } } -#include "cdinfoencodingwidget.moc" diff -Nru libkcddb-15.12.3/libkcddb/cdinfoencodingwidget.h libkcddb-16.12.1/libkcddb/cdinfoencodingwidget.h --- libkcddb-15.12.3/libkcddb/cdinfoencodingwidget.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/cdinfoencodingwidget.h 2016-12-12 00:51:42.000000000 +0000 @@ -34,7 +34,7 @@ QString selectedEncoding(); - private slots: + private Q_SLOTS: void slotEncodingChanged(const QString &); private: diff -Nru libkcddb-15.12.3/libkcddb/cdinfoencodingwidget.ui libkcddb-16.12.1/libkcddb/cdinfoencodingwidget.ui --- libkcddb-15.12.3/libkcddb/cdinfoencodingwidget.ui 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/cdinfoencodingwidget.ui 2016-12-12 00:51:42.000000000 +0000 @@ -11,19 +11,21 @@ - + + 10 + + + 10 + + + 10 + + 10 6 - - - - Encoding - - - @@ -36,7 +38,16 @@ 6 - + + 10 + + + 10 + + + 10 + + 10 @@ -47,7 +58,7 @@ - + 300 @@ -59,15 +70,22 @@ + + + + Encoding + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + - - - KListWidget - QListWidget -
klistwidget.h
-
-
diff -Nru libkcddb-15.12.3/libkcddb/cdinfo.h libkcddb-16.12.1/libkcddb/cdinfo.h --- libkcddb-15.12.3/libkcddb/cdinfo.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/cdinfo.h 2016-12-12 00:51:42.000000000 +0000 @@ -22,9 +22,9 @@ #ifndef KCDDB_CDINFO_H #define KCDDB_CDINFO_H +#include #include #include -#include namespace KCDDB { diff -Nru libkcddb-15.12.3/libkcddb/client.cpp libkcddb-16.12.1/libkcddb/client.cpp --- libkcddb-15.12.3/libkcddb/client.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/client.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -31,6 +31,7 @@ #include "asynchttpsubmit.h" #include "cache.h" #include "lookup.h" +#include "logging.h" #include "config-musicbrainz.h" #ifdef HAVE_MUSICBRAINZ5 @@ -38,8 +39,6 @@ #include "musicbrainz/asyncmusicbrainzlookup.h" #endif -#include - namespace KCDDB { class Client::Private @@ -56,6 +55,7 @@ { delete cdInfoLookup; delete cdInfoSubmit; + qDeleteAll(pendingLookups); } Lookup * cdInfoLookup; @@ -71,7 +71,7 @@ Client::Client() : d(new Private) { - d->config.readConfig(); + d->config.load(); } Client::~Client() @@ -111,7 +111,7 @@ if ( trackOffsetList.count() <= 1 ) { - kDebug(60010) << "Lookup called with empty offset list"; + qCDebug(LIBKCDDB) << "Lookup called with empty offset list"; return NoRecordFound; } @@ -119,7 +119,7 @@ { d->cdInfoList = Cache::lookup( trackOffsetList, config() ); - kDebug(60010) << "Found " << d->cdInfoList.count() << " hit(s)"; + qCDebug(LIBKCDDB) << "Found " << d->cdInfoList.count() << " hit(s)"; if ( !d->cdInfoList.isEmpty() ) { @@ -135,6 +135,8 @@ // just in case we have an info lookup hanging around, prevent mem leakage delete d->cdInfoLookup; d->cdInfoLookup = 0; + qDeleteAll(d->pendingLookups); + d->pendingLookups.clear(); if ( blockingMode() ) { @@ -321,7 +323,7 @@ break; } default: - kDebug(60010) << "Unsupported transport: "; + qCDebug(LIBKCDDB) << "Unsupported transport: "; // << CDDB::transportToString(d->config.submitTransport()) << endl; return UnknownError; break; @@ -370,7 +372,4 @@ } } -#include "client.moc" - - // vim:tabstop=2:shiftwidth=2:expandtab:cinoptions=(s,U1,m1 diff -Nru libkcddb-15.12.3/libkcddb/client.h libkcddb-16.12.1/libkcddb/client.h --- libkcddb-15.12.3/libkcddb/client.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/client.h 2016-12-12 00:51:42.000000000 +0000 @@ -21,11 +21,10 @@ #ifndef KCDDB_CLIENT_H #define KCDDB_CLIENT_H -#include "kcddbconfig.h" #include "cdinfo.h" -#include #include "kcddb.h" -#include +#include "kcddbconfig.h" +#include namespace KCDDB { diff -Nru libkcddb-15.12.3/libkcddb/CMakeLists.txt libkcddb-16.12.1/libkcddb/CMakeLists.txt --- libkcddb-15.12.3/libkcddb/CMakeLists.txt 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/CMakeLists.txt 2016-12-12 00:51:42.000000000 +0000 @@ -1,62 +1,121 @@ +add_definitions(-DTRANSLATION_DOMAIN="libkcddb") -include_directories(${CMAKE_CURRENT_BINARY_DIR}) +include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${QT_INCLUDES}) -########### next target ############### - -set(kcddb_LIB_SRCS ${libmusicbrainz_SRCS} - cache.cpp - cdinfo.cpp - kcddbconfig.cpp - client.cpp - kcddb.cpp - cddb.cpp - lookup.cpp - cddbplookup.cpp - synccddbplookup.cpp - asynccddbplookup.cpp - httplookup.cpp - synchttplookup.cpp - asynchttplookup.cpp - smtpsubmit.cpp - asyncsmtpsubmit.cpp - syncsmtpsubmit.cpp - submit.cpp - sites.cpp - httpsubmit.cpp - asynchttpsubmit.cpp - synchttpsubmit.cpp - categories.cpp - genres.cpp - cdinfodialog.cpp - cdinfoencodingwidget.cpp ) - - -kde4_add_ui_files(kcddb_LIB_SRCS cdinfodialog.ui cdinfoencodingwidget.ui ) - -kde4_add_kcfg_files(kcddb_LIB_SRCS configbase.kcfgc ) - -kde4_add_library(kcddb SHARED ${kcddb_LIB_SRCS}) +if(MUSICBRAINZ5_FOUND) + set(musicbrainz_sources + musicbrainz/musicbrainzlookup.cpp + musicbrainz/asyncmusicbrainzlookup.cpp) + + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR (WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")) + set(enable_exceptions -EHsc) + elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set(enable_exceptions "-fexceptions -UQT_NO_EXCEPTIONS") + elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") + set(enable_exceptions -fexceptions) + endif() + + set_source_files_properties(${musicbrainz_sources} PROPERTIES COMPILE_FLAGS ${enable_exceptions}) +endif() + +kconfig_add_kcfg_files(kcfg_sources configbase.kcfgc) + +add_library(KF5Cddb SHARED + cache.cpp + cdinfo.cpp + kcddbconfig.cpp + client.cpp + kcddb.cpp + cddb.cpp + lookup.cpp + cddbplookup.cpp + synccddbplookup.cpp + asynccddbplookup.cpp + httplookup.cpp + synchttplookup.cpp + asynchttplookup.cpp + smtpsubmit.cpp + asyncsmtpsubmit.cpp + syncsmtpsubmit.cpp + submit.cpp + sites.cpp + httpsubmit.cpp + asynchttpsubmit.cpp + synchttpsubmit.cpp + categories.cpp + genres.cpp + logging.cpp + ${musicbrainz_sources} + ${kcfg_sources}) + +target_link_libraries(KF5Cddb + PUBLIC + KF5::ConfigGui + PRIVATE + KF5::Codecs + KF5::I18n + KF5::KIOCore + Qt5::Network) -target_link_libraries(kcddb ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS}) if(MUSICBRAINZ5_FOUND) - target_link_libraries(kcddb ${MUSICBRAINZ5_LIBRARIES}) -endif(MUSICBRAINZ5_FOUND) + target_link_libraries(KF5Cddb PRIVATE musicbrainz) +endif() + +ki18n_wrap_ui(ui_sources cdinfodialog.ui cdinfoencodingwidget.ui) -set_target_properties(kcddb PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} ) -install(TARGETS kcddb EXPORT LibkcddbTargets ${INSTALL_TARGETS_DEFAULT_ARGS} ) +add_library(KF5CddbWidgets SHARED + cdinfodialog.cpp + cdinfoencodingwidget.cpp + ${ui_sources}) + +target_link_libraries(KF5CddbWidgets + PUBLIC + KF5::Cddb + Qt5::Widgets + PRIVATE + KF5::Codecs + KF5::I18n) + +generate_export_header(KF5Cddb BASE_NAME KCddb) +add_library(KF5::Cddb ALIAS KF5Cddb) +add_library(KF5::CddbWidgets ALIAS KF5CddbWidgets) +target_include_directories(KF5Cddb PUBLIC "$") + +set_target_properties(KF5Cddb PROPERTIES VERSION ${KCDDB_VERSION_STRING} + SOVERSION ${KCDDB_SOVERSION} + EXPORT_NAME Cddb +) + +set_target_properties(KF5CddbWidgets PROPERTIES VERSION ${KCDDB_VERSION_STRING} + SOVERSION ${KCDDB_SOVERSION} + EXPORT_NAME CddbWidgets +) + +ecm_generate_headers(KCddb_HEADERS + HEADER_NAMES + Categories + Cdinfo + CdinfoDialog + Client + Genres + KcddbConfig + Kcddb + REQUIRED_HEADERS KCddb_HEADERS +) -########### install files ############### +install(TARGETS KF5Cddb EXPORT KF5CddbTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) +install(TARGETS KF5CddbWidgets EXPORT KF5CddbTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) install(FILES - cdinfo.h - cdinfodialog.h - client.h - genres.h - kcddbconfig.h - kcddb.h - kcddb_export.h - ${CMAKE_CURRENT_BINARY_DIR}/configbase.h - DESTINATION ${INCLUDE_INSTALL_DIR}/libkcddb COMPONENT Devel ) -install( FILES libkcddb.kcfg DESTINATION ${KCFG_INSTALL_DIR} ) + ${CMAKE_CURRENT_BINARY_DIR}/kcddb_export.h + ${CMAKE_CURRENT_BINARY_DIR}/configbase.h + ${KCddb_HEADERS} + DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/KCddb COMPONENT Devel +) + +include(ECMGeneratePriFile) +ecm_generate_pri_file(BASE_NAME KCddb LIB_NAME KF5Cddb DEPS "Qt5Widgets" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/KCddb) +install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR}) +install(FILES libkcddb5.kcfg DESTINATION ${KCFG_INSTALL_DIR}) diff -Nru libkcddb-15.12.3/libkcddb/configbase.kcfgc libkcddb-16.12.1/libkcddb/configbase.kcfgc --- libkcddb-15.12.3/libkcddb/configbase.kcfgc 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/configbase.kcfgc 2016-12-12 00:51:42.000000000 +0000 @@ -1,6 +1,6 @@ ClassName=ConfigBase -File=libkcddb.kcfg +File=libkcddb5.kcfg Mutators=true -IncludeFiles=libkcddb/kcddb_export.h +IncludeFiles=kcddb_export.h Visibility=KCDDB_EXPORT MemberVariables=dpointer diff -Nru libkcddb-15.12.3/libkcddb/genres.cpp libkcddb-16.12.1/libkcddb/genres.cpp --- libkcddb-15.12.3/libkcddb/genres.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/genres.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -8,7 +8,7 @@ #include "genres.h" -#include +#include "kcddbi18n.h" class KCDDB::Genres::Private { diff -Nru libkcddb-15.12.3/libkcddb/genres.h libkcddb-16.12.1/libkcddb/genres.h --- libkcddb-15.12.3/libkcddb/genres.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/genres.h 2016-12-12 00:51:42.000000000 +0000 @@ -8,8 +8,8 @@ #ifndef KCDDB_GENRES_H #define KCDDB_GENRES_H +#include #include -#include namespace KCDDB { diff -Nru libkcddb-15.12.3/libkcddb/httplookup.cpp libkcddb-16.12.1/libkcddb/httplookup.cpp --- libkcddb-15.12.3/libkcddb/httplookup.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/httplookup.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -21,8 +21,9 @@ #include "httplookup.h" -#include -#include +#include +#include +#include namespace KCDDB { @@ -66,7 +67,7 @@ void HTTPLookup::initURL( const QString & hostName, uint port ) { - cgiURL_.setProtocol( QLatin1String( "http" ) ); + cgiURL_.setScheme( QLatin1String( "http" ) ); cgiURL_.setHost( hostName ); cgiURL_.setPort( port ); cgiURL_.setPath( QLatin1String( "/~cddb/cddb.cgi" ) ); @@ -77,23 +78,22 @@ void HTTPLookup::makeURL( const QString & cmd ) { - // The whole query has to constructed each time as the - // CDDB CGI script expects the parameters in strict order - - cgiURL_.setQuery( QString::null ); //krazy:exclude=nullstrassign for old broken gcc - QString hello = QString::fromLatin1("%1 %2 %3 %4") .arg(user_, localHostName_, clientName(), clientVersion()); - cgiURL_.addQueryItem( QLatin1String( "cmd" ), cmd ); - cgiURL_.addQueryItem( QLatin1String( "hello" ), hello ); - cgiURL_.addQueryItem( QLatin1String( "proto" ), QLatin1String( "6" ) ); + // The whole query has to constructed each time as the + // CDDB CGI script expects the parameters in strict order + QUrlQuery query; + query.addQueryItem( QLatin1String( "cmd" ), cmd ); + query.addQueryItem( QLatin1String( "hello" ), hello ); + query.addQueryItem( QLatin1String( "proto" ), QLatin1String( "6" ) ); + cgiURL_.setQuery( query ); } void HTTPLookup::jobFinished() { - QStringList lineList = QString::fromUtf8(data_, data_.size()).split( QLatin1String( "\n" ), QString::SkipEmptyParts ); + QStringList lineList = QString::fromUtf8(data_).split( QLatin1String( "\n" ), QString::SkipEmptyParts ); QStringList::ConstIterator it = lineList.constBegin(); switch ( state_ ) @@ -158,7 +158,7 @@ { CDInfo info; - if ( info.load( QString::fromUtf8(data_,data_.size()) ) ) + if ( info.load( QString::fromUtf8(data_) ) ) { info.set( QLatin1String( "category" ), category_ ); info.set( QLatin1String( "discid" ), discid_ ); @@ -183,6 +183,4 @@ } } -#include "httplookup.moc" - // vim:tabstop=2:shiftwidth=2:expandtab:cinoptions=(s,U1,m1 diff -Nru libkcddb-15.12.3/libkcddb/httplookup.h libkcddb-16.12.1/libkcddb/httplookup.h --- libkcddb-15.12.3/libkcddb/httplookup.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/httplookup.h 2016-12-12 00:51:42.000000000 +0000 @@ -22,9 +22,8 @@ #ifndef KCDDB_HTTP_LOOKUP_H #define KCDDB_HTTP_LOOKUP_H -#include - #include "lookup.h" +#include namespace KIO { @@ -61,7 +60,7 @@ Result sendQuery(); Result sendRead( const CDDBMatch & ); - signals: + Q_SIGNALS: void queryReady(); void readReady(); @@ -69,7 +68,7 @@ protected: bool block_; - KUrl cgiURL_; + QUrl cgiURL_; QByteArray data_; State state_; Result result_; diff -Nru libkcddb-15.12.3/libkcddb/httpsubmit.cpp libkcddb-16.12.1/libkcddb/httpsubmit.cpp --- libkcddb-15.12.3/libkcddb/httpsubmit.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/httpsubmit.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -20,15 +20,15 @@ #include "httpsubmit.h" -#include -#include +#include +#include namespace KCDDB { HTTPSubmit::HTTPSubmit(const QString& from, const QString& hostname, uint port) : Submit(), from_(from) { - url_.setProtocol( QLatin1String( "http" )); + url_.setScheme( QLatin1String( "http" )); url_.setHost(hostname); url_.setPort(port); url_.setPath(QLatin1String( "/~cddb/submit.cgi" )); diff -Nru libkcddb-15.12.3/libkcddb/httpsubmit.h libkcddb-16.12.1/libkcddb/httpsubmit.h --- libkcddb-15.12.3/libkcddb/httpsubmit.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/httpsubmit.h 2016-12-12 00:51:42.000000000 +0000 @@ -20,7 +20,7 @@ */ #include "submit.h" -#include +#include namespace KCDDB { @@ -33,7 +33,7 @@ protected: virtual KIO::Job* createJob(const CDInfo& cdInfo); - KUrl url_; + QUrl url_; QString from_; } ; } diff -Nru libkcddb-15.12.3/libkcddb/kcddbconfig.cpp libkcddb-16.12.1/libkcddb/kcddbconfig.cpp --- libkcddb-15.12.3/libkcddb/kcddbconfig.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/kcddbconfig.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -20,9 +20,9 @@ Boston, MA 02110-1301, USA. */ -#include +#include -#include +#include namespace KCDDB { @@ -49,7 +49,7 @@ { loadEmailSettings(); - readConfig(); + load(); } } diff -Nru libkcddb-15.12.3/libkcddb/kcddbconfig.h libkcddb-16.12.1/libkcddb/kcddbconfig.h --- libkcddb-15.12.3/libkcddb/kcddbconfig.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/kcddbconfig.h 2016-12-12 00:51:42.000000000 +0000 @@ -23,7 +23,7 @@ #ifndef KCDDB_CONFIG_H #define KCDDB_CONFIG_H -#include +#include #include "configbase.h" namespace KCDDB diff -Nru libkcddb-15.12.3/libkcddb/kcddb.cpp libkcddb-16.12.1/libkcddb/kcddb.cpp --- libkcddb-15.12.3/libkcddb/kcddb.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/kcddb.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -19,7 +19,7 @@ #include "kcddb.h" -#include +#include "kcddbi18n.h" namespace KCDDB { diff -Nru libkcddb-15.12.3/libkcddb/kcddb_export.h libkcddb-16.12.1/libkcddb/kcddb_export.h --- libkcddb-15.12.3/libkcddb/kcddb_export.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/kcddb_export.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2007 David Faure - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef KCDDB_EXPORT_H -#define KCDDB_EXPORT_H - -/* needed for KDE_EXPORT and KDE_IMPORT macros */ -#include - -#ifndef KCDDB_EXPORT -# if defined(MAKE_KCDDB_LIB) - /* We are building this library */ -# define KCDDB_EXPORT KDE_EXPORT -# else - /* We are using this library */ -# define KCDDB_EXPORT KDE_IMPORT -# endif -#endif - -# ifndef KCDDB_EXPORT_DEPRECATED -# define KCDDB_EXPORT_DEPRECATED KDE_DEPRECATED KCDDB_EXPORT -# endif - -#endif diff -Nru libkcddb-15.12.3/libkcddb/kcddb.h libkcddb-16.12.1/libkcddb/kcddb.h --- libkcddb-15.12.3/libkcddb/kcddb.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/kcddb.h 2016-12-12 00:51:42.000000000 +0000 @@ -23,7 +23,7 @@ #include #include -#include +#include namespace KCDDB { diff -Nru libkcddb-15.12.3/libkcddb/kcddbi18n.h libkcddb-16.12.1/libkcddb/kcddbi18n.h --- libkcddb-15.12.3/libkcddb/kcddbi18n.h 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/kcddbi18n.h 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,7 @@ +#ifndef KCDDBI18N_H +#define KCDDBI18N_H + +#define TRANSLATION_DOMAIN "libkcddb" +#include + +#endif // KCDDBI18N_H diff -Nru libkcddb-15.12.3/libkcddb/libkcddb5.kcfg libkcddb-16.12.1/libkcddb/libkcddb5.kcfg --- libkcddb-15.12.3/libkcddb/libkcddb5.kcfg 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/libkcddb5.kcfg 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,67 @@ + + + QtCore/QDir + + + + freedb.freedb.org + + + 80 + + + true + + + true + + + true + + + + + + + HTTP + + + QStringList(QDir::homePath()+QLatin1String("/.cddb/")) + + + + + + + + + HTTP + + + + + freedb.freedb.org + + + 80 + + + 25 + + + + + true + + + + + + + freedb-submit@freedb.org + + + diff -Nru libkcddb-15.12.3/libkcddb/libkcddb.kcfg libkcddb-16.12.1/libkcddb/libkcddb.kcfg --- libkcddb-15.12.3/libkcddb/libkcddb.kcfg 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/libkcddb.kcfg 1970-01-01 00:00:00.000000000 +0000 @@ -1,67 +0,0 @@ - - - QtCore/QDir - - - - freedb.freedb.org - - - 80 - - - true - - - true - - - true - - - - - - - HTTP - - - QStringList(QDir::homePath()+QLatin1String("/.cddb/")) - - - - - - - - - HTTP - - - - - freedb.freedb.org - - - 80 - - - 25 - - - - - true - - - - - - - freedb-submit@freedb.org - - - diff -Nru libkcddb-15.12.3/libkcddb/logging.cpp libkcddb-16.12.1/libkcddb/logging.cpp --- libkcddb-15.12.3/libkcddb/logging.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/logging.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,22 @@ +/* + Copyright (C) 2003-2004 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "logging.h" + +Q_LOGGING_CATEGORY(LIBKCDDB, "libkcddb") diff -Nru libkcddb-15.12.3/libkcddb/logging.h libkcddb-16.12.1/libkcddb/logging.h --- libkcddb-15.12.3/libkcddb/logging.h 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/logging.h 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,26 @@ +#ifndef LOGGING_H +#define LOGGING_H +/* + Copyright (C) 2003 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +Q_DECLARE_LOGGING_CATEGORY(LIBKCDDB) + +#endif // LOGGING_H diff -Nru libkcddb-15.12.3/libkcddb/lookup.cpp libkcddb-16.12.1/libkcddb/lookup.cpp --- libkcddb-15.12.3/libkcddb/lookup.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/lookup.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -21,7 +21,7 @@ #include "lookup.h" -#include +#include namespace KCDDB { diff -Nru libkcddb-15.12.3/libkcddb/lookup.h libkcddb-16.12.1/libkcddb/lookup.h --- libkcddb-15.12.3/libkcddb/lookup.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/lookup.h 2016-12-12 00:51:42.000000000 +0000 @@ -22,11 +22,12 @@ #ifndef KCDDB_LOOKUP_H #define KCDDB_LOOKUP_H +#include +#include + #include #include #include -#include -#include namespace KCDDB { diff -Nru libkcddb-15.12.3/libkcddb/musicbrainz/asyncmusicbrainzlookup.cpp libkcddb-16.12.1/libkcddb/musicbrainz/asyncmusicbrainzlookup.cpp --- libkcddb-15.12.3/libkcddb/musicbrainz/asyncmusicbrainzlookup.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/musicbrainz/asyncmusicbrainzlookup.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -21,10 +21,9 @@ #include "musicbrainzlookup.h" +#include #include -#include - namespace KCDDB { class LookupThread : public QThread @@ -68,7 +67,7 @@ void AsyncMusicBrainzLookup::lookupFinished() { - kDebug() ; + qDebug() ; cdInfoList_ = m_lookupThread->m_lookupResponse; @@ -77,5 +76,3 @@ } // vim:tabstop=2:shiftwidth=2:expandtab:cinoptions=(s,U1,m1 - -#include "asyncmusicbrainzlookup.moc" diff -Nru libkcddb-15.12.3/libkcddb/musicbrainz/asyncmusicbrainzlookup.h libkcddb-16.12.1/libkcddb/musicbrainz/asyncmusicbrainzlookup.h --- libkcddb-15.12.3/libkcddb/musicbrainz/asyncmusicbrainzlookup.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/musicbrainz/asyncmusicbrainzlookup.h 2016-12-12 00:51:42.000000000 +0000 @@ -40,11 +40,11 @@ CDInfoList lookupResponse() const; - signals: + Q_SIGNALS: void finished( KCDDB::Result ); - protected slots: + protected Q_SLOTS: void lookupFinished( ); private: diff -Nru libkcddb-15.12.3/libkcddb/musicbrainz/musicbrainzlookup.cpp libkcddb-16.12.1/libkcddb/musicbrainz/musicbrainzlookup.cpp --- libkcddb-15.12.3/libkcddb/musicbrainz/musicbrainzlookup.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/musicbrainz/musicbrainzlookup.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -17,15 +17,10 @@ Boston, MA 02110-1301, USA. */ - #include "musicbrainzlookup.h" -#include -#include -#include -#include -#include -#include +#include "kcddbi18n.h" + #include #include #include @@ -39,6 +34,14 @@ #include #include +#include + +#include +#include + +#include +#include + namespace KCDDB { MusicBrainzLookup::MusicBrainzLookup() @@ -55,19 +58,19 @@ { QString discId = calculateDiscId(trackOffsetList); - kDebug() << "Should lookup " << discId; + qDebug() << "Should lookup " << discId; MusicBrainz5::CQuery Query("libkcddb-0.5"); // Code adapted from libmusicbrainz/examples/cdlookup.cc try { - MusicBrainz5::CMetadata Metadata=Query.Query("discid",discId.toAscii().constData()); + MusicBrainz5::CMetadata Metadata=Query.Query("discid",discId.toLatin1().constData()); if (Metadata.Disc() && Metadata.Disc()->ReleaseList()) { MusicBrainz5::CReleaseList *ReleaseList=Metadata.Disc()->ReleaseList(); - kDebug() << "Found " << ReleaseList->NumItems() << " release(s)"; + qDebug() << "Found " << ReleaseList->NumItems() << " release(s)"; int relnr=1; @@ -90,22 +93,22 @@ //However, these releases will include information for all media in the release //So we need to filter out the only the media we want. - MusicBrainz5::CMediumList MediaList=FullRelease->MediaMatchingDiscID(discId.toAscii().constData()); + MusicBrainz5::CMediumList MediaList=FullRelease->MediaMatchingDiscID(discId.toLatin1().constData()); if (MediaList.NumItems() > 0) { /*if (FullRelease->ReleaseGroup()) - kDebug() << "Release group title: " << FullRelease->ReleaseGroup()->Title(); + qDebug() << "Release group title: " << FullRelease->ReleaseGroup()->Title(); else - kDebug() << "No release group for this release";*/ + qDebug() << "No release group for this release";*/ - kDebug() << "Found " << MediaList.NumItems() << " media item(s)"; + qDebug() << "Found " << MediaList.NumItems() << " media item(s)"; for (int i=0; i < MediaList.NumItems(); i++) { MusicBrainz5::CMedium* Medium= MediaList.Item(i); - /*kDebug() << "Found media: '" << Medium.Title() << "', position " << Medium.Position();*/ + /*qDebug() << "Found media: '" << Medium.Title() << "', position " << Medium.Position();*/ CDInfo info; info.set(QLatin1String( "source" ), QLatin1String( "musicbrainz" )); @@ -115,7 +118,7 @@ if (relnr == 1) info.set(QLatin1String( "discid" ), discId); else - info.set(QLatin1String( "discid" ), discId+QLatin1String( "-" )+QString::number(relnr)); + info.set(QLatin1String( "discid" ), QVariant(discId+QLatin1String( "-" )+QString::number(relnr))); QString title = QString::fromUtf8(FullRelease->Title().c_str()); @@ -126,7 +129,7 @@ info.set(Artist, artistFromCreditList(FullRelease->ArtistCredit())); QString date = QString::fromUtf8(FullRelease->Date().c_str()); - QRegExp yearRe("^(\\d{4,4})(-\\d{1,2}-\\d{1,2})?$"); + QRegExp yearRe(QString::fromUtf8("^(\\d{4,4})(-\\d{1,2}-\\d{1,2})?$")); int year = 0; if (yearRe.indexIn(date) > -1) { @@ -176,71 +179,71 @@ catch (MusicBrainz5::CConnectionError& Error) { - kDebug() << "Connection Exception: '" << Error.what() << "'"; - kDebug() << "LastResult: " << Query.LastResult(); - kDebug() << "LastHTTPCode: " << Query.LastHTTPCode(); - kDebug() << "LastErrorMessage: " << QString::fromUtf8(Query.LastErrorMessage().c_str()); + qDebug() << "Connection Exception: '" << Error.what() << "'"; + qDebug() << "LastResult: " << Query.LastResult(); + qDebug() << "LastHTTPCode: " << Query.LastHTTPCode(); + qDebug() << "LastErrorMessage: " << QString::fromUtf8(Query.LastErrorMessage().c_str()); return ServerError; } catch (MusicBrainz5::CTimeoutError& Error) { - kDebug() << "Timeout Exception: '" << Error.what() << "'"; - kDebug() << "LastResult: " << Query.LastResult(); - kDebug() << "LastHTTPCode: " << Query.LastHTTPCode(); - kDebug() << "LastErrorMessage: " << QString::fromUtf8(Query.LastErrorMessage().c_str()); + qDebug() << "Timeout Exception: '" << Error.what() << "'"; + qDebug() << "LastResult: " << Query.LastResult(); + qDebug() << "LastHTTPCode: " << Query.LastHTTPCode(); + qDebug() << "LastErrorMessage: " << QString::fromUtf8(Query.LastErrorMessage().c_str()); return ServerError; } catch (MusicBrainz5::CAuthenticationError& Error) { - kDebug() << "Authentication Exception: '" << Error.what() << "'"; - kDebug() << "LastResult: " << Query.LastResult(); - kDebug() << "LastHTTPCode: " << Query.LastHTTPCode(); - kDebug() << "LastErrorMessage: " << QString::fromUtf8(Query.LastErrorMessage().c_str()); + qDebug() << "Authentication Exception: '" << Error.what() << "'"; + qDebug() << "LastResult: " << Query.LastResult(); + qDebug() << "LastHTTPCode: " << Query.LastHTTPCode(); + qDebug() << "LastErrorMessage: " << QString::fromUtf8(Query.LastErrorMessage().c_str()); return ServerError; } catch (MusicBrainz5::CFetchError& Error) { - kDebug() << "Fetch Exception: '" << Error.what() << "'"; - kDebug() << "LastResult: " << Query.LastResult(); - kDebug() << "LastHTTPCode: " << Query.LastHTTPCode(); - kDebug() << "LastErrorMessage: " << QString::fromUtf8(Query.LastErrorMessage().c_str()); + qDebug() << "Fetch Exception: '" << Error.what() << "'"; + qDebug() << "LastResult: " << Query.LastResult(); + qDebug() << "LastHTTPCode: " << Query.LastHTTPCode(); + qDebug() << "LastErrorMessage: " << QString::fromUtf8(Query.LastErrorMessage().c_str()); return ServerError; } catch (MusicBrainz5::CRequestError& Error) { - kDebug() << "Request Exception: '" << Error.what() << "'"; - kDebug() << "LastResult: " << Query.LastResult(); - kDebug() << "LastHTTPCode: " << Query.LastHTTPCode(); - kDebug() << "LastErrorMessage: " << QString::fromUtf8(Query.LastErrorMessage().c_str()); + qDebug() << "Request Exception: '" << Error.what() << "'"; + qDebug() << "LastResult: " << Query.LastResult(); + qDebug() << "LastHTTPCode: " << Query.LastHTTPCode(); + qDebug() << "LastErrorMessage: " << QString::fromUtf8(Query.LastErrorMessage().c_str()); return ServerError; } catch (MusicBrainz5::CResourceNotFoundError& Error) { - kDebug() << "ResourceNotFound Exception: '" << Error.what() << "'"; - kDebug() << "LastResult: " << Query.LastResult(); - kDebug() << "LastHTTPCode: " << Query.LastHTTPCode(); - kDebug() << "LastErrorMessage: " << QString::fromUtf8(Query.LastErrorMessage().c_str()); + qDebug() << "ResourceNotFound Exception: '" << Error.what() << "'"; + qDebug() << "LastResult: " << Query.LastResult(); + qDebug() << "LastHTTPCode: " << Query.LastHTTPCode(); + qDebug() << "LastErrorMessage: " << QString::fromUtf8(Query.LastErrorMessage().c_str()); return ServerError; } if (cdInfoList_.isEmpty()) { - kDebug() << "No record found"; + qDebug() << "No record found"; return NoRecordFound; } - kDebug() << "Query succeeded :-)"; + qDebug() << "Query succeeded :-)"; return Success; } @@ -302,7 +305,7 @@ dir.setNameFilters(QStringList(discid+QLatin1String( "*" ))); QStringList files = dir.entryList(); - kDebug() << "Cache files found: " << files.count(); + qDebug() << "Cache files found: " << files.count(); for (QStringList::iterator it = files.begin(); it != files.end(); ++it) { QFile f( dir.filePath(*it) ); @@ -320,7 +323,7 @@ infoList.append( info ); } else - kDebug() << "Could not read file: " << f.fileName(); + qDebug() << "Could not read file: " << f.fileName(); } } @@ -329,7 +332,7 @@ QString MusicBrainzLookup::artistFromCreditList(MusicBrainz5::CArtistCredit * artistCredit ) { - kDebug() << k_funcinfo; + qDebug()/* << k_funcinfo*/; QString artistName; MusicBrainz5::CNameCreditList *ArtistList=artistCredit->NameCreditList(); @@ -349,7 +352,7 @@ artistName += QString::fromUtf8(Name->JoinPhrase().c_str()); } - kDebug() << "Artist:" << artistName; + qDebug() << "Artist:" << artistName; } @@ -358,5 +361,3 @@ } // vim:tabstop=2:shiftwidth=2:expandtab:cinoptions=(s,U1,m1 - -#include "musicbrainzlookup.moc" diff -Nru libkcddb-15.12.3/libkcddb/sites.cpp libkcddb-16.12.1/libkcddb/sites.cpp --- libkcddb-15.12.3/libkcddb/sites.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/sites.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -19,12 +19,12 @@ #include "sites.h" -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include namespace KCDDB { @@ -36,26 +36,27 @@ QList Sites::siteList() { - KUrl url; - url.setProtocol( QLatin1String( "http" ) ); + QUrl url; + url.setScheme( QLatin1String( "http" ) ); url.setHost( QLatin1String( "freedb.freedb.org" ) ); url.setPort( 80 ); url.setPath( QLatin1String( "/~cddb/cddb.cgi" ) ); - url.setQuery( QString::null ); //krazy:exclude=nullstrassign for old broken gcc - QString hello = QString::fromLatin1("%1 %2 %3 %4") .arg(QLatin1String( "libkcddb-user" ), QLatin1String( "localHost" ), CDDB::clientName(), CDDB::clientVersion()); - url.addQueryItem( QLatin1String( "cmd" ), QLatin1String( "sites" ) ); - url.addQueryItem( QLatin1String( "hello" ), hello ); - url.addQueryItem( QLatin1String( "proto" ), QLatin1String( "5" ) ); + QUrlQuery query; + query.addQueryItem( QLatin1String( "cmd" ), QLatin1String( "sites" ) ); + query.addQueryItem( QLatin1String( "hello" ), hello ); + query.addQueryItem( QLatin1String( "proto" ), QLatin1String( "5" ) ); + url.setQuery( query ); QList result; - KIO::Job* job = KIO::get( url, KIO::NoReload, KIO::HideProgressInfo ); + KIO::TransferJob* job = KIO::get( url, KIO::NoReload, KIO::HideProgressInfo ); QByteArray data; - if( KIO::NetAccess::synchronousRun( job, 0, &data ) ) + QObject::connect( job, &KIO::TransferJob::data, [&data](KIO::Job *, const QByteArray &d){ data += d; } ); + if( job->exec() ) { result = readData( data ); } @@ -103,7 +104,7 @@ m.port = rexp.cap(3).toUInt(); if (m.transport == Lookup::HTTP && rexp.cap(4) != QLatin1String( "/~cddb/cddb.cgi" )) - kWarning() << "Non default urls are not supported for http"; + qWarning() << "Non default urls are not supported for http"; m.description = rexp.cap(5); } diff -Nru libkcddb-15.12.3/libkcddb/sites.h libkcddb-16.12.1/libkcddb/sites.h --- libkcddb-15.12.3/libkcddb/sites.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/sites.h 2016-12-12 00:51:42.000000000 +0000 @@ -20,10 +20,10 @@ #ifndef KCDDB_SITES_H #define KCDDB_SITES_H +#include +#include +#include #include -#include -#include -#include namespace KCDDB { diff -Nru libkcddb-15.12.3/libkcddb/smtpsubmit.cpp libkcddb-16.12.1/libkcddb/smtpsubmit.cpp --- libkcddb-15.12.3/libkcddb/smtpsubmit.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/smtpsubmit.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -18,9 +18,9 @@ */ #include "smtpsubmit.h" +#include "logging.h" -#include -#include +#include namespace KCDDB { @@ -28,11 +28,11 @@ const QString& from, const QString& to) : Submit(), from_(from), to_(to) { - url_.setProtocol(QLatin1String( "smtp" )); + url_.setScheme(QLatin1String( "smtp" )); url_.setHost(hostname); url_.setPort(port); if (!username.isEmpty()) - url_.setUser(username); + url_.setUserName(username); url_.setPath(QLatin1String( "/send" )); } @@ -46,7 +46,7 @@ url_.setQuery(QString::fromLatin1("to=%1&subject=cddb %2 %3&from=%4") .arg(to_, cdInfo.get(Category).toString(), cdInfo.get(QLatin1String( "discid" )).toString(), from_)); - kDebug(60010) << "Url is: " << url_.prettyUrl(); + qCDebug(LIBKCDDB) << "Url is: " << url_.toDisplayString(); return KIO::storedPut(diskData_.toUtf8().data(), url_, -1, KIO::HideProgressInfo); } diff -Nru libkcddb-15.12.3/libkcddb/smtpsubmit.h libkcddb-16.12.1/libkcddb/smtpsubmit.h --- libkcddb-15.12.3/libkcddb/smtpsubmit.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/smtpsubmit.h 2016-12-12 00:51:42.000000000 +0000 @@ -20,7 +20,7 @@ */ #include "submit.h" -#include +#include namespace KCDDB { @@ -35,7 +35,7 @@ virtual KIO::Job* createJob(const CDInfo& cdInfo); - KUrl url_; + QUrl url_; QString from_, to_; } ; } diff -Nru libkcddb-15.12.3/libkcddb/submit.cpp libkcddb-16.12.1/libkcddb/submit.cpp --- libkcddb-15.12.3/libkcddb/submit.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/submit.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -20,8 +20,7 @@ */ #include "submit.h" - -#include +#include "logging.h" namespace KCDDB { @@ -82,7 +81,7 @@ diskData_ += cdInfo.toString(true); - kDebug(60010) << "diskData_ == " << diskData_; + qCDebug(LIBKCDDB) << "diskData_ == " << diskData_; } bool Submit::validCategory( const QString& c ) diff -Nru libkcddb-15.12.3/libkcddb/submit.h libkcddb-16.12.1/libkcddb/submit.h --- libkcddb-15.12.3/libkcddb/submit.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/submit.h 2016-12-12 00:51:42.000000000 +0000 @@ -25,7 +25,7 @@ #include "cddb.h" #include "cdinfo.h" -#include +#include namespace KIO { diff -Nru libkcddb-15.12.3/libkcddb/synccddbplookup.cpp libkcddb-16.12.1/libkcddb/synccddbplookup.cpp --- libkcddb-15.12.3/libkcddb/synccddbplookup.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/synccddbplookup.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -20,10 +20,9 @@ */ #include "synccddbplookup.h" +#include "logging.h" -#include -#include -#include +#include namespace KCDDB { @@ -47,12 +46,13 @@ { trackOffsetList_ = trackOffsetList; - socket_ = KSocketFactory::synchronousConnectToHost(QLatin1String( "cddbp" ), hostName, port); + socket_ = new QTcpSocket; + socket_->connectToHost(hostName, port); - if ( !socket_->isValid() ) + if ( !socket_->waitForConnected(30000) ) { - kDebug(60010) << "Couldn't connect to " << socket_->peerName() << ":" << socket_->peerPort(); - kDebug(60010) << "Socket error: " << socket_->errorString(); + qCDebug(LIBKCDDB) << "Couldn't connect to " << socket_->peerName() << ":" << socket_->peerPort(); + qCDebug(LIBKCDDB) << "Socket error: " << socket_->errorString(); if ( socket_->error() == QAbstractSocket::HostNotFoundError ) return HostNotFound; @@ -77,7 +77,7 @@ if (matchList_.isEmpty()) return NoRecordFound; - kDebug(60010) << matchList_.count() << " matches found."; + qCDebug(LIBKCDDB) << matchList_.count() << " matches found."; // For each match, read the cd info from the server and save it to // cdInfoList. @@ -186,7 +186,7 @@ { if ( !isConnected() ) { - kDebug(60010) << "socket status: " << socket_->state(); + qCDebug(LIBKCDDB) << "socket status: " << socket_->state(); return QString(); } diff -Nru libkcddb-15.12.3/libkcddb/synchttplookup.cpp libkcddb-16.12.1/libkcddb/synchttplookup.cpp --- libkcddb-15.12.3/libkcddb/synchttplookup.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/synchttplookup.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -19,13 +19,9 @@ */ #include "synchttplookup.h" +#include "logging.h" -#include -#include - -#include -#include -#include +#include namespace KCDDB { @@ -57,7 +53,7 @@ if ( Success != result_ ) return result_; - kDebug(60010) << matchList_.count() << " matches found."; + qCDebug(LIBKCDDB) << matchList_.count() << " matches found."; if (matchList_.isEmpty()) return NoRecordFound; @@ -87,7 +83,7 @@ if ( Success != result_ ) return result_; - kDebug(60010) << "runQuery() Result: " << resultToString(result_); + qCDebug(LIBKCDDB) << "runQuery() Result: " << resultToString(result_); return result_; } @@ -109,14 +105,16 @@ Result SyncHTTPLookup::fetchURL() { - kDebug(60010) << "About to fetch: " << cgiURL_.url(); + qCDebug(LIBKCDDB) << "About to fetch: " << cgiURL_.url(); KIO::TransferJob* job = KIO::get( cgiURL_, KIO::NoReload, KIO::HideProgressInfo ); if ( 0 == job ) return ServerError; - if (!KIO::NetAccess::synchronousRun(job, 0, &data_)) + QObject::connect( job, &KIO::TransferJob::data, [&](KIO::Job *, const QByteArray &data){ data_ += data; } ); + + if (!job->exec()) return ServerError; jobFinished(); diff -Nru libkcddb-15.12.3/libkcddb/synchttpsubmit.cpp libkcddb-16.12.1/libkcddb/synchttpsubmit.cpp --- libkcddb-15.12.3/libkcddb/synchttpsubmit.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/synchttpsubmit.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -19,8 +19,7 @@ #include "synchttpsubmit.h" -#include -#include +#include namespace KCDDB { @@ -37,9 +36,7 @@ Result SyncHTTPSubmit::runJob(KIO::Job* job) { - bool success = KIO::NetAccess::synchronousRun(job, 0); - - if (success) + if (job->exec()) return Success; else return UnknownError; diff -Nru libkcddb-15.12.3/libkcddb/syncsmtpsubmit.cpp libkcddb-16.12.1/libkcddb/syncsmtpsubmit.cpp --- libkcddb-15.12.3/libkcddb/syncsmtpsubmit.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/libkcddb/syncsmtpsubmit.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -21,8 +21,7 @@ #include "cdinfo.h" -#include -#include +#include namespace KCDDB { @@ -40,7 +39,7 @@ Result SyncSMTPSubmit::runJob(KIO::Job* job) { - if ( KIO::NetAccess::synchronousRun(job, 0) ) + if ( job->exec() ) return Success; return UnknownError; diff -Nru libkcddb-15.12.3/test/asynccddblookuptest.cpp libkcddb-16.12.1/test/asynccddblookuptest.cpp --- libkcddb-15.12.3/test/asynccddblookuptest.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/asynccddblookuptest.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,119 +0,0 @@ -/* - Copyright (C) 2006 Richard Lärkäng - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include "asynccddblookuptest.h" -#include "libkcddb/cache.h" -#include "libkcddb/lookup.h" - -void AsyncCDDBLookupTest::testLookup() -{ - using namespace KCDDB; - - client_ = new Client; - client_->config().setHostname("freedb.freedb.org"); - client_->config().setPort(8880); - client_->config().setCacheLookupEnabled(false); - client_->config().setFreedbLookupEnabled(true); - client_->config().setMusicBrainzLookupEnabled(false); - client_->config().setFreedbLookupTransport(Lookup::CDDBP); - client_->setBlockingMode( false ); - - connect(client_,SIGNAL(finished(KCDDB::Result)),SLOT(slotFinished(KCDDB::Result))); - - TrackOffsetList list; - - // a1107d0a - Kruder & Dorfmeister - The K&D Sessions - Disc One. - list - << 150 // First track start. - << 29462 - << 66983 - << 96785 - << 135628 - << 168676 - << 194147 - << 222158 - << 247076 - << 278203 // Last track start. - << 316732; // Disc end. - - client_->lookup(list); - - m_eventLoop.exec(QEventLoop::ExcludeUserInputEvents); - - delete client_; - - QVERIFY(m_result == Success); - - // If revision doesn't match, test probably needs to be updated - // See: http://www.freedb.org/freedb/jazz/a1107d0a for updated data - QCOMPARE(m_info.get("revision").toInt(), 7); - - QCOMPARE(m_info.get(Artist).toString(),QString("Kruder & Dorfmeister")); - QCOMPARE(m_info.get(Title).toString(),QString("The K&D Sessions (Part One)")); - QCOMPARE(m_info.get(Genre).toString(),QString("Trip-Hop")); - QCOMPARE(m_info.get(Year).toInt(),1998); - QCOMPARE(m_info.track(0).get(Title).toString(),QString("Roni Size - Heroes (Kruder's Long Loose Bossa remixed by Peter Kruder)")); - QCOMPARE(m_info.track(1).get(Title).toString(),QString("Alex Reece - Jazz Master (K&D Session)")); - QCOMPARE(m_info.track(2).get(Title).toString(),QString("Count Basic - Speechless (Drum 'n' Bass remixed by Peter Kruder)")); - QCOMPARE(m_info.track(3).get(Title).toString(),QString("Rockers Hi-Fi - Going Under (K&D Session)")); - QCOMPARE(m_info.track(4).get(Title).toString(),QString("Bomb The Bass - Bug Powder Dust (K&D Session)")); - QCOMPARE(m_info.track(5).get(Title).toString(),QString("Aphrodelics - Rollin' On Chrome (Wild Motherfucker Dub remixed by Richard Dorfmeister)")); - QCOMPARE(m_info.track(6).get(Title).toString(),QString("Depeche Mode - Useless (K&D Session)")); - QCOMPARE(m_info.track(7).get(Title).toString(),QString("Count Basic - Gotta Jazz (remixed by Richard Dorfmeister)")); - QCOMPARE(m_info.track(8).get(Title).toString(),QString("Rainer Truby Trio - Donaueschingen (Peter Kruder's Donaudampfschifffahrtsgesellschaftskapitnskajtenremix)")); - QCOMPARE(m_info.track(9).get(Title).toString(),QString("Lamb - Trans Fatty Acid (K&D Session)")); - QCOMPARE(m_info.track(0).get(Artist).toString(),QString("Kruder & Dorfmeister")); - QCOMPARE(m_info.track(1).get(Artist).toString(),QString("Kruder & Dorfmeister")); - QCOMPARE(m_info.track(2).get(Artist).toString(),QString("Kruder & Dorfmeister")); - QCOMPARE(m_info.track(3).get(Artist).toString(),QString("Kruder & Dorfmeister")); - QCOMPARE(m_info.track(4).get(Artist).toString(),QString("Kruder & Dorfmeister")); - QCOMPARE(m_info.track(5).get(Artist).toString(),QString("Kruder & Dorfmeister")); - QCOMPARE(m_info.track(6).get(Artist).toString(),QString("Kruder & Dorfmeister")); - QCOMPARE(m_info.track(7).get(Artist).toString(),QString("Kruder & Dorfmeister")); - QCOMPARE(m_info.track(8).get(Artist).toString(),QString("Kruder & Dorfmeister")); - QCOMPARE(m_info.track(9).get(Artist).toString(),QString("Kruder & Dorfmeister")); -} - - void -AsyncCDDBLookupTest::slotFinished(Result r) -{ - m_result = r; - kDebug() << "AsyncCDDBLookupTest::slotResult: Got " << KCDDB::resultToString(r); - - CDInfoList l = client_->lookupResponse(); - - kDebug() << "AsyncCDDBLookupTest::slotResult: Item count: " << l.count(); - - foreach(const CDInfo &i, l) - { - if (i.get("discid") == "a1107d0a" && i.get(Category) == "jazz") - { - kDebug() << "Found the CD"; - m_info = i; - break; - } - } - - m_eventLoop.quit(); -} - -QTEST_KDEMAIN(AsyncCDDBLookupTest, NoGUI) - -#include "asynccddblookuptest.moc" diff -Nru libkcddb-15.12.3/test/asynccddblookuptest.h libkcddb-16.12.1/test/asynccddblookuptest.h --- libkcddb-15.12.3/test/asynccddblookuptest.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/asynccddblookuptest.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -/* - Copyright (C) 2003 Richard Lärkäng - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef TEST_H -#define TEST_H - -#include -#include -#include -#include - -using namespace KCDDB; - -class AsyncCDDBLookupTest : public QObject -{ - Q_OBJECT - private slots: - void testLookup(); - void slotFinished(KCDDB::Result); - - private: - - QEventLoop m_eventLoop; - KCDDB::Client * client_; - CDInfo m_info; - Result m_result; -}; - -#endif diff -Nru libkcddb-15.12.3/test/asynchttplookuptest.cpp libkcddb-16.12.1/test/asynchttplookuptest.cpp --- libkcddb-15.12.3/test/asynchttplookuptest.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/asynchttplookuptest.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,120 +0,0 @@ -/* - Copyright (C) 2006 Richard Lärkäng - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - - -#include -#include "asynchttplookuptest.h" -#include "libkcddb/cache.h" -#include "libkcddb/lookup.h" - -void AsyncHTTPLookupTest::testLookup() -{ - using namespace KCDDB; - - client_ = new Client; - client_->config().setHostname("freedb.freedb.org"); - client_->config().setPort(80); - client_->config().setCacheLookupEnabled(false); - client_->config().setFreedbLookupEnabled(true); - client_->config().setMusicBrainzLookupEnabled(false); - client_->config().setFreedbLookupTransport(Lookup::HTTP); - client_->setBlockingMode( false ); - - connect(client_, SIGNAL(finished(KCDDB::Result)), SLOT(slotFinished(KCDDB::Result))); - - TrackOffsetList list; - - // a1107d0a - Kruder & Dorfmeister - The K&D Sessions - Disc One. - list - << 150 // First track start. - << 29462 - << 66983 - << 96785 - << 135628 - << 168676 - << 194147 - << 222158 - << 247076 - << 278203 // Last track start. - << 316732; // Disc end. - - client_->lookup(list); - - m_eventLoop.exec(QEventLoop::ExcludeUserInputEvents); - - delete client_; - - QVERIFY(m_result == Success); - - // If revision doesn't match, test probably needs to be updated - // See: http://www.freedb.org/freedb/jazz/a1107d0a for updated data - QCOMPARE(m_info.get("revision").toInt(), 7); - - QCOMPARE(m_info.get(Artist).toString(),QString("Kruder & Dorfmeister")); - QCOMPARE(m_info.get(Title).toString(),QString("The K&D Sessions (Part One)")); - QCOMPARE(m_info.get(Genre).toString(),QString("Trip-Hop")); - QCOMPARE(m_info.get(Year).toInt(),1998); - QCOMPARE(m_info.track(0).get(Title).toString(),QString("Roni Size - Heroes (Kruder's Long Loose Bossa remixed by Peter Kruder)")); - QCOMPARE(m_info.track(1).get(Title).toString(),QString("Alex Reece - Jazz Master (K&D Session)")); - QCOMPARE(m_info.track(2).get(Title).toString(),QString("Count Basic - Speechless (Drum 'n' Bass remixed by Peter Kruder)")); - QCOMPARE(m_info.track(3).get(Title).toString(),QString("Rockers Hi-Fi - Going Under (K&D Session)")); - QCOMPARE(m_info.track(4).get(Title).toString(),QString("Bomb The Bass - Bug Powder Dust (K&D Session)")); - QCOMPARE(m_info.track(5).get(Title).toString(),QString("Aphrodelics - Rollin' On Chrome (Wild Motherfucker Dub remixed by Richard Dorfmeister)")); - QCOMPARE(m_info.track(6).get(Title).toString(),QString("Depeche Mode - Useless (K&D Session)")); - QCOMPARE(m_info.track(7).get(Title).toString(),QString("Count Basic - Gotta Jazz (remixed by Richard Dorfmeister)")); - QCOMPARE(m_info.track(8).get(Title).toString(),QString("Rainer Truby Trio - Donaueschingen (Peter Kruder's Donaudampfschifffahrtsgesellschaftskapitnskajtenremix)")); - QCOMPARE(m_info.track(9).get(Title).toString(),QString("Lamb - Trans Fatty Acid (K&D Session)")); - QCOMPARE(m_info.track(0).get(Artist).toString(),QString("Kruder & Dorfmeister")); - QCOMPARE(m_info.track(1).get(Artist).toString(),QString("Kruder & Dorfmeister")); - QCOMPARE(m_info.track(2).get(Artist).toString(),QString("Kruder & Dorfmeister")); - QCOMPARE(m_info.track(3).get(Artist).toString(),QString("Kruder & Dorfmeister")); - QCOMPARE(m_info.track(4).get(Artist).toString(),QString("Kruder & Dorfmeister")); - QCOMPARE(m_info.track(5).get(Artist).toString(),QString("Kruder & Dorfmeister")); - QCOMPARE(m_info.track(6).get(Artist).toString(),QString("Kruder & Dorfmeister")); - QCOMPARE(m_info.track(7).get(Artist).toString(),QString("Kruder & Dorfmeister")); - QCOMPARE(m_info.track(8).get(Artist).toString(),QString("Kruder & Dorfmeister")); - QCOMPARE(m_info.track(9).get(Artist).toString(),QString("Kruder & Dorfmeister")); -} - - void -AsyncHTTPLookupTest::slotFinished(Result r) -{ - m_result = r; - kDebug() << "AsyncHTTPLookupTest::slotFinished: Got " << KCDDB::resultToString(r); - - CDInfoList l = client_->lookupResponse(); - - kDebug() << "AsyncHTTPLookupTest::slotFinished: Item count: " << l.count(); - - foreach(const CDInfo &i, l) - { - if (i.get("discid") == "a1107d0a" && i.get(Category) == "jazz") - { - kDebug() << "Found the CD"; - m_info = i; - break; - } - } - - m_eventLoop.quit(); -} - -QTEST_KDEMAIN(AsyncHTTPLookupTest, NoGUI) - -#include "asynchttplookuptest.moc" diff -Nru libkcddb-15.12.3/test/asynchttplookuptest.h libkcddb-16.12.1/test/asynchttplookuptest.h --- libkcddb-15.12.3/test/asynchttplookuptest.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/asynchttplookuptest.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -/* - Copyright (C) 2003 Richard Lärkäng - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef TEST_H -#define TEST_H - -#include -#include -#include -#include - -using namespace KCDDB; - -class AsyncHTTPLookupTest : public QObject -{ - Q_OBJECT - private slots: - void testLookup(); - void slotFinished(KCDDB::Result); - - private: - - QEventLoop m_eventLoop; - KCDDB::Client * client_; - CDInfo m_info; - Result m_result; -}; - -#endif diff -Nru libkcddb-15.12.3/test/asynchttpsubmittest.cpp libkcddb-16.12.1/test/asynchttpsubmittest.cpp --- libkcddb-15.12.3/test/asynchttpsubmittest.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/asynchttpsubmittest.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,87 +0,0 @@ -/* - Copyright (C) 2006 Richard Lärkäng - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include -#include - -#include "asynchttpsubmittest.h" -#include "libkcddb/submit.h" - -AsyncHTTPSubmitTest::AsyncHTTPSubmitTest() - : QObject() -{ - using namespace KCDDB; - - client_ = new Client; - client_->config().setFreedbSubmitTransport(Submit::HTTP); - client_->setBlockingMode( false ); - - TrackOffsetList list; - - list - << 150 // First track start. - << 2592 - << 35472 - << 47891 - << 123310 - << 133125; // Disc end. - - CDInfo cdInfo; - - cdInfo.set("discid", "3606ed05"); - cdInfo.set("revision", 4); - cdInfo.set("title", "Bamse och Bronto"); - cdInfo.set("artist", "Musiksage"); - cdInfo.set("year", 2001); - cdInfo.set("category", "misc"); - cdInfo.set("genre", "Barnsaga"); - cdInfo.set("extd", QString::fromUtf8("Berättare: Olof Thunberg")); - - cdInfo.track(0).set("title", "Bamses signaturmelodi"); - cdInfo.track(1).set("title","*"); - cdInfo.track(2).set("title", "Brummavisan"); - cdInfo.track(3).set("title", "*"); - cdInfo.track(4).set("title", QString::fromUtf8("Jätteödlan Bronto")); - - connect(client_,SIGNAL(finished(KCDDB::Result)),SLOT(slotFinished(KCDDB::Result))); - - client_->submit(cdInfo, list); -} - - void -AsyncHTTPSubmitTest::slotFinished(Result r) -{ - kDebug() << "AsyncHTTPSubmitTest::slotFinished: Got " << KCDDB::resultToString(r); - - kapp->quit(); -} - -int main(int argc, char ** argv) -{ - KCmdLineArgs::init(argc, argv, "libkcddb_test", 0, KLocalizedString(), ""); - - KApplication app(false); - - new AsyncHTTPSubmitTest; - - return app.exec(); -} - -#include "asynchttpsubmittest.moc" diff -Nru libkcddb-15.12.3/test/asynchttpsubmittest.h libkcddb-16.12.1/test/asynchttpsubmittest.h --- libkcddb-15.12.3/test/asynchttpsubmittest.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/asynchttpsubmittest.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -/* - Copyright (C) 2004 Richard Lärkäng - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef TEST_H -#define TEST_H - -#include -#include - -using namespace KCDDB; - -class AsyncHTTPSubmitTest : public QObject -{ - Q_OBJECT - - public: - AsyncHTTPSubmitTest(); - - public slots: - - void slotFinished(KCDDB::Result); - - private: - - KCDDB::Client * client_; -}; - -#endif diff -Nru libkcddb-15.12.3/test/asyncmusicbrainztest.cpp libkcddb-16.12.1/test/asyncmusicbrainztest.cpp --- libkcddb-15.12.3/test/asyncmusicbrainztest.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/asyncmusicbrainztest.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,158 +0,0 @@ -/* - Copyright (C) 2006 Richard Lärkäng - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - - -#include -#include "asyncmusicbrainztest.h" -#include "libkcddb/cache.h" -#include "libkcddb/lookup.h" -#include "config-musicbrainz.h" - -void AsyncMusicBrainzTest::testLookup() -{ - using namespace KCDDB; - -#ifndef HAVE_MUSICBRAINZ5 - QSKIP("This test requires libmusicbrainz", SkipAll); -#endif - - client_ = new Client; - client_->config().setCacheLookupEnabled(false); - client_->config().setFreedbLookupEnabled(false); - client_->config().setMusicBrainzLookupEnabled(true); - client_->setBlockingMode( false ); - - connect(client_,SIGNAL(finished(KCDDB::Result)),SLOT(slotFinished(KCDDB::Result))); - - TrackOffsetList list; - - // Various Artists / Definitivt 50 Spänn 10 - list - << 150 - << 17130 - << 26340 - << 44855 - << 60530 - << 75800 - << 90182 - << 106605 - << 122995 - << 139005 - << 153317 - << 167967 - << 179012 - << 190190 - << 202162 - << 211312 - << 229037 - << 240035; - - client_->lookup(list); - - m_eventLoop.exec(QEventLoop::ExcludeUserInputEvents); - - QVERIFY(m_result == Success); - - // See http://musicbrainz.org/release/dbb3e39a-4bea-4e32-a546-456654f30ca6.html for changes - QCOMPARE(m_info.numberOfTracks(),17); - - QCOMPARE(m_info.get(Artist).toString(),QString("Various Artists")); - QCOMPARE(m_info.get(Title).toString(),QString::fromUtf8("Definitivt 50 spänn 10")); - // genre not really supported for musicbrainz - QCOMPARE(m_info.get(Genre).toString(),QString()); - QCOMPARE(m_info.get(Year).toInt(),2001); - QCOMPARE(m_info.track(0).get(Title).toString(),QString::fromUtf8("Uphill Struggle")); - QCOMPARE(m_info.track(1).get(Title).toString(),QString::fromUtf8("Vill du bli miljonär?")); - QCOMPARE(m_info.track(2).get(Title).toString(),QString::fromUtf8("Här är jag")); - QCOMPARE(m_info.track(3).get(Title).toString(),QString::fromUtf8("Århundradets fest")); - QCOMPARE(m_info.track(4).get(Title).toString(),QString::fromUtf8("Vem valde mittemellan")); - QCOMPARE(m_info.track(5).get(Title).toString(),QString::fromUtf8("Hippieambulansen")); - QCOMPARE(m_info.track(6).get(Title).toString(),QString::fromUtf8("Jonsson")); - QCOMPARE(m_info.track(7).get(Title).toString(),QString::fromUtf8("Jag lämnar filmen")); - QCOMPARE(m_info.track(8).get(Title).toString(),QString::fromUtf8("39 Steg")); - QCOMPARE(m_info.track(9).get(Title).toString(),QString::fromUtf8("Lyckliga land")); - QCOMPARE(m_info.track(10).get(Title).toString(),QString::fromUtf8("Helpless")); - QCOMPARE(m_info.track(11).get(Title).toString(),QString::fromUtf8("Tunna skivor")); - QCOMPARE(m_info.track(12).get(Title).toString(),QString::fromUtf8("God läskeblask")); - QCOMPARE(m_info.track(13).get(Title).toString(),QString::fromUtf8("Hur snygg é du då?")); - QCOMPARE(m_info.track(14).get(Title).toString(),QString::fromUtf8("Självupptagen")); - QCOMPARE(m_info.track(15).get(Title).toString(),QString::fromUtf8("Sound Is Compressed; Words Rebel and Hiss")); - QCOMPARE(m_info.track(16).get(Title).toString(),QString::fromUtf8("Vi är på väg")); - QCOMPARE(m_info.track(0).get(Artist).toString(),QString::fromUtf8("Adhesive")); - QCOMPARE(m_info.track(1).get(Artist).toString(),QString::fromUtf8("Troublemakers")); - QCOMPARE(m_info.track(2).get(Artist).toString(),QString::fromUtf8("Mimikry")); - QCOMPARE(m_info.track(3).get(Artist).toString(),QString::fromUtf8("Lundberg & Dellamorte")); - QCOMPARE(m_info.track(4).get(Artist).toString(),QString::fromUtf8("Charta 77")); - QCOMPARE(m_info.track(5).get(Artist).toString(),QString::fromUtf8("UBBA")); - QCOMPARE(m_info.track(6).get(Artist).toString(),QString::fromUtf8("Coca Carola")); - QCOMPARE(m_info.track(7).get(Artist).toString(),QString::fromUtf8("Spoiler")); - QCOMPARE(m_info.track(8).get(Artist).toString(),QString::fromUtf8("Strebers")); - QCOMPARE(m_info.track(9).get(Artist).toString(),QString::fromUtf8("Iguana Party")); - QCOMPARE(m_info.track(10).get(Artist).toString(),QString::fromUtf8("Stoned")); - QCOMPARE(m_info.track(11).get(Artist).toString(),QString::fromUtf8("Per Bertil Birgers orkester")); - QCOMPARE(m_info.track(12).get(Artist).toString(),QString::fromUtf8("Slutstation Tjernobyl")); - QCOMPARE(m_info.track(13).get(Artist).toString(),QString::fromUtf8("SBD")); - QCOMPARE(m_info.track(14).get(Artist).toString(),QString::fromUtf8("Skumdum")); - QCOMPARE(m_info.track(15).get(Artist).toString(),QString::fromUtf8("Text")); - QCOMPARE(m_info.track(16).get(Artist).toString(),QString::fromUtf8("Ohlson Har Semester Production")); - // comments not supported in a simple way - for (int j=0; j < 17; j++) - QCOMPARE(m_info.track(j).get(Comment).toString(),QString()); - - // Make sure it's the same when loaded from the cache again - client_->config().setCacheLookupEnabled(true); - client_->config().setFreedbLookupEnabled(false); - client_->config().setMusicBrainzLookupEnabled(false); - client_->setBlockingMode(true); - - client_->lookup(list); - - CDInfoList response = client_->lookupResponse(); - QVERIFY(response.count() > 0); - - CDInfo cacheInfo(response.first()); - QCOMPARE(m_info.get(Artist).toString(),cacheInfo.get(Artist).toString()); - QCOMPARE(m_info.get(Title).toString(),cacheInfo.get(Title).toString()); - QCOMPARE(m_info.get(Year).toInt(),cacheInfo.get(Year).toInt()); - for (int j=0; j < 17; j++) - { - QCOMPARE(m_info.track(j).get(Title).toString(),cacheInfo.track(j).get(Title).toString()); - QCOMPARE(m_info.track(j).get(Comment).toString(),cacheInfo.track(j).get(Comment).toString()); - } -} - - void -AsyncMusicBrainzTest::slotFinished(Result r) -{ - m_result = r; - kDebug() << ": Got " << KCDDB::resultToString(r); - - CDInfoList l = client_->lookupResponse(); - - kDebug() << ": Item count: " << l.count(); - - QVERIFY(l.count() > 0); - m_info = l.first(); - - m_eventLoop.quit(); -} - -QTEST_KDEMAIN(AsyncMusicBrainzTest, NoGUI) - -#include "asyncmusicbrainztest.moc" diff -Nru libkcddb-15.12.3/test/asyncmusicbrainztest.h libkcddb-16.12.1/test/asyncmusicbrainztest.h --- libkcddb-15.12.3/test/asyncmusicbrainztest.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/asyncmusicbrainztest.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -/* - Copyright (C) 2006 Richard Lärkäng - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef TEST_H -#define TEST_H - -#include -#include -#include -#include - -using namespace KCDDB; - -class AsyncMusicBrainzTest : public QObject -{ - Q_OBJECT - private slots: - void testLookup(); - void slotFinished(KCDDB::Result); - - private: - - QEventLoop m_eventLoop; - KCDDB::Client * client_; - CDInfo m_info; - Result m_result; -}; - -#endif diff -Nru libkcddb-15.12.3/test/asyncsmtpsubmittest.cpp libkcddb-16.12.1/test/asyncsmtpsubmittest.cpp --- libkcddb-15.12.3/test/asyncsmtpsubmittest.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/asyncsmtpsubmittest.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,88 +0,0 @@ -/* - Copyright (C) 2006 Richard Lärkäng - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include -#include - -#include "asyncsmtpsubmittest.h" -#include "libkcddb/submit.h" - -AsyncSMTPSubmitTest::AsyncSMTPSubmitTest() - : QObject() -{ - using namespace KCDDB; - - client_ = new Client; - client_->config().setFreedbSubmitTransport(Submit::SMTP); - client_->config().setSubmitAddress("test-submit@freedb.org"); - client_->setBlockingMode( false ); - - TrackOffsetList list; - - list - << 150 // First track start. - << 2592 - << 35472 - << 47891 - << 123310 - << 133125; // Disc end. - - CDInfo cdInfo; - - cdInfo.set("discid", "3606ed05"); - cdInfo.set("revision", 4); - cdInfo.set("title", "Bamse och Bronto"); - cdInfo.set("artist", "Musiksage"); - cdInfo.set("year", 2001); - cdInfo.set("category", "misc"); - cdInfo.set("genre", "Barnsaga"); - cdInfo.set("extd", QString::fromUtf8("Berättare: Olof Thunberg")); - - cdInfo.track(0).set("title", "Bamses signaturmelodi"); - cdInfo.track(1).set("title","*"); - cdInfo.track(2).set("title", "Brummavisan"); - cdInfo.track(3).set("title", "*"); - cdInfo.track(4).set("title", QString::fromUtf8("Jätteödlan Bronto")); - - connect(client_,SIGNAL(finished(KCDDB::Result)),SLOT(slotFinished(KCDDB::Result))); - - client_->submit(cdInfo, list); -} - - void -AsyncSMTPSubmitTest::slotFinished(Result r) -{ - kDebug() << "AsyncSMTPSubmitTest::slotFinished: Got " << KCDDB::resultToString(r); - - kapp->quit(); -} - -int main(int argc, char ** argv) -{ - KCmdLineArgs::init(argc, argv, "libkcddb_test", 0, KLocalizedString(), ""); - - KApplication app(false); - - new AsyncSMTPSubmitTest; - - return app.exec(); -} - -#include "asyncsmtpsubmittest.moc" diff -Nru libkcddb-15.12.3/test/asyncsmtpsubmittest.h libkcddb-16.12.1/test/asyncsmtpsubmittest.h --- libkcddb-15.12.3/test/asyncsmtpsubmittest.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/asyncsmtpsubmittest.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -/* - Copyright (C) 2003 Richard Lärkäng - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef TEST_H -#define TEST_H - -#include -#include - -using namespace KCDDB; - -class AsyncSMTPSubmitTest : public QObject -{ - Q_OBJECT - - public: - AsyncSMTPSubmitTest(); - - public slots: - - void slotFinished(KCDDB::Result); - - private: - - KCDDB::Client * client_; -}; - -#endif diff -Nru libkcddb-15.12.3/test/cachetest.cpp libkcddb-16.12.1/test/cachetest.cpp --- libkcddb-15.12.3/test/cachetest.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/cachetest.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,134 +0,0 @@ -/* - Copyright (C) 2007 Richard Lärkäng - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "cachetest.h" -#include "libkcddb/cache.h" - -#include -#include "libkcddb/cdinfo.h" -#include "libkcddb/client.h" -#include "config-musicbrainz.h" - -using namespace KCDDB; - -void CacheTest::initTestCase() -{ - m_client = new Client; - m_client->config().setCacheLocations(QStringList(QDir::homePath()+"/.cddbTest/")); - - // a1107d0a - m_list - << 150 // First track start. - << 29462 - << 66983 - << 96785 - << 135628 - << 168676 - << 194147 - << 222158 - << 247076 - << 278203 // Last track start. - << 316732; // Disc end. - - m_info.set(Artist, QString().leftJustified(10, QChar(0xe4))); - m_info.set(Title, QString().leftJustified(10, QChar(0xf6))); - - for (int i=0; i<10; i++) - { - m_info.track(i).set(Title, QString().leftJustified(30*(i+1), 'a'+i)); - } - -} - -void CacheTest::cleanupTestCase() -{ - QDir().rmdir(QDir::homePath()+"/.cddbTest/"); -} - -bool CacheTest::verify(const QString& source, const QString& discid, const CDInfo& info) -{ - Cache::store(m_list, info, m_client->config()); - - CDInfoList results = Cache::lookup(m_list, m_client->config()); - foreach(const CDInfo &newInfo, results) - { - if (newInfo.get("source") == source && newInfo.get("discid").toString() == discid) - { - if (newInfo.get(Artist) != m_info.get(Artist)) - continue; - if (newInfo.get(Title) != m_info.get(Title)) - continue; - bool tracksOk = true; - for (int i=0; i < 10; i++) - { - if (newInfo.track(i).get(Title) != m_info.track(i).get(Title)) - { - tracksOk = false; - break; - } - } - - if (tracksOk) - return true; - } - } - return false; -} - -void CacheTest::testFreedb() -{ - CDInfo testInfo = m_info; - testInfo.set("source", "freedb"); - testInfo.set("discid", "a1107d0a"); - testInfo.set("category", "misc"); - - QVERIFY(verify("freedb", "a1107d0a", testInfo)); - - QFile::remove(QDir::homePath()+"/.cddbTest/misc/a1107d0a"); - QDir().rmdir(QDir::homePath()+"/.cddbTest/misc/"); -} - -void CacheTest::testUser() -{ - CDInfo testInfo = m_info; - testInfo.set("source", "user"); - - QVERIFY(verify("user", "a1107d0a", testInfo)); - - QFile::remove(QDir::homePath()+"/.cddbTest/user/a1107d0a"); - QDir().rmdir(QDir::homePath()+"/.cddbTest/user/"); -} - -void CacheTest::testMusicbrainz() -{ -#ifdef HAVE_MUSICBRAINZ5 - CDInfo testInfo = m_info; - testInfo.set("source", "musicbrainz"); - testInfo.set("discid", "wdABQ7s86gS7eVmS74CCQ6KwPUI-"); - - QVERIFY(verify("musicbrainz", "wdABQ7s86gS7eVmS74CCQ6KwPUI-", testInfo)); - - QFile::remove(QDir::homePath()+"/.cddbTest/musicbrainz/wdABQ7s86gS7eVmS74CCQ6KwPUI-"); - QDir().rmdir(QDir::homePath()+"/.cddbTest/musicbrainz/"); -#endif -} - -QTEST_KDEMAIN(CacheTest, NoGUI) - -#include "cachetest.moc" diff -Nru libkcddb-15.12.3/test/cachetest.h libkcddb-16.12.1/test/cachetest.h --- libkcddb-15.12.3/test/cachetest.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/cachetest.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -/* - Copyright (C) 2007 Richard Lärkäng - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef CACHETEST_H -#define CACHETEST_H - -#include "libkcddb/cdinfo.h" -#include "libkcddb/kcddb.h" - -namespace KCDDB -{ - class Client; -} - -#include - -class CacheTest : public QObject -{ - Q_OBJECT -private slots: - void initTestCase(); - void cleanupTestCase(); - void testFreedb(); - void testUser(); - void testMusicbrainz(); -private: - bool verify(const QString& source, const QString& discid, const KCDDB::CDInfo& info); - - KCDDB::Client* m_client; - KCDDB::CDInfo m_info; - KCDDB::TrackOffsetList m_list; -}; - -#endif diff -Nru libkcddb-15.12.3/test/cdinfotest.cpp libkcddb-16.12.1/test/cdinfotest.cpp --- libkcddb-15.12.3/test/cdinfotest.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/cdinfotest.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,93 +0,0 @@ -/* - Copyright (C) 2005-2006 Richard Lärkäng - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include -#include "libkcddb/cdinfo.h" -#include "cdinfotest.h" - -using namespace KCDDB; - -void CDInfoTest::testLongLines() -{ - CDInfo info; - - QString str; - - TrackInfo& tinfo = info.track(0); - - for (int i=0; i <= 100; i++) - { - str.fill('A',10*i); - info.set(Title, str); - str.fill('B',10*i); - str.append('\n'); - info.set(Comment, str); - str.fill('C',10*i); - info.set(Artist, str); - str.fill('D',10*i); - info.set(Genre, str); - str.fill('E',10*i); - info.set(Length, str); - str.fill('F',10*i); - str.append('\n'); - info.set("custom", str); - str.fill('G',10*i); - tinfo.set(Title, str); - str.fill('H',10*i); - str.append('\n'); - tinfo.set("custom", str); - QString data = info.toString(); - QString submitData = info.toString(true); - - CDInfo info2; - info2.load(data); - str.fill('A',10*i); - QCOMPARE(info2.get(Title).toString(), str); - str.fill('B',10*i); - str.append('\n'); - QCOMPARE(info2.get(Comment).toString(), str); - str.fill('C',10*i); - QCOMPARE(info2.get(Artist).toString(), str); - str.fill('D',10*i); - if (i == 0) - QCOMPARE(info2.get(Genre).toString(), QString("Unknown")); - else - QCOMPARE(info2.get(Genre).toString(), str); - str.fill('E',10*i); - QCOMPARE(info2.get(Length).toString(), str); - str.fill('F',10*i); - str.append('\n'); - QCOMPARE(info2.get("custom").toString(), str); - str.fill('G',10*i); - QCOMPARE(info2.track(0).get(Title).toString(), str); - const CDInfo info3(info2); - QCOMPARE(info3.track(0).get(Title).toString(), str); - str.fill('H',10*i); - str.append('\n'); - QCOMPARE(info2.track(0).get("custom").toString(), str); - - QVERIFY(!submitData.contains("CUSTOM")); - QVERIFY(data.contains("CUSTOM")); - } -} - -QTEST_MAIN(CDInfoTest) - -#include "cdinfotest.moc" diff -Nru libkcddb-15.12.3/test/cdinfotest.h libkcddb-16.12.1/test/cdinfotest.h --- libkcddb-15.12.3/test/cdinfotest.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/cdinfotest.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -/* - Copyright (C) 2005 Richard Lärkäng - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef CDINFOTEST_H -#define CDINFOTEST_H - -#include - -class CDInfoTest : public QObject -{ - Q_OBJECT -private slots: - void testLongLines(); -}; - -#endif diff -Nru libkcddb-15.12.3/test/CMakeLists.txt libkcddb-16.12.1/test/CMakeLists.txt --- libkcddb-15.12.3/test/CMakeLists.txt 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) - -include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_BINARY_DIR}/../libkcddb ) - - -MACRO(KCDDB_EXECUTABLE_TESTS) - FOREACH(_testname ${ARGN}) - kde4_add_executable(${_testname} TEST ${_testname}.cpp) - target_link_libraries(${_testname} ${KDE4_KDEUI_LIBS} - ${QT_QTTEST_LIBRARY} kcddb) - ENDFOREACH(_testname) -ENDMACRO(KCDDB_EXECUTABLE_TESTS) -MACRO(KCDDB_UNIT_TESTS) - FOREACH(_testname ${ARGN}) - kde4_add_unit_test(${_testname} TESTNAME kcddb-${_testname} ${_testname}.cpp) - target_link_libraries(${_testname} ${KDE4_KDEUI_LIBS} - ${QT_QTTEST_LIBRARY} kcddb) - ENDFOREACH(_testname) -ENDMACRO(KCDDB_UNIT_TESTS) - -KCDDB_UNIT_TESTS( - asynchttplookuptest - asynccddblookuptest - synccddblookuptest - synchttplookuptest - utf8test - musicbrainztest - asyncmusicbrainztest - cdinfotest - cachetest - musicbrainztest-severaldiscs - musicbrainztest-fulldate -) - -KCDDB_EXECUTABLE_TESTS( - syncsmtpsubmittest - asyncsmtpsubmittest - asynchttpsubmittest - synchttpsubmittest - sitestest -) - diff -Nru libkcddb-15.12.3/test/musicbrainztest.cpp libkcddb-16.12.1/test/musicbrainztest.cpp --- libkcddb-15.12.3/test/musicbrainztest.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/musicbrainztest.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,124 +0,0 @@ -/* - Copyright (C) 2006 Richard Lärkäng - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include "musicbrainztest.h" -#include "libkcddb/client.h" -#include "libkcddb/cache.h" -#include "libkcddb/lookup.h" -#include "config-musicbrainz.h" - - -void MusicBrainzTest::testLookup() -{ - using namespace KCDDB; - -#ifndef HAVE_MUSICBRAINZ5 - QSKIP("This test requires libmusicbrainz", SkipAll); -#endif - - Client c; - c.config().setCacheLookupEnabled(false); - c.config().setFreedbLookupEnabled(false); - c.config().setMusicBrainzLookupEnabled(true); - - TrackOffsetList list; - - //The Liptones / The Latest News - list - << 150 - << 9219 - << 20386 - << 34134 - << 51437 - << 68809 - << 86591 - << 106288 - << 115568 - << 133312 - << 155593 - << 169832 - << 179626 - << 194958 - << 212506; - - Result r = c.lookup(list); - - QVERIFY(r == Success); - - kDebug() << "Client::lookup gave : " << resultToString(r); - - CDInfoList response = c.lookupResponse(); - - kDebug() << "Client::lookup returned : " << response.count() << " entries" - << endl; - - QVERIFY(response.count() > 0); - - // See http://musicbrainz.org/release/68ec4a09-576c-472e-9103-aed99b6a3ffc for changes - CDInfo i(response.first()); - QCOMPARE(i.numberOfTracks(),14); - - QCOMPARE(i.get(Artist).toString(),QString("The Liptones")); - QCOMPARE(i.get(Title).toString(),QString("The Latest News")); - // genre not really supported for musicbrainz - QCOMPARE(i.get(Genre).toString(),QString()); - QCOMPARE(i.get(Year).toInt(),2002); - QCOMPARE(i.track(0).get(Title).toString(),QString("Jungle Heat")); - QCOMPARE(i.track(1).get(Title).toString(),QString("It's All I Hear You Say")); - QCOMPARE(i.track(2).get(Title).toString(),QString("Girl for Tonight")); - QCOMPARE(i.track(3).get(Title).toString(),QString("Shoot Em Down")); - QCOMPARE(i.track(4).get(Title).toString(),QString("Beautiful Day")); - QCOMPARE(i.track(5).get(Title).toString(),QString("Paranoia")); - QCOMPARE(i.track(6).get(Title).toString(),QString("My Way")); - QCOMPARE(i.track(7).get(Title).toString(),QString("Dressed in Pink")); - QCOMPARE(i.track(8).get(Title).toString(),QString("No Way Out")); - QCOMPARE(i.track(9).get(Title).toString(),QString("Strange Kind of Justice")); - QCOMPARE(i.track(10).get(Title).toString(),QString("Waiting Til Midnight")); - QCOMPARE(i.track(11).get(Title).toString(),QString("Liptones")); - QCOMPARE(i.track(12).get(Title).toString(),QString("Out With the Boys")); - QCOMPARE(i.track(13).get(Title).toString(),QString("Free Like a Bird")); - // comments not supported in a simple way - for (int j=0; j < 14; j++) - QCOMPARE(i.track(j).get(Comment).toString(),QString()); - - // Make sure it's the same when loaded from the cache again - c.config().setCacheLookupEnabled(true); - c.config().setFreedbLookupEnabled(false); - c.config().setMusicBrainzLookupEnabled(false); - - c.lookup(list); - - response = c.lookupResponse(); - QVERIFY(response.count() > 0); - - CDInfo cacheInfo(response.first()); - QCOMPARE(i.get(Artist).toString(),cacheInfo.get(Artist).toString()); - QCOMPARE(i.get(Title).toString(),cacheInfo.get(Title).toString()); - QCOMPARE(i.get(Year).toInt(),cacheInfo.get(Year).toInt()); - for (int j=0; j < 14; j++) - { - QCOMPARE(i.track(j).get(Title).toString(),cacheInfo.track(j).get(Title).toString()); - QCOMPARE(i.track(j).get(Comment).toString(),cacheInfo.track(j).get(Comment).toString()); - } -} - -QTEST_KDEMAIN(MusicBrainzTest, NoGUI) - -#include "musicbrainztest.moc" diff -Nru libkcddb-15.12.3/test/musicbrainztest-fulldate.cpp libkcddb-16.12.1/test/musicbrainztest-fulldate.cpp --- libkcddb-15.12.3/test/musicbrainztest-fulldate.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/musicbrainztest-fulldate.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,157 +0,0 @@ -/* - Copyright (C) 2006 Richard Lärkäng - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include "musicbrainztest-fulldate.h" -#include "libkcddb/client.h" -#include "libkcddb/cache.h" -#include "libkcddb/lookup.h" -#include "config-musicbrainz.h" - - -void MusicBrainzTestFullDate::testLookup() -{ - using namespace KCDDB; - -#ifndef HAVE_MUSICBRAINZ5 - QSKIP("This test requires libmusicbrainz", SkipAll); -#endif - - Client c; - c.config().setCacheLookupEnabled(false); - c.config().setFreedbLookupEnabled(false); - c.config().setMusicBrainzLookupEnabled(true); - - TrackOffsetList list; - - list << - 150 << - 11837 << - 20687 << - 29120 << - 35557 << - 50087 << - 58550 << - 72575 << - 81887 << - 95745 << - 104340 << - 115425 << - 124285 << - 132317 << - 142692 << - 160272 << - 169325 << - 181377 << - 194482 << - 205747 << - 216492 << - 229507 << - 242715 << - 252112 << - 274965 << - 285820 << - 308957 << - 322362 << - 338662 << - 350172 << - 356692; - - Result r = c.lookup(list); - - QVERIFY(r == Success); - - kDebug() << "Client::lookup gave : " << resultToString(r); - - CDInfoList response = c.lookupResponse(); - - kDebug() << "Client::lookup returned : " << response.count() << " entries" - << endl; - - QVERIFY(response.count() > 0); - - // See http://musicbrainz.org/release/04319e80-0948-4e89-8180-7cf6f17fc77a for changes - CDInfo i(response.first()); - QCOMPARE(i.numberOfTracks(),30); - - QCOMPARE(i.get(Artist).toString(),QString("Troublemakers")); - QCOMPARE(i.get(Title).toString(),QString("30")); - // genre not really supported for musicbrainz - QCOMPARE(i.get(Genre).toString(),QString()); - QCOMPARE(i.get(Year).toInt(),2011); - QCOMPARE(i.track(0).get(Title).toString(),QString("30")); - QCOMPARE(i.track(1).get(Title).toString(),QString::fromUtf8("Staden Göteborg")); - QCOMPARE(i.track(2).get(Title).toString(),QString::fromUtf8("Lilla Blå")); - QCOMPARE(i.track(3).get(Title).toString(),QString("Kleptoman")); - QCOMPARE(i.track(4).get(Title).toString(),QString::fromUtf8("Grogg å parabol")); - QCOMPARE(i.track(5).get(Title).toString(),QString("Majorna brinner")); - QCOMPARE(i.track(6).get(Title).toString(),QString::fromUtf8("Utan hjärta stannar Sverige")); - QCOMPARE(i.track(7).get(Title).toString(),QString("Dom e efter mig")); - QCOMPARE(i.track(8).get(Title).toString(),QString("Mammas flickor")); - QCOMPARE(i.track(9).get(Title).toString(),QString("Handgranat")); - QCOMPARE(i.track(10).get(Title).toString(),QString("Stenar o blod")); - QCOMPARE(i.track(11).get(Title).toString(),QString("Enkel Berlin")); - QCOMPARE(i.track(12).get(Title).toString(),QString("Dom ljuger")); - QCOMPARE(i.track(13).get(Title).toString(),QString("Jobba")); - QCOMPARE(i.track(14).get(Title).toString(),QString::fromUtf8("Varför lyser inga stjärnor")); - QCOMPARE(i.track(15).get(Title).toString(),QString("Partytrash")); - QCOMPARE(i.track(16).get(Title).toString(),QString::fromUtf8("Förstod ingenting")); - QCOMPARE(i.track(17).get(Title).toString(),QString::fromUtf8("Bara om min älskade väntar")); - QCOMPARE(i.track(18).get(Title).toString(),QString("Lillebror")); - QCOMPARE(i.track(19).get(Title).toString(),QString("Skandaler")); - QCOMPARE(i.track(20).get(Title).toString(),QString::fromUtf8("Hjältarna skålar i blod")); - QCOMPARE(i.track(21).get(Title).toString(),QString("Bomber o granater")); - QCOMPARE(i.track(22).get(Title).toString(),QString::fromUtf8("Vill du bli miljonär")); - QCOMPARE(i.track(23).get(Title).toString(),QString::fromUtf8("Stjärnorna kvittar det lika")); - QCOMPARE(i.track(24).get(Title).toString(),QString("Naken")); - QCOMPARE(i.track(25).get(Title).toString(),QString::fromUtf8("Månen lyser klar")); - QCOMPARE(i.track(26).get(Title).toString(),QString("Vild o vacker")); - QCOMPARE(i.track(27).get(Title).toString(),QString("Jag fryser")); - QCOMPARE(i.track(28).get(Title).toString(),QString("Ein zwei polizei")); - QCOMPARE(i.track(29).get(Title).toString(),QString::fromUtf8("Jävla idiot")); - for (int j=0; j < 30; j++) - QCOMPARE(i.track(j).get(Artist).toString(),QString("Troublemakers")); - // comments not supported in a simple way - for (int j=0; j < 19; j++) - QCOMPARE(i.track(j).get(Comment).toString(),QString()); - - // Make sure it's the same when loaded from the cache again - c.config().setCacheLookupEnabled(true); - c.config().setFreedbLookupEnabled(false); - c.config().setMusicBrainzLookupEnabled(false); - - c.lookup(list); - - response = c.lookupResponse(); - QVERIFY(response.count() > 0); - - CDInfo cacheInfo(response.first()); - QCOMPARE(i.get(Artist).toString(),cacheInfo.get(Artist).toString()); - QCOMPARE(i.get(Title).toString(),cacheInfo.get(Title).toString()); - QCOMPARE(i.get(Year).toInt(),cacheInfo.get(Year).toInt()); - for (int j=0; j < 19; j++) - { - QCOMPARE(i.track(j).get(Title).toString(),cacheInfo.track(j).get(Title).toString()); - QCOMPARE(i.track(j).get(Comment).toString(),cacheInfo.track(j).get(Comment).toString()); - } -} - -QTEST_KDEMAIN(MusicBrainzTestFullDate, NoGUI) - -#include "musicbrainztest-fulldate.moc" diff -Nru libkcddb-15.12.3/test/musicbrainztest-fulldate.h libkcddb-16.12.1/test/musicbrainztest-fulldate.h --- libkcddb-15.12.3/test/musicbrainztest-fulldate.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/musicbrainztest-fulldate.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -/* - Copyright (C) 2006 Richard Lärkäng - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef MUSICBRAINZTESTFULLDATE_H -#define MUSICBRAINZTESTFULLDATE_H - -#include - -class MusicBrainzTestFullDate : public QObject -{ - Q_OBJECT - private slots: - void testLookup(); -}; - -#endif diff -Nru libkcddb-15.12.3/test/musicbrainztest.h libkcddb-16.12.1/test/musicbrainztest.h --- libkcddb-15.12.3/test/musicbrainztest.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/musicbrainztest.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -/* - Copyright (C) 2006 Richard Lärkäng - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef MUSICBRAINZTEST_H -#define MUSICBRAINZTEST_H - -#include - -class MusicBrainzTest : public QObject -{ - Q_OBJECT - private slots: - void testLookup(); -}; - -#endif diff -Nru libkcddb-15.12.3/test/musicbrainztest-severaldiscs.cpp libkcddb-16.12.1/test/musicbrainztest-severaldiscs.cpp --- libkcddb-15.12.3/test/musicbrainztest-severaldiscs.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/musicbrainztest-severaldiscs.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,141 +0,0 @@ -/* - Copyright (C) 2006 Richard Lärkäng - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include "musicbrainztest-severaldiscs.h" -#include "libkcddb/client.h" -#include "libkcddb/cache.h" -#include "libkcddb/lookup.h" -#include "config-musicbrainz.h" - - -void MusicBrainzTestSeveralDiscs::testLookup() -{ - using namespace KCDDB; - -#ifndef HAVE_MUSICBRAINZ5 - QSKIP("This test requires libmusicbrainz", SkipAll); -#endif - - Client c; - c.config().setCacheLookupEnabled(false); - c.config().setFreedbLookupEnabled(false); - c.config().setMusicBrainzLookupEnabled(true); - - TrackOffsetList list; - - list << - 150 << - 17272 << - 36395 << - 47954 << - 63638 << - 77928 << - 95029 << - 112094 << - 130540 << - 145938 << - 160463 << - 180364 << - 195549 << - 203821 << - 222410 << - 230367 << - 249241 << - 273944 << - 287584 << - 309904 << - 325124; - - Result r = c.lookup(list); - - QVERIFY(r == Success); - - kDebug() << "Client::lookup gave : " << resultToString(r); - - CDInfoList response = c.lookupResponse(); - - kDebug() << "Client::lookup returned : " << response.count() << " entries" - << endl; - - QVERIFY(response.count() > 0); - - // See http://musicbrainz.org/release/4e0655b5-22fc-496e-9c14-2ee1a6027b45 for changes (disc 2) - CDInfo i(response.first()); - QCOMPARE(i.numberOfTracks(),20); - - QCOMPARE(i.get(Artist).toString(),QString("Billy Bragg")); - QCOMPARE(i.get(Title).toString(),QString("Must I Paint You a Picture? The Essential Billy Bragg (disc 2)")); - // genre not really supported for musicbrainz - QCOMPARE(i.get(Genre).toString(),QString()); - QCOMPARE(i.get(Year).toInt(),2003); - QCOMPARE(i.track(0).get(Title).toString(),QString("Sexuality")); - QCOMPARE(i.track(1).get(Title).toString(),QString("Cindy of 1000 Lives")); - QCOMPARE(i.track(2).get(Title).toString(),QString("Moving the Goalposts")); - QCOMPARE(i.track(3).get(Title).toString(),QString("Tank Park Salute")); - QCOMPARE(i.track(4).get(Title).toString(),QString("You Woke Up My Neighbourhood")); - QCOMPARE(i.track(5).get(Title).toString(),QString("Accident Waiting to Happen (Red Stars version)")); - QCOMPARE(i.track(6).get(Title).toString(),QString("Sulk")); - QCOMPARE(i.track(7).get(Title).toString(),QString("Upfield")); - QCOMPARE(i.track(8).get(Title).toString(),QString("The Fourteenth of February")); - QCOMPARE(i.track(9).get(Title).toString(),QString("Brickbat")); - QCOMPARE(i.track(10).get(Title).toString(),QString("The Space Race Is Over")); - QCOMPARE(i.track(11).get(Title).toString(),QString("The Boy Done Good")); - QCOMPARE(i.track(12).get(Title).toString(),QString("Ingrid Bergman")); - QCOMPARE(i.track(13).get(Title).toString(),QString("Way Over Yonder in the Minor Key")); - QCOMPARE(i.track(14).get(Title).toString(),QString("My Flying Saucer")); - QCOMPARE(i.track(15).get(Title).toString(),QString("All You Fascists Bound to Lose (Blokes version)")); - QCOMPARE(i.track(16).get(Title).toString(),QString("NPWA")); - QCOMPARE(i.track(17).get(Title).toString(),QString("St. Monday")); - QCOMPARE(i.track(18).get(Title).toString(),QString("Somedays I See the Point")); - QCOMPARE(i.track(19).get(Title).toString(),QString("Take Down the Union Jack (Band version)")); - for (int j=0; j < 12; j++) - QCOMPARE(i.track(j).get(Artist).toString(),QString("Billy Bragg")); - for (int j=12; j < 15; j++) - QCOMPARE(i.track(j).get(Artist).toString(),QString("Billy Bragg & Wilco")); - for (int j=15; j < 20; j++) - QCOMPARE(i.track(j).get(Artist).toString(),QString("Billy Bragg and The Blokes")); - // comments not supported in a simple way - for (int j=0; j < 19; j++) - QCOMPARE(i.track(j).get(Comment).toString(),QString()); - - // Make sure it's the same when loaded from the cache again - c.config().setCacheLookupEnabled(true); - c.config().setFreedbLookupEnabled(false); - c.config().setMusicBrainzLookupEnabled(false); - - c.lookup(list); - - response = c.lookupResponse(); - QVERIFY(response.count() > 0); - - CDInfo cacheInfo(response.first()); - QCOMPARE(i.get(Artist).toString(),cacheInfo.get(Artist).toString()); - QCOMPARE(i.get(Title).toString(),cacheInfo.get(Title).toString()); - QCOMPARE(i.get(Year).toInt(),cacheInfo.get(Year).toInt()); - for (int j=0; j < 19; j++) - { - QCOMPARE(i.track(j).get(Title).toString(),cacheInfo.track(j).get(Title).toString()); - QCOMPARE(i.track(j).get(Comment).toString(),cacheInfo.track(j).get(Comment).toString()); - } -} - -QTEST_KDEMAIN(MusicBrainzTestSeveralDiscs, NoGUI) - -#include "musicbrainztest-severaldiscs.moc" diff -Nru libkcddb-15.12.3/test/musicbrainztest-severaldiscs.h libkcddb-16.12.1/test/musicbrainztest-severaldiscs.h --- libkcddb-15.12.3/test/musicbrainztest-severaldiscs.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/musicbrainztest-severaldiscs.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -/* - Copyright (C) 2006 Richard Lärkäng - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef MUSICBRAINZTESTSEVERALDISCS_H -#define MUSICBRAINZTESTSEVERALDISCS_H - -#include - -class MusicBrainzTestSeveralDiscs : public QObject -{ - Q_OBJECT - private slots: - void testLookup(); -}; - -#endif diff -Nru libkcddb-15.12.3/test/sitestest.cpp libkcddb-16.12.1/test/sitestest.cpp --- libkcddb-15.12.3/test/sitestest.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/sitestest.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -/* - Copyright (C) 2003 Richard Lärkäng - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include -#include - -#include "libkcddb/sites.h" -#include - - int -main(int argc, char ** argv) -{ - KCmdLineArgs::init(argc, argv, "libkcddb_test", 0, KLocalizedString(), ""); - - KApplication app(true); - - using namespace KCDDB; - - Sites s; - - kDebug() << "Sites: "; - - QList sites = s.siteList(); - for (QList::Iterator it = sites.begin(); it != sites.end(); ++it) - if ((*it).transport == Lookup::CDDBP) - kDebug() << (*it).address << " CDDBP " << (*it).port << " " << (*it).description; - else - kDebug() << (*it).address << " HTTP " << (*it).port << " " << (*it).description; - - return 0; -} diff -Nru libkcddb-15.12.3/test/synccddblookuptest.cpp libkcddb-16.12.1/test/synccddblookuptest.cpp --- libkcddb-15.12.3/test/synccddblookuptest.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/synccddblookuptest.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,96 +0,0 @@ -/* - Copyright (C) 2005 Richard Lärkäng - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include "libkcddb/client.h" -#include "libkcddb/cache.h" -#include "libkcddb/lookup.h" -#include "synccddblookuptest.h" - -void SyncCDDBLookupTest::testLookup() -{ - using namespace KCDDB; - - Client c; - c.config().setHostname("freedb.freedb.org"); - c.config().setPort(8880); - c.config().setCacheLookupEnabled(false); - c.config().setFreedbLookupEnabled(true); - c.config().setMusicBrainzLookupEnabled(false); - c.config().setFreedbLookupTransport(Lookup::CDDBP); - - TrackOffsetList list; - - list - << 150 - << 106965 - << 127220 - << 151925 - << 176085 - << 234500; - - Result r = c.lookup(list); - - QVERIFY(r == Success); - - CDInfoList response = c.lookupResponse(); - - CDInfoList::ConstIterator it; - - bool hasRunTest = false; - - for (it = response.constBegin(); it != response.constEnd(); ++it) - { - CDInfo i(*it); - - if (i.get("discid") == "3e0c3a05" && i.get(Category) == "misc") - { - // If revision doesn't match, test probably needs to be updated - // See: http://www.freedb.org/freedb/misc/3e0c3a05 for updated data - QCOMPARE(i.get("revision").toInt(), 17); - - QCOMPARE(i.get(Artist).toString(),QString("Pink Floyd")); - QCOMPARE(i.get(Title).toString(),QString("Atom Heart Mother")); - QCOMPARE(i.get(Genre).toString(),QString("Psychedelic Rock")); - QCOMPARE(i.get(Year).toInt(),1970); - QCOMPARE(i.track(0).get(Title).toString(),QString("Atom Heart Mother: Father's Shout/Breast Milky/Mother Fore/Funky Dung/Mind Your Throats Please/Remergence")); - QCOMPARE(i.track(1).get(Title).toString(),QString("If")); - QCOMPARE(i.track(2).get(Title).toString(),QString("Summer '68")); - QCOMPARE(i.track(3).get(Title).toString(),QString("Fat Old Sun")); - QCOMPARE(i.track(4).get(Title).toString(),QString("Alan's Psychedelic Breakfast: Rise and Shine/Sunny Side Up/Morning Glory")); - QCOMPARE(i.track(0).get(Comment).toString(),QString("")); - QCOMPARE(i.track(1).get(Comment).toString(),QString("")); - QCOMPARE(i.track(2).get(Comment).toString(),QString("")); - QCOMPARE(i.track(3).get(Comment).toString(),QString("")); - QCOMPARE(i.track(4).get(Comment).toString(),QString("")); - for (int j=0; j <= 4; j++) - { - QCOMPARE(i.track(j).get(Artist).toString(),QString("Pink Floyd")); - } - - hasRunTest = true; - } - } - - QVERIFY(hasRunTest); -} - -QTEST_KDEMAIN(SyncCDDBLookupTest, NoGUI) - -#include "synccddblookuptest.moc" diff -Nru libkcddb-15.12.3/test/synccddblookuptest.h libkcddb-16.12.1/test/synccddblookuptest.h --- libkcddb-15.12.3/test/synccddblookuptest.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/synccddblookuptest.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -/* - Copyright (C) 2005 Richard Lärkäng - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef SYNCCDDBLOOKUPTEST_H -#define SYNCCDDBLOOKUPTEST_H - -#include - -class SyncCDDBLookupTest : public QObject -{ - Q_OBJECT - private slots: - void testLookup(); -}; - -#endif diff -Nru libkcddb-15.12.3/test/synchttplookuptest.cpp libkcddb-16.12.1/test/synchttplookuptest.cpp --- libkcddb-15.12.3/test/synchttplookuptest.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/synchttplookuptest.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,96 +0,0 @@ -/* - Copyright (C) 2006 Richard Lärkäng - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include "libkcddb/client.h" -#include "libkcddb/cache.h" -#include "libkcddb/lookup.h" -#include "synchttplookuptest.h" - -void SyncHTTPLookupTest::testLookup() -{ - using namespace KCDDB; - - Client c; - c.config().setHostname("freedb.freedb.org"); - c.config().setPort(80); - c.config().setCacheLookupEnabled(false); - c.config().setFreedbLookupEnabled(true); - c.config().setMusicBrainzLookupEnabled(false); - c.config().setFreedbLookupTransport(Lookup::HTTP); - - TrackOffsetList list; - - list - << 150 - << 106965 - << 127220 - << 151925 - << 176085 - << 234500; - - Result r = c.lookup(list); - - QVERIFY(r == Success); - - CDInfoList response = c.lookupResponse(); - - CDInfoList::ConstIterator it; - - bool hasRunTest = false; - - for (it = response.constBegin(); it != response.constEnd(); ++it) - { - CDInfo i(*it); - - if (i.get("discid") == "3e0c3a05" && i.get(Category) == "misc") - { - // If revision doesn't match, test probably needs to be updated - // See: http://www.freedb.org/freedb/misc/3e0c3a05 for updated data - QCOMPARE(i.get("revision").toInt(), 17); - - QCOMPARE(i.get(Artist).toString(),QString("Pink Floyd")); - QCOMPARE(i.get(Title).toString(),QString("Atom Heart Mother")); - QCOMPARE(i.get(Genre).toString(),QString("Psychedelic Rock")); - QCOMPARE(i.get(Year).toInt(),1970); - QCOMPARE(i.track(0).get(Title).toString(),QString("Atom Heart Mother: Father's Shout/Breast Milky/Mother Fore/Funky Dung/Mind Your Throats Please/Remergence")); - QCOMPARE(i.track(1).get(Title).toString(),QString("If")); - QCOMPARE(i.track(2).get(Title).toString(),QString("Summer '68")); - QCOMPARE(i.track(3).get(Title).toString(),QString("Fat Old Sun")); - QCOMPARE(i.track(4).get(Title).toString(),QString("Alan's Psychedelic Breakfast: Rise and Shine/Sunny Side Up/Morning Glory")); - QCOMPARE(i.track(0).get(Comment).toString(),QString("")); - QCOMPARE(i.track(1).get(Comment).toString(),QString("")); - QCOMPARE(i.track(2).get(Comment).toString(),QString("")); - QCOMPARE(i.track(3).get(Comment).toString(),QString("")); - QCOMPARE(i.track(4).get(Comment).toString(),QString("")); - for (int j=0; j <= 4; j++) - { - QCOMPARE(i.track(j).get(Artist).toString(),QString("Pink Floyd")); - } - - hasRunTest = true; - } - } - - QVERIFY(hasRunTest); -} - -QTEST_KDEMAIN(SyncHTTPLookupTest, NoGUI) - -#include "synchttplookuptest.moc" diff -Nru libkcddb-15.12.3/test/synchttplookuptest.h libkcddb-16.12.1/test/synchttplookuptest.h --- libkcddb-15.12.3/test/synchttplookuptest.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/synchttplookuptest.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -/* - Copyright (C) 2006 Richard Lärkäng - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef SYNCHTTPLOOKUPTEST_H -#define SYNCHTTPLOOKUPTEST_H - -#include - -class SyncHTTPLookupTest : public QObject -{ - Q_OBJECT - private slots: - void testLookup(); -}; - -#endif diff -Nru libkcddb-15.12.3/test/synchttpsubmittest.cpp libkcddb-16.12.1/test/synchttpsubmittest.cpp --- libkcddb-15.12.3/test/synchttpsubmittest.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/synchttpsubmittest.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,72 +0,0 @@ -/* - Copyright (C) 2003 Richard Lärkäng - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include -#include - -#include "libkcddb/client.h" -#include "libkcddb/kcddbconfig.h" -#include "libkcddb/submit.h" - - int -main(int argc, char ** argv) -{ - KCmdLineArgs::init(argc, argv, "libkcddb_test", 0, KLocalizedString(), ""); - - KApplication app(false /* No styles */); - - using namespace KCDDB; - - TrackOffsetList list; - - list - << 150 // First track start. - << 2592 - << 35472 - << 47891 - << 123310 - << 133125; // Disc end. - - CDInfo cdInfo; - - cdInfo.set("discid", "3606ed05"); - cdInfo.set("revision", 4); - cdInfo.set("title", "Bamse och Bronto"); - cdInfo.set("artist", "Musiksage"); - cdInfo.set("year", 2001); - cdInfo.set("category", "misc"); - cdInfo.set("genre", "Barnsaga"); - cdInfo.set("extd", QString::fromUtf8("Berättare: Olof Thunberg")); - - cdInfo.track(0).set("title", "Bamses signaturmelodi"); - cdInfo.track(1).set("title","*"); - cdInfo.track(2).set("title", "Brummavisan"); - cdInfo.track(3).set("title", "*"); - cdInfo.track(4).set("title", QString::fromUtf8("Jätteödlan Bronto")); - - Client c; - c.config().setFreedbSubmitTransport(Submit::HTTP); - c.setBlockingMode( true ); - - Result r = c.submit(cdInfo, list); - - kDebug() << "Result: " << resultToString(r); -} - diff -Nru libkcddb-15.12.3/test/syncsmtpsubmittest.cpp libkcddb-16.12.1/test/syncsmtpsubmittest.cpp --- libkcddb-15.12.3/test/syncsmtpsubmittest.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/syncsmtpsubmittest.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,74 +0,0 @@ -/* - Copyright (C) 2003 Richard Lärkäng - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include -#include - -#include "libkcddb/client.h" -#include "libkcddb/kcddbconfig.h" -#include "libkcddb/submit.h" - - int -main(int argc, char ** argv) -{ - KCmdLineArgs::init(argc, argv, "libkcddb_test", 0, KLocalizedString(), ""); - - KApplication app(false /* No styles */); - - using namespace KCDDB; - - TrackOffsetList list; - - list - << 150 // First track start. - << 2592 - << 35472 - << 47891 - << 123310 - << 133125; // Disc end. - - CDInfo cdInfo; - - cdInfo.set("discid", "3606ed05"); - cdInfo.set("revision", 4); - cdInfo.set("title", "Bamse och Bronto"); - cdInfo.set("artist", "Musiksage"); - cdInfo.set("year", 2001); - cdInfo.set("category", "misc"); - cdInfo.set("genre", "Barnsaga"); - cdInfo.set("extd", QString::fromUtf8("Berättare: Olof Thunberg")); - - cdInfo.track(0).set("title", "Bamses signaturmelodi"); - cdInfo.track(1).set("title","*"); - cdInfo.track(2).set("title", "Brummavisan"); - cdInfo.track(3).set("title", "*"); - cdInfo.track(4).set("title", QString::fromUtf8("Jätteödlan Bronto")); - - Client c; - c.config().setFreedbSubmitTransport(Submit::SMTP); - c.config().setSubmitAddress("test-submit@freedb.org"); - - c.setBlockingMode( true ); - - Result r = c.submit(cdInfo, list); - - kDebug() << "Result: " << resultToString(r); -} - diff -Nru libkcddb-15.12.3/test/utf8test.cpp libkcddb-16.12.1/test/utf8test.cpp --- libkcddb-15.12.3/test/utf8test.cpp 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/utf8test.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,87 +0,0 @@ -/* - Copyright (C) 2004-2006 Richard Lärkäng - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include "libkcddb/client.h" -#include "libkcddb/cache.h" -#include "libkcddb/lookup.h" -#include "utf8test.h" - -void Utf8Test::testLookup() -{ - using namespace KCDDB; - - Client c; - c.config().setHostname("freedb.freedb.org"); - c.config().setPort(80); - c.config().setCacheLookupEnabled(false); - c.config().setFreedbLookupEnabled(true); - c.config().setMusicBrainzLookupEnabled(false); - c.config().setFreedbLookupTransport(Lookup::HTTP); - - TrackOffsetList list; - - list - << 150 - << 61408 - << 177675; - - c.lookup(list); - - CDInfoList response = c.lookupResponse(); - - CDInfoList::ConstIterator it; - - bool hasRunTest = false; - - for (it = response.constBegin(); it != response.constEnd(); ++it) - { - CDInfo i(*it); - - if (i.get("discid") == "13093f02" && i.get(Category) == "blues") - { - // If revision doesn't match, test probably needs to be updated - // See: http://www.freedb.org/freedb/blues/13093f02 for updated data - QCOMPARE(i.get("revision").toInt(), 3); - - QString artist = QString::fromUtf8("神城麻郁(浪川大輔)/宮藤深衣奈(中原麻衣)/小野寺樺恋(清水愛)/織部椿(根谷美智子)/島崎康生(鈴村健一)/風見みずほ(井上喜久子)/森野苺(田村ゆかり)/四道跨(三浦祥朗)/四道晴子(新谷良子)/佐川秋那(浅野真澄)/真下双葉(佐久間紅美)/菊池浩美(進藤尚美)/草薙桂(保志総一郎)/縁川小石(川澄綾子)/間雲漂介(岩田光央)/水澄楓(大原さやか)/まりえ(金田朋子)/山田政臣(杉田智和)神城麻郁(浪川大輔)/宮藤深衣奈(中原麻衣)/小野寺樺恋(清水愛)/織部椿(根谷美智子)/島崎康生(鈴村健一)/風見みずほ(井上喜久子)/森野苺(田村ゆかり)/四道跨(三Y祥朗)/四道晴子(新谷良子)/佐川秋那(浅野真澄)/真下双葉(佐久間紅美)/菊池浩美(進藤尚美)/草薙桂(保志総一郎)/縁川小石(川澄綾子)/間雲漂介(岩田光央)/水澄楓(大原さやか)/まりえ(金田朋子)/山田政臣(杉田智和)"); - - QCOMPARE(i.get(Artist).toString(),artist); - QCOMPARE(i.get(Title).toString(),QString::fromUtf8("みずほ先生とはちみつツインズ ドラマアルバム2時間目「百合百合ツインズ」")); - QCOMPARE(i.get(Genre).toString(),QString("Anime")); - QCOMPARE(i.get(Year).toInt(),2004); - QCOMPARE(i.track(0).get(Title).toString(),QString::fromUtf8("第EX話 おねがい☆全員集合")); - QCOMPARE(i.track(1).get(Title).toString(),QString::fromUtf8("エピローグ")); - QCOMPARE(i.track(0).get(Comment).toString(),QString("")); - QCOMPARE(i.track(1).get(Comment).toString(),QString("")); - for (int j=0; j <= 1; j++) - { - QCOMPARE(i.track(j).get(Artist).toString(),artist); - } - - hasRunTest = true; - } - } - - QVERIFY(hasRunTest); -} - -QTEST_KDEMAIN(Utf8Test, NoGUI) - -#include "utf8test.moc" diff -Nru libkcddb-15.12.3/test/utf8test.h libkcddb-16.12.1/test/utf8test.h --- libkcddb-15.12.3/test/utf8test.h 2015-06-26 04:18:08.000000000 +0000 +++ libkcddb-16.12.1/test/utf8test.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -/* - Copyright (C) 2006 Richard Lärkäng - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef UTF8TEST_H -#define UTF8TEST_H - -#include - -class Utf8Test : public QObject -{ - Q_OBJECT - private slots: - void testLookup(); -}; - -#endif diff -Nru libkcddb-15.12.3/tests/asynccddblookuptest.cpp libkcddb-16.12.1/tests/asynccddblookuptest.cpp --- libkcddb-15.12.3/tests/asynccddblookuptest.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/asynccddblookuptest.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,117 @@ +/* + Copyright (C) 2006 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "asynccddblookuptest.h" +#include "libkcddb/cache.h" +#include "libkcddb/lookup.h" +#include + +void AsyncCDDBLookupTest::testLookup() +{ + using namespace KCDDB; + + client_ = new Client; + client_->config().setHostname(QString::fromUtf8("freedb.freedb.org")); + client_->config().setPort(8880); + client_->config().setCacheLookupEnabled(false); + client_->config().setFreedbLookupEnabled(true); + client_->config().setMusicBrainzLookupEnabled(false); + client_->config().setFreedbLookupTransport(Lookup::CDDBP); + client_->setBlockingMode( false ); + + connect(client_,SIGNAL(finished(KCDDB::Result)),SLOT(slotFinished(KCDDB::Result))); + + TrackOffsetList list; + + // a1107d0a - Kruder & Dorfmeister - The K&D Sessions - Disc One. + list + << 150 // First track start. + << 29462 + << 66983 + << 96785 + << 135628 + << 168676 + << 194147 + << 222158 + << 247076 + << 278203 // Last track start. + << 316732; // Disc end. + + client_->lookup(list); + + m_eventLoop.exec(QEventLoop::ExcludeUserInputEvents); + + delete client_; + + QVERIFY(m_result == Success); + + // If revision doesn't match, test probably needs to be updated + // See: http://www.freedb.org/freedb/jazz/a1107d0a for updated data + QCOMPARE(m_info.get(QString::fromUtf8("revision")).toInt(), 7); + + QCOMPARE(m_info.get(Artist).toString(),QString::fromUtf8("Kruder & Dorfmeister")); + QCOMPARE(m_info.get(Title).toString(),QString::fromUtf8("The K&D Sessions (Part One)")); + QCOMPARE(m_info.get(Genre).toString(),QString::fromUtf8("Trip-Hop")); + QCOMPARE(m_info.get(Year).toInt(),1998); + QCOMPARE(m_info.track(0).get(Title).toString(),QString::fromUtf8("Roni Size - Heroes (Kruder's Long Loose Bossa remixed by Peter Kruder)")); + QCOMPARE(m_info.track(1).get(Title).toString(),QString::fromUtf8("Alex Reece - Jazz Master (K&D Session)")); + QCOMPARE(m_info.track(2).get(Title).toString(),QString::fromUtf8("Count Basic - Speechless (Drum 'n' Bass remixed by Peter Kruder)")); + QCOMPARE(m_info.track(3).get(Title).toString(),QString::fromUtf8("Rockers Hi-Fi - Going Under (K&D Session)")); + QCOMPARE(m_info.track(4).get(Title).toString(),QString::fromUtf8("Bomb The Bass - Bug Powder Dust (K&D Session)")); + QCOMPARE(m_info.track(5).get(Title).toString(),QString::fromUtf8("Aphrodelics - Rollin' On Chrome (Wild Motherfucker Dub remixed by Richard Dorfmeister)")); + QCOMPARE(m_info.track(6).get(Title).toString(),QString::fromUtf8("Depeche Mode - Useless (K&D Session)")); + QCOMPARE(m_info.track(7).get(Title).toString(),QString::fromUtf8("Count Basic - Gotta Jazz (remixed by Richard Dorfmeister)")); + QCOMPARE(m_info.track(8).get(Title).toString(),QString::fromUtf8("Rainer Truby Trio - Donaueschingen (Peter Kruder's Donaudampfschifffahrtsgesellschaftskapitnskajtenremix)")); + QCOMPARE(m_info.track(9).get(Title).toString(),QString::fromUtf8("Lamb - Trans Fatty Acid (K&D Session)")); + QCOMPARE(m_info.track(0).get(Artist).toString(),QString::fromUtf8("Kruder & Dorfmeister")); + QCOMPARE(m_info.track(1).get(Artist).toString(),QString::fromUtf8("Kruder & Dorfmeister")); + QCOMPARE(m_info.track(2).get(Artist).toString(),QString::fromUtf8("Kruder & Dorfmeister")); + QCOMPARE(m_info.track(3).get(Artist).toString(),QString::fromUtf8("Kruder & Dorfmeister")); + QCOMPARE(m_info.track(4).get(Artist).toString(),QString::fromUtf8("Kruder & Dorfmeister")); + QCOMPARE(m_info.track(5).get(Artist).toString(),QString::fromUtf8("Kruder & Dorfmeister")); + QCOMPARE(m_info.track(6).get(Artist).toString(),QString::fromUtf8("Kruder & Dorfmeister")); + QCOMPARE(m_info.track(7).get(Artist).toString(),QString::fromUtf8("Kruder & Dorfmeister")); + QCOMPARE(m_info.track(8).get(Artist).toString(),QString::fromUtf8("Kruder & Dorfmeister")); + QCOMPARE(m_info.track(9).get(Artist).toString(),QString::fromUtf8("Kruder & Dorfmeister")); +} + + void +AsyncCDDBLookupTest::slotFinished(Result r) +{ + m_result = r; + qDebug() << "AsyncCDDBLookupTest::slotResult: Got " << KCDDB::resultToString(r); + + CDInfoList l = client_->lookupResponse(); + + qDebug() << "AsyncCDDBLookupTest::slotResult: Item count: " << l.count(); + + foreach(const CDInfo &i, l) + { + if (i.get(QString::fromUtf8("discid")) == QString::fromUtf8("a1107d0a") && i.get(Category) == QString::fromUtf8("jazz")) + { + qDebug() << "Found the CD"; + m_info = i; + break; + } + } + + m_eventLoop.quit(); +} + +QTEST_GUILESS_MAIN(AsyncCDDBLookupTest) diff -Nru libkcddb-15.12.3/tests/asynccddblookuptest.h libkcddb-16.12.1/tests/asynccddblookuptest.h --- libkcddb-15.12.3/tests/asynccddblookuptest.h 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/asynccddblookuptest.h 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,45 @@ +/* + Copyright (C) 2003 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef TEST_H +#define TEST_H + +#include +#include +#include "libkcddb/client.h" +#include "libkcddb/kcddb.h" + +using namespace KCDDB; + +class AsyncCDDBLookupTest : public QObject +{ + Q_OBJECT + private Q_SLOTS: + void testLookup(); + void slotFinished(KCDDB::Result); + + private: + + QEventLoop m_eventLoop; + KCDDB::Client * client_; + CDInfo m_info; + Result m_result; +}; + +#endif diff -Nru libkcddb-15.12.3/tests/asynchttplookuptest.cpp libkcddb-16.12.1/tests/asynchttplookuptest.cpp --- libkcddb-15.12.3/tests/asynchttplookuptest.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/asynchttplookuptest.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,118 @@ +/* + Copyright (C) 2006 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + + +#include "asynchttplookuptest.h" +#include "libkcddb/cache.h" +#include "libkcddb/lookup.h" +#include + +void AsyncHTTPLookupTest::testLookup() +{ + using namespace KCDDB; + + client_ = new Client; + client_->config().setHostname(QString::fromUtf8("freedb.freedb.org")); + client_->config().setPort(80); + client_->config().setCacheLookupEnabled(false); + client_->config().setFreedbLookupEnabled(true); + client_->config().setMusicBrainzLookupEnabled(false); + client_->config().setFreedbLookupTransport(Lookup::HTTP); + client_->setBlockingMode( false ); + + connect(client_, SIGNAL(finished(KCDDB::Result)), SLOT(slotFinished(KCDDB::Result))); + + TrackOffsetList list; + + // a1107d0a - Kruder & Dorfmeister - The K&D Sessions - Disc One. + list + << 150 // First track start. + << 29462 + << 66983 + << 96785 + << 135628 + << 168676 + << 194147 + << 222158 + << 247076 + << 278203 // Last track start. + << 316732; // Disc end. + + client_->lookup(list); + + m_eventLoop.exec(QEventLoop::ExcludeUserInputEvents); + + delete client_; + + QVERIFY(m_result == Success); + + // If revision doesn't match, test probably needs to be updated + // See: http://www.freedb.org/freedb/jazz/a1107d0a for updated data + QCOMPARE(m_info.get(QString::fromUtf8("revision")).toInt(), 7); + + QCOMPARE(m_info.get(Artist).toString(),QString::fromUtf8("Kruder & Dorfmeister")); + QCOMPARE(m_info.get(Title).toString(),QString::fromUtf8("The K&D Sessions (Part One)")); + QCOMPARE(m_info.get(Genre).toString(),QString::fromUtf8("Trip-Hop")); + QCOMPARE(m_info.get(Year).toInt(),1998); + QCOMPARE(m_info.track(0).get(Title).toString(),QString::fromUtf8("Roni Size - Heroes (Kruder's Long Loose Bossa remixed by Peter Kruder)")); + QCOMPARE(m_info.track(1).get(Title).toString(),QString::fromUtf8("Alex Reece - Jazz Master (K&D Session)")); + QCOMPARE(m_info.track(2).get(Title).toString(),QString::fromUtf8("Count Basic - Speechless (Drum 'n' Bass remixed by Peter Kruder)")); + QCOMPARE(m_info.track(3).get(Title).toString(),QString::fromUtf8("Rockers Hi-Fi - Going Under (K&D Session)")); + QCOMPARE(m_info.track(4).get(Title).toString(),QString::fromUtf8("Bomb The Bass - Bug Powder Dust (K&D Session)")); + QCOMPARE(m_info.track(5).get(Title).toString(),QString::fromUtf8("Aphrodelics - Rollin' On Chrome (Wild Motherfucker Dub remixed by Richard Dorfmeister)")); + QCOMPARE(m_info.track(6).get(Title).toString(),QString::fromUtf8("Depeche Mode - Useless (K&D Session)")); + QCOMPARE(m_info.track(7).get(Title).toString(),QString::fromUtf8("Count Basic - Gotta Jazz (remixed by Richard Dorfmeister)")); + QCOMPARE(m_info.track(8).get(Title).toString(),QString::fromUtf8("Rainer Truby Trio - Donaueschingen (Peter Kruder's Donaudampfschifffahrtsgesellschaftskapitnskajtenremix)")); + QCOMPARE(m_info.track(9).get(Title).toString(),QString::fromUtf8("Lamb - Trans Fatty Acid (K&D Session)")); + QCOMPARE(m_info.track(0).get(Artist).toString(),QString::fromUtf8("Kruder & Dorfmeister")); + QCOMPARE(m_info.track(1).get(Artist).toString(),QString::fromUtf8("Kruder & Dorfmeister")); + QCOMPARE(m_info.track(2).get(Artist).toString(),QString::fromUtf8("Kruder & Dorfmeister")); + QCOMPARE(m_info.track(3).get(Artist).toString(),QString::fromUtf8("Kruder & Dorfmeister")); + QCOMPARE(m_info.track(4).get(Artist).toString(),QString::fromUtf8("Kruder & Dorfmeister")); + QCOMPARE(m_info.track(5).get(Artist).toString(),QString::fromUtf8("Kruder & Dorfmeister")); + QCOMPARE(m_info.track(6).get(Artist).toString(),QString::fromUtf8("Kruder & Dorfmeister")); + QCOMPARE(m_info.track(7).get(Artist).toString(),QString::fromUtf8("Kruder & Dorfmeister")); + QCOMPARE(m_info.track(8).get(Artist).toString(),QString::fromUtf8("Kruder & Dorfmeister")); + QCOMPARE(m_info.track(9).get(Artist).toString(),QString::fromUtf8("Kruder & Dorfmeister")); +} + + void +AsyncHTTPLookupTest::slotFinished(Result r) +{ + m_result = r; + qDebug() << "AsyncHTTPLookupTest::slotFinished: Got " << KCDDB::resultToString(r); + + CDInfoList l = client_->lookupResponse(); + + qDebug() << "AsyncHTTPLookupTest::slotFinished: Item count: " << l.count(); + + foreach(const CDInfo &i, l) + { + if (i.get(QString::fromUtf8("discid")) == QVariant(QString::fromUtf8("a1107d0a")) && i.get(Category) == QVariant(QString::fromUtf8("jazz"))) + { + qDebug() << "Found the CD"; + m_info = i; + break; + } + } + + m_eventLoop.quit(); +} + +QTEST_GUILESS_MAIN(AsyncHTTPLookupTest) diff -Nru libkcddb-15.12.3/tests/asynchttplookuptest.h libkcddb-16.12.1/tests/asynchttplookuptest.h --- libkcddb-15.12.3/tests/asynchttplookuptest.h 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/asynchttplookuptest.h 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,45 @@ +/* + Copyright (C) 2003 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef TEST_H +#define TEST_H + +#include +#include +#include "libkcddb/client.h" +#include "libkcddb/kcddb.h" + +using namespace KCDDB; + +class AsyncHTTPLookupTest : public QObject +{ + Q_OBJECT + private Q_SLOTS: + void testLookup(); + void slotFinished(KCDDB::Result); + + private: + + QEventLoop m_eventLoop; + KCDDB::Client * client_; + CDInfo m_info; + Result m_result; +}; + +#endif diff -Nru libkcddb-15.12.3/tests/asynchttpsubmittest.cpp libkcddb-16.12.1/tests/asynchttpsubmittest.cpp --- libkcddb-15.12.3/tests/asynchttpsubmittest.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/asynchttpsubmittest.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,83 @@ +/* + Copyright (C) 2006 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include + +#include "asynchttpsubmittest.h" +#include "libkcddb/submit.h" + +AsyncHTTPSubmitTest::AsyncHTTPSubmitTest(QCoreApplication& app) + : app_(app) +{ + using namespace KCDDB; + + client_ = new Client; + client_->config().setFreedbSubmitTransport(Submit::HTTP); + client_->setBlockingMode( false ); + + TrackOffsetList list; + + list + << 150 // First track start. + << 2592 + << 35472 + << 47891 + << 123310 + << 133125; // Disc end. + + CDInfo cdInfo; + + cdInfo.set(QString::fromUtf8("discid"), QString::fromUtf8("3606ed05")); + cdInfo.set(QString::fromUtf8("revision"), 4); + cdInfo.set(QString::fromUtf8("title"), QString::fromUtf8("Bamse och Bronto")); + cdInfo.set(QString::fromUtf8("artist"), QString::fromUtf8("Musiksage")); + cdInfo.set(QString::fromUtf8("year"), 2001); + cdInfo.set(QString::fromUtf8("category"), QString::fromUtf8("misc")); + cdInfo.set(QString::fromUtf8("genre"), QString::fromUtf8("Barnsaga")); + cdInfo.set(QString::fromUtf8("extd"), QString::fromUtf8("Berättare: Olof Thunberg")); + + cdInfo.track(0).set(QString::fromUtf8("title"), QString::fromUtf8("Bamses signaturmelodi")); + cdInfo.track(1).set(QString::fromUtf8("title"),QString::fromUtf8("*")); + cdInfo.track(2).set(QString::fromUtf8("title"), QString::fromUtf8("Brummavisan")); + cdInfo.track(3).set(QString::fromUtf8("title"), QString::fromUtf8("*")); + cdInfo.track(4).set(QString::fromUtf8("title"), QString::fromUtf8("Jätteödlan Bronto")); + + connect(client_,SIGNAL(finished(KCDDB::Result)),SLOT(slotFinished(KCDDB::Result))); + + client_->submit(cdInfo, list); +} + + void +AsyncHTTPSubmitTest::slotFinished(Result r) +{ + qDebug() << "AsyncHTTPSubmitTest::slotFinished: Got " << KCDDB::resultToString(r); + + app_.quit(); +} + +int main(int argc, char ** argv) +{ + QCoreApplication app(argc, argv); + app.setApplicationName(QString::fromUtf8("libkcddb_test")); + + new AsyncHTTPSubmitTest(app); + + return app.exec(); +} diff -Nru libkcddb-15.12.3/tests/asynchttpsubmittest.h libkcddb-16.12.1/tests/asynchttpsubmittest.h --- libkcddb-15.12.3/tests/asynchttpsubmittest.h 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/asynchttpsubmittest.h 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,47 @@ +/* + Copyright (C) 2004 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef TEST_H +#define TEST_H + +#include +#include "libkcddb/client.h" + +using namespace KCDDB; + +class QCoreApplication; + +class AsyncHTTPSubmitTest : public QObject +{ + Q_OBJECT + + public: + AsyncHTTPSubmitTest(QCoreApplication& app); + + public Q_SLOTS: + + void slotFinished(KCDDB::Result); + + private: + + QCoreApplication& app_; + KCDDB::Client * client_; +}; + +#endif diff -Nru libkcddb-15.12.3/tests/asyncmusicbrainztest.cpp libkcddb-16.12.1/tests/asyncmusicbrainztest.cpp --- libkcddb-15.12.3/tests/asyncmusicbrainztest.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/asyncmusicbrainztest.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,156 @@ +/* + Copyright (C) 2006 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + + +#include "asyncmusicbrainztest.h" +#include "libkcddb/cache.h" +#include "libkcddb/lookup.h" +#include "config-musicbrainz.h" +#include + +void AsyncMusicBrainzTest::testLookup() +{ + using namespace KCDDB; + +#ifndef HAVE_MUSICBRAINZ5 + QSKIP("This test requires libmusicbrainz", SkipAll); +#endif + + client_ = new Client; + client_->config().setCacheLookupEnabled(false); + client_->config().setFreedbLookupEnabled(false); + client_->config().setMusicBrainzLookupEnabled(true); + client_->setBlockingMode( false ); + + connect(client_,SIGNAL(finished(KCDDB::Result)),SLOT(slotFinished(KCDDB::Result))); + + TrackOffsetList list; + + // Various Artists / Definitivt 50 Spänn 10 + list + << 150 + << 17130 + << 26340 + << 44855 + << 60530 + << 75800 + << 90182 + << 106605 + << 122995 + << 139005 + << 153317 + << 167967 + << 179012 + << 190190 + << 202162 + << 211312 + << 229037 + << 240035; + + client_->lookup(list); + + m_eventLoop.exec(QEventLoop::ExcludeUserInputEvents); + + QVERIFY(m_result == Success); + + // See http://musicbrainz.org/release/dbb3e39a-4bea-4e32-a546-456654f30ca6.html for changes + QCOMPARE(m_info.numberOfTracks(),17); + + QCOMPARE(m_info.get(Artist).toString(),QString::fromUtf8("Various Artists")); + QCOMPARE(m_info.get(Title).toString(),QString::fromUtf8("Definitivt 50 spänn 10")); + // genre not really supported for musicbrainz + QCOMPARE(m_info.get(Genre).toString(),QString()); + QCOMPARE(m_info.get(Year).toInt(),2001); + QCOMPARE(m_info.track(0).get(Title).toString(),QString::fromUtf8("Uphill Struggle")); + QCOMPARE(m_info.track(1).get(Title).toString(),QString::fromUtf8("Vill du bli miljonär?")); + QCOMPARE(m_info.track(2).get(Title).toString(),QString::fromUtf8("Här är jag")); + QCOMPARE(m_info.track(3).get(Title).toString(),QString::fromUtf8("Århundradets fest")); + QCOMPARE(m_info.track(4).get(Title).toString(),QString::fromUtf8("Vem valde mittemellan")); + QCOMPARE(m_info.track(5).get(Title).toString(),QString::fromUtf8("Hippieambulansen")); + QCOMPARE(m_info.track(6).get(Title).toString(),QString::fromUtf8("Jonsson")); + QCOMPARE(m_info.track(7).get(Title).toString(),QString::fromUtf8("Jag lämnar filmen")); + QCOMPARE(m_info.track(8).get(Title).toString(),QString::fromUtf8("39 Steg")); + QCOMPARE(m_info.track(9).get(Title).toString(),QString::fromUtf8("Lyckliga land")); + QCOMPARE(m_info.track(10).get(Title).toString(),QString::fromUtf8("Helpless")); + QCOMPARE(m_info.track(11).get(Title).toString(),QString::fromUtf8("Tunna skivor")); + QCOMPARE(m_info.track(12).get(Title).toString(),QString::fromUtf8("God läskeblask")); + QCOMPARE(m_info.track(13).get(Title).toString(),QString::fromUtf8("Hur snygg é du då?")); + QCOMPARE(m_info.track(14).get(Title).toString(),QString::fromUtf8("Självupptagen")); + QCOMPARE(m_info.track(15).get(Title).toString(),QString::fromUtf8("Sound Is Compressed; Words Rebel and Hiss")); + QCOMPARE(m_info.track(16).get(Title).toString(),QString::fromUtf8("Vi är på väg")); + QCOMPARE(m_info.track(0).get(Artist).toString(),QString::fromUtf8("Adhesive")); + QCOMPARE(m_info.track(1).get(Artist).toString(),QString::fromUtf8("Troublemakers")); + QCOMPARE(m_info.track(2).get(Artist).toString(),QString::fromUtf8("Mimikry")); + QCOMPARE(m_info.track(3).get(Artist).toString(),QString::fromUtf8("Lundberg & Dellamorte")); + QCOMPARE(m_info.track(4).get(Artist).toString(),QString::fromUtf8("Charta 77")); + QCOMPARE(m_info.track(5).get(Artist).toString(),QString::fromUtf8("UBBA")); + QCOMPARE(m_info.track(6).get(Artist).toString(),QString::fromUtf8("Coca Carola")); + QCOMPARE(m_info.track(7).get(Artist).toString(),QString::fromUtf8("Spoiler")); + QCOMPARE(m_info.track(8).get(Artist).toString(),QString::fromUtf8("Strebers")); + QCOMPARE(m_info.track(9).get(Artist).toString(),QString::fromUtf8("Iguana Party")); + QCOMPARE(m_info.track(10).get(Artist).toString(),QString::fromUtf8("Stoned")); + QCOMPARE(m_info.track(11).get(Artist).toString(),QString::fromUtf8("Per Bertil Birgers orkester")); + QCOMPARE(m_info.track(12).get(Artist).toString(),QString::fromUtf8("Slutstation Tjernobyl")); + QCOMPARE(m_info.track(13).get(Artist).toString(),QString::fromUtf8("SBD")); + QCOMPARE(m_info.track(14).get(Artist).toString(),QString::fromUtf8("Skumdum")); + QCOMPARE(m_info.track(15).get(Artist).toString(),QString::fromUtf8("Text")); + QCOMPARE(m_info.track(16).get(Artist).toString(),QString::fromUtf8("Ohlson Har Semester Production")); + // comments not supported in a simple way + for (int j=0; j < 17; j++) + QCOMPARE(m_info.track(j).get(Comment).toString(),QString()); + + // Make sure it's the same when loaded from the cache again + client_->config().setCacheLookupEnabled(true); + client_->config().setFreedbLookupEnabled(false); + client_->config().setMusicBrainzLookupEnabled(false); + client_->setBlockingMode(true); + + client_->lookup(list); + + CDInfoList response = client_->lookupResponse(); + QVERIFY(response.count() > 0); + + CDInfo cacheInfo(response.first()); + QCOMPARE(m_info.get(Artist).toString(),cacheInfo.get(Artist).toString()); + QCOMPARE(m_info.get(Title).toString(),cacheInfo.get(Title).toString()); + QCOMPARE(m_info.get(Year).toInt(),cacheInfo.get(Year).toInt()); + for (int j=0; j < 17; j++) + { + QCOMPARE(m_info.track(j).get(Title).toString(),cacheInfo.track(j).get(Title).toString()); + QCOMPARE(m_info.track(j).get(Comment).toString(),cacheInfo.track(j).get(Comment).toString()); + } +} + + void +AsyncMusicBrainzTest::slotFinished(Result r) +{ + m_result = r; + qDebug() << ": Got " << KCDDB::resultToString(r); + + CDInfoList l = client_->lookupResponse(); + + qDebug() << ": Item count: " << l.count(); + + QVERIFY(l.count() > 0); + m_info = l.first(); + + m_eventLoop.quit(); +} + +QTEST_GUILESS_MAIN(AsyncMusicBrainzTest) diff -Nru libkcddb-15.12.3/tests/asyncmusicbrainztest.h libkcddb-16.12.1/tests/asyncmusicbrainztest.h --- libkcddb-15.12.3/tests/asyncmusicbrainztest.h 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/asyncmusicbrainztest.h 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,45 @@ +/* + Copyright (C) 2006 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef TEST_H +#define TEST_H + +#include +#include +#include "libkcddb/client.h" +#include "libkcddb/kcddb.h" + +using namespace KCDDB; + +class AsyncMusicBrainzTest : public QObject +{ + Q_OBJECT + private Q_SLOTS: + void testLookup(); + void slotFinished(KCDDB::Result); + + private: + + QEventLoop m_eventLoop; + KCDDB::Client * client_; + CDInfo m_info; + Result m_result; +}; + +#endif diff -Nru libkcddb-15.12.3/tests/asyncsmtpsubmittest.cpp libkcddb-16.12.1/tests/asyncsmtpsubmittest.cpp --- libkcddb-15.12.3/tests/asyncsmtpsubmittest.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/asyncsmtpsubmittest.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,84 @@ +/* + Copyright (C) 2006 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include + +#include "asyncsmtpsubmittest.h" +#include "libkcddb/submit.h" + +AsyncSMTPSubmitTest::AsyncSMTPSubmitTest(QCoreApplication& app) + : app_(app) +{ + using namespace KCDDB; + + client_ = new Client; + client_->config().setFreedbSubmitTransport(Submit::SMTP); + client_->config().setSubmitAddress(QString::fromUtf8("test-submit@freedb.org")); + client_->setBlockingMode( false ); + + TrackOffsetList list; + + list + << 150 // First track start. + << 2592 + << 35472 + << 47891 + << 123310 + << 133125; // Disc end. + + CDInfo cdInfo; + + cdInfo.set(QString::fromUtf8("discid"), QString::fromUtf8("3606ed05")); + cdInfo.set(QString::fromUtf8("revision"), 4); + cdInfo.set(QString::fromUtf8("title"), QString::fromUtf8("Bamse och Bronto")); + cdInfo.set(QString::fromUtf8("artist"), QString::fromUtf8("Musiksage")); + cdInfo.set(QString::fromUtf8("year"), 2001); + cdInfo.set(QString::fromUtf8("category"), QString::fromUtf8("misc")); + cdInfo.set(QString::fromUtf8("genre"), QString::fromUtf8("Barnsaga")); + cdInfo.set(QString::fromUtf8("extd"), QString::fromUtf8("Berättare: Olof Thunberg")); + + cdInfo.track(0).set(QString::fromUtf8("title"), QString::fromUtf8("Bamses signaturmelodi")); + cdInfo.track(1).set(QString::fromUtf8("title"),QString::fromUtf8("*")); + cdInfo.track(2).set(QString::fromUtf8("title"), QString::fromUtf8("Brummavisan")); + cdInfo.track(3).set(QString::fromUtf8("title"), QString::fromUtf8("*")); + cdInfo.track(4).set(QString::fromUtf8("title"), QString::fromUtf8("Jätteödlan Bronto")); + + connect(client_,SIGNAL(finished(KCDDB::Result)),SLOT(slotFinished(KCDDB::Result))); + + client_->submit(cdInfo, list); +} + + void +AsyncSMTPSubmitTest::slotFinished(Result r) +{ + qDebug() << "AsyncSMTPSubmitTest::slotFinished: Got " << KCDDB::resultToString(r); + + app_.quit(); +} + +int main(int argc, char ** argv) +{ + QCoreApplication app(argc, argv); + app.setApplicationName(QString::fromUtf8("libkcddb_test")); + + new AsyncSMTPSubmitTest(app); + + return app.exec(); +} diff -Nru libkcddb-15.12.3/tests/asyncsmtpsubmittest.h libkcddb-16.12.1/tests/asyncsmtpsubmittest.h --- libkcddb-15.12.3/tests/asyncsmtpsubmittest.h 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/asyncsmtpsubmittest.h 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,47 @@ +/* + Copyright (C) 2003 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef TEST_H +#define TEST_H + +#include +#include "libkcddb/client.h" + +using namespace KCDDB; + +class QCoreApplication; + +class AsyncSMTPSubmitTest : public QObject +{ + Q_OBJECT + + public: + AsyncSMTPSubmitTest(QCoreApplication& app); + + public Q_SLOTS: + + void slotFinished(KCDDB::Result); + + private: + + QCoreApplication& app_; + KCDDB::Client * client_; +}; + +#endif diff -Nru libkcddb-15.12.3/tests/cachetest.cpp libkcddb-16.12.1/tests/cachetest.cpp --- libkcddb-15.12.3/tests/cachetest.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/cachetest.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,132 @@ +/* + Copyright (C) 2007 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "cachetest.h" +#include "libkcddb/cache.h" + +#include "libkcddb/cdinfo.h" +#include "libkcddb/client.h" +#include "config-musicbrainz.h" +#include + +using namespace KCDDB; + +void CacheTest::initTestCase() +{ + m_client = new Client; + m_client->config().setCacheLocations(QStringList(QDir::homePath()+QString::fromUtf8("/.cddbTest/"))); + + // a1107d0a + m_list + << 150 // First track start. + << 29462 + << 66983 + << 96785 + << 135628 + << 168676 + << 194147 + << 222158 + << 247076 + << 278203 // Last track start. + << 316732; // Disc end. + + m_info.set(Artist, QString().leftJustified(10, QChar(0xe4))); + m_info.set(Title, QString().leftJustified(10, QChar(0xf6))); + + for (int i=0; i<10; i++) + { + m_info.track(i).set(Title, QString().leftJustified(30*(i+1), 'a'+i)); + } + +} + +void CacheTest::cleanupTestCase() +{ + QDir().rmdir(QDir::homePath()+QString::fromUtf8("/.cddbTest/")); +} + +bool CacheTest::verify(const QString& source, const QString& discid, const CDInfo& info) +{ + Cache::store(m_list, info, m_client->config()); + + CDInfoList results = Cache::lookup(m_list, m_client->config()); + foreach(const CDInfo &newInfo, results) + { + if (newInfo.get(QString::fromUtf8("source")) == source && newInfo.get(QString::fromUtf8("discid")).toString() == discid) + { + if (newInfo.get(Artist) != m_info.get(Artist)) + continue; + if (newInfo.get(Title) != m_info.get(Title)) + continue; + bool tracksOk = true; + for (int i=0; i < 10; i++) + { + if (newInfo.track(i).get(Title) != m_info.track(i).get(Title)) + { + tracksOk = false; + break; + } + } + + if (tracksOk) + return true; + } + } + return false; +} + +void CacheTest::testFreedb() +{ + CDInfo testInfo = m_info; + testInfo.set(QString::fromUtf8("source"), QString::fromUtf8("freedb")); + testInfo.set(QString::fromUtf8("discid"), QString::fromUtf8("a1107d0a")); + testInfo.set(QString::fromUtf8("category"), QString::fromUtf8("misc")); + + QVERIFY(verify(QString::fromUtf8("freedb"), QString::fromUtf8("a1107d0a"), testInfo)); + + QFile::remove(QDir::homePath()+QString::fromUtf8("/.cddbTest/misc/a1107d0a")); + QDir().rmdir(QDir::homePath()+QString::fromUtf8("/.cddbTest/misc/")); +} + +void CacheTest::testUser() +{ + CDInfo testInfo = m_info; + testInfo.set(QString::fromUtf8("source"), QString::fromUtf8("user")); + + QVERIFY(verify(QString::fromUtf8("user"), QString::fromUtf8("a1107d0a"), testInfo)); + + QFile::remove(QDir::homePath()+QString::fromUtf8("/.cddbTest/user/a1107d0a")); + QDir().rmdir(QDir::homePath()+QString::fromUtf8("/.cddbTest/user/")); +} + +void CacheTest::testMusicbrainz() +{ +#ifdef HAVE_MUSICBRAINZ5 + CDInfo testInfo = m_info; + testInfo.set(QString::fromUtf8("source"), QString::fromUtf8("musicbrainz")); + testInfo.set(QString::fromUtf8("discid"), QString::fromUtf8("wdABQ7s86gS7eVmS74CCQ6KwPUI-")); + + QVERIFY(verify(QString::fromUtf8("musicbrainz"), QString::fromUtf8("wdABQ7s86gS7eVmS74CCQ6KwPUI-"), testInfo)); + + QFile::remove(QDir::homePath()+QString::fromUtf8("/.cddbTest/musicbrainz/wdABQ7s86gS7eVmS74CCQ6KwPUI-")); + QDir().rmdir(QDir::homePath()+QString::fromUtf8("/.cddbTest/musicbrainz/")); +#endif +} + +QTEST_GUILESS_MAIN(CacheTest) diff -Nru libkcddb-15.12.3/tests/cachetest.h libkcddb-16.12.1/tests/cachetest.h --- libkcddb-15.12.3/tests/cachetest.h 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/cachetest.h 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,50 @@ +/* + Copyright (C) 2007 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef CACHETEST_H +#define CACHETEST_H + +#include "libkcddb/cdinfo.h" +#include "libkcddb/kcddb.h" + +namespace KCDDB +{ + class Client; +} + +#include + +class CacheTest : public QObject +{ + Q_OBJECT +private Q_SLOTS: + void initTestCase(); + void cleanupTestCase(); + void testFreedb(); + void testUser(); + void testMusicbrainz(); +private: + bool verify(const QString& source, const QString& discid, const KCDDB::CDInfo& info); + + KCDDB::Client* m_client; + KCDDB::CDInfo m_info; + KCDDB::TrackOffsetList m_list; +}; + +#endif diff -Nru libkcddb-15.12.3/tests/cdinfotest.cpp libkcddb-16.12.1/tests/cdinfotest.cpp --- libkcddb-15.12.3/tests/cdinfotest.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/cdinfotest.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,91 @@ +/* + Copyright (C) 2005-2006 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include +#include "libkcddb/cdinfo.h" +#include "cdinfotest.h" + +using namespace KCDDB; + +void CDInfoTest::testLongLines() +{ + CDInfo info; + + QString str; + + TrackInfo& tinfo = info.track(0); + + for (int i=0; i <= 100; i++) + { + str.fill(QLatin1Char('A'),10*i); + info.set(Title, str); + str.fill(QLatin1Char('B'),10*i); + str.append(QLatin1Char('\n')); + info.set(Comment, str); + str.fill(QLatin1Char('C'),10*i); + info.set(Artist, str); + str.fill(QLatin1Char('D'),10*i); + info.set(Genre, str); + str.fill(QLatin1Char('E'),10*i); + info.set(Length, str); + str.fill(QLatin1Char('F'),10*i); + str.append(QLatin1Char('\n')); + info.set(QString::fromUtf8("custom"), str); + str.fill(QLatin1Char('G'),10*i); + tinfo.set(Title, str); + str.fill(QLatin1Char('H'),10*i); + str.append(QLatin1Char('\n')); + tinfo.set(QString::fromUtf8("custom"), str); + QString data = info.toString(); + QString submitData = info.toString(true); + + CDInfo info2; + info2.load(data); + str.fill(QLatin1Char('A'),10*i); + QCOMPARE(info2.get(Title).toString(), str); + str.fill(QLatin1Char('B'),10*i); + str.append(QLatin1Char('\n')); + QCOMPARE(info2.get(Comment).toString(), str); + str.fill(QLatin1Char('C'),10*i); + QCOMPARE(info2.get(Artist).toString(), str); + str.fill(QLatin1Char('D'),10*i); + if (i == 0) + QCOMPARE(info2.get(Genre).toString(), QString::fromUtf8("Unknown")); + else + QCOMPARE(info2.get(Genre).toString(), str); + str.fill(QLatin1Char('E'),10*i); + QCOMPARE(info2.get(Length).toString(), str); + str.fill(QLatin1Char('F'),10*i); + str.append(QLatin1Char('\n')); + QCOMPARE(info2.get(QString::fromUtf8("custom")).toString(), str); + str.fill(QLatin1Char('G'),10*i); + QCOMPARE(info2.track(0).get(Title).toString(), str); + const CDInfo info3(info2); + QCOMPARE(info3.track(0).get(Title).toString(), str); + str.fill(QLatin1Char('H'),10*i); + str.append(QLatin1Char('\n')); + QCOMPARE(info2.track(0).get(QString::fromUtf8("custom")).toString(), str); + + QVERIFY(!submitData.contains(QString::fromUtf8("CUSTOM"))); + QVERIFY(data.contains(QString::fromUtf8("CUSTOM"))); + } +} + +QTEST_GUILESS_MAIN(CDInfoTest) diff -Nru libkcddb-15.12.3/tests/cdinfotest.h libkcddb-16.12.1/tests/cdinfotest.h --- libkcddb-15.12.3/tests/cdinfotest.h 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/cdinfotest.h 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,32 @@ +/* + Copyright (C) 2005 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef CDINFOTEST_H +#define CDINFOTEST_H + +#include + +class CDInfoTest : public QObject +{ + Q_OBJECT +private Q_SLOTS: + void testLongLines(); +}; + +#endif diff -Nru libkcddb-15.12.3/tests/CMakeLists.txt libkcddb-16.12.1/tests/CMakeLists.txt --- libkcddb-15.12.3/tests/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/CMakeLists.txt 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,25 @@ +function(add_unit_tests) + foreach(test ${ARGN}) + add_executable(${test} ${test}.cpp) + add_test( ${test} ${test} ) + target_link_libraries(${test} Qt5::Test KF5::Cddb) + endforeach() +endfunction() + +add_unit_tests( + asynchttplookuptest + asynccddblookuptest + synccddblookuptest + synchttplookuptest + utf8test + musicbrainztest + asyncmusicbrainztest + cdinfotest + cachetest + musicbrainztest-severaldiscs + musicbrainztest-fulldate + syncsmtpsubmittest + asyncsmtpsubmittest + asynchttpsubmittest + synchttpsubmittest + sitestest) diff -Nru libkcddb-15.12.3/tests/musicbrainztest.cpp libkcddb-16.12.1/tests/musicbrainztest.cpp --- libkcddb-15.12.3/tests/musicbrainztest.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/musicbrainztest.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,121 @@ +/* + Copyright (C) 2006 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "musicbrainztest.h" +#include "libkcddb/client.h" +#include "libkcddb/cache.h" +#include "libkcddb/lookup.h" +#include "config-musicbrainz.h" +#include + +void MusicBrainzTest::testLookup() +{ + using namespace KCDDB; + +#ifndef HAVE_MUSICBRAINZ5 + QSKIP("This test requires libmusicbrainz", SkipAll); +#endif + + Client c; + c.config().setCacheLookupEnabled(false); + c.config().setFreedbLookupEnabled(false); + c.config().setMusicBrainzLookupEnabled(true); + + TrackOffsetList list; + + //The Liptones / The Latest News + list + << 150 + << 9219 + << 20386 + << 34134 + << 51437 + << 68809 + << 86591 + << 106288 + << 115568 + << 133312 + << 155593 + << 169832 + << 179626 + << 194958 + << 212506; + + Result r = c.lookup(list); + + QVERIFY(r == Success); + + qDebug() << "Client::lookup gave : " << resultToString(r); + + CDInfoList response = c.lookupResponse(); + + qDebug() << "Client::lookup returned : " << response.count() << " entries" + << endl; + + QVERIFY(response.count() > 0); + + // See http://musicbrainz.org/release/68ec4a09-576c-472e-9103-aed99b6a3ffc for changes + CDInfo i(response.first()); + QCOMPARE(i.numberOfTracks(),14); + + QCOMPARE(i.get(Artist).toString(),QString::fromUtf8("The Liptones")); + QCOMPARE(i.get(Title).toString(),QString::fromUtf8("The Latest News")); + // genre not really supported for musicbrainz + QCOMPARE(i.get(Genre).toString(),QString()); + QCOMPARE(i.get(Year).toInt(),2002); + QCOMPARE(i.track(0).get(Title).toString(),QString::fromUtf8("Jungle Heat")); + QCOMPARE(i.track(1).get(Title).toString(),QString::fromUtf8("It's All I Hear You Say")); + QCOMPARE(i.track(2).get(Title).toString(),QString::fromUtf8("Girl for Tonight")); + QCOMPARE(i.track(3).get(Title).toString(),QString::fromUtf8("Shoot Em Down")); + QCOMPARE(i.track(4).get(Title).toString(),QString::fromUtf8("Beautiful Day")); + QCOMPARE(i.track(5).get(Title).toString(),QString::fromUtf8("Paranoia")); + QCOMPARE(i.track(6).get(Title).toString(),QString::fromUtf8("My Way")); + QCOMPARE(i.track(7).get(Title).toString(),QString::fromUtf8("Dressed in Pink")); + QCOMPARE(i.track(8).get(Title).toString(),QString::fromUtf8("No Way Out")); + QCOMPARE(i.track(9).get(Title).toString(),QString::fromUtf8("Strange Kind of Justice")); + QCOMPARE(i.track(10).get(Title).toString(),QString::fromUtf8("Waiting Til Midnight")); + QCOMPARE(i.track(11).get(Title).toString(),QString::fromUtf8("Liptones")); + QCOMPARE(i.track(12).get(Title).toString(),QString::fromUtf8("Out With the Boys")); + QCOMPARE(i.track(13).get(Title).toString(),QString::fromUtf8("Free Like a Bird")); + // comments not supported in a simple way + for (int j=0; j < 14; j++) + QCOMPARE(i.track(j).get(Comment).toString(),QString()); + + // Make sure it's the same when loaded from the cache again + c.config().setCacheLookupEnabled(true); + c.config().setFreedbLookupEnabled(false); + c.config().setMusicBrainzLookupEnabled(false); + + c.lookup(list); + + response = c.lookupResponse(); + QVERIFY(response.count() > 0); + + CDInfo cacheInfo(response.first()); + QCOMPARE(i.get(Artist).toString(),cacheInfo.get(Artist).toString()); + QCOMPARE(i.get(Title).toString(),cacheInfo.get(Title).toString()); + QCOMPARE(i.get(Year).toInt(),cacheInfo.get(Year).toInt()); + for (int j=0; j < 14; j++) + { + QCOMPARE(i.track(j).get(Title).toString(),cacheInfo.track(j).get(Title).toString()); + QCOMPARE(i.track(j).get(Comment).toString(),cacheInfo.track(j).get(Comment).toString()); + } +} + +QTEST_GUILESS_MAIN(MusicBrainzTest) diff -Nru libkcddb-15.12.3/tests/musicbrainztest-fulldate.cpp libkcddb-16.12.1/tests/musicbrainztest-fulldate.cpp --- libkcddb-15.12.3/tests/musicbrainztest-fulldate.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/musicbrainztest-fulldate.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,154 @@ +/* + Copyright (C) 2006 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "musicbrainztest-fulldate.h" +#include "libkcddb/client.h" +#include "libkcddb/cache.h" +#include "libkcddb/lookup.h" +#include "config-musicbrainz.h" +#include + +void MusicBrainzTestFullDate::testLookup() +{ + using namespace KCDDB; + +#ifndef HAVE_MUSICBRAINZ5 + QSKIP("This test requires libmusicbrainz", SkipAll); +#endif + + Client c; + c.config().setCacheLookupEnabled(false); + c.config().setFreedbLookupEnabled(false); + c.config().setMusicBrainzLookupEnabled(true); + + TrackOffsetList list; + + list << + 150 << + 11837 << + 20687 << + 29120 << + 35557 << + 50087 << + 58550 << + 72575 << + 81887 << + 95745 << + 104340 << + 115425 << + 124285 << + 132317 << + 142692 << + 160272 << + 169325 << + 181377 << + 194482 << + 205747 << + 216492 << + 229507 << + 242715 << + 252112 << + 274965 << + 285820 << + 308957 << + 322362 << + 338662 << + 350172 << + 356692; + + Result r = c.lookup(list); + + QVERIFY(r == Success); + + qDebug() << "Client::lookup gave : " << resultToString(r); + + CDInfoList response = c.lookupResponse(); + + qDebug() << "Client::lookup returned : " << response.count() << " entries" + << endl; + + QVERIFY(response.count() > 0); + + // See http://musicbrainz.org/release/04319e80-0948-4e89-8180-7cf6f17fc77a for changes + CDInfo i(response.first()); + QCOMPARE(i.numberOfTracks(),30); + + QCOMPARE(i.get(Artist).toString(),QString::fromUtf8("Troublemakers")); + QCOMPARE(i.get(Title).toString(),QString::fromUtf8("30")); + // genre not really supported for musicbrainz + QCOMPARE(i.get(Genre).toString(),QString()); + QCOMPARE(i.get(Year).toInt(),2011); + QCOMPARE(i.track(0).get(Title).toString(),QString::fromUtf8("30")); + QCOMPARE(i.track(1).get(Title).toString(),QString::fromUtf8("Staden Göteborg")); + QCOMPARE(i.track(2).get(Title).toString(),QString::fromUtf8("Lilla Blå")); + QCOMPARE(i.track(3).get(Title).toString(),QString::fromUtf8("Kleptoman")); + QCOMPARE(i.track(4).get(Title).toString(),QString::fromUtf8("Grogg å parabol")); + QCOMPARE(i.track(5).get(Title).toString(),QString::fromUtf8("Majorna brinner")); + QCOMPARE(i.track(6).get(Title).toString(),QString::fromUtf8("Utan hjärta stannar Sverige")); + QCOMPARE(i.track(7).get(Title).toString(),QString::fromUtf8("Dom e efter mig")); + QCOMPARE(i.track(8).get(Title).toString(),QString::fromUtf8("Mammas flickor")); + QCOMPARE(i.track(9).get(Title).toString(),QString::fromUtf8("Handgranat")); + QCOMPARE(i.track(10).get(Title).toString(),QString::fromUtf8("Stenar o blod")); + QCOMPARE(i.track(11).get(Title).toString(),QString::fromUtf8("Enkel Berlin")); + QCOMPARE(i.track(12).get(Title).toString(),QString::fromUtf8("Dom ljuger")); + QCOMPARE(i.track(13).get(Title).toString(),QString::fromUtf8("Jobba")); + QCOMPARE(i.track(14).get(Title).toString(),QString::fromUtf8("Varför lyser inga stjärnor")); + QCOMPARE(i.track(15).get(Title).toString(),QString::fromUtf8("Partytrash")); + QCOMPARE(i.track(16).get(Title).toString(),QString::fromUtf8("Förstod ingenting")); + QCOMPARE(i.track(17).get(Title).toString(),QString::fromUtf8("Bara om min älskade väntar")); + QCOMPARE(i.track(18).get(Title).toString(),QString::fromUtf8("Lillebror")); + QCOMPARE(i.track(19).get(Title).toString(),QString::fromUtf8("Skandaler")); + QCOMPARE(i.track(20).get(Title).toString(),QString::fromUtf8("Hjältarna skålar i blod")); + QCOMPARE(i.track(21).get(Title).toString(),QString::fromUtf8("Bomber o granater")); + QCOMPARE(i.track(22).get(Title).toString(),QString::fromUtf8("Vill du bli miljonär")); + QCOMPARE(i.track(23).get(Title).toString(),QString::fromUtf8("Stjärnorna kvittar det lika")); + QCOMPARE(i.track(24).get(Title).toString(),QString::fromUtf8("Naken")); + QCOMPARE(i.track(25).get(Title).toString(),QString::fromUtf8("Månen lyser klar")); + QCOMPARE(i.track(26).get(Title).toString(),QString::fromUtf8("Vild o vacker")); + QCOMPARE(i.track(27).get(Title).toString(),QString::fromUtf8("Jag fryser")); + QCOMPARE(i.track(28).get(Title).toString(),QString::fromUtf8("Ein zwei polizei")); + QCOMPARE(i.track(29).get(Title).toString(),QString::fromUtf8("Jävla idiot")); + for (int j=0; j < 30; j++) + QCOMPARE(i.track(j).get(Artist).toString(),QString::fromUtf8("Troublemakers")); + // comments not supported in a simple way + for (int j=0; j < 19; j++) + QCOMPARE(i.track(j).get(Comment).toString(),QString()); + + // Make sure it's the same when loaded from the cache again + c.config().setCacheLookupEnabled(true); + c.config().setFreedbLookupEnabled(false); + c.config().setMusicBrainzLookupEnabled(false); + + c.lookup(list); + + response = c.lookupResponse(); + QVERIFY(response.count() > 0); + + CDInfo cacheInfo(response.first()); + QCOMPARE(i.get(Artist).toString(),cacheInfo.get(Artist).toString()); + QCOMPARE(i.get(Title).toString(),cacheInfo.get(Title).toString()); + QCOMPARE(i.get(Year).toInt(),cacheInfo.get(Year).toInt()); + for (int j=0; j < 19; j++) + { + QCOMPARE(i.track(j).get(Title).toString(),cacheInfo.track(j).get(Title).toString()); + QCOMPARE(i.track(j).get(Comment).toString(),cacheInfo.track(j).get(Comment).toString()); + } +} + +QTEST_GUILESS_MAIN(MusicBrainzTestFullDate) diff -Nru libkcddb-15.12.3/tests/musicbrainztest-fulldate.h libkcddb-16.12.1/tests/musicbrainztest-fulldate.h --- libkcddb-15.12.3/tests/musicbrainztest-fulldate.h 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/musicbrainztest-fulldate.h 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,32 @@ +/* + Copyright (C) 2006 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef MUSICBRAINZTESTFULLDATE_H +#define MUSICBRAINZTESTFULLDATE_H + +#include + +class MusicBrainzTestFullDate : public QObject +{ + Q_OBJECT + private Q_SLOTS: + void testLookup(); +}; + +#endif diff -Nru libkcddb-15.12.3/tests/musicbrainztest.h libkcddb-16.12.1/tests/musicbrainztest.h --- libkcddb-15.12.3/tests/musicbrainztest.h 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/musicbrainztest.h 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,32 @@ +/* + Copyright (C) 2006 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef MUSICBRAINZTEST_H +#define MUSICBRAINZTEST_H + +#include + +class MusicBrainzTest : public QObject +{ + Q_OBJECT + private Q_SLOTS: + void testLookup(); +}; + +#endif diff -Nru libkcddb-15.12.3/tests/musicbrainztest-severaldiscs.cpp libkcddb-16.12.1/tests/musicbrainztest-severaldiscs.cpp --- libkcddb-15.12.3/tests/musicbrainztest-severaldiscs.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/musicbrainztest-severaldiscs.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,138 @@ +/* + Copyright (C) 2006 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "musicbrainztest-severaldiscs.h" +#include "libkcddb/client.h" +#include "libkcddb/cache.h" +#include "libkcddb/lookup.h" +#include "config-musicbrainz.h" +#include + +void MusicBrainzTestSeveralDiscs::testLookup() +{ + using namespace KCDDB; + +#ifndef HAVE_MUSICBRAINZ5 + QSKIP("This test requires libmusicbrainz", SkipAll); +#endif + + Client c; + c.config().setCacheLookupEnabled(false); + c.config().setFreedbLookupEnabled(false); + c.config().setMusicBrainzLookupEnabled(true); + + TrackOffsetList list; + + list << + 150 << + 17272 << + 36395 << + 47954 << + 63638 << + 77928 << + 95029 << + 112094 << + 130540 << + 145938 << + 160463 << + 180364 << + 195549 << + 203821 << + 222410 << + 230367 << + 249241 << + 273944 << + 287584 << + 309904 << + 325124; + + Result r = c.lookup(list); + + QVERIFY(r == Success); + + qDebug() << "Client::lookup gave : " << resultToString(r); + + CDInfoList response = c.lookupResponse(); + + qDebug() << "Client::lookup returned : " << response.count() << " entries" + << endl; + + QVERIFY(response.count() > 0); + + // See http://musicbrainz.org/release/4e0655b5-22fc-496e-9c14-2ee1a6027b45 for changes (disc 2) + CDInfo i(response.first()); + QCOMPARE(i.numberOfTracks(),20); + + QCOMPARE(i.get(Artist).toString(),QString::fromUtf8("Billy Bragg")); + QCOMPARE(i.get(Title).toString(),QString::fromUtf8("Must I Paint You a Picture? The Essential Billy Bragg (disc 2)")); + // genre not really supported for musicbrainz + QCOMPARE(i.get(Genre).toString(),QString()); + QCOMPARE(i.get(Year).toInt(),2003); + QCOMPARE(i.track(0).get(Title).toString(),QString::fromUtf8("Sexuality")); + QCOMPARE(i.track(1).get(Title).toString(),QString::fromUtf8("Cindy of 1000 Lives")); + QCOMPARE(i.track(2).get(Title).toString(),QString::fromUtf8("Moving the Goalposts")); + QCOMPARE(i.track(3).get(Title).toString(),QString::fromUtf8("Tank Park Salute")); + QCOMPARE(i.track(4).get(Title).toString(),QString::fromUtf8("You Woke Up My Neighbourhood")); + QCOMPARE(i.track(5).get(Title).toString(),QString::fromUtf8("Accident Waiting to Happen (Red Stars version)")); + QCOMPARE(i.track(6).get(Title).toString(),QString::fromUtf8("Sulk")); + QCOMPARE(i.track(7).get(Title).toString(),QString::fromUtf8("Upfield")); + QCOMPARE(i.track(8).get(Title).toString(),QString::fromUtf8("The Fourteenth of February")); + QCOMPARE(i.track(9).get(Title).toString(),QString::fromUtf8("Brickbat")); + QCOMPARE(i.track(10).get(Title).toString(),QString::fromUtf8("The Space Race Is Over")); + QCOMPARE(i.track(11).get(Title).toString(),QString::fromUtf8("The Boy Done Good")); + QCOMPARE(i.track(12).get(Title).toString(),QString::fromUtf8("Ingrid Bergman")); + QCOMPARE(i.track(13).get(Title).toString(),QString::fromUtf8("Way Over Yonder in the Minor Key")); + QCOMPARE(i.track(14).get(Title).toString(),QString::fromUtf8("My Flying Saucer")); + QCOMPARE(i.track(15).get(Title).toString(),QString::fromUtf8("All You Fascists Bound to Lose (Blokes version)")); + QCOMPARE(i.track(16).get(Title).toString(),QString::fromUtf8("NPWA")); + QCOMPARE(i.track(17).get(Title).toString(),QString::fromUtf8("St. Monday")); + QCOMPARE(i.track(18).get(Title).toString(),QString::fromUtf8("Somedays I See the Point")); + QCOMPARE(i.track(19).get(Title).toString(),QString::fromUtf8("Take Down the Union Jack (Band version)")); + for (int j=0; j < 12; j++) + QCOMPARE(i.track(j).get(Artist).toString(),QString::fromUtf8("Billy Bragg")); + for (int j=12; j < 15; j++) + QCOMPARE(i.track(j).get(Artist).toString(),QString::fromUtf8("Billy Bragg & Wilco")); + for (int j=15; j < 20; j++) + QCOMPARE(i.track(j).get(Artist).toString(),QString::fromUtf8("Billy Bragg and The Blokes")); + // comments not supported in a simple way + for (int j=0; j < 19; j++) + QCOMPARE(i.track(j).get(Comment).toString(),QString()); + + // Make sure it's the same when loaded from the cache again + c.config().setCacheLookupEnabled(true); + c.config().setFreedbLookupEnabled(false); + c.config().setMusicBrainzLookupEnabled(false); + + c.lookup(list); + + response = c.lookupResponse(); + QVERIFY(response.count() > 0); + + CDInfo cacheInfo(response.first()); + QCOMPARE(i.get(Artist).toString(),cacheInfo.get(Artist).toString()); + QCOMPARE(i.get(Title).toString(),cacheInfo.get(Title).toString()); + QCOMPARE(i.get(Year).toInt(),cacheInfo.get(Year).toInt()); + for (int j=0; j < 19; j++) + { + QCOMPARE(i.track(j).get(Title).toString(),cacheInfo.track(j).get(Title).toString()); + QCOMPARE(i.track(j).get(Comment).toString(),cacheInfo.track(j).get(Comment).toString()); + } +} + +QTEST_GUILESS_MAIN(MusicBrainzTestSeveralDiscs) diff -Nru libkcddb-15.12.3/tests/musicbrainztest-severaldiscs.h libkcddb-16.12.1/tests/musicbrainztest-severaldiscs.h --- libkcddb-15.12.3/tests/musicbrainztest-severaldiscs.h 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/musicbrainztest-severaldiscs.h 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,32 @@ +/* + Copyright (C) 2006 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef MUSICBRAINZTESTSEVERALDISCS_H +#define MUSICBRAINZTESTSEVERALDISCS_H + +#include + +class MusicBrainzTestSeveralDiscs : public QObject +{ + Q_OBJECT + private Q_SLOTS: + void testLookup(); +}; + +#endif diff -Nru libkcddb-15.12.3/tests/sitestest.cpp libkcddb-16.12.1/tests/sitestest.cpp --- libkcddb-15.12.3/tests/sitestest.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/sitestest.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,46 @@ +/* + Copyright (C) 2003 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include +#include + +#include "libkcddb/sites.h" + + int +main(int argc, char ** argv) +{ + QCoreApplication app(argc, argv); + app.setApplicationName(QString::fromUtf8("libkcddb_test")); + + using namespace KCDDB; + + Sites s; + + qDebug() << "Sites: "; + + QList sites = s.siteList(); + for (QList::Iterator it = sites.begin(); it != sites.end(); ++it) + if ((*it).transport == Lookup::CDDBP) + qDebug() << (*it).address << " CDDBP " << (*it).port << " " << (*it).description; + else + qDebug() << (*it).address << " HTTP " << (*it).port << " " << (*it).description; + + return 0; +} diff -Nru libkcddb-15.12.3/tests/synccddblookuptest.cpp libkcddb-16.12.1/tests/synccddblookuptest.cpp --- libkcddb-15.12.3/tests/synccddblookuptest.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/synccddblookuptest.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,94 @@ +/* + Copyright (C) 2005 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "libkcddb/client.h" +#include "libkcddb/cache.h" +#include "libkcddb/lookup.h" +#include "synccddblookuptest.h" +#include + +void SyncCDDBLookupTest::testLookup() +{ + using namespace KCDDB; + + Client c; + c.config().setHostname(QString::fromUtf8("freedb.freedb.org")); + c.config().setPort(8880); + c.config().setCacheLookupEnabled(false); + c.config().setFreedbLookupEnabled(true); + c.config().setMusicBrainzLookupEnabled(false); + c.config().setFreedbLookupTransport(Lookup::CDDBP); + + TrackOffsetList list; + + list + << 150 + << 106965 + << 127220 + << 151925 + << 176085 + << 234500; + + Result r = c.lookup(list); + + QVERIFY(r == Success); + + CDInfoList response = c.lookupResponse(); + + CDInfoList::ConstIterator it; + + bool hasRunTest = false; + + for (it = response.constBegin(); it != response.constEnd(); ++it) + { + CDInfo i(*it); + + if (i.get(QString::fromUtf8("discid")) == QString::fromUtf8("3e0c3a05") && i.get(Category) == QString::fromUtf8("misc")) + { + // If revision doesn't match, test probably needs to be updated + // See: http://www.freedb.org/freedb/misc/3e0c3a05 for updated data + QCOMPARE(i.get(QString::fromUtf8("revision")).toInt(), 17); + + QCOMPARE(i.get(Artist).toString(),QString::fromUtf8("Pink Floyd")); + QCOMPARE(i.get(Title).toString(),QString::fromUtf8("Atom Heart Mother")); + QCOMPARE(i.get(Genre).toString(),QString::fromUtf8("Psychedelic Rock")); + QCOMPARE(i.get(Year).toInt(),1970); + QCOMPARE(i.track(0).get(Title).toString(),QString::fromUtf8("Atom Heart Mother: Father's Shout/Breast Milky/Mother Fore/Funky Dung/Mind Your Throats Please/Remergence")); + QCOMPARE(i.track(1).get(Title).toString(),QString::fromUtf8("If")); + QCOMPARE(i.track(2).get(Title).toString(),QString::fromUtf8("Summer '68")); + QCOMPARE(i.track(3).get(Title).toString(),QString::fromUtf8("Fat Old Sun")); + QCOMPARE(i.track(4).get(Title).toString(),QString::fromUtf8("Alan's Psychedelic Breakfast: Rise and Shine/Sunny Side Up/Morning Glory")); + QCOMPARE(i.track(0).get(Comment).toString(),QString::fromUtf8("")); + QCOMPARE(i.track(1).get(Comment).toString(),QString::fromUtf8("")); + QCOMPARE(i.track(2).get(Comment).toString(),QString::fromUtf8("")); + QCOMPARE(i.track(3).get(Comment).toString(),QString::fromUtf8("")); + QCOMPARE(i.track(4).get(Comment).toString(),QString::fromUtf8("")); + for (int j=0; j <= 4; j++) + { + QCOMPARE(i.track(j).get(Artist).toString(),QString::fromUtf8("Pink Floyd")); + } + + hasRunTest = true; + } + } + + QVERIFY(hasRunTest); +} + +QTEST_GUILESS_MAIN(SyncCDDBLookupTest) diff -Nru libkcddb-15.12.3/tests/synccddblookuptest.h libkcddb-16.12.1/tests/synccddblookuptest.h --- libkcddb-15.12.3/tests/synccddblookuptest.h 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/synccddblookuptest.h 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,32 @@ +/* + Copyright (C) 2005 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef SYNCCDDBLOOKUPTEST_H +#define SYNCCDDBLOOKUPTEST_H + +#include + +class SyncCDDBLookupTest : public QObject +{ + Q_OBJECT + private Q_SLOTS: + void testLookup(); +}; + +#endif diff -Nru libkcddb-15.12.3/tests/synchttplookuptest.cpp libkcddb-16.12.1/tests/synchttplookuptest.cpp --- libkcddb-15.12.3/tests/synchttplookuptest.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/synchttplookuptest.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,94 @@ +/* + Copyright (C) 2006 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "libkcddb/client.h" +#include "libkcddb/cache.h" +#include "libkcddb/lookup.h" +#include "synchttplookuptest.h" +#include + +void SyncHTTPLookupTest::testLookup() +{ + using namespace KCDDB; + + Client c; + c.config().setHostname(QString::fromUtf8("freedb.freedb.org")); + c.config().setPort(80); + c.config().setCacheLookupEnabled(false); + c.config().setFreedbLookupEnabled(true); + c.config().setMusicBrainzLookupEnabled(false); + c.config().setFreedbLookupTransport(Lookup::HTTP); + + TrackOffsetList list; + + list + << 150 + << 106965 + << 127220 + << 151925 + << 176085 + << 234500; + + Result r = c.lookup(list); + + QVERIFY(r == Success); + + CDInfoList response = c.lookupResponse(); + + CDInfoList::ConstIterator it; + + bool hasRunTest = false; + + for (it = response.constBegin(); it != response.constEnd(); ++it) + { + CDInfo i(*it); + + if (i.get(QString::fromUtf8("discid")) == QString::fromUtf8("3e0c3a05") && i.get(Category) == QString::fromUtf8("misc")) + { + // If revision doesn't match, test probably needs to be updated + // See: http://www.freedb.org/freedb/misc/3e0c3a05 for updated data + QCOMPARE(i.get(QString::fromUtf8("revision")).toInt(), 17); + + QCOMPARE(i.get(Artist).toString(),QString::fromUtf8("Pink Floyd")); + QCOMPARE(i.get(Title).toString(),QString::fromUtf8("Atom Heart Mother")); + QCOMPARE(i.get(Genre).toString(),QString::fromUtf8("Psychedelic Rock")); + QCOMPARE(i.get(Year).toInt(),1970); + QCOMPARE(i.track(0).get(Title).toString(),QString::fromUtf8("Atom Heart Mother: Father's Shout/Breast Milky/Mother Fore/Funky Dung/Mind Your Throats Please/Remergence")); + QCOMPARE(i.track(1).get(Title).toString(),QString::fromUtf8("If")); + QCOMPARE(i.track(2).get(Title).toString(),QString::fromUtf8("Summer '68")); + QCOMPARE(i.track(3).get(Title).toString(),QString::fromUtf8("Fat Old Sun")); + QCOMPARE(i.track(4).get(Title).toString(),QString::fromUtf8("Alan's Psychedelic Breakfast: Rise and Shine/Sunny Side Up/Morning Glory")); + QCOMPARE(i.track(0).get(Comment).toString(),QString::fromUtf8("")); + QCOMPARE(i.track(1).get(Comment).toString(),QString::fromUtf8("")); + QCOMPARE(i.track(2).get(Comment).toString(),QString::fromUtf8("")); + QCOMPARE(i.track(3).get(Comment).toString(),QString::fromUtf8("")); + QCOMPARE(i.track(4).get(Comment).toString(),QString::fromUtf8("")); + for (int j=0; j <= 4; j++) + { + QCOMPARE(i.track(j).get(Artist).toString(),QString::fromUtf8("Pink Floyd")); + } + + hasRunTest = true; + } + } + + QVERIFY(hasRunTest); +} + +QTEST_GUILESS_MAIN(SyncHTTPLookupTest) diff -Nru libkcddb-15.12.3/tests/synchttplookuptest.h libkcddb-16.12.1/tests/synchttplookuptest.h --- libkcddb-15.12.3/tests/synchttplookuptest.h 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/synchttplookuptest.h 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,32 @@ +/* + Copyright (C) 2006 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef SYNCHTTPLOOKUPTEST_H +#define SYNCHTTPLOOKUPTEST_H + +#include + +class SyncHTTPLookupTest : public QObject +{ + Q_OBJECT + private Q_SLOTS: + void testLookup(); +}; + +#endif diff -Nru libkcddb-15.12.3/tests/synchttpsubmittest.cpp libkcddb-16.12.1/tests/synchttpsubmittest.cpp --- libkcddb-15.12.3/tests/synchttpsubmittest.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/synchttpsubmittest.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,70 @@ +/* + Copyright (C) 2003 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include + +#include "libkcddb/client.h" +#include "libkcddb/kcddbconfig.h" +#include "libkcddb/submit.h" + + int +main(int argc, char ** argv) +{ + QCoreApplication app(argc, argv); + app.setApplicationName(QString::fromUtf8("libkcddb_test")); + + using namespace KCDDB; + + TrackOffsetList list; + + list + << 150 // First track start. + << 2592 + << 35472 + << 47891 + << 123310 + << 133125; // Disc end. + + CDInfo cdInfo; + + cdInfo.set(QString::fromUtf8("discid"), QString::fromUtf8("3606ed05")); + cdInfo.set(QString::fromUtf8("revision"), 4); + cdInfo.set(QString::fromUtf8("title"), QString::fromUtf8("Bamse och Bronto")); + cdInfo.set(QString::fromUtf8("artist"), QString::fromUtf8("Musiksage")); + cdInfo.set(QString::fromUtf8("year"), 2001); + cdInfo.set(QString::fromUtf8("category"), QString::fromUtf8("misc")); + cdInfo.set(QString::fromUtf8("genre"), QString::fromUtf8("Barnsaga")); + cdInfo.set(QString::fromUtf8("extd"), QString::fromUtf8("Berättare: Olof Thunberg")); + + cdInfo.track(0).set(QString::fromUtf8("title"), QString::fromUtf8("Bamses signaturmelodi")); + cdInfo.track(1).set(QString::fromUtf8("title"),QString::fromUtf8("*")); + cdInfo.track(2).set(QString::fromUtf8("title"), QString::fromUtf8("Brummavisan")); + cdInfo.track(3).set(QString::fromUtf8("title"), QString::fromUtf8("*")); + cdInfo.track(4).set(QString::fromUtf8("title"), QString::fromUtf8("Jätteödlan Bronto")); + + Client c; + c.config().setFreedbSubmitTransport(Submit::HTTP); + c.setBlockingMode( true ); + + Result r = c.submit(cdInfo, list); + + qDebug() << "Result: " << resultToString(r); +} + diff -Nru libkcddb-15.12.3/tests/syncsmtpsubmittest.cpp libkcddb-16.12.1/tests/syncsmtpsubmittest.cpp --- libkcddb-15.12.3/tests/syncsmtpsubmittest.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/syncsmtpsubmittest.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,72 @@ +/* + Copyright (C) 2003 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include + +#include "libkcddb/client.h" +#include "libkcddb/kcddbconfig.h" +#include "libkcddb/submit.h" + + int +main(int argc, char ** argv) +{ + QCoreApplication app(argc, argv); + app.setApplicationName(QString::fromUtf8("libkcddb_test")); + + using namespace KCDDB; + + TrackOffsetList list; + + list + << 150 // First track start. + << 2592 + << 35472 + << 47891 + << 123310 + << 133125; // Disc end. + + CDInfo cdInfo; + + cdInfo.set(QString::fromUtf8("discid"), QString::fromUtf8("3606ed05")); + cdInfo.set(QString::fromUtf8("revision"), 4); + cdInfo.set(QString::fromUtf8("title"), QString::fromUtf8("Bamse och Bronto")); + cdInfo.set(QString::fromUtf8("artist"), QString::fromUtf8("Musiksage")); + cdInfo.set(QString::fromUtf8("year"), 2001); + cdInfo.set(QString::fromUtf8("category"), QString::fromUtf8("misc")); + cdInfo.set(QString::fromUtf8("genre"), QString::fromUtf8("Barnsaga")); + cdInfo.set(QString::fromUtf8("extd"), QString::fromUtf8("Berättare: Olof Thunberg")); + + cdInfo.track(0).set(QString::fromUtf8("title"), QString::fromUtf8("Bamses signaturmelodi")); + cdInfo.track(1).set(QString::fromUtf8("title"),QString::fromUtf8("*")); + cdInfo.track(2).set(QString::fromUtf8("title"), QString::fromUtf8("Brummavisan")); + cdInfo.track(3).set(QString::fromUtf8("title"), QString::fromUtf8("*")); + cdInfo.track(4).set(QString::fromUtf8("title"), QString::fromUtf8("Jätteödlan Bronto")); + + Client c; + c.config().setFreedbSubmitTransport(Submit::SMTP); + c.config().setSubmitAddress(QString::fromUtf8("test-submit@freedb.org")); + + c.setBlockingMode( true ); + + Result r = c.submit(cdInfo, list); + + qDebug() << "Result: " << resultToString(r); +} + diff -Nru libkcddb-15.12.3/tests/utf8test.cpp libkcddb-16.12.1/tests/utf8test.cpp --- libkcddb-15.12.3/tests/utf8test.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/utf8test.cpp 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,85 @@ +/* + Copyright (C) 2004-2006 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "libkcddb/client.h" +#include "libkcddb/cache.h" +#include "libkcddb/lookup.h" +#include "utf8test.h" +#include + +void Utf8Test::testLookup() +{ + using namespace KCDDB; + + Client c; + c.config().setHostname(QString::fromUtf8("freedb.freedb.org")); + c.config().setPort(80); + c.config().setCacheLookupEnabled(false); + c.config().setFreedbLookupEnabled(true); + c.config().setMusicBrainzLookupEnabled(false); + c.config().setFreedbLookupTransport(Lookup::HTTP); + + TrackOffsetList list; + + list + << 150 + << 61408 + << 177675; + + c.lookup(list); + + CDInfoList response = c.lookupResponse(); + + CDInfoList::ConstIterator it; + + bool hasRunTest = false; + + for (it = response.constBegin(); it != response.constEnd(); ++it) + { + CDInfo i(*it); + + if (i.get(QString::fromUtf8("discid")) == QString::fromUtf8("13093f02") && i.get(Category) == QString::fromUtf8("blues")) + { + // If revision doesn't match, test probably needs to be updated + // See: http://www.freedb.org/freedb/blues/13093f02 for updated data + QCOMPARE(i.get(QString::fromUtf8("revision")).toInt(), 3); + + QString artist = QString::fromUtf8("神城麻郁(浪川大輔)/宮藤深衣奈(中原麻衣)/小野寺樺恋(清水愛)/織部椿(根谷美智子)/島崎康生(鈴村健一)/風見みずほ(井上喜久子)/森野苺(田村ゆかり)/四道跨(三浦祥朗)/四道晴子(新谷良子)/佐川秋那(浅野真澄)/真下双葉(佐久間紅美)/菊池浩美(進藤尚美)/草薙桂(保志総一郎)/縁川小石(川澄綾子)/間雲漂介(岩田光央)/水澄楓(大原さやか)/まりえ(金田朋子)/山田政臣(杉田智和)神城麻郁(浪川大輔)/宮藤深衣奈(中原麻衣)/小野寺樺恋(清水愛)/織部椿(根谷美智子)/島崎康生(鈴村健一)/風見みずほ(井上喜久子)/森野苺(田村ゆかり)/四道跨(三Y祥朗)/四道晴子(新谷良子)/佐川秋那(浅野真澄)/真下双葉(佐久間紅美)/菊池浩美(進藤尚美)/草薙桂(保志総一郎)/縁川小石(川澄綾子)/間雲漂介(岩田光央)/水澄楓(大原さやか)/まりえ(金田朋子)/山田政臣(杉田智和)"); + + QCOMPARE(i.get(Artist).toString(),artist); + QCOMPARE(i.get(Title).toString(),QString::fromUtf8("みずほ先生とはちみつツインズ ドラマアルバム2時間目「百合百合ツインズ」")); + QCOMPARE(i.get(Genre).toString(),QString::fromUtf8("Anime")); + QCOMPARE(i.get(Year).toInt(),2004); + QCOMPARE(i.track(0).get(Title).toString(),QString::fromUtf8("第EX話 おねがい☆全員集合")); + QCOMPARE(i.track(1).get(Title).toString(),QString::fromUtf8("エピローグ")); + QCOMPARE(i.track(0).get(Comment).toString(),QString::fromUtf8("")); + QCOMPARE(i.track(1).get(Comment).toString(),QString::fromUtf8("")); + for (int j=0; j <= 1; j++) + { + QCOMPARE(i.track(j).get(Artist).toString(),artist); + } + + hasRunTest = true; + } + } + + QVERIFY(hasRunTest); +} + +QTEST_GUILESS_MAIN(Utf8Test) diff -Nru libkcddb-15.12.3/tests/utf8test.h libkcddb-16.12.1/tests/utf8test.h --- libkcddb-15.12.3/tests/utf8test.h 1970-01-01 00:00:00.000000000 +0000 +++ libkcddb-16.12.1/tests/utf8test.h 2016-12-12 00:51:42.000000000 +0000 @@ -0,0 +1,32 @@ +/* + Copyright (C) 2006 Richard Lärkäng + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef UTF8TEST_H +#define UTF8TEST_H + +#include + +class Utf8Test : public QObject +{ + Q_OBJECT + private Q_SLOTS: + void testLookup(); +}; + +#endif