Removed redundant 'Bloom' namespace from entire codebase
This commit is contained in:
@@ -8,39 +8,36 @@
|
||||
#include "src/Services/PathService.hpp"
|
||||
#include "src/Application.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using namespace Exceptions;
|
||||
using namespace Exceptions;
|
||||
|
||||
AboutWindow::AboutWindow(QWidget* parent): QObject(parent) {
|
||||
auto aboutWindowUiFile = QFile(QString::fromStdString(
|
||||
Services::PathService::compiledResourcesPath()
|
||||
+ "/src/Insight/UserInterfaces/InsightWindow/UiFiles/AboutWindow.ui"
|
||||
)
|
||||
);
|
||||
auto aboutWindowStylesheet = QFile(QString::fromStdString(
|
||||
Services::PathService::compiledResourcesPath()
|
||||
+ "/src/Insight/UserInterfaces/InsightWindow/Stylesheets/AboutWindow.qss"
|
||||
)
|
||||
);
|
||||
AboutWindow::AboutWindow(QWidget* parent): QObject(parent) {
|
||||
auto aboutWindowUiFile = QFile(QString::fromStdString(
|
||||
Services::PathService::compiledResourcesPath()
|
||||
+ "/src/Insight/UserInterfaces/InsightWindow/UiFiles/AboutWindow.ui"
|
||||
)
|
||||
);
|
||||
auto aboutWindowStylesheet = QFile(QString::fromStdString(
|
||||
Services::PathService::compiledResourcesPath()
|
||||
+ "/src/Insight/UserInterfaces/InsightWindow/Stylesheets/AboutWindow.qss"
|
||||
)
|
||||
);
|
||||
|
||||
if (!aboutWindowUiFile.open(QFile::ReadOnly)) {
|
||||
throw Exception("Failed to open AboutWindow UI file");
|
||||
}
|
||||
if (!aboutWindowUiFile.open(QFile::ReadOnly)) {
|
||||
throw Exception("Failed to open AboutWindow UI file");
|
||||
}
|
||||
|
||||
if (!aboutWindowStylesheet.open(QFile::ReadOnly)) {
|
||||
throw Exception("Failed to open AboutWindow QSS file");
|
||||
}
|
||||
if (!aboutWindowStylesheet.open(QFile::ReadOnly)) {
|
||||
throw Exception("Failed to open AboutWindow QSS file");
|
||||
}
|
||||
|
||||
auto uiLoader = UiLoader(this);
|
||||
this->windowWidget = uiLoader.load(&aboutWindowUiFile, parent);
|
||||
this->windowWidget->setStyleSheet(aboutWindowStylesheet.readAll());
|
||||
this->windowWidget->setFixedSize(400, 300);
|
||||
auto uiLoader = UiLoader(this);
|
||||
this->windowWidget = uiLoader.load(&aboutWindowUiFile, parent);
|
||||
this->windowWidget->setStyleSheet(aboutWindowStylesheet.readAll());
|
||||
this->windowWidget->setFixedSize(400, 300);
|
||||
|
||||
auto versionLabel = this->windowWidget->findChild<Widgets::Label*>("version-label");
|
||||
auto versionLabel = this->windowWidget->findChild<Widgets::Label*>("version-label");
|
||||
|
||||
if (versionLabel != nullptr) {
|
||||
versionLabel->setText("Bloom v" + QString::fromStdString(Application::VERSION.toString()));
|
||||
}
|
||||
if (versionLabel != nullptr) {
|
||||
versionLabel->setText("Bloom v" + QString::fromStdString(Application::VERSION.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,25 +5,22 @@
|
||||
#include <QtUiTools/QtUiTools>
|
||||
#include <memory>
|
||||
|
||||
namespace Bloom
|
||||
class AboutWindow: public QObject
|
||||
{
|
||||
class AboutWindow: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AboutWindow(QWidget* parent);
|
||||
public:
|
||||
explicit AboutWindow(QWidget* parent);
|
||||
|
||||
void show() {
|
||||
if (this->windowWidget != nullptr) {
|
||||
this->windowWidget->move(
|
||||
this->windowWidget->parentWidget()->geometry().center() - this->windowWidget->rect().center()
|
||||
);
|
||||
this->windowWidget->show();
|
||||
}
|
||||
void show() {
|
||||
if (this->windowWidget != nullptr) {
|
||||
this->windowWidget->move(
|
||||
this->windowWidget->parentWidget()->geometry().center() - this->windowWidget->rect().center()
|
||||
);
|
||||
this->windowWidget->show();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
QWidget* windowWidget = nullptr;
|
||||
};
|
||||
}
|
||||
private:
|
||||
QWidget* windowWidget = nullptr;
|
||||
};
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
#include "BloomProxyStyle.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
int BloomProxyStyle::styleHint(
|
||||
StyleHint hint,
|
||||
const QStyleOption* option,
|
||||
const QWidget* widget,
|
||||
QStyleHintReturn* returnData
|
||||
) const {
|
||||
if (hint == QStyle::SH_ComboBox_Popup) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return QProxyStyle::styleHint(hint, option, widget, returnData);
|
||||
int BloomProxyStyle::styleHint(
|
||||
StyleHint hint,
|
||||
const QStyleOption* option,
|
||||
const QWidget* widget,
|
||||
QStyleHintReturn* returnData
|
||||
) const {
|
||||
if (hint == QStyle::SH_ComboBox_Popup) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return QProxyStyle::styleHint(hint, option, widget, returnData);
|
||||
}
|
||||
|
||||
@@ -2,18 +2,15 @@
|
||||
|
||||
#include <QProxyStyle>
|
||||
|
||||
namespace Bloom
|
||||
class BloomProxyStyle: public QProxyStyle
|
||||
{
|
||||
class BloomProxyStyle: public QProxyStyle
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
int styleHint(
|
||||
StyleHint hint,
|
||||
const QStyleOption* option = nullptr,
|
||||
const QWidget* widget = nullptr,
|
||||
QStyleHintReturn* returnData = nullptr
|
||||
) const override;
|
||||
};
|
||||
}
|
||||
public:
|
||||
int styleHint(
|
||||
StyleHint hint,
|
||||
const QStyleOption* option = nullptr,
|
||||
const QWidget* widget = nullptr,
|
||||
QStyleHintReturn* returnData = nullptr
|
||||
) const override;
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -25,107 +25,104 @@
|
||||
#include "Widgets/TaskIndicator/TaskIndicator.hpp"
|
||||
#include "AboutWindow.hpp"
|
||||
|
||||
namespace Bloom
|
||||
class InsightWindow: public QMainWindow
|
||||
{
|
||||
class InsightWindow: public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
InsightWindow(
|
||||
const EnvironmentConfig& environmentConfig,
|
||||
const InsightConfig& insightConfig,
|
||||
InsightProjectSettings& insightProjectSettings,
|
||||
const Targets::TargetDescriptor& targetDescriptor
|
||||
);
|
||||
public:
|
||||
InsightWindow(
|
||||
const EnvironmentConfig& environmentConfig,
|
||||
const InsightConfig& insightConfig,
|
||||
InsightProjectSettings& insightProjectSettings,
|
||||
const Targets::TargetDescriptor& targetDescriptor
|
||||
);
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
void showEvent(QShowEvent* event) override;
|
||||
void closeEvent(QCloseEvent* event) override;
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
void showEvent(QShowEvent* event) override;
|
||||
void closeEvent(QCloseEvent* event) override;
|
||||
|
||||
private:
|
||||
InsightProjectSettings& insightProjectSettings;
|
||||
private:
|
||||
InsightProjectSettings& insightProjectSettings;
|
||||
|
||||
InsightConfig insightConfig;
|
||||
EnvironmentConfig environmentConfig;
|
||||
TargetConfig targetConfig;
|
||||
InsightConfig insightConfig;
|
||||
EnvironmentConfig environmentConfig;
|
||||
TargetConfig targetConfig;
|
||||
|
||||
const Targets::TargetDescriptor& targetDescriptor;
|
||||
Targets::TargetState targetState = Targets::TargetState::UNKNOWN;
|
||||
const Targets::TargetDescriptor& targetDescriptor;
|
||||
Targets::TargetState targetState = Targets::TargetState::UNKNOWN;
|
||||
|
||||
QWidget* windowContainer = nullptr;
|
||||
QMenuBar* mainMenuBar = nullptr;
|
||||
QWidget* layoutContainer = nullptr;
|
||||
QWidget* container = nullptr;
|
||||
QMenu* variantMenu = nullptr;
|
||||
Widgets::Label* targetNameLabel = nullptr;
|
||||
Widgets::Label* targetIdLabel = nullptr;
|
||||
AboutWindow* aboutWindowWidget = nullptr;
|
||||
QWidget* windowContainer = nullptr;
|
||||
QMenuBar* mainMenuBar = nullptr;
|
||||
QWidget* layoutContainer = nullptr;
|
||||
QWidget* container = nullptr;
|
||||
QMenu* variantMenu = nullptr;
|
||||
Widgets::Label* targetNameLabel = nullptr;
|
||||
Widgets::Label* targetIdLabel = nullptr;
|
||||
AboutWindow* aboutWindowWidget = nullptr;
|
||||
|
||||
QWidget* header = nullptr;
|
||||
Widgets::SvgToolButton* refreshIoInspectionButton = nullptr;
|
||||
QWidget* header = nullptr;
|
||||
Widgets::SvgToolButton* refreshIoInspectionButton = nullptr;
|
||||
|
||||
QWidget* leftMenuBar = nullptr;
|
||||
Widgets::PanelWidget* leftPanel = nullptr;
|
||||
Widgets::TargetRegistersPaneWidget* targetRegistersSidePane = nullptr;
|
||||
QToolButton* targetRegistersButton = nullptr;
|
||||
QWidget* leftMenuBar = nullptr;
|
||||
Widgets::PanelWidget* leftPanel = nullptr;
|
||||
Widgets::TargetRegistersPaneWidget* targetRegistersSidePane = nullptr;
|
||||
QToolButton* targetRegistersButton = nullptr;
|
||||
|
||||
Widgets::Label* ioUnavailableWidget = nullptr;
|
||||
Widgets::InsightTargetWidgets::TargetPackageWidgetContainer* ioContainerWidget = nullptr;
|
||||
Widgets::InsightTargetWidgets::TargetPackageWidget* targetPackageWidget = nullptr;
|
||||
Widgets::Label* ioUnavailableWidget = nullptr;
|
||||
Widgets::InsightTargetWidgets::TargetPackageWidgetContainer* ioContainerWidget = nullptr;
|
||||
Widgets::InsightTargetWidgets::TargetPackageWidget* targetPackageWidget = nullptr;
|
||||
|
||||
QWidget* bottomMenuBar = nullptr;
|
||||
Widgets::PanelWidget* bottomPanel = nullptr;
|
||||
Widgets::TargetMemoryInspectionPane* ramInspectionPane = nullptr;
|
||||
Widgets::TargetMemoryInspectionPane* eepromInspectionPane = nullptr;
|
||||
Widgets::TargetMemoryInspectionPane* flashInspectionPane = nullptr;
|
||||
std::map<
|
||||
Targets::TargetMemoryType,
|
||||
Widgets::TargetMemoryInspectionPaneSettings
|
||||
> memoryInspectionPaneSettingsByMemoryType;
|
||||
QToolButton* ramInspectionButton = nullptr;
|
||||
QToolButton* eepromInspectionButton = nullptr;
|
||||
QToolButton* flashInspectionButton = nullptr;
|
||||
QWidget* bottomMenuBar = nullptr;
|
||||
Widgets::PanelWidget* bottomPanel = nullptr;
|
||||
Widgets::TargetMemoryInspectionPane* ramInspectionPane = nullptr;
|
||||
Widgets::TargetMemoryInspectionPane* eepromInspectionPane = nullptr;
|
||||
Widgets::TargetMemoryInspectionPane* flashInspectionPane = nullptr;
|
||||
std::map<
|
||||
Targets::TargetMemoryType,
|
||||
Widgets::TargetMemoryInspectionPaneSettings
|
||||
> memoryInspectionPaneSettingsByMemoryType;
|
||||
QToolButton* ramInspectionButton = nullptr;
|
||||
QToolButton* eepromInspectionButton = nullptr;
|
||||
QToolButton* flashInspectionButton = nullptr;
|
||||
|
||||
QWidget* footer = nullptr;
|
||||
Widgets::Label* targetStatusLabel = nullptr;
|
||||
Widgets::Label* programCounterValueLabel = nullptr;
|
||||
Widgets::TaskIndicator* taskIndicator = nullptr;
|
||||
QWidget* footer = nullptr;
|
||||
Widgets::Label* targetStatusLabel = nullptr;
|
||||
Widgets::Label* programCounterValueLabel = nullptr;
|
||||
Widgets::TaskIndicator* taskIndicator = nullptr;
|
||||
|
||||
std::map<QString, Targets::TargetVariant> supportedVariantsByName;
|
||||
const Targets::TargetVariant* selectedVariant = nullptr;
|
||||
std::optional<Targets::TargetVariant> previouslySelectedVariant;
|
||||
bool uiDisabled = false;
|
||||
std::map<QString, Targets::TargetVariant> supportedVariantsByName;
|
||||
const Targets::TargetVariant* selectedVariant = nullptr;
|
||||
std::optional<Targets::TargetVariant> previouslySelectedVariant;
|
||||
bool uiDisabled = false;
|
||||
|
||||
static bool isVariantSupported(const Targets::TargetVariant& variant);
|
||||
static bool isVariantSupported(const Targets::TargetVariant& variant);
|
||||
|
||||
void setUiDisabled(bool disable);
|
||||
void setUiDisabled(bool disable);
|
||||
|
||||
void populateVariantMenu();
|
||||
void selectDefaultVariant();
|
||||
void selectVariant(const Targets::TargetVariant* variant);
|
||||
void createPanes();
|
||||
void populateVariantMenu();
|
||||
void selectDefaultVariant();
|
||||
void selectVariant(const Targets::TargetVariant* variant);
|
||||
void createPanes();
|
||||
|
||||
void adjustPanels();
|
||||
void adjustMinimumSize();
|
||||
void adjustPanels();
|
||||
void adjustMinimumSize();
|
||||
|
||||
void onTargetStateUpdate(Targets::TargetState newState);
|
||||
void refresh();
|
||||
void refreshPinStates();
|
||||
void refreshProgramCounter(std::optional<std::function<void(void)>> callback = std::nullopt);
|
||||
void openReportIssuesUrl();
|
||||
void openGettingStartedUrl();
|
||||
void openAboutWindow();
|
||||
void toggleTargetRegistersPane();
|
||||
void toggleRamInspectionPane();
|
||||
void toggleEepromInspectionPane();
|
||||
void toggleFlashInspectionPane();
|
||||
void onRegistersPaneStateChanged();
|
||||
void onRamInspectionPaneStateChanged();
|
||||
void onEepromInspectionPaneStateChanged();
|
||||
void onFlashInspectionPaneStateChanged();
|
||||
void onProgrammingModeEnabled();
|
||||
void onProgrammingModeDisabled();
|
||||
};
|
||||
}
|
||||
void onTargetStateUpdate(Targets::TargetState newState);
|
||||
void refresh();
|
||||
void refreshPinStates();
|
||||
void refreshProgramCounter(std::optional<std::function<void(void)>> callback = std::nullopt);
|
||||
void openReportIssuesUrl();
|
||||
void openGettingStartedUrl();
|
||||
void openAboutWindow();
|
||||
void toggleTargetRegistersPane();
|
||||
void toggleRamInspectionPane();
|
||||
void toggleEepromInspectionPane();
|
||||
void toggleFlashInspectionPane();
|
||||
void onRegistersPaneStateChanged();
|
||||
void onRamInspectionPaneStateChanged();
|
||||
void onEepromInspectionPaneStateChanged();
|
||||
void onFlashInspectionPaneStateChanged();
|
||||
void onProgrammingModeEnabled();
|
||||
void onProgrammingModeDisabled();
|
||||
};
|
||||
|
||||
@@ -14,113 +14,110 @@
|
||||
#include "Widgets/ExpandingHeightScrollAreaWidget.hpp"
|
||||
#include "Widgets/TargetWidgets/TargetPackageWidgetContainer.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using namespace Bloom::Widgets;
|
||||
using namespace Widgets;
|
||||
|
||||
UiLoader::UiLoader(QObject* parent): QUiLoader(parent) {
|
||||
this->customWidgetConstructorsByWidgetName = {
|
||||
{
|
||||
"Label",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new Label(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"RotatableLabel",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new RotatableLabel("", parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"LabeledSeparator",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new LabeledSeparator(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"TextInput",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new TextInput(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"PlainTextEdit",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new PlainTextEdit(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"PushButton",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new PushButton(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"ExpandingHeightScrollAreaWidget",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new ExpandingHeightScrollAreaWidget(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"SvgWidget",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new SvgWidget(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"SvgToolButton",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new SvgToolButton(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"TargetPackageWidgetContainer",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new InsightTargetWidgets::TargetPackageWidgetContainer(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
QWidget* UiLoader::createWidget(const QString& className, QWidget* parent, const QString& name) {
|
||||
const auto widgetConstructorIt = this->customWidgetConstructorsByWidgetName.find(className);
|
||||
|
||||
if (widgetConstructorIt != this->customWidgetConstructorsByWidgetName.end()) {
|
||||
// This is a custom widget - call the mapped constructor
|
||||
return widgetConstructorIt->second(parent, name);
|
||||
}
|
||||
|
||||
return QUiLoader::createWidget(className, parent, name);
|
||||
}
|
||||
UiLoader::UiLoader(QObject* parent): QUiLoader(parent) {
|
||||
this->customWidgetConstructorsByWidgetName = {
|
||||
{
|
||||
"Label",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new Label(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"RotatableLabel",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new RotatableLabel("", parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"LabeledSeparator",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new LabeledSeparator(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"TextInput",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new TextInput(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"PlainTextEdit",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new PlainTextEdit(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"PushButton",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new PushButton(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"ExpandingHeightScrollAreaWidget",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new ExpandingHeightScrollAreaWidget(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"SvgWidget",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new SvgWidget(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"SvgToolButton",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new SvgToolButton(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"TargetPackageWidgetContainer",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new InsightTargetWidgets::TargetPackageWidgetContainer(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
QWidget* UiLoader::createWidget(const QString& className, QWidget* parent, const QString& name) {
|
||||
const auto widgetConstructorIt = this->customWidgetConstructorsByWidgetName.find(className);
|
||||
|
||||
if (widgetConstructorIt != this->customWidgetConstructorsByWidgetName.end()) {
|
||||
// This is a custom widget - call the mapped constructor
|
||||
return widgetConstructorIt->second(parent, name);
|
||||
}
|
||||
|
||||
return QUiLoader::createWidget(className, parent, name);
|
||||
}
|
||||
|
||||
@@ -3,21 +3,18 @@
|
||||
#include <QUiLoader>
|
||||
#include <QSize>
|
||||
|
||||
namespace Bloom
|
||||
class UiLoader: public QUiLoader
|
||||
{
|
||||
class UiLoader: public QUiLoader
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit UiLoader(QObject* parent);
|
||||
public:
|
||||
explicit UiLoader(QObject* parent);
|
||||
|
||||
QWidget* createWidget(const QString& className, QWidget* parent, const QString& name) override;
|
||||
QWidget* createWidget(const QString& className, QWidget* parent, const QString& name) override;
|
||||
|
||||
private:
|
||||
std::map<
|
||||
QString,
|
||||
std::function<QWidget*(QWidget* parent, const QString& name)>
|
||||
> customWidgetConstructorsByWidgetName = {};
|
||||
};
|
||||
}
|
||||
private:
|
||||
std::map<
|
||||
QString,
|
||||
std::function<QWidget*(QWidget* parent, const QString& name)>
|
||||
> customWidgetConstructorsByWidgetName = {};
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "ClickableWidget.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
void ClickableWidget::mouseReleaseEvent(QMouseEvent* event) {
|
||||
if (event->button() == Qt::MouseButton::LeftButton) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <QEvent>
|
||||
#include <QMouseEvent>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class ClickableWidget: public QFrame
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "ConfirmationDialog.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
ConfirmationDialog::ConfirmationDialog(
|
||||
const QString& windowTitle,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "Dialog/Dialog.hpp"
|
||||
#include "PushButton.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class ConfirmationDialog: public Dialog
|
||||
{
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
#include "src/Services/PathService.hpp"
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
using Bloom::Exceptions::Exception;
|
||||
using Exceptions::Exception;
|
||||
|
||||
Dialog::Dialog(
|
||||
const QString& windowTitle,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/Label.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class Dialog: public QDialog
|
||||
{
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
#include "src/Services/PathService.hpp"
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
using Bloom::Exceptions::Exception;
|
||||
using Exceptions::Exception;
|
||||
|
||||
ErrorDialogue::ErrorDialogue(
|
||||
const QString& windowTitle,
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/Label.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
/**
|
||||
* @deprecated
|
||||
* TODO: Bin this. Replace all usages with Bloom::Widgets::Dialog.
|
||||
* TODO: Bin this. Replace all usages with Widgets::Dialog.
|
||||
*/
|
||||
class ErrorDialogue: public QDialog
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <QScrollArea>
|
||||
#include <QSize>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class ExpandingHeightScrollAreaWidget: public QScrollArea
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <QLabel>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class Label: public QLabel
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "LabeledSeparator.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
LabeledSeparator::LabeledSeparator(QString title, QWidget* parent): title(std::move(title)), QWidget(parent) {
|
||||
this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <QPaintEvent>
|
||||
#include <QPainter>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class LabeledSeparator: public QWidget
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <QGraphicsView>
|
||||
#include <QGraphicsScene>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class ListItem: public QGraphicsItem
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <QByteArray>
|
||||
#include <algorithm>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
ListScene::ListScene(
|
||||
ListScene::ListItemSetType&& items,
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "ListItem.hpp"
|
||||
#include "src/Helpers/DereferenceLessComparator.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class ListScene: public QGraphicsScene
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "ListView.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
ListView::ListView(
|
||||
ListScene::ListItemSetType&& items,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "ListScene.hpp"
|
||||
#include "ListItem.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class ListView: public QGraphicsView
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <QPoint>
|
||||
#include <optional>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
struct DetachedWindowState
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "PaneWidget.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
PaneWidget::PaneWidget(PaneState& state, PanelWidget* parent)
|
||||
: state(state)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "PanelWidget.hpp"
|
||||
#include "PaneState.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class PaneWidget: public QWidget
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
struct PanelState
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include "PaneWidget.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
PanelWidget::PanelWidget(PanelWidgetType type, PanelState& state, QWidget* parent)
|
||||
: panelType(type)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "PanelState.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
Q_NAMESPACE
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <QMenu>
|
||||
#include <QAction>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
PlainTextEdit::PlainTextEdit(QWidget* parent)
|
||||
: QPlainTextEdit(parent)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <QPlainTextEdit>
|
||||
#include <QContextMenuEvent>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class PlainTextEdit: public QPlainTextEdit
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "PushButton.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
PushButton::PushButton(QWidget* parent)
|
||||
: QPushButton(parent)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <QPushButton>
|
||||
#include <QString>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class PushButton: public QPushButton
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
void RotatableLabel::paintEvent(QPaintEvent* event) {
|
||||
auto painter = QPainter(this);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "Label.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class RotatableLabel: public Label
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "SvgToolButton.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
SvgToolButton::SvgToolButton(QWidget* parent): QToolButton(parent) {
|
||||
this->setButtonWidth(10);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "SvgWidget.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class SvgToolButton: public QToolButton
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <QPainter>
|
||||
#include <cmath>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
SvgWidget::SvgWidget(QWidget* parent): QFrame(parent) {
|
||||
this->renderer.setAspectRatioMode(Qt::AspectRatioMode::KeepAspectRatioByExpanding);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <QSize>
|
||||
#include <QPropertyAnimation>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class SvgWidget: public QFrame
|
||||
{
|
||||
|
||||
@@ -2,11 +2,8 @@
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace Bloom
|
||||
enum class AddressType: std::uint8_t
|
||||
{
|
||||
enum class AddressType: std::uint8_t
|
||||
{
|
||||
ABSOLUTE,
|
||||
RELATIVE,
|
||||
};
|
||||
}
|
||||
ABSOLUTE,
|
||||
RELATIVE,
|
||||
};
|
||||
|
||||
@@ -2,21 +2,18 @@
|
||||
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
ExcludedMemoryRegion::ExcludedMemoryRegion(
|
||||
const QString& name,
|
||||
Targets::TargetMemoryType memoryType,
|
||||
const Targets::TargetMemoryAddressRange& addressRange
|
||||
)
|
||||
: MemoryRegion(name, memoryType, MemoryRegionType::EXCLUDED, addressRange)
|
||||
{}
|
||||
ExcludedMemoryRegion::ExcludedMemoryRegion(
|
||||
const QString& name,
|
||||
Targets::TargetMemoryType memoryType,
|
||||
const Targets::TargetMemoryAddressRange& addressRange
|
||||
)
|
||||
: MemoryRegion(name, memoryType, MemoryRegionType::EXCLUDED, addressRange)
|
||||
{}
|
||||
|
||||
ExcludedMemoryRegion::ExcludedMemoryRegion(const QJsonObject& jsonObject)
|
||||
: MemoryRegion(jsonObject)
|
||||
{
|
||||
if (this->type != MemoryRegionType::EXCLUDED) {
|
||||
throw Exceptions::Exception("Invalid memory region type");
|
||||
}
|
||||
ExcludedMemoryRegion::ExcludedMemoryRegion(const QJsonObject& jsonObject)
|
||||
: MemoryRegion(jsonObject)
|
||||
{
|
||||
if (this->type != MemoryRegionType::EXCLUDED) {
|
||||
throw Exceptions::Exception("Invalid memory region type");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,17 +2,14 @@
|
||||
|
||||
#include "MemoryRegion.hpp"
|
||||
|
||||
namespace Bloom
|
||||
class ExcludedMemoryRegion: public MemoryRegion
|
||||
{
|
||||
class ExcludedMemoryRegion: public MemoryRegion
|
||||
{
|
||||
public:
|
||||
ExcludedMemoryRegion(
|
||||
const QString& name,
|
||||
Targets::TargetMemoryType memoryType,
|
||||
const Targets::TargetMemoryAddressRange& addressRange
|
||||
);
|
||||
public:
|
||||
ExcludedMemoryRegion(
|
||||
const QString& name,
|
||||
Targets::TargetMemoryType memoryType,
|
||||
const Targets::TargetMemoryAddressRange& addressRange
|
||||
);
|
||||
|
||||
ExcludedMemoryRegion(const QJsonObject& jsonObject);
|
||||
};
|
||||
}
|
||||
ExcludedMemoryRegion(const QJsonObject& jsonObject);
|
||||
};
|
||||
|
||||
@@ -2,38 +2,35 @@
|
||||
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
namespace Bloom
|
||||
FocusedMemoryRegion::FocusedMemoryRegion(
|
||||
const QString& name,
|
||||
Targets::TargetMemoryType memoryType,
|
||||
const Targets::TargetMemoryAddressRange& addressRange
|
||||
)
|
||||
: MemoryRegion(name, memoryType, MemoryRegionType::FOCUSED, addressRange)
|
||||
{}
|
||||
|
||||
FocusedMemoryRegion::FocusedMemoryRegion(const QJsonObject& jsonObject)
|
||||
: MemoryRegion(jsonObject)
|
||||
{
|
||||
FocusedMemoryRegion::FocusedMemoryRegion(
|
||||
const QString& name,
|
||||
Targets::TargetMemoryType memoryType,
|
||||
const Targets::TargetMemoryAddressRange& addressRange
|
||||
)
|
||||
: MemoryRegion(name, memoryType, MemoryRegionType::FOCUSED, addressRange)
|
||||
{}
|
||||
using Exceptions::Exception;
|
||||
|
||||
FocusedMemoryRegion::FocusedMemoryRegion(const QJsonObject& jsonObject)
|
||||
: MemoryRegion(jsonObject)
|
||||
{
|
||||
using Exceptions::Exception;
|
||||
|
||||
if (this->type != MemoryRegionType::FOCUSED) {
|
||||
throw Exception("Invalid memory region type");
|
||||
}
|
||||
|
||||
if (!jsonObject.contains("dataType") || !jsonObject.contains("endianness")) {
|
||||
throw Exception("Missing data");
|
||||
}
|
||||
|
||||
this->dataType = FocusedMemoryRegion::regionDataTypesByName.at(jsonObject.find("dataType")->toString());
|
||||
this->endianness = FocusedMemoryRegion::regionEndiannessByName.at(jsonObject.find("endianness")->toString());
|
||||
if (this->type != MemoryRegionType::FOCUSED) {
|
||||
throw Exception("Invalid memory region type");
|
||||
}
|
||||
|
||||
QJsonObject FocusedMemoryRegion::toJson() const {
|
||||
auto jsonObject = MemoryRegion::toJson();
|
||||
jsonObject.insert("dataType", FocusedMemoryRegion::regionDataTypesByName.at(this->dataType));
|
||||
jsonObject.insert("endianness", FocusedMemoryRegion::regionEndiannessByName.at(this->endianness));
|
||||
|
||||
return jsonObject;
|
||||
if (!jsonObject.contains("dataType") || !jsonObject.contains("endianness")) {
|
||||
throw Exception("Missing data");
|
||||
}
|
||||
|
||||
this->dataType = FocusedMemoryRegion::regionDataTypesByName.at(jsonObject.find("dataType")->toString());
|
||||
this->endianness = FocusedMemoryRegion::regionEndiannessByName.at(jsonObject.find("endianness")->toString());
|
||||
}
|
||||
|
||||
QJsonObject FocusedMemoryRegion::toJson() const {
|
||||
auto jsonObject = MemoryRegion::toJson();
|
||||
jsonObject.insert("dataType", FocusedMemoryRegion::regionDataTypesByName.at(this->dataType));
|
||||
jsonObject.insert("endianness", FocusedMemoryRegion::regionEndiannessByName.at(this->endianness));
|
||||
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
@@ -6,43 +6,40 @@
|
||||
|
||||
#include "src/Helpers/BiMap.hpp"
|
||||
|
||||
namespace Bloom
|
||||
enum class MemoryRegionDataType: std::uint8_t
|
||||
{
|
||||
enum class MemoryRegionDataType: std::uint8_t
|
||||
{
|
||||
UNKNOWN,
|
||||
UNSIGNED_INTEGER,
|
||||
SIGNED_INTEGER,
|
||||
ASCII_STRING,
|
||||
UNKNOWN,
|
||||
UNSIGNED_INTEGER,
|
||||
SIGNED_INTEGER,
|
||||
ASCII_STRING,
|
||||
};
|
||||
|
||||
class FocusedMemoryRegion: public MemoryRegion
|
||||
{
|
||||
public:
|
||||
MemoryRegionDataType dataType = MemoryRegionDataType::UNKNOWN;
|
||||
Targets::TargetMemoryEndianness endianness = Targets::TargetMemoryEndianness::LITTLE;
|
||||
|
||||
FocusedMemoryRegion(
|
||||
const QString& name,
|
||||
Targets::TargetMemoryType memoryType,
|
||||
const Targets::TargetMemoryAddressRange& addressRange
|
||||
);
|
||||
|
||||
FocusedMemoryRegion(const QJsonObject& jsonObject);
|
||||
|
||||
QJsonObject toJson() const override;
|
||||
|
||||
private:
|
||||
static const inline BiMap<MemoryRegionDataType, QString> regionDataTypesByName = {
|
||||
{MemoryRegionDataType::UNKNOWN, "other"},
|
||||
{MemoryRegionDataType::UNSIGNED_INTEGER, "unsigned_int"},
|
||||
{MemoryRegionDataType::SIGNED_INTEGER, "signed_int"},
|
||||
{MemoryRegionDataType::ASCII_STRING, "ascii_string"},
|
||||
};
|
||||
|
||||
class FocusedMemoryRegion: public MemoryRegion
|
||||
{
|
||||
public:
|
||||
MemoryRegionDataType dataType = MemoryRegionDataType::UNKNOWN;
|
||||
Targets::TargetMemoryEndianness endianness = Targets::TargetMemoryEndianness::LITTLE;
|
||||
|
||||
FocusedMemoryRegion(
|
||||
const QString& name,
|
||||
Targets::TargetMemoryType memoryType,
|
||||
const Targets::TargetMemoryAddressRange& addressRange
|
||||
);
|
||||
|
||||
FocusedMemoryRegion(const QJsonObject& jsonObject);
|
||||
|
||||
QJsonObject toJson() const override;
|
||||
|
||||
private:
|
||||
static const inline BiMap<MemoryRegionDataType, QString> regionDataTypesByName = {
|
||||
{MemoryRegionDataType::UNKNOWN, "other"},
|
||||
{MemoryRegionDataType::UNSIGNED_INTEGER, "unsigned_int"},
|
||||
{MemoryRegionDataType::SIGNED_INTEGER, "signed_int"},
|
||||
{MemoryRegionDataType::ASCII_STRING, "ascii_string"},
|
||||
};
|
||||
|
||||
static const inline BiMap<Targets::TargetMemoryEndianness, QString> regionEndiannessByName = {
|
||||
{Targets::TargetMemoryEndianness::LITTLE, "little"},
|
||||
{Targets::TargetMemoryEndianness::BIG, "big"},
|
||||
};
|
||||
static const inline BiMap<Targets::TargetMemoryEndianness, QString> regionEndiannessByName = {
|
||||
{Targets::TargetMemoryEndianness::LITTLE, "little"},
|
||||
{Targets::TargetMemoryEndianness::BIG, "big"},
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "ByteAddressContainer.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
ByteAddressContainer::ByteAddressContainer(const HexViewerSharedState& hexViewerState)
|
||||
: hexViewerState(hexViewerState)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "HexViewerSharedState.hpp"
|
||||
#include "ByteAddressItem.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class ByteAddressContainer: public QGraphicsItem
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "ByteAddressItem.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
ByteAddressItem::ByteAddressItem(const HexViewerSharedState& hexViewerState, QGraphicsItem* parent)
|
||||
: hexViewerState(hexViewerState)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "ByteItem.hpp"
|
||||
#include "HexViewerSharedState.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class ByteAddressItem: public QGraphicsItem
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "ByteItem.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
ByteItem::ByteItem(Targets::TargetMemoryAddress address)
|
||||
: HexViewerItem(address)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "HexViewerItem.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
#pragma pack(push, 1)
|
||||
class ByteItem: public HexViewerItem
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "ContextMenuAction.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
ContextMenuAction::ContextMenuAction(
|
||||
const QString& text,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
#include "ByteItem.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class ContextMenuAction: public QAction
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <cassert>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
FocusedRegionGroupItem::FocusedRegionGroupItem(
|
||||
const FocusedMemoryRegion& focusedRegion,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/FocusedMemoryRegion.hpp"
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class FocusedRegionGroupItem: public GroupItem
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "GroupItem.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
GroupItem::~GroupItem() {
|
||||
for (auto& byteItem : this->items) {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
#include "HexViewerSharedState.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class GroupItem: public HexViewerItem
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "HexViewerItem.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
HexViewerItem::HexViewerItem(Targets::TargetMemoryAddress startAddress, HexViewerItem* parent)
|
||||
: startAddress(startAddress)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
#include "HexViewerSharedState.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class GraphicsItem;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
HexViewerItemIndex::HexViewerItemIndex(
|
||||
const TopLevelGroupItem* topLevelGroupItem,
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "TopLevelGroupItem.hpp"
|
||||
#include "ByteItem.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
/**
|
||||
* This class maintains indices of hex viewer item positions and provides fast lookups for items within certain
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <QScrollBar>
|
||||
#include <QColor>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
HexViewerItemRenderer::HexViewerItemRenderer(
|
||||
const HexViewerSharedState& hexViewerState,
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "FocusedRegionGroupItem.hpp"
|
||||
#include "StackMemoryGroupItem.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
/**
|
||||
* Renders hex viewer items in a QGraphicsScene.
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
#include "HexViewerWidgetSettings.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class ByteItem;
|
||||
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
#include "src/Services/PathService.hpp"
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
using namespace Bloom::Exceptions;
|
||||
using namespace Exceptions;
|
||||
|
||||
using Bloom::Targets::TargetMemoryDescriptor;
|
||||
using Targets::TargetMemoryDescriptor;
|
||||
|
||||
HexViewerWidget::HexViewerWidget(
|
||||
const TargetMemoryDescriptor& targetMemoryDescriptor,
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/FocusedMemoryRegion.hpp"
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/ExcludedMemoryRegion.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class HexViewerWidget: public QWidget
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/AddressType.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
struct HexViewerWidgetSettings
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
#include "src/Insight/InsightWorker/Tasks/ConstructHexViewerTopLevelGroupItem.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
ItemGraphicsScene::ItemGraphicsScene(
|
||||
const Targets::TargetMemoryDescriptor& targetMemoryDescriptor,
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/ExcludedMemoryRegion.hpp"
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/AddressType.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class ItemGraphicsScene: public QGraphicsScene
|
||||
{
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
|
||||
#include "ByteItem.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
using Bloom::Targets::TargetMemoryDescriptor;
|
||||
using Targets::TargetMemoryDescriptor;
|
||||
|
||||
ItemGraphicsView::ItemGraphicsView(
|
||||
const TargetMemoryDescriptor& targetMemoryDescriptor,
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/Label.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class ItemGraphicsView: public QGraphicsView
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <cassert>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
StackMemoryGroupItem::StackMemoryGroupItem(
|
||||
Targets::TargetStackPointer stackPointer,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/FocusedMemoryRegion.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class StackMemoryGroupItem: public GroupItem
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "TopLevelGroupItem.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
TopLevelGroupItem::TopLevelGroupItem(
|
||||
const std::vector<FocusedMemoryRegion>& focusedMemoryRegions,
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/FocusedMemoryRegion.hpp"
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/ExcludedMemoryRegion.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class TopLevelGroupItem: public GroupItem
|
||||
{
|
||||
|
||||
@@ -3,65 +3,62 @@
|
||||
#include "src/Helpers/EnumToStringMappings.hpp"
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
MemoryRegion::MemoryRegion(
|
||||
const QString& name,
|
||||
Targets::TargetMemoryType memoryType,
|
||||
MemoryRegionType type,
|
||||
const Targets::TargetMemoryAddressRange& addressRange
|
||||
)
|
||||
: name(name)
|
||||
, memoryType(memoryType)
|
||||
, type(type)
|
||||
, addressRange(addressRange)
|
||||
{}
|
||||
MemoryRegion::MemoryRegion(
|
||||
const QString& name,
|
||||
Targets::TargetMemoryType memoryType,
|
||||
MemoryRegionType type,
|
||||
const Targets::TargetMemoryAddressRange& addressRange
|
||||
)
|
||||
: name(name)
|
||||
, memoryType(memoryType)
|
||||
, type(type)
|
||||
, addressRange(addressRange)
|
||||
{}
|
||||
|
||||
MemoryRegion::MemoryRegion(const QJsonObject& jsonObject) {
|
||||
using Exceptions::Exception;
|
||||
MemoryRegion::MemoryRegion(const QJsonObject& jsonObject) {
|
||||
using Exceptions::Exception;
|
||||
|
||||
if (
|
||||
!jsonObject.contains("name")
|
||||
|| !jsonObject.contains("memoryType")
|
||||
|| !jsonObject.contains("type")
|
||||
|| !jsonObject.contains("createdTimestamp")
|
||||
|| !jsonObject.contains("addressInputType")
|
||||
|| !jsonObject.contains("addressRange")
|
||||
) {
|
||||
throw Exception("Missing data");
|
||||
}
|
||||
|
||||
const auto addressRangeObj = jsonObject.find("addressRange")->toObject();
|
||||
if (
|
||||
!addressRangeObj.contains("startAddress")
|
||||
|| !addressRangeObj.contains("endAddress")
|
||||
) {
|
||||
throw Exception("Missing address range data");
|
||||
}
|
||||
|
||||
this->name = jsonObject.find("name")->toString();
|
||||
this->memoryType = EnumToStringMappings::targetMemoryTypes.at(jsonObject.find("memoryType")->toString());
|
||||
this->type = MemoryRegion::memoryRegionTypesByName.at(jsonObject.find("type")->toString());
|
||||
this->createdDate.setSecsSinceEpoch(jsonObject.find("createdTimestamp")->toInteger());
|
||||
this->addressRangeInputType = MemoryRegion::addressTypesByName.at(jsonObject.find("addressInputType")->toString());
|
||||
|
||||
this->addressRange = {
|
||||
static_cast<std::uint32_t>(addressRangeObj.find("startAddress")->toInteger()),
|
||||
static_cast<std::uint32_t>(addressRangeObj.find("endAddress")->toInteger()),
|
||||
};
|
||||
if (
|
||||
!jsonObject.contains("name")
|
||||
|| !jsonObject.contains("memoryType")
|
||||
|| !jsonObject.contains("type")
|
||||
|| !jsonObject.contains("createdTimestamp")
|
||||
|| !jsonObject.contains("addressInputType")
|
||||
|| !jsonObject.contains("addressRange")
|
||||
) {
|
||||
throw Exception("Missing data");
|
||||
}
|
||||
|
||||
QJsonObject MemoryRegion::toJson() const {
|
||||
return QJsonObject({
|
||||
{"name", this->name},
|
||||
{"memoryType", EnumToStringMappings::targetMemoryTypes.at(this->memoryType)},
|
||||
{"type", MemoryRegion::memoryRegionTypesByName.at(this->type)},
|
||||
{"createdTimestamp", this->createdDate.toSecsSinceEpoch()},
|
||||
{"addressInputType", MemoryRegion::addressTypesByName.at(this->addressRangeInputType)},
|
||||
{"addressRange", QJsonObject({
|
||||
{"startAddress", static_cast<qint64>(this->addressRange.startAddress)},
|
||||
{"endAddress", static_cast<qint64>(this->addressRange.endAddress)},
|
||||
})},
|
||||
});
|
||||
const auto addressRangeObj = jsonObject.find("addressRange")->toObject();
|
||||
if (
|
||||
!addressRangeObj.contains("startAddress")
|
||||
|| !addressRangeObj.contains("endAddress")
|
||||
) {
|
||||
throw Exception("Missing address range data");
|
||||
}
|
||||
|
||||
this->name = jsonObject.find("name")->toString();
|
||||
this->memoryType = EnumToStringMappings::targetMemoryTypes.at(jsonObject.find("memoryType")->toString());
|
||||
this->type = MemoryRegion::memoryRegionTypesByName.at(jsonObject.find("type")->toString());
|
||||
this->createdDate.setSecsSinceEpoch(jsonObject.find("createdTimestamp")->toInteger());
|
||||
this->addressRangeInputType = MemoryRegion::addressTypesByName.at(jsonObject.find("addressInputType")->toString());
|
||||
|
||||
this->addressRange = {
|
||||
static_cast<std::uint32_t>(addressRangeObj.find("startAddress")->toInteger()),
|
||||
static_cast<std::uint32_t>(addressRangeObj.find("endAddress")->toInteger()),
|
||||
};
|
||||
}
|
||||
|
||||
QJsonObject MemoryRegion::toJson() const {
|
||||
return QJsonObject({
|
||||
{"name", this->name},
|
||||
{"memoryType", EnumToStringMappings::targetMemoryTypes.at(this->memoryType)},
|
||||
{"type", MemoryRegion::memoryRegionTypesByName.at(this->type)},
|
||||
{"createdTimestamp", this->createdDate.toSecsSinceEpoch()},
|
||||
{"addressInputType", MemoryRegion::addressTypesByName.at(this->addressRangeInputType)},
|
||||
{"addressRange", QJsonObject({
|
||||
{"startAddress", static_cast<qint64>(this->addressRange.startAddress)},
|
||||
{"endAddress", static_cast<qint64>(this->addressRange.endAddress)},
|
||||
})},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -13,79 +13,76 @@
|
||||
|
||||
#include "src/Helpers/BiMap.hpp"
|
||||
|
||||
namespace Bloom
|
||||
enum class MemoryRegionType: std::uint8_t
|
||||
{
|
||||
enum class MemoryRegionType: std::uint8_t
|
||||
{
|
||||
FOCUSED,
|
||||
EXCLUDED,
|
||||
FOCUSED,
|
||||
EXCLUDED,
|
||||
};
|
||||
|
||||
enum class MemoryRegionAddressInputType: std::uint8_t
|
||||
{
|
||||
ABSOLUTE,
|
||||
RELATIVE,
|
||||
};
|
||||
|
||||
class MemoryRegion
|
||||
{
|
||||
public:
|
||||
QString name;
|
||||
QDateTime createdDate = Services::DateTimeService::currentDateTime();
|
||||
Targets::TargetMemoryType memoryType;
|
||||
MemoryRegionType type;
|
||||
|
||||
/**
|
||||
* The addressRangeType holds the user's preference when inputting address ranges in the memory region manager
|
||||
* window, for this particular memory region.
|
||||
*
|
||||
* It has no significance anywhere else. We never store the address in relative form - this->addressRange will
|
||||
* always be in absolute form. Conversion is done at the point of applying the changes.
|
||||
*
|
||||
* For more, see the following and their call sites:
|
||||
* See RegionItem::convertRelativeToAbsoluteAddressRange()
|
||||
* See RegionItem::convertAbsoluteToRelativeAddressRange()
|
||||
*/
|
||||
AddressType addressRangeInputType = AddressType::ABSOLUTE;
|
||||
|
||||
/**
|
||||
* This address range will always be in absolute form. Regardless of the value of this->addressRangeType.
|
||||
* See the comment above, for this->addressRangeType, for more.
|
||||
*/
|
||||
Targets::TargetMemoryAddressRange addressRange;
|
||||
|
||||
MemoryRegion(
|
||||
const QString& name,
|
||||
Targets::TargetMemoryType memoryType,
|
||||
MemoryRegionType type,
|
||||
const Targets::TargetMemoryAddressRange& addressRange
|
||||
);
|
||||
|
||||
MemoryRegion(const QJsonObject& jsonObject);
|
||||
|
||||
virtual QJsonObject toJson() const;
|
||||
|
||||
virtual ~MemoryRegion() = default;
|
||||
|
||||
MemoryRegion(const MemoryRegion& other) = default;
|
||||
MemoryRegion(MemoryRegion&& other) = default;
|
||||
|
||||
MemoryRegion& operator = (const MemoryRegion& other) = default;
|
||||
MemoryRegion& operator = (MemoryRegion&& other) = default;
|
||||
|
||||
[[nodiscard]] bool intersectsWith(const MemoryRegion& other) const {
|
||||
return this->addressRange.intersectsWith(other.addressRange);
|
||||
}
|
||||
|
||||
private:
|
||||
static const inline BiMap<MemoryRegionType, QString> memoryRegionTypesByName = {
|
||||
{MemoryRegionType::EXCLUDED, "excluded"},
|
||||
{MemoryRegionType::FOCUSED, "focused"},
|
||||
};
|
||||
|
||||
enum class MemoryRegionAddressInputType: std::uint8_t
|
||||
{
|
||||
ABSOLUTE,
|
||||
RELATIVE,
|
||||
static const inline BiMap<AddressType, QString> addressTypesByName = {
|
||||
{AddressType::ABSOLUTE, "absolute"},
|
||||
{AddressType::RELATIVE, "relative"},
|
||||
};
|
||||
|
||||
class MemoryRegion
|
||||
{
|
||||
public:
|
||||
QString name;
|
||||
QDateTime createdDate = Services::DateTimeService::currentDateTime();
|
||||
Targets::TargetMemoryType memoryType;
|
||||
MemoryRegionType type;
|
||||
|
||||
/**
|
||||
* The addressRangeType holds the user's preference when inputting address ranges in the memory region manager
|
||||
* window, for this particular memory region.
|
||||
*
|
||||
* It has no significance anywhere else. We never store the address in relative form - this->addressRange will
|
||||
* always be in absolute form. Conversion is done at the point of applying the changes.
|
||||
*
|
||||
* For more, see the following and their call sites:
|
||||
* See RegionItem::convertRelativeToAbsoluteAddressRange()
|
||||
* See RegionItem::convertAbsoluteToRelativeAddressRange()
|
||||
*/
|
||||
AddressType addressRangeInputType = AddressType::ABSOLUTE;
|
||||
|
||||
/**
|
||||
* This address range will always be in absolute form. Regardless of the value of this->addressRangeType.
|
||||
* See the comment above, for this->addressRangeType, for more.
|
||||
*/
|
||||
Targets::TargetMemoryAddressRange addressRange;
|
||||
|
||||
MemoryRegion(
|
||||
const QString& name,
|
||||
Targets::TargetMemoryType memoryType,
|
||||
MemoryRegionType type,
|
||||
const Targets::TargetMemoryAddressRange& addressRange
|
||||
);
|
||||
|
||||
MemoryRegion(const QJsonObject& jsonObject);
|
||||
|
||||
virtual QJsonObject toJson() const;
|
||||
|
||||
virtual ~MemoryRegion() = default;
|
||||
|
||||
MemoryRegion(const MemoryRegion& other) = default;
|
||||
MemoryRegion(MemoryRegion&& other) = default;
|
||||
|
||||
MemoryRegion& operator = (const MemoryRegion& other) = default;
|
||||
MemoryRegion& operator = (MemoryRegion&& other) = default;
|
||||
|
||||
[[nodiscard]] bool intersectsWith(const MemoryRegion& other) const {
|
||||
return this->addressRange.intersectsWith(other.addressRange);
|
||||
}
|
||||
|
||||
private:
|
||||
static const inline BiMap<MemoryRegionType, QString> memoryRegionTypesByName = {
|
||||
{MemoryRegionType::EXCLUDED, "excluded"},
|
||||
{MemoryRegionType::FOCUSED, "focused"},
|
||||
};
|
||||
|
||||
static const inline BiMap<AddressType, QString> addressTypesByName = {
|
||||
{AddressType::ABSOLUTE, "absolute"},
|
||||
{AddressType::RELATIVE, "relative"},
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/UiLoader.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
ExcludedRegionItem::ExcludedRegionItem(
|
||||
const ExcludedMemoryRegion& region,
|
||||
@@ -23,7 +23,7 @@ namespace Bloom::Widgets
|
||||
);
|
||||
|
||||
if (!formUiFile.open(QFile::ReadOnly)) {
|
||||
throw Bloom::Exceptions::Exception("Failed to open excluded region item form UI file");
|
||||
throw Exceptions::Exception("Failed to open excluded region item form UI file");
|
||||
}
|
||||
|
||||
auto uiLoader = UiLoader(this);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "RegionItem.hpp"
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/ExcludedMemoryRegion.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class ExcludedRegionItem: public RegionItem
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/UiLoader.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
using Targets::TargetMemoryAddressRange;
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Bloom::Widgets
|
||||
);
|
||||
|
||||
if (!formUiFile.open(QFile::ReadOnly)) {
|
||||
throw Bloom::Exceptions::Exception("Failed to open focused region item form UI file");
|
||||
throw Exceptions::Exception("Failed to open focused region item form UI file");
|
||||
}
|
||||
|
||||
auto uiLoader = UiLoader(this);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "RegionItem.hpp"
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/FocusedMemoryRegion.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
struct DataTypeOption
|
||||
{
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
#include "src/Helpers/EnumToStringMappings.hpp"
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
using Bloom::Exceptions::Exception;
|
||||
using Exceptions::Exception;
|
||||
|
||||
MemoryRegionManagerWindow::MemoryRegionManagerWindow(
|
||||
const Targets::TargetMemoryDescriptor& memoryDescriptor,
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "FocusedRegionItem.hpp"
|
||||
#include "ExcludedRegionItem.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class MemoryRegionManagerWindow: public QWidget
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <QHBoxLayout>
|
||||
#include <QString>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
using Targets::TargetMemoryAddressRange;
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemoryRegion.hpp"
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
struct AddressRangeTypeOption
|
||||
{
|
||||
|
||||
@@ -7,137 +7,134 @@
|
||||
#include "src/Helpers/EnumToStringMappings.hpp"
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
MemorySnapshot::MemorySnapshot(
|
||||
const QString& name,
|
||||
const QString& description,
|
||||
Targets::TargetMemoryType memoryType,
|
||||
const Targets::TargetMemoryBuffer& data,
|
||||
Targets::TargetProgramCounter programCounter,
|
||||
Targets::TargetStackPointer stackPointer,
|
||||
const std::vector<FocusedMemoryRegion>& focusedRegions,
|
||||
const std::vector<ExcludedMemoryRegion>& excludedRegions
|
||||
)
|
||||
: id(QUuid::createUuid().toString(QUuid::StringFormat::WithoutBraces))
|
||||
, name(name)
|
||||
, description(description)
|
||||
, memoryType(memoryType)
|
||||
, data(data)
|
||||
, programCounter(programCounter)
|
||||
, stackPointer(stackPointer)
|
||||
, focusedRegions(focusedRegions)
|
||||
, excludedRegions(excludedRegions)
|
||||
{}
|
||||
MemorySnapshot::MemorySnapshot(
|
||||
const QString& name,
|
||||
const QString& description,
|
||||
Targets::TargetMemoryType memoryType,
|
||||
const Targets::TargetMemoryBuffer& data,
|
||||
Targets::TargetProgramCounter programCounter,
|
||||
Targets::TargetStackPointer stackPointer,
|
||||
const std::vector<FocusedMemoryRegion>& focusedRegions,
|
||||
const std::vector<ExcludedMemoryRegion>& excludedRegions
|
||||
)
|
||||
: id(QUuid::createUuid().toString(QUuid::StringFormat::WithoutBraces))
|
||||
, name(name)
|
||||
, description(description)
|
||||
, memoryType(memoryType)
|
||||
, data(data)
|
||||
, programCounter(programCounter)
|
||||
, stackPointer(stackPointer)
|
||||
, focusedRegions(focusedRegions)
|
||||
, excludedRegions(excludedRegions)
|
||||
{}
|
||||
|
||||
MemorySnapshot::MemorySnapshot(const QJsonObject& jsonObject) {
|
||||
using Exceptions::Exception;
|
||||
MemorySnapshot::MemorySnapshot(const QJsonObject& jsonObject) {
|
||||
using Exceptions::Exception;
|
||||
|
||||
if (
|
||||
!jsonObject.contains("id")
|
||||
|| !jsonObject.contains("name")
|
||||
|| !jsonObject.contains("description")
|
||||
|| !jsonObject.contains("memoryType")
|
||||
|| !jsonObject.contains("hexData")
|
||||
|| !jsonObject.contains("programCounter")
|
||||
|| !jsonObject.contains("stackPointer")
|
||||
|| !jsonObject.contains("createdTimestamp")
|
||||
|| !jsonObject.contains("focusedRegions")
|
||||
|| !jsonObject.contains("excludedRegions")
|
||||
) {
|
||||
throw Exception("Missing data");
|
||||
}
|
||||
if (
|
||||
!jsonObject.contains("id")
|
||||
|| !jsonObject.contains("name")
|
||||
|| !jsonObject.contains("description")
|
||||
|| !jsonObject.contains("memoryType")
|
||||
|| !jsonObject.contains("hexData")
|
||||
|| !jsonObject.contains("programCounter")
|
||||
|| !jsonObject.contains("stackPointer")
|
||||
|| !jsonObject.contains("createdTimestamp")
|
||||
|| !jsonObject.contains("focusedRegions")
|
||||
|| !jsonObject.contains("excludedRegions")
|
||||
) {
|
||||
throw Exception("Missing data");
|
||||
}
|
||||
|
||||
this->id = jsonObject.find("id")->toString();
|
||||
this->name = jsonObject.find("name")->toString();
|
||||
this->description = jsonObject.find("description")->toString();
|
||||
this->memoryType = EnumToStringMappings::targetMemoryTypes.at(jsonObject.find("memoryType")->toString());
|
||||
this->programCounter = static_cast<Targets::TargetProgramCounter>(jsonObject.find("programCounter")->toInteger());
|
||||
this->stackPointer = static_cast<Targets::TargetStackPointer>(jsonObject.find("stackPointer")->toInteger());
|
||||
this->createdDate.setSecsSinceEpoch(jsonObject.find("createdTimestamp")->toInteger());
|
||||
this->id = jsonObject.find("id")->toString();
|
||||
this->name = jsonObject.find("name")->toString();
|
||||
this->description = jsonObject.find("description")->toString();
|
||||
this->memoryType = EnumToStringMappings::targetMemoryTypes.at(jsonObject.find("memoryType")->toString());
|
||||
this->programCounter = static_cast<Targets::TargetProgramCounter>(jsonObject.find("programCounter")->toInteger());
|
||||
this->stackPointer = static_cast<Targets::TargetStackPointer>(jsonObject.find("stackPointer")->toInteger());
|
||||
this->createdDate.setSecsSinceEpoch(jsonObject.find("createdTimestamp")->toInteger());
|
||||
|
||||
const auto hexData = QByteArray::fromHex(jsonObject.find("hexData")->toString().toUtf8());
|
||||
this->data = Targets::TargetMemoryBuffer(hexData.begin(), hexData.end());
|
||||
const auto hexData = QByteArray::fromHex(jsonObject.find("hexData")->toString().toUtf8());
|
||||
this->data = Targets::TargetMemoryBuffer(hexData.begin(), hexData.end());
|
||||
|
||||
if (jsonObject.contains("focusedRegions")) {
|
||||
for (const auto& regionValue : jsonObject.find("focusedRegions")->toArray()) {
|
||||
try {
|
||||
this->focusedRegions.emplace_back(regionValue.toObject());
|
||||
if (jsonObject.contains("focusedRegions")) {
|
||||
for (const auto& regionValue : jsonObject.find("focusedRegions")->toArray()) {
|
||||
try {
|
||||
this->focusedRegions.emplace_back(regionValue.toObject());
|
||||
|
||||
} catch (Exception exception) {
|
||||
throw Exception("Invalid focused memory region");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (jsonObject.contains("excludedRegions")) {
|
||||
for (const auto& regionValue : jsonObject.find("excludedRegions")->toArray()) {
|
||||
try {
|
||||
this->excludedRegions.emplace_back(regionValue.toObject());
|
||||
|
||||
} catch (Exception exception) {
|
||||
throw Exception("Invalid excluded memory region");
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
throw Exception("Invalid focused memory region");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QJsonObject MemorySnapshot::toJson() const {
|
||||
auto focusedRegions = QJsonArray();
|
||||
for (const auto& focusedRegion : this->focusedRegions) {
|
||||
focusedRegions.push_back(focusedRegion.toJson());
|
||||
}
|
||||
if (jsonObject.contains("excludedRegions")) {
|
||||
for (const auto& regionValue : jsonObject.find("excludedRegions")->toArray()) {
|
||||
try {
|
||||
this->excludedRegions.emplace_back(regionValue.toObject());
|
||||
|
||||
auto excludedRegions = QJsonArray();
|
||||
for (const auto& excludedRegion : this->excludedRegions) {
|
||||
excludedRegions.push_back(excludedRegion.toJson());
|
||||
}
|
||||
|
||||
return QJsonObject({
|
||||
{"id", this->id},
|
||||
{"name", this->name},
|
||||
{"description", this->description},
|
||||
{"memoryType", EnumToStringMappings::targetMemoryTypes.at(this->memoryType)},
|
||||
{"hexData", QString(QByteArray(
|
||||
reinterpret_cast<const char*>(this->data.data()),
|
||||
static_cast<qsizetype>(this->data.size())
|
||||
).toHex())},
|
||||
{"programCounter", static_cast<qint64>(this->programCounter)},
|
||||
{"stackPointer", static_cast<qint64>(this->stackPointer)},
|
||||
{"createdTimestamp", this->createdDate.toSecsSinceEpoch()},
|
||||
{"focusedRegions", focusedRegions},
|
||||
{"excludedRegions", excludedRegions},
|
||||
});
|
||||
}
|
||||
|
||||
bool MemorySnapshot::isCompatible(const Targets::TargetMemoryDescriptor& memoryDescriptor) const {
|
||||
if (this->memoryType != memoryDescriptor.type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this->data.size() != memoryDescriptor.size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto& memoryAddressRange = memoryDescriptor.addressRange;
|
||||
for (const auto& focusedRegion : this->focusedRegions) {
|
||||
if (
|
||||
focusedRegion.addressRange.startAddress < memoryAddressRange.startAddress
|
||||
|| focusedRegion.addressRange.endAddress > memoryAddressRange.endAddress
|
||||
) {
|
||||
return false;
|
||||
} catch (Exception exception) {
|
||||
throw Exception("Invalid excluded memory region");
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& excludedRegion : this->excludedRegions) {
|
||||
if (
|
||||
excludedRegion.addressRange.startAddress < memoryAddressRange.startAddress
|
||||
|| excludedRegion.addressRange.endAddress > memoryAddressRange.endAddress
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
QJsonObject MemorySnapshot::toJson() const {
|
||||
auto focusedRegions = QJsonArray();
|
||||
for (const auto& focusedRegion : this->focusedRegions) {
|
||||
focusedRegions.push_back(focusedRegion.toJson());
|
||||
}
|
||||
|
||||
auto excludedRegions = QJsonArray();
|
||||
for (const auto& excludedRegion : this->excludedRegions) {
|
||||
excludedRegions.push_back(excludedRegion.toJson());
|
||||
}
|
||||
|
||||
return QJsonObject({
|
||||
{"id", this->id},
|
||||
{"name", this->name},
|
||||
{"description", this->description},
|
||||
{"memoryType", EnumToStringMappings::targetMemoryTypes.at(this->memoryType)},
|
||||
{"hexData", QString(QByteArray(
|
||||
reinterpret_cast<const char*>(this->data.data()),
|
||||
static_cast<qsizetype>(this->data.size())
|
||||
).toHex())},
|
||||
{"programCounter", static_cast<qint64>(this->programCounter)},
|
||||
{"stackPointer", static_cast<qint64>(this->stackPointer)},
|
||||
{"createdTimestamp", this->createdDate.toSecsSinceEpoch()},
|
||||
{"focusedRegions", focusedRegions},
|
||||
{"excludedRegions", excludedRegions},
|
||||
});
|
||||
}
|
||||
|
||||
bool MemorySnapshot::isCompatible(const Targets::TargetMemoryDescriptor& memoryDescriptor) const {
|
||||
if (this->memoryType != memoryDescriptor.type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this->data.size() != memoryDescriptor.size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto& memoryAddressRange = memoryDescriptor.addressRange;
|
||||
for (const auto& focusedRegion : this->focusedRegions) {
|
||||
if (
|
||||
focusedRegion.addressRange.startAddress < memoryAddressRange.startAddress
|
||||
|| focusedRegion.addressRange.endAddress > memoryAddressRange.endAddress
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& excludedRegion : this->excludedRegions) {
|
||||
if (
|
||||
excludedRegion.addressRange.startAddress < memoryAddressRange.startAddress
|
||||
|| excludedRegion.addressRange.endAddress > memoryAddressRange.endAddress
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -12,46 +12,43 @@
|
||||
#include "FocusedMemoryRegion.hpp"
|
||||
#include "ExcludedMemoryRegion.hpp"
|
||||
|
||||
namespace Bloom
|
||||
struct MemorySnapshot
|
||||
{
|
||||
struct MemorySnapshot
|
||||
{
|
||||
public:
|
||||
QString id;
|
||||
QString name;
|
||||
QString description;
|
||||
Targets::TargetMemoryType memoryType;
|
||||
Targets::TargetMemoryBuffer data;
|
||||
Targets::TargetProgramCounter programCounter;
|
||||
Targets::TargetStackPointer stackPointer;
|
||||
QDateTime createdDate = Services::DateTimeService::currentDateTime();
|
||||
public:
|
||||
QString id;
|
||||
QString name;
|
||||
QString description;
|
||||
Targets::TargetMemoryType memoryType;
|
||||
Targets::TargetMemoryBuffer data;
|
||||
Targets::TargetProgramCounter programCounter;
|
||||
Targets::TargetStackPointer stackPointer;
|
||||
QDateTime createdDate = Services::DateTimeService::currentDateTime();
|
||||
|
||||
std::vector<FocusedMemoryRegion> focusedRegions;
|
||||
std::vector<ExcludedMemoryRegion> excludedRegions;
|
||||
std::vector<FocusedMemoryRegion> focusedRegions;
|
||||
std::vector<ExcludedMemoryRegion> excludedRegions;
|
||||
|
||||
MemorySnapshot(
|
||||
const QString& name,
|
||||
const QString& description,
|
||||
Targets::TargetMemoryType memoryType,
|
||||
const Targets::TargetMemoryBuffer& data,
|
||||
Targets::TargetProgramCounter programCounter,
|
||||
Targets::TargetStackPointer stackPointer,
|
||||
const std::vector<FocusedMemoryRegion>& focusedRegions,
|
||||
const std::vector<ExcludedMemoryRegion>& excludedRegions
|
||||
);
|
||||
MemorySnapshot(
|
||||
const QString& name,
|
||||
const QString& description,
|
||||
Targets::TargetMemoryType memoryType,
|
||||
const Targets::TargetMemoryBuffer& data,
|
||||
Targets::TargetProgramCounter programCounter,
|
||||
Targets::TargetStackPointer stackPointer,
|
||||
const std::vector<FocusedMemoryRegion>& focusedRegions,
|
||||
const std::vector<ExcludedMemoryRegion>& excludedRegions
|
||||
);
|
||||
|
||||
MemorySnapshot(const QJsonObject& jsonObject);
|
||||
MemorySnapshot(const QJsonObject& jsonObject);
|
||||
|
||||
QJsonObject toJson() const;
|
||||
QJsonObject toJson() const;
|
||||
|
||||
bool isCompatible(const Targets::TargetMemoryDescriptor& memoryDescriptor) const;
|
||||
bool isCompatible(const Targets::TargetMemoryDescriptor& memoryDescriptor) const;
|
||||
|
||||
virtual ~MemorySnapshot() = default;
|
||||
virtual ~MemorySnapshot() = default;
|
||||
|
||||
MemorySnapshot(const MemorySnapshot& other) = default;
|
||||
MemorySnapshot(MemorySnapshot&& other) = default;
|
||||
MemorySnapshot(const MemorySnapshot& other) = default;
|
||||
MemorySnapshot(MemorySnapshot&& other) = default;
|
||||
|
||||
MemorySnapshot& operator = (const MemorySnapshot& other) = default;
|
||||
MemorySnapshot& operator = (MemorySnapshot&& other) = default;
|
||||
};
|
||||
}
|
||||
MemorySnapshot& operator = (const MemorySnapshot& other) = default;
|
||||
MemorySnapshot& operator = (MemorySnapshot&& other) = default;
|
||||
};
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
#include "src/Helpers/EnumToStringMappings.hpp"
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
using Bloom::Exceptions::Exception;
|
||||
using Exceptions::Exception;
|
||||
|
||||
CreateSnapshotWindow::CreateSnapshotWindow(
|
||||
Targets::TargetMemoryType memoryType,
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
#include "src/Targets/TargetState.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class CreateSnapshotWindow: public QWidget
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "src/Services/DateTimeService.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
MemorySnapshotItem::MemorySnapshotItem(const MemorySnapshot& memorySnapshot)
|
||||
: memorySnapshot(memorySnapshot)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemorySnapshot.hpp"
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class MemorySnapshotItem: public ListItem
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteAddressContainer.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
DifferentialHexViewerItemRenderer::DifferentialHexViewerItemRenderer(
|
||||
DifferentialHexViewerWidgetType differentialHexViewerWidgetType,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerItemRenderer.hpp"
|
||||
#include "DifferentialHexViewerWidgetType.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class DifferentialHexViewerItemRenderer: public HexViewerItemRenderer
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <unordered_set>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
struct DifferentialHexViewerSharedState
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <QVBoxLayout>
|
||||
#include <cassert>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
DifferentialHexViewerWidget::DifferentialHexViewerWidget(
|
||||
DifferentialHexViewerWidgetType type,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotDiff/SnapshotDiffSettings.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class DifferentialHexViewerWidget final: public HexViewerWidget
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
enum class DifferentialHexViewerWidgetType: std::uint8_t
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "DifferentialHexViewerItemRenderer.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
DifferentialItemGraphicsScene::DifferentialItemGraphicsScene(
|
||||
DifferentialHexViewerWidgetType differentialHexViewerWidgetType,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotDiff/SnapshotDiffSettings.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class DifferentialItemGraphicsScene final: public ItemGraphicsScene
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user