Moved refresh button out of HexViewerWidget, to MemoryInspectionPaneWidget
Added auto-refresh configuration menu Added checked/unchecked icons
This commit is contained in:
@@ -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"
|
||||
);
|
||||
|
||||
@@ -28,8 +28,6 @@ namespace Bloom::Widgets
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SvgToolButton* refreshButton = nullptr;
|
||||
|
||||
HexViewerWidget(
|
||||
const Targets::TargetMemoryDescriptor& targetMemoryDescriptor,
|
||||
HexViewerWidgetSettings& settings,
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -12,6 +12,9 @@ namespace Bloom::Widgets
|
||||
struct TargetMemoryInspectionPaneSettings
|
||||
{
|
||||
bool activated = false;
|
||||
bool refreshOnTargetStop = true;
|
||||
bool refreshOnActivation = true;
|
||||
|
||||
HexViewerWidgetSettings hexViewerWidgetSettings;
|
||||
|
||||
std::vector<FocusedMemoryRegion> focusedMemoryRegions;
|
||||
|
||||
@@ -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,122 +43,137 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="sub-container-layout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
<widget class="QWidget" name="top-bar">
|
||||
<property name="minimumHeight">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
<property name="maximumHeight">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<item alignment="Qt::AlignLeft">
|
||||
<widget class="QWidget" name="lh-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="lh-side-bar-layout">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"/>
|
||||
</property>
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontal-spacer">
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>5</width>
|
||||
</size>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="vertical-spacer">
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<height>3</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item alignment="Qt::AlignHCenter">
|
||||
<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>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Manage Memory Regions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="vertical-spacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</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>
|
||||
</spacer>
|
||||
</item>
|
||||
<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>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>2</number>
|
||||
<property name="toolTip">
|
||||
<string>Manage Memory Regions</string>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="vertical-spacer">
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<height>3</height>
|
||||
</size>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="separator"/>
|
||||
</item>
|
||||
<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>
|
||||
</spacer>
|
||||
</item>
|
||||
<item alignment="Qt::AlignHCenter">
|
||||
<widget class="SvgToolButton" name="detach-pane-btn">
|
||||
<property name="svgFilePath">
|
||||
<string>:/compiled/src/Insight/UserInterfaces/InsightWindow/Images/detach-pane-icon.svg</string>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Detach Pane</string>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignHCenter">
|
||||
<widget class="SvgToolButton" name="attach-pane-btn">
|
||||
<property name="svgFilePath">
|
||||
<string>:/compiled/src/Insight/UserInterfaces/InsightWindow/Images/attach-pane-icon.svg</string>
|
||||
</action>
|
||||
<action name="refresh-activation">
|
||||
<property name="text">
|
||||
<string>After opening this pane</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Attach Pane</string>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="vertical-spacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
</layout>
|
||||
</action>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontal-spacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item alignment="Qt::AlignHCenter">
|
||||
<widget class="SvgToolButton" name="detach-pane-btn">
|
||||
<property name="svgFilePath">
|
||||
<string>:/compiled/src/Insight/UserInterfaces/InsightWindow/Images/detach-pane-icon.svg</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Detach Pane</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignHCenter">
|
||||
<widget class="SvgToolButton" name="attach-pane-btn">
|
||||
<property name="svgFilePath">
|
||||
<string>:/compiled/src/Insight/UserInterfaces/InsightWindow/Images/attach-pane-icon.svg</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Attach Pane</string>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<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>
|
||||
</widget>
|
||||
|
||||
Reference in New Issue
Block a user