This commit is contained in:
Nav
2023-05-01 14:05:44 +01:00
parent 9364e8f59f
commit 86a09b1a4a
3 changed files with 13 additions and 12 deletions

View File

@@ -42,6 +42,15 @@ namespace Bloom
for (const auto& snapshotFileEntry : snapshotFileEntries) { for (const auto& snapshotFileEntry : snapshotFileEntries) {
auto snapshotFile = QFile(snapshotFileEntry.absoluteFilePath()); 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 { try {
if (!snapshotFile.open(QIODevice::ReadOnly | QIODevice::Text)) { if (!snapshotFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
throw Exceptions::Exception("Failed to open snapshot file"); throw Exceptions::Exception("Failed to open snapshot file");
@@ -57,15 +66,6 @@ namespace Bloom
} }
snapshotFile.close(); 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; return snapshots;

View File

@@ -1,5 +1,6 @@
#include "MemorySnapshot.hpp" #include "MemorySnapshot.hpp"
#include <QUuid>
#include <QByteArray> #include <QByteArray>
#include <QJsonArray> #include <QJsonArray>
@@ -18,7 +19,8 @@ namespace Bloom
const std::vector<FocusedMemoryRegion>& focusedRegions, const std::vector<FocusedMemoryRegion>& focusedRegions,
const std::vector<ExcludedMemoryRegion>& excludedRegions const std::vector<ExcludedMemoryRegion>& excludedRegions
) )
: name(name) : id(QUuid::createUuid().toString(QUuid::StringFormat::WithoutBraces))
, name(name)
, description(description) , description(description)
, memoryType(memoryType) , memoryType(memoryType)
, data(data) , data(data)

View File

@@ -4,7 +4,6 @@
#include <QString> #include <QString>
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <QUuid>
#include <QJsonObject> #include <QJsonObject>
#include "src/Targets/TargetMemory.hpp" #include "src/Targets/TargetMemory.hpp"
@@ -18,7 +17,7 @@ namespace Bloom
struct MemorySnapshot struct MemorySnapshot
{ {
public: public:
QString id = QUuid::createUuid().toString(QUuid::StringFormat::WithoutBraces); QString id;
QString name; QString name;
QString description; QString description;
Targets::TargetMemoryType memoryType; Targets::TargetMemoryType memoryType;