Lots of tidying
This commit is contained in:
@@ -312,8 +312,9 @@ namespace Bloom::Widgets
|
||||
}
|
||||
|
||||
QPointF ByteItemGraphicsScene::getByteItemPositionByAddress(std::uint32_t address) {
|
||||
if (this->byteItemsByAddress.contains(address)) {
|
||||
return this->byteItemsByAddress.at(address)->pos();
|
||||
const auto byteItemIt = this->byteItemsByAddress.find(address);
|
||||
if (byteItemIt != this->byteItemsByAddress.end()) {
|
||||
return byteItemIt->second->pos();
|
||||
}
|
||||
|
||||
return QPointF();
|
||||
@@ -623,12 +624,13 @@ namespace Bloom::Widgets
|
||||
}
|
||||
|
||||
for (auto* annotationItem : this->annotationItems) {
|
||||
if (!this->byteItemsByAddress.contains(annotationItem->startAddress)) {
|
||||
const auto firstByteItemIt = this->byteItemsByAddress.find(annotationItem->startAddress);
|
||||
if (firstByteItemIt == this->byteItemsByAddress.end()) {
|
||||
annotationItem->hide();
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto firstByteItemPosition = this->byteItemsByAddress.at(annotationItem->startAddress)->pos();
|
||||
const auto firstByteItemPosition = firstByteItemIt->second->pos();
|
||||
|
||||
if (annotationItem->position == AnnotationItemPosition::TOP) {
|
||||
annotationItem->setPos(
|
||||
@@ -646,7 +648,6 @@ namespace Bloom::Widgets
|
||||
}
|
||||
|
||||
void ByteItemGraphicsScene::onTargetStateChanged(Targets::TargetState newState) {
|
||||
using Targets::TargetState;
|
||||
this->targetState = newState;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,22 +42,24 @@ namespace Bloom::Widgets
|
||||
this->endAddressInput->text().toUInt(nullptr, 16)
|
||||
);
|
||||
this->memoryRegion.addressRangeInputType = this->getSelectedAddressInputType();
|
||||
this->memoryRegion.addressRange =
|
||||
this->memoryRegion.addressRangeInputType == AddressType::RELATIVE ?
|
||||
this->convertRelativeToAbsoluteAddressRange(inputAddressRange) : inputAddressRange;
|
||||
this->memoryRegion.addressRange = this->memoryRegion.addressRangeInputType == AddressType::RELATIVE
|
||||
? this->convertRelativeToAbsoluteAddressRange(inputAddressRange)
|
||||
: inputAddressRange;
|
||||
|
||||
auto selectedDataTypeOptionName = this->dataTypeInput->currentData().toString();
|
||||
if (FocusedRegionItem::dataTypeOptionsByName.contains(selectedDataTypeOptionName)) {
|
||||
this->memoryRegion.dataType = FocusedRegionItem::dataTypeOptionsByName.at(
|
||||
selectedDataTypeOptionName
|
||||
).dataType;
|
||||
const auto selectedDataTypeIt = FocusedRegionItem::dataTypeOptionsByName.find(
|
||||
this->dataTypeInput->currentData().toString()
|
||||
);
|
||||
|
||||
if (selectedDataTypeIt != FocusedRegionItem::dataTypeOptionsByName.end()) {
|
||||
this->memoryRegion.dataType = selectedDataTypeIt->second.dataType;
|
||||
}
|
||||
|
||||
auto selectedEndiannessOptionName = this->endiannessInput->currentData().toString();
|
||||
if (FocusedRegionItem::endiannessOptionsByName.contains(selectedEndiannessOptionName)) {
|
||||
this->memoryRegion.endianness = FocusedRegionItem::endiannessOptionsByName.at(
|
||||
selectedEndiannessOptionName
|
||||
).endianness;
|
||||
const auto selectedEndiannessIt = FocusedRegionItem::endiannessOptionsByName.find(
|
||||
this->endiannessInput->currentData().toString()
|
||||
);
|
||||
|
||||
if (selectedEndiannessIt != FocusedRegionItem::endiannessOptionsByName.end()) {
|
||||
this->memoryRegion.endianness = selectedEndiannessIt->second.endianness;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -176,9 +176,12 @@ namespace Bloom::Widgets
|
||||
}
|
||||
|
||||
AddressType RegionItem::getSelectedAddressInputType() const {
|
||||
auto selectedAddressTypeOptionName = this->addressTypeInput->currentData().toString();
|
||||
if (RegionItem::addressRangeTypeOptionsByName.contains(selectedAddressTypeOptionName)) {
|
||||
return RegionItem::addressRangeTypeOptionsByName.at(selectedAddressTypeOptionName).addressType;
|
||||
const auto selectedAddressTypeIt = RegionItem::addressRangeTypeOptionsByName.find(
|
||||
this->addressTypeInput->currentData().toString()
|
||||
);
|
||||
|
||||
if (selectedAddressTypeIt != RegionItem::addressRangeTypeOptionsByName.end()) {
|
||||
return selectedAddressTypeIt->second.addressType;
|
||||
}
|
||||
|
||||
return AddressType::ABSOLUTE;
|
||||
|
||||
@@ -395,7 +395,8 @@ namespace Bloom::Widgets
|
||||
};
|
||||
|
||||
for (const auto& focusedRegion : this->settings.focusedMemoryRegions) {
|
||||
if (!this->targetMemoryDescriptor.addressRange.contains(focusedRegion.addressRange)
|
||||
if (
|
||||
!this->targetMemoryDescriptor.addressRange.contains(focusedRegion.addressRange)
|
||||
|| regionIntersects(focusedRegion)
|
||||
) {
|
||||
continue;
|
||||
@@ -405,7 +406,8 @@ namespace Bloom::Widgets
|
||||
}
|
||||
|
||||
for (const auto& excludedRegion : this->settings.excludedMemoryRegions) {
|
||||
if (!this->targetMemoryDescriptor.addressRange.contains(excludedRegion.addressRange)
|
||||
if (
|
||||
!this->targetMemoryDescriptor.addressRange.contains(excludedRegion.addressRange)
|
||||
|| regionIntersects(excludedRegion)
|
||||
) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user