diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-03-08 22:25:47 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-03-12 23:28:27 +0100 |
| commit | 7981eefcfebb563ccf5627f132abdfdef22e0c23 (patch) | |
| tree | 62c0302b8b4d65de4343877b8975fd3407a11bad /src/lib/copy_to_drive_job.cc | |
| parent | 3de828ef40c7b7c94c050bec4db57e6151787019 (diff) | |
Get progress during formatting.
Diffstat (limited to 'src/lib/copy_to_drive_job.cc')
| -rw-r--r-- | src/lib/copy_to_drive_job.cc | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/lib/copy_to_drive_job.cc b/src/lib/copy_to_drive_job.cc index eafa126b6..96f873cf6 100644 --- a/src/lib/copy_to_drive_job.cc +++ b/src/lib/copy_to_drive_job.cc @@ -86,19 +86,24 @@ CopyToDriveJob::run () set_state (FINISHED_OK); return; } else if (*s == DISK_WRITER_ERROR) { - optional<string> const m = _nanomsg.receive (500); - optional<string> const n = _nanomsg.receive (500); + auto const m = _nanomsg.receive (500); + auto const n = _nanomsg.receive (500); throw CopyError (m.get_value_or("Unknown"), raw_convert<int>(n.get_value_or("0"))); - } else if (*s == DISK_WRITER_FORMATTING) { - sub (_("Formatting drive")); - set_progress_unknown (); - state = FORMAT; + } else if (*s == DISK_WRITER_FORMAT_PROGRESS) { + if (state == SETUP) { + sub (_("Formatting drive")); + state = FORMAT; + } + auto progress = _nanomsg.receive (500); + if (progress) { + set_progress (raw_convert<float>(*progress)); + } } else if (*s == DISK_WRITER_COPY_PROGRESS) { if (state == FORMAT) { sub (_("Copying DCP")); state = COPY; } - optional<string> progress = _nanomsg.receive (500); + auto progress = _nanomsg.receive (500); if (progress) { set_progress (raw_convert<float>(*progress)); } @@ -107,7 +112,7 @@ CopyToDriveJob::run () sub (_("Verifying copied files")); state = VERIFY; } - optional<string> progress = _nanomsg.receive (500); + auto progress = _nanomsg.receive (500); if (progress) { set_progress (raw_convert<float>(*progress)); } |
