| 198 | } |
| 199 | |
| 200 | void ReplayManager::CopyCaptureFromRemote(const rdcstr &remotepath, const rdcstr &localpath, |
| 201 | QWidget *window) |
| 202 | { |
| 203 | if(!m_Remote) |
| 204 | return; |
| 205 | |
| 206 | QAtomicInt copied = 0; |
| 207 | float progress = 0.0f; |
| 208 | |
| 209 | auto lambda = [this, localpath, remotepath, &progress, &copied](IReplayController *r) { |
| 210 | QMutexLocker autolock(&m_RemoteLock); |
| 211 | m_Remote->CopyCaptureFromRemote(remotepath, localpath, [&progress](float p) { progress = p; }); |
| 212 | copied = 1; |
| 213 | }; |
| 214 | |
| 215 | // we should never have the thread running at this point, but let's be safe. |
| 216 | if(IsRunning()) |
| 217 | { |
| 218 | AsyncInvoke(lambda); |
| 219 | } |
| 220 | else |
| 221 | { |
| 222 | LambdaThread *thread = new LambdaThread([&lambda]() { lambda(NULL); }); |
| 223 | thread->selfDelete(true); |
| 224 | thread->setName(lit("CopyCaptureFromRemote")); |
| 225 | thread->start(); |
| 226 | } |
| 227 | |
| 228 | ShowProgressDialog( |
| 229 | window, tr("Transferring..."), [&copied]() { return copied == 1; }, |
| 230 | [&progress]() { return progress; }); |
| 231 | } |
| 232 | |
| 233 | bool ReplayManager::IsRunning() |
| 234 | { |
no test coverage detected