mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
Ref T609, fixed signal/slot connection of cross context hookup
* audio can be local or remote special case * so we have to hookup on core or remote side depending on that
This commit is contained in:
committed by
Mat Sutcliffe
parent
105db27fa8
commit
d9948af103
@@ -259,14 +259,14 @@ namespace BlackCore
|
||||
c = connect(this->getCContextOwnAircraft(), &CContextOwnAircraft::ps_changedModel,
|
||||
this->getCContextSimulator(), &CContextSimulator::xCtxChangedOwnAircraftModel);
|
||||
Q_ASSERT(c);
|
||||
}
|
||||
|
||||
|
||||
// hook up with audio
|
||||
if (this->getIContextAudio())
|
||||
{
|
||||
c = connect(m_contextOwnAircraft, &IContextOwnAircraft::changedAircraftCockpit, this->getCContextAudio(), &CContextAudio::xCtxChangedAircraftCockpit, Qt::QueuedConnection);
|
||||
Q_ASSERT(c);
|
||||
}
|
||||
// special case for the audio related connection (which mutes audio for a changed cockpit)
|
||||
// hook up with audio if audio context is local
|
||||
if (this->hasLocalAudio() && m_contextOwnAircraft)
|
||||
{
|
||||
c = connect(m_contextOwnAircraft, &IContextOwnAircraft::changedAircraftCockpit, this->getCContextAudio(), &CContextAudio::xCtxChangedAircraftCockpit, Qt::QueuedConnection);
|
||||
Q_ASSERT(c);
|
||||
}
|
||||
|
||||
// times
|
||||
@@ -452,6 +452,11 @@ namespace BlackCore
|
||||
return static_cast<CContextAudio *>(m_contextAudio);
|
||||
}
|
||||
|
||||
bool CCoreFacade::hasLocalAudio() const
|
||||
{
|
||||
return m_contextAudio && m_contextAudio->isUsingImplementingObject();
|
||||
}
|
||||
|
||||
const CContextAudio *CCoreFacade::getCContextAudio() const
|
||||
{
|
||||
Q_ASSERT_X(m_contextAudio && m_contextAudio->isUsingImplementingObject(), "CCoreRuntime", "Cannot downcast to local object");
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace BlackCore
|
||||
CCoreFacade(const CCoreFacadeConfig &config, QObject *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CCoreFacade() { this->gracefulShutdown(); }
|
||||
virtual ~CCoreFacade() override { this->gracefulShutdown(); }
|
||||
|
||||
//! DBus server (if applicable)
|
||||
const BlackMisc::CDBusServer *getDBusServer() const { return this->m_dbusServer; }
|
||||
@@ -123,6 +123,9 @@ namespace BlackCore
|
||||
//! \remarks only applicable for local object
|
||||
Context::CContextAudio *getCContextAudio();
|
||||
|
||||
//! Local audio context, means audio really runs here
|
||||
bool hasLocalAudio() const;
|
||||
|
||||
//! Context for audio
|
||||
//! \remarks only applicable for local object
|
||||
const Context::CContextAudio *getCContextAudio() const;
|
||||
|
||||
Reference in New Issue
Block a user