feat: option to disable power on/off haptic (#5017)
This commit is contained in:
@@ -279,6 +279,7 @@ Node convert<GeneralSettings>::encode(const GeneralSettings& rhs)
|
||||
node["antennaMode"] = antennaModeLut << rhs.antennaMode;
|
||||
node["pwrOnSpeed"] = rhs.pwrOnSpeed;
|
||||
node["pwrOffSpeed"] = rhs.pwrOffSpeed;
|
||||
node["disablePwrOnOffHaptic"] = (int)rhs.disablePwrOnOffHaptic;
|
||||
|
||||
for (int i = 0; i < CPN_MAX_SPECIAL_FUNCTIONS; i++) {
|
||||
const CustomFunctionData& fn = rhs.customFn[i];
|
||||
@@ -557,6 +558,7 @@ bool convert<GeneralSettings>::decode(const Node& node, GeneralSettings& rhs)
|
||||
node["backlightColor"] >> rhs.backlightColor;
|
||||
node["pwrOnSpeed"] >> rhs.pwrOnSpeed;
|
||||
node["pwrOffSpeed"] >> rhs.pwrOffSpeed;
|
||||
node["disablePwrOnOffHaptic"] >> rhs.disablePwrOnOffHaptic;
|
||||
|
||||
if (node["customFn"]) {
|
||||
// decode common for radio GF and model SF and conversion test assumes decoding a model
|
||||
|
||||
@@ -296,6 +296,7 @@ class GeneralSettings {
|
||||
|
||||
int pwrOnSpeed;
|
||||
int pwrOffSpeed;
|
||||
bool disablePwrOnOffHaptic;
|
||||
|
||||
char selectedTheme[SELECTED_THEME_NAME_LEN + 1];
|
||||
|
||||
|
||||
@@ -289,6 +289,8 @@ ui(new Ui::GeneralSetup)
|
||||
ui->pwrOnDelay->hide();
|
||||
}
|
||||
|
||||
ui->pwrOnOffHaptic_CB->setChecked(!generalSettings.disablePwrOnOffHaptic); // Default is zero=checked
|
||||
|
||||
ui->registrationId->setValidator(new NameValidator(board, this));
|
||||
ui->registrationId->setMaxLength(REGISTRATION_ID_LEN);
|
||||
|
||||
@@ -642,6 +644,12 @@ void GeneralSetupPanel::on_pwrOffDelay_valueChanged(int)
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void GeneralSetupPanel::on_pwrOnOffHaptic_CB_stateChanged(int)
|
||||
{
|
||||
generalSettings.disablePwrOnOffHaptic = ui->pwrOnOffHaptic_CB->isChecked() ? 0 : 1;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void GeneralSetupPanel::on_beepVolume_SL_valueChanged()
|
||||
{
|
||||
generalSettings.beepVolume=ui->beepVolume_SL->value();
|
||||
|
||||
@@ -93,6 +93,7 @@ class GeneralSetupPanel : public GeneralPanel
|
||||
|
||||
void on_pwrOnDelay_valueChanged(int);
|
||||
void on_pwrOffDelay_valueChanged(int);
|
||||
void on_pwrOnOffHaptic_CB_stateChanged(int);
|
||||
|
||||
void on_modelQuickSelect_CB_stateChanged(int);
|
||||
void on_startSoundCB_stateChanged(int);
|
||||
|
||||
+1071
-1023
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user