Added BLOOM_COMPILED_RESOURCES_PATH_OVERRIDE macro to avoid using compiled resources in debug builds

This commit is contained in:
Nav
2021-05-30 19:05:18 +01:00
parent 3c60fee231
commit 602328d9d1
16 changed files with 155 additions and 60 deletions

View File

@@ -3,7 +3,7 @@
#include "Insight.hpp"
#include "InsightWorker.hpp"
#include "src/Application.hpp"
#include "src/Helpers/Paths.hpp"
#include "src/Logger/Logger.hpp"
#include "src/Exceptions/InvalidConfig.hpp"
#include "src/Targets/TargetState.hpp"
@@ -49,7 +49,7 @@ void Insight::startup() {
auto targetDescriptor = this->targetControllerConsole.getTargetDescriptor();
#ifndef BLOOM_DEBUG_BUILD
QCoreApplication::addLibraryPath(QString::fromStdString(Application::getApplicationDirPath() + "/plugins"));
QCoreApplication::addLibraryPath(QString::fromStdString(Paths::applicationDirPath() + "/plugins"));
#endif
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);

View File

@@ -5,14 +5,23 @@
#include "src/Logger/Logger.hpp"
#include "src/Exceptions/Exception.hpp"
#include "src/Application.hpp"
#include "src/Helpers/Paths.hpp"
using namespace Bloom;
using namespace InsightTargetWidgets;
using namespace Exceptions;
AboutWindow::AboutWindow(QWidget* parent): QObject(parent) {
auto aboutWindowUiFile = QFile(":/compiled/Insight/UserInterfaces/InsightWindow/UiFiles/AboutWindow.ui");
auto aboutWindowStylesheet = QFile(":/compiled/Insight/UserInterfaces/InsightWindow/Stylesheets/AboutWindow.qss");
auto aboutWindowUiFile = QFile(QString::fromStdString(
Paths::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/UiFiles/AboutWindow.ui"
)
);
auto aboutWindowStylesheet = QFile(QString::fromStdString(
Paths::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/Stylesheets/AboutWindow.qss"
)
);
if (!aboutWindowUiFile.open(QFile::ReadOnly)) {
throw Exception("Failed to open AboutWindow UI file");

View File

@@ -8,6 +8,7 @@
#include "src/Logger/Logger.hpp"
#include "src/Exceptions/Exception.hpp"
#include "src/Targets/TargetDescriptor.hpp"
#include "src/Helpers/Paths.hpp"
using namespace Bloom;
using namespace Bloom::Exceptions;
@@ -25,8 +26,16 @@ void InsightWindow::init(
) {
this->targetDescriptor = targetDescriptor;
auto mainWindowUiFile = QFile(":/compiled/Insight/UserInterfaces/InsightWindow/UiFiles/InsightWindow.ui");
auto mainWindowStylesheet = QFile(":/compiled/Insight/UserInterfaces/InsightWindow/Stylesheets/InsightWindow.qss");
auto mainWindowUiFile = QFile(
QString::fromStdString(Paths::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/UiFiles/InsightWindow.ui"
)
);
auto mainWindowStylesheet = QFile(
QString::fromStdString(Paths::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/Stylesheets/InsightWindow.qss"
)
);
if (!mainWindowUiFile.open(QFile::ReadOnly)) {
throw Exception("Failed to open InsightWindow UI file");
@@ -40,7 +49,11 @@ void InsightWindow::init(
this->mainWindowWidget = uiLoader.load(&mainWindowUiFile);
this->mainWindowWidget->setStyleSheet(mainWindowStylesheet.readAll());
application.setWindowIcon(QIcon(":/compiled/Insight/UserInterfaces/InsightWindow/Images/BloomIcon.svg"));
application.setWindowIcon(QIcon(
QString::fromStdString(Paths::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/Images/BloomIcon.svg"
)
));
this->ioContainerWidget = this->mainWindowWidget->findChild<QWidget*>("io-container");
this->ioUnavailableWidget = this->mainWindowWidget->findChild<QLabel*>("io-inspection-unavailable");
this->mainMenuBar = this->mainWindowWidget->findChild<QMenuBar*>("menu-bar");

View File

@@ -13,7 +13,7 @@ QMainWindow {
min-width: 150px;
max-height: 150px;
max-width: 150px;
image: url(":/compiled/Insight/UserInterfaces/InsightWindow/Images/BloomIcon.svg");
image: url(":/compiled/src/Insight/UserInterfaces/InsightWindow/Images/BloomIcon.svg");
image-position: center;
}
@@ -21,4 +21,4 @@ QMainWindow {
font-size: 14px;
color: #adadb1;
}
}

View File

@@ -88,7 +88,7 @@ QMenu#help-menu::separator {
height: 25px;
color: #000;
border: none;
qproperty-icon: url(":/compiled/Insight/UserInterfaces/InsightWindow/Images/RAM.svg");
qproperty-icon: url(":/compiled/src/Insight/UserInterfaces/InsightWindow/Images/RAM.svg");
icon-size: 25px;
}

View File

@@ -9,6 +9,7 @@
#include "DualInlinePackageWidget.hpp"
#include "src/Logger/Logger.hpp"
#include "src/Exceptions/Exception.hpp"
#include "src/Helpers/Paths.hpp"
#include "PinWidget.hpp"
#include "BodyWidget.hpp"
@@ -22,7 +23,11 @@ DualInlinePackageWidget::DualInlinePackageWidget(
QObject* insightWindowObj,
QWidget* parent
): TargetPackageWidget(targetVariant, insightWindowObj, parent) {
auto stylesheetFile = QFile(":/compiled/Insight/UserInterfaces/InsightWindow/TargetWidgets/DIP/Stylesheets/DualInlinePackage.qss");
auto stylesheetFile = QFile(QString::fromStdString(
Paths::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/TargetWidgets/DIP/Stylesheets/DualInlinePackage.qss"
)
);
stylesheetFile.open(QFile::ReadOnly);
this->setStyleSheet(stylesheetFile.readAll());
@@ -121,4 +126,3 @@ void DualInlinePackageWidget::drawWidget(QPainter& painter) {
height
);
}

View File

@@ -7,6 +7,7 @@
#include "../../InsightWindow.hpp"
#include "QuadFlatPackageWidget.hpp"
#include "src/Helpers/Paths.hpp"
#include "PinWidget.hpp"
#include "BodyWidget.hpp"
@@ -20,7 +21,11 @@ QuadFlatPackageWidget::QuadFlatPackageWidget(
): TargetPackageWidget(targetVariant, insightWindowObj, parent) {
assert((targetVariant.pinDescriptorsByNumber.size() % 4) == 0);
auto stylesheetFile = QFile(":/compiled/Insight/UserInterfaces/InsightWindow/TargetWidgets/QFP/Stylesheets/QuadFlatPackage.qss");
auto stylesheetFile = QFile(QString::fromStdString(
Paths::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/TargetWidgets//QFP/Stylesheets/QuadFlatPackage.qss"
)
);
stylesheetFile.open(QFile::ReadOnly);
this->setStyleSheet(stylesheetFile.readAll());

View File

@@ -62,8 +62,8 @@
<widget class="QToolButton" name="refresh-io-inspection-btn">
<property name="icon">
<iconset>
<disabledoff>:/compiled/Insight/UserInterfaces/InsightWindow/Images/refresh-disabled.svg</disabledoff>
<normalon>:/compiled/Insight/UserInterfaces/InsightWindow/Images/refresh.svg</normalon>
<disabledoff>:/compiled/src/Insight/UserInterfaces/InsightWindow/Images/refresh-disabled.svg</disabledoff>
<normalon>:/compiled/src/Insight/UserInterfaces/InsightWindow/Images/refresh.svg</normalon>
</iconset>
</property>
<property name="toolTip">