Hyperion-remote changed to support multiple colors in the setColor command

Former-commit-id: f0acda054056d6fa937e9cbd2b22686979911bc9
This commit is contained in:
johan
2013-12-13 00:01:48 +01:00
parent cf7f66bc40
commit c11808878f
4 changed files with 37 additions and 20 deletions

View File

@@ -39,18 +39,21 @@ JsonConnection::~JsonConnection()
_socket.close();
}
void JsonConnection::setColor(QColor color, int priority, int duration)
void JsonConnection::setColor(std::vector<QColor> colors, int priority, int duration)
{
std::cout << "Set color to " << color.red() << " " << color.green() << " " << color.blue() << std::endl;
std::cout << "Set color to " << colors[0].red() << " " << colors[0].green() << " " << colors[0].blue() << (colors.size() > 1 ? " + ..." : "") << std::endl;
// create command
Json::Value command;
command["command"] = "color";
command["priority"] = priority;
Json::Value & rgbValue = command["color"];
rgbValue[0] = color.red();
rgbValue[1] = color.green();
rgbValue[2] = color.blue();
for (const QColor & color : colors)
{
rgbValue.append(color.red());
rgbValue.append(color.green());
rgbValue.append(color.blue());
}
if (duration > 0)
{
command["duration"] = duration;