1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-01-20 07:46:30 +01:00

Use enum class ProgressResult, don't interconvert with int or bool

This commit is contained in:
Paul Licameli
2016-12-24 10:43:25 -05:00
parent 5036583549
commit aa0d55ac83
33 changed files with 216 additions and 218 deletions

View File

@@ -505,12 +505,12 @@ int TimerRecordDialog::RunWaitDialog()
{
AudacityProject* pProject = GetActiveProject();
int updateResult = eProgressSuccess;
auto updateResult = ProgressResult::Success;
if (m_DateTime_Start > wxDateTime::UNow())
updateResult = this->WaitForStart();
if (updateResult != eProgressSuccess) {
if (updateResult != ProgressResult::Success) {
// Don't proceed, but don't treat it as canceled recording. User just canceled waiting.
return POST_TIMER_RECORD_CANCEL_WAIT;
} else {
@@ -552,7 +552,7 @@ int TimerRecordDialog::RunWaitDialog()
this->OnTimer(dummyTimerEvent);
// Loop for progress display during recording.
while (bIsRecording && (updateResult == eProgressSuccess)) {
while (bIsRecording && (updateResult == ProgressResult::Success)) {
updateResult = progress.Update();
wxMilliSleep(kTimerInterval);
bIsRecording = (wxDateTime::UNow() <= m_DateTime_End); // Call UNow() again for extra accuracy...
@@ -564,10 +564,10 @@ int TimerRecordDialog::RunWaitDialog()
pProject->OnStop();
// Let the caller handle cancellation or failure from recording progress.
if (updateResult == eProgressCancelled || updateResult == eProgressFailed)
if (updateResult == ProgressResult::Cancelled || updateResult == ProgressResult::Failed)
return POST_TIMER_RECORD_CANCEL;
return ExecutePostRecordActions((updateResult == eProgressStopped));
return ExecutePostRecordActions((updateResult == ProgressResult::Stopped));
}
int TimerRecordDialog::ExecutePostRecordActions(bool bWasStopped) {
@@ -675,8 +675,8 @@ int TimerRecordDialog::ExecutePostRecordActions(bool bWasStopped) {
// 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, (TimerRecordCompletedActions)eActionFlags);
if (iDelayOutcome != eProgressSuccess) {
auto iDelayOutcome = PreActionDelay(iPostRecordAction, (TimerRecordCompletedActions)eActionFlags);
if (iDelayOutcome != ProgressResult::Success) {
// Cancel the action!
iPostRecordAction = POST_TIMER_RECORD_NOTHING;
// Set this to true to avoid any chance of the temp files being deleted
@@ -993,7 +993,7 @@ void TimerRecordDialog::UpdateEnd()
m_pTimeTextCtrl_End->SetValue(wxDateTime_to_AudacityTime(m_DateTime_End));
}
int TimerRecordDialog::WaitForStart()
ProgressResult 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());
@@ -1026,9 +1026,9 @@ int TimerRecordDialog::WaitForStart()
pdlgHideStopButton | pdlgConfirmStopCancel | pdlgHideElapsedTime,
_("Recording will commence in:"));
int updateResult = eProgressSuccess;
auto updateResult = ProgressResult::Success;
bool bIsRecording = false;
while (updateResult == eProgressSuccess && !bIsRecording)
while (updateResult == ProgressResult::Success && !bIsRecording)
{
updateResult = progress.Update();
wxMilliSleep(10);
@@ -1037,7 +1037,7 @@ int TimerRecordDialog::WaitForStart()
return updateResult;
}
int TimerRecordDialog::PreActionDelay(int iActionIndex, TimerRecordCompletedActions eCompletedActions)
ProgressResult TimerRecordDialog::PreActionDelay(int iActionIndex, TimerRecordCompletedActions eCompletedActions)
{
wxString sAction = m_pTimerAfterCompleteChoiceCtrl->GetString(iActionIndex);
wxString sCountdownLabel;
@@ -1068,9 +1068,9 @@ int TimerRecordDialog::PreActionDelay(int iActionIndex, TimerRecordCompletedActi
pdlgHideStopButton | pdlgHideElapsedTime,
sCountdownLabel);
int iUpdateResult = eProgressSuccess;
auto iUpdateResult = ProgressResult::Success;
bool bIsTime = false;
while (iUpdateResult == eProgressSuccess && !bIsTime)
while (iUpdateResult == ProgressResult::Success && !bIsTime)
{
iUpdateResult = dlgAction.Update();
wxMilliSleep(10);