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

Bug 1402, rewrite logic for the display of hours and minutes and ensure we use one routine for this.

This commit is contained in:
Mark Young
2016-09-21 13:18:56 +01:00
committed by James Crook
parent d7d0596df9
commit a4ae301a5b
4 changed files with 41 additions and 86 deletions

View File

@@ -356,43 +356,6 @@ void TimerRecordDialog::OnHelpButtonClick(wxCommandEvent& WXUNUSED(event))
HelpSystem::ShowHelpDialog(this, wxT("Timer_Record"), true);
}
wxString TimerRecordDialog::GetHoursMinsString(int iMinutes) {
wxString sFormatted = "";
wxString sHours = "";
wxString sMins = "";
if (iMinutes < 1) {
// Less than a minute...
sFormatted = _("Less than 1 minute");
return sFormatted;
}
// Calculate
int iHours = iMinutes / 60;
int iMins = iMinutes % 60;
// Format the hours
if (iHours == 1) {
sHours = _("1 hour and ");
}
else if (iHours > 1) {
sHours.Printf(_("%d hours and"), iHours);
}
// Format the minutes
if (iMins == 1) {
sMins = _("1 minute");
}
else if (iMins > 1) {
sMins.Printf(_("%d minutes"), iMins);
}
// Build the string
sFormatted.Printf("%s %s", sHours, sMins);
return sFormatted;
}
void TimerRecordDialog::OnOK(wxCommandEvent& WXUNUSED(event))
{
this->TransferDataFromWindow();
@@ -440,9 +403,9 @@ void TimerRecordDialog::OnOK(wxCommandEvent& WXUNUSED(event))
// Format the strings
wxString sRemainingTime = "";
sRemainingTime = GetHoursMinsString(iMinsLeft);
sRemainingTime = pProject->GetHoursMinsString(iMinsLeft);
wxString sPlannedTime = "";
sPlannedTime = GetHoursMinsString(iMinsRecording);
sPlannedTime = pProject->GetHoursMinsString(iMinsRecording);
// Create the message string
wxString sMessage = "";