Moved refresh button out of HexViewerWidget, to MemoryInspectionPaneWidget

Added auto-refresh configuration menu
Added checked/unchecked icons
This commit is contained in:
Nav
2022-07-17 18:26:07 +01:00
parent c01fbcc99c
commit 6fd926b9bb
13 changed files with 394 additions and 156 deletions

View File

@@ -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"

View File

@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="16"
height="14"
viewBox="0 0 4.2333335 3.7041667"
version="1.1"
id="svg974"
sodipodi:docname="checked-action-icon.svg"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<defs
id="defs968" />
<sodipodi:namedview
id="base"
pagecolor="#343532"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:zoom="32"
inkscape:cx="5.8125"
inkscape:cy="2.828125"
inkscape:document-units="px"
inkscape:current-layer="layer2"
inkscape:document-rotation="0"
showgrid="false"
units="px"
inkscape:snap-page="true"
inkscape:window-width="2560"
inkscape:window-height="1353"
inkscape:window-x="0"
inkscape:window-y="34"
inkscape:window-maximized="1"
inkscape:snap-smooth-nodes="true"
inkscape:snap-bbox="true"
inkscape:snap-bbox-midpoints="true"
inkscape:snap-bbox-edge-midpoints="true"
inkscape:pagecheckerboard="0" />
<metadata
id="metadata971">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="Main"
style="display:inline">
<rect
style="display:inline;fill:none;fill-opacity:1;stroke:none;stroke-width:0.546629;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect1537-3-6-4-3-6"
width="2.8929155"
height="1.8345821"
x="1.5962507"
y="1.5962507" />
<rect
style="display:inline;fill:#838382;fill-opacity:1;stroke:none;stroke-width:0.683152;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect1537-3-6-4-3-7"
width="1.5875001"
height="1.0583334"
x="1.3229166"
y="1.3229166" />
<path
id="rect1537-3-6-4-3-7-6"
style="display:inline;fill:#838382;fill-opacity:1;stroke:none;stroke-width:0.989981;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 0.26458333,0.26458333 V 3.4395834 H 3.9687501 V 0.26458333 Z M 0.79375004,0.79375002 H 3.4395834 V 2.9104167 H 0.79375004 Z" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="16"
height="14"
viewBox="0 0 4.2333335 3.7041667"
version="1.1"
id="svg974"
sodipodi:docname="unchecked-action-icon.svg"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<defs
id="defs968" />
<sodipodi:namedview
id="base"
pagecolor="#343532"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:zoom="32"
inkscape:cx="5.8125"
inkscape:cy="2.828125"
inkscape:document-units="px"
inkscape:current-layer="layer2"
inkscape:document-rotation="0"
showgrid="false"
units="px"
inkscape:snap-page="true"
inkscape:window-width="3440"
inkscape:window-height="1353"
inkscape:window-x="2560"
inkscape:window-y="34"
inkscape:window-maximized="1"
inkscape:snap-smooth-nodes="true"
inkscape:snap-bbox="true"
inkscape:snap-bbox-midpoints="true"
inkscape:snap-bbox-edge-midpoints="true"
inkscape:pagecheckerboard="0" />
<metadata
id="metadata971">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="Main"
style="display:inline">
<path
id="rect1537-3-6-4-3-7"
style="display:inline;fill:#838382;fill-opacity:1;stroke:none;stroke-width:3.74166;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 1 1 L 1 13 L 15 13 L 15 1 L 1 1 z M 3 3 L 13 3 L 13 11 L 3 11 L 3 3 z "
transform="scale(0.26458334)" />
<rect
style="display:inline;fill:none;fill-opacity:1;stroke:none;stroke-width:0.546629;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect1537-3-6-4-3-6"
width="2.8929155"
height="1.8345821"
x="1.5962507"
y="1.5962507" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -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;
}

View File

@@ -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,

View File

@@ -48,7 +48,6 @@ namespace Bloom::Widgets
this->toolBar = this->container->findChild<QWidget*>("tool-bar");
this->bottomBar = this->container->findChild<QWidget*>("bottom-bar");
this->refreshButton = this->toolBar->findChild<SvgToolButton*>("refresh-memory-btn");
this->highlightStackMemoryButton = this->toolBar->findChild<SvgToolButton*>(
"highlight-stack-memory-btn"
);

View File

