X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fcopy_to_drive_job.cc;h=96f873cf61e75d99ccb659ff544cfb1485191463;hb=52d2940cb94ff59b66bce633189e8fb277a54f72;hp=0fb41f85642cb3a6fa26929376c4080f2ad51adb;hpb=9bdf75cc619740246c2c413d204f26e228e75bb1;p=dcpomatic.git diff --git a/src/lib/copy_to_drive_job.cc b/src/lib/copy_to_drive_job.cc index 0fb41f856..96f873cf6 100644 --- a/src/lib/copy_to_drive_job.cc +++ b/src/lib/copy_to_drive_job.cc @@ -37,7 +37,7 @@ using std::string; using std::cout; using std::min; -using boost::shared_ptr; +using std::shared_ptr; using boost::optional; using dcp::raw_convert; @@ -53,7 +53,7 @@ CopyToDriveJob::CopyToDriveJob (boost::filesystem::path dcp, Drive drive, Nanoms string CopyToDriveJob::name () const { - return String::compose (_("Copying %1 to %2"), _dcp.filename().string(), _drive.description()); + return String::compose (_("Copying %1\nto %2"), _dcp.filename().string(), _drive.description()); } string @@ -86,19 +86,24 @@ CopyToDriveJob::run () set_state (FINISHED_OK); return; } else if (*s == DISK_WRITER_ERROR) { - optional const m = _nanomsg.receive (500); - optional 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(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(*progress)); + } } else if (*s == DISK_WRITER_COPY_PROGRESS) { if (state == FORMAT) { sub (_("Copying DCP")); state = COPY; } - optional progress = _nanomsg.receive (500); + auto progress = _nanomsg.receive (500); if (progress) { set_progress (raw_convert(*progress)); } @@ -107,7 +112,7 @@ CopyToDriveJob::run () sub (_("Verifying copied files")); state = VERIFY; } - optional progress = _nanomsg.receive (500); + auto progress = _nanomsg.receive (500); if (progress) { set_progress (raw_convert(*progress)); }