mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 06:35:52 +08:00
* This was an approach to avoid registration of "local signals" * that part DID NOT work as planned, as all object's signals are registered * the refactoring itself nevertheless is NOT a bad idea and has been kept * as the audio context has this special "concept" and CAfvClient can run on both sides (proxy AND impl.side)
109 lines
3.5 KiB
C++
109 lines
3.5 KiB
C++
/* Copyright (C) 2013
|
|
* swift Project Community / Contributors
|
|
*
|
|
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
|
* directory of this distribution. No part of swift project, including this file, may be copied, modified, propagated,
|
|
* or distributed except according to the terms contained in the LICENSE file.
|
|
*/
|
|
|
|
#include "blackcore/context/context.h"
|
|
#include "blackcore/application.h"
|
|
#include "blackmisc/logcategorylist.h"
|
|
|
|
using namespace BlackMisc;
|
|
|
|
namespace BlackCore
|
|
{
|
|
namespace Context
|
|
{
|
|
const CLogCategoryList &IContext::getLogCategories()
|
|
{
|
|
static const CLogCategoryList cats { BlackMisc::CLogCategory::context() };
|
|
return cats;
|
|
}
|
|
|
|
IContext::IContext(CCoreFacadeConfig::ContextMode mode, QObject *parent) :
|
|
QObject(parent), m_mode(mode), m_contextId(QDateTime::currentMSecsSinceEpoch())
|
|
{
|
|
if (sApp && !sApp->isShuttingDown())
|
|
{
|
|
QObject::connect(sApp, &CApplication::aboutToShutdown, this, &IContext::onAboutToShutdown);
|
|
}
|
|
}
|
|
|
|
IContextNetwork *IContext::getIContextNetwork()
|
|
{
|
|
return this->getRuntime()->getIContextNetwork();
|
|
}
|
|
|
|
const IContextNetwork *IContext::getIContextNetwork() const
|
|
{
|
|
return this->getRuntime()->getIContextNetwork();
|
|
}
|
|
|
|
IContextAudio *IContext::getIContextAudio()
|
|
{
|
|
return this->getRuntime()->getIContextAudio();
|
|
}
|
|
|
|
const IContextAudio *IContext::getIContextAudio() const
|
|
{
|
|
return this->getRuntime()->getIContextAudio();
|
|
}
|
|
|
|
IContextApplication *IContext::getIContextApplication()
|
|
{
|
|
return this->getRuntime()->getIContextApplication();
|
|
}
|
|
|
|
const IContextApplication *IContext::getIContextApplication() const
|
|
{
|
|
return this->getRuntime()->getIContextApplication();
|
|
}
|
|
|
|
IContextOwnAircraft *IContext::getIContextOwnAircraft()
|
|
{
|
|
return this->getRuntime()->getIContextOwnAircraft();
|
|
}
|
|
|
|
const IContextOwnAircraft *IContext::getIContextOwnAircraft() const
|
|
{
|
|
return this->getRuntime()->getIContextOwnAircraft();
|
|
}
|
|
|
|
IContextSimulator *IContext::getIContextSimulator()
|
|
{
|
|
return this->getRuntime()->getIContextSimulator();
|
|
}
|
|
|
|
void IContext::setDebugEnabled(bool debug)
|
|
{
|
|
if (m_debugEnabled == debug) { return; }
|
|
emit this->changedLogOrDebugSettings();
|
|
}
|
|
|
|
bool IContext::isDebugEnabled() const
|
|
{
|
|
return m_debugEnabled;
|
|
}
|
|
|
|
void IContext::relayBaseClassSignals(const QString &serviceName, QDBusConnection &connection, const QString &objectPath, const QString &interfaceName)
|
|
{
|
|
bool s = connection.connect(serviceName, objectPath, interfaceName,
|
|
"changedLogOrDebugSettings", this, SIGNAL(changedLogOrDebugSettings()));
|
|
Q_ASSERT(s);
|
|
}
|
|
|
|
const IContextSimulator *IContext::getIContextSimulator() const
|
|
{
|
|
return this->getRuntime()->getIContextSimulator();
|
|
}
|
|
|
|
const CStatusMessage &IContext::statusMessageEmptyContext()
|
|
{
|
|
static const CStatusMessage m(static_cast<IContext *>(nullptr), CStatusMessage::SeverityWarning, u"empty context");
|
|
return m;
|
|
}
|
|
} // ns
|
|
} // ns
|