Avoids the crash in Companion
This commit is contained in:
@@ -668,18 +668,18 @@ void Setup::startupSwitchToggled(bool checked)
|
|||||||
void Setup::updatePotWarnings()
|
void Setup::updatePotWarnings()
|
||||||
{
|
{
|
||||||
lock = true;
|
lock = true;
|
||||||
int mode = model.nPotsToWarn >> 6;
|
int mode = model.nPotsToWarn >> 6;
|
||||||
ui->potWarningMode->setCurrentIndex(mode);
|
ui->potWarningMode->setCurrentIndex(mode);
|
||||||
|
|
||||||
if (mode == 0)
|
if (mode == 0)
|
||||||
model.nPotsToWarn = 0x3F;
|
model.nPotsToWarn = 0x3F;
|
||||||
|
|
||||||
for (int i=0; i<GetEepromInterface()->getCapability(Pots); i++) {
|
for (int i=0; i<potWarningCheckboxes.size(); i++) {
|
||||||
bool enabled = !(model.nPotsToWarn & (1 << i));
|
bool enabled = !(model.nPotsToWarn & (1 << i));
|
||||||
|
|
||||||
potWarningCheckboxes[i]->setChecked(enabled);
|
potWarningCheckboxes[i]->setChecked(enabled);
|
||||||
potWarningCheckboxes[i]->setDisabled(mode == 0);
|
potWarningCheckboxes[i]->setDisabled(mode == 0);
|
||||||
}
|
}
|
||||||
lock = false;
|
lock = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -700,12 +700,14 @@ void Setup::potWarningToggled(bool checked)
|
|||||||
|
|
||||||
void Setup::on_potWarningMode_currentIndexChanged(int index)
|
void Setup::on_potWarningMode_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
int mask = 0xC0;
|
if (!lock) {
|
||||||
model.nPotsToWarn = model.nPotsToWarn & ~mask;
|
int mask = 0xC0;
|
||||||
model.nPotsToWarn = model.nPotsToWarn | ((index << 6) & mask);
|
model.nPotsToWarn = model.nPotsToWarn & ~mask;
|
||||||
|
model.nPotsToWarn = model.nPotsToWarn | ((index << 6) & mask);
|
||||||
|
|
||||||
updatePotWarnings();
|
updatePotWarnings();
|
||||||
emit modified();
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Setup::on_displayText_toggled(bool checked)
|
void Setup::on_displayText_toggled(bool checked)
|
||||||
|
|||||||
Reference in New Issue
Block a user