Migrated PauseMusic to new plugin format

This commit is contained in:
Albert Vaca 2013-08-13 06:09:14 +02:00
parent 8c3056a286
commit 031f769ff6
3 changed files with 22 additions and 12 deletions

View file

@ -2,4 +2,5 @@
install(FILES kdeconnect_plugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})
add_subdirectory(ping)
add_subdirectory(pausemusic)

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "pausemusicpackageinterface.h"
#include "pausemusicplugin.h"
#include <QDebug>
#include <QDBusConnection>
@ -27,16 +27,20 @@
#include <QDBusReply>
#include <QDBusMessage>
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;

View file

@ -18,20 +18,25 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PAUSEMUSICPACKAGEINTERFACE_H
#define PAUSEMUSICPACKAGEINTERFACE_H
#include "packageinterface.h"
#ifndef PAUSEMUSICPLUGIN_H
#define PAUSEMUSICPLUGIN_H
#include <QObject>
#include <QSet>
#include <QString>
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 };