MCPcopy Create free account
hub / github.com/audacity/audacity / OnOK

Method OnOK

src/TimerRecordDialog.cpp:415–492  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

413}
414
415void TimerRecordDialog::OnOK(wxCommandEvent& WXUNUSED(event))
416{
417 this->TransferDataFromWindow();
418 if (!m_TimeSpan_Duration.IsPositive())
419 {
420 AudacityMessageBox(
421 XO("Duration is zero. Nothing will be recorded."),
422 XO("Error in Duration"),
423 wxICON_EXCLAMATION | wxOK);
424 return;
425 }
426
427 // Validate that we have a Save and/or Export path setup if the appropriate check box is ticked
428 wxString sTemp = m_fnAutoSaveFile.GetFullPath();
429 if (m_pTimerAutoSaveCheckBoxCtrl->IsChecked()) {
430 if (!m_fnAutoSaveFile.IsOk() || m_fnAutoSaveFile.IsDir()) {
431 AudacityMessageBox(
432 XO("Automatic Save path is invalid."),
433 XO("Error in Automatic Save"),
434 wxICON_EXCLAMATION | wxOK);
435 return;
436 }
437 }
438 if (m_pTimerAutoExportCheckBoxCtrl->IsChecked()) {
439 if (!m_fnAutoExportFile.IsOk() || m_fnAutoExportFile.IsDir()) {
440 AudacityMessageBox(
441 XO("Automatic Export path is invalid."),
442 XO("Error in Automatic Export"),
443 wxICON_EXCLAMATION | wxOK);
444 return;
445 }
446 }
447
448 // MY: Estimate here if we have enough disk space to
449 // complete this Timer Recording.
450 // If we don't think there is enough space then ask the user
451 // if they want to continue.
452 // We don't stop the user from starting the recording
453 // as its possible that they plan to free up some
454 // space before the recording begins
455 auto &projectManager = ProjectManager::Get( mProject );
456
457 // How many minutes do we have left on the disc?
458 int iMinsLeft = projectManager.GetEstimatedRecordingMinsLeftOnDisk();
459
460 // How many minutes will this recording require?
461 int iMinsRecording = m_TimeSpan_Duration.GetMinutes();
462
463 // Do we have enough space?
464 if (iMinsRecording >= iMinsLeft) {
465
466 // Format the strings
467 auto sRemainingTime = projectManager.GetHoursMinsString(iMinsLeft);
468 auto sPlannedTime = projectManager.GetHoursMinsString(iMinsRecording);
469
470 // Create the message string
471 auto sMessage = XO(
472"You may not have enough free disk space to complete this Timer Recording, based on your current settings.\n\nDo you wish to continue?\n\nPlanned recording duration: %s\nRecording time remaining on disk: %s")

Callers

nothing calls this directly

Calls 11

AudacityMessageBoxFunction · 0.85
GetFunction · 0.85
IsCheckedMethod · 0.80
GetHoursMinsStringMethod · 0.80
IsOkMethod · 0.45
ShowModalMethod · 0.45
StopMethod · 0.45
WriteMethod · 0.45
FlushMethod · 0.45

Tested by

no test coverage detected