Ref T111, aligned cockpit UI elements

* naming
* allow to set cockpit values by simulated aircraft
This commit is contained in:
Klaus Basan
2017-08-08 02:51:19 +02:00
committed by Mathew Sutcliffe
parent 753bbc1847
commit 1ec3f4566d
3 changed files with 19 additions and 9 deletions

View File

@@ -64,7 +64,7 @@ namespace BlackGui
// COM form
connect(ui->editor_Com, &CCockpitComForm::testSelcal, this, &CCockpitComComponent::testSelcal);
connect(ui->editor_Com, &CCockpitComForm::changedCockpitValues, this, &CCockpitComComponent::updateOwnCockpitInContext);
connect(ui->editor_Com, &CCockpitComForm::selcalChanged, this, &CCockpitComComponent::updateSelcalInContext);
connect(ui->editor_Com, &CCockpitComForm::changedSelcal, this, &CCockpitComComponent::updateSelcalInContext);
// Relay COM form signals
connect(ui->editor_Com, &CCockpitComForm::transponderModeChanged, this, &CCockpitComComponent::transponderModeChanged);
@@ -103,7 +103,7 @@ namespace BlackGui
const CTransponder transponder = ownAircraft.getTransponder();
// update the frequencies
ui->editor_Com->setFrequencyDisplays(com1, com2);
ui->editor_Com->setFrequencies(com1, com2);
// update transponder
ui->editor_Com->setTransponder(transponder);

View File

@@ -117,6 +117,13 @@ namespace BlackGui
ui->cbp_ComPanelTransponderMode->setSelectedTransponderModeStateIdent();
}
void CCockpitComForm::setValue(const CSimulatedAircraft &aircraft)
{
this->setFrequencies(aircraft.getCom1System(), aircraft.getCom2System());
this->setSelcal(aircraft.getSelcal());
this->setTransponder(aircraft.getTransponder());
}
CSelcal CCockpitComForm::getSelcal() const
{
return ui->frp_ComPanelSelcalSelector->getSelcal();
@@ -163,7 +170,7 @@ namespace BlackGui
com1.setFrequencyStandbyMHz(ui->ds_ComPanelCom1Standby->value());
com2.setFrequencyActiveMHz(ui->ds_ComPanelCom2Active->value());
com2.setFrequencyStandbyMHz(ui->ds_ComPanelCom2Standby->value());
this->setFrequencyDisplays(com1, com2); // back annotation after rounding
this->setFrequencies(com1, com2); // back annotation after rounding
comAircraft.setCom1System(com1);
comAircraft.setCom2System(com2);
@@ -171,7 +178,7 @@ namespace BlackGui
return comAircraft;
}
void CCockpitComForm::setFrequencyDisplays(const CComSystem &com1, const CComSystem &com2)
void CCockpitComForm::setFrequencies(const CComSystem &com1, const CComSystem &com2)
{
double freq = com1.getFrequencyActive().valueRounded(CFrequencyUnit::MHz(), 3);
if (freq != ui->ds_ComPanelCom1Active->value())
@@ -237,7 +244,7 @@ namespace BlackGui
void CCockpitComForm::onSelcalChanged()
{
const CSelcal selcal = ui->frp_ComPanelSelcalSelector->getSelcal();
emit this->selcalChanged(selcal);
emit this->changedSelcal(selcal);
}
} // ns
} // ns

View File

@@ -40,7 +40,7 @@ namespace BlackGui
virtual ~CCockpitComForm();
//! COM frequencies displayed
void setFrequencyDisplays(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2);
void setFrequencies(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2);
//! Set the XPDR values
void setTransponder(const BlackMisc::Aviation::CTransponder &transponder);
@@ -54,6 +54,9 @@ namespace BlackGui
//! Set to BlackMisc::Aviation::CTransponder::StateIdent
void setTransponderModeStateIdent();
//! Set all values
void setValue(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
//! Get SELCAL
BlackMisc::Aviation::CSelcal getSelcal() const;
@@ -74,12 +77,12 @@ namespace BlackGui
//! \copydoc BlackGui::Components::CTransponderModeSelector::transponderStateIdentEnded
void transponderStateIdentEnded();
//! SELCAL value changed
void selcalChanged(const BlackMisc::Aviation::CSelcal &selcal);
//! Request to test SELCAL
void testSelcal();
//! SELCAL value changed
void changedSelcal(const BlackMisc::Aviation::CSelcal &selcal);
//! GUI values changed
void changedCockpitValues(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);