Added addressLabelType to HexViewerWidgetSettings
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
|
||||
namespace Bloom::Widgets
|
||||
{
|
||||
ByteAddressContainer::ByteAddressContainer(const HexViewerWidgetSettings& settings)
|
||||
: settings(settings)
|
||||
{}
|
||||
|
||||
void ByteAddressContainer::adjustAddressLabels(
|
||||
const std::map<std::size_t, std::vector<ByteItem*>>& byteItemsByRowIndex
|
||||
) {
|
||||
@@ -15,7 +19,7 @@ namespace Bloom::Widgets
|
||||
|
||||
ByteAddressItem* addressLabel = nullptr;
|
||||
if (static_cast<int>(rowIndex) > layoutItemMaxIndex) {
|
||||
addressLabel = new ByteAddressItem(rowIndex, byteItemsByRowIndex, this);
|
||||
addressLabel = new ByteAddressItem(rowIndex, byteItemsByRowIndex, this->settings.addressLabelType, this);
|
||||
this->addressItemsByRowIndex.emplace(rowIndex, addressLabel);
|
||||
|
||||
} else {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "ByteItem.hpp"
|
||||
#include "ByteAddressItem.hpp"
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidgetSettings.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
{
|
||||
@@ -17,7 +18,7 @@ namespace Bloom::Widgets
|
||||
public:
|
||||
static constexpr int WIDTH = 88;
|
||||
|
||||
ByteAddressContainer() = default;
|
||||
ByteAddressContainer(const HexViewerWidgetSettings& settings);
|
||||
|
||||
[[nodiscard]] QRectF boundingRect() const override {
|
||||
return QRectF(
|
||||
@@ -28,10 +29,11 @@ namespace Bloom::Widgets
|
||||
);
|
||||
}
|
||||
|
||||
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) override;
|
||||
void adjustAddressLabels(const std::map<std::size_t, std::vector<ByteItem*>>& byteItemsByRowIndex);
|
||||
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) override;
|
||||
|
||||
private:
|
||||
const HexViewerWidgetSettings& settings;
|
||||
std::map<std::size_t, ByteAddressItem*> addressItemsByRowIndex;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,10 +7,12 @@ namespace Bloom::Widgets
|
||||
ByteAddressItem::ByteAddressItem(
|
||||
std::size_t rowIndex,
|
||||
const std::map<std::size_t, std::vector<ByteItem*>>& byteItemsByRowIndex,
|
||||
const AddressType& addressType,
|
||||
QGraphicsItem* parent
|
||||
)
|
||||
: rowIndex(rowIndex)
|
||||
, byteItemsByRowIndex(byteItemsByRowIndex)
|
||||
, addressType(addressType)
|
||||
, QGraphicsItem(parent)
|
||||
{
|
||||
this->setCacheMode(
|
||||
@@ -36,7 +38,9 @@ namespace Bloom::Widgets
|
||||
painter->drawText(
|
||||
widgetRect,
|
||||
Qt::AlignLeft,
|
||||
this->byteItemsByRowIndex.at(this->rowIndex)[0]->relativeAddressHex
|
||||
this->addressType == AddressType::RELATIVE
|
||||
? this->byteItemsByRowIndex.at(this->rowIndex)[0]->relativeAddressHex
|
||||
: this->byteItemsByRowIndex.at(this->rowIndex)[0]->addressHex
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
#include "ByteItem.hpp"
|
||||
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/AddressType.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
{
|
||||
class ByteAddressItem: public QGraphicsItem
|
||||
@@ -19,6 +21,7 @@ namespace Bloom::Widgets
|
||||
explicit ByteAddressItem(
|
||||
std::size_t rowIndex,
|
||||
const std::map<std::size_t, std::vector<ByteItem*>>& byteItemsByRowIndex,
|
||||
const AddressType& addressType,
|
||||
QGraphicsItem* parent
|
||||
);
|
||||
|
||||
@@ -35,5 +38,6 @@ namespace Bloom::Widgets
|
||||
|
||||
private:
|
||||
const std::map<std::size_t, std::vector<ByteItem*>>& byteItemsByRowIndex;
|
||||
const AddressType& addressType;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Bloom::Widgets
|
||||
const TargetMemoryDescriptor& targetMemoryDescriptor,
|
||||
std::vector<FocusedMemoryRegion>& focusedMemoryRegions,
|
||||
std::vector<ExcludedMemoryRegion>& excludedMemoryRegions,
|
||||
const HexViewerWidgetSettings& settings,
|
||||
HexViewerWidgetSettings& settings,
|
||||
Label* hoveredAddressLabel
|
||||
) {
|
||||
auto* constructSceneTask = new ConstructHexViewerByteItemScene(
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Bloom::Widgets
|
||||
const Targets::TargetMemoryDescriptor& targetMemoryDescriptor,
|
||||
std::vector<FocusedMemoryRegion>& focusedMemoryRegions,
|
||||
std::vector<ExcludedMemoryRegion>& excludedMemoryRegions,
|
||||
const HexViewerWidgetSettings& settings,
|
||||
HexViewerWidgetSettings& settings,
|
||||
Label* hoveredAddressLabel
|
||||
);
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Bloom::Widgets
|
||||
const TargetMemoryDescriptor& targetMemoryDescriptor,
|
||||
std::vector<FocusedMemoryRegion>& focusedMemoryRegions,
|
||||
std::vector<ExcludedMemoryRegion>& excludedMemoryRegions,
|
||||
const HexViewerWidgetSettings& settings,
|
||||
HexViewerWidgetSettings& settings,
|
||||
Label* hoveredAddressLabel,
|
||||
QGraphicsView* parent
|
||||
)
|
||||
@@ -25,7 +25,7 @@ namespace Bloom::Widgets
|
||||
{
|
||||
this->setObjectName("byte-widget-container");
|
||||
|
||||
this->byteAddressContainer = new ByteAddressContainer();
|
||||
this->byteAddressContainer = new ByteAddressContainer(this->settings);
|
||||
this->addItem(this->byteAddressContainer);
|
||||
|
||||
// Construct ByteWidget objects
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Bloom::Widgets
|
||||
const Targets::TargetMemoryDescriptor& targetMemoryDescriptor,
|
||||
std::vector<FocusedMemoryRegion>& focusedMemoryRegions,
|
||||
std::vector<ExcludedMemoryRegion>& excludedMemoryRegions,
|
||||
const HexViewerWidgetSettings& settings,
|
||||
HexViewerWidgetSettings& settings,
|
||||
Label* hoveredAddressLabel,
|
||||
QGraphicsView* parent
|
||||
);
|
||||
@@ -91,7 +91,7 @@ namespace Bloom::Widgets
|
||||
Targets::TargetState targetState = Targets::TargetState::UNKNOWN;
|
||||
|
||||
const QMargins margins = QMargins(10, 10, 10, 10);
|
||||
const HexViewerWidgetSettings& settings;
|
||||
HexViewerWidgetSettings& settings;
|
||||
|
||||
Label* hoveredAddressLabel = nullptr;
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/AddressType.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
{
|
||||
struct HexViewerWidgetSettings
|
||||
@@ -9,5 +11,7 @@ namespace Bloom::Widgets
|
||||
bool highlightHoveredRowAndCol = true;
|
||||
bool displayAsciiValues = false;
|
||||
bool displayAnnotations = true;
|
||||
|
||||
AddressType addressLabelType = AddressType::ABSOLUTE;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user