diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -34,7 +34,7 @@ add_subdirectory( aboutdialog/libattica-ocsclient ) add_subdirectory( transcoding ) add_subdirectory( kconf_update ) -#add_subdirectory( importers ) #FIXME: disabled temporarily for KF5 porting: Port this to KF5::Plasma after the rest of the code has been ported to the other KF5 components. +add_subdirectory( importers ) ##################################################################### # PROXYCOLLECTION @@ -611,7 +611,7 @@ ${libamarokurl_SRCS} ${libsynchronization_SRCS} ${statsyncing_SRCS} -# ${importers_SRCS} #FIXME: disabled temporarily for KF5 porting: Port this to KF5::Plasma after the rest of the code has been ported to the other KF5 components. + ${importers_SRCS} core-impl/logger/ProxyLogger.cpp aboutdialog/AnimatedBarWidget.cpp aboutdialog/AnimatedWidget.cpp diff --git a/src/importers/ImporterManager.h b/src/importers/ImporterManager.h --- a/src/importers/ImporterManager.h +++ b/src/importers/ImporterManager.h @@ -21,14 +21,9 @@ #include "amarok_export.h" -/** - * This macro needs to be expanded exactly once for a single importer. The best practice - * is to put it at the beginning of the .cpp file of concrete ImporterManager - * implementation. - */ -#define AMAROK_EXPORT_IMPORTER_PLUGIN( libname, FactoryClass ) \ - K_PLUGIN_FACTORY( factory, registerPlugin(); ) \ - K_EXPORT_PLUGIN( factory( "amarok_importer-" #libname ) ) +#include +#include + namespace StatSyncing { @@ -104,13 +99,6 @@ */ KConfigGroup providerConfig( const ProviderPtr &provider ) const; - /** - * Return the KPluginInfo for this importer. The KPluginInfo should contain the - * name of this importer's .desktop file and plugin's type (typically "services"). - * This function's return value will initialize m_info variable of PluginFactory. - */ - virtual KPluginInfo pluginInfo() const = 0; - /** * Return a new provider instance. */ diff --git a/src/importers/ImporterManager.cpp b/src/importers/ImporterManager.cpp --- a/src/importers/ImporterManager.cpp +++ b/src/importers/ImporterManager.cpp @@ -43,8 +43,6 @@ void ImporterManager::init() { - m_info = pluginInfo(); - foreach( const QString &providerId, managerConfig().groupList() ) { KConfigGroup group = providerConfig( providerId ); diff --git a/src/importers/SimpleImporterConfigWidget.cpp b/src/importers/SimpleImporterConfigWidget.cpp --- a/src/importers/SimpleImporterConfigWidget.cpp +++ b/src/importers/SimpleImporterConfigWidget.cpp @@ -18,7 +18,7 @@ #include "core/support/Debug.h" -#include +#include #include #include @@ -47,7 +47,7 @@ setLayout( mainLayout ); addField( "name", i18nc( "Name of the synchronization target", "Target name" ), - new KLineEdit( targetName ), "text" ); + new QLineEdit( targetName ), "text" ); } SimpleImporterConfigWidget::~SimpleImporterConfigWidget() diff --git a/src/importers/SimpleImporterManager.h b/src/importers/SimpleImporterManager.h --- a/src/importers/SimpleImporterManager.h +++ b/src/importers/SimpleImporterManager.h @@ -19,27 +19,25 @@ #include "ImporterManager.h" +using namespace StatSyncing; + /** * This macro can be used to reduce the amount of code needed in order to implement * ImporterManager subclass and export it as a plugin. If your manager doesn't do * anything other than give static info, you can replace the whole class with this macro. + * You need to include the .moc file after this macro (#include ). * See iTunes importer for usage example (ITunesManager.cpp file). */ -#define AMAROK_EXPORT_SIMPLE_IMPORTER_PLUGIN( libname, TYPE, PRETTY_NAME, DESCRIPTION, \ +#define AMAROK_EXPORT_SIMPLE_IMPORTER_PLUGIN( libname, JSON, TYPE, PRETTY_NAME, DESCRIPTION, \ ICON, ConfigWidget_T, ImporterProvider_T ) \ - class libname : public StatSyncing::ImporterManager \ + class libname : public ImporterManager \ { \ - Q_OBJECT \ - Q_INTERFACES(Plugins::PluginFactory) \ Q_PLUGIN_METADATA(IID AmarokPluginFactory_iid FILE JSON) \ + Q_INTERFACES(Plugins::PluginFactory) \ + Q_OBJECT \ \ public: \ libname() \ - : StatSyncing::ImporterManager() \ - { \ - } \ - \ - ~ libname() \ { \ } \ \ @@ -63,21 +61,15 @@ return ICON; \ } \ \ - StatSyncing::ProviderConfigWidget *configWidget( const QVariantMap &config ) \ + ProviderConfigWidget *configWidget( const QVariantMap &config ) \ { \ return new ConfigWidget_T( config ); \ } \ \ protected: \ - KPluginInfo pluginInfo() const \ - { \ - return KPluginInfo( "amarok_importer-" #libname ".desktop" ); \ - } \ - \ - StatSyncing::ImporterProviderPtr newInstance( const QVariantMap &config ) \ + ImporterProviderPtr newInstance( const QVariantMap &config ) \ { \ - return StatSyncing::ImporterProviderPtr( \ - new ImporterProvider_T( config, this ) ); \ + return ImporterProviderPtr( new ImporterProvider_T( config, this ) ); \ } \ }; \ diff --git a/src/importers/amarok/AmarokConfigWidget.cpp b/src/importers/amarok/AmarokConfigWidget.cpp --- a/src/importers/amarok/AmarokConfigWidget.cpp +++ b/src/importers/amarok/AmarokConfigWidget.cpp @@ -34,8 +34,8 @@ << m_hostnameLabel << m_password << m_passwordLabel << m_port << m_portLabel << m_username << m_usernameLabel; - connect( m_connectionType, SIGNAL(currentIndexChanged(int)), - SLOT(connectionTypeChanged(int)) ); + connect( m_connectionType, QOverload::of( &KComboBox::currentIndexChanged ), + this, &AmarokConfigWidget::connectionTypeChanged ); populateFields(); } diff --git a/src/importers/amarok/AmarokConfigWidget.ui b/src/importers/amarok/AmarokConfigWidget.ui --- a/src/importers/amarok/AmarokConfigWidget.ui +++ b/src/importers/amarok/AmarokConfigWidget.ui @@ -14,7 +14,7 @@ - + @@ -76,7 +76,7 @@ - + 1 @@ -96,7 +96,7 @@ - + @@ -109,7 +109,7 @@ - + @@ -132,7 +132,7 @@ - + @@ -180,14 +180,14 @@
kcombobox.h
- KLineEdit + QLineEdit QLineEdit -
klineedit.h
+
qlineedit.h
- KIntSpinBox + QSpinBox QSpinBox -
knuminput.h
+
qspinbox.h
KUrlRequester diff --git a/src/importers/amarok/AmarokEmbeddedSqlConnection.cpp b/src/importers/amarok/AmarokEmbeddedSqlConnection.cpp --- a/src/importers/amarok/AmarokEmbeddedSqlConnection.cpp +++ b/src/importers/amarok/AmarokEmbeddedSqlConnection.cpp @@ -34,7 +34,8 @@ , m_mysqld( mysqld ) , m_datadir( datadir ) { - connect( &m_shutdownTimer, &QTimer::timeout, SLOT(stopServer()) ); + connect( &m_shutdownTimer, &QTimer::timeout, + this, &AmarokEmbeddedSqlConnection::stopServer ); m_shutdownTimer.setSingleShot( true ); } @@ -115,12 +116,12 @@ QTimer timer; // Set conditions on which we stop waiting for the startup - connect( &timer, SIGNAL(timeout()), - &loop, SLOT(quit()), Qt::QueuedConnection ); - connect( &watcher, SIGNAL(fileChanged(QString)), - &loop, SLOT(quit()), Qt::QueuedConnection ); - connect( &m_srv, SIGNAL(error(QProcess::ProcessError)), - &loop, SLOT(quit()), Qt::QueuedConnection ); + connect( &timer, &QTimer::timeout, + &loop, &QEventLoop::quit, Qt::QueuedConnection ); + connect( &watcher, &QFileSystemWatcher::fileChanged, + &loop, &QEventLoop::quit, Qt::QueuedConnection ); + connect( &m_srv, QOverload::of( &QProcess::error ), + &loop, &QEventLoop::quit, Qt::QueuedConnection ); // Important: we use modification of pidfile as a cue that the server is ready // This is consistent with behavior of mysqld startup scripts diff --git a/src/importers/amarok/AmarokManager.h b/src/importers/amarok/AmarokManager.h --- a/src/importers/amarok/AmarokManager.h +++ b/src/importers/amarok/AmarokManager.h @@ -24,22 +24,20 @@ class AmarokManager : public ImporterManager { - Q_PLUGIN_METADATA(IID KPluginFactory_iid FILE "amarok_importer-amarok.json") + Q_PLUGIN_METADATA(IID AmarokPluginFactory_iid FILE "amarok_importer-amarok.json") Q_INTERFACES(Plugins::PluginFactory) Q_OBJECT public: AmarokManager(); - ~AmarokManager(); QString type() const; QString prettyName() const; QString description() const; QIcon icon() const; ProviderConfigWidget *configWidget( const QVariantMap &config ); protected: - KPluginInfo pluginInfo() const; virtual ImporterProviderPtr newInstance( const QVariantMap &config ); }; diff --git a/src/importers/amarok/AmarokManager.cpp b/src/importers/amarok/AmarokManager.cpp --- a/src/importers/amarok/AmarokManager.cpp +++ b/src/importers/amarok/AmarokManager.cpp @@ -27,22 +27,12 @@ { } -AmarokManager::~AmarokManager() -{ -} - QString AmarokManager::type() const { return "AmarokImporter"; } -KPluginInfo -AmarokManager::pluginInfo() const -{ - return KPluginInfo( "amarok_importer-amarok.desktop" ); -} - QString AmarokManager::prettyName() const { @@ -70,5 +60,5 @@ ImporterProviderPtr AmarokManager::newInstance( const QVariantMap &config ) { - return ProviderPtr( new AmarokProvider( config, this ) ); + return ImporterProviderPtr( new AmarokProvider( config, this ) ); } diff --git a/src/importers/amarok/AmarokTrack.h b/src/importers/amarok/AmarokTrack.h --- a/src/importers/amarok/AmarokTrack.h +++ b/src/importers/amarok/AmarokTrack.h @@ -19,6 +19,8 @@ #include "statsyncing/SimpleWritableTrack.h" +#include + namespace StatSyncing { diff --git a/src/importers/amarok/AmarokTrack.cpp b/src/importers/amarok/AmarokTrack.cpp --- a/src/importers/amarok/AmarokTrack.cpp +++ b/src/importers/amarok/AmarokTrack.cpp @@ -98,7 +98,7 @@ { QVariantMap bindValues; bindValues.insert( ":url", m_urlId ); - m_connection->query( "DELETE QUICK FROM urls_labels WHERE url = ?", bindValues, + m_connection->query( "DELETE QUICK FROM urls_labels WHERE url = :url", bindValues, &ok ); if( !ok ) { diff --git a/src/importers/amarok/CMakeLists.txt b/src/importers/amarok/CMakeLists.txt --- a/src/importers/amarok/CMakeLists.txt +++ b/src/importers/amarok/CMakeLists.txt @@ -1,8 +1,3 @@ -include_directories( - - -) - set( amarok_importer-amarok_PART_SRCS AmarokConfigWidget.cpp AmarokManager.cpp @@ -24,4 +19,4 @@ install( TARGETS amarok_importer-amarok DESTINATION ${PLUGIN_INSTALL_DIR} ) -install( FILES amarok_importer-amarok.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) +kcoreaddons_desktop_to_json(amarok_importer-amarok amarok_importer-amarok.desktop SERVICE_TYPES ${CMAKE_SOURCE_DIR}/src/amarok-plugin.desktop) diff --git a/src/importers/banshee/BansheeManager.cpp b/src/importers/banshee/BansheeManager.cpp --- a/src/importers/banshee/BansheeManager.cpp +++ b/src/importers/banshee/BansheeManager.cpp @@ -21,10 +21,13 @@ #include -AMAROK_EXPORT_SIMPLE_IMPORTER_PLUGIN( banshee, +AMAROK_EXPORT_SIMPLE_IMPORTER_PLUGIN( BansheeImporterFactory, + "amarok_importer-banshee.json", "BansheeImporter", i18n( "Banshee" ), i18n( "Banshee Statistics Importer" ), QIcon::fromTheme( "view-importers-banshee-amarok" ), StatSyncing::BansheeConfigWidget, StatSyncing::BansheeProvider ) + +#include diff --git a/src/importers/banshee/BansheeTrack.h b/src/importers/banshee/BansheeTrack.h --- a/src/importers/banshee/BansheeTrack.h +++ b/src/importers/banshee/BansheeTrack.h @@ -19,6 +19,8 @@ #include "statsyncing/SimpleWritableTrack.h" +#include + namespace StatSyncing { diff --git a/src/importers/banshee/CMakeLists.txt b/src/importers/banshee/CMakeLists.txt --- a/src/importers/banshee/CMakeLists.txt +++ b/src/importers/banshee/CMakeLists.txt @@ -1,8 +1,3 @@ -include_directories( - - -) - set( amarok_importer-banshee_PART_SRCS BansheeConfigWidget.cpp BansheeManager.cpp @@ -21,4 +16,4 @@ install( TARGETS amarok_importer-banshee DESTINATION ${PLUGIN_INSTALL_DIR} ) -install( FILES amarok_importer-banshee.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) +kcoreaddons_desktop_to_json(amarok_importer-banshee amarok_importer-banshee.desktop SERVICE_TYPES ${CMAKE_SOURCE_DIR}/src/amarok-plugin.desktop) diff --git a/src/importers/clementine/CMakeLists.txt b/src/importers/clementine/CMakeLists.txt --- a/src/importers/clementine/CMakeLists.txt +++ b/src/importers/clementine/CMakeLists.txt @@ -1,8 +1,3 @@ -include_directories( - - -) - set( amarok_importer-clementine_PART_SRCS ClementineConfigWidget.cpp ClementineManager.cpp @@ -21,4 +16,4 @@ install( TARGETS amarok_importer-clementine DESTINATION ${PLUGIN_INSTALL_DIR} ) -install( FILES amarok_importer-clementine.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) +kcoreaddons_desktop_to_json(amarok_importer-clementine amarok_importer-clementine.desktop SERVICE_TYPES ${CMAKE_SOURCE_DIR}/src/amarok-plugin.desktop) diff --git a/src/importers/clementine/ClementineManager.cpp b/src/importers/clementine/ClementineManager.cpp --- a/src/importers/clementine/ClementineManager.cpp +++ b/src/importers/clementine/ClementineManager.cpp @@ -21,10 +21,13 @@ #include -AMAROK_EXPORT_SIMPLE_IMPORTER_PLUGIN( clementine, +AMAROK_EXPORT_SIMPLE_IMPORTER_PLUGIN( ClementineImporterFactory, + "amarok_importer-clementine.json", "ClementineImporter", i18n( "Clementine" ), i18n( "Clementine Statistics Importer" ), QIcon::fromTheme( "view-importers-clementine-amarok" ), StatSyncing::ClementineConfigWidget, StatSyncing::ClementineProvider ) + +#include diff --git a/src/importers/clementine/ClementineTrack.h b/src/importers/clementine/ClementineTrack.h --- a/src/importers/clementine/ClementineTrack.h +++ b/src/importers/clementine/ClementineTrack.h @@ -19,6 +19,8 @@ #include "statsyncing/SimpleWritableTrack.h" +#include + namespace StatSyncing { diff --git a/src/importers/fastforward/CMakeLists.txt b/src/importers/fastforward/CMakeLists.txt --- a/src/importers/fastforward/CMakeLists.txt +++ b/src/importers/fastforward/CMakeLists.txt @@ -1,8 +1,3 @@ -include_directories( - - -) - set( amarok_importer-fastforward_PART_SRCS FastForwardConfigWidget.cpp FastForwardManager.cpp @@ -23,4 +18,4 @@ install( TARGETS amarok_importer-fastforward DESTINATION ${PLUGIN_INSTALL_DIR} ) -install( FILES amarok_importer-fastforward.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) +kcoreaddons_desktop_to_json(amarok_importer-fastforward amarok_importer-fastforward.desktop SERVICE_TYPES ${CMAKE_SOURCE_DIR}/src/amarok-plugin.desktop) diff --git a/src/importers/fastforward/FastForwardConfigWidget.cpp b/src/importers/fastforward/FastForwardConfigWidget.cpp --- a/src/importers/fastforward/FastForwardConfigWidget.cpp +++ b/src/importers/fastforward/FastForwardConfigWidget.cpp @@ -34,8 +34,8 @@ << m_hostnameLabel << m_password << m_passwordLabel << m_port << m_portLabel << m_username << m_usernameLabel; - connect( m_connectionType, SIGNAL(currentIndexChanged(int)), - SLOT(connectionTypeChanged(int)) ); + connect( m_connectionType, QOverload::of( &KComboBox::currentIndexChanged ), + this, &FastForwardConfigWidget::connectionTypeChanged ); populateFields(); } diff --git a/src/importers/fastforward/FastForwardConfigWidget.ui b/src/importers/fastforward/FastForwardConfigWidget.ui --- a/src/importers/fastforward/FastForwardConfigWidget.ui +++ b/src/importers/fastforward/FastForwardConfigWidget.ui @@ -22,7 +22,7 @@
- + @@ -84,7 +84,7 @@ - + 1 @@ -104,7 +104,7 @@ - + @@ -117,7 +117,7 @@ - + @@ -140,7 +140,7 @@ - + @@ -174,14 +174,14 @@
kcombobox.h
- KLineEdit + QLineEdit QLineEdit -
klineedit.h
+
qlineedit.h
- KIntSpinBox + QSpinBox QSpinBox -
knuminput.h
+
qspinbox.h
KUrlRequester diff --git a/src/importers/fastforward/FastForwardManager.cpp b/src/importers/fastforward/FastForwardManager.cpp --- a/src/importers/fastforward/FastForwardManager.cpp +++ b/src/importers/fastforward/FastForwardManager.cpp @@ -19,10 +19,13 @@ #include "FastForwardConfigWidget.h" #include "FastForwardProvider.h" -AMAROK_EXPORT_SIMPLE_IMPORTER_PLUGIN( fastforward, +AMAROK_EXPORT_SIMPLE_IMPORTER_PLUGIN( FastForwardImporterFactory, + "amarok_importer-fastforward.json", "FastForwardImporter", i18n( "Amarok 1.4 (FastForward)" ), i18n( "Amarok 1.4 Statistics Importer" ), QIcon::fromTheme( "amarok" ), StatSyncing::FastForwardConfigWidget, StatSyncing::FastForwardProvider ) + +#include diff --git a/src/importers/fastforward/FastForwardTrack.h b/src/importers/fastforward/FastForwardTrack.h --- a/src/importers/fastforward/FastForwardTrack.h +++ b/src/importers/fastforward/FastForwardTrack.h @@ -19,6 +19,8 @@ #include "statsyncing/SimpleWritableTrack.h" +#include + namespace StatSyncing { diff --git a/src/importers/itunes/CMakeLists.txt b/src/importers/itunes/CMakeLists.txt --- a/src/importers/itunes/CMakeLists.txt +++ b/src/importers/itunes/CMakeLists.txt @@ -1,8 +1,3 @@ -include_directories( - - -) - set( amarok_importer-itunes_PART_SRCS ITunesConfigWidget.cpp ITunesManager.cpp @@ -20,4 +15,4 @@ install( TARGETS amarok_importer-itunes DESTINATION ${PLUGIN_INSTALL_DIR} ) -install( FILES amarok_importer-itunes.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) +kcoreaddons_desktop_to_json(amarok_importer-itunes amarok_importer-itunes.desktop SERVICE_TYPES ${CMAKE_SOURCE_DIR}/src/amarok-plugin.desktop) diff --git a/src/importers/itunes/ITunesManager.cpp b/src/importers/itunes/ITunesManager.cpp --- a/src/importers/itunes/ITunesManager.cpp +++ b/src/importers/itunes/ITunesManager.cpp @@ -21,10 +21,13 @@ #include -AMAROK_EXPORT_SIMPLE_IMPORTER_PLUGIN( itunes, +AMAROK_EXPORT_SIMPLE_IMPORTER_PLUGIN( ITunesImporterFactory, + "amarok_importer-itunes.json", "ITunesImporter", i18n( "Apple iTunes" ), i18n( "iTunes Statistics Importer" ), QIcon::fromTheme( "media-album-track" ), StatSyncing::ITunesConfigWidget, StatSyncing::ITunesProvider ) + +#include diff --git a/src/importers/itunes/ITunesProvider.cpp b/src/importers/itunes/ITunesProvider.cpp --- a/src/importers/itunes/ITunesProvider.cpp +++ b/src/importers/itunes/ITunesProvider.cpp @@ -184,8 +184,8 @@ if( !byArtist.isEmpty() && currentArtist == byArtist && trackId != -1 ) { ITunesTrack *track = new ITunesTrack( trackId, metadata ); - connect( track, SIGNAL(commitCalled(int,Meta::FieldHash)), - SLOT(trackUpdated(int,Meta::FieldHash)), Qt::DirectConnection ); + connect( track, &ITunesTrack::commitCalled, + this, &ITunesProvider::trackUpdated, Qt::DirectConnection ); m_artistTracks << TrackPtr( track ); } else if( byArtist.isEmpty() ) diff --git a/src/importers/rhythmbox/CMakeLists.txt b/src/importers/rhythmbox/CMakeLists.txt --- a/src/importers/rhythmbox/CMakeLists.txt +++ b/src/importers/rhythmbox/CMakeLists.txt @@ -1,8 +1,3 @@ -include_directories( - - -) - set( amarok_importer-rhythmbox_PART_SRCS RhythmboxConfigWidget.cpp RhythmboxManager.cpp @@ -20,4 +15,4 @@ install( TARGETS amarok_importer-rhythmbox DESTINATION ${PLUGIN_INSTALL_DIR} ) -install( FILES amarok_importer-rhythmbox.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) +kcoreaddons_desktop_to_json(amarok_importer-rhythmbox amarok_importer-rhythmbox.desktop SERVICE_TYPES ${CMAKE_SOURCE_DIR}/src/amarok-plugin.desktop) diff --git a/src/importers/rhythmbox/RhythmboxManager.cpp b/src/importers/rhythmbox/RhythmboxManager.cpp --- a/src/importers/rhythmbox/RhythmboxManager.cpp +++ b/src/importers/rhythmbox/RhythmboxManager.cpp @@ -21,10 +21,13 @@ #include -AMAROK_EXPORT_SIMPLE_IMPORTER_PLUGIN( rhythmbox, +AMAROK_EXPORT_SIMPLE_IMPORTER_PLUGIN( RhythmboxImporterFactory, + "amarok_importer-rhythmbox.json", "RhythmboxImporter", i18n( "Rhythmbox" ), i18n( "Rhythmbox Statistics Importer" ), QIcon::fromTheme( "view-importers-rhythmbox-amarok" ), StatSyncing::RhythmboxConfigWidget, StatSyncing::RhythmboxProvider ) + +#include diff --git a/src/importers/rhythmbox/RhythmboxProvider.cpp b/src/importers/rhythmbox/RhythmboxProvider.cpp --- a/src/importers/rhythmbox/RhythmboxProvider.cpp +++ b/src/importers/rhythmbox/RhythmboxProvider.cpp @@ -161,8 +161,8 @@ if( !byArtist.isEmpty() && currentArtist == byArtist ) { RhythmboxTrack *track = new RhythmboxTrack( location, metadata ); - connect( track, SIGNAL(commitCalled(QString,Meta::FieldHash)), - SLOT(trackUpdated(QString,Meta::FieldHash)), Qt::DirectConnection ); + connect( track, &RhythmboxTrack::commitCalled, + this, &RhythmboxProvider::trackUpdated, Qt::DirectConnection ); m_artistTracks << TrackPtr( track ); } else if( byArtist.isEmpty() )