1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-03 07:10:10 +01:00

Use TranslatableString in TimerRecordPathCtrl

This commit is contained in:
Paul Licameli
2019-12-27 22:44:44 -05:00
parent 956e0813c4
commit e0d57a0e6b
2 changed files with 23 additions and 13 deletions

View File

@@ -809,13 +809,14 @@ wxPrintf(wxT("%s\n"), dt.Format());
return Verbatim( dt.FormatDate() + wxT(" ") + dt.FormatTime() );
}
TimerRecordPathCtrl * TimerRecordDialog::NewPathControl(wxWindow *wParent, const int iID,
const wxString &sCaption, const wxString &sValue)
TimerRecordPathCtrl * TimerRecordDialog::NewPathControl(
wxWindow *wParent, const int iID,
const TranslatableString &sCaption, const TranslatableString &sValue)
{
TimerRecordPathCtrl * pTextCtrl;
wxASSERT(wParent); // to justify safenew
pTextCtrl = safenew TimerRecordPathCtrl(wParent, iID, sValue);
pTextCtrl->SetName(sCaption);
pTextCtrl->SetName(sCaption.Translation());
return pTextCtrl;
}
@@ -930,16 +931,17 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S)
bAutoSave);
S.StartMultiColumn(3, wxEXPAND);
{
wxString sInitialValue;
TranslatableString sInitialValue;
AudacityProject* pProject = GetActiveProject();
auto sSaveValue = pProject->GetFileName();
if (!sSaveValue.empty()) {
m_fnAutoSaveFile.Assign(sSaveValue);
sInitialValue = _("Current Project");
sInitialValue = XO("Current Project");
}
S.AddPrompt(XO("Save Project As:"));
m_pTimerSavePathTextCtrl = NewPathControl(
S.GetParent(), ID_AUTOSAVEPATH_TEXT, _("Save Project As:"), sInitialValue);
S.GetParent(), ID_AUTOSAVEPATH_TEXT,
XO("Save Project As:"), sInitialValue);
m_pTimerSavePathTextCtrl->SetEditable(false);
S.AddWindow(m_pTimerSavePathTextCtrl);
m_pTimerSavePathButtonCtrl = S.Id(ID_AUTOSAVEPATH_BUTTON).AddButton(XO("Select..."));
@@ -955,7 +957,8 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S)
{
S.AddPrompt(XO("Export Project As:"));
m_pTimerExportPathTextCtrl = NewPathControl(
S.GetParent(), ID_AUTOEXPORTPATH_TEXT, _("Export Project As:"), wxT(""));
S.GetParent(), ID_AUTOEXPORTPATH_TEXT,
XO("Export Project As:"), {});
m_pTimerExportPathTextCtrl->SetEditable(false);
S.AddWindow(m_pTimerExportPathTextCtrl);
m_pTimerExportPathButtonCtrl = S.Id(ID_AUTOEXPORTPATH_BUTTON).AddButton(XO("Select..."));

View File

@@ -44,11 +44,16 @@ class TimerRecordPathCtrl final : public wxTextCtrl
// We override AcceptsFocusFromKeyboard in order to add
// the text controls to the Tab Order.
public:
TimerRecordPathCtrl(wxWindow * parent, wxWindowID id, const wxString &value
= {}, const wxPoint &pos = wxDefaultPosition, const wxSize &
size = wxDefaultSize, long style = 0, const wxValidator & validator =
wxDefaultValidator, const wxString & name = wxTextCtrlNameStr)
:wxTextCtrl(parent, id, value, pos, size, style, validator, name) {};
TimerRecordPathCtrl(wxWindow * parent, wxWindowID id,
const TranslatableString &value = {},
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
long style = 0,
const wxValidator &validator = wxDefaultValidator,
const wxString &name = wxTextCtrlNameStr)
:wxTextCtrl(parent, id, value.Translation(), pos, size, style, validator, name)
{
};
~TimerRecordPathCtrl() {};
virtual bool AcceptsFocusFromKeyboard() const override {
@@ -101,7 +106,9 @@ private:
bool RemoveAllAutoSaveFiles();
// Add Path Controls to Form
TimerRecordPathCtrl *NewPathControl(wxWindow *wParent, const int iID, const wxString &sCaption, const wxString &sValue);
TimerRecordPathCtrl *NewPathControl(
wxWindow *wParent, const int iID,
const TranslatableString &sCaption, const TranslatableString &sValue);
int ExecutePostRecordActions(bool bWasStopped);
ProgressResult PreActionDelay(int iActionIndex, TimerRecordCompletedActions eCompletedActions);