mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 11:05:44 +08:00
refs #239, some finetuning for runtime based components
* virtual method to be called for signal slot hook up * comments
This commit is contained in:
@@ -27,6 +27,14 @@ namespace BlackGui
|
|||||||
return this->m_runtime->getIContextAudio();
|
return this->m_runtime->getIContextAudio();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CRuntimeBasedComponent::setRuntime(BlackCore::CRuntime *runtime, bool runtimeOwner)
|
||||||
|
{
|
||||||
|
Q_ASSERT(runtime);
|
||||||
|
this->m_runtime = runtime;
|
||||||
|
this->m_runtimeOwner = runtimeOwner;
|
||||||
|
this->runtimeHasBeenSet();
|
||||||
|
}
|
||||||
|
|
||||||
void CRuntimeBasedComponent::setRuntimeForComponents(BlackCore::CRuntime *runtime, QWidget *parent)
|
void CRuntimeBasedComponent::setRuntimeForComponents(BlackCore::CRuntime *runtime, QWidget *parent)
|
||||||
{
|
{
|
||||||
if (!parent) return;
|
if (!parent) return;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "blackcore/context_runtime.h"
|
#include "blackcore/context_runtime.h"
|
||||||
#include "blackcore/context_all_interfaces.h"
|
#include "blackcore/context_all_interfaces.h"
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
{
|
{
|
||||||
@@ -16,17 +17,15 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Set runtime, usually set by runtime owner (must only be one, usually main window)
|
//! Set runtime, usually set by runtime owner (must only be one, usually main window)
|
||||||
void setRuntime(BlackCore::CRuntime *runtime, bool runtimeOwner = false)
|
void setRuntime(BlackCore::CRuntime *runtime, bool runtimeOwner = false);
|
||||||
{
|
|
||||||
this->m_runtime = runtime; this->m_runtimeOwner = runtimeOwner;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Set runtime for each CRuntimeBasedComponent
|
//! Set runtime for each CRuntimeBasedComponent
|
||||||
static void setRuntimeForComponents(BlackCore::CRuntime *runtime, QWidget *parent);
|
static void setRuntimeForComponents(BlackCore::CRuntime *runtime, QWidget *parent);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! Constructor
|
//! Constructor
|
||||||
//! \remarks usually runtime will be provide later, not at initialization time
|
//! \remarks Usually runtime will be provided later, not at initialization time.
|
||||||
|
//! If runtime is provided right now, make sure to call runtimeHasBeenSet afterwards
|
||||||
CRuntimeBasedComponent(BlackCore::CRuntime *runtime = nullptr, bool runtimeOwner = false) :
|
CRuntimeBasedComponent(BlackCore::CRuntime *runtime = nullptr, bool runtimeOwner = false) :
|
||||||
m_runtime(runtime), m_runtimeOwner(runtimeOwner)
|
m_runtime(runtime), m_runtimeOwner(runtimeOwner)
|
||||||
{}
|
{}
|
||||||
@@ -79,10 +78,13 @@ namespace BlackGui
|
|||||||
//! Owner?
|
//! Owner?
|
||||||
bool isRuntimeOwner() const { return this->m_runtimeOwner; }
|
bool isRuntimeOwner() const { return this->m_runtimeOwner; }
|
||||||
|
|
||||||
|
//! "Callback" when runtime is initialized, done this way as we do not have signals/slots here
|
||||||
|
//! \remarks use this methods to hook up signal/slots with runtime
|
||||||
|
virtual void runtimeHasBeenSet() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BlackCore::CRuntime *m_runtime;
|
BlackCore::CRuntime *m_runtime;
|
||||||
bool m_runtimeOwner;
|
bool m_runtimeOwner;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
Reference in New Issue
Block a user