Ref T739, changed core modes which no longer make sense like "audio in core"

This commit is contained in:
Klaus Basan
2019-10-05 00:13:00 +02:00
committed by Mat Sutcliffe
parent 2a7633dc31
commit f09e99333f
4 changed files with 11 additions and 35 deletions

View File

@@ -265,7 +265,7 @@ namespace BlackCore
// hook up with audio if audio context is local // hook up with audio if audio context is local
if (this->hasLocalAudio() && m_contextOwnAircraft) if (this->hasLocalAudio() && m_contextOwnAircraft)
{ {
c = connect(m_contextOwnAircraft, &IContextOwnAircraft::changedAircraftCockpit, this->getCContextAudio(), &CContextAudio::xCtxChangedAircraftCockpit, Qt::QueuedConnection); c = connect(m_contextOwnAircraft, &IContextOwnAircraft::changedAircraftCockpit, this->getCContextAudio(), &IContextAudio::xCtxChangedAircraftCockpit, Qt::QueuedConnection);
Q_ASSERT(c); Q_ASSERT(c);
} }
@@ -288,7 +288,7 @@ namespace BlackCore
{ {
Q_ASSERT(m_contextApplication); Q_ASSERT(m_contextApplication);
c = connect(m_contextNetwork, &IContextNetwork::connectionStatusChanged, c = connect(m_contextNetwork, &IContextNetwork::connectionStatusChanged,
this->getCContextAudio(), &CContextAudio::xCtxNetworkConnectionStatusChanged, Qt::QueuedConnection); this->getCContextAudio(), &IContextAudio::xCtxNetworkConnectionStatusChanged, Qt::QueuedConnection);
Q_ASSERT(c); Q_ASSERT(c);
times.insert("Post setup, connects audio", time.restart()); times.insert("Post setup, connects audio", time.restart());
} }
@@ -352,11 +352,10 @@ namespace BlackCore
if (this->getIContextAudio()) if (this->getIContextAudio())
{ {
// there is no empty audio context since AFV
disconnect(this->getIContextAudio()); disconnect(this->getIContextAudio());
this->getIContextAudio()->deleteLater(); this->getIContextAudio()->deleteLater();
// replace by dummy object avoiding nullptr issues during shutdown phase m_contextAudio = nullptr;
QDBusConnection defaultConnection("default");
m_contextAudio = IContextAudio::create(this, CCoreFacadeConfig::NotUsed, nullptr, defaultConnection);
} }
if (this->getIContextOwnAircraft()) if (this->getIContextOwnAircraft())

View File

