From 918559e60f381f39ed973f022fdb4ec1f36ae191 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Tue, 16 Apr 2019 18:01:10 +0200 Subject: [PATCH] Ref T609, active COM1/2 in sim LEDs and function --- src/blackgui/editors/cockpitcomform.cpp | 40 +- src/blackgui/editors/cockpitcomform.h | 3 + src/blackgui/editors/cockpitcomform.ui | 606 ++++++++++++------------ 3 files changed, 341 insertions(+), 308 deletions(-) diff --git a/src/blackgui/editors/cockpitcomform.cpp b/src/blackgui/editors/cockpitcomform.cpp index a53314ed1..db9a4bfb0 100644 --- a/src/blackgui/editors/cockpitcomform.cpp +++ b/src/blackgui/editors/cockpitcomform.cpp @@ -43,20 +43,18 @@ namespace BlackGui connect(ui->cbp_ComPanelTransponderMode, &CTransponderModeSelector::transponderStateIdentEnded, this, &CCockpitComForm::transponderStateIdentEnded); // COM GUI events - connect(ui->tb_ComPanelCom1Toggle, &QPushButton::clicked, this, &CCockpitComForm::onGuiChangedCockpitValues); - connect(ui->tb_ComPanelCom2Toggle, &QPushButton::clicked, this, &CCockpitComForm::onGuiChangedCockpitValues); - connect(ui->ds_ComPanelCom1Active, &QDoubleSpinBox::editingFinished, this, &CCockpitComForm::onGuiChangedCockpitValues); - connect(ui->ds_ComPanelCom2Active, &QDoubleSpinBox::editingFinished, this, &CCockpitComForm::onGuiChangedCockpitValues); - connect(ui->ds_ComPanelCom1Standby, &QDoubleSpinBox::editingFinished, this, &CCockpitComForm::onGuiChangedCockpitValues); - connect(ui->ds_ComPanelCom2Standby, &QDoubleSpinBox::editingFinished, this, &CCockpitComForm::onGuiChangedCockpitValues); + connect(ui->tb_ComPanelCom1Toggle, &QPushButton::clicked, this, &CCockpitComForm::onGuiChangedCockpitValues); + connect(ui->tb_ComPanelCom2Toggle, &QPushButton::clicked, this, &CCockpitComForm::onGuiChangedCockpitValues); + connect(ui->ds_ComPanelCom1Active, &QDoubleSpinBox::editingFinished, this, &CCockpitComForm::onGuiChangedCockpitValues); + connect(ui->ds_ComPanelCom2Active, &QDoubleSpinBox::editingFinished, this, &CCockpitComForm::onGuiChangedCockpitValues); + connect(ui->ds_ComPanelCom1Standby, &QDoubleSpinBox::editingFinished, this, &CCockpitComForm::onGuiChangedCockpitValues); + connect(ui->ds_ComPanelCom2Standby, &QDoubleSpinBox::editingFinished, this, &CCockpitComForm::onGuiChangedCockpitValues); connect(ui->sbp_ComPanelTransponder, &QDoubleSpinBox::editingFinished, this, &CCockpitComForm::onGuiChangedCockpitValues); connect(ui->cbp_ComPanelTransponderMode, &CTransponderModeSelector::transponderModeChanged, this, &CCockpitComForm::onGuiChangedCockpitValues); - connect(ui->frp_ComPanelSelcalSelector, &CSelcalCodeSelector::valueChanged, this, &CCockpitComForm::onGuiChangedCockpitValues); - connect(ui->tb_RequestTextMessageCom1, &QToolButton::released, this, &CCockpitComForm::requestCom1TextMessage); - connect(ui->tb_RequestTextMessageCom2, &QToolButton::released, this, &CCockpitComForm::requestCom2TextMessage); + connect(ui->frp_ComPanelSelcalSelector, &CSelcalCodeSelector::valueChanged, this, &CCockpitComForm::onGuiChangedCockpitValues); + connect(ui->tb_RequestTextMessageCom1, &QToolButton::released, this, &CCockpitComForm::requestCom1TextMessage); + connect(ui->tb_RequestTextMessageCom2, &QToolButton::released, this, &CCockpitComForm::requestCom2TextMessage); - ui->led_ComPanelCom1->setShape(CLedWidget::Rounded); - ui->led_ComPanelCom2->setShape(CLedWidget::Rounded); ui->tb_RequestTextMessageCom1->setIcon(CIcons::appTextMessages16()); ui->tb_RequestTextMessageCom2->setIcon(CIcons::appTextMessages16()); @@ -224,6 +222,8 @@ namespace BlackGui { ui->ds_ComPanelCom2Standby->setValue(freq); } + + this->updateActiveCOMUnitLEDs(m_integratedWithSim, com1.isSendEnabled(), com1.isReceiveEnabled(), com2.isSendEnabled(), com2.isReceiveEnabled()); } void CCockpitComForm::setTransponder(const CTransponder &transponder) @@ -288,6 +288,24 @@ namespace BlackGui } } + void CCockpitComForm::updateActiveCOMUnitLEDs(bool integratedWithSim, bool com1S, bool com1R, bool com2S, bool com2R) + { + if (!integratedWithSim) + { + ui->led_ComPanelCom1R->setTriState(); + ui->led_ComPanelCom1S->setTriState(); + ui->led_ComPanelCom2R->setTriState(); + ui->led_ComPanelCom2S->setTriState(); + } + else + { + ui->led_ComPanelCom1R->setOn(com1R); + ui->led_ComPanelCom1S->setOn(com1S); + ui->led_ComPanelCom2R->setOn(com2R); + ui->led_ComPanelCom2S->setOn(com2S); + } + } + bool CCockpitComForm::isFrequenceEqual(double f1, double f2) { return CMathUtils::epsilonEqual(f1, f2); diff --git a/src/blackgui/editors/cockpitcomform.h b/src/blackgui/editors/cockpitcomform.h index f8fc64225..df1c6b931 100644 --- a/src/blackgui/editors/cockpitcomform.h +++ b/src/blackgui/editors/cockpitcomform.h @@ -106,6 +106,9 @@ namespace BlackGui //! Align the heights void alignUiElementsHeight(); + //! Update UI for COM unit + void updateActiveCOMUnitLEDs(bool integratedWithSim, bool com1S, bool com1R, bool com2S, bool com2R); + //! Compare 2 frequencies (consider epsilon) static bool isFrequenceEqual(double f1, double f2); diff --git a/src/blackgui/editors/cockpitcomform.ui b/src/blackgui/editors/cockpitcomform.ui index 0222bb0e4..24914eed9 100644 --- a/src/blackgui/editors/cockpitcomform.ui +++ b/src/blackgui/editors/cockpitcomform.ui @@ -13,7 +13,7 @@ Cockpit COM - + 3 @@ -26,243 +26,6 @@ 3 - - - - - 0 - 0 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 18 - - - - 7777 - - - 7000 - - - - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - COM1: - - - qw_ComPanelCom1Active - - - - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - standby: - - - - - - - Overlay text message - - - Overlay text message - - - T - - - - - - - Toggle COM 1 standby/active - - - - - - - :/diagona/icons/diagona/icons/arrow-circle-double-135.png:/diagona/icons/diagona/icons/arrow-circle-double-135.png - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - SELCAL: - - - - - - - - 0 - 0 - - - - test SELCAL - - - test SELCAL - - - - :/diagona/icons/diagona/icons/speaker-volume.png:/diagona/icons/diagona/icons/speaker-volume.png - - - - - - - - - - 3 - - - 118.000000000000000 - - - 136.974999999999994 - - - 0.025000000000000 - - - 119.000000000000000 - - - - - - - 3 - - - 118.000000000000000 - - - 136.974999999999994 - - - 0.025000000000000 - - - 119.000000000000000 - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - @@ -282,65 +45,6 @@ - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - COM2: - - - qw_ComPanelCom2Active - - - - - - - - - - - - - 3 - - - 118.000000000000000 - - - 136.974999999999994 - - - 0.025000000000000 - - - 119.000000000000000 - - - @@ -375,6 +79,198 @@ + + + + 3 + + + 118.000000000000000 + + + 136.974999999999994 + + + 0.025000000000000 + + + 119.000000000000000 + + + + + + + + 3 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + COM2: + + + qw_ComPanelCom2Active + + + + + + + + + + + + + + + + + + + 3 + + + 118.000000000000000 + + + 136.974999999999994 + + + 0.025000000000000 + + + 119.000000000000000 + + + + + + + 3 + + + 118.000000000000000 + + + 136.974999999999994 + + + 0.025000000000000 + + + 119.000000000000000 + + + + + + + + 0 + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 18 + + + + 7777 + + + 7000 + + + + + + + + + + + + + + 3 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + COM1: + + + qw_ComPanelCom1Active + + + + + + + + + + + + + + + @@ -436,6 +332,122 @@ + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + standby: + + + + + + + Overlay text message + + + Overlay text message + + + T + + + + + + + Toggle COM 1 standby/active + + + + + + + :/diagona/icons/diagona/icons/arrow-circle-double-135.png:/diagona/icons/diagona/icons/arrow-circle-double-135.png + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + SELCAL: + + + + + + + + 0 + 0 + + + + test SELCAL + + + test SELCAL + + + + :/diagona/icons/diagona/icons/speaker-volume.png:/diagona/icons/diagona/icons/speaker-volume.png + + + + + +