This commit is contained in:
Nav
2022-04-28 21:08:55 +01:00
parent 178df2d9e0
commit 80405057f6
8 changed files with 275 additions and 265 deletions

View File

@@ -160,7 +160,7 @@ namespace Bloom
&InsightWindow::openAboutWindow &InsightWindow::openAboutWindow
); );
// Tool bar button connections // Toolbar button connections
QObject::connect( QObject::connect(
this->refreshIoInspectionButton, this->refreshIoInspectionButton,
&QToolButton::clicked, &QToolButton::clicked,

View File

@@ -53,8 +53,7 @@ namespace Bloom::Widgets
size.setWidth(static_cast<int>( size.setWidth(static_cast<int>(
std::cos(angleRadians) * textSize.width() std::cos(angleRadians) * textSize.width()
+ std::ceil(std::sin(angleRadians) * textSize.height()) + std::ceil(std::sin(angleRadians) * textSize.height())
)) ));
;
size.setHeight(static_cast<int>( size.setHeight(static_cast<int>(
std::sin(angleRadians) * textSize.width() std::sin(angleRadians) * textSize.width()
+ std::ceil(std::cos(angleRadians) * textSize.height()) + std::ceil(std::cos(angleRadians) * textSize.height())

View File

@@ -12,7 +12,9 @@ namespace Bloom::Widgets
public: public:
RotatableLabel(const QString& text, QWidget* parent): QLabel(text, parent) {}; RotatableLabel(const QString& text, QWidget* parent): QLabel(text, parent) {};
RotatableLabel(int angleDegrees, const QString& text, QWidget* parent) RotatableLabel(int angleDegrees, const QString& text, QWidget* parent)
: QLabel(text, parent), angle(angleDegrees) {}; : QLabel(text, parent),
angle(angleDegrees)
{};
void setAngle(int angleDegrees) { void setAngle(int angleDegrees) {
this->angle = angleDegrees; this->angle = angleDegrees;
@@ -23,11 +25,11 @@ namespace Bloom::Widgets
[[nodiscard]] QSize sizeHint() const override { [[nodiscard]] QSize sizeHint() const override {
return this->getContainerSize(); return this->getContainerSize();
}; }
[[nodiscard]] QSize minimumSizeHint() const override { [[nodiscard]] QSize minimumSizeHint() const override {
return this->getContainerSize(); return this->getContainerSize();
}; }
private: private:
int angle = 90; int angle = 90;

View File

@@ -12,23 +12,24 @@
#include "src/Helpers/Paths.hpp" #include "src/Helpers/Paths.hpp"
#include "src/Exceptions/Exception.hpp" #include "src/Exceptions/Exception.hpp"
using namespace Bloom::Widgets; namespace Bloom::Widgets
using namespace Bloom::Exceptions; {
using namespace Bloom::Exceptions;
using Bloom::Targets::TargetMemoryDescriptor; using Bloom::Targets::TargetMemoryDescriptor;
using Bloom::Targets::TargetMemoryType; using Bloom::Targets::TargetMemoryType;
TargetMemoryInspectionPane::TargetMemoryInspectionPane( TargetMemoryInspectionPane::TargetMemoryInspectionPane(
const TargetMemoryDescriptor& targetMemoryDescriptor, const TargetMemoryDescriptor& targetMemoryDescriptor,
TargetMemoryInspectionPaneSettings& settings, TargetMemoryInspectionPaneSettings& settings,
InsightWorker& insightWorker, InsightWorker& insightWorker,
PanelWidget* parent PanelWidget* parent
) )
: PaneWidget(parent) : PaneWidget(parent)
, targetMemoryDescriptor(targetMemoryDescriptor) , targetMemoryDescriptor(targetMemoryDescriptor)
, settings(settings) , settings(settings)
, insightWorker(insightWorker) , insightWorker(insightWorker)
{ {
this->setObjectName("target-memory-inspection-pane"); this->setObjectName("target-memory-inspection-pane");
auto memoryInspectionPaneUiFile = QFile( auto memoryInspectionPaneUiFile = QFile(
@@ -92,9 +93,9 @@ TargetMemoryInspectionPane::TargetMemoryInspectionPane(
this->refreshMemoryValues(); this->refreshMemoryValues();
} }
); );
} }
void TargetMemoryInspectionPane::refreshMemoryValues(std::optional<std::function<void(void)>> callback) { void TargetMemoryInspectionPane::refreshMemoryValues(std::optional<std::function<void(void)>> callback) {
this->hexViewerWidget->refreshButton->setDisabled(true); this->hexViewerWidget->refreshButton->setDisabled(true);
this->hexViewerWidget->refreshButton->startSpin(); this->hexViewerWidget->refreshButton->startSpin();
@@ -162,39 +163,39 @@ void TargetMemoryInspectionPane::refreshMemoryValues(std::optional<std::function
} }
this->insightWorker.queueTask(readMemoryTask); this->insightWorker.queueTask(readMemoryTask);
} }
void TargetMemoryInspectionPane::activate() { void TargetMemoryInspectionPane::activate() {
this->show(); this->show();
this->activated = true; this->activated = true;
this->postActivate(); this->postActivate();
} }
void TargetMemoryInspectionPane::deactivate() { void TargetMemoryInspectionPane::deactivate() {
this->hide(); this->hide();
this->activated = false; this->activated = false;
this->postDeactivate(); this->postDeactivate();
} }
void TargetMemoryInspectionPane::resizeEvent(QResizeEvent* event) { void TargetMemoryInspectionPane::resizeEvent(QResizeEvent* event) {
const auto parentSize = this->parentPanel->size(); const auto parentSize = this->parentPanel->size();
const auto width = parentSize.width() - 1; const auto width = parentSize.width() - 1;
this->container->setFixedSize(width, parentSize.height()); this->container->setFixedSize(width, parentSize.height());
} }
void TargetMemoryInspectionPane::postActivate() { void TargetMemoryInspectionPane::postActivate() {
if (this->targetState == Targets::TargetState::STOPPED) { if (this->targetState == Targets::TargetState::STOPPED) {
this->refreshMemoryValues([this] { this->refreshMemoryValues([this] {
this->hexViewerWidget->setDisabled(false); this->hexViewerWidget->setDisabled(false);
}); });
} }
} }
void TargetMemoryInspectionPane::postDeactivate() { void TargetMemoryInspectionPane::postDeactivate() {
} }
void TargetMemoryInspectionPane::sanitiseSettings() { void TargetMemoryInspectionPane::sanitiseSettings() {
// Remove any invalid memory regions. It's very unlikely that there will be any, but not impossible. // Remove any invalid memory regions. It's very unlikely that there will be any, but not impossible.
auto processedFocusedMemoryRegions = std::vector<FocusedMemoryRegion>(); auto processedFocusedMemoryRegions = std::vector<FocusedMemoryRegion>();
auto processedExcludedMemoryRegions = std::vector<ExcludedMemoryRegion>(); auto processedExcludedMemoryRegions = std::vector<ExcludedMemoryRegion>();
@@ -240,9 +241,9 @@ void TargetMemoryInspectionPane::sanitiseSettings() {
this->settings.focusedMemoryRegions = std::move(processedFocusedMemoryRegions); this->settings.focusedMemoryRegions = std::move(processedFocusedMemoryRegions);
this->settings.excludedMemoryRegions = std::move(processedExcludedMemoryRegions); this->settings.excludedMemoryRegions = std::move(processedExcludedMemoryRegions);
} }
void TargetMemoryInspectionPane::onTargetStateChanged(Targets::TargetState newState) { void TargetMemoryInspectionPane::onTargetStateChanged(Targets::TargetState newState) {
if (this->targetState == newState) { if (this->targetState == newState) {
return; return;
} }
@@ -258,13 +259,13 @@ void TargetMemoryInspectionPane::onTargetStateChanged(Targets::TargetState newSt
} else if (newState == TargetState::RUNNING) { } else if (newState == TargetState::RUNNING) {
this->hexViewerWidget->setDisabled(true); this->hexViewerWidget->setDisabled(true);
} }
} }
void TargetMemoryInspectionPane::onMemoryRead(const Targets::TargetMemoryBuffer& buffer) { void TargetMemoryInspectionPane::onMemoryRead(const Targets::TargetMemoryBuffer& buffer) {
this->hexViewerWidget->updateValues(buffer); this->hexViewerWidget->updateValues(buffer);
} }
void TargetMemoryInspectionPane::openMemoryRegionManagerWindow() { void TargetMemoryInspectionPane::openMemoryRegionManagerWindow() {
if (this->memoryRegionManagerWindow == nullptr) { if (this->memoryRegionManagerWindow == nullptr) {
this->memoryRegionManagerWindow = new MemoryRegionManagerWindow( this->memoryRegionManagerWindow = new MemoryRegionManagerWindow(
this->targetMemoryDescriptor, this->targetMemoryDescriptor,
@@ -289,8 +290,9 @@ void TargetMemoryInspectionPane::openMemoryRegionManagerWindow() {
} else { } else {
this->memoryRegionManagerWindow->activateWindow(); this->memoryRegionManagerWindow->activateWindow();
} }
} }
void TargetMemoryInspectionPane::onMemoryRegionsChange() { void TargetMemoryInspectionPane::onMemoryRegionsChange() {
this->hexViewerWidget->refreshRegions(); this->hexViewerWidget->refreshRegions();
}
} }

View File

@@ -9,7 +9,6 @@
#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/Helpers/Paths.hpp"
#include "src/Helpers/DateTime.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"

View File

@@ -25,7 +25,11 @@ namespace Bloom::Widgets
const TargetDescriptor& targetDescriptor, const TargetDescriptor& targetDescriptor,
InsightWorker& insightWorker, InsightWorker& insightWorker,
PanelWidget* parent PanelWidget* parent
): PaneWidget(parent), targetDescriptor(targetDescriptor), insightWorker(insightWorker) { )
: PaneWidget(parent)
, targetDescriptor(targetDescriptor)
, insightWorker(insightWorker)
{
this->setObjectName("target-registers-side-pane"); this->setObjectName("target-registers-side-pane");
auto targetRegistersPaneUiFile = QFile( auto targetRegistersPaneUiFile = QFile(

View File

@@ -12,7 +12,11 @@ namespace Bloom::Widgets::InsightTargetWidgets
Targets::TargetVariant targetVariant, Targets::TargetVariant targetVariant,
InsightWorker& insightWorker, InsightWorker& insightWorker,
QWidget* parent QWidget* parent
): QWidget(parent), targetVariant(std::move(targetVariant)), insightWorker(insightWorker) { )
: QWidget(parent)
, targetVariant(std::move(targetVariant))
, insightWorker(insightWorker)
{
QObject::connect( QObject::connect(
&(this->insightWorker), &(this->insightWorker),
&InsightWorker::targetStateUpdated, &InsightWorker::targetStateUpdated,

View File

@@ -3,7 +3,7 @@
#include "Command.hpp" #include "Command.hpp"
#include "src/TargetController/Responses/TargetMemoryRead.hpp" #include "src/TargetController/Responses/TargetMemoryRead.hpp"
#include "src/Targets/TargetRegister.hpp" #include "src/Targets/TargetMemory.hpp"
namespace Bloom::TargetController::Commands namespace Bloom::TargetController::Commands
{ {