@@ -53,13 +53,6 @@ namespace BlackCore
return cfg; return cfg;
} }
CCoreFacadeConfig CCoreFacadeConfig::forCoreAllLocalInDBusNoAudio(const QString &dbusBootstrapAddress)
{
CCoreFacadeConfig cfg(CCoreFacadeConfig::LocalInDBusServer, dbusBootstrapAddress);
cfg.m_audio = CCoreFacadeConfig::NotUsed;
return cfg;
}
CCoreFacadeConfig CCoreFacadeConfig::local(const QString &dbusBootstrapAddress) CCoreFacadeConfig CCoreFacadeConfig::local(const QString &dbusBootstrapAddress)
{ {
const CCoreFacadeConfig cfg = CCoreFacadeConfig(CCoreFacadeConfig(CCoreFacadeConfig::Local, dbusBootstrapAddress)); const CCoreFacadeConfig cfg = CCoreFacadeConfig(CCoreFacadeConfig(CCoreFacadeConfig::Local, dbusBootstrapAddress));
@@ -67,12 +60,6 @@ namespace BlackCore
} }
CCoreFacadeConfig CCoreFacadeConfig::remote(const QString &dbusBootstrapAddress) CCoreFacadeConfig CCoreFacadeConfig::remote(const QString &dbusBootstrapAddress)
{
const CCoreFacadeConfig cfg = CCoreFacadeConfig(CCoreFacadeConfig(CCoreFacadeConfig::Remote, dbusBootstrapAddress));
return cfg;
}
CCoreFacadeConfig CCoreFacadeConfig::remoteLocalAudio(const QString &dbusBootstrapAddress)
{ {
CCoreFacadeConfig cfg = CCoreFacadeConfig(CCoreFacadeConfig(CCoreFacadeConfig::Remote, dbusBootstrapAddress)); CCoreFacadeConfig cfg = CCoreFacadeConfig(CCoreFacadeConfig(CCoreFacadeConfig::Remote, dbusBootstrapAddress));
cfg.m_audio = CCoreFacadeConfig::LocalInDBusServer; cfg.m_audio = CCoreFacadeConfig::LocalInDBusServer;
@@ -81,7 +68,8 @@ namespace BlackCore
CCoreFacadeConfig CCoreFacadeConfig::allEmpty() CCoreFacadeConfig CCoreFacadeConfig::allEmpty()
{ {
const CCoreFacadeConfig cfg = CCoreFacadeConfig(); CCoreFacadeConfig cfg = CCoreFacadeConfig();
cfg.m_audio = CCoreFacadeConfig::Local;
return cfg; return cfg;
} }
} // namespace } // namespace

View File

@@ -97,18 +97,12 @@ namespace BlackCore
//! Predefined for Core //! Predefined for Core
static CCoreFacadeConfig forCoreAllLocalInDBus(const QString &dbusBootstrapAddress = ""); static CCoreFacadeConfig forCoreAllLocalInDBus(const QString &dbusBootstrapAddress = "");
//! Predefined for Core
static CCoreFacadeConfig forCoreAllLocalInDBusNoAudio(const QString &dbusBootstrapAddress = "");
//! Predefined, completely local (e.g. for unit tests) //! Predefined, completely local (e.g. for unit tests)
static CCoreFacadeConfig local(const QString &dbusBootstrapAddress = ""); static CCoreFacadeConfig local(const QString &dbusBootstrapAddress = "");
//! Predefined, completely remote (e.g. for GUI with core) //! Predefined, completely remote
static CCoreFacadeConfig remote(const QString &dbusBootstrapAddress = ""); static CCoreFacadeConfig remote(const QString &dbusBootstrapAddress = "");
//! Predefined, remote with local audio (e.g. Aduio in GUI)
static CCoreFacadeConfig remoteLocalAudio(const QString &dbusBootstrapAddress = "");
//! Predefined, all empty configs (normally used when the real config can only be determined later) //! Predefined, all empty configs (normally used when the real config can only be determined later)
static CCoreFacadeConfig allEmpty(); static CCoreFacadeConfig allEmpty();
}; };

View File

@@ -23,8 +23,7 @@ namespace BlackCore
enum CoreMode enum CoreMode
{ {
CoreInGuiProcess, CoreInGuiProcess,
CoreExternalCoreAudio, CoreExternal
CoreExternalAudioGui
}; };
//! String to core mode //! String to core mode
@@ -32,14 +31,11 @@ namespace BlackCore
{ {
QString cm(m.toLower().trimmed()); QString cm(m.toLower().trimmed());
if (cm.isEmpty()) { return CoreInGuiProcess; } if (cm.isEmpty()) { return CoreInGuiProcess; }
if (m == coreModeToString(CoreExternalCoreAudio)) { return CoreExternalCoreAudio; }
if (m == coreModeToString(CoreInGuiProcess)) { return CoreInGuiProcess; } if (m == coreModeToString(CoreInGuiProcess)) { return CoreInGuiProcess; }
if (m == coreModeToString(CoreExternalAudioGui)) { return CoreExternalAudioGui; } if (m == coreModeToString(CoreExternal)) { return CoreExternal; }
// some alternative names // some alternative names
if (cm.contains("audiolocal")) { return CoreExternalAudioGui; } if (cm.contains("external")) { return CoreExternal; }
if (cm.contains("localaudio")) { return CoreExternalAudioGui; }
if (cm.contains("external")) { return CoreExternalCoreAudio; }
if (cm.contains("gui")) { return CoreInGuiProcess; } if (cm.contains("gui")) { return CoreInGuiProcess; }
return CoreInGuiProcess; return CoreInGuiProcess;
} }
@@ -50,8 +46,7 @@ namespace BlackCore
switch (mode) switch (mode)
{ {
case CoreInGuiProcess: return QStringLiteral("coreinguiprocess"); case CoreInGuiProcess: return QStringLiteral("coreinguiprocess");
case CoreExternalCoreAudio: return QStringLiteral("coreexternal"); case CoreExternal: return QStringLiteral("coreexternal");
case CoreExternalAudioGui: return QStringLiteral("coreexternalaudiogui");
} }
return {}; return {};
} }