Implement "reloadEffects" function in Hyperion for "write and delete" custom created effect configuration files (#293)

* Update EffectEngine.h

* add reloadEffects function

* add readEffects function

* add reloadEffects function

* Call reloadEffects after handleCreateEffectCommand and handleDeleteEffectCommand
This commit is contained in:
Paulchen Panther
2016-11-20 18:41:10 +01:00
committed by redPanther
parent c05181666c
commit 8f67294de6
5 changed files with 126 additions and 102 deletions

View File

@@ -493,13 +493,14 @@ void JsonClientConnection::handleCreateEffectCommand(const QJsonObject& message,
}
QJsonFactory::writeJson(newFileName.absoluteFilePath(), effectJson);
Info(_log, "Reload effect list");
_hyperion->reloadEffects();
sendSuccessReply(command, tan);
} else
{
sendErrorReply("Can't save new effect. Effect path empty", command, tan);
return;
}
sendSuccessReply(command, tan);
} else
sendErrorReply("Missing schema file for Python script " + message["script"].toString(), command, tan);
} else
@@ -534,7 +535,13 @@ void JsonClientConnection::handleDeleteEffectCommand(const QJsonObject& message,
if (effectConfigurationFile.exists())
{
bool result = QFile::remove(effectConfigurationFile.absoluteFilePath());
(result) ? sendSuccessReply(command, tan) : sendErrorReply("Can't delete effect configuration file: " + effectConfigurationFile.absoluteFilePath() + ". Please check permissions", command, tan);
if (result)
{
Info(_log, "Reload effect list");
_hyperion->reloadEffects();
sendSuccessReply(command, tan);
} else
sendErrorReply("Can't delete effect configuration file: " + effectConfigurationFile.absoluteFilePath() + ". Please check permissions", command, tan);
} else
sendErrorReply("Can't find effect configuration file: " + effectConfigurationFile.absoluteFilePath(), command, tan);
} else