implement states for components_autoselect and ledMAppingType via json (#344)

This commit is contained in:
redPanther 2016-12-20 19:55:54 +01:00 committed by GitHub
parent c5e0299c55
commit 0414e3c860
5 changed files with 20 additions and 5 deletions

View File

@ -183,6 +183,9 @@ public:
bool configWriteable(); bool configWriteable();
/// gets the methode how image is maped to leds
int getLedMappingType() { return _ledMAppingType; };
public slots: public slots:
/// ///
/// Writes a single color to all the leds for the given time and priority /// Writes a single color to all the leds for the given time and priority
@ -406,4 +409,6 @@ private:
QByteArray _configHash; QByteArray _configHash;
QSize _ledGridSize; QSize _ledGridSize;
int _ledMAppingType;
}; };

View File

@ -50,6 +50,7 @@ public:
int ledMappingType(); int ledMappingType();
static int mappingTypeToInt(QString mappingType); static int mappingTypeToInt(QString mappingType);
static QString mappingTypeToStr(int mappingType);
public slots: public slots:
/// Enable or disable the black border detector /// Enable or disable the black border detector

View File

@ -560,11 +560,9 @@ Hyperion::Hyperion(const QJsonObject &qjsonConfig, const QString configFile)
InfoIf(_colorAdjustmentV4Lonly , _log, "Color adjustment for v4l inputs only" ); InfoIf(_colorAdjustmentV4Lonly , _log, "Color adjustment for v4l inputs only" );
// initialize the image processor factory // initialize the image processor factory
ImageProcessorFactory::getInstance().init( _ledMAppingType = ImageProcessor::mappingTypeToInt(color["imageToLedMappingType"].toString());
_ledString, ImageProcessorFactory::getInstance().init(_ledString, qjsonConfig["blackborderdetector"].toObject(),_ledMAppingType );
qjsonConfig["blackborderdetector"].toObject(),
ImageProcessor::mappingTypeToInt(color["imageToLedMappingType"].toString())
);
getComponentRegister().componentStateChanged(hyperion::COMP_FORWARDER, _messageForwarder->forwardingEnabled()); getComponentRegister().componentStateChanged(hyperion::COMP_FORWARDER, _messageForwarder->forwardingEnabled());
// initialize leddevices // initialize leddevices
@ -856,6 +854,7 @@ int Hyperion::setEffect(const QString &effectName, const QJsonObject &args, int
void Hyperion::setLedMappingType(int mappingType) void Hyperion::setLedMappingType(int mappingType)
{ {
_ledMAppingType = mappingType;
emit imageToLedsMappingChanged(mappingType); emit imageToLedsMappingChanged(mappingType);
} }

View File

@ -76,6 +76,14 @@ int ImageProcessor::mappingTypeToInt(QString mappingType)
return 0; return 0;
} }
QString ImageProcessor::mappingTypeToStr(int mappingType)
{
if (mappingType == 1 )
return "unicolor_mean";
return "mulicolor_mean";
}
bool ImageProcessor::getScanParameters(size_t led, double &hscanBegin, double &hscanEnd, double &vscanBegin, double &vscanEnd) const bool ImageProcessor::getScanParameters(size_t led, double &hscanBegin, double &hscanEnd, double &vscanBegin, double &vscanEnd) const
{ {
if (led < _ledString.leds().size()) if (led < _ledString.leds().size())

View File

@ -836,6 +836,8 @@ void JsonClientConnection::handleServerInfoCommand(const QJsonObject&, const QSt
} }
info["components"] = component; info["components"] = component;
info["components_autoselect"] = _hyperion->sourceAutoSelectEnabled();
info["ledMAppingType"] = ImageProcessor::mappingTypeToStr(_hyperion->getLedMappingType());
// Add Hyperion Version, build time // Add Hyperion Version, build time
QJsonArray hyperion; QJsonArray hyperion;