From 59986b052a196f8529b312172593ca744281b99d Mon Sep 17 00:00:00 2001 From: Nav Date: Sun, 11 Sep 2022 17:19:17 +0100 Subject: [PATCH] Stale data indicator in memory inspection pane --- src/Insight/CMakeLists.txt | 3 +- .../Stylesheets/InsightWindow.qss | 9 +++ .../Images/stale-data-icon.svg | 67 +++++++++++++++++++ .../TargetMemoryInspectionPane.cpp | 21 ++++++ .../TargetMemoryInspectionPane.hpp | 6 ++ .../UiFiles/TargetMemoryInspectionPane.ui | 40 ++++++++++- 6 files changed, 144 insertions(+), 2 deletions(-) create mode 100644 src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Images/stale-data-icon.svg diff --git a/src/Insight/CMakeLists.txt b/src/Insight/CMakeLists.txt index d103702c..830dc240 100755 --- a/src/Insight/CMakeLists.txt +++ b/src/Insight/CMakeLists.txt @@ -117,11 +117,12 @@ qt_add_resources( "./UserInterfaces/InsightWindow/Widgets/TargetRegistersPane/Images/search-registers.svg" "./UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Images/memory-inspection-icon.svg" "./UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Images/memory-inspection-icon-disabled.svg" + "./UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Images/manage-focused-regions.svg" + "./UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Images/stale-data-icon.svg" "./UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/highlight-stack-memory.svg" "./UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/highlight-stack-memory-disabled.svg" "./UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/highlight-focused-memory.svg" "./UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/highlight-focused-memory-disabled.svg" - "./UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Images/manage-focused-regions.svg" "./UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/highlight-hovered-rows-columns.svg" "./UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/highlight-hovered-rows-columns-disabled.svg" "./UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/display-annotations.svg" diff --git a/src/Insight/UserInterfaces/InsightWindow/Stylesheets/InsightWindow.qss b/src/Insight/UserInterfaces/InsightWindow/Stylesheets/InsightWindow.qss index 19f39fa7..9b77c6bb 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Stylesheets/InsightWindow.qss +++ b/src/Insight/UserInterfaces/InsightWindow/Stylesheets/InsightWindow.qss @@ -337,6 +337,15 @@ QScrollBar::sub-line:vertical { color: #8a8a8d; } +#target-memory-inspection-pane #stale-data-label QLabel { + margin-top: 1px; + color: #9a9a9d; +} + +#target-memory-inspection-pane #stale-data-label #icon { + margin-top: 2px; +} + #hex-viewer-container #tool-bar, #hex-viewer-container #search-bar { border-bottom: 1px solid #41423f; diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Images/stale-data-icon.svg b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Images/stale-data-icon.svg new file mode 100644 index 00000000..a39d853e --- /dev/null +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Images/stale-data-icon.svg @@ -0,0 +1,67 @@ + + + + + + + + image/svg+xml + + + + + + + + diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.cpp index f7b8e4db..c7f3a73c 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.cpp @@ -78,6 +78,8 @@ namespace Bloom::Widgets auto* memoryCapacityLabel = this->container->findChild("memory-capacity-label"); memoryCapacityLabel->setText(QString::number(this->targetMemoryDescriptor.size()) + " Bytes"); + this->staleDataLabelContainer = this->container->findChild("stale-data-label"); + this->hexViewerWidget = new HexViewerWidget( this->targetMemoryDescriptor, this->settings.hexViewerWidgetSettings, @@ -190,6 +192,13 @@ namespace Bloom::Widgets &TargetMemoryInspectionPane::onTargetStateChanged ); + QObject::connect( + insightSignals, + &InsightSignals::targetReset, + this, + &TargetMemoryInspectionPane::onTargetReset + ); + QObject::connect( insightSignals, &InsightSignals::programmingModeEnabled, @@ -431,6 +440,7 @@ namespace Bloom::Widgets } else if (newState == TargetState::RUNNING) { this->hexViewerWidget->setDisabled(true); this->refreshButton->setDisabled(true); + this->setStaleData(this->data.has_value()); } } @@ -449,6 +459,7 @@ namespace Bloom::Widgets this->data = data; this->hexViewerWidget->updateValues(this->data.value()); + this->setStaleData(false); } void TargetMemoryInspectionPane::openMemoryRegionManagerWindow() { @@ -482,9 +493,14 @@ namespace Bloom::Widgets this->hexViewerWidget->refreshRegions(); } + void TargetMemoryInspectionPane::onTargetReset() { + this->setStaleData(this->data.has_value()); + } + void TargetMemoryInspectionPane::onProgrammingModeEnabled() { this->hexViewerWidget->setDisabled(true); this->refreshButton->setDisabled(true); + this->setStaleData(this->data.has_value()); } void TargetMemoryInspectionPane::onProgrammingModeDisabled() { @@ -492,4 +508,9 @@ namespace Bloom::Widgets this->hexViewerWidget->setDisabled(disabled); this->refreshButton->setDisabled(disabled); } + + void TargetMemoryInspectionPane::setStaleData(bool staleData) { + this->staleData = staleData; + this->staleDataLabelContainer->setVisible(this->staleData); + } } diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.hpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.hpp index 9b2c5035..1873e5ef 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.hpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.hpp @@ -62,10 +62,14 @@ namespace Bloom::Widgets SvgToolButton* attachPaneButton = nullptr; HexViewerWidget* hexViewerWidget = nullptr; + QWidget* staleDataLabelContainer = nullptr; + Targets::TargetState targetState = Targets::TargetState::UNKNOWN; MemoryRegionManagerWindow* memoryRegionManagerWindow = nullptr; + bool staleData = false; + void sanitiseSettings(); void onTargetStateChanged(Targets::TargetState newState); void setRefreshOnTargetStopEnabled(bool enabled); @@ -73,7 +77,9 @@ namespace Bloom::Widgets void onMemoryRead(const Targets::TargetMemoryBuffer& data); void openMemoryRegionManagerWindow(); void onMemoryRegionsChange(); + void onTargetReset(); void onProgrammingModeEnabled(); void onProgrammingModeDisabled(); + void setStaleData(bool staleData); }; } diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/UiFiles/TargetMemoryInspectionPane.ui b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/UiFiles/TargetMemoryInspectionPane.ui index 088faa20..04efd7db 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/UiFiles/TargetMemoryInspectionPane.ui +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/UiFiles/TargetMemoryInspectionPane.ui @@ -317,11 +317,49 @@ + + + + false + + + + 1 + + + 0 + + + + + 15 + + + 14 + + + :/compiled/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Images/stale-data-icon.svg + + + + + + + Stale data + + + Data may be stale + + + + + + - 5 + 10