fix(cpn): radio specific name and label validators (#4670)
Only allows valid characters in names, drops invalid characters if present
This commit is contained in:
@@ -32,6 +32,17 @@
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
void YamlValidateNames(GeneralSettings& gs, Board::Type board)
|
||||
{
|
||||
for (int i = 0; i < CPN_MAX_INPUTS; i++) {
|
||||
YamlValidateName(gs.inputConfig[i].name, board);
|
||||
}
|
||||
|
||||
for (int i = 0; i < CPN_MAX_SWITCHES; i++) {
|
||||
YamlValidateName(gs.switchConfig[i].name, board);
|
||||
}
|
||||
}
|
||||
|
||||
const YamlLookupTable beeperModeLut = {
|
||||
{ GeneralSettings::BEEPER_QUIET, "mode_quiet" },
|
||||
{ GeneralSettings::BEEPER_ALARMS_ONLY, "mode_alarms" },
|
||||
@@ -599,7 +610,8 @@ bool convert<GeneralSettings>::decode(const Node& node, GeneralSettings& rhs)
|
||||
node["labelMultiMode"] >> rhs.labelMultiMode;
|
||||
node["favMultiMode"] >> rhs.favMultiMode;
|
||||
|
||||
// fix ups
|
||||
// perform integrity checks and fix-ups
|
||||
YamlValidateNames(rhs, fw->getBoard());
|
||||
rhs.validateFlexSwitches();
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user