JsonCpp to QTJson (Part 3) (#257)

* Update BlackBorderProcessor.h

* Update Hyperion.h

* Update ImageProcessor.h

* Update ImageProcessorFactory.h

* Update LedString.h

* Update BlackBorderProcessor.cpp

* Update ImageProcessor.cpp

* Update ImageProcessorFactory.cpp

* Update Hyperion.cpp

* Update hyperiond.cpp

* Update TestImage2LedsMap.cpp

* Update TestBlackBorderProcessor.cpp

* Update Hyperion.cpp

* Update Hyperion.cpp
This commit is contained in:
Paulchen Panther
2016-09-25 21:59:31 +02:00
committed by redPanther
parent d6a34edfb2
commit f146894799
12 changed files with 212 additions and 180 deletions

View File

@@ -1,8 +1,8 @@
#pragma once
// Jsoncpp includes
#include <json/json.h>
// QT includes
#include <QJsonObject>
// Local Hyperion includes
#include "BlackBorderDetector.h"
@@ -26,7 +26,7 @@ namespace hyperion
/// outer pixels is blurred (black and color combined due to image scaling))
/// @param[in] blackborderThreshold The threshold which the blackborder detector should use
///
BlackBorderProcessor(const Json::Value &blackborderConfig);
BlackBorderProcessor(const QJsonObject &blackborderConfig);
///
/// Return the current (detected) border

View File

@@ -8,6 +8,9 @@
#include <QObject>
#include <QTimer>
#include <QSize>
#include <QJsonObject>
#include <QJsonValue>
#include <QJsonArray>
// hyperion-utils includes
#include <utils/Image.h>
@@ -79,7 +82,7 @@ public:
~Hyperion();
static Hyperion* initInstance(const Json::Value& jsonConfig, const std::string configFile);
static Hyperion* initInstance(const Json::Value& jsonConfig, const QJsonObject& qjsonConfig, const std::string configFile);
static Hyperion* getInstance();
///
@@ -270,7 +273,7 @@ public slots:
public:
static Hyperion *_hyperion;
static ColorOrder createColorOrder(const Json::Value & deviceConfig);
static ColorOrder createColorOrder(const QJsonObject & deviceConfig);
/**
* Construct the 'led-string' with the integration area definition per led and the color
* ordering of the RGB channels
@@ -278,24 +281,24 @@ public:
* @param deviceOrder The default RGB channel ordering
* @return The constructed ledstring
*/
static LedString createLedString(const Json::Value & ledsConfig, const ColorOrder deviceOrder);
static LedString createLedStringClone(const Json::Value & ledsConfig, const ColorOrder deviceOrder);
static LedString createLedString(const QJsonValue & ledsConfig, const ColorOrder deviceOrder);
static LedString createLedStringClone(const QJsonValue & ledsConfig, const ColorOrder deviceOrder);
static MultiColorTransform * createLedColorsTransform(const unsigned ledCnt, const Json::Value & colorTransformConfig);
static MultiColorCorrection * createLedColorsTemperature(const unsigned ledCnt, const Json::Value & colorTemperatureConfig);
static MultiColorAdjustment * createLedColorsAdjustment(const unsigned ledCnt, const Json::Value & colorAdjustmentConfig);
static ColorTransform * createColorTransform(const Json::Value & transformConfig);
static ColorCorrection * createColorCorrection(const Json::Value & correctionConfig);
static ColorAdjustment * createColorAdjustment(const Json::Value & adjustmentConfig);
static HsvTransform * createHsvTransform(const Json::Value & hsvConfig);
static HslTransform * createHslTransform(const Json::Value & hslConfig);
static RgbChannelTransform * createRgbChannelTransform(const Json::Value& colorConfig);
static RgbChannelAdjustment * createRgbChannelCorrection(const Json::Value& colorConfig);
static RgbChannelAdjustment * createRgbChannelAdjustment(const Json::Value& colorConfig, const RgbChannel color);
static MultiColorTransform * createLedColorsTransform(const unsigned ledCnt, const QJsonObject & colorTransformConfig);
static MultiColorCorrection * createLedColorsTemperature(const unsigned ledCnt, const QJsonObject & colorTemperatureConfig);
static MultiColorAdjustment * createLedColorsAdjustment(const unsigned ledCnt, const QJsonObject & colorAdjustmentConfig);
static ColorTransform * createColorTransform(const QJsonObject & transformConfig);
static ColorCorrection * createColorCorrection(const QJsonObject & correctionConfig);
static ColorAdjustment * createColorAdjustment(const QJsonObject & adjustmentConfig);
static HsvTransform * createHsvTransform(const QJsonObject & hsvConfig);
static HslTransform * createHslTransform(const QJsonObject & hslConfig);
static RgbChannelTransform * createRgbChannelTransform(const QJsonObject& colorConfig);
static RgbChannelAdjustment * createRgbChannelCorrection(const QJsonObject& colorConfig);
static RgbChannelAdjustment * createRgbChannelAdjustment(const QJsonObject& colorConfig, const RgbChannel color);
static LinearColorSmoothing * createColorSmoothing(const Json::Value & smoothingConfig, LedDevice* leddevice);
static MessageForwarder * createMessageForwarder(const Json::Value & forwarderConfig);
static QSize getLedLayoutGridSize(const Json::Value& ledsConfig);
static LinearColorSmoothing * createColorSmoothing(const QJsonObject & smoothingConfig, LedDevice* leddevice);
static MessageForwarder * createMessageForwarder(const QJsonObject & forwarderConfig);
static QSize getLedLayoutGridSize(const QJsonValue& ledsConfig);
signals:
/// Signal which is emitted when a priority channel is actively cleared
@@ -322,7 +325,7 @@ private:
///
/// @param[in] jsonConfig The Json configuration
///
Hyperion(const Json::Value& jsonConfig, const std::string configFile);
Hyperion(const Json::Value& jsonConfig, const QJsonObject& qjsonConfig, const std::string configFile);
/// The specifiation of the led frame construction and picture integration
LedString _ledString;

View File

@@ -109,7 +109,7 @@ private:
/// @param[in] ledString The led-string specification
/// @param[in] blackborderThreshold The threshold which the blackborder detector should use
///
ImageProcessor(const LedString &ledString, const Json::Value &blackborderConfig);
ImageProcessor(const LedString &ledString, const QJsonObject &blackborderConfig);
///
/// Performs black-border detection (if enabled) on the given image

View File

@@ -3,6 +3,14 @@
// STL includes
#include <memory>
// QT includes
#include <QJsonObject>
// if (jsoncpp_converted_to_QtJSON)
// {
// remove("#include <json/json.h>");
// }
// Jsoncpp includes
#include <json/json.h>
@@ -33,7 +41,7 @@ public:
/// @param[in] enableBlackBorderDetector Flag indicating if the blacborder detector should be enabled
/// @param[in] blackborderThreshold The threshold which the blackborder detector should use
///
void init(const LedString& ledString, const Json::Value &blackborderConfig);
void init(const LedString& ledString, const QJsonObject &blackborderConfig);
///
/// Creates a new ImageProcessor. The onwership of the processor is transferred to the caller.
@@ -47,5 +55,5 @@ private:
LedString _ledString;
// Reference to the blackborder json configuration values
Json::Value _blackborderConfig;
QJsonObject _blackborderConfig;
};

View File

@@ -9,6 +9,9 @@
// Local includes
#include <utils/ColorRgb.h>
// QT includes
#include <QString>
// Forward class declarations
namespace Json { class Value; }
@@ -18,7 +21,7 @@ enum ColorOrder
ORDER_RGB, ORDER_RBG, ORDER_GRB, ORDER_BRG, ORDER_GBR, ORDER_BGR
};
inline std::string colorOrderToString(const ColorOrder colorOrder)
inline QString colorOrderToString(const ColorOrder colorOrder)
{
switch (colorOrder)
{
@@ -38,7 +41,7 @@ inline std::string colorOrderToString(const ColorOrder colorOrder)
return "not-a-colororder";
}
}
inline ColorOrder stringToColorOrder(const std::string & order)
inline ColorOrder stringToColorOrder(const QString & order)
{
if (order == "rgb")
{
@@ -65,7 +68,7 @@ inline ColorOrder stringToColorOrder(const std::string & order)
return ORDER_GRB;
}
std::cout << "Unknown color order defined (" << order << "). Using RGB." << std::endl;
std::cout << "Unknown color order defined (" << order.toStdString() << "). Using RGB." << std::endl;
return ORDER_RGB;
}