JsonCpp to QTJson (Part 2) (#147)

* Replace std::string with QString

* Replace std::string with QString

* Replace std::string with QString

* Replace std::string with QString

* Convert JsonCPP Code to QTJson

Not all JsonCPP Code is converted to QTJson Code. See Pull Request for Details.

* Convert JsonCPP Code to QTJson

Not all JsonCPP Code is converted to QTJson Code. See Pull Request for Details.
This commit is contained in:
Paulchen-Panther
2016-08-04 10:53:26 +02:00
committed by brindosch
parent 0e2f0127fd
commit f183032270
6 changed files with 171 additions and 106 deletions

View File

@@ -8,7 +8,7 @@
KODIVideoChecker* KODIVideoChecker::_kodichecker = nullptr;
KODIVideoChecker* KODIVideoChecker::initInstance(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabPause, bool grabScreensaver, bool enable3DDetection)
KODIVideoChecker* KODIVideoChecker::initInstance(const QString & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabPause, bool grabScreensaver, bool enable3DDetection)
{
if ( KODIVideoChecker::_kodichecker != nullptr )
throw std::runtime_error("KODIVideoChecker::initInstance can be called only one time");
@@ -39,9 +39,9 @@ KODIVideoChecker* KODIVideoChecker::getInstance()
// {"jsonrpc":"2.0","method":"GUI.GetProperties","params":{"properties":["stereoscopicmode"]},"id":669}
// {"id":669,"jsonrpc":"2.0","result":{"stereoscopicmode":{"label":"Nebeneinander","mode":"split_vertical"}}}
KODIVideoChecker::KODIVideoChecker(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabPause, bool grabScreensaver, bool enable3DDetection)
KODIVideoChecker::KODIVideoChecker(const QString & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabPause, bool grabScreensaver, bool enable3DDetection)
: QObject()
, _address(QString::fromStdString(address))
, _address(address)
, _port(port)
, _activePlayerRequest(R"({"jsonrpc":"2.0","method":"Player.GetActivePlayers", "id":666})")
, _currentPlayingItemRequest(R"({"id":667,"jsonrpc":"2.0","method":"Player.GetItem","params":{"playerid":%1,"properties":["file"]}})")
@@ -78,9 +78,9 @@ KODIVideoChecker::~KODIVideoChecker()
}
void KODIVideoChecker::setConfig(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabPause, bool grabScreensaver, bool enable3DDetection)
void KODIVideoChecker::setConfig(const QString & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabPause, bool grabScreensaver, bool enable3DDetection)
{
_address = QString::fromStdString(address);
_address = address;
_port = port;
_grabVideo = grabVideo;
_grabPhoto = grabPhoto;

View File

@@ -10,7 +10,7 @@
#include "utils/ColorRgb.h"
#include "HyperionConfig.h"
UDPListener::UDPListener(const int priority, const int timeout, const std::string& address, quint16 listenPort, bool shared) :
UDPListener::UDPListener(const int priority, const int timeout, const QString& address, quint16 listenPort, bool shared) :
QObject(),
_hyperion(Hyperion::getInstance()),
_server(),
@@ -23,9 +23,9 @@ UDPListener::UDPListener(const int priority, const int timeout, const std::strin
_bondage(shared ? QAbstractSocket::ShareAddress : QAbstractSocket::DefaultForPlatform)
{
_server = new QUdpSocket(this);
_listenAddress = address.empty()
_listenAddress = address.isEmpty()
? QHostAddress::AnyIPv4
: QHostAddress( QString::fromStdString(address) );
: QHostAddress(address);
// Set trigger for incoming connections
connect(_server, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams()));