mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
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:
committed by
redPanther
parent
102fd611fa
commit
ebbb6b9440
@@ -17,7 +17,6 @@
|
||||
|
||||
#include "HyperionConfig.h"
|
||||
|
||||
#include <utils/jsonschema/JsonFactory.h> // DEPRECATED | Remove this only when the conversion have been completed from JsonCpp to QTJson
|
||||
#include <utils/jsonschema/QJsonFactory.h>
|
||||
#include <utils/Components.h>
|
||||
|
||||
@@ -163,7 +162,24 @@ void HyperionDaemon::loadConfig(const QString & configFile)
|
||||
QJsonSchemaChecker schemaChecker;
|
||||
schemaChecker.setSchema(schemaJson.object());
|
||||
|
||||
_config = JsonFactory::readJson(configFile.toStdString()); // DEPRECATED | Remove this only when the conversion have been completed from JsonCpp to QTJson
|
||||
// ----------------- DEPRECATED BEGIN -----------------
|
||||
// NOTE: Remove this code block when the conversion have been completed from JsonCpp to QTJson
|
||||
|
||||
std::ifstream ifs(configFile.toStdString().c_str());
|
||||
|
||||
Json::Reader reader;
|
||||
|
||||
if (! reader.parse(ifs, _config, false))
|
||||
{
|
||||
// report to the user the failure and their locations in the document.
|
||||
std::stringstream sstream;
|
||||
sstream << "Failed to parse configuration: " << reader.getFormattedErrorMessages().c_str();
|
||||
|
||||
throw std::runtime_error(sstream.str());
|
||||
}
|
||||
|
||||
// ----------------- DEPRECATED END -----------------
|
||||
|
||||
_qconfig = QJsonFactory::readJson(configFile);
|
||||
if (!schemaChecker.validate(_qconfig))
|
||||
{
|
||||
|
Reference in New Issue
Block a user