Skip to content

Commit

Permalink
#662 add when key is pressed section to dynamic config
Browse files Browse the repository at this point in the history
  • Loading branch information
oben01 committed Oct 23, 2020
1 parent 39baea0 commit 3d53465
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 2 deletions.
29 changes: 27 additions & 2 deletions sources/plugins/StreamDeck/StreamDeck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ void CStreamDeck::doWork(boost::shared_ptr<yApi::IYPluginApi> api)
auto keySection = shared::CDataContainer::make();
auto keyOptionSection = shared::CDataContainer::make();

auto SecondKeySection = shared::CDataContainer::make();
auto whenKeyIsPressedOptionSection = shared::CDataContainer::make();

for (auto i = 0; i < keys.size(); ++i)
{
shared::CDataContainer keyOptions;
Expand All @@ -231,19 +234,41 @@ void CStreamDeck::doWork(boost::shared_ptr<yApi::IYPluginApi> api)
customTextOptions.set("i18nKey", "customTextArray");
customTextOptions.set("required", "false");

shared::CDataContainer whenKeyIsPressedOption;
whenKeyIsPressedOption.set("type", "section");
whenKeyIsPressedOption.set("enableWithCheckBox", "true");
whenKeyIsPressedOption.set("enableWithCheckBoxDefaultValue", "false");

shared::CDataContainer iconsWhenKeyIsPressedOptions;
iconsWhenKeyIsPressedOptions.set("type", "enum");
iconsWhenKeyIsPressedOptions.set("i18nKey", "iconsWhenKeyIsPressedArray");
iconsWhenKeyIsPressedOptions.set("values", defaultIconsNames);
iconsWhenKeyIsPressedOptions.set("defaultValue", defaultIconsNames[0]);

shared::CDataContainer customTextWhenKeyIsPressedOptions;
customTextWhenKeyIsPressedOptions.set("type", "string");
customTextWhenKeyIsPressedOptions.set("i18nKey", "customTextWhenKeyIsPressedArray");
customTextWhenKeyIsPressedOptions.set("required", "false");

keyOptionSection->set("icon", iconsOptions);
keyOptionSection->set("customText", customTextOptions);

keyOptions.set("content", keyOptionSection);
whenKeyIsPressedOptionSection->set("iconWhenKeyIsPressed", iconsWhenKeyIsPressedOptions);
whenKeyIsPressedOptionSection->set("customTextWhenKeyIsPressed", customTextWhenKeyIsPressedOptions);

whenKeyIsPressedOption.set("content", whenKeyIsPressedOptionSection);
whenKeyIsPressedOption.set("i18nKey", "whenKeyIsPressedElement");

keyOptionSection->set("content", whenKeyIsPressedOption);

keyOptions.set("content", keyOptionSection);
keyOptions.set("i18nKey", "keyElement");
keySection->set("keyElement#" + std::to_string(i), keyOptions);

mainSection.set("content", keySection);
}

body->set("mainSection", mainSection);
auto test = body->serialize();
YADOMS_LOG(information) << "Body : " << body->serialize();

auto deviceConfigurationSchemaRequest = api
Expand Down
13 changes: 13 additions & 0 deletions sources/plugins/StreamDeck/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@
"customTextArray": {
"name": "Custom text",
"description": "Custom text to display below the icon (OPTIONAL)"
},
"whenKeyIsPressedElement": {
"name": "Enable changing icon image when the key is pressed",
"content": {
"iconsWhenKeyIsPressedArray": {
"name": "Icons",
"description": "List of available icons (see [the Wiki](https://github.com/Yadoms/yadoms/wiki/StreamDeck#available-icons))"
},
"customTextWhenKeyIsPressedArray": {
"name": "Custom text",
"description": "Custom text to display below the icon (OPTIONAL)"
}
}
}
}
}
Expand Down
13 changes: 13 additions & 0 deletions sources/plugins/StreamDeck/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@
"customTextArray": {
"name": "Texte personnalisé",
"description": "Texte personnalisé à afficher en dessous de l'icône (OPTIONNEL)"
},
"whenKeyIsPressedElement": {
"name": "Activer le changement de l'icône lorsque la touche est enfoncée",
"content": {
"iconsWhenKeyIsPressedArray": {
"name": "Icône",
"description": "La liste des icones disponible (voir [le Wiki](https://github.com/Yadoms/yadoms/wiki/StreamDeck#available-icons))"
},
"customTextWhenKeyIsPressedArray": {
"name": "Texte personnalisé",
"description": "Texte personnalisé à afficher en dessous de l'icône (OPTIONNEL)"
}
}
}
}
}
Expand Down

0 comments on commit 3d53465

Please sign in to comment.