| 1122 | } |
| 1123 | |
| 1124 | ProgressResult TimerRecordDialog::PreActionDelay(int iActionIndex, TimerRecordCompletedActions eCompletedActions) |
| 1125 | { |
| 1126 | auto sAction = Verbatim( m_pTimerAfterCompleteChoiceCtrl |
| 1127 | ->GetString(iActionIndex) ); |
| 1128 | |
| 1129 | /* i18n-hint: %s is one of "Do nothing", "Exit Audacity", "Restart system", |
| 1130 | or "Shutdown system", and |
| 1131 | "in" means after a duration of time, shown below this string */ |
| 1132 | auto sCountdownLabel = XO("%s in:").Format( sAction ); |
| 1133 | |
| 1134 | // Two column layout. |
| 1135 | TimerProgressDialog::MessageTable columns{ |
| 1136 | { |
| 1137 | XO("Timer Recording completed.") , |
| 1138 | {} , |
| 1139 | XO("Recording Saved:") , |
| 1140 | XO("Recording Exported:") , |
| 1141 | XO("Action after Timer Recording:") , |
| 1142 | }, |
| 1143 | { |
| 1144 | {} , |
| 1145 | {} , |
| 1146 | ((eCompletedActions & TR_ACTION_SAVED) ? XO("Yes") : XO("No")) , |
| 1147 | ((eCompletedActions & TR_ACTION_EXPORTED) ? XO("Yes") : XO("No")) , |
| 1148 | sAction , |
| 1149 | }, |
| 1150 | }; |
| 1151 | |
| 1152 | |
| 1153 | wxDateTime dtNow = wxDateTime::UNow(); |
| 1154 | wxTimeSpan tsWait = wxTimeSpan(0, 1, 0, 0); |
| 1155 | wxDateTime dtActionTime = dtNow.Add(tsWait); |
| 1156 | |
| 1157 | TimerProgressDialog dlgAction(tsWait.GetMilliseconds().GetValue(), |
| 1158 | XO("Audacity Timer Record - Waiting"), |
| 1159 | columns, |
| 1160 | pdlgHideStopButton | pdlgHideElapsedTime, |
| 1161 | sCountdownLabel); |
| 1162 | |
| 1163 | auto iUpdateResult = ProgressResult::Success; |
| 1164 | bool bIsTime = false; |
| 1165 | while (iUpdateResult == ProgressResult::Success && !bIsTime) |
| 1166 | { |
| 1167 | iUpdateResult = dlgAction.UpdateProgress(); |
| 1168 | using namespace std::chrono; |
| 1169 | std::this_thread::sleep_for(kTimerInterval); |
| 1170 | bIsTime = (dtActionTime <= wxDateTime::UNow()); |
| 1171 | } |
| 1172 | return iUpdateResult; |
| 1173 | } |
| 1174 | |
| 1175 | // Register a menu item |
| 1176 |
nothing calls this directly
no test coverage detected