Ref T167, utility functions in CCoreFacadeConfig and better check in SwiftGuiStd::displayDBusReconnectDialog

This commit is contained in:
Klaus Basan
2017-10-10 00:16:27 +01:00
committed by Mathew Sutcliffe
parent 7a87f986e2
commit 2aa5ed431f
4 changed files with 38 additions and 9 deletions

View File

@@ -343,6 +343,9 @@ namespace BlackCore
//! \sa m_useContexts we use or we will use contexts
bool supportsContexts() const;
//! The core facade config
const CCoreFacadeConfig &getCoreFacadeConfig() const { return m_coreFacadeConfig; }
//! Init the contexts part and start core facade
//! \sa coreFacadeStarted
//! \remark requires setup loaded

View File

@@ -26,22 +26,37 @@ namespace BlackCore
bool CCoreFacadeConfig::requiresDBusConnection() const
{
return (this->m_application == Remote ||
this->m_audio == Remote ||
this->m_network == Remote ||
this->m_ownAircraft == Remote ||
this->m_simulator == Remote);
return this->any(Remote);
}
bool CCoreFacadeConfig::any(CCoreFacadeConfig::ContextMode mode) const
{
return (this->m_application == mode ||
this->m_audio == mode ||
this->m_network == mode ||
this->m_ownAircraft == mode ||
this->m_simulator == mode);
}
bool CCoreFacadeConfig::anyRemote() const
{
return this->any(Remote);
}
bool CCoreFacadeConfig::anyLocalInDBusServer() const
{
return this->any(LocalInDBusServer);
}
CCoreFacadeConfig CCoreFacadeConfig::forCoreAllLocalInDBus(const QString &dbusBootstrapAddress)
{
const CCoreFacadeConfig cfg(CCoreFacadeConfig::LocalInDbusServer, dbusBootstrapAddress);
const CCoreFacadeConfig cfg(CCoreFacadeConfig::LocalInDBusServer, dbusBootstrapAddress);
return cfg;
}
CCoreFacadeConfig CCoreFacadeConfig::forCoreAllLocalInDBusNoAudio(const QString &dbusBootstrapAddress)
{
CCoreFacadeConfig cfg(CCoreFacadeConfig::LocalInDbusServer, dbusBootstrapAddress);
CCoreFacadeConfig cfg(CCoreFacadeConfig::LocalInDBusServer, dbusBootstrapAddress);
cfg.m_audio = CCoreFacadeConfig::NotUsed;
return cfg;
}

View File

@@ -86,6 +86,15 @@ namespace BlackCore
//! DBus address?
bool hasDBusAddress() const { return !this->m_dbusAddress.isEmpty(); }
//! Any context in given mode
bool any(ContextMode mode) const;
//! Any remote context?
bool anyRemote() const;
//! Any local in DBus context?
bool anyLocalInDBusServer() const;
//! Predefined for Core
static CCoreFacadeConfig forCoreAllLocalInDBus(const QString &dbusBootstrapAddress = "");