@@ -28,8 +28,6 @@ namespace Bloom::Widgets
Q_OBJECT
public:
SvgToolButton* refreshButton = nullptr;
HexViewerWidget(
const Targets::TargetMemoryDescriptor& targetMemoryDescriptor,
HexViewerWidgetSettings& settings,

View File

@@ -29,22 +29,6 @@
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="SvgToolButton" name="refresh-memory-btn">
<property name="svgFilePath">
<string>:/compiled/src/Insight/UserInterfaces/InsightWindow/Images/refresh.svg</string>
</property>
<property name="disabledSvgFilePath">
<string>:/compiled/src/Insight/UserInterfaces/InsightWindow/Images/refresh-disabled.svg</string>
</property>
<property name="toolTip">
<string>Refresh Memory</string>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="separator"/>
</item>
<item>
<spacer name="horizontal-spacer">
<property name="sizeHint">

View File

@@ -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;

View File

@@ -1,6 +1,6 @@
#include "TargetMemoryInspectionPane.hpp"
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QToolButton>
#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<QHBoxLayout*>("sub-container-layout");
auto* containerLayout = this->container->findChild<QVBoxLayout*>("container-layout");
this->manageMemoryRegionsButton = this->container->findChild<SvgToolButton*>("manage-memory-regions-btn");
this->refreshButton = this->container->findChild<SvgToolButton*>("refresh-memory-btn");
this->refreshOnTargetStopAction = this->refreshButton->findChild<QAction*>("refresh-target-stopped");
this->refreshOnActivationAction = this->refreshButton->findChild<QAction*>("refresh-activation");
this->detachPaneButton = this->container->findChild<SvgToolButton*>("detach-pane-btn");
this->attachPaneButton = this->container->findChild<SvgToolButton*>("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<std::function<void(void)>> callback) {
this->hexViewerWidget->refreshButton->setDisabled(true);
this->hexViewerWidget->refreshButton->startSpin();
this->refreshButton->setDisabled(true);
this->refreshButton->startSpin();
auto excludedAddressRanges = std::set<Targets::TargetMemoryAddressRange>();
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) {
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);
}

View File

@@ -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();

View File

@@ -12,6 +12,9 @@ namespace Bloom::Widgets
struct TargetMemoryInspectionPaneSettings
{
bool activated = false;
bool refreshOnTargetStop = true;
bool refreshOnActivation = true;
HexViewerWidgetSettings hexViewerWidgetSettings;
std::vector<FocusedMemoryRegion> focusedMemoryRegions;

View File

@@ -4,7 +4,7 @@
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"/>
</property>
<layout class="QVBoxLayout">
<layout class="QVBoxLayout" name="container-layout">
<property name="spacing">
<number>0</number>
</property>
@@ -43,25 +43,17 @@
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="sub-container-layout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item alignment="Qt::AlignLeft">
<widget class="QWidget" name="lh-side-bar">
<property name="minimumWidth">
<widget class="QWidget" name="top-bar">
<property name="minimumHeight">
<number>30</number>
</property>
<property name="maximumWidth">
<property name="maximumHeight">
<number>30</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Expanding"/>
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"/>
</property>
<layout class="QVBoxLayout" name="lh-side-bar-layout">
<layout class="QHBoxLayout">
<property name="spacing">
<number>3</number>
</property>
@@ -69,15 +61,18 @@
<number>0</number>
</property>
<item>
<spacer name="vertical-spacer">
<spacer name="horizontal-spacer">
<property name="sizeHint">
<size>
<height>3</height>
<width>5</width>
</size>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
</spacer>
</item>
<item alignment="Qt::AlignHCenter">
<item>
<widget class="SvgToolButton" name="manage-memory-regions-btn">
<property name="svgFilePath">
<string>:/compiled/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Images/manage-focused-regions.svg</string>
@@ -88,39 +83,57 @@
</widget>
</item>
<item>
<spacer name="vertical-spacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</spacer>
<widget class="QFrame" name="separator"/>
</item>
</layout>
<item>
<widget class="SvgToolButton" name="refresh-memory-btn">
<property name="svgFilePath">
<string>:/compiled/src/Insight/UserInterfaces/InsightWindow/Images/refresh.svg</string>
</property>
<property name="disabledSvgFilePath">
<string>:/compiled/src/Insight/UserInterfaces/InsightWindow/Images/refresh-disabled.svg</string>
</property>
<property name="toolTip">
<string>Refresh Memory (right-click for auto-refresh options)</string>
</property>
<property name="popupMode">
<enum>QToolButton::InstantPopup</enum>
</property>
<property name="contextMenuEnabled">
<bool>true</bool>
</property>
<widget class="QMenu" name="refresh-menu">
<addaction name="refresh-target-stopped"/>
<addaction name="refresh-activation"/>
<action name="refresh-target-stopped">
<property name="text">
<string>After target execution stops</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</action>
<action name="refresh-activation">
<property name="text">
<string>After opening this pane</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</action>
</widget>
</widget>
</item>
<item alignment="Qt::AlignLeft">
<widget class="QWidget" name="rh-side-bar">
<property name="minimumWidth">
<number>30</number>
</property>
<property name="maximumWidth">
<number>30</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Expanding"/>
</property>
<layout class="QVBoxLayout" name="rh-side-bar-layout">
<property name="spacing">
<number>3</number>
</property>
<property name="margin">
<number>2</number>
</property>
<item>
<spacer name="vertical-spacer">
<property name="sizeHint">
<size>
<height>3</height>
</size>
<spacer name="horizontal-spacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</spacer>
</item>
@@ -148,18 +161,20 @@
</widget>
</item>
<item>
<spacer name="vertical-spacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<spacer name="horizontal-spacer">
<property name="sizeHint">
<size>
<width>5</width>
</size>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</ui>