Files
edgetx-gx12/companion/src/modeledit/heli.cpp
T
bsongis 50a73a3af5 Each ModelEdit window now has its own FirmwareInterface (it means that
we could open 2 ModelEdit windows on different firmwares)
2014-04-18 16:55:53 +02:00

50 lines
1.8 KiB
C++

#include "heli.h"
#include "ui_heli.h"
#include "helpers.h"
HeliPanel::HeliPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
ModelPanel(parent, model, generalSettings, firmware),
ui(new Ui::Heli)
{
ui->setupUi(this);
connect(ui->swashTypeCB, SIGNAL(currentIndexChanged(int)), this, SLOT(edited()));
connect(ui->swashCollectiveCB, SIGNAL(currentIndexChanged(int)), this, SLOT(edited()));
connect(ui->swashRingValSB, SIGNAL(editingFinished()), this, SLOT(edited()));
connect(ui->swashInvertELE, SIGNAL(stateChanged(int)), this, SLOT(edited()));
connect(ui->swashInvertAIL, SIGNAL(stateChanged(int)), this, SLOT(edited()));
connect(ui->swashInvertCOL, SIGNAL(stateChanged(int)), this, SLOT(edited()));
}
HeliPanel::~HeliPanel()
{
delete ui;
}
void HeliPanel::update()
{
lock = true;
ui->swashTypeCB->setCurrentIndex(model.swashRingData.type);
populateSourceCB(ui->swashCollectiveCB, model.swashRingData.collectiveSource, model, POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS);
ui->swashRingValSB->setValue(model.swashRingData.value);
ui->swashInvertELE->setChecked(model.swashRingData.invertELE);
ui->swashInvertAIL->setChecked(model.swashRingData.invertAIL);
ui->swashInvertCOL->setChecked(model.swashRingData.invertCOL);
lock = false;
}
void HeliPanel::edited()
{
if (!lock) {
model.swashRingData.type = ui->swashTypeCB->currentIndex();
model.swashRingData.collectiveSource = ui->swashCollectiveCB->itemData(ui->swashCollectiveCB->currentIndex()).toInt();
model.swashRingData.value = ui->swashRingValSB->value();
model.swashRingData.invertELE = ui->swashInvertELE->isChecked();
model.swashRingData.invertAIL = ui->swashInvertAIL->isChecked();
model.swashRingData.invertCOL = ui->swashInvertCOL->isChecked();
emit modified();
}
}