mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-03 05:57:40 -05:00
impr: Cleanup task progress handling
This commit is contained in:
@@ -89,14 +89,12 @@ namespace hex::plugin::builtin {
|
||||
|
||||
auto provider = ImHexApi::Provider::get();
|
||||
|
||||
u64 count = 0;
|
||||
for (auto &[address, value] : patch->get()) {
|
||||
provider->write(address, &value, sizeof(value));
|
||||
count += 1;
|
||||
task.update(count);
|
||||
task.increment();
|
||||
}
|
||||
|
||||
provider->getUndoStack().groupOperations(count, "hex.builtin.undo_operation.patches");
|
||||
provider->getUndoStack().groupOperations(patch->get().size(), "hex.builtin.undo_operation.patches");
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -115,14 +113,12 @@ namespace hex::plugin::builtin {
|
||||
|
||||
auto provider = ImHexApi::Provider::get();
|
||||
|
||||
u64 count = 0;
|
||||
for (auto &[address, value] : patch->get()) {
|
||||
provider->write(address, &value, sizeof(value));
|
||||
count += 1;
|
||||
task.update(count);
|
||||
task.increment();
|
||||
}
|
||||
|
||||
provider->getUndoStack().groupOperations(count, "hex.builtin.undo_operation.patches");
|
||||
provider->getUndoStack().groupOperations(patch->get().size(), "hex.builtin.undo_operation.patches");
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -151,14 +147,12 @@ namespace hex::plugin::builtin {
|
||||
|
||||
task.setMaxValue(patches.size());
|
||||
|
||||
u64 count = 0;
|
||||
for (auto &[address, value] : patches) {
|
||||
provider->write(address, &value, sizeof(value));
|
||||
count += 1;
|
||||
task.update(count);
|
||||
task.increment();
|
||||
}
|
||||
|
||||
provider->getUndoStack().groupOperations(count, "hex.builtin.undo_operation.patches");
|
||||
provider->getUndoStack().groupOperations(patches.size(), "hex.builtin.undo_operation.patches");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -120,10 +120,8 @@ namespace hex::plugin::builtin {
|
||||
|
||||
task.setMaxValue(files.size());
|
||||
|
||||
u64 fileIndex = 0;
|
||||
for (const auto &file : files) {
|
||||
task.update(fileIndex);
|
||||
fileIndex++;
|
||||
task.increment();
|
||||
|
||||
wolv::io::File input(file, wolv::io::File::Mode::Read);
|
||||
if (!input.isValid()) {
|
||||
|
||||
Reference in New Issue
Block a user