Beispiel #1
0
ProgressResult TimerRecordDialog::PreActionDelay(int iActionIndex, TimerRecordCompletedActions eCompletedActions)
{
   wxString sAction = m_pTimerAfterCompleteChoiceCtrl->GetString(iActionIndex);
   wxString sCountdownLabel;
   sCountdownLabel.Printf("%s in:", sAction);

   // Two column layout.
   TimerProgressDialog::MessageTable columns(2);
   auto &column1 = columns[0];
   auto &column2 = columns[1];

   column1.push_back(_("Timer Recording completed."));
   column2.push_back( {} );

   column1.push_back( {} );
   column2.push_back( {} );

   column1.push_back(_("Recording Saved:"));
   column2.push_back(((eCompletedActions & TR_ACTION_SAVED) ? _("Yes") : _("No")));

   column1.push_back(_("Recording Exported:"));
   column2.push_back(((eCompletedActions & TR_ACTION_EXPORTED) ? _("Yes") : _("No")));

   column1.push_back(_("Action after Timer Recording:"));
   column2.push_back(sAction);

   wxDateTime dtNow = wxDateTime::UNow();
   wxTimeSpan tsWait = wxTimeSpan(0, 1, 0, 0);
   wxDateTime dtActionTime = dtNow.Add(tsWait);

   TimerProgressDialog dlgAction(tsWait.GetMilliseconds().GetValue(),
                          _("Audacity Timer Record - Waiting"),
                          columns,
                          pdlgHideStopButton | pdlgHideElapsedTime,
                          sCountdownLabel);

   auto iUpdateResult = ProgressResult::Success;
   bool bIsTime = false;
   while (iUpdateResult == ProgressResult::Success && !bIsTime)
   {
      iUpdateResult = dlgAction.UpdateProgress();
      wxMilliSleep(10);
      bIsTime = (dtActionTime <= wxDateTime::UNow());
   }
   return iUpdateResult;
}
int TimerRecordDialog::PreActionDelay(int iActionIndex, TimerRecordCompletedActions eCompletedActions)
{
   wxString sAction = m_pTimerAfterCompleteChoiceCtrl->GetString(iActionIndex);
   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);
   wxDateTime dtActionTime = dtNow.Add(tsWait);

   TimerProgressDialog dlgAction(tsWait.GetMilliseconds().GetValue(),
                          _("Audacity Timer Record - Waiting"),
                          sMessage,
                          pdlgHideStopButton | pdlgHideElapsedTime,
                          sCountdownLabel);

   int iUpdateResult = eProgressSuccess;
   bool bIsTime = false;
   while (iUpdateResult == eProgressSuccess && !bIsTime)
   {
      iUpdateResult = dlgAction.Update();
      wxMilliSleep(10);
      bIsTime = (dtActionTime <= wxDateTime::UNow());
   }
   return iUpdateResult;
}