Files
pilotclient/src/blackgui/editors/cockpitcomform.h
Klaus Basan bcbdaaf1a7 COM audio did not tune in (voice room) if channel was already selected at startup
Reason was: hardcoded channel spacing to 8.33kHz

As a result changed to channel spacing based on COM unit, which could also be changed at runtime

* the issue itself was in own aircraft context
* added functions for channel spacing
* changed to COM unit channel spacing (instead of hardcoded spacing)
2019-05-13 11:20:49 +02:00

125 lines
4.2 KiB
C++

/* Copyright (C) 2017
* swift project Community / Contributors
*
* This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution. No part of swift project, including this file, may be copied, modified, propagated,
* or distributed except according to the terms contained in the LICENSE file.
*/
//! \file
#ifndef BLACKGUI_EDITORS_COCKPITCOMFORM_H
#define BLACKGUI_EDITORS_COCKPITCOMFORM_H
#include "form.h"
#include "blackgui/blackguiexport.h"
#include "blackmisc/simulation/simulatedaircraft.h"
#include "blackmisc/aviation/atcstationlist.h"
#include "blackmisc/audio/voiceroomlist.h"
#include <QFrame>
#include <QScopedPointer>
namespace Ui { class CCockpitComForm; }
namespace BlackGui
{
namespace Editors
{
/*!
* COM elements
*/
class BLACKGUI_EXPORT CCockpitComForm : public CForm
{
Q_OBJECT
public:
//! Constructor
explicit CCockpitComForm(QWidget *parent = nullptr);
//! Destrutor
virtual ~CCockpitComForm() override;
//! COM frequencies displayed
void setFrequencies(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2);
//! Set the XPDR values
void setTransponder(const BlackMisc::Aviation::CTransponder &transponder);
//! Change the voice room status
void setVoiceRoomStatus(const BlackMisc::Audio::CVoiceRoomList &selectedVoiceRooms);
//! Set selected stations
void setSelectedAtcStations(const BlackMisc::Aviation::CAtcStationList &selectedStations);
//! 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;
//! Set SELCAL
void setSelcal(const BlackMisc::Aviation::CSelcal &selcal);
//! \name Form class implementations
//! @{
virtual void setReadOnly(bool readonly) override;
virtual void setSelectOnly() override;
virtual BlackMisc::CStatusMessageList validate(bool nested = false) const override;
//! @}
signals:
//! \copydoc BlackGui::Components::CTransponderModeSelector::transponderModeChanged
void transponderModeChanged(BlackMisc::Aviation::CTransponder::TransponderMode newMode);
//! \copydoc BlackGui::Components::CTransponderModeSelector::transponderStateIdentEnded
void transponderStateIdentEnded();
//! 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);
//! Request COM text messages @{
void requestCom1TextMessage();
void requestCom2TextMessage();
//! @}
private:
bool m_integratedWithSim = false; //!< Synced with simulator
//! Init LEDs
void initLeds();
//! Cockpit values to aircraft
BlackMisc::Simulation::CSimulatedAircraft cockpitValuesToAircraftObject();
//! GUI values have been changed, will trigger CCockpitComForm::guiChangedCockpitValues
void onGuiChangedCockpitValues();
//! SELCAL value changed (in selector)
void onSelcalChanged();
//! Align the heights
void alignUiElementsHeight();
//! Update UI for COM unit
void updateActiveCOMUnitLEDs(bool integratedWithSim, bool com1S, bool com1R, bool com2S, bool com2R);
//! Update from simulator context
void updateIntegratedFlagFromSimulatorContext();
//! Compare 2 frequencies (consider epsilon)
static bool isFrequenceEqual(double f1, double f2);
QScopedPointer<Ui::CCockpitComForm> ui;
};
} // ns
} // ns
#endif // guard