Use enhanced autocombobox for timer mode
This commit is contained in:
@@ -56,10 +56,8 @@ TimerPanel::TimerPanel(QWidget * parent, ModelData & model, TimerData & timer, G
|
|||||||
ui->value->setField(timer.val, this);
|
ui->value->setField(timer.val, this);
|
||||||
ui->value->setMaximumTime(firmware->getMaxTimerStart());
|
ui->value->setMaximumTime(firmware->getMaxTimerStart());
|
||||||
|
|
||||||
// Mode
|
|
||||||
ui->mode->setModel(panelFilteredModels->getItemModel(FIM_TIMERSWITCH));
|
ui->mode->setModel(panelFilteredModels->getItemModel(FIM_TIMERSWITCH));
|
||||||
ui->mode->setCurrentIndex(ui->mode->findData(timer.mode.toValue()));
|
ui->mode->setField(timer.mode, this);
|
||||||
connect(ui->mode, SIGNAL(activated(int)), this, SLOT(onModeChanged(int)));
|
|
||||||
|
|
||||||
ui->countdownBeep->setModel(panelItemModels->getItemModel(AIM_TIMER_COUNTDOWNBEEP));
|
ui->countdownBeep->setModel(panelItemModels->getItemModel(AIM_TIMER_COUNTDOWNBEEP));
|
||||||
ui->countdownBeep->setField(timer.countdownBeep, this);
|
ui->countdownBeep->setField(timer.countdownBeep, this);
|
||||||
@@ -102,7 +100,7 @@ void TimerPanel::update()
|
|||||||
lock = true;
|
lock = true;
|
||||||
|
|
||||||
ui->name->updateValue();
|
ui->name->updateValue();
|
||||||
ui->mode->setCurrentIndex(ui->mode->findData(timer.mode.toValue()));
|
ui->mode->updateValue();
|
||||||
ui->value->updateValue();
|
ui->value->updateValue();
|
||||||
|
|
||||||
ui->countdownBeep->updateValue();
|
ui->countdownBeep->updateValue();
|
||||||
@@ -128,18 +126,6 @@ QWidget * TimerPanel::getLastFocus()
|
|||||||
return ui->persistent;
|
return ui->persistent;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimerPanel::onModeChanged(int index)
|
|
||||||
{
|
|
||||||
if (!lock) {
|
|
||||||
bool ok;
|
|
||||||
const RawSwitch rs(ui->mode->itemData(index).toInt(&ok));
|
|
||||||
if (ok && timer.mode.toValue() != rs.toValue()) {
|
|
||||||
timer.mode = rs;
|
|
||||||
emit modified();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void TimerPanel::connectItemModelEvents(const FilteredItemModel * itemModel)
|
void TimerPanel::connectItemModelEvents(const FilteredItemModel * itemModel)
|
||||||
{
|
{
|
||||||
connect(itemModel, &FilteredItemModel::aboutToBeUpdated, this, &TimerPanel::onItemModelAboutToBeUpdated);
|
connect(itemModel, &FilteredItemModel::aboutToBeUpdated, this, &TimerPanel::onItemModelAboutToBeUpdated);
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ class TimerPanel : public ModelPanel
|
|||||||
QWidget * getLastFocus();
|
QWidget * getLastFocus();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onModeChanged(int index);
|
|
||||||
void onNameChanged();
|
void onNameChanged();
|
||||||
void onItemModelAboutToBeUpdated();
|
void onItemModelAboutToBeUpdated();
|
||||||
void onItemModelUpdateComplete();
|
void onItemModelUpdateComplete();
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="mode"/>
|
<widget class="AutoComboBox" name="mode"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="countdownBeepLabel">
|
<widget class="QLabel" name="countdownBeepLabel">
|
||||||
|
|||||||
Reference in New Issue
Block a user