Runs the wait for start dialog. Returns -1 if the user clicks stop while we are recording or if the post recording actions fail.
| 524 | /// Runs the wait for start dialog. Returns -1 if the user clicks stop while we are recording |
| 525 | /// or if the post recording actions fail. |
| 526 | int TimerRecordDialog::RunWaitDialog() |
| 527 | { |
| 528 | auto updateResult = ProgressResult::Success; |
| 529 | |
| 530 | const auto gAudioIO = AudioIO::Get(); |
| 531 | gAudioIO->DelayActions(true); |
| 532 | { |
| 533 | auto cleanup = finally([gAudioIO]{ gAudioIO->DelayActions(false); }); |
| 534 | |
| 535 | if (m_DateTime_Start > wxDateTime::UNow()) |
| 536 | updateResult = this->WaitForStart(); |
| 537 | |
| 538 | if (updateResult != ProgressResult::Success) { |
| 539 | // Don't proceed, but don't treat it as canceled recording. User just canceled waiting. |
| 540 | return POST_TIMER_RECORD_CANCEL_WAIT; |
| 541 | } else { |
| 542 | // Record for specified time. |
| 543 | ProjectAudioManager::Get( mProject ).OnRecord(false); |
| 544 | bool bIsRecording = true; |
| 545 | |
| 546 | auto sPostAction = Verbatim( |
| 547 | m_pTimerAfterCompleteChoiceCtrl->GetStringSelection() ); |
| 548 | |
| 549 | // Two column layout. |
| 550 | TimerProgressDialog::MessageTable columns{ |
| 551 | { |
| 552 | XO("Recording start:") , |
| 553 | XO("Duration:") , |
| 554 | XO("Recording end:") , |
| 555 | {} , |
| 556 | XO("Automatic Save enabled:") , |
| 557 | XO("Automatic Export enabled:") , |
| 558 | XO("Action after Timer Recording:") , |
| 559 | }, |
| 560 | { |
| 561 | GetDisplayDate(m_DateTime_Start) , |
| 562 | Verbatim( m_TimeSpan_Duration.Format() ), |
| 563 | GetDisplayDate(m_DateTime_End) , |
| 564 | {} , |
| 565 | (m_bAutoSaveEnabled ? XO("Yes") : XO("No")) , |
| 566 | (m_bAutoExportEnabled ? XO("Yes") : XO("No")) , |
| 567 | sPostAction , |
| 568 | } |
| 569 | }; |
| 570 | |
| 571 | TimerProgressDialog |
| 572 | progress(m_TimeSpan_Duration.GetMilliseconds().GetValue(), |
| 573 | XO("Audacity Timer Record Progress"), |
| 574 | columns, |
| 575 | pdlgHideCancelButton | pdlgConfirmStopCancel); |
| 576 | |
| 577 | // Make sure that start and end time are updated, so we always get the full |
| 578 | // duration, even if there's some delay getting here. |
| 579 | this->UpdateStart(); |
| 580 | |
| 581 | // Loop for progress display during recording. |
| 582 | while (bIsRecording && (updateResult == ProgressResult::Success)) { |
| 583 | updateResult = progress.UpdateProgress(); |
no test coverage detected