mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 20:40:29 +08:00
Ref T111, some cleanup of cockpit component
(preparation for next steps)
This commit is contained in:
committed by
Mathew Sutcliffe
parent
f3d75fde53
commit
9040665173
@@ -60,7 +60,7 @@ namespace BlackGui
|
|||||||
connect(ui->cbp_ComPanelTransponderMode, &CTransponderModeSelector::transponderStateIdentEnded, this, &CCockpitComComponent::transponderStateIdentEnded);
|
connect(ui->cbp_ComPanelTransponderMode, &CTransponderModeSelector::transponderStateIdentEnded, this, &CCockpitComComponent::transponderStateIdentEnded);
|
||||||
|
|
||||||
// init from aircraft
|
// init from aircraft
|
||||||
CSimulatedAircraft ownAircraft = this->getOwnAircraft();
|
const CSimulatedAircraft ownAircraft = this->getOwnAircraft();
|
||||||
this->ps_updateCockpitFromContext(ownAircraft, CIdentifier("dummyInitialValues")); // intentionally different name here
|
this->ps_updateCockpitFromContext(ownAircraft, CIdentifier("dummyInitialValues")); // intentionally different name here
|
||||||
|
|
||||||
// SELCAL pairs in cockpit
|
// SELCAL pairs in cockpit
|
||||||
@@ -102,18 +102,18 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CCockpitComComponent::ps_guiChangedCockpitValues()
|
void CCockpitComComponent::ps_guiChangedCockpitValues()
|
||||||
{
|
{
|
||||||
QObject *sender = QObject::sender();
|
const QObject *sender = QObject::sender();
|
||||||
if (sender == ui->tb_ComPanelCom1Toggle)
|
if (sender == ui->tb_ComPanelCom1Toggle)
|
||||||
{
|
{
|
||||||
if (ui->ds_ComPanelCom1Standby->value() == ui->ds_ComPanelCom1Active->value()) return;
|
if (ui->ds_ComPanelCom1Standby->value() == ui->ds_ComPanelCom1Active->value()) { return; }
|
||||||
double f = ui->ds_ComPanelCom1Active->value();
|
const double f = ui->ds_ComPanelCom1Active->value();
|
||||||
ui->ds_ComPanelCom1Active->setValue(ui->ds_ComPanelCom1Standby->value());
|
ui->ds_ComPanelCom1Active->setValue(ui->ds_ComPanelCom1Standby->value());
|
||||||
ui->ds_ComPanelCom1Standby->setValue(f);
|
ui->ds_ComPanelCom1Standby->setValue(f);
|
||||||
}
|
}
|
||||||
else if (sender == ui->tb_ComPanelCom2Toggle)
|
else if (sender == ui->tb_ComPanelCom2Toggle)
|
||||||
{
|
{
|
||||||
if (ui->ds_ComPanelCom2Standby->value() == ui->ds_ComPanelCom2Active->value()) return;
|
if (ui->ds_ComPanelCom2Standby->value() == ui->ds_ComPanelCom2Active->value()) { return; }
|
||||||
double f = ui->ds_ComPanelCom2Active->value();
|
const double f = ui->ds_ComPanelCom2Active->value();
|
||||||
ui->ds_ComPanelCom2Active->setValue(ui->ds_ComPanelCom2Standby->value());
|
ui->ds_ComPanelCom2Active->setValue(ui->ds_ComPanelCom2Standby->value());
|
||||||
ui->ds_ComPanelCom2Standby->setValue(f);
|
ui->ds_ComPanelCom2Standby->setValue(f);
|
||||||
}
|
}
|
||||||
@@ -141,7 +141,7 @@ namespace BlackGui
|
|||||||
this->updateFrequencyDisplaysFromComSystems(com1, com2);
|
this->updateFrequencyDisplaysFromComSystems(com1, com2);
|
||||||
|
|
||||||
// update transponder
|
// update transponder
|
||||||
int tc = transponder.getTransponderCode();
|
const int tc = transponder.getTransponderCode();
|
||||||
if (tc != ui->sbp_ComPanelTransponder->value())
|
if (tc != ui->sbp_ComPanelTransponder->value())
|
||||||
{
|
{
|
||||||
ui->sbp_ComPanelTransponder->setValue(tc);
|
ui->sbp_ComPanelTransponder->setValue(tc);
|
||||||
@@ -151,9 +151,9 @@ namespace BlackGui
|
|||||||
|
|
||||||
if (sGui->getIContextNetwork())
|
if (sGui->getIContextNetwork())
|
||||||
{
|
{
|
||||||
CAtcStationList selectedStations = sGui->getIContextNetwork()->getSelectedAtcStations();
|
const CAtcStationList selectedStations = sGui->getIContextNetwork()->getSelectedAtcStations();
|
||||||
CAtcStation com1Station = selectedStations.size() > 0 ? selectedStations[0] : CAtcStation();
|
const CAtcStation com1Station = selectedStations.size() > 0 ? selectedStations[0] : CAtcStation();
|
||||||
CAtcStation com2Station = selectedStations.size() > 1 ? selectedStations[1] : CAtcStation();
|
const CAtcStation com2Station = selectedStations.size() > 1 ? selectedStations[1] : CAtcStation();
|
||||||
if (com1Station.getCallsign().isEmpty())
|
if (com1Station.getCallsign().isEmpty())
|
||||||
{
|
{
|
||||||
ui->lbl_ComPanelCom1Active->setToolTip("");
|
ui->lbl_ComPanelCom1Active->setToolTip("");
|
||||||
@@ -180,7 +180,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CCockpitComComponent::ps_testSelcal()
|
void CCockpitComComponent::ps_testSelcal()
|
||||||
{
|
{
|
||||||
CSelcal selcal = this->getSelcal();
|
const CSelcal selcal = this->getSelcal();
|
||||||
if (!selcal.isValid())
|
if (!selcal.isValid())
|
||||||
{
|
{
|
||||||
CLogMessage().validationWarning("Invalid SELCAL code");
|
CLogMessage().validationWarning("Invalid SELCAL code");
|
||||||
@@ -208,7 +208,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CCockpitComComponent::initLeds()
|
void CCockpitComComponent::initLeds()
|
||||||
{
|
{
|
||||||
CLedWidget::LedShape shape = CLedWidget::Rounded;
|
const CLedWidget::LedShape shape = CLedWidget::Rounded;
|
||||||
ui->led_ComPanelCom1->setValues(CLedWidget::Yellow, CLedWidget::Black, shape, "COM1 connected", "COM1 disconnected", 14);
|
ui->led_ComPanelCom1->setValues(CLedWidget::Yellow, CLedWidget::Black, shape, "COM1 connected", "COM1 disconnected", 14);
|
||||||
ui->led_ComPanelCom2->setValues(CLedWidget::Yellow, CLedWidget::Black, shape, "COM2 connected", "COM2 disconnected", 14);
|
ui->led_ComPanelCom2->setValues(CLedWidget::Yellow, CLedWidget::Black, shape, "COM2 connected", "COM2 disconnected", 14);
|
||||||
}
|
}
|
||||||
@@ -223,7 +223,7 @@ namespace BlackGui
|
|||||||
//
|
//
|
||||||
// Transponder
|
// Transponder
|
||||||
//
|
//
|
||||||
QString transponderCode = QString::number(ui->sbp_ComPanelTransponder->value());
|
const QString transponderCode = QString::number(ui->sbp_ComPanelTransponder->value());
|
||||||
if (CTransponder::isValidTransponderCode(transponderCode))
|
if (CTransponder::isValidTransponderCode(transponderCode))
|
||||||
{
|
{
|
||||||
transponder.setTransponderCode(transponderCode);
|
transponder.setTransponderCode(transponderCode);
|
||||||
@@ -296,8 +296,8 @@ namespace BlackGui
|
|||||||
void CCockpitComComponent::ps_onChangedVoiceRoomStatus(const CVoiceRoomList &selectedVoiceRooms, bool connected)
|
void CCockpitComComponent::ps_onChangedVoiceRoomStatus(const CVoiceRoomList &selectedVoiceRooms, bool connected)
|
||||||
{
|
{
|
||||||
Q_ASSERT(selectedVoiceRooms.size() == 2);
|
Q_ASSERT(selectedVoiceRooms.size() == 2);
|
||||||
CVoiceRoom room1 = selectedVoiceRooms[0];
|
const CVoiceRoom room1 = selectedVoiceRooms[0];
|
||||||
CVoiceRoom room2 = selectedVoiceRooms[1];
|
const CVoiceRoom room2 = selectedVoiceRooms[1];
|
||||||
ui->led_ComPanelCom1->setOn(room1.isConnected());
|
ui->led_ComPanelCom1->setOn(room1.isConnected());
|
||||||
ui->led_ComPanelCom2->setOn(room2.isConnected());
|
ui->led_ComPanelCom2->setOn(room2.isConnected());
|
||||||
Q_UNUSED(connected);
|
Q_UNUSED(connected);
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace BlackGui
|
|||||||
explicit CCockpitComComponent(QWidget *parent = nullptr);
|
explicit CCockpitComComponent(QWidget *parent = nullptr);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
~CCockpitComComponent();
|
virtual ~CCockpitComComponent();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
//! \copydoc BlackGui::Components::CTransponderModeSelector::transponderModeChanged
|
//! \copydoc BlackGui::Components::CTransponderModeSelector::transponderModeChanged
|
||||||
@@ -103,7 +103,7 @@ namespace BlackGui
|
|||||||
void updateFrequencyDisplaysFromComSystems(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2);
|
void updateFrequencyDisplaysFromComSystems(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2);
|
||||||
|
|
||||||
QScopedPointer<Ui::CCockpitComComponent> ui;
|
QScopedPointer<Ui::CCockpitComComponent> ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
Reference in New Issue
Block a user