mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 05:26:45 +08:00
Improved handling of runtime based GUI components, allows to init all child components in one step
refs #195, follow up of fixing FSX configuration page as result of #217
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "runtimebasedcomponent.h"
|
||||
#include <QWidget>
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
@@ -26,6 +27,18 @@ namespace BlackGui
|
||||
return this->m_runtime->getIContextAudio();
|
||||
}
|
||||
|
||||
void CRuntimeBasedComponent::setRuntimeForComponents(BlackCore::CRuntime *runtime, QWidget *parent)
|
||||
{
|
||||
if (!parent) return;
|
||||
QList<QWidget *> children = parent->findChildren<QWidget *>();
|
||||
foreach(QWidget * widget, children)
|
||||
{
|
||||
if (widget->objectName().isEmpty()) continue; // rule out unamed widgets
|
||||
CRuntimeBasedComponent *rbc = dynamic_cast<CRuntimeBasedComponent *>(widget);
|
||||
if (rbc) rbc->setRuntime(runtime, false);
|
||||
}
|
||||
}
|
||||
|
||||
void CRuntimeBasedComponent::createRuntime(const BlackCore::CRuntimeConfig &config, QObject *parent)
|
||||
{
|
||||
this->m_runtime = new BlackCore::CRuntime(config, parent);
|
||||
@@ -67,4 +80,16 @@ namespace BlackGui
|
||||
if (!this->m_runtime) return nullptr;
|
||||
return this->m_runtime->getIContextSimulator();
|
||||
}
|
||||
|
||||
void CRuntimeBasedComponent::sendStatusMessage(const BlackMisc::CStatusMessage &statusMessage)
|
||||
{
|
||||
Q_ASSERT(this->getIContextApplication());
|
||||
this->getIContextApplication()->sendStatusMessage(statusMessage);
|
||||
}
|
||||
|
||||
void CRuntimeBasedComponent::sendStatusMessages(const BlackMisc::CStatusMessageList &statusMessages)
|
||||
{
|
||||
Q_ASSERT(this->getIContextApplication());
|
||||
this->getIContextApplication()->sendStatusMessages(statusMessages);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user