changed kodi json handler class name
This commit is contained in:
parent
c7381c38e4
commit
053ea0a770
@ -29,15 +29,15 @@ Kodi::Kodi(const QByteArray &logo, const QHostAddress &hostAddress, const int &p
|
|||||||
m_connection = new KodiConnection(hostAddress, port, this);
|
m_connection = new KodiConnection(hostAddress, port, this);
|
||||||
connect (m_connection, &KodiConnection::connectionStatusChanged, this, &Kodi::connectionStatusChanged);
|
connect (m_connection, &KodiConnection::connectionStatusChanged, this, &Kodi::connectionStatusChanged);
|
||||||
|
|
||||||
m_jsonHandler = new JsonHandler(m_connection, this);
|
m_jsonHandler = new KodiJsonHandler(m_connection, this);
|
||||||
connect(m_jsonHandler, &JsonHandler::volumeChanged, this, &Kodi::onVolumeChanged);
|
connect(m_jsonHandler, &KodiJsonHandler::volumeChanged, this, &Kodi::onVolumeChanged);
|
||||||
connect(m_jsonHandler, &JsonHandler::actionExecuted, this, &Kodi::actionExecuted);
|
connect(m_jsonHandler, &KodiJsonHandler::actionExecuted, this, &Kodi::actionExecuted);
|
||||||
connect(m_jsonHandler, &JsonHandler::versionDataReceived, this, &Kodi::versionDataReceived);
|
connect(m_jsonHandler, &KodiJsonHandler::versionDataReceived, this, &Kodi::versionDataReceived);
|
||||||
connect(m_jsonHandler, &JsonHandler::updateDataReceived, this, &Kodi::updateDataReceived);
|
connect(m_jsonHandler, &KodiJsonHandler::updateDataReceived, this, &Kodi::updateDataReceived);
|
||||||
connect(m_jsonHandler, &JsonHandler::updateDataReceived, this, &Kodi::onUpdateFinished);
|
connect(m_jsonHandler, &KodiJsonHandler::updateDataReceived, this, &Kodi::onUpdateFinished);
|
||||||
connect(m_jsonHandler, &JsonHandler::onPlayerPlay, this, &Kodi::onPlayerPlay);
|
connect(m_jsonHandler, &KodiJsonHandler::onPlayerPlay, this, &Kodi::onPlayerPlay);
|
||||||
connect(m_jsonHandler, &JsonHandler::onPlayerPause, this, &Kodi::onPlayerPause);
|
connect(m_jsonHandler, &KodiJsonHandler::onPlayerPause, this, &Kodi::onPlayerPause);
|
||||||
connect(m_jsonHandler, &JsonHandler::onPlayerStop, this, &Kodi::onPlayerStop);
|
connect(m_jsonHandler, &KodiJsonHandler::onPlayerStop, this, &Kodi::onPlayerStop);
|
||||||
}
|
}
|
||||||
|
|
||||||
QHostAddress Kodi::hostAddress() const
|
QHostAddress Kodi::hostAddress() const
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
|
|
||||||
#include "kodiconnection.h"
|
#include "kodiconnection.h"
|
||||||
#include "jsonhandler.h"
|
#include "kodijsonhandler.h"
|
||||||
|
|
||||||
class Kodi : public QObject
|
class Kodi : public QObject
|
||||||
{
|
{
|
||||||
@ -63,7 +63,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
KodiConnection *m_connection;
|
KodiConnection *m_connection;
|
||||||
JsonHandler *m_jsonHandler;
|
KodiJsonHandler *m_jsonHandler;
|
||||||
QByteArray m_logo;
|
QByteArray m_logo;
|
||||||
bool m_muted;
|
bool m_muted;
|
||||||
int m_volume;
|
int m_volume;
|
||||||
|
|||||||
@ -7,14 +7,14 @@ RESOURCES += images.qrc
|
|||||||
SOURCES += \
|
SOURCES += \
|
||||||
devicepluginkodi.cpp \
|
devicepluginkodi.cpp \
|
||||||
kodiconnection.cpp \
|
kodiconnection.cpp \
|
||||||
jsonhandler.cpp \
|
kodijsonhandler.cpp \
|
||||||
kodi.cpp \
|
kodi.cpp \
|
||||||
kodireply.cpp
|
kodireply.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
devicepluginkodi.h \
|
devicepluginkodi.h \
|
||||||
kodiconnection.h \
|
kodiconnection.h \
|
||||||
jsonhandler.h \
|
kodijsonhandler.h \
|
||||||
kodi.h \
|
kodi.h \
|
||||||
kodireply.h
|
kodireply.h
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
#include "kodiconnection.h"
|
#include "kodiconnection.h"
|
||||||
#include "jsonhandler.h"
|
#include "kodijsonhandler.h"
|
||||||
#include "extern-plugininfo.h"
|
#include "extern-plugininfo.h"
|
||||||
|
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
|
|||||||
@ -18,20 +18,20 @@
|
|||||||
* *
|
* *
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
#include "jsonhandler.h"
|
#include "kodijsonhandler.h"
|
||||||
#include "extern-plugininfo.h"
|
#include "extern-plugininfo.h"
|
||||||
|
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
|
|
||||||
JsonHandler::JsonHandler(KodiConnection *connection, QObject *parent) :
|
KodiJsonHandler::KodiJsonHandler(KodiConnection *connection, QObject *parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
m_connection(connection),
|
m_connection(connection),
|
||||||
m_id(0)
|
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 ¶ms, const ActionId &actionId)
|
void KodiJsonHandler::sendData(const QString &method, const QVariantMap ¶ms, const ActionId &actionId)
|
||||||
{
|
{
|
||||||
QVariantMap package;
|
QVariantMap package;
|
||||||
package.insert("id", m_id);
|
package.insert("id", m_id);
|
||||||
@ -47,7 +47,7 @@ void JsonHandler::sendData(const QString &method, const QVariantMap ¶ms, con
|
|||||||
m_id++;
|
m_id++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonHandler::processNotification(const QString &method, const QVariantMap ¶ms)
|
void KodiJsonHandler::processNotification(const QString &method, const QVariantMap ¶ms)
|
||||||
{
|
{
|
||||||
qCDebug(dcKodi) << "got notification" << method;
|
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")) {
|
if (response.contains("error")) {
|
||||||
qCDebug(dcKodi) << QJsonDocument::fromVariant(response).toJson();
|
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")) {
|
if (response.contains("error")) {
|
||||||
qCDebug(dcKodi) << QJsonDocument::fromVariant(response).toJson();
|
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;
|
QJsonParseError error;
|
||||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(data, &error);
|
QJsonDocument jsonDoc = QJsonDocument::fromJson(data, &error);
|
||||||
@ -18,8 +18,8 @@
|
|||||||
* *
|
* *
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
#ifndef JSONHANDLER_H
|
#ifndef KODIJSONHANDLER_H
|
||||||
#define JSONHANDLER_H
|
#define KODIJSONHANDLER_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
@ -29,11 +29,11 @@
|
|||||||
#include "kodireply.h"
|
#include "kodireply.h"
|
||||||
#include "typeutils.h"
|
#include "typeutils.h"
|
||||||
|
|
||||||
class JsonHandler : public QObject
|
class KodiJsonHandler : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit JsonHandler(KodiConnection *connection = 0, QObject *parent = 0);
|
explicit KodiJsonHandler(KodiConnection *connection = 0, QObject *parent = 0);
|
||||||
|
|
||||||
void sendData(const QString &method, const QVariantMap ¶ms, const ActionId &actionId);
|
void sendData(const QString &method, const QVariantMap ¶ms, const ActionId &actionId);
|
||||||
|
|
||||||
@ -61,4 +61,4 @@ private slots:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // JSONHANDLER_H
|
#endif // KODIJSONHANDLER_H
|
||||||
Reference in New Issue
Block a user