New ASCII view tool button in hex viewer

This commit is contained in:
Nav
2021-12-26 18:07:08 +00:00
parent 910eb97561
commit dd5424b6bb
7 changed files with 347 additions and 1 deletions

View File

@@ -415,7 +415,8 @@ QScrollBar::sub-line:vertical {
#hex-viewer-container #tool-bar #highlight-stack-memory-btn,
#hex-viewer-container #tool-bar #highlight-focused-memory-btn,
#hex-viewer-container #tool-bar #highlight-hovered-rows-columns-btn,
#hex-viewer-container #tool-bar #display-annotations-btn {
#hex-viewer-container #tool-bar #display-annotations-btn,
#hex-viewer-container #tool-bar #display-ascii-btn {
qproperty-buttonWidth: 25;
qproperty-buttonHeight: 21;
}

View File

@@ -56,6 +56,7 @@ HexViewerWidget::HexViewerWidget(
"highlight-focused-memory-btn"
);
this->displayAnnotationsButton = this->container->findChild<SvgToolButton*>("display-annotations-btn");
this->displayAsciiButton = this->container->findChild<SvgToolButton*>("display-ascii-btn");
this->toolBar->setContentsMargins(0, 0, 0, 0);
this->toolBar->layout()->setContentsMargins(5, 0, 5, 1);
@@ -80,6 +81,7 @@ HexViewerWidget::HexViewerWidget(
this->setHoveredRowAndColumnHighlightingEnabled(this->settings.highlightHoveredRowAndCol);
this->setFocusedMemoryHighlightingEnabled(this->settings.highlightFocusedMemory);
this->setAnnotationsEnabled(this->settings.displayAnnotations);
this->setDisplayAsciiEnabled(this->settings.displayAsciiValues);
if (this->targetMemoryDescriptor.type == Targets::TargetMemoryType::RAM) {
this->highlightStackMemoryButton->show();
@@ -126,6 +128,15 @@ HexViewerWidget::HexViewerWidget(
}
);
QObject::connect(
this->displayAsciiButton,
&QToolButton::clicked,
this,
[this] {
this->setDisplayAsciiEnabled(!this->settings.displayAsciiValues);
}
);
QObject::connect(
&insightWorker,
&InsightWorker::targetStateUpdated,
@@ -193,3 +204,10 @@ void HexViewerWidget::setAnnotationsEnabled(bool enabled) {
this->byteItemGraphicsScene->adjustSize(true);
}
void HexViewerWidget::setDisplayAsciiEnabled(bool enabled) {
this->displayAsciiButton->setChecked(enabled);
this->settings.displayAsciiValues = enabled;
this->byteItemGraphicsScene->invalidateChildItemCaches();
}

View File

@@ -68,6 +68,7 @@ namespace Bloom::Widgets
SvgToolButton* highlightFocusedMemoryButton = nullptr;
SvgToolButton* highlightHoveredRowAndColumnButton = nullptr;
SvgToolButton* displayAnnotationsButton = nullptr;
SvgToolButton* displayAsciiButton = nullptr;
Targets::TargetState targetState = Targets::TargetState::UNKNOWN;
@@ -76,5 +77,6 @@ namespace Bloom::Widgets
void setHoveredRowAndColumnHighlightingEnabled(bool enabled);
void setFocusedMemoryHighlightingEnabled(bool enabled);
void setAnnotationsEnabled(bool enabled);
void setDisplayAsciiEnabled(bool enabled);
};
}

View File

