mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
refactor: Remove COM sync button from cockpit page
This setting is simulator specific and can already be adjusted from the simulator plugin settings. To avoid complexity, it should only be adjustable from one location. As this setting doesn't need to be adjusted often inflight, it should be fine to not have it directly accessible. This also fixes a previous issue, where a change of the setting within the simulator plugin settings did not propagated to the cockpit page.
This commit is contained in:
@@ -54,20 +54,6 @@ namespace BlackCore::Context
|
||||
return this->getSimulatorPluginInfo().getSimulatorInfo();
|
||||
}
|
||||
|
||||
bool IContextSimulator::updateCurrentSettings(const Simulation::Settings::CSimulatorSettings &settings)
|
||||
{
|
||||
const CSimulatorInfo sim = this->getSimulatorInfo();
|
||||
if (!sim.isSingleSimulator()) { return false; }
|
||||
return this->setSimulatorSettings(settings, sim);
|
||||
}
|
||||
|
||||
bool IContextSimulator::updateCurrentSettingComIntegration(bool comIntegration)
|
||||
{
|
||||
Simulation::Settings::CSimulatorSettings settings = this->getSimulatorSettings();
|
||||
settings.setComIntegrated(comIntegration);
|
||||
return this->updateCurrentSettings(settings);
|
||||
}
|
||||
|
||||
bool IContextSimulator::isSimulatorAvailable() const
|
||||
{
|
||||
return CBuildConfig::isCompiledWithFlightSimulatorSupport() && !this->getSimulatorPluginInfo().isUnspecified();
|
||||
|
||||
@@ -86,12 +86,6 @@ namespace BlackCore::Context
|
||||
//! Current simulator
|
||||
BlackMisc::Simulation::CSimulatorInfo getSimulatorInfo() const;
|
||||
|
||||
//! Update current settings
|
||||
bool updateCurrentSettings(const BlackMisc::Simulation::Settings::CSimulatorSettings &settings);
|
||||
|
||||
//! Update current setting for COM integration (aka "synced")
|
||||
bool updateCurrentSettingComIntegration(bool comIntegration);
|
||||
|
||||
signals:
|
||||
//! Simulator combined status
|
||||
//! \sa ISimulator::SimulatorStatus
|
||||
|
||||
@@ -54,7 +54,6 @@ namespace BlackGui::Components
|
||||
connect(ui->cb_2Tx, &QCheckBox::toggled, this, &CAudioDeviceVolumeSetupComponent::onRxTxChanged, Qt::QueuedConnection);
|
||||
connect(ui->cb_1Rec, &QCheckBox::toggled, this, &CAudioDeviceVolumeSetupComponent::onRxTxChanged, Qt::QueuedConnection);
|
||||
connect(ui->cb_2Rec, &QCheckBox::toggled, this, &CAudioDeviceVolumeSetupComponent::onRxTxChanged, Qt::QueuedConnection);
|
||||
connect(ui->cb_IntegratedWithCom, &QCheckBox::toggled, this, &CAudioDeviceVolumeSetupComponent::onIntegratedFlagChanged, Qt::QueuedConnection);
|
||||
|
||||
ui->hs_VolumeIn->setMaximum(CSettings::InMax);
|
||||
ui->hs_VolumeIn->setMinimum(CSettings::InMin);
|
||||
@@ -111,6 +110,12 @@ namespace BlackGui::Components
|
||||
c = connect(ui->cb_DisableAudioEffects, &QCheckBox::toggled, this, &CAudioDeviceVolumeSetupComponent::onDisableAudioEffectsToggled);
|
||||
Q_ASSERT(c);
|
||||
|
||||
if (hasSimulator())
|
||||
{
|
||||
c = connect(sGui->getIContextSimulator(), &IContextSimulator::simulatorSettingsChanged, this, &CAudioDeviceVolumeSetupComponent::simulatorSettingsChanged);
|
||||
Q_ASSERT(c);
|
||||
}
|
||||
|
||||
if (audio)
|
||||
{
|
||||
this->setAudioRunsWhere();
|
||||
@@ -268,7 +273,6 @@ namespace BlackGui::Components
|
||||
void CAudioDeviceVolumeSetupComponent::setTransmitReceiveInUi(bool tx1, bool rec1, bool tx2, bool rec2, bool integrated)
|
||||
{
|
||||
this->setRxTxCheckboxes(rec1, tx1, rec2, tx2);
|
||||
ui->cb_IntegratedWithCom->setChecked(integrated);
|
||||
this->setCheckBoxesReadOnly(integrated);
|
||||
this->setVolumeSlidersReadOnly(integrated);
|
||||
}
|
||||
@@ -436,14 +440,11 @@ namespace BlackGui::Components
|
||||
ui->le_Info->setPlaceholderText(ai);
|
||||
}
|
||||
|
||||
bool CAudioDeviceVolumeSetupComponent::updateIntegrateWithComFlagUi()
|
||||
void CAudioDeviceVolumeSetupComponent::simulatorSettingsChanged()
|
||||
{
|
||||
const bool integrate = this->isComIntegrated();
|
||||
if (ui->cb_IntegratedWithCom->isChecked() == integrate) { return integrate; }
|
||||
ui->cb_IntegratedWithCom->setChecked(integrate);
|
||||
this->setCheckBoxesReadOnly(integrate);
|
||||
this->setVolumeSlidersReadOnly(integrate);
|
||||
return integrate;
|
||||
const bool integrated = this->isComIntegrated();
|
||||
setCheckBoxesReadOnly(integrated);
|
||||
setVolumeSlidersReadOnly(integrated);
|
||||
}
|
||||
|
||||
bool CAudioDeviceVolumeSetupComponent::isComIntegrated() const
|
||||
@@ -452,11 +453,6 @@ namespace BlackGui::Components
|
||||
const Simulation::Settings::CSimulatorSettings settings = sGui->getIContextSimulator()->getSimulatorSettings();
|
||||
const bool integrate = settings.isComIntegrated();
|
||||
return integrate;
|
||||
|
||||
/*
|
||||
if (!this->hasAudio()) { return false; }
|
||||
const bool integrated = sGui->getCContextAudioBase()->isComUnitIntegrated();
|
||||
*/
|
||||
}
|
||||
|
||||
void CAudioDeviceVolumeSetupComponent::onRxTxChanged(bool checked)
|
||||
@@ -482,19 +478,6 @@ namespace BlackGui::Components
|
||||
});
|
||||
}
|
||||
|
||||
void CAudioDeviceVolumeSetupComponent::onIntegratedFlagChanged(bool checked)
|
||||
{
|
||||
if (!this->hasAudio()) { return; }
|
||||
this->setCheckBoxesReadOnly(checked);
|
||||
this->setVolumeSlidersReadOnly(checked);
|
||||
|
||||
if (!this->hasSimulator()) { return; }
|
||||
if (!sGui->getIContextSimulator()->isSimulatorAvailable()) { return; }
|
||||
|
||||
const bool s = sGui->getIContextSimulator()->updateCurrentSettingComIntegration(checked);
|
||||
Q_UNUSED(s)
|
||||
}
|
||||
|
||||
void CAudioDeviceVolumeSetupComponent::setRxTxCheckboxes(bool rx1, bool tx1, bool rx2, bool tx2)
|
||||
{
|
||||
if (ui->cb_1Tx->isChecked() != tx1) { ui->cb_1Tx->setChecked(tx1); }
|
||||
|
||||
@@ -121,10 +121,8 @@ namespace BlackGui::Components
|
||||
|
||||
void setAudioRunsWhere();
|
||||
|
||||
bool updateIntegrateWithComFlagUi();
|
||||
bool isComIntegrated() const;
|
||||
|
||||
void onIntegratedFlagChanged(bool checked);
|
||||
void onRxTxChanged(bool checked);
|
||||
void setRxTxCheckboxes(bool rx1, bool tx1, bool rx2, bool tx2);
|
||||
|
||||
@@ -156,6 +154,9 @@ namespace BlackGui::Components
|
||||
BlackMisc::Audio::CAudioDeviceInfoList m_cbDevices; //!< devices to be displayed in the checkbox
|
||||
BlackMisc::CDigestSignal m_volumeSliderChanged { this, &CAudioDeviceVolumeSetupComponent::saveVolumes, 1000, 10 };
|
||||
BlackMisc::CSetting<BlackMisc::Audio::TSettings> m_audioSettings { this, &CAudioDeviceVolumeSetupComponent::reloadSettings };
|
||||
|
||||
private slots:
|
||||
void simulatorSettingsChanged();
|
||||
};
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -246,16 +246,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cb_IntegratedWithCom">
|
||||
<property name="toolTip">
|
||||
<string>integrated with sim. cockpit</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>sync.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -413,7 +403,6 @@
|
||||
<tabstop>cb_1Tx</tabstop>
|
||||
<tabstop>cb_2Rec</tabstop>
|
||||
<tabstop>cb_2Tx</tabstop>
|
||||
<tabstop>cb_IntegratedWithCom</tabstop>
|
||||
<tabstop>cb_SetupAudioInputDevice</tabstop>
|
||||
<tabstop>tb_RefreshInDevice</tabstop>
|
||||
<tabstop>cb_SetupAudioOutputDevice</tabstop>
|
||||
|
||||
Reference in New Issue
Block a user