diff --git a/src/Insight/UserInterfaces/InsightWindow/Stylesheets/InsightWindow.qss b/src/Insight/UserInterfaces/InsightWindow/Stylesheets/InsightWindow.qss index 2bfc196a..93eb59ee 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Stylesheets/InsightWindow.qss +++ b/src/Insight/UserInterfaces/InsightWindow/Stylesheets/InsightWindow.qss @@ -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; } diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidget.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidget.cpp index 9798473c..d35a7aa0 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidget.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidget.cpp @@ -56,6 +56,7 @@ HexViewerWidget::HexViewerWidget( "highlight-focused-memory-btn" ); this->displayAnnotationsButton = this->container->findChild("display-annotations-btn"); + this->displayAsciiButton = this->container->findChild("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(); +} diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidget.hpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidget.hpp index 435e4217..557d09c6 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidget.hpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidget.hpp @@ -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); }; } diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/ascii-view-disabled.svg b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/ascii-view-disabled.svg new file mode 100644 index 00000000..146642b3 --- /dev/null +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/ascii-view-disabled.svg @@ -0,0 +1,146 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/ascii-view.svg b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/ascii-view.svg new file mode 100644 index 00000000..0c45665f --- /dev/null +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/ascii-view.svg @@ -0,0 +1,146 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + 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 303fd7ad..200402d5 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/UiFiles/HexViewerWidget.ui +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/UiFiles/HexViewerWidget.ui @@ -131,6 +131,37 @@ + + + + + 1 + + + + QSizePolicy::Fixed + + + + + + + true + + + :/compiled/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/ascii-view.svg + + + :/compiled/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/ascii-view-disabled.svg + + + Display As ASCII + + + + + + diff --git a/src/resources.qrc b/src/resources.qrc index bb3c7b07..29eccaec 100644 --- a/src/resources.qrc +++ b/src/resources.qrc @@ -47,6 +47,8 @@ ./Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/highlight-hovered-rows-columns-disabled.svg ./Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/display-annotations.svg ./Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/display-annotations-disabled.svg + ./Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/ascii-view.svg + ./Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Images/ascii-view-disabled.svg ./Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/DIP/Stylesheets/DualInlinePackage.qss