@@ -0,0 +1,146 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="25"
height="15"
viewBox="0 0 6.6145835 3.96875"
version="1.1"
id="svg974"
sodipodi:docname="ascii-view-disabled.svg"
inkscape:version="1.0.1 (1.0.1+r75)">
<defs
id="defs968" />
<sodipodi:namedview
id="base"
pagecolor="#343532"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:zoom="44.8"
inkscape:cx="17.651472"
inkscape:cy="8.9180725"
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="6000"
inkscape:window-y="24"
inkscape:window-maximized="1"
inkscape:snap-smooth-nodes="true"
inkscape:snap-bbox="true"
inkscape:snap-bbox-midpoints="true"
inkscape:snap-bbox-edge-midpoints="true" />
<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" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="Main"
style="display:inline">
<rect
style="fill:#7c5d3b;fill-opacity:1;stroke-width:0.0552426;opacity:0.5"
id="rect1537-3-6"
width="0.79374999"
height="0.79374993"
x="1.3229166"
y="0.52916658" />
<rect
style="display:inline;fill:#838382;fill-opacity:0.30000001;stroke-width:0.0552426;opacity:0.5"
id="rect1537-3-6-7"
width="0.79374999"
height="0.79374999"
x="2.3812504"
y="0.52916658" />
<rect
style="display:inline;fill:#7c5d3b;fill-opacity:1;stroke-width:0.0552426;opacity:0.5"
id="rect1537-3-6-4"
width="0.79374999"
height="0.79374999"
x="3.4395833"
y="0.52916658" />
<rect
style="display:inline;fill:#7c5d3b;fill-opacity:1;stroke-width:0.0552426;opacity:0.5"
id="rect1537-3-6-3"
width="0.79374999"
height="0.79374999"
x="4.4979167"
y="0.52916658" />
<rect
style="display:inline;fill:#838382;fill-opacity:0.30000001;stroke-width:0.0552426;opacity:0.5"
id="rect1537-3-6-0"
width="0.79374999"
height="0.79374993"
x="1.3229166"
y="1.5875002" />
<rect
style="display:inline;fill:#7c5d3b;fill-opacity:1;stroke-width:0.0552426;opacity:0.5"
id="rect1537-3-6-7-7"
width="0.79374999"
height="0.79374999"
x="2.3812504"
y="1.5875002" />
<rect
style="display:inline;fill:#838382;fill-opacity:0.30000001;stroke-width:0.0552426;opacity:0.5"
id="rect1537-3-6-4-8"
width="0.79374999"
height="0.79374999"
x="3.4395835"
y="1.5875002" />
<rect
style="display:inline;fill:#838382;fill-opacity:0.30000001;stroke-width:0.0552426;opacity:0.5"
id="rect1537-3-6-3-6"
width="0.79374999"
height="0.79374999"
x="4.4979167"
y="1.5875002" />
<rect
style="display:inline;fill:#7c5d3b;fill-opacity:1;stroke-width:0.0552426;opacity:0.5"
id="rect1537-3-6-8"
width="0.79374999"
height="0.79374993"
x="1.3229166"
y="2.6458335" />
<rect
style="display:inline;fill:#838382;fill-opacity:0.30000001;stroke-width:0.0552426;opacity:0.5"
id="rect1537-3-6-7-8"
width="0.79374999"
height="0.79374999"
x="2.3812504"
y="2.6458335" />
<rect
style="display:inline;fill:#7c5d3b;fill-opacity:1;stroke-width:0.0552426;opacity:0.5"
id="rect1537-3-6-4-4"
width="0.79374999"
height="0.79374999"
x="3.4395833"
y="2.6458335" />
<rect
style="display:inline;fill:#838382;fill-opacity:0.30000001;stroke-width:0.0552426;opacity:0.5"
id="rect1537-3-6-3-3"
width="0.79374999"
height="0.79374999"
x="4.4979167"
y="2.6458335" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@@ -0,0 +1,146 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="25"
height="15"
viewBox="0 0 6.6145835 3.96875"
version="1.1"
id="svg974"
sodipodi:docname="ascii-view.svg"
inkscape:version="1.0.1 (1.0.1+r75)">
<defs
id="defs968" />
<sodipodi:namedview
id="base"
pagecolor="#343532"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:zoom="44.8"
inkscape:cx="17.651472"
inkscape:cy="8.9180725"
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" />
<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" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="Main"
style="display:inline">
<rect
style="fill:#7c5d3b;fill-opacity:1;stroke-width:0.0552426"
id="rect1537-3-6"
width="0.79374999"
height="0.79374993"
x="1.3229166"
y="0.52916658" />
<rect
style="display:inline;fill:#838382;fill-opacity:0.30000001;stroke-width:0.0552426;opacity:1"
id="rect1537-3-6-7"
width="0.79374999"
height="0.79374999"
x="2.3812504"
y="0.52916658" />
<rect
style="display:inline;fill:#7c5d3b;fill-opacity:1;stroke-width:0.0552426"
id="rect1537-3-6-4"
width="0.79374999"
height="0.79374999"
x="3.4395833"
y="0.52916658" />
<rect
style="display:inline;fill:#7c5d3b;fill-opacity:1;stroke-width:0.0552426"
id="rect1537-3-6-3"
width="0.79374999"
height="0.79374999"
x="4.4979167"
y="0.52916658" />
<rect
style="display:inline;fill:#838382;fill-opacity:0.30000001;stroke-width:0.0552426;opacity:1"
id="rect1537-3-6-0"
width="0.79374999"
height="0.79374993"
x="1.3229166"
y="1.5875002" />
<rect
style="display:inline;fill:#7c5d3b;fill-opacity:1;stroke-width:0.0552426"
id="rect1537-3-6-7-7"
width="0.79374999"
height="0.79374999"
x="2.3812504"
y="1.5875002" />
<rect
style="display:inline;fill:#838382;fill-opacity:0.30000001;stroke-width:0.0552426;opacity:1"
id="rect1537-3-6-4-8"
width="0.79374999"
height="0.79374999"
x="3.4395835"
y="1.5875002" />
<rect
style="display:inline;fill:#838382;fill-opacity:0.30000001;stroke-width:0.0552426;opacity:1"
id="rect1537-3-6-3-6"
width="0.79374999"
height="0.79374999"
x="4.4979167"
y="1.5875002" />
<rect
style="display:inline;fill:#7c5d3b;fill-opacity:1;stroke-width:0.0552426"
id="rect1537-3-6-8"
width="0.79374999"
height="0.79374993"
x="1.3229166"
y="2.6458335" />
<rect
style="display:inline;fill:#838382;fill-opacity:0.30000001;stroke-width:0.0552426;opacity:1"
id="rect1537-3-6-7-8"
width="0.79374999"
height="0.79374999"
x="2.3812504"
y="2.6458335" />
<rect
style="display:inline;fill:#7c5d3b;fill-opacity:1;stroke-width:0.0552426"
id="rect1537-3-6-4-4"
width="0.79374999"
height="0.79374999"
x="3.4395833"
y="2.6458335" />
<rect
style="display:inline;fill:#838382;fill-opacity:0.30000001;stroke-width:0.0552426;opacity:1"
id="rect1537-3-6-3-3"
width="0.79374999"
height="0.79374999"
x="4.4979167"
y="2.6458335" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@@ -131,6 +131,37 @@
<item>
<widget class="QFrame" name="separator"/>
</item>
<item>
<spacer name="horizontal-spacer">
<property name="sizeHint">
<size>
<width>1</width>
</size>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
</spacer>
</item>
<item>
<widget class="SvgToolButton" name="display-ascii-btn">
<property name="checkable">
<bool>true</bool>
</property>
<property name="svgFilePath">
<string>:/compiled/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/ascii-view.svg</string>
</property>
<property name="disabledSvgFilePath">
<string>:/compiled/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/ascii-view-disabled.svg</string>
</property>
<property name="toolTip">
<string>Display As ASCII</string>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="separator"/>
</item>
<item>
<spacer name="horizontal-spacer">
<property name="orientation">

View File

@@ -47,6 +47,8 @@
<file alias="/compiled/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/highlight-hovered-rows-columns-disabled.svg">./Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/highlight-hovered-rows-columns-disabled.svg</file>
<file alias="/compiled/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/display-annotations.svg">./Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/display-annotations.svg</file>
<file alias="/compiled/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/display-annotations-disabled.svg">./Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/display-annotations-disabled.svg</file>
<file alias="/compiled/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/ascii-view.svg">./Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/ascii-view.svg</file>
<file alias="/compiled/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/ascii-view-disabled.svg">./Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/ascii-view-disabled.svg</file>
<!-- Target package widgets -->
<file alias="/compiled/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/DIP/Stylesheets/DualInlinePackage.qss">./Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/DIP/Stylesheets/DualInlinePackage.qss</file>