Commit 380e90cb authored by Michał Małek's avatar Michał Małek
Browse files

First port to KF5 with the help of KDELibs4Support

parent 1b5cfafb
project(libkcddb)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
cmake_minimum_required(VERSION 2.8.12)
find_package(ECM REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH "${ECM_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(KDEInstallDirs)
include(KDECompilerSettings)
include(KDECMakeSettings)
include(FeatureSummary)
include(GenerateExportHeader)
find_package(Qt5 REQUIRED COMPONENTS Test)
find_package(KF5 REQUIRED COMPONENTS Config DocTools KDELibs4Support Codecs KIO)
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")
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)
......@@ -20,10 +32,10 @@ if(MUSICBRAINZ5_FOUND)
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 )
......
......@@ -6,16 +6,16 @@ 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)
set_source_files_properties(cddbconfigwidget.cpp PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ui_cddbconfigwidget.h)
kde4_add_ui_files(kcm_cddb_PART_SRCS cddbconfigwidget.ui )
qt5_wrap_ui(kcm_cddb_PART_SRCS cddbconfigwidget.ui )
kde4_add_plugin(kcm_cddb ${kcm_cddb_PART_SRCS})
add_library(kcm_cddb MODULE ${kcm_cddb_PART_SRCS})
target_link_libraries(kcm_cddb ${KDE4_KIO_LIBS} kcddb)
target_link_libraries(kcm_cddb KF5::KIOCore kcddb)
install(TARGETS kcm_cddb DESTINATION ${PLUGIN_INSTALL_DIR} )
......
......@@ -33,11 +33,7 @@
#include <klocale.h>
#include <kinputdialog.h>
#include <kmessagebox.h>
#ifndef KDE_NO_DEPRECATED
#include <keditlistbox.h>
#else
#include <keditlistwidget.h>
#endif
#include <kurlrequester.h>
#include <QCheckBox>
......@@ -60,11 +56,7 @@ CDDBConfigWidget::CDDBConfigWidget(QWidget * parent)
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);
......@@ -131,5 +123,3 @@ void CDDBConfigWidget::needAuthenticationChanged(bool needsAuth)
}
// vim:tabstop=2:shiftwidth=2:expandtab:cinoptions=(s,U1,m1
#include "cddbconfigwidget.moc"
########### 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/cddbretrieval)
......@@ -40,8 +40,8 @@ K_PLUGIN_FACTORY(KCDDBFactory, registerPlugin<CDDBModule>();)
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);
......
......@@ -32,7 +32,7 @@ class CDDBModule : public KCModule
public:
CDDBModule(QWidget * parent, const QVariantList &);
CDDBModule(QWidget * parent, const QVariantList & args);
public slots:
......
......@@ -28,20 +28,22 @@ set(kcddb_LIB_SRCS ${libmusicbrainz_SRCS}
categories.cpp
genres.cpp
cdinfodialog.cpp
cdinfoencodingwidget.cpp )
cdinfoencodingwidget.cpp
logging.cpp )
qt5_wrap_ui(kcddb_LIB_SRCS cdinfodialog.ui cdinfoencodingwidget.ui )
kde4_add_ui_files(kcddb_LIB_SRCS cdinfodialog.ui cdinfoencodingwidget.ui )
kconfig_add_kcfg_files(kcddb_LIB_SRCS configbase.kcfgc )
kde4_add_kcfg_files(kcddb_LIB_SRCS configbase.kcfgc )
add_library(kcddb SHARED ${kcddb_LIB_SRCS})
kde4_add_library(kcddb SHARED ${kcddb_LIB_SRCS})
target_link_libraries(kcddb ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS})
target_link_libraries(kcddb KF5::Codecs KF5::ConfigGui KF5::KDELibs4Support KF5::KIOCore)
if(MUSICBRAINZ5_FOUND)
target_link_libraries(kcddb ${MUSICBRAINZ5_LIBRARIES})
endif(MUSICBRAINZ5_FOUND)
generate_export_header(kcddb)
set_target_properties(kcddb PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} )
install(TARGETS kcddb EXPORT LibkcddbTargets ${INSTALL_TARGETS_DEFAULT_ARGS} )
......
......@@ -20,8 +20,8 @@
*/
#include "asynccddbplookup.h"
#include "logging.h"
#include <kdebug.h>
#include <ksocketfactory.h>
namespace KCDDB
......@@ -77,14 +77,14 @@ namespace KCDDB
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 +337,4 @@ namespace KCDDB
}
#include "asynccddbplookup.moc"
// vim:tabstop=2:shiftwidth=2:expandtab:cinoptions=(s,U1,m1
......@@ -19,11 +19,11 @@
*/
#include "asynchttplookup.h"
#include "logging.h"
#include <qstringlist.h>
#include <qapplication.h>
#include <kdebug.h>
#include <kio/job.h>
namespace KCDDB
......@@ -74,7 +74,7 @@ namespace KCDDB
void
AsyncHTTPLookup::slotQueryReady()
{
kDebug(60010) << "Matches Found: " << matchList_.count();
qCDebug(LIBKCDDB) << "Matches Found: " << matchList_.count();
if ( Success != result_ )
{
......@@ -130,7 +130,7 @@ namespace KCDDB
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 +147,4 @@ namespace KCDDB
}
#include "asynchttplookup.moc"
// vim:tabstop=2:shiftwidth=2:expandtab:cinoptions=(s,U1,m1
......@@ -20,7 +20,7 @@
#include "asynchttpsubmit.h"
#include <kio/job.h>
#include <kdebug.h>
#include <QtCore/QDebug>
namespace KCDDB
{
......@@ -44,7 +44,7 @@ namespace KCDDB
void AsyncHTTPSubmit::slotFinished(KJob* job)
{
kDebug() << "Finished";
qDebug() << "Finished";
if ( job->error()==0 )
emit finished( Success );
......@@ -53,4 +53,3 @@ namespace KCDDB
}
}
#include "asynchttpsubmit.moc"
......@@ -18,11 +18,11 @@
*/
#include "asyncsmtpsubmit.h"
#include "logging.h"
#include "cdinfo.h"
#include <kdebug.h>
#include <kio/job.h>
namespace KCDDB
......@@ -49,7 +49,7 @@ namespace KCDDB
void AsyncSMTPSubmit::slotDone( KJob* job )
{
kDebug(60010) ;
qCDebug(LIBKCDDB) ;
if ( job->error()==0 )
emit finished( Success );
else
......@@ -57,4 +57,3 @@ namespace KCDDB
}
}
#include "asyncsmtpsubmit.moc"
......@@ -24,13 +24,13 @@
#include "kcddbconfig.h"
#include "cddb.h"
#include "logging.h"
#include "config-musicbrainz.h"
#ifdef HAVE_MUSICBRAINZ5
#include "musicbrainz/musicbrainzlookup.h"
#endif
#include <kdebug.h>
#include <kstandarddirs.h>
#include <QFile>
......@@ -44,7 +44,7 @@ namespace KCDDB
{
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 +104,7 @@ namespace KCDDB
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);
......@@ -120,12 +120,12 @@ namespace KCDDB
{
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) )
......
......@@ -25,7 +25,7 @@
#include <qstringlist.h>
#include <kdebug.h>
#include <QtCore/QDebug>
#include <kstringhandler.h>
#include <klocale.h>
......
......@@ -20,8 +20,7 @@
*/
#include "cddbplookup.h"
#include <kdebug.h>
#include "logging.h"
#include <qbytearray.h>
......@@ -90,7 +89,7 @@ namespace KCDDB
void
CDDBPLookup::close()
{
kDebug(60010) << "Disconnect from server...";
qCDebug(LIBKCDDB) << "Disconnect from server...";
if ( isConnected() )
{
socket_->close();
......@@ -104,16 +103,16 @@ namespace KCDDB
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 @@ namespace KCDDB
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 @@ namespace KCDDB
{
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' );
......
......@@ -24,8 +24,9 @@
#include "client.h"
#include "cddb.h"
#include "logging.h"
#include <kdebug.h>
#include <QtCore/QDebug>
#include <kstringhandler.h>
#include <QMap>
......@@ -119,13 +120,13 @@ namespace KCDDB
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 @@ namespace KCDDB
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<QString, QVariant>::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" )) {
......@@ -412,7 +413,7 @@ namespace KCDDB
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 @@ namespace KCDDB
return d->trackInfoList[trackNumber];
else
{
kWarning() << "Couldn't find track " << trackNumber;
qWarning() << "Couldn't find track " << trackNumber;
return TrackInfo();
}
}
......
......@@ -27,7 +27,7 @@
#include <QStringList>
#include <QStandardItemModel>
#include <kdebug.h>
#include <QtCore/QDebug>
#include <kglobal.h>
#include <kcharsets.h>
......@@ -149,10 +149,10 @@ class CDInfoDialog::Private
QList<QStandardItem *> trackItems = QList<QStandardItem *>();
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;
......@@ -307,4 +307,3 @@ class CDInfoDialog::Private
}
}
#include "cdinfodialog.moc"
......@@ -67,4 +67,3 @@ namespace KCDDB
}
}
#include "cdinfoencodingwidget.moc"
......@@ -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 <kdebug.h>
namespace KCDDB
{
class Client::Private
......@@ -111,7 +110,7 @@ namespace KCDDB
if ( trackOffsetList.count() <= 1 )
{
kDebug(60010) << "Lookup called with empty offset list";
qCDebug(LIBKCDDB) << "Lookup called with empty offset list";
return NoRecordFound;
}
......@@ -119,7 +118,7 @@ namespace KCDDB
{
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() )
{
......@@ -321,7 +320,7 @@ namespace KCDDB
break;
}
default:
kDebug(60010) << "Unsupported transport: ";
qCDebug(LIBKCDDB) << "Unsupported transport: ";
// << CDDB::transportToString(d->config.submitTransport()) << endl;
return UnknownError;
break;
......@@ -370,7 +369,4 @@ namespace KCDDB
}
}
#include "client.moc"
// vim:tabstop=2:shiftwidth=2:expandtab:cinoptions=(s,U1,m1
......@@ -22,7 +22,7 @@
#include "httplookup.h"
#include <kio/job.h>
#include <kdebug.h>
#include <QtCore/QDebug>
namespace KCDDB
{
......@@ -183,6 +183,4 @@ namespace KCDDB
}
}
#include "httplookup.moc"
// vim:tabstop=2:shiftwidth=2:expandtab:cinoptions=(s,U1,m1
......@@ -20,7 +20,7 @@
#include "httpsubmit.h"
#include <kdebug.h>
#include <QtCore/QDebug>
#include <kio/job.h>
namespace KCDDB
......
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