mirror of
https://github.com/cookiengineer/audacity
synced 2026-01-20 07:46:30 +01:00
Introduce further enhancement of the Timer Recording process:
* Disk space warning if the recording potentially will not fit in disk space available. * ProgressDialog enhancements that allow the Stop/Cancel button to be confirmed and the elapsed time to be hidden. * Messages enhanced to clearly show the actions being taken.
This commit is contained in:
@@ -371,6 +371,33 @@ void TimerRecordDialog::OnOK(wxCommandEvent& WXUNUSED(event))
|
||||
}
|
||||
}
|
||||
|
||||
// MY: Estimate here if we have enough disk space to
|
||||
// complete this Timer Recording.
|
||||
// If we dont think there is enough space then ask the user
|
||||
// if they want to continue.
|
||||
// We don't stop the user from starting the recording
|
||||
// as its possible that they plan to free up some
|
||||
// space before the recording begins
|
||||
AudacityProject* pProject = GetActiveProject();
|
||||
|
||||
// How many minutes do we have left on the recording?
|
||||
int iMinsLeft = pProject->GetEstimatedRecordingMinsLeftOnDisk();
|
||||
|
||||
// How many minutes will this recording require?
|
||||
int iMinsRecording = m_TimeSpan_Duration.GetMinutes();
|
||||
|
||||
// Do we have enough space?
|
||||
if (iMinsRecording >= iMinsLeft) {
|
||||
wxMessageDialog dlgMessage(NULL,
|
||||
_("You may not have enough free disk space to complete this timer recording, based on your current settings.\n\nDo you wish to continue?"),
|
||||
_("Timer Recording Disk Space Warning"),
|
||||
wxYES_NO | wxNO_DEFAULT | wxICON_WARNING);
|
||||
if (dlgMessage.ShowModal() != wxID_YES) {
|
||||
// User decided not to continue - bail out!
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_timer.Stop(); // Don't need to keep updating m_DateTime_Start to prevent backdating.
|
||||
this->EndModal(wxID_OK);
|
||||
wxLongLong duration = m_TimeSpan_Duration.GetSeconds();
|
||||
@@ -465,17 +492,26 @@ int TimerRecordDialog::RunWaitDialog()
|
||||
pProject->OnRecord();
|
||||
bool bIsRecording = true;
|
||||
|
||||
wxString strMsg =
|
||||
_("Recording start") + (wxString)wxT(":\t\t")
|
||||
+ GetDisplayDate(m_DateTime_Start) + wxT("\n") + _("Recording end")
|
||||
+ wxT(":\t\t") + GetDisplayDate(m_DateTime_End) + wxT("\n")
|
||||
+ _("Duration") + wxT(":\t\t") + m_TimeSpan_Duration.Format();
|
||||
wxString sPostAction = m_pTimerAfterCompleteChoiceCtrl->GetString(m_pTimerAfterCompleteChoiceCtrl->GetSelection());
|
||||
wxString strMsg;
|
||||
strMsg.Printf(_("Recording start:\t\t\t%s\n") +
|
||||
_("Recording end:\t\t\t%s\n") +
|
||||
_("Duration:\t\t\t%s\n\n") +
|
||||
_("Automatic Save Enabled:\t\t%s\n") +
|
||||
_("Automatic Export Enabled:\t\t%s\n") +
|
||||
_("Post Timer Recording Action:\t%s"),
|
||||
GetDisplayDate(m_DateTime_Start).c_str(),
|
||||
m_TimeSpan_Duration.Format(),
|
||||
GetDisplayDate(m_DateTime_End).c_str(),
|
||||
(m_bAutoSaveEnabled ? _("Yes") : _("No")),
|
||||
(m_bAutoExportEnabled ? _("Yes") : _("No")),
|
||||
sPostAction);
|
||||
|
||||
TimerProgressDialog
|
||||
progress(m_TimeSpan_Duration.GetMilliseconds().GetValue(),
|
||||
_("Audacity Timer Record Progress"),
|
||||
strMsg,
|
||||
pdlgHideCancelButton);
|
||||
pdlgHideCancelButton | pdlgConfirmStopCancel);
|
||||
|
||||
// Make sure that start and end time are updated, so we always get the full
|
||||
// duration, even if there's some delay getting here.
|
||||
@@ -593,11 +629,20 @@ int TimerRecordDialog::ExecutePostRecordActions(bool bWasStopped) {
|
||||
// MY: Lets do some actions that only apply to Exit/Restart/Shutdown
|
||||
if (iPostRecordAction >= POST_TIMER_RECORD_CLOSE) {
|
||||
do {
|
||||
|
||||
// Set the flags as appropriate based on what we have done
|
||||
wxUint32 eActionFlags = TR_ACTION_NOTHING;
|
||||
if (m_bAutoSaveEnabled && bSaveOK) {
|
||||
eActionFlags |= TR_ACTION_SAVED;
|
||||
}
|
||||
if (m_bAutoExportEnabled && bExportOK) {
|
||||
eActionFlags |= TR_ACTION_EXPORTED;
|
||||
}
|
||||
|
||||
// Lets show a warning dialog telling the user what is about to happen.
|
||||
// If the user no longer wants to carry out this action then they can click
|
||||
// Cancel and we will do POST_TIMER_RECORD_NOTHING instead.
|
||||
int iDelayOutcome = PreActionDelay(iPostRecordAction, (m_bAutoSaveEnabled && bSaveOK),
|
||||
(m_bAutoExportEnabled && bExportOK));
|
||||
int iDelayOutcome = PreActionDelay(iPostRecordAction, (TimerRecordCompletedActions)eActionFlags);
|
||||
if (iDelayOutcome != eProgressSuccess) {
|
||||
// Cancel the action!
|
||||
iPostRecordAction = POST_TIMER_RECORD_NOTHING;
|
||||
@@ -912,18 +957,32 @@ void TimerRecordDialog::UpdateEnd()
|
||||
|
||||
int TimerRecordDialog::WaitForStart()
|
||||
{
|
||||
// MY: The Waiting For Start dialog now shows what actions will occur after recording has completed
|
||||
wxString sPostAction = m_pTimerAfterCompleteChoiceCtrl->GetString(m_pTimerAfterCompleteChoiceCtrl->GetSelection());
|
||||
|
||||
/* i18n-hint: Time specifications like "Sunday 28th October 2007 15:16:17 GMT"
|
||||
* but hopefully translated by wxwidgets will be inserted into this */
|
||||
wxString strMsg;
|
||||
/* i18n-hint: A time specification like "Sunday 28th October 2007 15:16:17 GMT"
|
||||
* but hopefully translated by wxwidgets will be inserted into this */
|
||||
strMsg.Printf(_("Waiting to start recording at %s.\n"),
|
||||
GetDisplayDate(m_DateTime_Start).c_str());
|
||||
strMsg.Printf(_("Waiting to start recording at:\t%s\n") +
|
||||
_("Recording duration:\t\t%s\n") +
|
||||
_("Scheduled to stop at:\t\t%s\n\n") +
|
||||
_("Automatic Save Enabled:\t\t%s\n") +
|
||||
_("Automatic Export Enabled:\t\t%s\n") +
|
||||
_("Post Timer Recording Action:\t%s"),
|
||||
GetDisplayDate(m_DateTime_Start).c_str(),
|
||||
m_TimeSpan_Duration.Format(),
|
||||
GetDisplayDate(m_DateTime_End).c_str(),
|
||||
(m_bAutoSaveEnabled ? _("Yes") : _("No")),
|
||||
(m_bAutoExportEnabled ? _("Yes") : _("No")),
|
||||
sPostAction);
|
||||
|
||||
wxDateTime startWait_DateTime = wxDateTime::UNow();
|
||||
wxTimeSpan waitDuration = m_DateTime_Start - startWait_DateTime;
|
||||
TimerProgressDialog
|
||||
progress(waitDuration.GetMilliseconds().GetValue(),
|
||||
_("Audacity Timer Record - Waiting for Start"),
|
||||
strMsg,
|
||||
pdlgHideStopButton);
|
||||
TimerProgressDialog progress(waitDuration.GetMilliseconds().GetValue(),
|
||||
_("Audacity Timer Record - Waiting for Start"),
|
||||
strMsg,
|
||||
pdlgHideStopButton | pdlgConfirmStopCancel | pdlgHideElapsedTime,
|
||||
_("Recording will commence in:"));
|
||||
|
||||
int updateResult = eProgressSuccess;
|
||||
bool bIsRecording = false;
|
||||
@@ -936,28 +995,21 @@ int TimerRecordDialog::WaitForStart()
|
||||
return updateResult;
|
||||
}
|
||||
|
||||
// TODO: Rather than two flags, an enum with the possibilities would be better.
|
||||
int TimerRecordDialog::PreActionDelay(int iActionIndex, bool bSaved, bool bExported)
|
||||
int TimerRecordDialog::PreActionDelay(int iActionIndex, TimerRecordCompletedActions eCompletedActions)
|
||||
{
|
||||
wxString sMessage;
|
||||
wxString sAction = m_pTimerAfterCompleteChoiceCtrl->GetString(iActionIndex);
|
||||
wxString sDone = "";
|
||||
if (bSaved && bExported) {
|
||||
sDone = _("Saved and Exported");
|
||||
}
|
||||
else if (bSaved) {
|
||||
sDone = _("Saved");
|
||||
}
|
||||
else if (bExported) {
|
||||
sDone = _("Exported");
|
||||
}
|
||||
// TODO: The wording will sound better if there are complete messages for
|
||||
// the will-occur-shortly messages.
|
||||
/* i18n-hint: The first %s will be a translation of 'Saved', 'Exported' or
|
||||
* 'Saved and Exported'. The second %s will be 'Exit Audacity'
|
||||
* 'Restart System' or 'Shutdown System' */
|
||||
sMessage.Printf(_("Timer Recording completed: Recording has been %s.\n\n'%s' will occur shortly...\n"),
|
||||
sDone, sAction);
|
||||
wxString sCountdownLabel;
|
||||
sCountdownLabel.Printf("%s in:", sAction);
|
||||
|
||||
// Build a clearer message...
|
||||
wxString sMessage;
|
||||
sMessage.Printf(_("Timer Recording Completed.\n\n") +
|
||||
_("Recording Saved:\t\t\t%s\n") +
|
||||
_("Recording Exported:\t\t%s\n") +
|
||||
_("Post Timer Recording Action:\t%s"),
|
||||
((eCompletedActions & TR_ACTION_SAVED) ? _("Yes") : _("No")),
|
||||
((eCompletedActions & TR_ACTION_EXPORTED) ? _("Yes") : _("No")),
|
||||
sAction);
|
||||
|
||||
wxDateTime dtNow = wxDateTime::UNow();
|
||||
wxTimeSpan tsWait = wxTimeSpan(0, 1, 0, 0);
|
||||
@@ -966,7 +1018,8 @@ int TimerRecordDialog::PreActionDelay(int iActionIndex, bool bSaved, bool bExpor
|
||||
TimerProgressDialog dlgAction(tsWait.GetMilliseconds().GetValue(),
|
||||
_("Audacity Timer Record - Waiting"),
|
||||
sMessage,
|
||||
pdlgHideStopButton);
|
||||
pdlgHideStopButton | pdlgHideElapsedTime,
|
||||
sCountdownLabel);
|
||||
|
||||
int iUpdateResult = eProgressSuccess;
|
||||
bool bIsTime = false;
|
||||
|
||||
Reference in New Issue
Block a user