diff --git a/src/Insight/CMakeLists.txt b/src/Insight/CMakeLists.txt index 4f95e6c6..3e918ad5 100755 --- a/src/Insight/CMakeLists.txt +++ b/src/Insight/CMakeLists.txt @@ -100,6 +100,8 @@ qt_add_resources( "./UserInterfaces/InsightWindow/Images/down-arrow.svg" "./UserInterfaces/InsightWindow/Images/detach-pane-icon.svg" "./UserInterfaces/InsightWindow/Images/attach-pane-icon.svg" + "./UserInterfaces/InsightWindow/Images/checked-action-icon.svg" + "./UserInterfaces/InsightWindow/Images/unchecked-action-icon.svg" "./UserInterfaces/InsightWindow/Widgets/TargetRegistersPane/Images/collapse-all.svg" "./UserInterfaces/InsightWindow/Widgets/TargetRegistersPane/Images/expand-all.svg" "./UserInterfaces/InsightWindow/Widgets/TargetRegistersPane/Images/arrow.svg" diff --git a/src/Insight/UserInterfaces/InsightWindow/Images/checked-action-icon.svg b/src/Insight/UserInterfaces/InsightWindow/Images/checked-action-icon.svg new file mode 100644 index 00000000..df9865d2 --- /dev/null +++ b/src/Insight/UserInterfaces/InsightWindow/Images/checked-action-icon.svg @@ -0,0 +1,80 @@ + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/src/Insight/UserInterfaces/InsightWindow/Images/unchecked-action-icon.svg b/src/Insight/UserInterfaces/InsightWindow/Images/unchecked-action-icon.svg new file mode 100644 index 00000000..a1693070 --- /dev/null +++ b/src/Insight/UserInterfaces/InsightWindow/Images/unchecked-action-icon.svg @@ -0,0 +1,74 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/src/Insight/UserInterfaces/InsightWindow/Stylesheets/Global.qss b/src/Insight/UserInterfaces/InsightWindow/Stylesheets/Global.qss index 8a4b7793..62a16c9d 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Stylesheets/Global.qss +++ b/src/Insight/UserInterfaces/InsightWindow/Stylesheets/Global.qss @@ -69,6 +69,18 @@ QMenu::separator { height: 1px; } +QMenu::indicator { + padding-left: 10px; +} + +QMenu::indicator:non-exclusive:checked { + image: url(":/compiled/src/Insight/UserInterfaces/InsightWindow/Images/checked-action-icon.svg"); +} + +QMenu::indicator:non-exclusive:unchecked { + image: url(":/compiled/src/Insight/UserInterfaces/InsightWindow/Images/unchecked-action-icon.svg"); +} + QMenu#help-menu::separator { margin: 1px 0; } @@ -174,7 +186,16 @@ QPushButton:disabled { color: #8d8d90; } +QToolButton::menu-indicator { + image: none; +} + Bloom--Widgets--LabeledSeparator { qproperty-lineColor: #454545; color: #a6a6a6; } + +Bloom--Widgets--SvgToolButton QMenu::item { + padding-left: 10px; + min-width: 250px; +} diff --git a/src/Insight/UserInterfaces/InsightWindow/Stylesheets/InsightWindow.qss b/src/Insight/UserInterfaces/InsightWindow/Stylesheets/InsightWindow.qss index 9e57c832..6223a55e 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Stylesheets/InsightWindow.qss +++ b/src/Insight/UserInterfaces/InsightWindow/Stylesheets/InsightWindow.qss @@ -284,27 +284,34 @@ QScrollBar::sub-line:vertical { color: #afb1b3; } -#target-memory-inspection-pane #lh-side-bar { - border-right: 1px solid #41423f; +#target-memory-inspection-pane #top-bar { + border-bottom: 1px solid #41423f; } -#target-memory-inspection-pane #rh-side-bar { - border-left: 1px solid #41423f; -} - -#target-memory-inspection-pane #lh-side-bar QToolButton, -#target-memory-inspection-pane #rh-side-bar QToolButton { +#target-memory-inspection-pane #top-bar QToolButton { background-color: transparent; border: none; padding: 0; - qproperty-buttonWidth: 23; + qproperty-buttonWidth: 24; + qproperty-buttonHeight: 20; +} + +#target-memory-inspection-pane #top-bar QToolButton:hover { + background-color: #454541; + border: none; +} + +#target-memory-inspection-pane #top-bar #manage-memory-regions-btn { + qproperty-buttonWidth: 26; qproperty-buttonHeight: 21; } -#target-memory-inspection-pane #lh-side-bar QToolButton:hover, -#target-memory-inspection-pane #rh-side-bar QToolButton:hover { - background-color: #454541; - border: none; +#target-memory-inspection-pane #top-bar #separator { + background-color: transparent; + border-right: 1px solid #41423f; + padding: 0; + min-width: 1px; + max-width: 1px; } #hex-viewer-container #tool-bar, diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidget.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidget.cpp index 7d1a2059..5b7c0641 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidget.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidget.cpp @@ -48,7 +48,6 @@ namespace Bloom::Widgets this->toolBar = this->container->findChild("tool-bar"); this->bottomBar = this->container->findChild("bottom-bar"); - this->refreshButton = this->toolBar->findChild("refresh-memory-btn"); this->highlightStackMemoryButton = this->toolBar->findChild( "highlight-stack-memory-btn" ); diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidget.hpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidget.hpp index af506e10..a0f14978 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidget.hpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidget.hpp @@ -28,8 +28,6 @@ namespace Bloom::Widgets Q_OBJECT public: - SvgToolButton* refreshButton = nullptr; - HexViewerWidget( const Targets::TargetMemoryDescriptor& targetMemoryDescriptor, HexViewerWidgetSettings& settings, diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/UiFiles/HexViewerWidget.ui b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/UiFiles/HexViewerWidget.ui index 6fe84974..e2d9f0a2 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/UiFiles/HexViewerWidget.ui +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/UiFiles/HexViewerWidget.ui @@ -29,22 +29,6 @@ 0 - - - - :/compiled/src/Insight/UserInterfaces/InsightWindow/Images/refresh.svg - - - :/compiled/src/Insight/UserInterfaces/InsightWindow/Images/refresh-disabled.svg - - - Refresh Memory - - - - - - diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemoryRegionManager/Stylesheets/MemoryRegionManagerWindow.qss b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemoryRegionManager/Stylesheets/MemoryRegionManagerWindow.qss index 2e7e8d55..626b1606 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemoryRegionManager/Stylesheets/MemoryRegionManagerWindow.qss +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemoryRegionManager/Stylesheets/MemoryRegionManagerWindow.qss @@ -49,6 +49,10 @@ border: none; } +#region-selector-tool-bar Bloom--Widgets--SvgToolButton QMenu::item { + padding-left: 25px; +} + #region-selector-tool-bar #separator { background-color: transparent; border-right: 1px solid #41423f; diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.cpp index e9c313bb..eeecea05 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.cpp @@ -1,6 +1,6 @@ #include "TargetMemoryInspectionPane.hpp" -#include +#include #include #include "src/Insight/UserInterfaces/InsightWindow/UiLoader.hpp" @@ -64,10 +64,16 @@ namespace Bloom::Widgets // Quick sanity check to ensure the validity of persisted settings. this->sanitiseSettings(); - auto* subContainerLayout = this->container->findChild("sub-container-layout"); + auto* containerLayout = this->container->findChild("container-layout"); this->manageMemoryRegionsButton = this->container->findChild("manage-memory-regions-btn"); + + this->refreshButton = this->container->findChild("refresh-memory-btn"); + this->refreshOnTargetStopAction = this->refreshButton->findChild("refresh-target-stopped"); + this->refreshOnActivationAction = this->refreshButton->findChild("refresh-activation"); + this->detachPaneButton = this->container->findChild("detach-pane-btn"); this->attachPaneButton = this->container->findChild("attach-pane-btn"); + this->hexViewerWidget = new HexViewerWidget( this->targetMemoryDescriptor, this->settings.hexViewerWidgetSettings, @@ -78,7 +84,9 @@ namespace Bloom::Widgets ); this->hexViewerWidget->setDisabled(true); - subContainerLayout->insertWidget(1, this->hexViewerWidget); + containerLayout->addWidget(this->hexViewerWidget); + + this->setRefreshOnTargetStopEnabled(this->settings.refreshOnTargetStop); QObject::connect( this, @@ -115,6 +123,33 @@ namespace Bloom::Widgets &TargetMemoryInspectionPane::openMemoryRegionManagerWindow ); + QObject::connect( + this->refreshButton, + &QToolButton::clicked, + this, + [this] { + this->refreshMemoryValues(); + } + ); + + QObject::connect( + this->refreshOnTargetStopAction, + &QAction::triggered, + this, + [this] (bool checked) { + this->setRefreshOnTargetStopEnabled(checked); + } + ); + + QObject::connect( + this->refreshOnActivationAction, + &QAction::triggered, + this, + [this] (bool checked) { + this->setRefreshOnActivationEnabled(checked); + } + ); + QObject::connect( this->detachPaneButton, &QToolButton::clicked, @@ -149,20 +184,11 @@ namespace Bloom::Widgets this, &TargetMemoryInspectionPane::onProgrammingModeDisabled ); - - QObject::connect( - this->hexViewerWidget->refreshButton, - &QToolButton::clicked, - this, - [this] { - this->refreshMemoryValues(); - } - ); } void TargetMemoryInspectionPane::refreshMemoryValues(std::optional> callback) { - this->hexViewerWidget->refreshButton->setDisabled(true); - this->hexViewerWidget->refreshButton->startSpin(); + this->refreshButton->setDisabled(true); + this->refreshButton->startSpin(); auto excludedAddressRanges = std::set(); std::transform( @@ -210,10 +236,10 @@ namespace Bloom::Widgets &InsightWorkerTask::finished, this, [this] { - this->hexViewerWidget->refreshButton->stopSpin(); + this->refreshButton->stopSpin(); if (this->targetState == Targets::TargetState::STOPPED) { - this->hexViewerWidget->refreshButton->setDisabled(false); + this->refreshButton->setDisabled(false); } } ); @@ -241,7 +267,10 @@ namespace Bloom::Widgets } void TargetMemoryInspectionPane::postActivate() { - if (this->targetState == Targets::TargetState::STOPPED) { + if ( + this->settings.refreshOnActivation + && this->targetState == Targets::TargetState::STOPPED + ) { this->refreshMemoryValues([this] { this->hexViewerWidget->setDisabled(false); }); @@ -319,15 +348,30 @@ namespace Bloom::Widgets this->targetState = newState; if (newState == TargetState::STOPPED && this->activated) { - this->refreshMemoryValues([this] { + if (this->settings.refreshOnTargetStop) { + this->refreshMemoryValues([this] { + this->hexViewerWidget->setDisabled(false); + }); + + } else { this->hexViewerWidget->setDisabled(false); - }); + } } else if (newState == TargetState::RUNNING) { this->hexViewerWidget->setDisabled(true); } } + void TargetMemoryInspectionPane::setRefreshOnTargetStopEnabled(bool enabled) { + this->refreshOnTargetStopAction->setChecked(enabled); + this->settings.refreshOnTargetStop = enabled; + } + + void TargetMemoryInspectionPane::setRefreshOnActivationEnabled(bool enabled) { + this->refreshOnActivationAction->setChecked(enabled); + this->settings.refreshOnActivation = enabled; + } + void TargetMemoryInspectionPane::onMemoryRead(const Targets::TargetMemoryBuffer& buffer) { this->hexViewerWidget->updateValues(buffer); } diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.hpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.hpp index 7bd47d0f..5fd24d96 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.hpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.hpp @@ -53,6 +53,11 @@ namespace Bloom::Widgets QWidget* titleBar = nullptr; SvgToolButton* manageMemoryRegionsButton = nullptr; + + SvgToolButton* refreshButton = nullptr; + QAction* refreshOnTargetStopAction = nullptr; + QAction* refreshOnActivationAction = nullptr; + SvgToolButton* detachPaneButton = nullptr; SvgToolButton* attachPaneButton = nullptr; HexViewerWidget* hexViewerWidget = nullptr; @@ -63,6 +68,8 @@ namespace Bloom::Widgets void sanitiseSettings(); void onTargetStateChanged(Targets::TargetState newState); + void setRefreshOnTargetStopEnabled(bool enabled); + void setRefreshOnActivationEnabled(bool enabled); void onMemoryRead(const Targets::TargetMemoryBuffer& buffer); void openMemoryRegionManagerWindow(); void onMemoryRegionsChange(); diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPaneSettings.hpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPaneSettings.hpp index ce089e83..1a41f907 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPaneSettings.hpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPaneSettings.hpp @@ -12,6 +12,9 @@ namespace Bloom::Widgets struct TargetMemoryInspectionPaneSettings { bool activated = false; + bool refreshOnTargetStop = true; + bool refreshOnActivation = true; + HexViewerWidgetSettings hexViewerWidgetSettings; std::vector focusedMemoryRegions; diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/UiFiles/TargetMemoryInspectionPane.ui b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/UiFiles/TargetMemoryInspectionPane.ui index 563e86bb..f8d176c4 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/UiFiles/TargetMemoryInspectionPane.ui +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/UiFiles/TargetMemoryInspectionPane.ui @@ -4,7 +4,7 @@ - + 0 @@ -43,122 +43,137 @@ - - - 0 + + + 30 - - 0 + + 30 - - - - 30 - - - 30 - - - - - - - 3 + + + + + + 3 + + + 0 + + + + + + 5 + - - 0 + + QSizePolicy::Fixed - - - - - 3 - - - - - - - - :/compiled/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Images/manage-focused-regions.svg - - - Manage Memory Regions - - - - - - - Qt::Vertical - - - - - - - - - - 30 - - - 30 - - - - - - - 3 + + + + + + :/compiled/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Images/manage-focused-regions.svg - - 2 + + Manage Memory Regions - - - - - 3 - + + + + + + + + + :/compiled/src/Insight/UserInterfaces/InsightWindow/Images/refresh.svg + + + :/compiled/src/Insight/UserInterfaces/InsightWindow/Images/refresh-disabled.svg + + + Refresh Memory (right-click for auto-refresh options) + + + QToolButton::InstantPopup + + + true + + + + + + + After target execution stops - - - - - - :/compiled/src/Insight/UserInterfaces/InsightWindow/Images/detach-pane-icon.svg + + true - - Detach Pane + + true - - - - - - :/compiled/src/Insight/UserInterfaces/InsightWindow/Images/attach-pane-icon.svg + + + + After opening this pane - - Attach Pane + + true - - false + + true - - - - - - Qt::Vertical - - - - - - - - + + + + + + + + Qt::Horizontal + + + + + + + :/compiled/src/Insight/UserInterfaces/InsightWindow/Images/detach-pane-icon.svg + + + Detach Pane + + + + + + + :/compiled/src/Insight/UserInterfaces/InsightWindow/Images/attach-pane-icon.svg + + + Attach Pane + + + false + + + + + + + + 5 + + + + QSizePolicy::Fixed + + + + +