From 86a09b1a4a0d84cb8beb71fe509c70c7223b15e0 Mon Sep 17 00:00:00 2001 From: Nav Date: Mon, 1 May 2023 14:05:44 +0100 Subject: [PATCH] Tidying --- .../Tasks/RetrieveMemorySnapshots.cpp | 18 +++++++++--------- .../MemorySnapshot.cpp | 4 +++- .../MemorySnapshot.hpp | 3 +-- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/Insight/InsightWorker/Tasks/RetrieveMemorySnapshots.cpp b/src/Insight/InsightWorker/Tasks/RetrieveMemorySnapshots.cpp index 21c47097..2a4a1e5b 100644 --- a/src/Insight/InsightWorker/Tasks/RetrieveMemorySnapshots.cpp +++ b/src/Insight/InsightWorker/Tasks/RetrieveMemorySnapshots.cpp @@ -42,6 +42,15 @@ namespace Bloom for (const auto& snapshotFileEntry : snapshotFileEntries) { auto snapshotFile = QFile(snapshotFileEntry.absoluteFilePath()); + if (snapshots.size() >= MAX_SNAPSHOTS) { + Logger::warning( + "The total number of " + EnumToStringMappings::targetMemoryTypes.at(memoryType).toUpper().toStdString() + + " snapshots exceeds the hard limit of " + std::to_string(MAX_SNAPSHOTS) + + ". Only the most recent " + std::to_string(MAX_SNAPSHOTS) + " snapshots will be loaded." + ); + break; + } + try { if (!snapshotFile.open(QIODevice::ReadOnly | QIODevice::Text)) { throw Exceptions::Exception("Failed to open snapshot file"); @@ -57,15 +66,6 @@ namespace Bloom } snapshotFile.close(); - - if (snapshots.size() >= MAX_SNAPSHOTS) { - Logger::warning( - "The total number of " + EnumToStringMappings::targetMemoryTypes.at(memoryType).toUpper().toStdString() - + " snapshots exceeds the hard limit of " + std::to_string(MAX_SNAPSHOTS) - + ". Only the most recent " + std::to_string(MAX_SNAPSHOTS) + " snapshots will be loaded." - ); - break; - } } return snapshots; diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemorySnapshot.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemorySnapshot.cpp index dc62146b..9b343495 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemorySnapshot.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemorySnapshot.cpp @@ -1,5 +1,6 @@ #include "MemorySnapshot.hpp" +#include #include #include @@ -18,7 +19,8 @@ namespace Bloom const std::vector& focusedRegions, const std::vector& excludedRegions ) - : name(name) + : id(QUuid::createUuid().toString(QUuid::StringFormat::WithoutBraces)) + , name(name) , description(description) , memoryType(memoryType) , data(data) diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemorySnapshot.hpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemorySnapshot.hpp index a2e14061..87cde40e 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemorySnapshot.hpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemorySnapshot.hpp @@ -4,7 +4,6 @@ #include #include #include -#include #include #include "src/Targets/TargetMemory.hpp" @@ -18,7 +17,7 @@ namespace Bloom struct MemorySnapshot { public: - QString id = QUuid::createUuid().toString(QUuid::StringFormat::WithoutBraces); + QString id; QString name; QString description; Targets::TargetMemoryType memoryType;