JsonCpp to QTJson (Part 5) (#270)

* Update Hyperion.h

* Update ImageProcessorFactory.h

* Update ProtoConnection.h

* Update WebConfig.h

* Update CMakeLists.txt

* Update Hyperion.cpp

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CgiHandler.cpp

* Update CgiHandler.h

* Update WebConfig.cpp

* Update CMakeLists.txt

* Update hyperion-remote.cpp

* Update JsonConnection.cpp

* Update JsonConnection.h

* Update hyperiond.cpp

* Update hyperiond.h

* Delete JsonFactory.h

* Delete JsonSchemaChecker.h

* Delete JsonSchemaChecker.cpp

* Update WebConfig.cpp
This commit is contained in:
Paulchen Panther
2016-10-11 19:51:20 +02:00
committed by redPanther
parent 102fd611fa
commit ebbb6b9440
20 changed files with 223 additions and 899 deletions

View File

@@ -11,7 +11,7 @@
CgiHandler::CgiHandler (Hyperion * hyperion, QString baseUrl, QObject * parent)
: QObject(parent)
, _hyperion(hyperion)
, _hyperionConfig(_hyperion->getJsonConfig())
, _hyperionConfig(_hyperion->getQJsonConfig())
, _baseUrl(baseUrl)
{
}
@@ -44,10 +44,10 @@ void CgiHandler::cmd_cfg_jsonserver(const QStringList & args, QtHttpReply * repl
if ( args.at(0) == "cfg_jsonserver" )
{
quint16 jsonPort = 19444;
if (_hyperionConfig.isMember("jsonServer"))
if (_hyperionConfig.contains("jsonServer"))
{
const Json::Value & jsonConfig = _hyperionConfig["jsonServer"];
jsonPort = jsonConfig.get("port", jsonPort).asUInt();
const QJsonObject jsonConfig = _hyperionConfig["jsonServer"].toObject();
jsonPort = jsonConfig["port"].toInt(jsonPort);
}
// send result as reply

View File

@@ -5,7 +5,6 @@
#include <QString>
#include <QStringList>
#include <utils/jsonschema/JsonFactory.h>
#include <hyperion/Hyperion.h>
#include "QtHttpReply.h"
@@ -28,7 +27,7 @@ public:
private:
Hyperion* _hyperion;
QtHttpReply * _reply;
const Json::Value &_hyperionConfig;
const QJsonObject &_hyperionConfig;
const QString _baseUrl;
};

View File

@@ -11,16 +11,16 @@ WebConfig::WebConfig(QObject * parent)
Logger* log = Logger::getInstance("WEBSERVER");
_port = WEBCONFIG_DEFAULT_PORT;
_baseUrl = WEBCONFIG_DEFAULT_PATH;
const Json::Value &config = _hyperion->getJsonConfig();
const QJsonObject config = _hyperion->getQJsonConfig();
bool webconfigEnable = true;
if (config.isMember("webConfig"))
if (config.contains("webConfig"))
{
const Json::Value & webconfigConfig = config["webConfig"];
webconfigEnable = webconfigConfig.get("enable", true).asBool();
_port = webconfigConfig.get("port", _port).asUInt();
_baseUrl = QString::fromStdString( webconfigConfig.get("document_root", _baseUrl.toStdString()).asString() );
const QJsonObject webconfigConfig = config["webConfig"].toObject();
webconfigEnable = webconfigConfig["enable"].toBool(true);
_port = webconfigConfig["port"].toInt(_port);
_baseUrl = webconfigConfig["document_root"].toString(_baseUrl);
}
if (_baseUrl != ":/webconfig")