From 7c08a37d82e9a8f20cc4d340acb46aa78540da32 Mon Sep 17 00:00:00 2001 From: Nav Date: Fri, 31 Dec 2021 17:05:31 +0000 Subject: [PATCH] Renamed ApplicationConfig to ProjectConfig --- CMakeLists.txt | 2 +- src/Application.cpp | 26 +++++++++---------- src/Application.hpp | 12 ++++----- src/DebugServers/DebugServer.hpp | 8 +++--- .../Microchip/AVR/AVR8/Avr8Interface.hpp | 2 +- src/Insight/Insight.hpp | 8 +++--- src/Insight/InsightWorker/InsightWorker.hpp | 2 +- .../InsightWindow/InsightWindow.hpp | 2 +- src/Logger/Logger.cpp | 4 +-- src/Logger/Logger.hpp | 4 +-- ...pplicationConfig.cpp => ProjectConfig.cpp} | 4 +-- ...pplicationConfig.hpp => ProjectConfig.hpp} | 6 ++--- src/TargetController/TargetController.hpp | 6 ++--- src/Targets/Microchip/AVR/AVR8/Avr8.hpp | 2 +- src/Targets/Target.hpp | 2 +- 15 files changed, 45 insertions(+), 45 deletions(-) rename src/{ApplicationConfig.cpp => ProjectConfig.cpp} (97%) rename src/{ApplicationConfig.hpp => ProjectConfig.hpp} (98%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a13983b..cadde579 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,7 +66,7 @@ add_executable(Bloom src/Generated/resources.cpp # Project & application configuration - src/ApplicationConfig.cpp + src/ProjectConfig.cpp # Events src/EventManager/EventListener.cpp diff --git a/src/Application.cpp b/src/Application.cpp index 24e29382..e7059563 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -46,7 +46,7 @@ int Application::run(const std::vector& arguments) { if (this->insightConfig.insightEnabled) { this->insight = std::make_unique(this->eventManager); - this->insight->setApplicationConfig(this->applicationConfig); + this->insight->setProjectConfig(this->projectConfig); this->insight->setEnvironmentConfig(this->environmentConfig); this->insight->setInsightConfig(this->insightConfig); @@ -92,8 +92,8 @@ void Application::startup() { std::bind(&Application::onShutdownApplicationRequest, this, std::placeholders::_1) ); - this->applicationConfig = this->extractConfig(); - Logger::configure(this->applicationConfig); + this->projectConfig = this->extractConfig(); + Logger::configure(this->projectConfig); // Start signal handler this->blockAllSignalsOnCurrentThread(); @@ -101,21 +101,21 @@ void Application::startup() { Logger::info("Selected environment: \"" + this->selectedEnvironmentName + "\""); Logger::debug("Number of environments extracted from config: " - + std::to_string(this->applicationConfig.environments.size())); + + std::to_string(this->projectConfig.environments.size())); // Validate the selected environment - if (!applicationConfig.environments.contains(this->selectedEnvironmentName)) { + if (!projectConfig.environments.contains(this->selectedEnvironmentName)) { throw InvalidConfig("Environment (\"" + this->selectedEnvironmentName + "\") not found in configuration."); } - this->environmentConfig = applicationConfig.environments.at(this->selectedEnvironmentName); - this->insightConfig = this->environmentConfig.insightConfig.value_or(this->applicationConfig.insightConfig); + this->environmentConfig = projectConfig.environments.at(this->selectedEnvironmentName); + this->insightConfig = this->environmentConfig.insightConfig.value_or(this->projectConfig.insightConfig); if (this->environmentConfig.debugServerConfig.has_value()) { this->debugServerConfig = this->environmentConfig.debugServerConfig.value(); - } else if (this->applicationConfig.debugServerConfig.has_value()) { - this->debugServerConfig = this->applicationConfig.debugServerConfig.value(); + } else if (this->projectConfig.debugServerConfig.has_value()) { + this->debugServerConfig = this->projectConfig.debugServerConfig.value(); } else { throw InvalidConfig("Debug server configuration missing."); @@ -169,8 +169,8 @@ void Application::shutdown() { Thread::setThreadState(ThreadState::STOPPED); } -ApplicationConfig Application::extractConfig() { - auto appConfig = ApplicationConfig(); +ProjectConfig Application::extractConfig() { + auto appConfig = ProjectConfig(); auto currentPath = std::filesystem::current_path().string(); auto jsonConfigFile = QFile(QString::fromStdString(currentPath + "/bloom.json")); @@ -271,7 +271,7 @@ int Application::initProject() { } void Application::startTargetController() { - this->targetController.setApplicationConfig(this->applicationConfig); + this->targetController.setProjectConfig(this->projectConfig); this->targetController.setEnvironmentConfig(this->environmentConfig); this->targetControllerThread = std::thread( @@ -309,7 +309,7 @@ void Application::startDebugServer() { } this->debugServer = supportedDebugServers.at(this->debugServerConfig.name)(); - this->debugServer->setApplicationConfig(this->applicationConfig); + this->debugServer->setProjectConfig(this->projectConfig); this->debugServer->setEnvironmentConfig(this->environmentConfig); this->debugServer->setDebugServerConfig(this->debugServerConfig); diff --git a/src/Application.hpp b/src/Application.hpp index 3abc4b58..5c05a980 100644 --- a/src/Application.hpp +++ b/src/Application.hpp @@ -15,7 +15,7 @@ #include "src/Insight/Insight.hpp" #include "src/Logger/Logger.hpp" -#include "src/ApplicationConfig.hpp" +#include "src/ProjectConfig.hpp" #include "src/VersionNumber.hpp" #include "src/EventManager/EventListener.hpp" @@ -131,9 +131,9 @@ namespace Bloom /** * Configuration extracted from the user's project configuration file. * - * See ApplicationConfig.hpp for more on this. + * See ProjectConfig.hpp for more on this. */ - ApplicationConfig applicationConfig; + ProjectConfig projectConfig; EnvironmentConfig environmentConfig; DebugServerConfig debugServerConfig; InsightConfig insightConfig; @@ -193,12 +193,12 @@ namespace Bloom void shutdown(); /** - * Extracts config from the user's JSON config file and generates an ApplicationConfig object. + * Extracts config from the user's JSON config file and generates an ProjectConfig object. * - * @see ApplicationConfig declaration for more on this. + * @see ProjectConfig declaration for more on this. * @return */ - static ApplicationConfig extractConfig(); + static ProjectConfig extractConfig(); /** * Presents application help text to user. diff --git a/src/DebugServers/DebugServer.hpp b/src/DebugServers/DebugServer.hpp index 76adedfb..7e47687f 100644 --- a/src/DebugServers/DebugServer.hpp +++ b/src/DebugServers/DebugServer.hpp @@ -8,7 +8,7 @@ #include "src/EventManager/Events/Events.hpp" #include "src/EventManager/EventManager.hpp" #include "src/Exceptions/DebugServerInterrupted.hpp" -#include "src/ApplicationConfig.hpp" +#include "src/ProjectConfig.hpp" #include "src/Helpers/Thread.hpp" #include "src/Targets/TargetDescriptor.hpp" #include "src/Targets/TargetRegister.hpp" @@ -31,8 +31,8 @@ namespace Bloom::DebugServers explicit DebugServer(EventManager& eventManager): eventManager(eventManager) {}; virtual ~DebugServer() = default; - void setApplicationConfig(const ApplicationConfig& applicationConfig) { - this->applicationConfig = applicationConfig; + void setProjectConfig(const ProjectConfig& projectConfig) { + this->projectConfig = projectConfig; } void setEnvironmentConfig(const EnvironmentConfig& environmentConfig) { @@ -67,7 +67,7 @@ namespace Bloom::DebugServers */ std::shared_ptr interruptEventNotifier = nullptr; - ApplicationConfig applicationConfig; + ProjectConfig projectConfig; EnvironmentConfig environmentConfig; DebugServerConfig debugServerConfig; diff --git a/src/DebugToolDrivers/TargetInterfaces/Microchip/AVR/AVR8/Avr8Interface.hpp b/src/DebugToolDrivers/TargetInterfaces/Microchip/AVR/AVR8/Avr8Interface.hpp index fe1a48d1..e2dbb14b 100644 --- a/src/DebugToolDrivers/TargetInterfaces/Microchip/AVR/AVR8/Avr8Interface.hpp +++ b/src/DebugToolDrivers/TargetInterfaces/Microchip/AVR/AVR8/Avr8Interface.hpp @@ -9,7 +9,7 @@ #include "src/Targets/TargetState.hpp" #include "src/Targets/TargetRegister.hpp" #include "src/Targets/TargetMemory.hpp" -#include "src/ApplicationConfig.hpp" +#include "src/ProjectConfig.hpp" namespace Bloom::DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8 { diff --git a/src/Insight/Insight.hpp b/src/Insight/Insight.hpp index 4c316bcf..e7ced041 100644 --- a/src/Insight/Insight.hpp +++ b/src/Insight/Insight.hpp @@ -6,7 +6,7 @@ #include "src/Helpers/Thread.hpp" #include "src/TargetController/TargetControllerConsole.hpp" #include "src/Helpers/Paths.hpp" -#include "src/ApplicationConfig.hpp" +#include "src/ProjectConfig.hpp" #include "src/EventManager/EventManager.hpp" #include "src/EventManager/EventListener.hpp" @@ -49,8 +49,8 @@ namespace Bloom ) ) {}; - void setApplicationConfig(const ApplicationConfig& applicationConfig) { - this->applicationConfig = applicationConfig; + void setProjectConfig(const ProjectConfig& projectConfig) { + this->projectConfig = projectConfig; } void setEnvironmentConfig(const EnvironmentConfig& environmentConfig) { @@ -71,7 +71,7 @@ namespace Bloom std::array qtApplicationArgv = {this->qtApplicationName.data()}; int qtApplicationArgc = 1; - ApplicationConfig applicationConfig; + ProjectConfig projectConfig; EnvironmentConfig environmentConfig; InsightConfig insightConfig; diff --git a/src/Insight/InsightWorker/InsightWorker.hpp b/src/Insight/InsightWorker/InsightWorker.hpp index e18f754e..312047fb 100644 --- a/src/Insight/InsightWorker/InsightWorker.hpp +++ b/src/Insight/InsightWorker/InsightWorker.hpp @@ -5,7 +5,7 @@ #include "src/Helpers/Thread.hpp" #include "src/Helpers/SyncSafe.hpp" -#include "src/ApplicationConfig.hpp" +#include "src/ProjectConfig.hpp" #include "src/EventManager/EventManager.hpp" #include "src/EventManager/EventListener.hpp" #include "src/TargetController/TargetControllerConsole.hpp" diff --git a/src/Insight/UserInterfaces/InsightWindow/InsightWindow.hpp b/src/Insight/UserInterfaces/InsightWindow/InsightWindow.hpp index 081363e1..2cba3fd6 100644 --- a/src/Insight/UserInterfaces/InsightWindow/InsightWindow.hpp +++ b/src/Insight/UserInterfaces/InsightWindow/InsightWindow.hpp @@ -6,7 +6,7 @@ #include #include -#include "src/ApplicationConfig.hpp" +#include "src/ProjectConfig.hpp" #include "src/Insight/InsightWorker/InsightWorker.hpp" #include "src/Targets/TargetState.hpp" diff --git a/src/Logger/Logger.cpp b/src/Logger/Logger.cpp index 7642be33..275404dc 100644 --- a/src/Logger/Logger.cpp +++ b/src/Logger/Logger.cpp @@ -4,8 +4,8 @@ using namespace Bloom; -void Logger::configure(ApplicationConfig& applicationConfig) { - if (applicationConfig.debugLoggingEnabled) { +void Logger::configure(ProjectConfig& projectConfig) { + if (projectConfig.debugLoggingEnabled) { Logger::debugPrintingEnabled = true; Logger::debug("Debug log printing has been enabled."); } diff --git a/src/Logger/Logger.hpp b/src/Logger/Logger.hpp index ae1a778e..124ff95b 100644 --- a/src/Logger/Logger.hpp +++ b/src/Logger/Logger.hpp @@ -7,7 +7,7 @@ #include #include -#include "src/ApplicationConfig.hpp" +#include "src/ProjectConfig.hpp" #include "src/Helpers/DateTime.hpp" namespace Bloom @@ -53,7 +53,7 @@ namespace Bloom class Logger { public: - static void configure(ApplicationConfig& applicationConfig); + static void configure(ProjectConfig& projectConfig); static void silence(); diff --git a/src/ApplicationConfig.cpp b/src/ProjectConfig.cpp similarity index 97% rename from src/ApplicationConfig.cpp rename to src/ProjectConfig.cpp index 3022b639..09fa0c4e 100644 --- a/src/ApplicationConfig.cpp +++ b/src/ProjectConfig.cpp @@ -1,11 +1,11 @@ -#include "ApplicationConfig.hpp" +#include "ProjectConfig.hpp" #include "src/Logger/Logger.hpp" #include "src/Exceptions/InvalidConfig.hpp" using namespace Bloom; -void ApplicationConfig::init(const QJsonObject& jsonObject) { +void ProjectConfig::init(const QJsonObject& jsonObject) { if (!jsonObject.contains("environments")) { throw Exceptions::InvalidConfig( "No environments found - please review the bloom.json configuration file and ensure that " diff --git a/src/ApplicationConfig.hpp b/src/ProjectConfig.hpp similarity index 98% rename from src/ApplicationConfig.hpp rename to src/ProjectConfig.hpp index bd58c54c..a6a7f346 100644 --- a/src/ApplicationConfig.hpp +++ b/src/ProjectConfig.hpp @@ -16,7 +16,7 @@ namespace Bloom * can define multiple debugging environments, each object should be assigned a key in the config file. We use this * key to allow users to select different debugging environments between debugging sessions. * - * On application startup, we extract the config from this JSON file and generate an ApplicationConfig object. + * On application startup, we extract the config from this JSON file and generate an ProjectConfig object. * See Application::extractConfig() for more on this. * * Some config parameters are specific to certain entities within Bloom, but have no significance across the @@ -174,9 +174,9 @@ namespace Bloom }; /** - * This holds all user provided application configuration. + * This holds all user provided project configuration. */ - struct ApplicationConfig + struct ProjectConfig { /** * Obtains config parameters from JSON object. diff --git a/src/TargetController/TargetController.hpp b/src/TargetController/TargetController.hpp index 90d90530..c87f9d98 100644 --- a/src/TargetController/TargetController.hpp +++ b/src/TargetController/TargetController.hpp @@ -36,8 +36,8 @@ namespace Bloom public: explicit TargetController(EventManager& eventManager): eventManager(eventManager) {}; - void setApplicationConfig(const ApplicationConfig& applicationConfig) { - this->applicationConfig = applicationConfig; + void setProjectConfig(const ProjectConfig& projectConfig) { + this->projectConfig = projectConfig; } void setEnvironmentConfig(const EnvironmentConfig& environmentConfig) { @@ -55,7 +55,7 @@ namespace Bloom */ TargetControllerState state = TargetControllerState::SUSPENDED; - ApplicationConfig applicationConfig; + ProjectConfig projectConfig; EnvironmentConfig environmentConfig; /** diff --git a/src/Targets/Microchip/AVR/AVR8/Avr8.hpp b/src/Targets/Microchip/AVR/AVR8/Avr8.hpp index 407545e7..7a680116 100644 --- a/src/Targets/Microchip/AVR/AVR8/Avr8.hpp +++ b/src/Targets/Microchip/AVR/AVR8/Avr8.hpp @@ -8,7 +8,7 @@ #include "src/Targets/Microchip/AVR/Target.hpp" #include "src/Targets/TargetRegister.hpp" #include "src/DebugToolDrivers/DebugTool.hpp" -#include "src/ApplicationConfig.hpp" +#include "src/ProjectConfig.hpp" #include "src/Exceptions/Exception.hpp" #include "TargetParameters.hpp" diff --git a/src/Targets/Target.hpp b/src/Targets/Target.hpp index 6996c0e9..e6c72877 100644 --- a/src/Targets/Target.hpp +++ b/src/Targets/Target.hpp @@ -7,7 +7,7 @@ #include #include -#include "src/ApplicationConfig.hpp" +#include "src/ProjectConfig.hpp" #include "TargetDescriptor.hpp" #include "TargetState.hpp"