Foundations laid for project settings and Insight porject settings

This commit is contained in:
Nav
2022-01-02 20:44:39 +00:00
parent 0faa97fc68
commit 2ecde9d11d
7 changed files with 103 additions and 2 deletions

View File

@@ -49,7 +49,8 @@ int Application::run(const std::vector<std::string>& arguments) {
this->eventManager,
this->projectConfig.value(),
this->environmentConfig.value(),
this->insightConfig.value()
this->insightConfig.value(),
this->projectSettings.value().insightSettings
);
/*
@@ -94,6 +95,7 @@ void Application::startup() {
std::bind(&Application::onShutdownApplicationRequest, this, std::placeholders::_1)
);
this->loadProjectSettings();
this->loadProjectConfiguration();
Logger::configure(this->projectConfig.value());
@@ -153,6 +155,28 @@ void Application::shutdown() {
Thread::setThreadState(ThreadState::STOPPED);
}
void Application::loadProjectSettings() {
const auto projectSettingsPath = Paths::projectSettingsPath();
auto jsonSettingsFile = QFile(QString::fromStdString(projectSettingsPath));
if (jsonSettingsFile.exists()) {
auto jsonObject = QJsonDocument::fromJson(jsonSettingsFile.readAll()).object();
jsonSettingsFile.close();
try {
this->projectSettings = ProjectSettings(jsonObject);
return;
} catch (const std::exception& exception) {
Logger::error(
"Failed to load project settings from " + projectSettingsPath + " - " + exception.what()
);
}
}
this->projectSettings = ProjectSettings();
}
void Application::loadProjectConfiguration() {
auto jsonConfigFile = QFile(QString::fromStdString(Paths::projectConfigPath()));