Refactored PaneState management across the PaneWidget

This commit is contained in:
Nav
2022-08-08 22:26:32 +01:00
parent c88395b8eb
commit d59c4f92ba
10 changed files with 117 additions and 167 deletions

View File

@@ -266,6 +266,8 @@ namespace Bloom
this->layoutContainer->setFixedSize(windowSize); this->layoutContainer->setFixedSize(windowSize);
this->adjustPanels(); this->adjustPanels();
this->insightProjectSettings.mainWindowSize = windowSize;
} }
void InsightWindow::showEvent(QShowEvent* event) { void InsightWindow::showEvent(QShowEvent* event) {
@@ -358,43 +360,12 @@ namespace Bloom
if (lastLeftPanelState.has_value() && this->leftPanel != nullptr) { if (lastLeftPanelState.has_value() && this->leftPanel != nullptr) {
this->leftPanel->setSize(lastLeftPanelState->size); this->leftPanel->setSize(lastLeftPanelState->size);
}
if (
this->targetRegistersSidePane != nullptr
&& this->insightProjectSettings.previousRegistersPaneState.has_value()
) {
auto& lastRegisterSidePaneState = this->insightProjectSettings.previousRegistersPaneState.value();
// The register pane cannot be detached
lastRegisterSidePaneState.attached = true;
lastRegisterSidePaneState.detachedWindowState = std::nullopt;
this->targetRegistersSidePane->restoreLastPaneState(lastRegisterSidePaneState);
} }
if (lastBottomPanelState.has_value()) { if (lastBottomPanelState.has_value()) {
this->bottomPanel->setSize(lastBottomPanelState->size); this->bottomPanel->setSize(lastBottomPanelState->size);
} }
if (
this->ramInspectionPane != nullptr
&& this->insightProjectSettings.previousRamInspectionPaneState.has_value()
) {
this->ramInspectionPane->restoreLastPaneState(
this->insightProjectSettings.previousRamInspectionPaneState.value()
);
}
if (
this->eepromInspectionPane != nullptr
&& this->insightProjectSettings.previousEepromInspectionPaneState.has_value()
) {
this->eepromInspectionPane->restoreLastPaneState(
this->insightProjectSettings.previousEepromInspectionPaneState.value()
);
}
this->setUiDisabled(this->targetState != TargetState::STOPPED); this->setUiDisabled(this->targetState != TargetState::STOPPED);
this->activated = true; this->activated = true;
emit this->activatedSignal(); emit this->activatedSignal();
@@ -559,10 +530,15 @@ namespace Bloom
void InsightWindow::createPanes() { void InsightWindow::createPanes() {
// Target registers pane // Target registers pane
if (!this->insightProjectSettings.registersPaneState.has_value()) {
this->insightProjectSettings.registersPaneState = PaneState(false, true, std::nullopt);
}
auto* leftPanelLayout = this->leftPanel->layout(); auto* leftPanelLayout = this->leftPanel->layout();
this->targetRegistersSidePane = new TargetRegistersPaneWidget( this->targetRegistersSidePane = new TargetRegistersPaneWidget(
this->targetDescriptor, this->targetDescriptor,
this->insightWorker, this->insightWorker,
*(this->insightProjectSettings.registersPaneState),
this->leftPanel this->leftPanel
); );
leftPanelLayout->addWidget(this->targetRegistersSidePane); leftPanelLayout->addWidget(this->targetRegistersSidePane);
@@ -589,6 +565,10 @@ namespace Bloom
// Target memory inspection panes // Target memory inspection panes
auto* bottomPanelLayout = this->bottomPanel->layout(); auto* bottomPanelLayout = this->bottomPanel->layout();
if (this->targetDescriptor.memoryDescriptorsByType.contains(TargetMemoryType::RAM)) { if (this->targetDescriptor.memoryDescriptorsByType.contains(TargetMemoryType::RAM)) {
if (!this->insightProjectSettings.ramInspectionPaneState.has_value()) {
this->insightProjectSettings.ramInspectionPaneState = PaneState(false, true, std::nullopt);
}
auto& ramDescriptor = this->targetDescriptor.memoryDescriptorsByType.at(TargetMemoryType::RAM); auto& ramDescriptor = this->targetDescriptor.memoryDescriptorsByType.at(TargetMemoryType::RAM);
if (!memoryInspectionPaneSettingsByMemoryType.contains(TargetMemoryType::RAM)) { if (!memoryInspectionPaneSettingsByMemoryType.contains(TargetMemoryType::RAM)) {
@@ -599,6 +579,7 @@ namespace Bloom
ramDescriptor, ramDescriptor,
memoryInspectionPaneSettingsByMemoryType[TargetMemoryType::RAM], memoryInspectionPaneSettingsByMemoryType[TargetMemoryType::RAM],
this->insightWorker, this->insightWorker,
*(this->insightProjectSettings.ramInspectionPaneState),
this->bottomPanel this->bottomPanel
); );
@@ -623,11 +604,15 @@ namespace Bloom
&InsightWindow::onRamInspectionPaneStateChanged &InsightWindow::onRamInspectionPaneStateChanged
); );
this->ramInspectionPane->deactivate();
this->ramInspectionButton->setDisabled(false); this->ramInspectionButton->setDisabled(false);
this->onRamInspectionPaneStateChanged();
} }
if (this->targetDescriptor.memoryDescriptorsByType.contains(TargetMemoryType::EEPROM)) { if (this->targetDescriptor.memoryDescriptorsByType.contains(TargetMemoryType::EEPROM)) {
if (!this->insightProjectSettings.eepromInspectionPaneState.has_value()) {
this->insightProjectSettings.eepromInspectionPaneState = PaneState(false, true, std::nullopt);
}
auto& eepromDescriptor = this->targetDescriptor.memoryDescriptorsByType.at(TargetMemoryType::EEPROM); auto& eepromDescriptor = this->targetDescriptor.memoryDescriptorsByType.at(TargetMemoryType::EEPROM);
if (!memoryInspectionPaneSettingsByMemoryType.contains(TargetMemoryType::EEPROM)) { if (!memoryInspectionPaneSettingsByMemoryType.contains(TargetMemoryType::EEPROM)) {
@@ -638,6 +623,7 @@ namespace Bloom
eepromDescriptor, eepromDescriptor,
memoryInspectionPaneSettingsByMemoryType[TargetMemoryType::EEPROM], memoryInspectionPaneSettingsByMemoryType[TargetMemoryType::EEPROM],
this->insightWorker, this->insightWorker,
*(this->insightProjectSettings.eepromInspectionPaneState),
this->bottomPanel this->bottomPanel
); );
@@ -662,8 +648,8 @@ namespace Bloom
&InsightWindow::onEepromInspectionPaneStateChanged &InsightWindow::onEepromInspectionPaneStateChanged
); );
this->eepromInspectionPane->deactivate();
this->eepromInspectionButton->setDisabled(false); this->eepromInspectionButton->setDisabled(false);
this->onEepromInspectionPaneStateChanged();
} }
} }
@@ -855,7 +841,7 @@ namespace Bloom
if (this->targetState == TargetState::STOPPED) { if (this->targetState == TargetState::STOPPED) {
this->targetPackageWidget->setDisabled(false); this->targetPackageWidget->setDisabled(false);
if (this->targetRegistersSidePane == nullptr || !this->targetRegistersSidePane->activated) { if (this->targetRegistersSidePane == nullptr || !this->targetRegistersSidePane->state.activated) {
this->refreshIoInspectionButton->stopSpin(); this->refreshIoInspectionButton->stopSpin();
this->setUiDisabled(false); this->setUiDisabled(false);
} }
@@ -863,7 +849,7 @@ namespace Bloom
}); });
} }
if (this->targetRegistersSidePane != nullptr && this->targetRegistersSidePane->activated) { if (this->targetRegistersSidePane != nullptr && this->targetRegistersSidePane->state.activated) {
this->targetRegistersSidePane->refreshRegisterValues([this] { this->targetRegistersSidePane->refreshRegisterValues([this] {
this->refreshIoInspectionButton->stopSpin(); this->refreshIoInspectionButton->stopSpin();
this->setUiDisabled(false); this->setUiDisabled(false);
@@ -911,7 +897,7 @@ namespace Bloom
} }
void InsightWindow::toggleTargetRegistersPane() { void InsightWindow::toggleTargetRegistersPane() {
if (this->targetRegistersSidePane->activated) { if (this->targetRegistersSidePane->state.activated) {
this->targetRegistersSidePane->deactivate(); this->targetRegistersSidePane->deactivate();
} else { } else {
@@ -920,8 +906,8 @@ namespace Bloom
} }
void InsightWindow::toggleRamInspectionPane() { void InsightWindow::toggleRamInspectionPane() {
if (this->ramInspectionPane->activated) { if (this->ramInspectionPane->state.activated) {
if (!this->ramInspectionPane->attached) { if (!this->ramInspectionPane->state.attached) {
this->ramInspectionPane->activateWindow(); this->ramInspectionPane->activateWindow();
this->ramInspectionButton->setChecked(true); this->ramInspectionButton->setChecked(true);
@@ -932,10 +918,10 @@ namespace Bloom
} else { } else {
if ( if (
this->ramInspectionPane->attached this->ramInspectionPane->state.attached
&& this->eepromInspectionPane != nullptr && this->eepromInspectionPane != nullptr
&& this->eepromInspectionPane->activated && this->eepromInspectionPane->state.activated
&& this->eepromInspectionPane->attached && this->eepromInspectionPane->state.attached
) { ) {
this->eepromInspectionPane->deactivate(); this->eepromInspectionPane->deactivate();
} }
@@ -945,8 +931,8 @@ namespace Bloom
} }
void InsightWindow::toggleEepromInspectionPane() { void InsightWindow::toggleEepromInspectionPane() {
if (this->eepromInspectionPane->activated) { if (this->eepromInspectionPane->state.activated) {
if (!this->eepromInspectionPane->attached) { if (!this->eepromInspectionPane->state.attached) {
this->eepromInspectionPane->activateWindow(); this->eepromInspectionPane->activateWindow();
this->eepromInspectionButton->setChecked(true); this->eepromInspectionButton->setChecked(true);
@@ -957,10 +943,10 @@ namespace Bloom
} else { } else {
if ( if (
this->eepromInspectionPane->attached this->eepromInspectionPane->state.attached
&& this->ramInspectionPane != nullptr && this->ramInspectionPane != nullptr
&& this->ramInspectionPane->activated && this->ramInspectionPane->state.activated
&& this->ramInspectionPane->attached && this->ramInspectionPane->state.attached
) { ) {
this->ramInspectionPane->deactivate(); this->ramInspectionPane->deactivate();
} }
@@ -970,18 +956,18 @@ namespace Bloom
} }
void InsightWindow::onRegistersPaneStateChanged() { void InsightWindow::onRegistersPaneStateChanged() {
this->targetRegistersButton->setChecked(this->targetRegistersSidePane->activated); this->targetRegistersButton->setChecked(this->targetRegistersSidePane->state.activated);
} }
void InsightWindow::onRamInspectionPaneStateChanged() { void InsightWindow::onRamInspectionPaneStateChanged() {
this->ramInspectionButton->setChecked(this->ramInspectionPane->activated); this->ramInspectionButton->setChecked(this->ramInspectionPane->state.activated);
if ( if (
this->ramInspectionPane->activated this->ramInspectionPane->state.activated
&& this->ramInspectionPane->attached && this->ramInspectionPane->state.attached
&& this->eepromInspectionPane != nullptr && this->eepromInspectionPane != nullptr
&& this->eepromInspectionPane->activated && this->eepromInspectionPane->state.activated
&& this->eepromInspectionPane->attached && this->eepromInspectionPane->state.attached
) { ) {
// Both panes cannot be attached and activated at the same time. // Both panes cannot be attached and activated at the same time.
this->eepromInspectionPane->deactivate(); this->eepromInspectionPane->deactivate();
@@ -989,14 +975,14 @@ namespace Bloom
} }
void InsightWindow::onEepromInspectionPaneStateChanged() { void InsightWindow::onEepromInspectionPaneStateChanged() {
this->eepromInspectionButton->setChecked(this->eepromInspectionPane->activated); this->eepromInspectionButton->setChecked(this->eepromInspectionPane->state.activated);
if ( if (
this->eepromInspectionPane->activated this->eepromInspectionPane->state.activated
&& this->eepromInspectionPane->attached && this->eepromInspectionPane->state.attached
&& this->ramInspectionPane != nullptr && this->ramInspectionPane != nullptr
&& this->ramInspectionPane->activated && this->ramInspectionPane->state.activated
&& this->ramInspectionPane->attached && this->ramInspectionPane->state.attached
) { ) {
// Both panes cannot be attached and activated at the same time. // Both panes cannot be attached and activated at the same time.
this->ramInspectionPane->deactivate(); this->ramInspectionPane->deactivate();
@@ -1013,29 +999,13 @@ namespace Bloom
} }
void InsightWindow::recordInsightSettings() { void InsightWindow::recordInsightSettings() {
auto& projectSettings = this->insightProjectSettings;
projectSettings.mainWindowSize = this->size();
if (this->activated) { if (this->activated) {
if (this->leftPanel != nullptr) { if (this->leftPanel != nullptr) {
projectSettings.previousLeftPanelState = this->leftPanel->getCurrentState(); this->insightProjectSettings.previousLeftPanelState = this->leftPanel->getCurrentState();
if (this->targetRegistersSidePane != nullptr) {
projectSettings.previousRegistersPaneState = this->targetRegistersSidePane->getCurrentState();
}
} }
if (this->bottomPanel != nullptr) { if (this->bottomPanel != nullptr) {
projectSettings.previousBottomPanelState = this->bottomPanel->getCurrentState(); this->insightProjectSettings.previousBottomPanelState = this->bottomPanel->getCurrentState();
if (this->ramInspectionPane != nullptr) {
projectSettings.previousRamInspectionPaneState = this->ramInspectionPane->getCurrentState();
}
if (this->eepromInspectionPane != nullptr) {
projectSettings.previousEepromInspectionPaneState = this->eepromInspectionPane->getCurrentState();
}
} }
} }
} }

View File

@@ -2,9 +2,10 @@
namespace Bloom::Widgets namespace Bloom::Widgets
{ {
PaneWidget::PaneWidget(PanelWidget* parent) PaneWidget::PaneWidget(PaneState& state, PanelWidget* parent)
: QWidget(parent) : state(state)
, parentPanel(parent) , parentPanel(parent)
, QWidget(parent)
{ {
this->setMouseTracking(false); this->setMouseTracking(false);
this->setAttribute(Qt::WA_Hover, true); this->setAttribute(Qt::WA_Hover, true);
@@ -16,94 +17,57 @@ namespace Bloom::Widgets
QObject::connect(this, &PaneWidget::paneDetached, parent, &PanelWidget::updateVisibility); QObject::connect(this, &PaneWidget::paneDetached, parent, &PanelWidget::updateVisibility);
} }
PaneState PaneWidget::getCurrentState() const {
return PaneState(
this->activated,
this->attached,
this->getDetachedWindowState()
);
}
void PaneWidget::activate() { void PaneWidget::activate() {
if (this->activated) {
return;
}
this->show(); this->show();
this->activated = true; this->state.activated = true;
emit this->paneActivated(); emit this->paneActivated();
} }
void PaneWidget::deactivate() { void PaneWidget::deactivate() {
if (!this->activated) { if (this->isVisible()) {
return; this->hide();
} }
this->hide(); this->state.activated = false;
this->activated = false;
emit this->paneDeactivated(); emit this->paneDeactivated();
} }
void PaneWidget::restoreLastPaneState(const PaneState& lastPaneState) {
if (lastPaneState.detachedWindowState.has_value()) {
this->lastDetachedWindowState = lastPaneState.detachedWindowState;
}
if (!lastPaneState.attached && lastPaneState.detachedWindowState.has_value()) {
this->detach();
}
if (lastPaneState.activated) {
this->activate();
}
}
void PaneWidget::detach() { void PaneWidget::detach() {
if (!this->attached) {
return;
}
this->setWindowFlag(Qt::Window); this->setWindowFlag(Qt::Window);
if (this->lastDetachedWindowState.has_value()) { if (this->state.detachedWindowState.has_value()) {
this->resize(this->lastDetachedWindowState->size); this->resize(this->state.detachedWindowState->size);
this->move(this->lastDetachedWindowState->position); this->move(this->state.detachedWindowState->position);
} else {
this->state.detachedWindowState = DetachedWindowState(this->size(), this->pos());
} }
if (this->activated) { this->state.attached = false;
this->show();
}
this->attached = false;
emit this->paneDetached(); emit this->paneDetached();
} }
void PaneWidget::attach() { void PaneWidget::attach() {
if (this->attached) {
return;
}
this->lastDetachedWindowState = this->getDetachedWindowState();
this->setWindowFlag(Qt::Window, false); this->setWindowFlag(Qt::Window, false);
if (this->activated) { this->state.attached = true;
this->show();
}
this->attached = true;
emit this->paneAttached(); emit this->paneAttached();
} }
void PaneWidget::resizeEvent(QResizeEvent* event) {
if (!this->state.attached && this->state.detachedWindowState.has_value()) {
this->state.detachedWindowState->size = this->size();
}
}
void PaneWidget::moveEvent(QMoveEvent* event) {
if (!this->state.attached && this->state.detachedWindowState.has_value()) {
this->state.detachedWindowState->position = this->pos();
}
}
void PaneWidget::closeEvent(QCloseEvent* event) { void PaneWidget::closeEvent(QCloseEvent* event) {
this->deactivate(); this->deactivate();
QWidget::closeEvent(event); QWidget::closeEvent(event);
} }
std::optional<DetachedWindowState> PaneWidget::getDetachedWindowState() const {
if (!this->attached) {
return DetachedWindowState(this->size(), this->pos());
}
return this->lastDetachedWindowState;
}
} }

View File

@@ -1,6 +1,7 @@
#pragma once #pragma once
#include <QWidget> #include <QWidget>
#include <QEvent>
#include <optional> #include <optional>
#include "PanelWidget.hpp" #include "PanelWidget.hpp"
@@ -13,19 +14,14 @@ namespace Bloom::Widgets
Q_OBJECT Q_OBJECT
public: public:
bool activated = true; PaneState& state;
bool attached = true;
PanelWidget* parentPanel = nullptr; PanelWidget* parentPanel = nullptr;
explicit PaneWidget(PanelWidget* parent); explicit PaneWidget(PaneState& state, PanelWidget* parent);
[[nodiscard]] PaneState getCurrentState() const;
void activate(); void activate();
void deactivate(); void deactivate();
void restoreLastPaneState(const PaneState& lastPaneState);
signals: signals:
void paneActivated(); void paneActivated();
void paneDeactivated(); void paneDeactivated();
@@ -36,11 +32,8 @@ namespace Bloom::Widgets
void detach(); void detach();
void attach(); void attach();
void resizeEvent(QResizeEvent* event) override;
void moveEvent(QMoveEvent* event) override;
void closeEvent(QCloseEvent* event) override; void closeEvent(QCloseEvent* event) override;
private:
std::optional<DetachedWindowState> lastDetachedWindowState;
std::optional<DetachedWindowState> getDetachedWindowState() const;
}; };
} }

View File

@@ -64,7 +64,7 @@ namespace Bloom::Widgets
auto visible = false; auto visible = false;
for (const auto& paneWidget : paneWidgets) { for (const auto& paneWidget : paneWidgets) {
if (paneWidget->activated && paneWidget->attached) { if (paneWidget->state.activated && paneWidget->state.attached) {
visible = true; visible = true;
break; break;
} }

View File

@@ -23,9 +23,10 @@ namespace Bloom::Widgets
const TargetMemoryDescriptor& targetMemoryDescriptor, const TargetMemoryDescriptor& targetMemoryDescriptor,
TargetMemoryInspectionPaneSettings& settings, TargetMemoryInspectionPaneSettings& settings,
InsightWorker& insightWorker, InsightWorker& insightWorker,
PaneState& paneState,
PanelWidget* parent PanelWidget* parent
) )
: PaneWidget(parent) : PaneWidget(paneState, parent)
, targetMemoryDescriptor(targetMemoryDescriptor) , targetMemoryDescriptor(targetMemoryDescriptor)
, settings(settings) , settings(settings)
, insightWorker(insightWorker) , insightWorker(insightWorker)
@@ -185,6 +186,15 @@ namespace Bloom::Widgets
this, this,
&TargetMemoryInspectionPane::onProgrammingModeDisabled &TargetMemoryInspectionPane::onProgrammingModeDisabled
); );
// Restore the state
if (!this->state.attached) {
this->detach();
}
if (this->state.activated) {
this->activate();
}
} }
void TargetMemoryInspectionPane::refreshMemoryValues(std::optional<std::function<void(void)>> callback) { void TargetMemoryInspectionPane::refreshMemoryValues(std::optional<std::function<void(void)>> callback) {
@@ -368,7 +378,7 @@ namespace Bloom::Widgets
using Targets::TargetState; using Targets::TargetState;
this->targetState = newState; this->targetState = newState;
if (newState == TargetState::STOPPED && this->activated) { if (newState == TargetState::STOPPED && this->state.activated) {
if (this->settings.refreshOnTargetStop || !this->data.has_value()) { if (this->settings.refreshOnTargetStop || !this->data.has_value()) {
this->refreshMemoryValues([this] { this->refreshMemoryValues([this] {
this->hexViewerWidget->setDisabled(false); this->hexViewerWidget->setDisabled(false);

View File

@@ -31,6 +31,7 @@ namespace Bloom::Widgets
const Targets::TargetMemoryDescriptor& targetMemoryDescriptor, const Targets::TargetMemoryDescriptor& targetMemoryDescriptor,
TargetMemoryInspectionPaneSettings& settings, TargetMemoryInspectionPaneSettings& settings,
InsightWorker& insightWorker, InsightWorker& insightWorker,
PaneState& paneState,
PanelWidget* parent PanelWidget* parent
); );

View File

@@ -24,9 +24,10 @@ namespace Bloom::Widgets
TargetRegistersPaneWidget::TargetRegistersPaneWidget( TargetRegistersPaneWidget::TargetRegistersPaneWidget(
const TargetDescriptor& targetDescriptor, const TargetDescriptor& targetDescriptor,
InsightWorker& insightWorker, InsightWorker& insightWorker,
PaneState& paneState,
PanelWidget* parent PanelWidget* parent
) )
: PaneWidget(parent) : PaneWidget(paneState, parent)
, targetDescriptor(targetDescriptor) , targetDescriptor(targetDescriptor)
, insightWorker(insightWorker) , insightWorker(insightWorker)
{ {
@@ -141,6 +142,16 @@ namespace Bloom::Widgets
this, this,
&TargetRegistersPaneWidget::onRegistersRead &TargetRegistersPaneWidget::onRegistersRead
); );
// Restore the state
if (!this->state.attached) {
// The register pane cannot be detached.
this->state.attached = true;
}
if (this->state.activated) {
this->activate();
}
} }
void TargetRegistersPaneWidget::filterRegisters(const QString& keyword) { void TargetRegistersPaneWidget::filterRegisters(const QString& keyword) {
@@ -244,7 +255,7 @@ namespace Bloom::Widgets
using Targets::TargetState; using Targets::TargetState;
this->targetState = newState; this->targetState = newState;
if (newState == TargetState::STOPPED && this->activated) { if (newState == TargetState::STOPPED && this->state.activated) {
this->refreshRegisterValues(); this->refreshRegisterValues();
} }
} }

View File

@@ -29,6 +29,7 @@ namespace Bloom::Widgets
TargetRegistersPaneWidget( TargetRegistersPaneWidget(
const Targets::TargetDescriptor& targetDescriptor, const Targets::TargetDescriptor& targetDescriptor,
InsightWorker& insightWorker, InsightWorker& insightWorker,
PaneState& paneState,
PanelWidget *parent PanelWidget *parent
); );

View File

@@ -43,19 +43,19 @@ namespace Bloom
} }
if (jsonObject.contains("previousRegistersPaneState")) { if (jsonObject.contains("previousRegistersPaneState")) {
this->previousRegistersPaneState = this->paneStateFromJson( this->registersPaneState = this->paneStateFromJson(
jsonObject.find("previousRegistersPaneState")->toObject() jsonObject.find("previousRegistersPaneState")->toObject()
); );
} }
if (jsonObject.contains("previousRamInspectionPaneState")) { if (jsonObject.contains("previousRamInspectionPaneState")) {
this->previousRamInspectionPaneState = this->paneStateFromJson( this->ramInspectionPaneState = this->paneStateFromJson(
jsonObject.find("previousRamInspectionPaneState")->toObject() jsonObject.find("previousRamInspectionPaneState")->toObject()
); );
} }
if (jsonObject.contains("previousEepromInspectionPaneState")) { if (jsonObject.contains("previousEepromInspectionPaneState")) {
this->previousEepromInspectionPaneState = this->paneStateFromJson( this->eepromInspectionPaneState = this->paneStateFromJson(
jsonObject.find("previousEepromInspectionPaneState")->toObject() jsonObject.find("previousEepromInspectionPaneState")->toObject()
); );
} }
@@ -119,24 +119,24 @@ namespace Bloom
); );
} }
if (this->previousRegistersPaneState.has_value()) { if (this->registersPaneState.has_value()) {
insightObj.insert( insightObj.insert(
"previousRegistersPaneState", "previousRegistersPaneState",
this->paneStateToJson(this->previousRegistersPaneState.value()) this->paneStateToJson(this->registersPaneState.value())
); );
} }
if (this->previousRamInspectionPaneState.has_value()) { if (this->ramInspectionPaneState.has_value()) {
insightObj.insert( insightObj.insert(
"previousRamInspectionPaneState", "previousRamInspectionPaneState",
this->paneStateToJson(this->previousRamInspectionPaneState.value()) this->paneStateToJson(this->ramInspectionPaneState.value())
); );
} }
if (this->previousEepromInspectionPaneState.has_value()) { if (this->eepromInspectionPaneState.has_value()) {
insightObj.insert( insightObj.insert(
"previousEepromInspectionPaneState", "previousEepromInspectionPaneState",
this->paneStateToJson(this->previousEepromInspectionPaneState.value()) this->paneStateToJson(this->eepromInspectionPaneState.value())
); );
} }

View File

@@ -22,9 +22,9 @@ namespace Bloom
std::optional<QSize> mainWindowSize; std::optional<QSize> mainWindowSize;
std::optional<Widgets::PanelState> previousLeftPanelState; std::optional<Widgets::PanelState> previousLeftPanelState;
std::optional<Widgets::PanelState> previousBottomPanelState; std::optional<Widgets::PanelState> previousBottomPanelState;
std::optional<Widgets::PaneState> previousRegistersPaneState; std::optional<Widgets::PaneState> registersPaneState;
std::optional<Widgets::PaneState> previousRamInspectionPaneState; std::optional<Widgets::PaneState> ramInspectionPaneState;
std::optional<Widgets::PaneState> previousEepromInspectionPaneState; std::optional<Widgets::PaneState> eepromInspectionPaneState;
std::map< std::map<
Targets::TargetMemoryType, Targets::TargetMemoryType,