mirror of
https://github.com/stenzek/duckstation.git
synced 2024-11-23 05:49:43 +00:00
Qt: Make image verification cancellable
This commit is contained in:
parent
194e9bbbe5
commit
49b669c8be
@ -403,6 +403,7 @@ void GameSummaryWidget::onComputeHashClicked()
|
||||
}
|
||||
|
||||
QtModalProgressCallback progress_callback(this);
|
||||
progress_callback.SetCancellable(true);
|
||||
progress_callback.SetProgressRange(image->GetTrackCount());
|
||||
|
||||
std::vector<CDImageHasher::Hash> track_hashes;
|
||||
@ -419,6 +420,10 @@ void GameSummaryWidget::onComputeHashClicked()
|
||||
if (!CDImageHasher::GetTrackHash(image.get(), track, &hash, &progress_callback))
|
||||
{
|
||||
progress_callback.PopState();
|
||||
|
||||
if (progress_callback.IsCancelled())
|
||||
return;
|
||||
|
||||
calculate_hash_success = false;
|
||||
break;
|
||||
}
|
||||
|
@ -40,6 +40,9 @@ bool CDImageHasher::ReadIndex(CDImage* image, u8 track, u8 index, MD5Digest* dig
|
||||
if ((lba % update_interval) == 0)
|
||||
progress_callback->SetProgressValue(lba);
|
||||
|
||||
if (progress_callback->IsCancelled())
|
||||
return false;
|
||||
|
||||
if (!image->ReadRawSector(sector.data(), nullptr))
|
||||
{
|
||||
progress_callback->FormatModalError("Failed to read sector {} from image", image->GetPositionOnDisc());
|
||||
@ -112,6 +115,7 @@ bool CDImageHasher::GetImageHash(CDImage* image, Hash* out_hash,
|
||||
{
|
||||
MD5Digest digest;
|
||||
|
||||
progress_callback->SetCancellable(true);
|
||||
progress_callback->SetProgressRange(image->GetTrackCount());
|
||||
progress_callback->SetProgressValue(0);
|
||||
progress_callback->PushState();
|
||||
|
Loading…
Reference in New Issue
Block a user