Improved handling of late initialisation for component objects

This commit is contained in:
Nav
2021-12-31 19:45:15 +00:00
parent d24587b992
commit 49383eb448
9 changed files with 109 additions and 72 deletions

View File

@@ -37,8 +37,16 @@ namespace Bloom
*
* @param eventManager
*/
explicit Insight(EventManager& eventManager):
explicit Insight(
EventManager& eventManager,
const ProjectConfig& projectConfig,
const EnvironmentConfig& environmentConfig,
const InsightConfig& insightConfig
):
eventManager(eventManager),
projectConfig(projectConfig),
environmentConfig(environmentConfig),
insightConfig(insightConfig),
application(
(
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, false),
@@ -49,18 +57,6 @@ namespace Bloom
)
) {};
void setProjectConfig(const ProjectConfig& projectConfig) {
this->projectConfig = projectConfig;
}
void setEnvironmentConfig(const EnvironmentConfig& environmentConfig) {
this->environmentConfig = environmentConfig;
}
void setInsightConfig(const InsightConfig& insightConfig) {
this->insightConfig = insightConfig;
}
/**
* Entry point for Insight.
*/
@@ -80,7 +76,11 @@ namespace Bloom
QApplication application;
InsightWorker* insightWorker = new InsightWorker(this->eventManager);
InsightWindow* mainWindow = new InsightWindow(*(this->insightWorker));
InsightWindow* mainWindow = new InsightWindow(
*(this->insightWorker),
this->environmentConfig,
this->insightConfig
);
TargetControllerConsole targetControllerConsole = TargetControllerConsole(
this->eventManager,

View File

@@ -27,7 +27,17 @@ using Bloom::Targets::TargetPackage;
using Bloom::Targets::TargetPinDescriptor;
using Bloom::Targets::TargetMemoryType;
InsightWindow::InsightWindow(InsightWorker& insightWorker): QMainWindow(nullptr), insightWorker(insightWorker) {
InsightWindow::InsightWindow(
InsightWorker& insightWorker,
const EnvironmentConfig& environmentConfig,
const InsightConfig& insightConfig
):
QMainWindow(nullptr),
insightWorker(insightWorker),
environmentConfig(environmentConfig),
targetConfig(environmentConfig.targetConfig),
insightConfig(insightConfig)
{
this->setObjectName("main-window");
this->setWindowTitle("Bloom Insight");
this->setMinimumSize(1000, 500);

View File

@@ -30,7 +30,11 @@ namespace Bloom
Q_OBJECT
public:
InsightWindow(InsightWorker& insightWorker);
InsightWindow(
InsightWorker& insightWorker,
const EnvironmentConfig& environmentConfig,
const InsightConfig& insightConfig
);
void setEnvironmentConfig(const EnvironmentConfig& environmentConfig) {
this->environmentConfig = environmentConfig;