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)
This commit is contained in:
Klaus Basan
2019-05-01 02:11:02 +02:00
parent 8df7404f2b
commit bcbdaaf1a7
19 changed files with 99 additions and 29 deletions

View File

@@ -58,8 +58,7 @@ namespace BlackGui
ui->setupUi(this);
// init from aircraft
const CSimulatedAircraft ownAircraft = this->getOwnAircraft();
this->updateCockpitFromContext(ownAircraft, CIdentifier("dummyInitialValues")); // intentionally different name here
this->forceCockpitUpdateFromOwnAircraftContext();
// COM form
connect(ui->editor_Com, &CCockpitComForm::testSelcal, this, &CCockpitComComponent::testSelcal);
@@ -75,11 +74,15 @@ namespace BlackGui
// hook up with changes from own aircraft context
if (sGui)
{
// own aircraft
connect(sGui->getIContextOwnAircraft(), &IContextOwnAircraft::changedAircraftCockpit, this, &CCockpitComComponent::updateCockpitFromContext, Qt::QueuedConnection);
connect(sGui->getIContextOwnAircraft(), &IContextOwnAircraft::changedSelcal, this, &CCockpitComComponent::updateSelcalFromContext, Qt::QueuedConnection);
// hook up with audio context
connect(sGui->getIContextAudio(), &IContextAudio::changedVoiceRooms, this, &CCockpitComComponent::updateVoiceRoomStatusFromContext, Qt::QueuedConnection);
// network
connect(sGui->getIContextNetwork(), &IContextNetwork::changedAtcStationsOnlineDigest, this, &CCockpitComComponent::onAtcStationsChanged, Qt::QueuedConnection);
}
}
@@ -171,6 +174,18 @@ namespace BlackGui
ui->editor_Com->setVoiceRoomStatus(selectedVoiceRooms);
}
void CCockpitComComponent::forceCockpitUpdateFromOwnAircraftContext()
{
if (!sGui || sGui->isShuttingDown()) { return; }
const CSimulatedAircraft ownAircraft = this->getOwnAircraft();
this->updateCockpitFromContext(ownAircraft, CIdentifier("dummyInitialValues")); // intentionally different name here
}
void CCockpitComComponent::onAtcStationsChanged()
{
// void
}
void CCockpitComComponent::updateSelcalInContext(const CSelcal &selcal)
{
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextOwnAircraft()) { return; }

View File

@@ -89,6 +89,12 @@ namespace BlackGui
//! Update voice room related information
void updateVoiceRoomStatusFromContext(const BlackMisc::Audio::CVoiceRoomList &selectedVoiceRooms, bool connected);
//! Update the cockpit from aircraft context
void forceCockpitUpdateFromOwnAircraftContext();
//! Stations changed
void onAtcStationsChanged();
QScopedPointer<Ui::CCockpitComComponent> ui;
};
} // namespace

View File

@@ -79,7 +79,7 @@ namespace BlackGui
static const QSize defaultSizeHidden(300, 150);
// keep old size
QSize manuallySetSize = this->window()->size();
const QSize manuallySetSize = this->window()->size();
// hide area
ui->comp_CockpitInfoArea->setVisible(show);
@@ -134,6 +134,11 @@ namespace BlackGui
this->requestTextMessageEntryTab(TextMessagesCom2);
}
void CCockpitComponent::onATCStationsChanged()
{
// void
}
void CCockpitComponent::onToggleFloating(bool floating)
{
ui->wip_CockpitComPanelShowHideBar->setVisible(floating);

View File

@@ -69,6 +69,9 @@ namespace BlackGui
void onRequestTextMessageCom2();
//! @}
//! ATC stations have been changed
void onATCStationsChanged();
QScopedPointer<Ui::CCockpitComponent> ui;
QSize m_sizeFloatingShown; //! size when info area is shown
QSize m_sizeFloatingHidden; //! size when info area is hidden

View File

@@ -66,6 +66,7 @@ namespace BlackGui
ui->tw_TextMessages->setCurrentIndex(0);
ui->fr_TextMessage->setVisible(false);
ui->tvp_TextMessagesAll->setResizeMode(CTextMessageView::ResizingAuto);
ui->tvp_TextMessagesAll->setWordWrap(false);
ui->comp_AtcStations->setWithIcons(false);
// lep_textMessages is the own line edit
@@ -499,11 +500,11 @@ namespace BlackGui
if (!station.getCallsign().isEmpty())
{
const CSimulatedAircraft ownAircraft(this->getOwnAircraft());
if (ownAircraft.getCom1System().isActiveFrequencyWithin25kHzChannel(station.getFrequency()))
if (ownAircraft.getCom1System().isActiveFrequencyWithinChannelSpacing(station.getFrequency()))
{
return this->getTabWidget(TextMessagesCom1);
}
else if (ownAircraft.getCom2System().isActiveFrequencyWithin25kHzChannel(station.getFrequency()))
else if (ownAircraft.getCom2System().isActiveFrequencyWithinChannelSpacing(station.getFrequency()))
{
return this->getTabWidget(TextMessagesCom2);
}