mirror of
https://github.com/opentx/opentx.git
synced 2025-07-24 00:35:18 +03:00
Companion countdown start
This commit is contained in:
parent
8b68192a7b
commit
f10eaa48ee
5 changed files with 35 additions and 3 deletions
|
@ -70,6 +70,8 @@ class TimerData {
|
|||
unsigned int countdownBeep;
|
||||
unsigned int val;
|
||||
unsigned int persistent;
|
||||
int countdownStart;
|
||||
unsigned int direction;
|
||||
int pvalue;
|
||||
void clear() { memset(reinterpret_cast<void *>(this), 0, sizeof(TimerData)); mode = RawSwitch(SWITCH_TYPE_TIMER_MODE, 0); }
|
||||
void convert(RadioDataConversionState & cstate);
|
||||
|
|
|
@ -2311,7 +2311,8 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, Board::Type board, unsig
|
|||
internalField.Append(new UnsignedField<2>(this, modelData.timers[i].countdownBeep));
|
||||
internalField.Append(new BoolField<1>(this, modelData.timers[i].minuteBeep));
|
||||
internalField.Append(new UnsignedField<2>(this, modelData.timers[i].persistent));
|
||||
internalField.Append(new SpareBitsField<3>(this));
|
||||
internalField.Append(new SignedField<2>(this, modelData.timers[i].countdownStart));
|
||||
internalField.Append(new UnsignedField<1>(this, modelData.timers[i].direction));
|
||||
if (HAS_LARGE_LCD(board))
|
||||
internalField.Append(new ZCharField<8>(this, modelData.timers[i].name, "Timer name"));
|
||||
else
|
||||
|
|
|
@ -73,13 +73,20 @@ TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, Ge
|
|||
ui->persistent->addItem(tr("Not persistent"), 0);
|
||||
ui->persistent->addItem(tr("Persistent (flight)"), 1);
|
||||
ui->persistent->addItem(tr("Persistent (manual reset)"), 2);
|
||||
|
||||
ui->countdownStart->setField(timer.countdownStart, this);
|
||||
ui->countdownStart->addItem("5s", 1);
|
||||
ui->countdownStart->addItem("10s", 0);
|
||||
ui->countdownStart->addItem("20s", -1);
|
||||
ui->countdownStart->addItem("30s", 2);
|
||||
|
||||
disableMouseScrolling();
|
||||
QWidget::setTabOrder(prevFocus, ui->name);
|
||||
QWidget::setTabOrder(ui->name, ui->value);
|
||||
QWidget::setTabOrder(ui->value, ui->mode);
|
||||
QWidget::setTabOrder(ui->mode, ui->countdownBeep);
|
||||
QWidget::setTabOrder(ui->countdownBeep, ui->minuteBeep);
|
||||
QWidget::setTabOrder(ui->countdownBeep, ui->countdownStart);
|
||||
QWidget::setTabOrder(ui->countdownStart, ui->minuteBeep);
|
||||
QWidget::setTabOrder(ui->minuteBeep, ui->persistent);
|
||||
|
||||
update();
|
||||
|
@ -121,6 +128,7 @@ void TimerPanel::update()
|
|||
ui->countdownBeep->updateValue();
|
||||
ui->minuteBeep->setChecked(timer.minuteBeep);
|
||||
ui->persistent->updateValue();
|
||||
ui->countdownStart->updateValue();
|
||||
lock = false;
|
||||
}
|
||||
|
||||
|
@ -129,6 +137,14 @@ QWidget * TimerPanel::getLastFocus()
|
|||
return ui->persistent;
|
||||
}
|
||||
|
||||
void TimerPanel::on_countdownBeep_currentIndexChanged(int index)
|
||||
{
|
||||
if(index == TimerData::COUNTDOWN_SILENT)
|
||||
ui->countdownStart->hide();
|
||||
else
|
||||
ui->countdownStart->show();
|
||||
}
|
||||
|
||||
void TimerPanel::on_value_editingFinished()
|
||||
{
|
||||
if (!lock) {
|
||||
|
|
|
@ -51,6 +51,7 @@ class TimerPanel : public ModelPanel
|
|||
void onModeChanged(int index);
|
||||
void on_value_editingFinished();
|
||||
void on_minuteBeep_toggled(bool checked);
|
||||
void on_countdownBeep_currentIndexChanged(int index);
|
||||
void on_name_editingFinished();
|
||||
void onItemModelAboutToBeUpdated();
|
||||
void onItemModelUpdateComplete();
|
||||
|
|
|
@ -20,7 +20,16 @@
|
|||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
|
@ -59,6 +68,9 @@
|
|||
<item>
|
||||
<widget class="AutoComboBox" name="countdownBeep"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="AutoComboBox" name="countdownStart"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="minuteBeep">
|
||||
<property name="text">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue