Commit 1d4f4777 authored by Michał Małek's avatar Michał Małek
Browse files

Removed dependency on KDELibs4Support

parent 0a0deb48
......@@ -11,8 +11,8 @@ include(KDECMakeSettings)
include(FeatureSummary)
include(GenerateExportHeader)
find_package(Qt5 REQUIRED COMPONENTS Test)
find_package(KF5 REQUIRED COMPONENTS Config DocTools KDELibs4Support Codecs KIO)
find_package(Qt5 REQUIRED COMPONENTS Network Widgets Test)
find_package(KF5 REQUIRED COMPONENTS Config DocTools Codecs I18n KIO WidgetsAddons)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
......@@ -25,16 +25,8 @@ set_package_properties(MusicBrainz5 PROPERTIES
if(MUSICBRAINZ5_FOUND)
set(HAVE_MUSICBRAINZ5 1)
include_directories(${MUSICBRAINZ5_INCLUDE_DIR})
set(libmusicbrainz_SRCS ${libmusicbrainz_SRCS}
musicbrainz/musicbrainzlookup.cpp
musicbrainz/asyncmusicbrainzlookup.cpp)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}")
else()
set(HAVE_MUSICBRAINZ5 0)
set(libmusicbrainz_SRCS)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-musicbrainz.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-musicbrainz.h )
......
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../libkcddb ${CMAKE_CURRENT_BINARY_DIR}/../libkcddb )
add_subdirectory ( doc )
########### next target ###############
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)
qt5_wrap_ui(kcm_cddb_PART_SRCS cddbconfigwidget.ui )
add_library(kcm_cddb MODULE ${kcm_cddb_PART_SRCS})
qt5_wrap_ui(ui_sources cddbconfigwidget.ui)
add_library(kcm_cddb MODULE
cddbconfigwidget.cpp
kcmcddb.cpp
${ui_sources})
set_source_files_properties(cddbconfigwidget.cpp PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ui_cddbconfigwidget.h)
target_link_libraries(kcm_cddb KF5::KIOCore kcddb)
install(TARGETS kcm_cddb DESTINATION ${PLUGIN_INSTALL_DIR} )
########### install files ###############
install( FILES libkcddb.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
target_link_libraries(kcm_cddb PRIVATE
KF5::ConfigWidgets
KF5::I18n
KF5::KIOCore
KF5::KIOWidgets
KF5::WidgetsAddons
kcddb)
install(TARGETS kcm_cddb DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES libkcddb.desktop DESTINATION ${SERVICES_INSTALL_DIR})
......@@ -22,14 +22,11 @@
#include "config-musicbrainz.h"
#include <kdemacros.h> // KDE_NO_DEPRECATED
#include "libkcddb/sites.h"
#include "libkcddb/lookup.h"
#include <qlist.h>
#include <kapplication.h>
#include <klocale.h>
#include <KI18n/KLocalizedString>
#include <kmessagebox.h>
#include <keditlistwidget.h>
#include <kurlrequester.h>
......
include_directories(${CMAKE_CURRENT_BINARY_DIR})
if(MUSICBRAINZ5_FOUND)
set(musicbrainz_sources
musicbrainz/musicbrainzlookup.cpp
musicbrainz/asyncmusicbrainzlookup.cpp)
########### next target ###############
include_directories(${MUSICBRAINZ5_INCLUDE_DIR})
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
logging.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()
qt5_wrap_ui(kcddb_LIB_SRCS cdinfodialog.ui cdinfoencodingwidget.ui )
set_source_files_properties(${musicbrainz_sources} PROPERTIES COMPILE_FLAGS ${enable_exceptions})
endif()
kconfig_add_kcfg_files(kcddb_LIB_SRCS configbase.kcfgc )
qt5_wrap_ui(ui_sources cdinfodialog.ui cdinfoencodingwidget.ui)
add_library(kcddb SHARED ${kcddb_LIB_SRCS})
kconfig_add_kcfg_files(kcfg_sources configbase.kcfgc)
target_link_libraries(kcddb KF5::Codecs KF5::ConfigGui KF5::KDELibs4Support KF5::KIOCore)
if(MUSICBRAINZ5_FOUND)
target_link_libraries(kcddb ${MUSICBRAINZ5_LIBRARIES})
endif(MUSICBRAINZ5_FOUND)
add_library(kcddb 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
cdinfodialog.cpp
cdinfoencodingwidget.cpp
logging.cpp
${musicbrainz_sources}
${ui_sources}
${kcfg_sources})
generate_export_header(kcddb)
target_link_libraries(kcddb
PUBLIC
KF5::ConfigGui
Qt5::Widgets
PRIVATE
KF5::Codecs
KF5::I18n
KF5::KIOCore
Qt5::Network
${MUSICBRAINZ5_LIBRARIES})
set_target_properties(kcddb PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} )
install(TARGETS kcddb EXPORT LibkcddbTargets ${INSTALL_TARGETS_DEFAULT_ARGS} )
generate_export_header(kcddb)
set_target_properties(kcddb PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION})
########### install files ###############
install(TARGETS kcddb EXPORT LibkcddbTargets ${INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES
cdinfo.h
......@@ -57,8 +76,8 @@ install(FILES
genres.h
kcddbconfig.h
kcddb.h
kcddb_export.h
${CMAKE_CURRENT_BINARY_DIR}/kcddb_export.h
${CMAKE_CURRENT_BINARY_DIR}/configbase.h
DESTINATION ${INCLUDE_INSTALL_DIR}/libkcddb COMPONENT Devel )
install( FILES libkcddb.kcfg DESTINATION ${KCFG_INSTALL_DIR} )
DESTINATION ${INCLUDE_INSTALL_DIR}/libkcddb COMPONENT Devel)
install( FILES libkcddb.kcfg DESTINATION ${KCFG_INSTALL_DIR})
......@@ -22,7 +22,6 @@
#include "logging.h"
#include <qstringlist.h>
#include <qapplication.h>
#include <kio/job.h>
......
......@@ -31,8 +31,6 @@
#include "musicbrainz/musicbrainzlookup.h"
#endif
#include <kstandarddirs.h>
#include <QFile>
#include <QDir>
#include <QTextStream>
......
......@@ -27,7 +27,6 @@
#include "kcddb.h"
#include "cdinfo.h"
#include <kdemacros.h>
namespace KCDDB
{
......
......@@ -8,7 +8,7 @@
#include "categories.h"
#include <klocale.h>
#include <KI18n/KLocalizedString>
KCDDB::Categories::Categories()
{
......
......@@ -27,7 +27,7 @@
#include <QtCore/QDebug>
#include <kstringhandler.h>
#include <klocale.h>
#include <KI18n/KLocalizedString>
namespace KCDDB
{
......
......@@ -22,7 +22,7 @@
#ifndef KCDDB_CDDBP_LOOKUP_H
#define KCDDB_CDDBP_LOOKUP_H
#include <qtcpsocket.h>
#include <QtNetwork/QTcpSocket>
#include "lookup.h"
......
......@@ -97,7 +97,7 @@
</widget>
</item>
<item row="4" column="1">
<widget class="KComboBox" name="m_category">
<widget class="QComboBox" name="m_category">
<property name="enabled">
<bool>false</bool>
</property>
......@@ -144,7 +144,7 @@
</widget>
</item>
<item row="4" column="3">
<widget class="KComboBox" name="m_genre">
<widget class="QComboBox" name="m_genre">
<property name="toolTip">
<string>Avoid custom values, as they will be written to CDDB as-is.</string>
</property>
......@@ -243,13 +243,6 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>m_artist</tabstop>
<tabstop>m_title</tabstop>
......
......@@ -25,7 +25,6 @@
#include "cdinfo.h"
#include <QtCore/QObject>
#include "kcddb.h"
#include <kdemacros.h>
namespace KCDDB
{
......
......@@ -8,7 +8,7 @@
#include "genres.h"
#include <klocale.h>
#include <KI18n/KLocalizedString>
class KCDDB::Genres::Private
{
......
......@@ -19,7 +19,7 @@
#include "kcddb.h"
#include <klocale.h>
#include <KI18n/KLocalizedString>
namespace KCDDB
{
......
......@@ -22,7 +22,7 @@
#include <QtCore/QDebug>
#include <kcodecs.h>
#include <klocale.h>
#include <KI18n/KLocalizedString>
#include <qcryptographichash.h>
#include <cstdio>
#include <cstring>
......@@ -62,7 +62,7 @@ namespace KCDDB
// 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())
{
......@@ -90,7 +90,7 @@ namespace KCDDB
//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)
{
......
......@@ -20,7 +20,6 @@
#include "sites.h"
#include <KIO/Job>
#include <KIO/NetAccess>
#include <QtCore/QDebug>
#include <QtCore/QRegExp>
#include <QtCore/QTextStream>
......@@ -54,9 +53,10 @@ namespace KCDDB
QList<Mirror> 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 );
}
......
......@@ -21,11 +21,7 @@
#include "synchttplookup.h"
#include "logging.h"
#include <qstringlist.h>
#include <qapplication.h>
#include <kio/job.h>
#include <kio/netaccess.h>
#include <KIO/Job>
namespace KCDDB
{
......@@ -116,7 +112,9 @@ namespace KCDDB
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();
......
......@@ -19,8 +19,7 @@
#include "synchttpsubmit.h"
#include <kio/netaccess.h>
#include <kio/job.h>
#include <KIO/Job>
namespace KCDDB
{
......@@ -37,9 +36,7 @@ namespace KCDDB
Result SyncHTTPSubmit::runJob(KIO::Job* job)
{
bool success = KIO::NetAccess::synchronousRun(job, 0);
if (success)
if (job->exec())
return Success;
else
return UnknownError;
......
......@@ -21,8 +21,7 @@
#include "cdinfo.h"
#include <kio/netaccess.h>
#include <kio/job.h>
#include <KIO/Job>
namespace KCDDB
{
......@@ -40,7 +39,7 @@ namespace KCDDB
Result SyncSMTPSubmit::runJob(KIO::Job* job)
{
if ( KIO::NetAccess::synchronousRun(job, 0) )
if ( job->exec() )
return Success;
return UnknownError;
......
set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} )
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_BINARY_DIR}/../libkcddb )
function(add_unit_tests)
foreach(test ${ARGN})
add_executable(${test} ${test}.cpp)
add_test( ${test} ${test} )
target_link_libraries(${test} Qt5::Test kcddb)
endforeach()
endfunction()
macro(kcddb_executable_tests)
foreach(_testname ${ARGN})
add_executable(${_testname} ${_testname}.cpp)
add_test( ${_testname} ${_testname} )
target_link_libraries(${_testname} Qt5::Test kcddb)
endforeach()
endmacro()
macro(kcddb_unit_tests)
foreach(_testname ${ARGN})
add_executable(${_testname} ${_testname}.cpp)
add_test( kcddb-${_testname} ${_testname} )
target_link_libraries(${_testname} Qt5::Test kcddb)
endforeach()
endmacro()
kcddb_unit_tests(
add_unit_tests(
asynchttplookuptest
asynccddblookuptest
synccddblookuptest
......@@ -30,12 +19,8 @@ kcddb_unit_tests(
cachetest
musicbrainztest-severaldiscs
musicbrainztest-fulldate
)
kcddb_executable_tests(
syncsmtpsubmittest
asyncsmtpsubmittest
asynchttpsubmittest
synchttpsubmittest
sitestest
)
sitestest)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment