priorities rework, webc update (#366)

* update

* update

* tabs test

* update

* test

* ...

* fix editor

* update ui

* fix visual glitch if help is off

* fix fadecandy error and th

[skip ci]
This commit is contained in:
brindosch
2017-01-17 21:53:35 +01:00
committed by redPanther
parent 5b809743f7
commit 8d7137136b
75 changed files with 1713 additions and 1144 deletions

View File

@@ -610,6 +610,48 @@ void JsonClientConnection::handleServerInfoCommand(const QJsonObject&, const QSt
}
}
if(priorityInfo.componentId == 9)
{
QJsonObject LEDcolor;
// add RGB Value to Array
QJsonArray RGBValue;
RGBValue.append(priorityInfo.ledColors.begin()->red);
RGBValue.append(priorityInfo.ledColors.begin()->green);
RGBValue.append(priorityInfo.ledColors.begin()->blue);
LEDcolor.insert("RGB", RGBValue);
uint16_t Hue;
float Saturation, Luminace;
// add HSL Value to Array
QJsonArray HSLValue;
ColorSys::rgb2hsl(priorityInfo.ledColors.begin()->red,
priorityInfo.ledColors.begin()->green,
priorityInfo.ledColors.begin()->blue,
Hue, Saturation, Luminace);
HSLValue.append(Hue);
HSLValue.append(Saturation);
HSLValue.append(Luminace);
LEDcolor.insert("HSL", HSLValue);
// add HEX Value to Array ["HEX Value"]
QJsonArray HEXValue;
std::stringstream hex;
hex << "0x"
<< std::uppercase << std::setw(2) << std::setfill('0')
<< std::hex << unsigned(priorityInfo.ledColors.begin()->red)
<< std::uppercase << std::setw(2) << std::setfill('0')
<< std::hex << unsigned(priorityInfo.ledColors.begin()->green)
<< std::uppercase << std::setw(2) << std::setfill('0')
<< std::hex << unsigned(priorityInfo.ledColors.begin()->blue);
HEXValue.append(QString::fromStdString(hex.str()));
LEDcolor.insert("HEX", HEXValue);
item["value"] = LEDcolor;
}
// priorities[priorities.size()] = item;
priorities.append(item);
}
@@ -679,87 +721,6 @@ void JsonClientConnection::handleServerInfoCommand(const QJsonObject&, const QSt
}
info["effects"] = effects;
// collect active effect info
QJsonArray activeEffects;
const std::list<ActiveEffectDefinition> & activeEffectsDefinitions = _hyperion->getActiveEffects();
for (const ActiveEffectDefinition & activeEffectDefinition : activeEffectsDefinitions)
{
if (activeEffectDefinition.priority != PriorityMuxer::LOWEST_PRIORITY -1)
{
QJsonObject activeEffect;
activeEffect["script"] = activeEffectDefinition.script;
activeEffect["name"] = activeEffectDefinition.name;
activeEffect["priority"] = activeEffectDefinition.priority;
activeEffect["timeout"] = activeEffectDefinition.timeout;
activeEffect["args"] = activeEffectDefinition.args;
activeEffects.append(activeEffect);
}
}
info["activeEffects"] = activeEffects;
// collect active static led color
QJsonArray activeLedColors;
const Hyperion::InputInfo & priorityInfo = _hyperion->getPriorityInfo(_hyperion->getCurrentPriority());
if (priorityInfo.priority != std::numeric_limits<int>::max())
{
QJsonObject LEDcolor;
// check if all LEDs has the same Color
if (std::all_of(priorityInfo.ledColors.begin(), priorityInfo.ledColors.end(), [&](ColorRgb color)
{
return ((color.red == priorityInfo.ledColors.begin()->red) &&
(color.green == priorityInfo.ledColors.begin()->green) &&
(color.blue == priorityInfo.ledColors.begin()->blue));
} ))
{
// check if LED Color not Black (0,0,0)
if ((priorityInfo.ledColors.begin()->red +
priorityInfo.ledColors.begin()->green +
priorityInfo.ledColors.begin()->blue != 0))
{
// add RGB Value to Array
QJsonArray RGBValue;
RGBValue.append(priorityInfo.ledColors.begin()->red);
RGBValue.append(priorityInfo.ledColors.begin()->green);
RGBValue.append(priorityInfo.ledColors.begin()->blue);
LEDcolor.insert("RGB Value", RGBValue);
uint16_t Hue;
float Saturation, Luminace;
// add HSL Value to Array
QJsonArray HSLValue;
ColorSys::rgb2hsl(priorityInfo.ledColors.begin()->red,
priorityInfo.ledColors.begin()->green,
priorityInfo.ledColors.begin()->blue,
Hue, Saturation, Luminace);
HSLValue.append(Hue);
HSLValue.append(Saturation);
HSLValue.append(Luminace);
LEDcolor.insert("HSL Value", HSLValue);
// add HEX Value to Array ["HEX Value"]
QJsonArray HEXValue;
std::stringstream hex;
hex << "0x"
<< std::uppercase << std::setw(2) << std::setfill('0')
<< std::hex << unsigned(priorityInfo.ledColors.begin()->red)
<< std::uppercase << std::setw(2) << std::setfill('0')
<< std::hex << unsigned(priorityInfo.ledColors.begin()->green)
<< std::uppercase << std::setw(2) << std::setfill('0')
<< std::hex << unsigned(priorityInfo.ledColors.begin()->blue);
HEXValue.append(QString::fromStdString(hex.str()));
LEDcolor.insert("HEX Value", HEXValue);
activeLedColors.append(LEDcolor);
}
}
}
info["activeLedColor"] = activeLedColors;
// get available led devices
QJsonObject ledDevices;

View File

@@ -12,6 +12,8 @@
},
"priority": {
"type": "integer",
"minimum" : 1,
"maximum" : 253,
"required": true
}
},

View File

@@ -12,6 +12,8 @@
},
"priority": {
"type": "integer",
"minimum" : 1,
"maximum" : 253,
"required": true
},
"duration": {

View File

@@ -12,6 +12,8 @@
},
"priority": {
"type": "integer",
"minimum" : 1,
"maximum" : 253,
"required": true
},
"duration": {

View File

@@ -12,6 +12,8 @@
},
"priority": {
"type": "integer",
"minimum" : 1,
"maximum" : 253,
"required": true
},
"duration": {

View File

@@ -11,7 +11,9 @@
"type" : "integer"
},
"priority": {
"type": "integer"
"type": "integer",
"minimum" : 0,
"maximum" : 255
},
"auto": {
"type": "boolean"