changed kodi json handler class name

This commit is contained in:
Simon Stürz 2015-07-07 23:51:40 +02:00 committed by Michael Zanetti
parent c7381c38e4
commit 053ea0a770
6 changed files with 27 additions and 27 deletions

View File

@ -29,15 +29,15 @@ Kodi::Kodi(const QByteArray &logo, const QHostAddress &hostAddress, const int &p
m_connection = new KodiConnection(hostAddress, port, this);
connect (m_connection, &KodiConnection::connectionStatusChanged, this, &Kodi::connectionStatusChanged);
m_jsonHandler = new JsonHandler(m_connection, this);
connect(m_jsonHandler, &JsonHandler::volumeChanged, this, &Kodi::onVolumeChanged);
connect(m_jsonHandler, &JsonHandler::actionExecuted, this, &Kodi::actionExecuted);
connect(m_jsonHandler, &JsonHandler::versionDataReceived, this, &Kodi::versionDataReceived);
connect(m_jsonHandler, &JsonHandler::updateDataReceived, this, &Kodi::updateDataReceived);
connect(m_jsonHandler, &JsonHandler::updateDataReceived, this, &Kodi::onUpdateFinished);
connect(m_jsonHandler, &JsonHandler::onPlayerPlay, this, &Kodi::onPlayerPlay);
connect(m_jsonHandler, &JsonHandler::onPlayerPause, this, &Kodi::onPlayerPause);
connect(m_jsonHandler, &JsonHandler::onPlayerStop, this, &Kodi::onPlayerStop);
m_jsonHandler = new KodiJsonHandler(m_connection, this);
connect(m_jsonHandler, &KodiJsonHandler::volumeChanged, this, &Kodi::onVolumeChanged);
connect(m_jsonHandler, &KodiJsonHandler::actionExecuted, this, &Kodi::actionExecuted);
connect(m_jsonHandler, &KodiJsonHandler::versionDataReceived, this, &Kodi::versionDataReceived);
connect(m_jsonHandler, &KodiJsonHandler::updateDataReceived, this, &Kodi::updateDataReceived);
connect(m_jsonHandler, &KodiJsonHandler::updateDataReceived, this, &Kodi::onUpdateFinished);
connect(m_jsonHandler, &KodiJsonHandler::onPlayerPlay, this, &Kodi::onPlayerPlay);
connect(m_jsonHandler, &KodiJsonHandler::onPlayerPause, this, &Kodi::onPlayerPause);
connect(m_jsonHandler, &KodiJsonHandler::onPlayerStop, this, &Kodi::onPlayerStop);
}
QHostAddress Kodi::hostAddress() const

View File

@ -27,7 +27,7 @@
#include <QPixmap>
#include "kodiconnection.h"
#include "jsonhandler.h"
#include "kodijsonhandler.h"
class Kodi : public QObject
{
@ -63,7 +63,7 @@ public:
private:
KodiConnection *m_connection;
JsonHandler *m_jsonHandler;
KodiJsonHandler *m_jsonHandler;
QByteArray m_logo;
bool m_muted;
int m_volume;

View File

@ -7,14 +7,14 @@ RESOURCES += images.qrc
SOURCES += \
devicepluginkodi.cpp \
kodiconnection.cpp \
jsonhandler.cpp \
kodijsonhandler.cpp \
kodi.cpp \
kodireply.cpp
HEADERS += \
devicepluginkodi.h \
kodiconnection.h \
jsonhandler.h \
kodijsonhandler.h \
kodi.h \
kodireply.h

View File

@ -19,7 +19,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "kodiconnection.h"
#include "jsonhandler.h"
#include "kodijsonhandler.h"
#include "extern-plugininfo.h"
#include <QPixmap>

View File

@ -18,20 +18,20 @@
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "jsonhandler.h"
#include "kodijsonhandler.h"
#include "extern-plugininfo.h"
#include <QJsonDocument>
JsonHandler::JsonHandler(KodiConnection *connection, QObject *parent) :
KodiJsonHandler::KodiJsonHandler(KodiConnection *connection, QObject *parent) :
QObject(parent),
m_connection(connection),
m_id(0)
{
connect(m_connection, &KodiConnection::dataReady, this, &JsonHandler::processResponse);
connect(m_connection, &KodiConnection::dataReady, this, &KodiJsonHandler::processResponse);
}
void JsonHandler::sendData(const QString &method, const QVariantMap &params, const ActionId &actionId)
void KodiJsonHandler::sendData(const QString &method, const QVariantMap &params, const ActionId &actionId)
{
QVariantMap package;
package.insert("id", m_id);
@ -47,7 +47,7 @@ void JsonHandler::sendData(const QString &method, const QVariantMap &params, con
m_id++;
}
void JsonHandler::processNotification(const QString &method, const QVariantMap &params)
void KodiJsonHandler::processNotification(const QString &method, const QVariantMap &params)
{
qCDebug(dcKodi) << "got notification" << method;
@ -63,7 +63,7 @@ void JsonHandler::processNotification(const QString &method, const QVariantMap &
}
}
void JsonHandler::processActionResponse(const KodiReply &reply, const QVariantMap &response)
void KodiJsonHandler::processActionResponse(const KodiReply &reply, const QVariantMap &response)
{
if (response.contains("error")) {
qCDebug(dcKodi) << QJsonDocument::fromVariant(response).toJson();
@ -74,7 +74,7 @@ void JsonHandler::processActionResponse(const KodiReply &reply, const QVariantMa
}
}
void JsonHandler::processRequestResponse(const KodiReply &reply, const QVariantMap &response)
void KodiJsonHandler::processRequestResponse(const KodiReply &reply, const QVariantMap &response)
{
if (response.contains("error")) {
qCDebug(dcKodi) << QJsonDocument::fromVariant(response).toJson();
@ -92,7 +92,7 @@ void JsonHandler::processRequestResponse(const KodiReply &reply, const QVariantM
}
}
void JsonHandler::processResponse(const QByteArray &data)
void KodiJsonHandler::processResponse(const QByteArray &data)
{
QJsonParseError error;
QJsonDocument jsonDoc = QJsonDocument::fromJson(data, &error);

View File

@ -18,8 +18,8 @@
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef JSONHANDLER_H
#define JSONHANDLER_H
#ifndef KODIJSONHANDLER_H
#define KODIJSONHANDLER_H
#include <QObject>
#include <QVariant>
@ -29,11 +29,11 @@
#include "kodireply.h"
#include "typeutils.h"
class JsonHandler : public QObject
class KodiJsonHandler : public QObject
{
Q_OBJECT
public:
explicit JsonHandler(KodiConnection *connection = 0, QObject *parent = 0);
explicit KodiJsonHandler(KodiConnection *connection = 0, QObject *parent = 0);
void sendData(const QString &method, const QVariantMap &params, const ActionId &actionId);
@ -61,4 +61,4 @@ private slots:
};
#endif // JSONHANDLER_H
#endif // KODIJSONHANDLER_H