mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 20:15:35 +08:00
Ref T609, change COM transmission values in UI/emulated driver
This commit is contained in:
committed by
Mat Sutcliffe
parent
5470a55e15
commit
a9a0216e53
@@ -224,6 +224,15 @@ namespace BlackSimPlugin
|
||||
return this->updateCockpit(aircraft, this->identifier());
|
||||
}
|
||||
|
||||
bool CSimulatorEmulated::changeInternalCom(const CComSystem &comSystem, CComSystem::ComUnit unit)
|
||||
{
|
||||
if (m_myAircraft.getComSystem(unit) == comSystem) { return false; }
|
||||
m_myAircraft.setComSystem(comSystem, unit);
|
||||
const bool c = this->updateCockpit(m_myAircraft, this->identifier());
|
||||
if (c) { emit this->internalAircraftChanged(); }
|
||||
return c;
|
||||
}
|
||||
|
||||
bool CSimulatorEmulated::changeInternalSelcal(const CSelcal &selcal)
|
||||
{
|
||||
if (m_myAircraft.getSelcal() == selcal) { return false; }
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#define BLACKSIMPLUGIN_EMULATED_SIMULATOREMULATED_H
|
||||
|
||||
#include "../plugincommon/simulatorplugincommon.h"
|
||||
#include "blackmisc/aviation/comsystem.h"
|
||||
#include "blackmisc/simulation/interpolatormulti.h"
|
||||
#include "blackmisc/simulation/interpolationrenderingsetup.h"
|
||||
#include "blackmisc/simulation/interpolationlogger.h"
|
||||
@@ -97,6 +98,10 @@ namespace BlackSimPlugin
|
||||
//! \remark normally used by corresponding BlackSimPlugin::Emulated::CSimulatorEmulatedMonitorDialog
|
||||
bool changeInternalCom(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
|
||||
|
||||
//! Simulator internal change of COM values
|
||||
//! \remark normally used by corresponding BlackSimPlugin::Emulated::CSimulatorEmulatedMonitorDialog
|
||||
bool changeInternalCom(const BlackMisc::Aviation::CComSystem &comSystem, BlackMisc::Aviation::CComSystem::ComUnit unit);
|
||||
|
||||
//! Simulator internal change of SELCAL
|
||||
//! \remark normally used by corresponding BlackSimPlugin::Emulated::CSimulatorEmulatedMonitorDialog
|
||||
bool changeInternalSelcal(const BlackMisc::Aviation::CSelcal &selcal);
|
||||
|
||||
@@ -7,8 +7,9 @@
|
||||
*/
|
||||
|
||||
#include "simulatoremulatedmonitordialog.h"
|
||||
#include "simulatoremulated.h"
|
||||
#include "ui_simulatoremulatedmonitordialog.h"
|
||||
#include "simulatoremulated.h"
|
||||
#include "blackgui/components/cockpitcomtransmissioncomponent.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
|
||||
#include <QIntValidator>
|
||||
@@ -18,6 +19,7 @@ using namespace BlackMisc;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackGui;
|
||||
using namespace BlackGui::Components;
|
||||
using namespace BlackGui::Editors;
|
||||
|
||||
namespace BlackSimPlugin
|
||||
@@ -49,14 +51,15 @@ namespace BlackSimPlugin
|
||||
connect(m_simulator, &CSimulatorEmulated::internalAircraftChanged, this, &CSimulatorEmulatedMonitorDialog::setInternalAircraftUiValues, Qt::QueuedConnection);
|
||||
connect(&m_uiUpdateTimer, &QTimer::timeout, this, &CSimulatorEmulatedMonitorDialog::timerBasedUiUpdates);
|
||||
|
||||
connect(ui->cb_Connected, &QCheckBox::released, this, &CSimulatorEmulatedMonitorDialog::onSimulatorValuesChanged);
|
||||
connect(ui->cb_Paused, &QCheckBox::released, this, &CSimulatorEmulatedMonitorDialog::onSimulatorValuesChanged);
|
||||
connect(ui->cb_Connected, & QCheckBox::released, this, &CSimulatorEmulatedMonitorDialog::onSimulatorValuesChanged);
|
||||
connect(ui->cb_Paused, &QCheckBox::released, this, &CSimulatorEmulatedMonitorDialog::onSimulatorValuesChanged);
|
||||
connect(ui->cb_Simulating, &QCheckBox::released, this, &CSimulatorEmulatedMonitorDialog::onSimulatorValuesChanged);
|
||||
|
||||
connect(ui->editor_Situation, &CSituationForm::changeAircraftSituation, this, &CSimulatorEmulatedMonitorDialog::changeSituationFromUi, Qt::QueuedConnection);
|
||||
connect(ui->editor_AircraftParts, &CAircraftPartsForm::changeAircraftParts, this, &CSimulatorEmulatedMonitorDialog::changePartsFromUi, Qt::QueuedConnection);
|
||||
connect(ui->editor_Com, &CCockpitComForm::changedCockpitValues, this, &CSimulatorEmulatedMonitorDialog::changeComFromUi, Qt::QueuedConnection);
|
||||
connect(ui->editor_Com, &CCockpitComForm::changedSelcal, this, &CSimulatorEmulatedMonitorDialog::changeSelcalFromUi, Qt::QueuedConnection);
|
||||
connect(ui->comp_ComTransmissions, &CCockpitComTransmissionComponent::changedValues, this, &CSimulatorEmulatedMonitorDialog::onSavedComTransmissionValues, Qt::QueuedConnection);
|
||||
|
||||
connect(ui->pb_ResetStatistics, &QPushButton::clicked, this, &CSimulatorEmulatedMonitorDialog::resetStatistics);
|
||||
connect(ui->pb_InterpolatorStopLog, &QPushButton::clicked, this, &CSimulatorEmulatedMonitorDialog::interpolatorLogButton);
|
||||
@@ -159,6 +162,15 @@ namespace BlackSimPlugin
|
||||
);
|
||||
}
|
||||
|
||||
void CSimulatorEmulatedMonitorDialog::onSavedComTransmissionValues(CComSystem::ComUnit unit)
|
||||
{
|
||||
if (!m_simulator) { return; }
|
||||
const CSimulatedAircraft ownAircraft = m_simulator->getOwnAircraft();
|
||||
CComSystem com = ownAircraft.getComSystem(unit);
|
||||
ui->comp_ComTransmissions->updateComSystem(com, unit);
|
||||
m_simulator->changeInternalCom(com, unit);
|
||||
}
|
||||
|
||||
void CSimulatorEmulatedMonitorDialog::changeComFromUi(const CSimulatedAircraft &aircraft)
|
||||
{
|
||||
if (!m_simulator) { return; }
|
||||
@@ -201,6 +213,7 @@ namespace BlackSimPlugin
|
||||
ui->editor_Situation->setSituation(internal.getSituation());
|
||||
ui->editor_AircraftParts->setAircraftParts(internal.getParts());
|
||||
ui->editor_Com->setValue(internal);
|
||||
ui->comp_ComTransmissions->setComSystems(internal);
|
||||
}
|
||||
|
||||
void CSimulatorEmulatedMonitorDialog::timerBasedUiUpdates()
|
||||
|
||||
@@ -74,6 +74,9 @@ namespace BlackSimPlugin
|
||||
//! UI values changed
|
||||
void onSimulatorValuesChanged();
|
||||
|
||||
//! Transmission values (COM unit volume etc.)
|
||||
void onSavedComTransmissionValues(BlackMisc::Aviation::CComSystem::ComUnit unit);
|
||||
|
||||
//! Cockpit COM values changed
|
||||
void changeComFromUi(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user