Moved Paths helper functions to service class

This commit is contained in:
Nav
2022-12-26 21:47:09 +00:00
parent 4c25c85c36
commit 8fa7e82c56
36 changed files with 131 additions and 125 deletions

View File

@@ -36,13 +36,13 @@ if (${CMAKE_BUILD_TYPE} MATCHES "Debug")
# a lot easier, as it removes the need to recompile for each tweak. # a lot easier, as it removes the need to recompile for each tweak.
# CAUTION: Although convenient, this does add a limitation; the debug build can only be run on the same machine # CAUTION: Although convenient, this does add a limitation; the debug build can only be run on the same machine
# that compiled it. Or a machine that has the Bloom source located in the same place. # that compiled it. Or a machine that has the Bloom source located in the same place.
# See Paths::compiledResourcesPath() for more. # See Services::PathService::compiledResourcesPath() for more.
add_compile_definitions(BLOOM_COMPILED_RESOURCES_PATH_OVERRIDE="${CMAKE_CURRENT_SOURCE_DIR}") add_compile_definitions(BLOOM_COMPILED_RESOURCES_PATH_OVERRIDE="${CMAKE_CURRENT_SOURCE_DIR}")
# BLOOM_HOME_DOMAIN_NAME_OVERRIDE can be used to override the domain name used in URLs to the Bloom website. # BLOOM_HOME_DOMAIN_NAME_OVERRIDE can be used to override the domain name used in URLs to the Bloom website.
# I (Nav) use this in debug builds, so I can test local changes that involve the Bloom website as well as Bloom # I (Nav) use this in debug builds, so I can test local changes that involve the Bloom website as well as Bloom
# itself. Other users can comment out this override if they don't have a copy of the Bloom website running on their # itself. Other users can comment out this override if they don't have a copy of the Bloom website running on their
# local machine. See Paths::homeDomainName() for more. # local machine. See Services::PathService::homeDomainName() for more.
add_compile_definitions(BLOOM_HOME_DOMAIN_NAME_OVERRIDE="http://bloom.local") add_compile_definitions(BLOOM_HOME_DOMAIN_NAME_OVERRIDE="http://bloom.local")
# CMAKE_BUILD_RPATH needs to point to the local Qt installation, to use Gammaray during development. # CMAKE_BUILD_RPATH needs to point to the local Qt installation, to use Gammaray during development.

View File

