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:
Neil Horne
2024-02-28 11:35:57 +10:00
committed by GitHub
parent 3807d7759b
commit 57c7aca2f6
31 changed files with 428 additions and 139 deletions
+5
View File
@@ -28,6 +28,7 @@
#include "autodoublespinbox.h"
#include "autobitmappedcombobox.h"
#include "autobitmappedcheckbox.h"
#include "namevalidator.h"
#include <QLabel>
#include <QGridLayout>
@@ -212,6 +213,7 @@ HardwarePanel::HardwarePanel(QWidget * parent, GeneralSettings & generalSettings
addLabel(tr("Bluetooth"));
AutoComboBox *bluetoothMode = new AutoComboBox(this);
bluetoothMode->setValidator(new NameValidator(board, this));
bluetoothMode->setModel(editorItemModels->getItemModel(btmodelid));
bluetoothMode->setField(generalSettings.bluetoothMode, this);
params->append(bluetoothMode);
@@ -414,6 +416,7 @@ void HardwarePanel::addStick(int index)
addLabel(Boards::getInputName(index, board));
AutoLineEdit *name = new AutoLineEdit(this);
name->setValidator(new NameValidator(board, this));
name->setField(config.name, HARDWARE_NAME_LEN, this);
params->append(name);
addParams();
@@ -426,6 +429,7 @@ void HardwarePanel::addFlex(int index)
addLabel(Boards::getInputName(index, board));
AutoLineEdit *name = new AutoLineEdit(this);
name->setValidator(new NameValidator(board, this));
name->setField(config.name, HARDWARE_NAME_LEN, this);
params->append(name);
@@ -467,6 +471,7 @@ void HardwarePanel::addSwitch(int index)
addLabel(Boards::getSwitchName(index));
AutoLineEdit *name = new AutoLineEdit(this);
name->setValidator(new NameValidator(board, this));
name->setField(config.name, HARDWARE_NAME_LEN, this);
params->append(name);