Added support for attaching and detaching memory inspection panes from the main insight window
This commit is contained in:
@@ -553,8 +553,27 @@ namespace Bloom
|
|||||||
);
|
);
|
||||||
|
|
||||||
bottomPanelLayout->addWidget(this->ramInspectionPane);
|
bottomPanelLayout->addWidget(this->ramInspectionPane);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
this->ramInspectionPane,
|
||||||
|
&PaneWidget::paneActivated,
|
||||||
|
this,
|
||||||
|
&InsightWindow::onRamInspectionPaneStateChanged
|
||||||
|
);
|
||||||
|
QObject::connect(
|
||||||
|
this->ramInspectionPane,
|
||||||
|
&PaneWidget::paneDeactivated,
|
||||||
|
this,
|
||||||
|
&InsightWindow::onRamInspectionPaneStateChanged
|
||||||
|
);
|
||||||
|
QObject::connect(
|
||||||
|
this->ramInspectionPane,
|
||||||
|
&PaneWidget::paneAttached,
|
||||||
|
this,
|
||||||
|
&InsightWindow::onRamInspectionPaneStateChanged
|
||||||
|
);
|
||||||
|
|
||||||
this->ramInspectionPane->deactivate();
|
this->ramInspectionPane->deactivate();
|
||||||
this->ramInspectionButton->setChecked(false);
|
|
||||||
this->ramInspectionButton->setDisabled(false);
|
this->ramInspectionButton->setDisabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -573,8 +592,27 @@ namespace Bloom
|
|||||||
);
|
);
|
||||||
|
|
||||||
bottomPanelLayout->addWidget(this->eepromInspectionPane);
|
bottomPanelLayout->addWidget(this->eepromInspectionPane);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
this->eepromInspectionPane,
|
||||||
|
&PaneWidget::paneActivated,
|
||||||
|
this,
|
||||||
|
&InsightWindow::onEepromInspectionPaneStateChanged
|
||||||
|
);
|
||||||
|
QObject::connect(
|
||||||
|
this->eepromInspectionPane,
|
||||||
|
&PaneWidget::paneDeactivated,
|
||||||
|
this,
|
||||||
|
&InsightWindow::onEepromInspectionPaneStateChanged
|
||||||
|
);
|
||||||
|
QObject::connect(
|
||||||
|
this->eepromInspectionPane,
|
||||||
|
&PaneWidget::paneAttached,
|
||||||
|
this,
|
||||||
|
&InsightWindow::onEepromInspectionPaneStateChanged
|
||||||
|
);
|
||||||
|
|
||||||
this->eepromInspectionPane->deactivate();
|
this->eepromInspectionPane->deactivate();
|
||||||
this->eepromInspectionButton->setChecked(false);
|
|
||||||
this->eepromInspectionButton->setDisabled(false);
|
this->eepromInspectionButton->setDisabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -837,33 +875,83 @@ namespace Bloom
|
|||||||
|
|
||||||
void InsightWindow::toggleRamInspectionPane() {
|
void InsightWindow::toggleRamInspectionPane() {
|
||||||
if (this->ramInspectionPane->activated) {
|
if (this->ramInspectionPane->activated) {
|
||||||
|
if (!this->ramInspectionPane->attached) {
|
||||||
|
this->ramInspectionPane->activateWindow();
|
||||||
|
this->ramInspectionButton->setChecked(true);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this->ramInspectionPane->deactivate();
|
this->ramInspectionPane->deactivate();
|
||||||
this->ramInspectionButton->setChecked(false);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (this->eepromInspectionPane != nullptr && this->eepromInspectionPane->activated) {
|
if (
|
||||||
this->toggleEepromInspectionPane();
|
this->ramInspectionPane->attached
|
||||||
|
&& this->eepromInspectionPane != nullptr
|
||||||
|
&& this->eepromInspectionPane->activated
|
||||||
|
&& this->eepromInspectionPane->attached
|
||||||
|
) {
|
||||||
|
this->eepromInspectionPane->deactivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
this->ramInspectionPane->activate();
|
this->ramInspectionPane->activate();
|
||||||
this->ramInspectionButton->setChecked(true);
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void InsightWindow::toggleEepromInspectionPane() {
|
||||||
|
if (this->eepromInspectionPane->activated) {
|
||||||
|
if (!this->eepromInspectionPane->attached) {
|
||||||
|
this->eepromInspectionPane->activateWindow();
|
||||||
|
this->eepromInspectionButton->setChecked(true);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->eepromInspectionPane->deactivate();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (
|
||||||
|
this->eepromInspectionPane->attached
|
||||||
|
&& this->ramInspectionPane != nullptr
|
||||||
|
&& this->ramInspectionPane->activated
|
||||||
|
&& this->ramInspectionPane->attached
|
||||||
|
) {
|
||||||
|
this->ramInspectionPane->deactivate();
|
||||||
|
}
|
||||||
|
|
||||||
|
this->eepromInspectionPane->activate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void InsightWindow::onRamInspectionPaneStateChanged() {
|
||||||
|
this->ramInspectionButton->setChecked(this->ramInspectionPane->activated);
|
||||||
|
|
||||||
|
if (
|
||||||
|
this->ramInspectionPane->activated
|
||||||
|
&& this->ramInspectionPane->attached
|
||||||
|
&& this->eepromInspectionPane != nullptr
|
||||||
|
&& this->eepromInspectionPane->activated
|
||||||
|
&& this->eepromInspectionPane->attached
|
||||||
|
) {
|
||||||
|
// Both panes cannot be attached and activated at the same time.
|
||||||
|
this->eepromInspectionPane->deactivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
this->adjustMinimumSize();
|
this->adjustMinimumSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InsightWindow::toggleEepromInspectionPane() {
|
void InsightWindow::onEepromInspectionPaneStateChanged() {
|
||||||
if (this->eepromInspectionPane->activated) {
|
this->eepromInspectionButton->setChecked(this->eepromInspectionPane->activated);
|
||||||
this->eepromInspectionPane->deactivate();
|
|
||||||
this->eepromInspectionButton->setChecked(false);
|
|
||||||
|
|
||||||
} else {
|
if (
|
||||||
if (this->ramInspectionPane != nullptr && this->ramInspectionPane->activated) {
|
this->eepromInspectionPane->activated
|
||||||
this->toggleRamInspectionPane();
|
&& this->eepromInspectionPane->attached
|
||||||
}
|
&& this->ramInspectionPane != nullptr
|
||||||
|
&& this->ramInspectionPane->activated
|
||||||
this->eepromInspectionPane->activate();
|
&& this->ramInspectionPane->attached
|
||||||
this->eepromInspectionButton->setChecked(true);
|
) {
|
||||||
|
// Both panes cannot be attached and activated at the same time.
|
||||||
|
this->ramInspectionPane->deactivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
this->adjustMinimumSize();
|
this->adjustMinimumSize();
|
||||||
|
|||||||
@@ -139,6 +139,8 @@ namespace Bloom
|
|||||||
void toggleTargetRegistersPane();
|
void toggleTargetRegistersPane();
|
||||||
void toggleRamInspectionPane();
|
void toggleRamInspectionPane();
|
||||||
void toggleEepromInspectionPane();
|
void toggleEepromInspectionPane();
|
||||||
|
void onRamInspectionPaneStateChanged();
|
||||||
|
void onEepromInspectionPaneStateChanged();
|
||||||
void onProgrammingModeEnabled();
|
void onProgrammingModeEnabled();
|
||||||
void onProgrammingModeDisabled();
|
void onProgrammingModeDisabled();
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,15 @@ namespace Bloom::Widgets
|
|||||||
{
|
{
|
||||||
this->setObjectName("target-memory-inspection-pane");
|
this->setObjectName("target-memory-inspection-pane");
|
||||||
|
|
||||||
|
const auto memoryName = QString(
|
||||||
|
this->targetMemoryDescriptor.type == TargetMemoryType::EEPROM
|
||||||
|
? "Internal EEPROM"
|
||||||
|
: "Internal RAM"
|
||||||
|
);
|
||||||
|
|
||||||
|
this->setWindowTitle("Memory Inspection - " + memoryName);
|
||||||
|
this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||||
|
|
||||||
auto memoryInspectionPaneUiFile = QFile(
|
auto memoryInspectionPaneUiFile = QFile(
|
||||||
QString::fromStdString(Paths::compiledResourcesPath()
|
QString::fromStdString(Paths::compiledResourcesPath()
|
||||||
+ "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/UiFiles/TargetMemoryInspectionPane.ui"
|
+ "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/UiFiles/TargetMemoryInspectionPane.ui"
|
||||||
@@ -44,15 +53,13 @@ namespace Bloom::Widgets
|
|||||||
|
|
||||||
auto uiLoader = UiLoader(this);
|
auto uiLoader = UiLoader(this);
|
||||||
this->container = uiLoader.load(&memoryInspectionPaneUiFile, this);
|
this->container = uiLoader.load(&memoryInspectionPaneUiFile, this);
|
||||||
this->container->setFixedSize(parent->width(), parent->maximumHeight());
|
this->container->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||||
|
|
||||||
this->titleBar = this->container->findChild<QWidget*>("title-bar");
|
this->titleBar = this->container->findChild<QWidget*>("title-bar");
|
||||||
|
|
||||||
this->titleBar->layout()->setContentsMargins(7, 0, 7, 0);
|
this->titleBar->layout()->setContentsMargins(7, 0, 7, 0);
|
||||||
auto* titleLabel = this->titleBar->findChild<Label*>("title");
|
auto* titleLabel = this->titleBar->findChild<Label*>("title");
|
||||||
titleLabel->setText(
|
titleLabel->setText(memoryName);
|
||||||
this->targetMemoryDescriptor.type == TargetMemoryType::EEPROM ? "Internal EEPROM" : "Internal RAM"
|
|
||||||
);
|
|
||||||
|
|
||||||
// Quick sanity check to ensure the validity of persisted settings.
|
// Quick sanity check to ensure the validity of persisted settings.
|
||||||
this->sanitiseSettings();
|
this->sanitiseSettings();
|
||||||
@@ -73,6 +80,34 @@ namespace Bloom::Widgets
|
|||||||
|
|
||||||
subContainerLayout->insertWidget(1, this->hexViewerWidget);
|
subContainerLayout->insertWidget(1, this->hexViewerWidget);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
this,
|
||||||
|
&PaneWidget::paneActivated,
|
||||||
|
this,
|
||||||
|
&TargetMemoryInspectionPane::postActivate
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
this,
|
||||||
|
&PaneWidget::paneDeactivated,
|
||||||
|
this,
|
||||||
|
&TargetMemoryInspectionPane::postDeactivate
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
this,
|
||||||
|
&PaneWidget::paneAttached,
|
||||||
|
this,
|
||||||
|
&TargetMemoryInspectionPane::postAttach
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
this,
|
||||||
|
&PaneWidget::paneDetached,
|
||||||
|
this,
|
||||||
|
&TargetMemoryInspectionPane::postDetach
|
||||||
|
);
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
this->manageMemoryRegionsButton,
|
this->manageMemoryRegionsButton,
|
||||||
&QToolButton::clicked,
|
&QToolButton::clicked,
|
||||||
@@ -80,6 +115,20 @@ namespace Bloom::Widgets
|
|||||||
&TargetMemoryInspectionPane::openMemoryRegionManagerWindow
|
&TargetMemoryInspectionPane::openMemoryRegionManagerWindow
|
||||||
);
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
this->detachPaneButton,
|
||||||
|
&QToolButton::clicked,
|
||||||
|
this,
|
||||||
|
&TargetMemoryInspectionPane::detach
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
this->attachPaneButton,
|
||||||
|
&QToolButton::clicked,
|
||||||
|
this,
|
||||||
|
&TargetMemoryInspectionPane::attach
|
||||||
|
);
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
&insightWorker,
|
&insightWorker,
|
||||||
&InsightWorker::targetStateUpdated,
|
&InsightWorker::targetStateUpdated,
|
||||||
@@ -181,22 +230,14 @@ namespace Bloom::Widgets
|
|||||||
this->insightWorker.queueTask(readMemoryTask);
|
this->insightWorker.queueTask(readMemoryTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TargetMemoryInspectionPane::activate() {
|
|
||||||
this->show();
|
|
||||||
this->activated = true;
|
|
||||||
this->postActivate();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetMemoryInspectionPane::deactivate() {
|
|
||||||
this->hide();
|
|
||||||
this->activated = false;
|
|
||||||
this->postDeactivate();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetMemoryInspectionPane::resizeEvent(QResizeEvent* event) {
|
void TargetMemoryInspectionPane::resizeEvent(QResizeEvent* event) {
|
||||||
const auto parentSize = this->parentPanel->size();
|
const auto size = this->size();
|
||||||
const auto width = parentSize.width() - 1;
|
this->container->setFixedSize(size.width() - 1, size.height());
|
||||||
this->container->setFixedSize(width, parentSize.height());
|
}
|
||||||
|
|
||||||
|
void TargetMemoryInspectionPane::closeEvent(QCloseEvent* event) {
|
||||||
|
this->deactivate();
|
||||||
|
QWidget::closeEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TargetMemoryInspectionPane::postActivate() {
|
void TargetMemoryInspectionPane::postActivate() {
|
||||||
@@ -211,6 +252,16 @@ namespace Bloom::Widgets
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TargetMemoryInspectionPane::postAttach() {
|
||||||
|
this->attachPaneButton->hide();
|
||||||
|
this->detachPaneButton->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TargetMemoryInspectionPane::postDetach() {
|
||||||
|
this->detachPaneButton->hide();
|
||||||
|
this->attachPaneButton->show();
|
||||||
|
}
|
||||||
|
|
||||||
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>();
|
||||||
|
|||||||
@@ -38,9 +38,12 @@ namespace Bloom::Widgets
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent* event) override;
|
void resizeEvent(QResizeEvent* event) override;
|
||||||
|
void closeEvent(QCloseEvent* event) override;
|
||||||
|
|
||||||
void postActivate();
|
void postActivate();
|
||||||
void postDeactivate();
|
void postDeactivate();
|
||||||
|
void postAttach();
|
||||||
|
void postDetach();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Targets::TargetMemoryDescriptor& targetMemoryDescriptor;
|
const Targets::TargetMemoryDescriptor& targetMemoryDescriptor;
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<widget class="QWidget" name="container">
|
<widget class="QWidget" name="container">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"/>
|
||||||
|
</property>
|
||||||
<layout class="QVBoxLayout">
|
<layout class="QVBoxLayout">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
|
|||||||
Reference in New Issue
Block a user