@@ -10,7 +10,7 @@
#include "src/Services/ProcessService.hpp" #include "src/Services/ProcessService.hpp"
#include "src/Logger/Logger.hpp" #include "src/Logger/Logger.hpp"
#include "src/Helpers/Paths.hpp" #include "src/Services/PathService.hpp"
#include "src/Exceptions/InvalidConfig.hpp" #include "src/Exceptions/InvalidConfig.hpp"
@@ -178,7 +178,7 @@ namespace Bloom
} }
void Application::loadProjectSettings() { void Application::loadProjectSettings() {
const auto projectSettingsPath = Paths::projectSettingsPath(); const auto projectSettingsPath = Services::PathService::projectSettingsPath();
auto jsonSettingsFile = QFile(QString::fromStdString(projectSettingsPath)); auto jsonSettingsFile = QFile(QString::fromStdString(projectSettingsPath));
if (jsonSettingsFile.exists()) { if (jsonSettingsFile.exists()) {
@@ -209,12 +209,12 @@ namespace Bloom
return; return;
} }
const auto projectSettingsPath = Paths::projectSettingsPath(); const auto projectSettingsPath = Services::PathService::projectSettingsPath();
auto jsonSettingsFile = QFile(QString::fromStdString(projectSettingsPath)); auto jsonSettingsFile = QFile(QString::fromStdString(projectSettingsPath));
Logger::debug("Saving project settings to " + projectSettingsPath); Logger::debug("Saving project settings to " + projectSettingsPath);
QDir().mkpath(QString::fromStdString(Paths::projectSettingsDirPath())); QDir().mkpath(QString::fromStdString(Services::PathService::projectSettingsDirPath()));
try { try {
const auto jsonDocument = QJsonDocument(this->projectSettings->toJson()); const auto jsonDocument = QJsonDocument(this->projectSettings->toJson());
@@ -236,11 +236,11 @@ namespace Bloom
} }
void Application::loadProjectConfiguration() { void Application::loadProjectConfiguration() {
auto configFile = QFile(QString::fromStdString(Paths::projectConfigPath())); auto configFile = QFile(QString::fromStdString(Services::PathService::projectConfigPath()));
if (!configFile.exists()) { if (!configFile.exists()) {
// Try looking for the old bloom.json config file // Try looking for the old bloom.json config file
configFile.setFileName(QString::fromStdString(Paths::projectDirPath()) + "/bloom.json"); configFile.setFileName(QString::fromStdString(Services::PathService::projectDirPath()) + "/bloom.json");
if (configFile.exists()) { if (configFile.exists()) {
Logger::warning( Logger::warning(
@@ -252,14 +252,14 @@ namespace Bloom
} else { } else {
throw InvalidConfig( throw InvalidConfig(
"Bloom configuration file (bloom.yaml) not found. Working directory: " + Paths::projectDirPath() "Bloom configuration file (bloom.yaml) not found. Working directory: " + Services::PathService::projectDirPath()
); );
} }
} }
if (!configFile.open(QIODevice::ReadOnly | QIODevice::Text)) { if (!configFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
throw InvalidConfig( throw InvalidConfig(
"Failed to open Bloom configuration file. Working directory: " + Paths::projectDirPath() "Failed to open Bloom configuration file. Working directory: " + Services::PathService::projectDirPath()
); );
} }
@@ -312,12 +312,12 @@ namespace Bloom
Logger::silence(); Logger::silence();
// The file help.txt is included in Bloom's binary, as a resource. See the root-level CMakeLists.txt for more. // The file help.txt is included in Bloom's binary, as a resource. See the root-level CMakeLists.txt for more.
auto helpFile = QFile(QString::fromStdString(Paths::compiledResourcesPath() + "/resources/help.txt")); auto helpFile = QFile(QString::fromStdString(Services::PathService::compiledResourcesPath() + "/resources/help.txt"));
if (!helpFile.open(QIODevice::ReadOnly)) { if (!helpFile.open(QIODevice::ReadOnly)) {
// This should never happen - if it does, something has gone very wrong // This should never happen - if it does, something has gone very wrong
throw Exception( throw Exception(
"Failed to open help file - please report this issue at " + Paths::homeDomainName() "Failed to open help file - please report this issue at " + Services::PathService::homeDomainName()
+ "/report-issue" + "/report-issue"
); );
} }
@@ -336,7 +336,7 @@ namespace Bloom
std::cout << "DEBUG BUILD - Compilation timestamp: " << __DATE__ << " " << __TIME__ << "\n"; std::cout << "DEBUG BUILD - Compilation timestamp: " << __DATE__ << " " << __TIME__ << "\n";
#endif #endif
std::cout << Paths::homeDomainName() + "/\n"; std::cout << Services::PathService::homeDomainName() + "/\n";
std::cout << "Nav Mohammed\n"; std::cout << "Nav Mohammed\n";
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
@@ -357,7 +357,7 @@ namespace Bloom
} }
int Application::initProject() { int Application::initProject() {
auto configFile = QFile(QString::fromStdString(Paths::projectConfigPath())); auto configFile = QFile(QString::fromStdString(Services::PathService::projectConfigPath()));
if (configFile.exists()) { if (configFile.exists()) {
throw Exception("Bloom configuration file (bloom.yaml) already exists in working directory."); throw Exception("Bloom configuration file (bloom.yaml) already exists in working directory.");
@@ -370,13 +370,13 @@ namespace Bloom
* We simply copy the template file into the user's working directory. * We simply copy the template file into the user's working directory.
*/ */
auto templateConfigFile = QFile( auto templateConfigFile = QFile(
QString::fromStdString(Paths::compiledResourcesPath()+ "/resources/bloom.template.yaml") QString::fromStdString(Services::PathService::compiledResourcesPath()+ "/resources/bloom.template.yaml")
); );
if (!templateConfigFile.open(QIODevice::ReadOnly)) { if (!templateConfigFile.open(QIODevice::ReadOnly)) {
throw Exception( throw Exception(
"Failed to open template configuration file - please report this issue at " "Failed to open template configuration file - please report this issue at "
+ Paths::homeDomainName() + "/report-issue" + Services::PathService::homeDomainName() + "/report-issue"
); );
} }

View File

@@ -6,11 +6,11 @@ target_sources(
# Services # Services
${CMAKE_CURRENT_SOURCE_DIR}/Services/TargetControllerService.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Services/TargetControllerService.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Services/PathService.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Services/ProcessService.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Services/ProcessService.cpp
# Helpers & other # Helpers & other
${CMAKE_CURRENT_SOURCE_DIR}/Logger/Logger.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Logger/Logger.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Helpers/Paths.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Helpers/String.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Helpers/String.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Helpers/EpollInstance.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Helpers/EpollInstance.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Helpers/EventFdNotifier.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Helpers/EventFdNotifier.cpp

View File

@@ -7,7 +7,7 @@
#include "src/Application.hpp" #include "src/Application.hpp"
#include "src/Helpers/Paths.hpp" #include "src/Services/PathService.hpp"
#include "src/Helpers/String.hpp" #include "src/Helpers/String.hpp"
#include "src/Logger/Logger.hpp" #include "src/Logger/Logger.hpp"
@@ -32,7 +32,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
debugSession.connection.writePacket(ResponsePacket(String::toHex( debugSession.connection.writePacket(ResponsePacket(String::toHex(
std::string( std::string(
"Bloom v" + Application::VERSION.toString() + "\n" "Bloom v" + Application::VERSION.toString() + "\n"
+ Paths::homeDomainName() + "\n" + Services::PathService::homeDomainName() + "\n"
+ "Nav Mohammed\n" + "Nav Mohammed\n"
) )
))); )));

View File

@@ -9,7 +9,7 @@
#include "src/Targets/TargetMemory.hpp" #include "src/Targets/TargetMemory.hpp"
#include "src/Application.hpp" #include "src/Application.hpp"
#include "src/Helpers/Paths.hpp" #include "src/Services/PathService.hpp"
#include "src/Helpers/String.hpp" #include "src/Helpers/String.hpp"
#include "src/Logger/Logger.hpp" #include "src/Logger/Logger.hpp"
@@ -46,7 +46,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
return; return;
} }
const auto svdOutputFilePath = Paths::projectDirPath() + "/" + targetDescriptor.name + ".svd"; const auto svdOutputFilePath = Services::PathService::projectDirPath() + "/" + targetDescriptor.name + ".svd";
auto outputFile = QFile(QString::fromStdString(svdOutputFilePath)); auto outputFile = QFile(QString::fromStdString(svdOutputFilePath));
if (!outputFile.open(QIODevice::ReadWrite | QIODevice::Truncate | QIODevice::Text)) { if (!outputFile.open(QIODevice::ReadWrite | QIODevice::Truncate | QIODevice::Text)) {
@@ -102,7 +102,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
deviceElement.setAttribute("xmlns:xs", "http://www.w3.org/2001/XMLSchema-instance"); deviceElement.setAttribute("xmlns:xs", "http://www.w3.org/2001/XMLSchema-instance");
deviceElement.setAttribute( deviceElement.setAttribute(
"xs:noNamespaceSchemaLocation", "xs:noNamespaceSchemaLocation",
QString::fromStdString(Paths::homeDomainName() + "/assets/svd-schema.xsd") QString::fromStdString(Services::PathService::homeDomainName() + "/assets/svd-schema.xsd")
); );
deviceElement.appendChild(createElement("vendor", QString::fromStdString(targetDescriptor.vendorName))); deviceElement.appendChild(createElement("vendor", QString::fromStdString(targetDescriptor.vendorName)));

View File

@@ -6,7 +6,7 @@
#include "src/DebugServer/Gdb/ResponsePackets/ErrorResponsePacket.hpp" #include "src/DebugServer/Gdb/ResponsePackets/ErrorResponsePacket.hpp"
#include "src/DebugServer/Gdb/ResponsePackets/ResponsePacket.hpp" #include "src/DebugServer/Gdb/ResponsePackets/ResponsePacket.hpp"
#include "src/Helpers/Paths.hpp" #include "src/Services/PathService.hpp"
#include "src/Helpers/String.hpp" #include "src/Helpers/String.hpp"
#include "src/Logger/Logger.hpp" #include "src/Logger/Logger.hpp"
@@ -35,13 +35,13 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
*/ */
auto helpFile = QFile( auto helpFile = QFile(
QString::fromStdString( QString::fromStdString(
Paths::compiledResourcesPath() + "/src/DebugServer/Gdb/Resources/GdbHelpMonitorInfo.txt" Services::PathService::compiledResourcesPath() + "/src/DebugServer/Gdb/Resources/GdbHelpMonitorInfo.txt"
) )
); );
if (!helpFile.open(QIODevice::ReadOnly)) { if (!helpFile.open(QIODevice::ReadOnly)) {
throw Exception( throw Exception(
"Failed to open GDB monitor info help file - please report this issue at " + Paths::homeDomainName() "Failed to open GDB monitor info help file - please report this issue at " + Services::PathService::homeDomainName()
+ "/report-issue" + "/report-issue"
); );
} }

View File

@@ -3,9 +3,9 @@
#include <thread> #include <thread>
#include <cmath> #include <cmath>
#include "src/Logger/Logger.hpp" #include "src/Services/PathService.hpp"
#include "src/Helpers/Paths.hpp"
#include "src/Helpers/String.hpp" #include "src/Helpers/String.hpp"
#include "src/Logger/Logger.hpp"
#include "src/Exceptions/InvalidConfig.hpp" #include "src/Exceptions/InvalidConfig.hpp"
#include "src/TargetController/Exceptions/DeviceInitializationFailure.hpp" #include "src/TargetController/Exceptions/DeviceInitializationFailure.hpp"
@@ -272,7 +272,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
throw DebugWirePhysicalInterfaceError( throw DebugWirePhysicalInterfaceError(
"Failed to activate the debugWire physical interface - check target connection. " "Failed to activate the debugWire physical interface - check target connection. "
"If the target was recently programmed via ISP, try cycling the target power. See " "If the target was recently programmed via ISP, try cycling the target power. See "
+ Paths::homeDomainName() + "/docs/debugging-avr-debugwire for more information." + Services::PathService::homeDomainName() + "/docs/debugging-avr-debugwire for more information."
); );
} }

View File

@@ -85,6 +85,7 @@ target_sources(
${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotManager.cpp ${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/MemorySnapshotItem.cpp ${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/MemorySnapshotItem.cpp
${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/CreateSnapshotWindow/CreateSnapshotWindow.cpp ${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/CreateSnapshotWindow/CreateSnapshotWindow.cpp
${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotViewer/SnapshotViewer.cpp
# Memory region manager window # Memory region manager window
${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemoryRegionManager/MemoryRegionManagerWindow.cpp ${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemoryRegionManager/MemoryRegionManagerWindow.cpp
@@ -110,6 +111,7 @@ qt_add_resources(
"./UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/UiFiles/HexViewerWidget.ui" "./UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/UiFiles/HexViewerWidget.ui"
"./UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/UiFiles/SnapshotManager.ui" "./UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/UiFiles/SnapshotManager.ui"
"./UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/CreateSnapshotWindow/UiFiles/CreateSnapshotWindow.ui" "./UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/CreateSnapshotWindow/UiFiles/CreateSnapshotWindow.ui"
"./UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotViewer/UiFiles/SnapshotViewer.ui"
"./UserInterfaces/InsightWindow/Images/bloom-icon.svg" "./UserInterfaces/InsightWindow/Images/bloom-icon.svg"
"./UserInterfaces/InsightWindow/Images/RAM.svg" "./UserInterfaces/InsightWindow/Images/RAM.svg"
"./UserInterfaces/InsightWindow/Images/refresh.svg" "./UserInterfaces/InsightWindow/Images/refresh.svg"

View File

@@ -9,7 +9,7 @@
#include <QUrlQuery> #include <QUrlQuery>
#include <QJsonDocument> #include <QJsonDocument>
#include "src/Helpers/Paths.hpp" #include "src/Services/PathService.hpp"
#include "src/Logger/Logger.hpp" #include "src/Logger/Logger.hpp"
#include "UserInterfaces/InsightWindow/BloomProxyStyle.hpp" #include "UserInterfaces/InsightWindow/BloomProxyStyle.hpp"
@@ -39,7 +39,11 @@ namespace Bloom
( (
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true), QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true),
#ifndef BLOOM_DEBUG_BUILD #ifndef BLOOM_DEBUG_BUILD
<<<<<<< HEAD
QCoreApplication::addLibraryPath(QString::fromStdString(Paths::applicationDirPath() + "/../plugins")), QCoreApplication::addLibraryPath(QString::fromStdString(Paths::applicationDirPath() + "/../plugins")),
=======
QCoreApplication::addLibraryPath(QString::fromStdString(Services::PathService::applicationDirPath() + "/plugins")),
>>>>>>> 0fea8bc1 (Moved Paths helper functions to service class)
#endif #endif
QApplication(this->qtApplicationArgc, this->qtApplicationArgv.data()) QApplication(this->qtApplicationArgc, this->qtApplicationArgv.data())
) )
@@ -107,7 +111,7 @@ namespace Bloom
auto globalStylesheet = QFile( auto globalStylesheet = QFile(
QString::fromStdString( QString::fromStdString(
Paths::compiledResourcesPath() + "/src/Insight/UserInterfaces/InsightWindow/Stylesheets/Global.qss" Services::PathService::compiledResourcesPath() + "/src/Insight/UserInterfaces/InsightWindow/Stylesheets/Global.qss"
) )
); );
@@ -125,46 +129,46 @@ namespace Bloom
// Load Ubuntu fonts // Load Ubuntu fonts
QFontDatabase::addApplicationFont( QFontDatabase::addApplicationFont(
QString::fromStdString(Paths::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-B.ttf") QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-B.ttf")
); );
QFontDatabase::addApplicationFont( QFontDatabase::addApplicationFont(
QString::fromStdString(Paths::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-BI.ttf") QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-BI.ttf")
); );
QFontDatabase::addApplicationFont( QFontDatabase::addApplicationFont(
QString::fromStdString(Paths::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-C.ttf") QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-C.ttf")
); );
QFontDatabase::addApplicationFont( QFontDatabase::addApplicationFont(
QString::fromStdString(Paths::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-L.ttf") QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-L.ttf")
); );
QFontDatabase::addApplicationFont( QFontDatabase::addApplicationFont(
QString::fromStdString(Paths::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-LI.ttf") QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-LI.ttf")
); );
QFontDatabase::addApplicationFont( QFontDatabase::addApplicationFont(
QString::fromStdString(Paths::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-M.ttf") QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-M.ttf")
); );
QFontDatabase::addApplicationFont( QFontDatabase::addApplicationFont(
QString::fromStdString(Paths::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-MI.ttf") QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-MI.ttf")
); );
QFontDatabase::addApplicationFont( QFontDatabase::addApplicationFont(
QString::fromStdString(Paths::resourcesDirPath() + "/fonts/Ubuntu/UbuntuMono-B.ttf") QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/UbuntuMono-B.ttf")
); );
QFontDatabase::addApplicationFont( QFontDatabase::addApplicationFont(
QString::fromStdString(Paths::resourcesDirPath() + "/fonts/Ubuntu/UbuntuMono-BI.ttf") QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/UbuntuMono-BI.ttf")
); );
QFontDatabase::addApplicationFont( QFontDatabase::addApplicationFont(
QString::fromStdString(Paths::resourcesDirPath() + "/fonts/Ubuntu/UbuntuMono-R.ttf") QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/UbuntuMono-R.ttf")
); );
QFontDatabase::addApplicationFont( QFontDatabase::addApplicationFont(
QString::fromStdString(Paths::resourcesDirPath() + "/fonts/Ubuntu/UbuntuMono-RI.ttf") QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/UbuntuMono-RI.ttf")
); );
QFontDatabase::addApplicationFont( QFontDatabase::addApplicationFont(
QString::fromStdString(Paths::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-R.ttf") QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-R.ttf")
); );
QFontDatabase::addApplicationFont( QFontDatabase::addApplicationFont(
QString::fromStdString(Paths::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-RI.ttf") QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-RI.ttf")
); );
QFontDatabase::addApplicationFont( QFontDatabase::addApplicationFont(
QString::fromStdString(Paths::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-Th.ttf") QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-Th.ttf")
); );
/* /*
@@ -238,7 +242,7 @@ namespace Bloom
const auto currentVersionNumber = Application::VERSION; const auto currentVersionNumber = Application::VERSION;
auto* networkAccessManager = new QNetworkAccessManager(this); auto* networkAccessManager = new QNetworkAccessManager(this);
auto queryVersionEndpointUrl = QUrl(QString::fromStdString(Paths::homeDomainName() + "/latest-version")); auto queryVersionEndpointUrl = QUrl(QString::fromStdString(Services::PathService::homeDomainName() + "/latest-version"));
queryVersionEndpointUrl.setScheme("http"); queryVersionEndpointUrl.setScheme("http");
queryVersionEndpointUrl.setQuery(QUrlQuery({ queryVersionEndpointUrl.setQuery(QUrlQuery({
{"currentVersionNumber", QString::fromStdString(currentVersionNumber.toString())} {"currentVersionNumber", QString::fromStdString(currentVersionNumber.toString())}
@@ -255,7 +259,7 @@ namespace Bloom
if (latestVersionNumber > currentVersionNumber) { if (latestVersionNumber > currentVersionNumber) {
Logger::warning( Logger::warning(
"Bloom v" + latestVersionNumber.toString() "Bloom v" + latestVersionNumber.toString()
+ " is available to download - upgrade via " + Paths::homeDomainName() + " is available to download - upgrade via " + Services::PathService::homeDomainName()
); );
} }
} }

View File

@@ -9,7 +9,7 @@
#include <QTimer> #include <QTimer>
#include "src/Helpers/Thread.hpp" #include "src/Helpers/Thread.hpp"
#include "src/Helpers/Paths.hpp" #include "src/Services/PathService.hpp"
#include "src/ProjectConfig.hpp" #include "src/ProjectConfig.hpp"
#include "src/ProjectSettings.hpp" #include "src/ProjectSettings.hpp"

View File

@@ -4,7 +4,7 @@
#include <QDir> #include <QDir>
#include <QJsonDocument> #include <QJsonDocument>
#include "src/Helpers/Paths.hpp" #include "src/Services/PathService.hpp"
#include "src/Helpers/EnumToStringMappings.hpp" #include "src/Helpers/EnumToStringMappings.hpp"
#include "src/Logger/Logger.hpp" #include "src/Logger/Logger.hpp"
@@ -83,7 +83,7 @@ namespace Bloom
std::move(this->excludedRegions) std::move(this->excludedRegions)
); );
const auto snapshotDirPath = QString::fromStdString(Paths::projectSettingsDirPath()) const auto snapshotDirPath = QString::fromStdString(Services::PathService::projectSettingsDirPath())
+ "/memory_snapshots/" + EnumToStringMappings::targetMemoryTypes.at(snapshot.memoryType); + "/memory_snapshots/" + EnumToStringMappings::targetMemoryTypes.at(snapshot.memoryType);
QDir().mkpath(snapshotDirPath); QDir().mkpath(snapshotDirPath);

View File

@@ -5,7 +5,7 @@
#include <QStringList> #include <QStringList>
#include <QJsonDocument> #include <QJsonDocument>
#include "src/Helpers/Paths.hpp" #include "src/Services/PathService.hpp"
#include "src/Helpers/EnumToStringMappings.hpp" #include "src/Helpers/EnumToStringMappings.hpp"
#include "src/Exceptions/Exception.hpp" #include "src/Exceptions/Exception.hpp"
#include "src/Logger/Logger.hpp" #include "src/Logger/Logger.hpp"
@@ -23,7 +23,7 @@ namespace Bloom
} }
std::vector<MemorySnapshot> RetrieveMemorySnapshots::getSnapshots(Targets::TargetMemoryType memoryType) { std::vector<MemorySnapshot> RetrieveMemorySnapshots::getSnapshots(Targets::TargetMemoryType memoryType) {
auto snapshotDir = QDir(QString::fromStdString(Paths::projectSettingsDirPath()) auto snapshotDir = QDir(QString::fromStdString(Services::PathService::projectSettingsDirPath())
+ "/memory_snapshots/" + EnumToStringMappings::targetMemoryTypes.at(memoryType)); + "/memory_snapshots/" + EnumToStringMappings::targetMemoryTypes.at(memoryType));
if (!snapshotDir.exists()) { if (!snapshotDir.exists()) {

View File

@@ -5,7 +5,7 @@
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/Label.hpp" #include "src/Insight/UserInterfaces/InsightWindow/Widgets/Label.hpp"
#include "src/Exceptions/Exception.hpp" #include "src/Exceptions/Exception.hpp"
#include "src/Helpers/Paths.hpp" #include "src/Services/PathService.hpp"
#include "src/Application.hpp" #include "src/Application.hpp"
namespace Bloom namespace Bloom
@@ -14,12 +14,12 @@ namespace Bloom
AboutWindow::AboutWindow(QWidget* parent): QObject(parent) { AboutWindow::AboutWindow(QWidget* parent): QObject(parent) {
auto aboutWindowUiFile = QFile(QString::fromStdString( auto aboutWindowUiFile = QFile(QString::fromStdString(
Paths::compiledResourcesPath() Services::PathService::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/UiFiles/AboutWindow.ui" + "/src/Insight/UserInterfaces/InsightWindow/UiFiles/AboutWindow.ui"
) )
); );
auto aboutWindowStylesheet = QFile(QString::fromStdString( auto aboutWindowStylesheet = QFile(QString::fromStdString(
Paths::compiledResourcesPath() Services::PathService::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/Stylesheets/AboutWindow.qss" + "/src/Insight/UserInterfaces/InsightWindow/Stylesheets/AboutWindow.qss"
) )
); );

View File

@@ -12,7 +12,7 @@
#include "src/Logger/Logger.hpp" #include "src/Logger/Logger.hpp"
#include "src/Exceptions/Exception.hpp" #include "src/Exceptions/Exception.hpp"
#include "src/Helpers/Paths.hpp" #include "src/Services/PathService.hpp"
#include "src/Targets/TargetMemory.hpp" #include "src/Targets/TargetMemory.hpp"
@@ -60,12 +60,12 @@ namespace Bloom
} }
auto mainWindowUiFile = QFile( auto mainWindowUiFile = QFile(
QString::fromStdString(Paths::compiledResourcesPath() QString::fromStdString(Services::PathService::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/UiFiles/InsightWindow.ui" + "/src/Insight/UserInterfaces/InsightWindow/UiFiles/InsightWindow.ui"
) )
); );
auto mainWindowStylesheet = QFile( auto mainWindowStylesheet = QFile(
QString::fromStdString(Paths::compiledResourcesPath() QString::fromStdString(Services::PathService::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/Stylesheets/InsightWindow.qss" + "/src/Insight/UserInterfaces/InsightWindow/Stylesheets/InsightWindow.qss"
) )
); );
@@ -86,7 +86,7 @@ namespace Bloom
mainWindowStylesheet.close(); mainWindowStylesheet.close();
QApplication::setWindowIcon(QIcon( QApplication::setWindowIcon(QIcon(
QString::fromStdString(Paths::compiledResourcesPath() QString::fromStdString(Services::PathService::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/Images/bloom-icon.svg" + "/src/Insight/UserInterfaces/InsightWindow/Images/bloom-icon.svg"
) )
)); ));
@@ -937,7 +937,7 @@ namespace Bloom
} }
void InsightWindow::openReportIssuesUrl() { void InsightWindow::openReportIssuesUrl() {
auto url = QUrl(QString::fromStdString(Paths::homeDomainName() + "/report-issue")); auto url = QUrl(QString::fromStdString(Services::PathService::homeDomainName() + "/report-issue"));
/* /*
* The https://bloom.oscillate.io/report-issue URL just redirects to the Bloom GitHub issue page. * The https://bloom.oscillate.io/report-issue URL just redirects to the Bloom GitHub issue page.
* *
@@ -963,7 +963,7 @@ namespace Bloom
void InsightWindow::openGettingStartedUrl() { void InsightWindow::openGettingStartedUrl() {
QDesktopServices::openUrl( QDesktopServices::openUrl(
QUrl(QString::fromStdString(Paths::homeDomainName() + "/docs/getting-started")) QUrl(QString::fromStdString(Services::PathService::homeDomainName() + "/docs/getting-started"))
); );
} }

View File

@@ -4,7 +4,7 @@
#include <QFile> #include <QFile>
#include "src/Insight/UserInterfaces/InsightWindow/UiLoader.hpp" #include "src/Insight/UserInterfaces/InsightWindow/UiLoader.hpp"
#include "src/Helpers/Paths.hpp" #include "src/Services/PathService.hpp"
#include "src/Exceptions/Exception.hpp" #include "src/Exceptions/Exception.hpp"
namespace Bloom::Widgets namespace Bloom::Widgets
@@ -23,13 +23,13 @@ namespace Bloom::Widgets
this->setWindowTitle(windowTitle); this->setWindowTitle(windowTitle);
auto dialogueUiFile = QFile( auto dialogueUiFile = QFile(
QString::fromStdString(Paths::compiledResourcesPath() QString::fromStdString(Services::PathService::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/Widgets/ErrorDialogue/UiFiles/ErrorDialogue.ui" + "/src/Insight/UserInterfaces/InsightWindow/Widgets/ErrorDialogue/UiFiles/ErrorDialogue.ui"
) )
); );
auto dialogueStylesheet = QFile( auto dialogueStylesheet = QFile(
QString::fromStdString(Paths::compiledResourcesPath() QString::fromStdString(Services::PathService::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/Widgets/ErrorDialogue/Stylesheets/ErrorDialogue.qss" + "/src/Insight/UserInterfaces/InsightWindow/Widgets/ErrorDialogue/Stylesheets/ErrorDialogue.qss"
) )
); );

View File

@@ -5,7 +5,7 @@
#include "src/Insight/UserInterfaces/InsightWindow/UiLoader.hpp" #include "src/Insight/UserInterfaces/InsightWindow/UiLoader.hpp"
#include "src/Insight/InsightSignals.hpp" #include "src/Insight/InsightSignals.hpp"
#include "src/Helpers/Paths.hpp" #include "src/Services/PathService.hpp"
#include "src/Exceptions/Exception.hpp" #include "src/Exceptions/Exception.hpp"
namespace Bloom::Widgets namespace Bloom::Widgets
@@ -31,7 +31,7 @@ namespace Bloom::Widgets
this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
auto widgetUiFile = QFile( auto widgetUiFile = QFile(
QString::fromStdString(Paths::compiledResourcesPath() QString::fromStdString(Services::PathService::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget" + "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget"
+ "/UiFiles/HexViewerWidget.ui" + "/UiFiles/HexViewerWidget.ui"
) )

View File

@@ -2,7 +2,7 @@
#include <QFile> #include <QFile>
#include "src/Helpers/Paths.hpp" #include "src/Services/PathService.hpp"
#include "src/Exceptions/Exception.hpp" #include "src/Exceptions/Exception.hpp"
#include "src/Insight/UserInterfaces/InsightWindow/UiLoader.hpp" #include "src/Insight/UserInterfaces/InsightWindow/UiLoader.hpp"
@@ -16,7 +16,7 @@ namespace Bloom::Widgets
: memoryRegion(region), RegionItem(region, memoryDescriptor, parent) : memoryRegion(region), RegionItem(region, memoryDescriptor, parent)
{ {
auto formUiFile = QFile( auto formUiFile = QFile(
QString::fromStdString(Paths::compiledResourcesPath() QString::fromStdString(Services::PathService::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane" + "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane"
+ "/MemoryRegionManager/UiFiles/ExcludedMemoryRegionForm.ui" + "/MemoryRegionManager/UiFiles/ExcludedMemoryRegionForm.ui"
) )

View File

@@ -2,7 +2,7 @@
#include <QFile> #include <QFile>
#include "src/Helpers/Paths.hpp" #include "src/Services/PathService.hpp"
#include "src/Exceptions/Exception.hpp" #include "src/Exceptions/Exception.hpp"
#include "src/Insight/UserInterfaces/InsightWindow/UiLoader.hpp" #include "src/Insight/UserInterfaces/InsightWindow/UiLoader.hpp"
@@ -18,7 +18,7 @@ namespace Bloom::Widgets
: memoryRegion(region), RegionItem(region, memoryDescriptor, parent) : memoryRegion(region), RegionItem(region, memoryDescriptor, parent)
{ {
auto formUiFile = QFile( auto formUiFile = QFile(
QString::fromStdString(Paths::compiledResourcesPath() QString::fromStdString(Services::PathService::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane" + "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane"
+ "/MemoryRegionManager/UiFiles/FocusedMemoryRegionForm.ui" + "/MemoryRegionManager/UiFiles/FocusedMemoryRegionForm.ui"
) )

View File

@@ -7,7 +7,7 @@
#include "src/Insight/UserInterfaces/InsightWindow/UiLoader.hpp" #include "src/Insight/UserInterfaces/InsightWindow/UiLoader.hpp"
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/ErrorDialogue/ErrorDialogue.hpp" #include "src/Insight/UserInterfaces/InsightWindow/Widgets/ErrorDialogue/ErrorDialogue.hpp"
#include "src/Helpers/Paths.hpp" #include "src/Services/PathService.hpp"
#include "src/Exceptions/Exception.hpp" #include "src/Exceptions/Exception.hpp"
namespace Bloom::Widgets namespace Bloom::Widgets
@@ -33,14 +33,14 @@ namespace Bloom::Widgets
); );
auto windowUiFile = QFile( auto windowUiFile = QFile(
QString::fromStdString(Paths::compiledResourcesPath() QString::fromStdString(Services::PathService::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane" + "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane"
+ "/MemoryRegionManager/UiFiles/MemoryRegionManagerWindow.ui" + "/MemoryRegionManager/UiFiles/MemoryRegionManagerWindow.ui"
) )
); );
auto windowStylesheet = QFile( auto windowStylesheet = QFile(
QString::fromStdString(Paths::compiledResourcesPath() QString::fromStdString(Services::PathService::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane" + "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane"
+ "/MemoryRegionManager/Stylesheets/MemoryRegionManagerWindow.qss" + "/MemoryRegionManager/Stylesheets/MemoryRegionManagerWindow.qss"
) )
@@ -406,7 +406,7 @@ namespace Bloom::Widgets
void MemoryRegionManagerWindow::openHelpPage() { void MemoryRegionManagerWindow::openHelpPage() {
QDesktopServices::openUrl( QDesktopServices::openUrl(
QUrl(QString::fromStdString(Paths::homeDomainName() + "/docs/manage-memory-regions")) QUrl(QString::fromStdString(Services::PathService::homeDomainName() + "/docs/manage-memory-regions"))
); );
} }
} }

View File

@@ -8,7 +8,7 @@
#include "src/Insight/InsightSignals.hpp" #include "src/Insight/InsightSignals.hpp"
#include "src/Helpers/Paths.hpp" #include "src/Services/PathService.hpp"
#include "src/Exceptions/Exception.hpp" #include "src/Exceptions/Exception.hpp"
namespace Bloom::Widgets namespace Bloom::Widgets
@@ -32,7 +32,7 @@ namespace Bloom::Widgets
); );
auto windowUiFile = QFile( auto windowUiFile = QFile(
QString::fromStdString(Paths::compiledResourcesPath() QString::fromStdString(Services::PathService::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane" + "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane"
+ "/SnapshotManager/CreateSnapshotWindow/UiFiles/CreateSnapshotWindow.ui" + "/SnapshotManager/CreateSnapshotWindow/UiFiles/CreateSnapshotWindow.ui"
) )

View File

@@ -9,7 +9,7 @@
#include "src/Insight/InsightWorker/Tasks/CaptureMemorySnapshot.hpp" #include "src/Insight/InsightWorker/Tasks/CaptureMemorySnapshot.hpp"
#include "src/Insight/InsightWorker/InsightWorker.hpp" #include "src/Insight/InsightWorker/InsightWorker.hpp"
#include "src/Helpers/Paths.hpp" #include "src/Services/PathService.hpp"
#include "src/Helpers/EnumToStringMappings.hpp" #include "src/Helpers/EnumToStringMappings.hpp"
#include "src/Exceptions/Exception.hpp" #include "src/Exceptions/Exception.hpp"
#include "src/Logger/Logger.hpp" #include "src/Logger/Logger.hpp"
@@ -34,7 +34,7 @@ namespace Bloom::Widgets
this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
auto widgetUiFile = QFile( auto widgetUiFile = QFile(
QString::fromStdString(Paths::compiledResourcesPath() QString::fromStdString(Services::PathService::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane" + "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane"
+ "/SnapshotManager/UiFiles/SnapshotManager.ui" + "/SnapshotManager/UiFiles/SnapshotManager.ui"
) )

View File

@@ -12,7 +12,7 @@
#include "src/Insight/InsightWorker/Tasks/ReadTargetMemory.hpp" #include "src/Insight/InsightWorker/Tasks/ReadTargetMemory.hpp"
#include "src/Insight/InsightWorker/Tasks/ReadStackPointer.hpp" #include "src/Insight/InsightWorker/Tasks/ReadStackPointer.hpp"
#include "src/Helpers/Paths.hpp" #include "src/Services/PathService.hpp"
#include "src/Exceptions/Exception.hpp" #include "src/Exceptions/Exception.hpp"
#include "src/Logger/Logger.hpp" #include "src/Logger/Logger.hpp"
@@ -46,13 +46,13 @@ namespace Bloom::Widgets
this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
auto uiFile = QFile( auto uiFile = QFile(
QString::fromStdString(Paths::compiledResourcesPath() QString::fromStdString(Services::PathService::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/UiFiles/TargetMemoryInspectionPane.ui" + "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/UiFiles/TargetMemoryInspectionPane.ui"
) )
); );
auto stylesheetFile = QFile( auto stylesheetFile = QFile(
QString::fromStdString(Paths::compiledResourcesPath() QString::fromStdString(Services::PathService::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Stylesheets/TargetMemoryInspectionPane.qss" + "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Stylesheets/TargetMemoryInspectionPane.qss"
) )
); );

View File

@@ -11,7 +11,7 @@
#include "src/Insight/InsightSignals.hpp" #include "src/Insight/InsightSignals.hpp"
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/Label.hpp" #include "src/Insight/UserInterfaces/InsightWindow/Widgets/Label.hpp"
#include "src/Helpers/Paths.hpp" #include "src/Services/PathService.hpp"
#include "src/Helpers/DateTime.hpp" #include "src/Helpers/DateTime.hpp"
#include "src/Exceptions/Exception.hpp" #include "src/Exceptions/Exception.hpp"
@@ -37,7 +37,7 @@ namespace Bloom::Widgets
this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
auto widgetUiFile = QFile( auto widgetUiFile = QFile(
QString::fromStdString(Paths::compiledResourcesPath() QString::fromStdString(Services::PathService::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/RegisterHistoryWidget" + "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/RegisterHistoryWidget"
+ "/UiFiles/RegisterHistoryWidget.ui" + "/UiFiles/RegisterHistoryWidget.ui"
) )

View File

@@ -10,7 +10,7 @@
#include "src/Insight/InsightWorker/InsightWorker.hpp" #include "src/Insight/InsightWorker/InsightWorker.hpp"
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/ErrorDialogue/ErrorDialogue.hpp" #include "src/Insight/UserInterfaces/InsightWindow/Widgets/ErrorDialogue/ErrorDialogue.hpp"
#include "src/Helpers/Paths.hpp" #include "src/Services/PathService.hpp"
#include "src/Exceptions/Exception.hpp" #include "src/Exceptions/Exception.hpp"
#include "src/Insight/InsightWorker/Tasks/ReadTargetRegisters.hpp" #include "src/Insight/InsightWorker/Tasks/ReadTargetRegisters.hpp"
@@ -40,14 +40,14 @@ namespace Bloom::Widgets
this->setWindowTitle("Inspect Register"); this->setWindowTitle("Inspect Register");
auto windowUiFile = QFile( auto windowUiFile = QFile(
QString::fromStdString(Paths::compiledResourcesPath() QString::fromStdString(Services::PathService::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/UiFiles/" + "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/UiFiles/"
"TargetRegisterInspectorWindow.ui" "TargetRegisterInspectorWindow.ui"
) )
); );
auto windowStylesheet = QFile( auto windowStylesheet = QFile(
QString::fromStdString(Paths::compiledResourcesPath() QString::fromStdString(Services::PathService::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/Stylesheets/" + "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/Stylesheets/"
"TargetRegisterInspectorWindow.qss" "TargetRegisterInspectorWindow.qss"
) )
@@ -378,7 +378,7 @@ namespace Bloom::Widgets
void TargetRegisterInspectorWindow::openHelpPage() { void TargetRegisterInspectorWindow::openHelpPage() {
QDesktopServices::openUrl( QDesktopServices::openUrl(
QUrl(QString::fromStdString(Paths::homeDomainName() + "/docs/register-inspection")) QUrl(QString::fromStdString(Services::PathService::homeDomainName() + "/docs/register-inspection"))
); );
} }
} }

View File

@@ -6,7 +6,7 @@
#include "RegisterWidget.hpp" #include "RegisterWidget.hpp"
#include "src/Helpers/Paths.hpp" #include "src/Services/PathService.hpp"
namespace Bloom::Widgets namespace Bloom::Widgets
{ {
@@ -31,7 +31,7 @@ namespace Bloom::Widgets
this->arrowIcon->setObjectName("arrow-icon"); this->arrowIcon->setObjectName("arrow-icon");
auto static arrowIconPath = QString::fromStdString( auto static arrowIconPath = QString::fromStdString(
Paths::compiledResourcesPath() Services::PathService::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegistersPane/Images/arrow.svg" + "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegistersPane/Images/arrow.svg"
); );
this->arrowIcon->setSvgFilePath(arrowIconPath); this->arrowIcon->setSvgFilePath(arrowIconPath);
@@ -40,7 +40,7 @@ namespace Bloom::Widgets
this->registerGroupIcon->setObjectName("register-group-icon"); this->registerGroupIcon->setObjectName("register-group-icon");
auto static registerIconPath = QString::fromStdString( auto static registerIconPath = QString::fromStdString(
Paths::compiledResourcesPath() Services::PathService::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegistersPane/Images/register-group.svg" + "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegistersPane/Images/register-group.svg"
); );
this->registerGroupIcon->setSvgFilePath(registerIconPath); this->registerGroupIcon->setSvgFilePath(registerIconPath);

View File

@@ -5,7 +5,7 @@
#include <QMenu> #include <QMenu>
#include <QStyle> #include <QStyle>
#include "src/Helpers/Paths.hpp" #include "src/Services/PathService.hpp"
#include "src/Insight/InsightSignals.hpp" #include "src/Insight/InsightSignals.hpp"
#include "src/Insight/InsightWorker/InsightWorker.hpp" #include "src/Insight/InsightWorker/InsightWorker.hpp"
@@ -35,7 +35,7 @@ namespace Bloom::Widgets
this->registerIcon->setObjectName("register-icon"); this->registerIcon->setObjectName("register-icon");
auto static registerIconPath = QString::fromStdString( auto static registerIconPath = QString::fromStdString(
Paths::compiledResourcesPath() Services::PathService::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegistersPane/Images/register.svg" + "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegistersPane/Images/register.svg"
); );
this->registerIcon->setSvgFilePath(registerIconPath); this->registerIcon->setSvgFilePath(registerIconPath);

View File

@@ -9,7 +9,7 @@
#include "RegisterGroupWidget.hpp" #include "RegisterGroupWidget.hpp"
#include "RegisterWidget.hpp" #include "RegisterWidget.hpp"
#include "src/Helpers/Paths.hpp" #include "src/Services/PathService.hpp"
#include "src/Exceptions/Exception.hpp" #include "src/Exceptions/Exception.hpp"
#include "src/Insight/InsightWorker/Tasks/ReadTargetRegisters.hpp" #include "src/Insight/InsightWorker/Tasks/ReadTargetRegisters.hpp"
@@ -34,7 +34,7 @@ namespace Bloom::Widgets
this->setObjectName("target-registers-side-pane"); this->setObjectName("target-registers-side-pane");
auto targetRegistersPaneUiFile = QFile( auto targetRegistersPaneUiFile = QFile(
QString::fromStdString(Paths::compiledResourcesPath() QString::fromStdString(Services::PathService::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegistersPane/UiFiles/" + "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegistersPane/UiFiles/"
"TargetRegistersSidePane.ui" "TargetRegistersSidePane.ui"
) )

View File

@@ -6,7 +6,7 @@
#include <QEvent> #include <QEvent>
#include <QFile> #include <QFile>
#include "src/Helpers/Paths.hpp" #include "src/Services/PathService.hpp"
namespace Bloom::Widgets::InsightTargetWidgets::Dip namespace Bloom::Widgets::InsightTargetWidgets::Dip
{ {
@@ -19,7 +19,7 @@ namespace Bloom::Widgets::InsightTargetWidgets::Dip
: TargetPackageWidget(targetVariant, parent) : TargetPackageWidget(targetVariant, parent)
{ {
auto stylesheetFile = QFile(QString::fromStdString( auto stylesheetFile = QFile(QString::fromStdString(
Paths::compiledResourcesPath() Services::PathService::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/DIP/Stylesheets/" + "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/DIP/Stylesheets/"
"DualInlinePackage.qss" "DualInlinePackage.qss"
) )

View File

@@ -7,7 +7,7 @@
#include <QFile> #include <QFile>
#include <QLine> #include <QLine>
#include "src/Helpers/Paths.hpp" #include "src/Services/PathService.hpp"
#include "PinWidget.hpp" #include "PinWidget.hpp"
#include "BodyWidget.hpp" #include "BodyWidget.hpp"
@@ -22,7 +22,7 @@ namespace Bloom::Widgets::InsightTargetWidgets::Qfp
assert((targetVariant.pinDescriptorsByNumber.size() % 4) == 0); assert((targetVariant.pinDescriptorsByNumber.size() % 4) == 0);
auto stylesheetFile = QFile(QString::fromStdString( auto stylesheetFile = QFile(QString::fromStdString(
Paths::compiledResourcesPath() Services::PathService::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/QFP/Stylesheets/QuadFlatPackage.qss" + "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/QFP/Stylesheets/QuadFlatPackage.qss"
) )
); );

View File

@@ -1,4 +1,4 @@
#include "Paths.hpp" #include "PathService.hpp"
#include <unistd.h> #include <unistd.h>
#include <array> #include <array>
@@ -7,9 +7,9 @@
#include "src/Exceptions/Exception.hpp" #include "src/Exceptions/Exception.hpp"
namespace Bloom namespace Bloom::Services
{ {
std::string Paths::applicationDirPath() { std::string PathService::applicationDirPath() {
auto pathCharArray = std::array<char, PATH_MAX>(); auto pathCharArray = std::array<char, PATH_MAX>();
if (readlink("/proc/self/exe", pathCharArray.data(), PATH_MAX) < 0) { if (readlink("/proc/self/exe", pathCharArray.data(), PATH_MAX) < 0) {

View File

@@ -3,9 +3,9 @@
#include <string> #include <string>
#include <filesystem> #include <filesystem>
namespace Bloom namespace Bloom::Services
{ {
class Paths class PathService
{ {
public: public:
/** /**
@@ -21,7 +21,7 @@ namespace Bloom
* @return * @return
*/ */
static std::string resourcesDirPath() { static std::string resourcesDirPath() {
return Paths::applicationDirPath() + "/../resources/"; return PathService::applicationDirPath() + "/../resources/";
} }
/** /**
@@ -39,7 +39,7 @@ namespace Bloom
* @return * @return
*/ */
static std::string projectConfigPath() { static std::string projectConfigPath() {
return Paths::projectDirPath() + "/bloom.yaml"; return PathService::projectDirPath() + "/bloom.yaml";
} }
/** /**
@@ -48,7 +48,7 @@ namespace Bloom
* @return * @return
*/ */
static std::string projectSettingsDirPath() { static std::string projectSettingsDirPath() {
return Paths::projectDirPath() + "/.bloom"; return PathService::projectDirPath() + "/.bloom";
} }
/** /**
@@ -57,7 +57,7 @@ namespace Bloom
* @return * @return
*/ */
static std::string projectSettingsPath() { static std::string projectSettingsPath() {
return Paths::projectSettingsDirPath() + "/settings.json"; return PathService::projectSettingsDirPath() + "/settings.json";
} }
/** /**

View File

@@ -443,7 +443,7 @@ namespace Bloom::TargetController
======= =======
void TargetControllerComponent::checkUdevRules() { void TargetControllerComponent::checkUdevRules() {
auto bloomRulesPath = std::string("/etc/udev/rules.d/99-bloom.rules"); auto bloomRulesPath = std::string("/etc/udev/rules.d/99-bloom.rules");
auto latestBloomRulesPath = Paths::resourcesDirPath() + "/UDevRules/99-bloom.rules"; auto latestBloomRulesPath = Services::PathService::resourcesDirPath() + "/UDevRules/99-bloom.rules";
if (!std::filesystem::exists(bloomRulesPath)) { if (!std::filesystem::exists(bloomRulesPath)) {
Logger::warning("Bloom udev rules missing - attempting installation"); Logger::warning("Bloom udev rules missing - attempting installation");
@@ -453,7 +453,7 @@ namespace Bloom::TargetController
Logger::error("Bloom udev rules missing - cannot install udev rules without root privileges.\n" Logger::error("Bloom udev rules missing - cannot install udev rules without root privileges.\n"
"Running Bloom once with root privileges will allow it to automatically install the udev rules. " "Running Bloom once with root privileges will allow it to automatically install the udev rules. "
"Alternatively, instructions on manually installing the udev rules can be found " "Alternatively, instructions on manually installing the udev rules can be found "
"here: " + Paths::homeDomainName() + "/docs/getting-started\nBloom may fail to connect to some " "here: " + Services::PathService::homeDomainName() + "/docs/getting-started\nBloom may fail to connect to some "
"debug tools until this is resolved."); "debug tools until this is resolved.");
return; return;
} }

View File

@@ -7,7 +7,7 @@
#include <algorithm> #include <algorithm>
#include "src/Logger/Logger.hpp" #include "src/Logger/Logger.hpp"
#include "src/Helpers/Paths.hpp" #include "src/Services/PathService.hpp"
#include "src/Exceptions/InvalidConfig.hpp" #include "src/Exceptions/InvalidConfig.hpp"
#include "Exceptions/DebugWirePhysicalInterfaceError.hpp" #include "Exceptions/DebugWirePhysicalInterfaceError.hpp"
@@ -67,9 +67,9 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
+ physicalInterfaceNames.at(this->targetConfig->physicalInterface) + "). Target activation " + physicalInterfaceNames.at(this->targetConfig->physicalInterface) + "). Target activation "
"will likely fail. The target supports the following physical interfaces: \n" "will likely fail. The target supports the following physical interfaces: \n"
+ supportedPhysicalInterfaceList + "\n\nFor physical interface configuration values, see " + supportedPhysicalInterfaceList + "\n\nFor physical interface configuration values, see "
+ Paths::homeDomainName() + "/docs/configuration/avr8-physical-interfaces. \n\nIf this " + Services::PathService::homeDomainName() + "/docs/configuration/avr8-physical-interfaces. \n\nIf this "
"information is incorrect, please report this to Bloom developers via " "information is incorrect, please report this to Bloom developers via "
+ Paths::homeDomainName() + "/report-issue.\n" + Services::PathService::homeDomainName() + "/report-issue.\n"
); );
} }
@@ -78,7 +78,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
throw InvalidConfig( throw InvalidConfig(
"The JTAG physical interface cannot be used with an ambiguous target name" "The JTAG physical interface cannot be used with an ambiguous target name"
" - please specify the exact name of the target in your configuration file. " " - please specify the exact name of the target in your configuration file. "
"See " + Paths::homeDomainName() + "/docs/supported-targets" "See " + Services::PathService::homeDomainName() + "/docs/supported-targets"
); );
} }
@@ -86,7 +86,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
throw InvalidConfig( throw InvalidConfig(
"The UPDI physical interface cannot be used with an ambiguous target name" "The UPDI physical interface cannot be used with an ambiguous target name"
" - please specify the exact name of the target in your configuration file. " " - please specify the exact name of the target in your configuration file. "
"See " + Paths::homeDomainName() + "/docs/supported-targets" "See " + Services::PathService::homeDomainName() + "/docs/supported-targets"
); );
} }
} }
@@ -163,7 +163,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
throw TargetOperationFailure( throw TargetOperationFailure(
"Failed to activate debugWire physical interface - check target connection and DWEN fuse " "Failed to activate debugWire physical interface - check target connection and DWEN fuse "
"bit. Bloom can manage the DWEN fuse bit automatically. For instructions on enabling this " "bit. Bloom can manage the DWEN fuse bit automatically. For instructions on enabling this "
"function, see " + Paths::homeDomainName() + "/docs/debugging-avr-debugwire" "function, see " + Services::PathService::homeDomainName() + "/docs/debugging-avr-debugwire"
); );
} }
@@ -763,7 +763,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
if (this->avrIspInterface == nullptr) { if (this->avrIspInterface == nullptr) {
throw Exception( throw Exception(
"Debug tool or driver does not provide access to an ISP interface - please confirm that the " "Debug tool or driver does not provide access to an ISP interface - please confirm that the "
"debug tool supports ISP and then report this issue via " + Paths::homeDomainName() "debug tool supports ISP and then report this issue via " + Services::PathService::homeDomainName()
+ "/report-issue" + "/report-issue"
); );
} }
@@ -778,7 +778,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
if (!this->supportedPhysicalInterfaces.contains(PhysicalInterface::DEBUG_WIRE)) { if (!this->supportedPhysicalInterfaces.contains(PhysicalInterface::DEBUG_WIRE)) {
throw Exception( throw Exception(
"Target does not support debugWire physical interface - check target configuration or " "Target does not support debugWire physical interface - check target configuration or "
"report this issue via " + Paths::homeDomainName() + "/report-issue" "report this issue via " + Services::PathService::homeDomainName() + "/report-issue"
); );
} }
@@ -842,7 +842,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
"Updating the DWEN fuse bit is a potentially dangerous operation. Bloom is provided \"AS IS\", " "Updating the DWEN fuse bit is a potentially dangerous operation. Bloom is provided \"AS IS\", "
"without warranty of any kind. You are using Bloom at your own risk. In no event shall the copyright " "without warranty of any kind. You are using Bloom at your own risk. In no event shall the copyright "
"owner or contributors be liable for any damage caused as a result of using Bloom. For more details, " "owner or contributors be liable for any damage caused as a result of using Bloom. For more details, "
"see the Bloom license at " + Paths::homeDomainName() + "/license" "see the Bloom license at " + Services::PathService::homeDomainName() + "/license"
); );
try { try {
@@ -882,7 +882,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
*/ */
throw Exception( throw Exception(
"Invalid SPIEN fuse bit value - suspected inaccuracies in TDF data. Please report this to " "Invalid SPIEN fuse bit value - suspected inaccuracies in TDF data. Please report this to "
"Bloom developers as a matter of urgency, via " + Paths::homeDomainName() + "/report-issue" "Bloom developers as a matter of urgency, via " + Services::PathService::homeDomainName() + "/report-issue"
); );
} }

View File

@@ -1,7 +1,7 @@
#include "Avr8TargetConfig.hpp" #include "Avr8TargetConfig.hpp"
#include "src/Helpers/String.hpp" #include "src/Helpers/String.hpp"
#include "src/Helpers/Paths.hpp" #include "src/Services/PathService.hpp"
#include "src/Exceptions/InvalidConfig.hpp" #include "src/Exceptions/InvalidConfig.hpp"
namespace Bloom::Targets::Microchip::Avr::Avr8Bit namespace Bloom::Targets::Microchip::Avr::Avr8Bit
@@ -25,7 +25,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
if (physicalInterfaceIt == Avr8TargetConfig::debugPhysicalInterfacesByConfigName.end()) { if (physicalInterfaceIt == Avr8TargetConfig::debugPhysicalInterfacesByConfigName.end()) {
throw InvalidConfig( throw InvalidConfig(
"Invalid physical interface provided (\"" + physicalInterfaceName + "\") for AVR8 target. " "Invalid physical interface provided (\"" + physicalInterfaceName + "\") for AVR8 target. "
"See " + Paths::homeDomainName() + "/docs/configuration/avr8-physical-interfaces for valid physical " "See " + Services::PathService::homeDomainName() + "/docs/configuration/avr8-physical-interfaces for valid physical "
"interface configuration values." "interface configuration values."
); );
} }

View File

@@ -4,7 +4,7 @@
#include <QJsonArray> #include <QJsonArray>
#include <QJsonObject> #include <QJsonObject>
#include "src/Helpers/Paths.hpp" #include "src/Services/PathService.hpp"
#include "src/Logger/Logger.hpp" #include "src/Logger/Logger.hpp"
#include "src/Exceptions/Exception.hpp" #include "src/Exceptions/Exception.hpp"
@@ -73,7 +73,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit::TargetDescription
continue; continue;
} }
const auto descriptionFilePath = QString::fromStdString(Paths::applicationDirPath()) + "/" const auto descriptionFilePath = QString::fromStdString(Services::PathService::applicationDirPath()) + "/"
+ mappingObject.find("targetDescriptionFilePath")->toString(); + mappingObject.find("targetDescriptionFilePath")->toString();
Logger::debug("Loading AVR8 target description file: " + descriptionFilePath.toStdString()); Logger::debug("Loading AVR8 target description file: " + descriptionFilePath.toStdString());
@@ -99,7 +99,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit::TargetDescription
QJsonObject TargetDescriptionFile::getTargetDescriptionMapping() { QJsonObject TargetDescriptionFile::getTargetDescriptionMapping() {
auto mappingFile = QFile( auto mappingFile = QFile(
QString::fromStdString(Paths::resourcesDirPath() + "/TargetDescriptionFiles/AVR/Mapping.json") QString::fromStdString(Services::PathService::resourcesDirPath() + "/TargetDescriptionFiles/AVR/Mapping.json")
); );
if (!mappingFile.exists()) { if (!mappingFile.exists()) {

View File

@@ -5,7 +5,7 @@
#include "Exceptions/TargetDescriptionParsingFailureException.hpp" #include "Exceptions/TargetDescriptionParsingFailureException.hpp"
#include "src/Logger/Logger.hpp" #include "src/Logger/Logger.hpp"
#include "src/Helpers/Paths.hpp" #include "src/Services/PathService.hpp"
namespace Bloom::Targets::TargetDescription namespace Bloom::Targets::TargetDescription
{ {
@@ -26,7 +26,7 @@ namespace Bloom::Targets::TargetDescription
auto xml = QDomDocument(); auto xml = QDomDocument();
if (!xml.setContent(file.readAll())) { if (!xml.setContent(file.readAll())) {
throw Exception("Failed to parse target description file - please report this error " throw Exception("Failed to parse target description file - please report this error "
"to Bloom developers via " + Paths::homeDomainName() + "/report-issue"); "to Bloom developers via " + Services::PathService::homeDomainName() + "/report-issue");
} }
this->init(xml); this->init(xml);