From 031f769ff62ef9006011ec06820f382b09cc17b8 Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Tue, 13 Aug 2013 06:09:14 +0200 Subject: [PATCH] Migrated PauseMusic to new plugin format --- daemon/plugins/CMakeLists.txt | 1 + ...kageinterface.cpp => pausemusicplugin.cpp} | 12 +++++++---- ...cpackageinterface.h => pausemusicplugin.h} | 21 ++++++++++++------- 3 files changed, 22 insertions(+), 12 deletions(-) rename daemon/plugins/pausemusic/{pausemusicpackageinterface.cpp => pausemusicplugin.cpp} (90%) rename daemon/plugins/pausemusic/{pausemusicpackageinterface.h => pausemusicplugin.h} (77%) diff --git a/daemon/plugins/CMakeLists.txt b/daemon/plugins/CMakeLists.txt index a6e89f674..494973ab7 100644 --- a/daemon/plugins/CMakeLists.txt +++ b/daemon/plugins/CMakeLists.txt @@ -2,4 +2,5 @@ install(FILES kdeconnect_plugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR}) add_subdirectory(ping) +add_subdirectory(pausemusic) diff --git a/daemon/plugins/pausemusic/pausemusicpackageinterface.cpp b/daemon/plugins/pausemusic/pausemusicplugin.cpp similarity index 90% rename from daemon/plugins/pausemusic/pausemusicpackageinterface.cpp rename to daemon/plugins/pausemusic/pausemusicplugin.cpp index 43e3b8b41..72267130f 100644 --- a/daemon/plugins/pausemusic/pausemusicpackageinterface.cpp +++ b/daemon/plugins/pausemusic/pausemusicplugin.cpp @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -#include "pausemusicpackageinterface.h" +#include "pausemusicplugin.h" #include #include @@ -27,16 +27,20 @@ #include #include -PauseMusicPackageInterface::PauseMusicPackageInterface() +K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< PauseMusicPlugin >(); ) +K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_pausemusic", "kdeconnect_pausemusic") ) + +PauseMusicPlugin::PauseMusicPlugin(QObject* parent, const QVariantList& args) + : KdeConnectPlugin(parent, args) { + //TODO: Be able to change this from plugin settings pauseWhen = PauseWhenRinging; } -bool PauseMusicPackageInterface::receivePackage (const Device& device, const NetworkPackage& np) +bool PauseMusicPlugin::receivePackage(const NetworkPackage& np) { - Q_UNUSED(device); bool pauseConditionFulfilled = false; diff --git a/daemon/plugins/pausemusic/pausemusicpackageinterface.h b/daemon/plugins/pausemusic/pausemusicplugin.h similarity index 77% rename from daemon/plugins/pausemusic/pausemusicpackageinterface.h rename to daemon/plugins/pausemusic/pausemusicplugin.h index 3d5a8de4a..0ab9a01c6 100644 --- a/daemon/plugins/pausemusic/pausemusicpackageinterface.h +++ b/daemon/plugins/pausemusic/pausemusicplugin.h @@ -18,20 +18,25 @@ * along with this program. If not, see . */ -#ifndef PAUSEMUSICPACKAGEINTERFACE_H -#define PAUSEMUSICPACKAGEINTERFACE_H - -#include "packageinterface.h" +#ifndef PAUSEMUSICPLUGIN_H +#define PAUSEMUSICPLUGIN_H +#include #include #include -class PauseMusicPackageInterface - : public PackageInterface +#include "../kdeconnectplugin.h" + +class PauseMusicPlugin + : public KdeConnectPlugin { + Q_OBJECT + public: - PauseMusicPackageInterface(); - virtual bool receivePackage(const Device& device, const NetworkPackage& np); + explicit PauseMusicPlugin(QObject *parent, const QVariantList &args); + +public Q_SLOTS: + virtual bool receivePackage(const NetworkPackage& np); private: enum PauseCondtions { PauseWhenTalking, PauseWhenRinging, NeverPause };