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);
|
||||
|
||||
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->ramInspectionButton->setChecked(false);
|
||||
this->ramInspectionButton->setDisabled(false);
|
||||
}
|
||||
|
||||
@@ -573,8 +592,27 @@ namespace Bloom
|
||||
);
|
||||
|
||||
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->eepromInspectionButton->setChecked(false);
|
||||
this->eepromInspectionButton->setDisabled(false);
|
||||
}
|
||||
}
|
||||
@@ -837,33 +875,83 @@ namespace Bloom
|
||||
|
||||
void InsightWindow::toggleRamInspectionPane() {
|
||||
if (this->ramInspectionPane->activated) {
|
||||
if (!this->ramInspectionPane->attached) {
|
||||
this->ramInspectionPane->activateWindow();
|
||||
this->ramInspectionButton->setChecked(true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this->ramInspectionPane->deactivate();
|
||||
this->ramInspectionButton->setChecked(false);
|
||||
|
||||
} else {
|
||||
if (this->eepromInspectionPane != nullptr && this->eepromInspectionPane->activated) {
|
||||
this->toggleEepromInspectionPane();
|
||||
if (
|
||||
this->ramInspectionPane->attached
|
||||
&& this->eepromInspectionPane != nullptr
|
||||
&& this->eepromInspectionPane->activated
|
||||
&& this->eepromInspectionPane->attached
|
||||
) {
|
||||
this->eepromInspectionPane->deactivate();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
void InsightWindow::toggleEepromInspectionPane() {
|
||||
if (this->eepromInspectionPane->activated) {
|
||||
this->eepromInspectionPane->deactivate();
|
||||
this->eepromInspectionButton->setChecked(false);
|
||||
void InsightWindow::onEepromInspectionPaneStateChanged() {
|
||||
this->eepromInspectionButton->setChecked(this->eepromInspectionPane->activated);
|
||||
|
||||
} else {
|
||||
if (this->ramInspectionPane != nullptr && this->ramInspectionPane->activated) {
|
||||
this->toggleRamInspectionPane();
|
||||
}
|
||||
|
||||
this->eepromInspectionPane->activate();
|
||||
this->eepromInspectionButton->setChecked(true);
|
||||
if (
|
||||
this->eepromInspectionPane->activated
|
||||
&& this->eepromInspectionPane->attached
|
||||
&& this->ramInspectionPane != nullptr
|
||||
&& this->ramInspectionPane->activated
|
||||
&& this->ramInspectionPane->attached
|
||||
) {
|
||||
// Both panes cannot be attached and activated at the same time.
|
||||
this->ramInspectionPane->deactivate();
|
||||
}
|
||||
|
||||
this->adjustMinimumSize();
|
||||
|
||||
@@ -139,6 +139,8 @@ namespace Bloom
|
||||
void toggleTargetRegistersPane();
|
||||
void toggleRamInspectionPane();
|
||||
void toggleEepromInspectionPane();
|
||||
void onRamInspectionPaneStateChanged();
|
||||
void onEepromInspectionPaneStateChanged();
|
||||
void onProgrammingModeEnabled();
|
||||
void onProgrammingModeDisabled();
|
||||
|
||||
|
||||
@@ -32,6 +32,15 @@ namespace Bloom::Widgets
|
||||
{
|
||||
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(
|
||||
QString::fromStdString(Paths::compiledResourcesPath()
|
||||
+ "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/UiFiles/TargetMemoryInspectionPane.ui"
|
||||
@@ -44,15 +53,13 @@ namespace Bloom::Widgets
|
||||
|
||||
auto uiLoader = UiLoader(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->layout()->setContentsMargins(7, 0, 7, 0);
|
||||
auto* titleLabel = this->titleBar->findChild<Label*>("title");
|
||||
titleLabel->setText(
|
||||
this->targetMemoryDescriptor.type == TargetMemoryType::EEPROM ? "Internal EEPROM" : "Internal RAM"
|
||||
);
|
||||
titleLabel->setText(memoryName);
|
||||
|
||||
// Quick sanity check to ensure the validity of persisted settings.
|
||||
this->sanitiseSettings();
|
||||
@@ -73,6 +80,34 @@ namespace Bloom::Widgets
|
||||
|
||||
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(
|
||||
this->manageMemoryRegionsButton,
|
||||
&QToolButton::clicked,
|
||||
@@ -80,6 +115,20 @@ namespace Bloom::Widgets
|
||||
&TargetMemoryInspectionPane::openMemoryRegionManagerWindow
|
||||
);
|
||||
|
||||
QObject::connect(
|
||||
this->detachPaneButton,
|
||||
&QToolButton::clicked,
|
||||
this,
|
||||
&TargetMemoryInspectionPane::detach
|
||||
);
|
||||
|
||||
QObject::connect(
|
||||
this->attachPaneButton,
|
||||
&QToolButton::clicked,
|
||||
this,
|
||||
&TargetMemoryInspectionPane::attach
|
||||
);
|
||||
|
||||
QObject::connect(
|
||||
&insightWorker,
|
||||
&InsightWorker::targetStateUpdated,
|
||||
@@ -181,22 +230,14 @@ namespace Bloom::Widgets
|
||||
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) {
|
||||
const auto parentSize = this->parentPanel->size();
|
||||
const auto width = parentSize.width() - 1;
|
||||
this->container->setFixedSize(width, parentSize.height());
|
||||
const auto size = this->size();
|
||||
this->container->setFixedSize(size.width() - 1, size.height());
|
||||
}
|
||||
|
||||
void TargetMemoryInspectionPane::closeEvent(QCloseEvent* event) {
|
||||
this->deactivate();
|
||||
QWidget::closeEvent(event);
|
||||
}
|
||||
|
||||
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() {
|
||||
// Remove any invalid memory regions. It's very unlikely that there will be any, but not impossible.
|
||||
auto processedFocusedMemoryRegions = std::vector<FocusedMemoryRegion>();
|
||||
|
||||
@@ -38,9 +38,12 @@ namespace Bloom::Widgets
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
void closeEvent(QCloseEvent* event) override;
|
||||
|
||||
void postActivate();
|
||||
void postDeactivate();
|
||||
void postAttach();
|
||||
void postDetach();
|
||||
|
||||
private:
|
||||
const Targets::TargetMemoryDescriptor& targetMemoryDescriptor;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<widget class="QWidget" name="container">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
|
||||
Reference in New Issue
Block a user