1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-31 16:09:28 +02:00

Some more uses of TranslatableString

This commit is contained in:
Paul Licameli 2019-12-14 01:49:57 -05:00
commit 5c2aa7ce2e
46 changed files with 409 additions and 297 deletions

View File

@ -137,6 +137,9 @@ public:
// non-virtual convenience function
const wxString GetTranslatedName();
// non-virtual convenience function
const TranslatableString &GetUntranslatedName();
// Parameters, if defined. false means no defined parameters.
virtual bool DefineParams( ShuttleParams & WXUNUSED(S) ){ return false;};
};

View File

@ -67,7 +67,7 @@ public:
// Get a description of the file type this importer can import.
// Examples: "Ogg Vorbis", "MP3", "Uncompressed PCM"
virtual wxString GetPluginFormatDescription() = 0;
virtual TranslatableString GetPluginFormatDescription() = 0;
// Get a list of extensions this plugin expects to be able to
// import. If a filename matches any of these extensions,
@ -134,7 +134,7 @@ public:
// This is similar to GetImporterDescription, but if possible the
// importer will return a more specific description of the
// specific file that is open.
virtual wxString GetFileDescription() = 0;
virtual TranslatableString GetFileDescription() = 0;
// Return stream descriptions list
virtual void GetStreamInfo(wxArrayString & streamInfo) = 0;

View File

@ -346,7 +346,7 @@ void ApplyMacroDialog::OnApplyToFiles(wxCommandEvent & WXUNUSED(event))
for (const auto &format : l) {
const Format *f = &format;
wxString newfilter = f->formatName + wxT("|");
wxString newfilter = f->formatName.Translation() + wxT("|");
for (size_t i = 0; i < f->formatExtensions.size(); i++) {
if (!newfilter.Contains(wxT("*.") + f->formatExtensions[i] + wxT(";")))
newfilter += wxT("*.") + f->formatExtensions[i] + wxT(";");

View File

@ -170,9 +170,9 @@ static void RemoveDependencies(AudacityProject *project,
auto &dirManager = DirManager::Get( *project );
const auto &settings = ProjectSettings::Get( *project );
ProgressDialog progress
(_("Removing Dependencies"),
_("Copying audio data into project..."));
ProgressDialog progress(
XO("Removing Dependencies"),
XO("Copying audio data into project..."));
auto updateResult = ProgressResult::Success;
// Hash aliasedFiles based on their full paths and

View File

@ -202,12 +202,12 @@ int DirManager::RecursivelyEnumerateWithProgress(const FilePath &dirPath,
wxString filespec,
bool bFiles, bool bDirs,
int progress_count,
const wxChar* message)
const TranslatableString &message)
{
Maybe<ProgressDialog> progress{};
if (message)
progress.create( _("Progress"), message );
if (!message.empty())
progress.create( XO("Progress"), message );
int count = RecursivelyEnumerate(
dirPath, filePathArray, dirspec,filespec,
@ -284,7 +284,7 @@ int DirManager::RecursivelyRemoveEmptyDirs(const FilePath &dirPath,
}
void DirManager::RecursivelyRemove(const FilePaths& filePathArray, int count, int bias,
int flags, const wxChar* message)
int flags, const TranslatableString &message)
{
bool bFiles= (flags & kCleanFiles) != 0;
bool bDirs = (flags & kCleanDirs) != 0;
@ -292,8 +292,8 @@ void DirManager::RecursivelyRemove(const FilePaths& filePathArray, int count, in
Maybe<ProgressDialog> progress{};
if (message)
progress.create( _("Progress"), message );
if (!message.empty())
progress.create( XO("Progress"), message );
auto nn = filePathArray.size();
for ( size_t ii = 0; ii < nn; ++ii ) {
@ -451,7 +451,7 @@ DirManager::~DirManager()
CleanTempDir();
//::wxRmdir(temp);
} else if( projFull.empty() && !mytemp.empty()) {
CleanDir(mytemp, wxEmptyString, ".DS_Store", _("Cleaning project temporary files"), kCleanTopDirToo | kCleanDirsOnlyIfEmpty );
CleanDir(mytemp, wxEmptyString, ".DS_Store", XO("Cleaning project temporary files"), kCleanTopDirToo | kCleanDirsOnlyIfEmpty );
}
}
@ -464,7 +464,7 @@ void DirManager::CleanTempDir()
{
// with default flags (none) this does not clean the top directory, and may remove non-empty
// directories.
CleanDir(globaltemp, wxT("project*"), wxEmptyString, _("Cleaning up temporary files"));
CleanDir(globaltemp, wxT("project*"), wxEmptyString, XO("Cleaning up temporary files"));
}
// static
@ -472,7 +472,7 @@ void DirManager::CleanDir(
const FilePath &path,
const wxString &dirSpec,
const wxString &fileSpec,
const wxString &msg,
const TranslatableString &msg,
int flags)
{
if (dontDeleteTempFiles)
@ -539,7 +539,7 @@ namespace {
fullPath,
wxEmptyString,
wxEmptyString,
_("Cleaning up after failed save"),
XO("Cleaning up after failed save"),
kCleanTopDirToo);
}
@ -687,8 +687,8 @@ DirManager::ProjectSetter::Impl::Impl(
{
/* i18n-hint: This title appears on a dialog that indicates the progress
in doing something.*/
ProgressDialog progress(_("Progress"),
_("Saving project data files"));
ProgressDialog progress(XO("Progress"),
XO("Saving project data files"));
int total = dirManager.mBlockFileHash.size();
@ -790,7 +790,7 @@ void DirManager::ProjectSetter::Impl::Commit()
wxEmptyString, // EmptyString => ALL directories.
// If the next line were wxEmptyString, ALL files would be removed.
".DS_Store", // Other project files should already have been removed.
_("Cleaning up cache directories"),
XO("Cleaning up cache directories"),
kCleanTopDirToo);
//This destroys the empty dirs of the OD block files, which are yet to come.
@ -1732,7 +1732,7 @@ void DirManager::RemoveOrphanBlockfiles()
wxEmptyString, // All files
true, false,
mBlockFileHash.size(), // rough guess of how many BlockFiles will be found/processed, for progress
_("Inspecting project file data"));
XO("Inspecting project file data"));
FilePaths orphanFilePathArray;
this->FindOrphanBlockFiles(
@ -1818,8 +1818,8 @@ void DirManager::WriteCacheToDisk()
if (numNeed == 0)
return;
ProgressDialog progress(_("Saving recorded audio"),
_("Saving recorded audio to disk"));
ProgressDialog progress(XO("Saving recorded audio"),
XO("Saving recorded audio to disk"));
iter = mBlockFileHash.begin();
int current = 0;

View File

@ -70,7 +70,7 @@ class PROFILE_DLL_API DirManager final
wxString filespec,
bool bFiles, bool bDirs,
int progress_count,
const wxChar* message);
const TranslatableString &message);
static int RecursivelyCountSubdirs( const FilePath &dirPath );
@ -79,7 +79,7 @@ class PROFILE_DLL_API DirManager final
ProgressDialog* pProgress = nullptr);
static void RecursivelyRemove(const FilePaths& filePathArray, int count, int bias,
int flags, const wxChar* message = nullptr);
int flags, const TranslatableString &message = {});
// Type of a function that builds a block file, using attributes from XML
using BlockFileDeserializer =
@ -193,7 +193,7 @@ class PROFILE_DLL_API DirManager final
const FilePath &path,
const wxString &dirSpec,
const wxString &fileSpec,
const wxString &msg,
const TranslatableString &msg,
int flags = 0);
void FindMissingAliasFiles(

View File

@ -156,8 +156,8 @@ void MixAndRender(TrackList *tracks, TrackFactory *trackFactory,
auto updateResult = ProgressResult::Success;
{
ProgressDialog progress(_("Mix and Render"),
_("Mixing and rendering tracks"));
ProgressDialog progress(XO("Mix and Render"),
XO("Mixing and rendering tracks"));
while (updateResult == ProgressResult::Success) {
auto blockLen = mixer.Process(maxBlockLen);

View File

@ -982,15 +982,14 @@ void PluginRegistrationDialog::OnOK(wxCommandEvent & WXUNUSED(evt))
mLongestPath + wxT("\n") +
mLongestPath + wxT("\n");
wxString msg;
msg.Printf(_("Enabling effects or commands:\n\n%s"), last3);
auto msg = XO("Enabling effects or commands:\n\n%s").Format( last3 );
// Make sure the progress dialog is deleted before we call EndModal() or
// we will leave the project window in an unusable state on OSX.
// See bug #1192.
{
ProgressDialog progress(GetTitle(), msg, pdlgHideStopButton);
ProgressDialog progress(
TranslatableString{ GetTitle() }, msg, pdlgHideStopButton);
progress.CenterOnParent();
int i = 0;
@ -1002,7 +1001,8 @@ void PluginRegistrationDialog::OnOK(wxCommandEvent & WXUNUSED(evt))
if (item.state == STATE_Enabled && item.plugs[0]->GetPluginType() == PluginTypeStub)
{
last3 = last3.AfterFirst(wxT('\n')) + item.path + wxT("\n");
auto status = progress.Update(++i, enableCount, wxString::Format(_("Enabling effect or command:\n\n%s"), last3));
auto status = progress.Update(++i, enableCount,
XO("Enabling effect or command:\n\n%s").Format( last3 ));
if (status == ProgressResult::Cancelled)
{
break;
@ -3218,3 +3218,8 @@ const wxString ComponentInterface::GetTranslatedName()
{
return GetSymbol().Translation();
}
const TranslatableString &ComponentInterface::GetUntranslatedName()
{
return GetSymbol().Msgid();
}

View File

@ -111,11 +111,11 @@ public:
// Importer plugins only
const wxString & GetImporterIdentifier() const;
const wxString & GetImporterFilterDescription() const;
const TranslatableString & GetImporterFilterDescription() const;
const FileExtensions & GetImporterExtensions() const;
void SetImporterIdentifier(const wxString & identifier);
void SetImporterFilterDescription(const wxString & filterDesc);
void SetImporterFilterDescription(const TranslatableString & filterDesc);
void SetImporterExtensions(FileExtensions extensions);
private:

View File

@ -77,7 +77,7 @@ int ProjectFSCK(
wxEmptyString, // All files
true, false,
dm.NumBlockFiles(), // rough guess of how many BlockFiles will be found/processed, for progress
_("Inspecting project file data"));
XO("Inspecting project file data"));
//
// MISSING ALIASED AUDIO FILES
@ -360,9 +360,9 @@ other projects. \
if ((nResult != FSCKstatus_CLOSE_REQ) && !ODManager::HasLoadedODFlag())
{
// Remove any empty directories.
ProgressDialog pProgress
(_("Progress"),
_("Cleaning up unused directories in project data"));
ProgressDialog pProgress(
XO("Progress"),
XO("Cleaning up unused directories in project data"));
// nDirCount is for updating pProgress. +1 because we may DELETE dirPath.
int nDirCount = DirManager::RecursivelyCountSubdirs(dirPath) + 1;
DirManager::RecursivelyRemoveEmptyDirs(dirPath, nDirCount, &pProgress);

View File

@ -986,7 +986,7 @@ wxArrayString ProjectFileManager::ShowOpenDialog(const wxString &extraformat, co
/* this loop runs once per supported _format_ */
const Format *f = &format;
wxString newfilter = f->formatName + wxT("|");
wxString newfilter = f->formatName.Translation() + wxT("|");
// bung format name into string plus | separator
for (size_t i = 0; i < f->formatExtensions.size(); i++) {
/* this loop runs once per valid _file extension_ for file containing
@ -1661,7 +1661,7 @@ bool ProjectFileManager::Import(
auto &dirManager = DirManager::Get( project );
auto oldTags = Tags::Get( project ).shared_from_this();
TrackHolders newTracks;
wxString errorMessage;
TranslatableString errorMessage;
{
// Backup Tags, before the import. Be prepared to roll back changes.
@ -1683,7 +1683,7 @@ bool ProjectFileManager::Import(
// Error message derived from Importer::Import
// Additional help via a Help button links to the manual.
ShowErrorDialog(&GetProjectFrame( project ), _("Error Importing"),
errorMessage, wxT("Importing_Audio"));
errorMessage.Translation(), wxT("Importing_Audio"));
}
if (!success)
return false;

View File

@ -546,33 +546,34 @@ int TimerRecordDialog::RunWaitDialog()
ProjectAudioManager::Get( *pProject ).OnRecord(false);
bool bIsRecording = true;
wxString sPostAction = m_pTimerAfterCompleteChoiceCtrl->GetString(m_pTimerAfterCompleteChoiceCtrl->GetSelection());
auto sPostAction = TranslatableString{
m_pTimerAfterCompleteChoiceCtrl->GetStringSelection() };
// Two column layout.
TimerProgressDialog::MessageTable columns{
{
_("Recording start:") ,
_("Duration:") ,
_("Recording end:") ,
XO("Recording start:") ,
XO("Duration:") ,
XO("Recording end:") ,
{} ,
_("Automatic Save enabled:") ,
_("Automatic Export enabled:") ,
_("Action after Timer Recording:") ,
XO("Automatic Save enabled:") ,
XO("Automatic Export enabled:") ,
XO("Action after Timer Recording:") ,
},
{
GetDisplayDate(m_DateTime_Start) ,
m_TimeSpan_Duration.Format() ,
TranslatableString{ m_TimeSpan_Duration.Format() },
GetDisplayDate(m_DateTime_End) ,
{} ,
(m_bAutoSaveEnabled ? _("Yes") : _("No")) ,
(m_bAutoExportEnabled ? _("Yes") : _("No")) ,
(m_bAutoSaveEnabled ? XO("Yes") : XO("No")) ,
(m_bAutoExportEnabled ? XO("Yes") : XO("No")) ,
sPostAction ,
}
};
TimerProgressDialog
progress(m_TimeSpan_Duration.GetMilliseconds().GetValue(),
_("Audacity Timer Record Progress"),
XO("Audacity Timer Record Progress"),
columns,
pdlgHideCancelButton | pdlgConfirmStopCancel);
@ -743,7 +744,7 @@ int TimerRecordDialog::ExecutePostRecordActions(bool bWasStopped) {
return iPostRecordAction;
}
wxString TimerRecordDialog::GetDisplayDate( wxDateTime & dt )
TranslatableString TimerRecordDialog::GetDisplayDate( wxDateTime & dt )
{
#if defined(__WXMSW__)
// On Windows, wxWidgets uses the system date control and it displays the
@ -789,7 +790,7 @@ wxString TimerRecordDialog::GetDisplayDate( wxDateTime & dt )
// Use default formatting
wxPrintf(wxT("%s\n"), dt.Format());
return dt.FormatDate() + wxT(" ") + dt.FormatTime();
return TranslatableString{ dt.FormatDate() + wxT(" ") + dt.FormatTime() };
}
TimerRecordPathCtrl * TimerRecordDialog::NewPathControl(wxWindow *wParent, const int iID,
@ -1057,26 +1058,27 @@ void TimerRecordDialog::UpdateEnd()
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());
auto sPostAction = TranslatableString{
m_pTimerAfterCompleteChoiceCtrl->GetStringSelection() };
// Two column layout.
TimerProgressDialog::MessageTable columns{
{
_("Waiting to start recording at:") ,
_("Recording duration:") ,
_("Scheduled to stop at:") ,
XO("Waiting to start recording at:") ,
XO("Recording duration:") ,
XO("Scheduled to stop at:") ,
{} ,
_("Automatic Save enabled:") ,
_("Automatic Export enabled:") ,
_("Action after Timer Recording:") ,
XO("Automatic Save enabled:") ,
XO("Automatic Export enabled:") ,
XO("Action after Timer Recording:") ,
},
{
GetDisplayDate(m_DateTime_Start) ,
m_TimeSpan_Duration.Format() ,
GetDisplayDate(m_DateTime_Start),
TranslatableString{ m_TimeSpan_Duration.Format() },
GetDisplayDate(m_DateTime_End) ,
{} ,
(m_bAutoSaveEnabled ? _("Yes") : _("No")) ,
(m_bAutoExportEnabled ? _("Yes") : _("No")) ,
(m_bAutoSaveEnabled ? XO("Yes") : XO("No")) ,
(m_bAutoExportEnabled ? XO("Yes") : XO("No")) ,
sPostAction ,
},
};
@ -1084,12 +1086,12 @@ ProgressResult TimerRecordDialog::WaitForStart()
wxDateTime startWait_DateTime = wxDateTime::UNow();
wxTimeSpan waitDuration = m_DateTime_Start - startWait_DateTime;
TimerProgressDialog progress(waitDuration.GetMilliseconds().GetValue(),
_("Audacity Timer Record - Waiting for Start"),
XO("Audacity Timer Record - Waiting for Start"),
columns,
pdlgHideStopButton | pdlgConfirmStopCancel | pdlgHideElapsedTime,
/* i18n-hint: "in" means after a duration of time,
which is shown below this string */
_("Recording will commence in:"));
XO("Recording will commence in:"));
auto updateResult = ProgressResult::Success;
bool bIsRecording = false;
@ -1104,27 +1106,28 @@ ProgressResult TimerRecordDialog::WaitForStart()
ProgressResult TimerRecordDialog::PreActionDelay(int iActionIndex, TimerRecordCompletedActions eCompletedActions)
{
wxString sAction = m_pTimerAfterCompleteChoiceCtrl->GetString(iActionIndex);
wxString sCountdownLabel;
auto sAction = TranslatableString{ m_pTimerAfterCompleteChoiceCtrl
->GetString(iActionIndex) };
/* i18n-hint: %s is one of "Do nothing", "Exit Audacity", "Restart system",
or "Shutdown system", and
"in" means after a duration of time, shown below this string */
sCountdownLabel.Printf(_("%s in:"), sAction);
auto sCountdownLabel = XO("%s in:").Format( sAction );
// Two column layout.
TimerProgressDialog::MessageTable columns{
{
_("Timer Recording completed.") ,
XO("Timer Recording completed.") ,
{} ,
_("Recording Saved:") ,
_("Recording Exported:") ,
_("Action after Timer Recording:") ,
XO("Recording Saved:") ,
XO("Recording Exported:") ,
XO("Action after Timer Recording:") ,
},
{
{} ,
{} ,
((eCompletedActions & TR_ACTION_SAVED) ? _("Yes") : _("No")) ,
((eCompletedActions & TR_ACTION_EXPORTED) ? _("Yes") : _("No")) ,
((eCompletedActions & TR_ACTION_SAVED) ? XO("Yes") : XO("No")) ,
((eCompletedActions & TR_ACTION_EXPORTED) ? XO("Yes") : XO("No")) ,
sAction ,
},
};
@ -1135,7 +1138,7 @@ ProgressResult TimerRecordDialog::PreActionDelay(int iActionIndex, TimerRecordCo
wxDateTime dtActionTime = dtNow.Add(tsWait);
TimerProgressDialog dlgAction(tsWait.GetMilliseconds().GetValue(),
_("Audacity Timer Record - Waiting"),
XO("Audacity Timer Record - Waiting"),
columns,
pdlgHideStopButton | pdlgHideElapsedTime,
sCountdownLabel);

View File

@ -78,7 +78,7 @@ private:
void OnOK(wxCommandEvent& event);
void OnHelpButtonClick(wxCommandEvent& event);
wxString GetDisplayDate(wxDateTime & dt);
TranslatableString GetDisplayDate(wxDateTime & dt);
void PopulateOrExchange(ShuttleGui& S);
bool TransferDataFromWindow() override;

View File

@ -208,10 +208,10 @@ bool AudacityCommand::DoAudacityCommand(wxWindow *parent,
bool skipFlag = CheckWhetherSkipAudacityCommand();
if (skipFlag == false)
{
auto name = GetTranslatedName();
auto name = GetUntranslatedName();
ProgressDialog progress{
name,
wxString::Format(_("Applying %s..."), name),
XO("Applying %s...").Format( name ),
pdlgHideStopButton
};
auto vr = valueRestorer( mProgress, &progress );

View File

@ -1267,10 +1267,10 @@ bool Effect::DoEffect(wxWindow *parent,
bool skipFlag = CheckWhetherSkipEffect();
if (skipFlag == false)
{
auto name = GetTranslatedName();
auto name = GetUntranslatedName();
ProgressDialog progress{
name,
wxString::Format(_("Applying %s..."), name),
XO("Applying %s...").Format( name ),
pdlgHideStopButton
};
auto vr = valueRestorer( mProgress, &progress );
@ -1996,7 +1996,7 @@ void Effect::IncludeNotSelectedPreviewTracks(bool includeNotSelected)
mPreviewWithNotSelected = includeNotSelected;
}
bool Effect::TotalProgress(double frac, const wxString &msg)
bool Effect::TotalProgress(double frac, const TranslatableString &msg)
{
auto updateResult = (mProgress ?
mProgress->Update(frac, msg) :
@ -2004,7 +2004,7 @@ bool Effect::TotalProgress(double frac, const wxString &msg)
return (updateResult != ProgressResult::Success);
}
bool Effect::TrackProgress(int whichTrack, double frac, const wxString &msg)
bool Effect::TrackProgress(int whichTrack, double frac, const TranslatableString &msg)
{
auto updateResult = (mProgress ?
mProgress->Update(whichTrack + frac, (double) mNumTracks, msg) :
@ -2012,7 +2012,7 @@ bool Effect::TrackProgress(int whichTrack, double frac, const wxString &msg)
return (updateResult != ProgressResult::Success);
}
bool Effect::TrackGroupProgress(int whichGroup, double frac, const wxString &msg)
bool Effect::TrackGroupProgress(int whichGroup, double frac, const TranslatableString &msg)
{
auto updateResult = (mProgress ?
mProgress->Update(whichGroup + frac, (double) mNumGroups, msg) :
@ -2398,8 +2398,8 @@ void Effect::Preview(bool dryOnly)
// Apply effect
if (!dryOnly) {
ProgressDialog progress{
GetTranslatedName(),
_("Preparing preview"),
GetUntranslatedName(),
XO("Preparing preview"),
pdlgHideCancelButton
}; // Have only "Stop" button.
auto vr = valueRestorer( mProgress, &progress );
@ -2429,7 +2429,7 @@ void Effect::Preview(bool dryOnly)
// The progress dialog blocks these events.
{
ProgressDialog progress
(GetTranslatedName(), _("Previewing"), pdlgHideCancelButton);
(GetUntranslatedName(), XO("Previewing"), pdlgHideCancelButton);
while (gAudioIO->IsStreamActive(token) && previewing == ProgressResult::Success) {
::wxMilliSleep(100);

View File

@ -335,15 +335,15 @@ protected:
// is okay, but don't try to undo).
// Pass a fraction between 0.0 and 1.0
bool TotalProgress(double frac, const wxString & = {});
bool TotalProgress(double frac, const TranslatableString & = {});
// Pass a fraction between 0.0 and 1.0, for the current track
// (when doing one track at a time)
bool TrackProgress(int whichTrack, double frac, const wxString & = {});
bool TrackProgress(int whichTrack, double frac, const TranslatableString & = {});
// Pass a fraction between 0.0 and 1.0, for the current track group
// (when doing stereo groups at a time)
bool TrackGroupProgress(int whichGroup, double frac, const wxString & = {});
bool TrackGroupProgress(int whichGroup, double frac, const TranslatableString & = {});
int GetNumWaveTracks() { return mNumTracks; }
int GetNumWaveGroups() { return mNumGroups; }

View File

@ -174,7 +174,7 @@ bool EffectLoudness::Process()
// Iterate over each track
this->CopyInputTracks(); // Set up mOutputTracks.
bool bGoodResult = true;
wxString topMsg = _("Normalizing Loudness...\n");
auto topMsg = XO("Normalizing Loudness...\n");
AllocBuffers();
mProgressVal = 0;
@ -200,7 +200,7 @@ bool EffectLoudness::Process()
mSteps = 2;
mProgressMsg =
topMsg + wxString::Format(_("Analyzing: %s"), trackName);
topMsg + XO("Analyzing: %s").Format( trackName );
auto range = mStereoInd
? TrackList::SingletonRange(track)
@ -258,7 +258,7 @@ bool EffectLoudness::Process()
mMult = sqrt(mMult);
}
mProgressMsg = topMsg + wxString::Format(_("Processing: %s"), trackName);
mProgressMsg = topMsg + XO("Processing: %s").Format( trackName );
if(!ProcessOne(range, false))
{
// Processing failed -> abort
@ -394,7 +394,7 @@ bool EffectLoudness::GetTrackRMS(WaveTrack* track, float& rms)
while (ProjectFileManager::GetODFlags(*track)) {
// update the gui
if (ProgressResult::Cancelled == mProgress->Update(
0, _("Waiting for waveform to finish computing...")) )
0, XO("Waiting for waveform to finish computing...")) )
return false;
wxMilliSleep(100);
}

View File

@ -87,7 +87,7 @@ private:
double mCurT1;
double mProgressVal;
int mSteps;
wxString mProgressMsg;
TranslatableString mProgressMsg;
double mTrackLen;
double mCurRate;

View File

@ -181,15 +181,15 @@ bool EffectNormalize::Process()
this->CopyInputTracks(); // Set up mOutputTracks.
bool bGoodResult = true;
double progress = 0;
wxString topMsg;
TranslatableString topMsg;
if(mDC && mGain)
topMsg = _("Removing DC offset and Normalizing...\n");
topMsg = XO("Removing DC offset and Normalizing...\n");
else if(mDC && !mGain)
topMsg = _("Removing DC offset...\n");
topMsg = XO("Removing DC offset...\n");
else if(!mDC && mGain)
topMsg = _("Normalizing without removing DC offset...\n");
topMsg = XO("Normalizing without removing DC offset...\n");
else if(!mDC && !mGain)
topMsg = _("Not doing anything...\n"); // shouldn't get here
topMsg = XO("Not doing anything...\n"); // shouldn't get here
for ( auto track : mOutputTracks->Selected< WaveTrack >()
+ ( mStereoInd ? &Track::Any : &Track::IsLeader ) ) {
@ -216,15 +216,13 @@ bool EffectNormalize::Process()
extent = std::numeric_limits<float>::lowest();
std::vector<float> offsets;
wxString msg;
if (range.size() == 1)
auto msg = (range.size() == 1)
// mono or 'stereo tracks independently'
msg = topMsg +
wxString::Format( _("Analyzing: %s"), trackName );
else
msg = topMsg +
? topMsg +
XO("Analyzing: %s").Format( trackName )
: topMsg +
// TODO: more-than-two-channels-message
wxString::Format( _("Analyzing first track of stereo pair: %s"), trackName);
XO("Analyzing first track of stereo pair: %s").Format( trackName );
// Analysis loop over channels collects offsets and extent
for (auto channel : range) {
@ -238,7 +236,7 @@ bool EffectNormalize::Process()
offsets.push_back(offset);
// TODO: more-than-two-channels-message
msg = topMsg +
wxString::Format( _("Analyzing second track of stereo pair: %s"), trackName );
XO("Analyzing second track of stereo pair: %s").Format( trackName );
}
// Compute the multiplier using extent
@ -252,17 +250,17 @@ bool EffectNormalize::Process()
if (TrackList::Channels(track).size() == 1)
// really mono
msg = topMsg +
wxString::Format( _("Processing: %s"), trackName );
XO("Processing: %s").Format( trackName );
else
//'stereo tracks independently'
// TODO: more-than-two-channels-message
msg = topMsg +
wxString::Format( _("Processing stereo channels independently: %s"), trackName);
XO("Processing stereo channels independently: %s").Format( trackName );
}
else
msg = topMsg +
// TODO: more-than-two-channels-message
wxString::Format( _("Processing first track of stereo pair: %s"), trackName);
XO("Processing first track of stereo pair: %s").Format( trackName );
// Use multiplier in the second, processing loop over channels
auto pOffset = offsets.begin();
@ -272,7 +270,7 @@ bool EffectNormalize::Process()
goto break2;
// TODO: more-than-two-channels-message
msg = topMsg +
wxString::Format( _("Processing second track of stereo pair: %s"), trackName);
XO("Processing second track of stereo pair: %s").Format( trackName );
}
}
}
@ -359,7 +357,7 @@ bool EffectNormalize::TransferDataFromWindow()
// EffectNormalize implementation
bool EffectNormalize::AnalyseTrack(const WaveTrack * track, const wxString &msg,
bool EffectNormalize::AnalyseTrack(const WaveTrack * track, const TranslatableString &msg,
double &progress, float &offset, float &extent)
{
bool result = true;
@ -373,7 +371,7 @@ bool EffectNormalize::AnalyseTrack(const WaveTrack * track, const wxString &msg,
while (ProjectFileManager::GetODFlags( *track )) {
// update the gui
if (ProgressResult::Cancelled == mProgress->Update(
0, _("Waiting for waveform to finish computing...")) )
0, XO("Waiting for waveform to finish computing...")) )
return false;
wxMilliSleep(100);
}
@ -409,7 +407,7 @@ bool EffectNormalize::AnalyseTrack(const WaveTrack * track, const wxString &msg,
//AnalyseTrackData() takes a track, transforms it to bunch of buffer-blocks,
//and executes selected AnalyseOperation on it...
bool EffectNormalize::AnalyseTrackData(const WaveTrack * track, const wxString &msg,
bool EffectNormalize::AnalyseTrackData(const WaveTrack * track, const TranslatableString &msg,
double &progress, AnalyseOperation op, float &offset)
{
bool rc = true;
@ -477,7 +475,7 @@ bool EffectNormalize::AnalyseTrackData(const WaveTrack * track, const wxString &
// uses mMult and offset to normalize a track.
// mMult must be set before this is called
bool EffectNormalize::ProcessOne(
WaveTrack * track, const wxString &msg, double &progress, float offset)
WaveTrack * track, const TranslatableString &msg, double &progress, float offset)
{
bool rc = true;

View File

@ -64,10 +64,10 @@ private:
};
bool ProcessOne(
WaveTrack * t, const wxString &msg, double& progress, float offset);
bool AnalyseTrack(const WaveTrack * track, const wxString &msg,
WaveTrack * t, const TranslatableString &msg, double& progress, float offset);
bool AnalyseTrack(const WaveTrack * track, const TranslatableString &msg,
double &progress, float &offset, float &extent);
bool AnalyseTrackData(const WaveTrack * track, const wxString &msg, double &progress,
bool AnalyseTrackData(const WaveTrack * track, const TranslatableString &msg, double &progress,
AnalyseOperation op, float &offset);
void AnalyseDataDC(float *buffer, size_t len);
void ProcessData(float *buffer, size_t len, float offset);

View File

@ -1347,10 +1347,10 @@ bool NyquistEffect::ProcessOne()
// so notify the user that process has completed (bug 558)
if ((rval != nyx_audio) && ((mCount + mCurNumChannels) == mNumSelectedChannels)) {
if (mCurNumChannels == 1) {
TrackProgress(mCount, 1.0, _("Processing complete."));
TrackProgress(mCount, 1.0, XO("Processing complete."));
}
else {
TrackGroupProgress(mCount, 1.0, _("Processing complete."));
TrackGroupProgress(mCount, 1.0, XO("Processing complete."));
}
}

View File

@ -271,7 +271,7 @@ std::unique_ptr<Mixer> ExportPlugin::CreateMixer(const TrackList &tracks,
}
void ExportPlugin::InitProgress(std::unique_ptr<ProgressDialog> &pDialog,
const wxString &title, const wxString &message)
const TranslatableString &title, const TranslatableString &message)
{
if (!pDialog)
pDialog = std::make_unique<ProgressDialog>( title, message );
@ -283,9 +283,10 @@ void ExportPlugin::InitProgress(std::unique_ptr<ProgressDialog> &pDialog,
}
void ExportPlugin::InitProgress(std::unique_ptr<ProgressDialog> &pDialog,
const wxFileNameWrapper &title, const wxString &message)
const wxFileNameWrapper &title, const TranslatableString &message)
{
return InitProgress( pDialog, title.GetName(), message );
return InitProgress(
pDialog, TranslatableString{ title.GetName() }, message );
}
//----------------------------------------------------------------------------

View File

@ -144,9 +144,9 @@ protected:
// Create or recycle a dialog.
static void InitProgress(std::unique_ptr<ProgressDialog> &pDialog,
const wxString &title, const wxString &message);
const TranslatableString &title, const TranslatableString &message);
static void InitProgress(std::unique_ptr<ProgressDialog> &pDialog,
const wxFileNameWrapper &title, const wxString &message);
const wxFileNameWrapper &title, const TranslatableString &message);
private:
std::vector<FormatInfo> mFormatInfos;

View File

@ -462,10 +462,10 @@ ProgressResult ExportCL::Export(AudacityProject *project,
} );
// Prepare the progress display
InitProgress( pDialog, _("Export"),
InitProgress( pDialog, XO("Export"),
selectionOnly
? _("Exporting the selected audio using command-line encoder")
: _("Exporting the audio using command-line encoder") );
? XO("Exporting the selected audio using command-line encoder")
: XO("Exporting the audio using command-line encoder") );
auto &progress = *pDialog;
// Start piping the mixed data to the command

View File

@ -912,10 +912,10 @@ ProgressResult ExportFFmpeg::Export(AudacityProject *project,
{
InitProgress( pDialog, fName,
selectionOnly
? wxString::Format(_("Exporting selected audio as %s"),
ExportFFmpegOptions::fmts[mSubFormat].description.Translation())
: wxString::Format(_("Exporting the audio as %s"),
ExportFFmpegOptions::fmts[mSubFormat].description.Translation()) );
? XO("Exporting selected audio as %s")
.Format( ExportFFmpegOptions::fmts[mSubFormat].description )
: XO("Exporting the audio as %s")
.Format( ExportFFmpegOptions::fmts[mSubFormat].description ) );
auto &progress = *pDialog;
while (updateResult == ProgressResult::Success) {

View File

@ -381,8 +381,8 @@ ProgressResult ExportFLAC::Export(AudacityProject *project,
InitProgress( pDialog, fName,
selectionOnly
? _("Exporting the selected audio as FLAC")
: _("Exporting the audio as FLAC") );
? XO("Exporting the selected audio as FLAC")
: XO("Exporting the audio as FLAC") );
auto &progress = *pDialog;
while (updateResult == ProgressResult::Success) {

View File

@ -309,10 +309,10 @@ ProgressResult ExportMP2::Export(AudacityProject *project,
InitProgress( pDialog, fName,
selectionOnly
? wxString::Format(_("Exporting selected audio at %ld kbps"),
bitrate)
: wxString::Format(_("Exporting the audio at %ld kbps"),
bitrate) );
? XO("Exporting selected audio at %ld kbps")
.Format( bitrate )
: XO("Exporting the audio at %ld kbps")
.Format( bitrate ) );
auto &progress = *pDialog;
while (updateResult == ProgressResult::Success) {

View File

@ -1879,24 +1879,24 @@ ProgressResult ExportMP3::Export(AudacityProject *project,
channels, inSamples, true,
rate, int16Sample, true, mixerSpec);
wxString title;
TranslatableString title;
if (rmode == MODE_SET) {
title.Printf(selectionOnly ?
_("Exporting selected audio with %s preset") :
_("Exporting the audio with %s preset"),
setRateNamesShort[brate].Translation());
title = (selectionOnly ?
XO("Exporting selected audio with %s preset") :
XO("Exporting the audio with %s preset"))
.Format( setRateNamesShort[brate] );
}
else if (rmode == MODE_VBR) {
title.Printf(selectionOnly ?
_("Exporting selected audio with VBR quality %s") :
_("Exporting the audio with VBR quality %s"),
varRateNames[brate].Translation());
title = (selectionOnly ?
XO("Exporting selected audio with VBR quality %s") :
XO("Exporting the audio with VBR quality %s"))
.Format( varRateNames[brate] );
}
else {
title.Printf(selectionOnly ?
_("Exporting selected audio at %d Kbps") :
_("Exporting the audio at %d Kbps"),
brate);
title = (selectionOnly ?
XO("Exporting selected audio at %d Kbps") :
XO("Exporting the audio at %d Kbps"))
.Format( brate );
}
InitProgress( pDialog, fName, title );

View File

@ -283,8 +283,8 @@ ProgressResult ExportOGG::Export(AudacityProject *project,
InitProgress( pDialog, fName,
selectionOnly
? _("Exporting the selected audio as Ogg Vorbis")
: _("Exporting the audio as Ogg Vorbis") );
? XO("Exporting the selected audio as Ogg Vorbis")
: XO("Exporting the audio as Ogg Vorbis") );
auto &progress = *pDialog;
while (updateResult == ProgressResult::Success && !eos) {

View File

@ -554,11 +554,10 @@ ProgressResult ExportPCM::Export(AudacityProject *project,
rate, format, true, mixerSpec);
InitProgress( pDialog, fName,
selectionOnly
? wxString::Format(_("Exporting the selected audio as %s"),
formatStr)
: wxString::Format(_("Exporting the audio as %s"),
formatStr) );
(selectionOnly
? XO("Exporting the selected audio as %s")
: XO("Exporting the audio as %s"))
.Format( formatStr ) );
auto &progress = *pDialog;
while (updateResult == ProgressResult::Success) {

View File

@ -345,7 +345,7 @@ bool Importer::Import(const FilePath &fName,
TrackFactory *trackFactory,
TrackHolders &tracks,
Tags *tags,
wxString &errorMessage)
TranslatableString &errorMessage)
{
AudacityProject *pProj = GetActiveProject();
auto cleanup = valueRestorer( pProj->mbBusyImporting, true );
@ -356,7 +356,9 @@ bool Importer::Import(const FilePath &fName,
#ifdef USE_MIDI
// MIDI files must be imported, not opened
if (FileNames::IsMidi(fName)) {
errorMessage.Printf(_("\"%s\" \nis a MIDI file, not an audio file. \nAudacity cannot open this type of file for playing, but you can\nedit it by clicking File > Import > MIDI."), fName);
errorMessage = XO(
"\"%s\" \nis a MIDI file, not an audio file. \nAudacity cannot open this type of file for playing, but you can\nedit it by clicking File > Import > MIDI.")
.Format( fName );
return false;
}
#endif
@ -391,7 +393,7 @@ bool Importer::Import(const FilePath &fName,
// store localized strings!
// The bad consequences of a change of locale are not severe -- only that
// a default choice of file type for an open dialog is not remembered
if (plugin->GetPluginFormatDescription().CompareTo(type) == 0)
if (plugin->GetPluginFormatDescription().Translation() == type )
{
// This plugin corresponds to user-selected filter, try it first.
wxLogDebug(wxT("Inserting %s"),plugin->GetPluginStringID());
@ -587,9 +589,8 @@ bool Importer::Import(const FilePath &fName,
{
if( unusableImportPlugin->SupportsExtension(extension) )
{
errorMessage.Printf(_("This version of Audacity was not compiled with %s support."),
unusableImportPlugin->
GetPluginFormatDescription());
errorMessage = XO("This version of Audacity was not compiled with %s support.")
.Format( unusableImportPlugin->GetPluginFormatDescription() );
return false;
}
}
@ -601,101 +602,131 @@ bool Importer::Import(const FilePath &fName,
// if someone has sent us a .cda file, send them away
if (extension.IsSameAs(wxT("cda"), false)) {
/* i18n-hint: %s will be the filename */
errorMessage.Printf(_("\"%s\" is an audio CD track. \nAudacity cannot open audio CDs directly. \nExtract (rip) the CD tracks to an audio format that \nAudacity can import, such as WAV or AIFF."), fName);
errorMessage = XO(
"\"%s\" is an audio CD track. \nAudacity cannot open audio CDs directly. \nExtract (rip) the CD tracks to an audio format that \nAudacity can import, such as WAV or AIFF.")
.Format( fName );
return false;
}
// playlist type files
if ((extension.IsSameAs(wxT("m3u"), false))||(extension.IsSameAs(wxT("ram"), false))||(extension.IsSameAs(wxT("pls"), false))) {
errorMessage.Printf(_("\"%s\" is a playlist file. \nAudacity cannot open this file because it only contains links to other files. \nYou may be able to open it in a text editor and download the actual audio files."), fName);
errorMessage = XO(
"\"%s\" is a playlist file. \nAudacity cannot open this file because it only contains links to other files. \nYou may be able to open it in a text editor and download the actual audio files.")
.Format( fName );
return false;
}
//WMA files of various forms
if ((extension.IsSameAs(wxT("wma"), false))||(extension.IsSameAs(wxT("asf"), false))) {
errorMessage.Printf(_("\"%s\" is a Windows Media Audio file. \nAudacity cannot open this type of file due to patent restrictions. \nYou need to convert it to a supported audio format, such as WAV or AIFF."), fName);
errorMessage = XO(
"\"%s\" is a Windows Media Audio file. \nAudacity cannot open this type of file due to patent restrictions. \nYou need to convert it to a supported audio format, such as WAV or AIFF.")
.Format( fName );
return false;
}
//AAC files of various forms (probably not encrypted)
if ((extension.IsSameAs(wxT("aac"), false))||(extension.IsSameAs(wxT("m4a"), false))||(extension.IsSameAs(wxT("m4r"), false))||(extension.IsSameAs(wxT("mp4"), false))) {
errorMessage.Printf(_("\"%s\" is an Advanced Audio Coding file.\nWithout the optional FFmpeg library, Audacity cannot open this type of file.\nOtherwise, you need to convert it to a supported audio format, such as WAV or AIFF."), fName);
errorMessage = XO(
"\"%s\" is an Advanced Audio Coding file.\nWithout the optional FFmpeg library, Audacity cannot open this type of file.\nOtherwise, you need to convert it to a supported audio format, such as WAV or AIFF.")
.Format( fName );
return false;
}
// encrypted itunes files
if ((extension.IsSameAs(wxT("m4p"), false))) {
errorMessage.Printf(_("\"%s\" is an encrypted audio file. \nThese typically are from an online music store. \nAudacity cannot open this type of file due to the encryption. \nTry recording the file into Audacity, or burn it to audio CD then \nextract the CD track to a supported audio format such as WAV or AIFF."), fName);
errorMessage = XO(
"\"%s\" is an encrypted audio file. \nThese typically are from an online music store. \nAudacity cannot open this type of file due to the encryption. \nTry recording the file into Audacity, or burn it to audio CD then \nextract the CD track to a supported audio format such as WAV or AIFF.")
.Format( fName );
return false;
}
// Real Inc. files of various sorts
if ((extension.IsSameAs(wxT("ra"), false))||(extension.IsSameAs(wxT("rm"), false))||(extension.IsSameAs(wxT("rpm"), false))) {
errorMessage.Printf(_("\"%s\" is a RealPlayer media file. \nAudacity cannot open this proprietary format. \nYou need to convert it to a supported audio format, such as WAV or AIFF."), fName);
errorMessage = XO(
"\"%s\" is a RealPlayer media file. \nAudacity cannot open this proprietary format. \nYou need to convert it to a supported audio format, such as WAV or AIFF.")
.Format( fName );
return false;
}
// Other notes-based formats
if ((extension.IsSameAs(wxT("kar"), false))||(extension.IsSameAs(wxT("mod"), false))||(extension.IsSameAs(wxT("rmi"), false))) {
errorMessage.Printf(_("\"%s\" is a notes-based file, not an audio file. \nAudacity cannot open this type of file. \nTry converting it to an audio file such as WAV or AIFF and \nthen import it, or record it into Audacity."), fName);
errorMessage = XO(
"\"%s\" is a notes-based file, not an audio file. \nAudacity cannot open this type of file. \nTry converting it to an audio file such as WAV or AIFF and \nthen import it, or record it into Audacity.")
.Format( fName );
return false;
}
// MusePack files
if ((extension.IsSameAs(wxT("mp+"), false))||(extension.IsSameAs(wxT("mpc"), false))||(extension.IsSameAs(wxT("mpp"), false))) {
errorMessage.Printf(_("\"%s\" is a Musepack audio file. \nAudacity cannot open this type of file. \nIf you think it might be an mp3 file, rename it to end with \".mp3\" \nand try importing it again. Otherwise you need to convert it to a supported audio \nformat, such as WAV or AIFF."), fName);
errorMessage = XO(
"\"%s\" is a Musepack audio file. \nAudacity cannot open this type of file. \nIf you think it might be an mp3 file, rename it to end with \".mp3\" \nand try importing it again. Otherwise you need to convert it to a supported audio \nformat, such as WAV or AIFF.")
.Format( fName );
return false;
}
// WavPack files
if ((extension.IsSameAs(wxT("wv"), false))||(extension.IsSameAs(wxT("wvc"), false))) {
errorMessage.Printf(_("\"%s\" is a Wavpack audio file. \nAudacity cannot open this type of file. \nYou need to convert it to a supported audio format, such as WAV or AIFF."), fName);
errorMessage = XO(
"\"%s\" is a Wavpack audio file. \nAudacity cannot open this type of file. \nYou need to convert it to a supported audio format, such as WAV or AIFF.")
.Format( fName );
return false;
}
// AC3 files
if ((extension.IsSameAs(wxT("ac3"), false))) {
errorMessage.Printf(_("\"%s\" is a Dolby Digital audio file. \nAudacity cannot currently open this type of file. \nYou need to convert it to a supported audio format, such as WAV or AIFF."), fName);
errorMessage = XO(
"\"%s\" is a Dolby Digital audio file. \nAudacity cannot currently open this type of file. \nYou need to convert it to a supported audio format, such as WAV or AIFF.")
.Format( fName );
return false;
}
// Speex files
if ((extension.IsSameAs(wxT("spx"), false))) {
errorMessage.Printf(_("\"%s\" is an Ogg Speex audio file. \nAudacity cannot currently open this type of file. \nYou need to convert it to a supported audio format, such as WAV or AIFF."), fName);
errorMessage = XO(
"\"%s\" is an Ogg Speex audio file. \nAudacity cannot currently open this type of file. \nYou need to convert it to a supported audio format, such as WAV or AIFF.")
.Format( fName );
return false;
}
// Video files of various forms
if ((extension.IsSameAs(wxT("mpg"), false))||(extension.IsSameAs(wxT("mpeg"), false))||(extension.IsSameAs(wxT("avi"), false))||(extension.IsSameAs(wxT("wmv"), false))||(extension.IsSameAs(wxT("rv"), false))) {
errorMessage.Printf(_("\"%s\" is a video file. \nAudacity cannot currently open this type of file. \nYou need to extract the audio to a supported format, such as WAV or AIFF."), fName);
errorMessage = XO(
"\"%s\" is a video file. \nAudacity cannot currently open this type of file. \nYou need to extract the audio to a supported format, such as WAV or AIFF.")
.Format( fName );
return false;
}
// Audacity project
if (extension.IsSameAs(wxT("aup"), false)) {
errorMessage.Printf(_("\"%s\" is an Audacity Project file. \nUse the 'File > Open' command to open Audacity Projects."), fName);
errorMessage = XO(
"\"%s\" is an Audacity Project file. \nUse the 'File > Open' command to open Audacity Projects.")
.Format( fName );
return false;
}
if( !wxFileExists(fName)){
errorMessage.Printf(_("File \"%s\" not found."), fName);
errorMessage = XO( "File \"%s\" not found.").Format( fName );
return false;
}
// we were not able to recognize the file type
errorMessage.Printf(_("Audacity did not recognize the type of the file '%s'.\nTry installing FFmpeg. For uncompressed files, also try File > Import > Raw Data."),fName);
errorMessage = XO(
"Audacity did not recognize the type of the file '%s'.\nTry installing FFmpeg. For uncompressed files, also try File > Import > Raw Data.")
.Format( fName );
}
else
{
// We DO have a plugin for this file, but import failed.
wxString pluglist;
TranslatableString pluglist;
for (const auto &plugin : compatiblePlugins)
{
if (pluglist.empty())
pluglist = plugin->GetPluginFormatDescription();
else
pluglist = wxString::Format( _("%s, %s"),
pluglist, plugin->GetPluginFormatDescription() );
pluglist = XO("%s, %s")
.Format( pluglist, plugin->GetPluginFormatDescription() );
}
errorMessage.Printf(_("Audacity recognized the type of the file '%s'.\nImporters supposedly supporting such files are:\n%s,\nbut none of them understood this file format."),fName, pluglist);
errorMessage = XO(
"Audacity recognized the type of the file '%s'.\nImporters supposedly supporting such files are:\n%s,\nbut none of them understood this file format.")
.Format( fName, pluglist );
}
return false;
@ -774,9 +805,9 @@ ImportFileHandle::~ImportFileHandle()
void ImportFileHandle::CreateProgress()
{
wxFileName ff( mFilename );
wxString title;
title.Printf(_("Importing %s"), GetFileDescription());
mProgress = std::make_unique< ProgressDialog >( title, ff.GetFullName() );
auto title = XO("Importing %s").Format( GetFileDescription() );
mProgress = std::make_unique< ProgressDialog >(
title, TranslatableString{ ff.GetFullName() } );
}

View File

@ -31,10 +31,10 @@ typedef bool (*progress_callback_t)( void *userData, float percent );
class Format {
public:
wxString formatName;
TranslatableString formatName;
FileExtensions formatExtensions;
Format(const wxString &_formatName,
Format(const TranslatableString &_formatName,
FileExtensions _formatExtensions):
formatName(_formatName),
formatExtensions( std::move( _formatExtensions ) )
@ -155,7 +155,7 @@ public:
TrackFactory *trackFactory,
TrackHolders &tracks,
Tags *tags,
wxString &errorMessage);
TranslatableString &errorMessage);
private:
static Importer mInstance;

View File

@ -39,7 +39,7 @@ Licensed under the GNU General Public License v2 or later
#include "../widgets/ProgressDialog.h"
#define DESC _("FFmpeg-compatible files")
#define DESC XO("FFmpeg-compatible files")
//TODO: remove non-audio extensions
#if defined(USE_FFMPEG)
@ -180,7 +180,7 @@ public:
~FFmpegImportPlugin() { }
wxString GetPluginStringID() override { return wxT("libav"); }
wxString GetPluginFormatDescription() override;
TranslatableString GetPluginFormatDescription() override;
///! Probes the file and opens it if appropriate
std::unique_ptr<ImportFileHandle> Open(const FilePath &Filename) override;
@ -204,7 +204,7 @@ public:
bool InitCodecs();
wxString GetFileDescription() override;
TranslatableString GetFileDescription() override;
ByteCount GetFileUncompressedBytes() override;
///! Imports audio
@ -286,7 +286,7 @@ private:
};
wxString FFmpegImportPlugin::GetPluginFormatDescription()
TranslatableString FFmpegImportPlugin::GetPluginFormatDescription()
{
return DESC;
}
@ -465,7 +465,7 @@ bool FFmpegImportFileHandle::InitCodecs()
return true;
}
wxString FFmpegImportFileHandle::GetFileDescription()
TranslatableString FFmpegImportFileHandle::GetFileDescription()
{
return DESC;
}

View File

@ -49,7 +49,7 @@
#define FLAC_HEADER "fLaC"
#define DESC _("FLAC files")
#define DESC XO("FLAC files")
static const auto exts = {
wxT("flac"),
@ -134,7 +134,7 @@ class FLACImportPlugin final : public ImportPlugin
~FLACImportPlugin() { }
wxString GetPluginStringID() override { return wxT("libflac"); }
wxString GetPluginFormatDescription() override;
TranslatableString GetPluginFormatDescription() override;
std::unique_ptr<ImportFileHandle> Open(const FilePath &Filename) override;
unsigned SequenceNumber() const override;
@ -150,7 +150,7 @@ public:
bool Init();
wxString GetFileDescription() override;
TranslatableString GetFileDescription() override;
ByteCount GetFileUncompressedBytes() override;
ProgressResult Import(TrackFactory *trackFactory, TrackHolders &outTracks,
Tags *tags) override;
@ -285,7 +285,7 @@ FLAC__StreamDecoderWriteStatus MyFLACFile::write_callback(const FLAC__Frame *fra
}, MakeSimpleGuard(FLAC__STREAM_DECODER_WRITE_STATUS_ABORT) );
}
wxString FLACImportPlugin::GetPluginFormatDescription()
TranslatableString FLACImportPlugin::GetPluginFormatDescription()
{
return DESC;
}
@ -425,7 +425,7 @@ bool FLACImportFileHandle::Init()
return true;
}
wxString FLACImportFileHandle::GetFileDescription()
TranslatableString FLACImportFileHandle::GetFileDescription()
{
return DESC;
}

View File

@ -31,7 +31,7 @@ Licensed under the GNU General Public License v2 or later
#include <wx/window.h>
#include <wx/log.h>
#define DESC _("GStreamer-compatible files")
#define DESC XO("GStreamer-compatible files")
// On Windows we don't have configure script to turn this on or off,
@ -165,7 +165,7 @@ public:
///\return true if successful, false otherwise
bool Init();
wxString GetFileDescription() override;
TranslatableString GetFileDescription() override;
ByteCount GetFileUncompressedBytes() override;
///! Called by Import.cpp
@ -240,7 +240,7 @@ public:
///! Destructor
virtual ~GStreamerImportPlugin();
wxString GetPluginFormatDescription() override;
TranslatableString GetPluginFormatDescription() override;
wxString GetPluginStringID() override;
@ -323,7 +323,7 @@ GStreamerImportPlugin::~GStreamerImportPlugin()
// ----------------------------------------------------------------------------
// Return the plugin description
wxString
TranslatableString
GStreamerImportPlugin::GetPluginFormatDescription()
{
return DESC;
@ -994,7 +994,7 @@ GStreamerImportFileHandle::Init()
// ----------------------------------------------------------------------------
// Return file dialog filter description
wxString
TranslatableString
GStreamerImportFileHandle::GetFileDescription()
{
return DESC;

View File

@ -96,7 +96,7 @@
#define BINARY_FILE_CHECK_BUFFER_SIZE 1024
#define DESC _("List of Files in basic text format")
#define DESC XO("List of Files in basic text format")
static const auto exts = {
wxT("lof")
@ -113,7 +113,7 @@ public:
~LOFImportPlugin() { }
wxString GetPluginStringID() override { return wxT("lof"); }
wxString GetPluginFormatDescription() override;
TranslatableString GetPluginFormatDescription() override;
std::unique_ptr<ImportFileHandle> Open(const FilePath &Filename) override;
unsigned SequenceNumber() const override;
@ -126,7 +126,7 @@ public:
LOFImportFileHandle(const FilePath & name, std::unique_ptr<wxTextFile> &&file);
~LOFImportFileHandle();
wxString GetFileDescription() override;
TranslatableString GetFileDescription() override;
ByteCount GetFileUncompressedBytes() override;
ProgressResult Import(TrackFactory *trackFactory, TrackHolders &outTracks,
Tags *tags) override;
@ -172,7 +172,7 @@ LOFImportFileHandle::LOFImportFileHandle
{
}
wxString LOFImportPlugin::GetPluginFormatDescription()
TranslatableString LOFImportPlugin::GetPluginFormatDescription()
{
return DESC;
}
@ -211,7 +211,7 @@ std::unique_ptr<ImportFileHandle> LOFImportPlugin::Open(const FilePath &filename
return std::make_unique<LOFImportFileHandle>(filename, std::move(file));
}
wxString LOFImportFileHandle::GetFileDescription()
TranslatableString LOFImportFileHandle::GetFileDescription()
{
return DESC;
}

View File

@ -45,7 +45,7 @@
#include "../prefs/QualityPrefs.h"
#include "../widgets/ProgressDialog.h"
#define DESC _("MP3 files")
#define DESC XO("MP3 files")
static const auto exts = {
wxT("mp3"),
@ -114,7 +114,7 @@ public:
~MP3ImportPlugin() { }
wxString GetPluginStringID() override { return wxT("libmad"); }
wxString GetPluginFormatDescription() override;
TranslatableString GetPluginFormatDescription() override;
std::unique_ptr<ImportFileHandle> Open(const FilePath &Filename) override;
unsigned SequenceNumber() const override;
@ -131,7 +131,7 @@ public:
~MP3ImportFileHandle();
wxString GetFileDescription() override;
TranslatableString GetFileDescription() override;
ByteCount GetFileUncompressedBytes() override;
ProgressResult Import(TrackFactory *trackFactory, TrackHolders &outTracks,
Tags *tags) override;
@ -172,7 +172,7 @@ inline float scale(mad_fixed_t sample)
}
wxString MP3ImportPlugin::GetPluginFormatDescription()
TranslatableString MP3ImportPlugin::GetPluginFormatDescription()
{
return DESC;
}
@ -190,7 +190,7 @@ std::unique_ptr<ImportFileHandle> MP3ImportPlugin::Open(const FilePath &Filename
return std::make_unique<MP3ImportFileHandle>(std::move(file), Filename);
}
wxString MP3ImportFileHandle::GetFileDescription()
TranslatableString MP3ImportFileHandle::GetFileDescription()
{
return DESC;
}

View File

@ -45,7 +45,7 @@
#include "../widgets/ProgressDialog.h"
#define DESC _("Ogg Vorbis files")
#define DESC XO("Ogg Vorbis files")
static const auto exts = {
wxT("ogg")
@ -88,7 +88,7 @@ public:
~OggImportPlugin() { }
wxString GetPluginStringID() override { return wxT("liboggvorbis"); }
wxString GetPluginFormatDescription() override;
TranslatableString GetPluginFormatDescription() override;
std::unique_ptr<ImportFileHandle> Open(const FilePath &Filename) override;
unsigned SequenceNumber() const override;
@ -119,7 +119,7 @@ public:
}
~OggImportFileHandle();
wxString GetFileDescription() override;
TranslatableString GetFileDescription() override;
ByteCount GetFileUncompressedBytes() override;
ProgressResult Import(TrackFactory *trackFactory, TrackHolders &outTracks,
Tags *tags) override;
@ -158,7 +158,7 @@ private:
};
wxString OggImportPlugin::GetPluginFormatDescription()
TranslatableString OggImportPlugin::GetPluginFormatDescription()
{
return DESC;
}
@ -218,7 +218,7 @@ static Importer::RegisteredImportPlugin registered{
std::make_unique< OggImportPlugin >()
};
wxString OggImportFileHandle::GetFileDescription()
TranslatableString OggImportFileHandle::GetFileDescription()
{
return DESC;
}

View File

@ -71,7 +71,7 @@
}
#endif
#define DESC _("WAV, AIFF, and other uncompressed types")
#define DESC XO("WAV, AIFF, and other uncompressed types")
class PCMImportPlugin final : public ImportPlugin
{
@ -84,7 +84,7 @@ public:
~PCMImportPlugin() { }
wxString GetPluginStringID() override { return wxT("libsndfile"); }
wxString GetPluginFormatDescription() override;
TranslatableString GetPluginFormatDescription() override;
std::unique_ptr<ImportFileHandle> Open(const FilePath &Filename) override;
unsigned SequenceNumber() const override;
@ -97,7 +97,7 @@ public:
PCMImportFileHandle(const FilePath &name, SFFile &&file, SF_INFO info);
~PCMImportFileHandle();
wxString GetFileDescription() override;
TranslatableString GetFileDescription() override;
ByteCount GetFileUncompressedBytes() override;
ProgressResult Import(TrackFactory *trackFactory, TrackHolders &outTracks,
Tags *tags) override;
@ -119,7 +119,7 @@ private:
sampleFormat mFormat;
};
wxString PCMImportPlugin::GetPluginFormatDescription()
TranslatableString PCMImportPlugin::GetPluginFormatDescription()
{
return DESC;
}
@ -220,9 +220,69 @@ PCMImportFileHandle::PCMImportFileHandle(const FilePath &name,
mFormat = floatSample;
}
wxString PCMImportFileHandle::GetFileDescription()
TranslatableString PCMImportFileHandle::GetFileDescription()
{
return SFCall<wxString>(sf_header_name, mInfo.format);
// Library strings
// See the major_formats and subtype_formats tables in command.c in
// libsndfile for this list of possibilities
using Unevaluated = decltype(
/* major_formats */
XO("AIFF (Apple/SGI)")
, XO("AU (Sun/NeXT)")
, XO("AVR (Audio Visual Research)")
, XO("CAF (Apple Core Audio File)")
, XO("FLAC (FLAC Lossless Audio Codec)")
, XO("HTK (HMM Tool Kit)")
, XO("IFF (Amiga IFF/SVX8/SV16)")
, XO("MAT4 (GNU Octave 2.0 / Matlab 4.2)")
, XO("MAT5 (GNU Octave 2.1 / Matlab 5.0)")
, XO("MPC (Akai MPC 2k)")
, XO("OGG (OGG Container format)")
, XO("PAF (Ensoniq PARIS)")
, XO("PVF (Portable Voice Format)")
, XO("RAW (header-less)")
, XO("RF64 (RIFF 64)")
, XO("SD2 (Sound Designer II)")
, XO("SDS (Midi Sample Dump Standard)")
, XO("SF (Berkeley/IRCAM/CARL)")
, XO("VOC (Creative Labs)")
, XO("W64 (SoundFoundry WAVE 64)")
, XO("WAV (Microsoft)")
, XO("WAV (NIST Sphere)")
, XO("WAVEX (Microsoft)")
, XO("WVE (Psion Series 3)")
, XO("XI (FastTracker 2)")
);
using Unevaluated2 = decltype(
/* subtype_formats */
XO("Signed 8 bit PCM")
, XO("Signed 16 bit PCM")
, XO("Signed 24 bit PCM")
, XO("Signed 32 bit PCM")
, XO("Unsigned 8 bit PCM")
, XO("32 bit float")
, XO("64 bit float")
, XO("U-Law")
, XO("A-Law")
, XO("IMA ADPCM")
, XO("Microsoft ADPCM")
, XO("GSM 6.10")
, XO("32kbs G721 ADPCM")
, XO("24kbs G723 ADPCM")
, XO("12 bit DWVW")
, XO("16 bit DWVW")
, XO("24 bit DWVW")
, XO("VOX ADPCM")
, XO("16 bit DPCM")
, XO("8 bit DPCM")
, XO("Vorbis")
);
auto untranslated = SFCall<wxString>(sf_header_name, mInfo.format);
return TranslatableString{
untranslated, {} };
}
auto PCMImportFileHandle::GetFileUncompressedBytes() -> ByteCount

View File

@ -73,7 +73,7 @@ public:
// Get a description of the file type this importer can import.
// Examples: "Ogg Vorbis", "MP3", "Uncompressed PCM"
virtual wxString GetPluginFormatDescription() = 0;
virtual TranslatableString GetPluginFormatDescription() = 0;
// Get a list of extensions this plugin expects to be able to
// import. If a filename matches any of these extensions,
@ -120,10 +120,10 @@ public:
// identify the filename being imported.
void CreateProgress();
// This is similar to GetImporterDescription, but if possible the
// This is similar to GetPluginFormatDescription, but if possible the
// importer will return a more specific description of the
// specific file that is open.
virtual wxString GetFileDescription() = 0;
virtual TranslatableString GetFileDescription() = 0;
// Return an estimate of how many bytes the file will occupy once
// imported. In principle this may exceed main memory, so don't use
@ -162,13 +162,13 @@ class UnusableImportPlugin
{
public:
UnusableImportPlugin(
const wxString &formatName, FileExtensions extensions):
const TranslatableString &formatName, FileExtensions extensions):
mFormatName(formatName),
mExtensions( std::move( extensions ) )
{
}
wxString GetPluginFormatDescription()
TranslatableString GetPluginFormatDescription()
{
return mFormatName;
}
@ -179,7 +179,7 @@ public:
}
private:
wxString mFormatName;
TranslatableString mFormatName;
const FileExtensions mExtensions;
};

View File

@ -121,7 +121,7 @@ class QTImportPlugin final : public ImportPlugin
wxString GetPluginStringID() { return wxT("quicktime"); }
wxString GetPluginFormatDescription();
TranslatableString GetPluginFormatDescription();
std::unique_ptr<ImportFileHandle> Open(const wxString & Filename) override;
unsigned SequenceNumber() const override;
@ -147,7 +147,7 @@ class QTImportFileHandle final : public ImportFileHandle
}
}
wxString GetFileDescription() override;
TranslatableString GetFileDescription() override;
ByteCount GetFileUncompressedBytes() override;
wxInt32 GetStreamCount() override
@ -175,7 +175,7 @@ class QTImportFileHandle final : public ImportFileHandle
Movie mMovie;
};
wxString QTImportPlugin::GetPluginFormatDescription()
TranslatableString QTImportPlugin::GetPluginFormatDescription()
{
return DESC;
}
@ -230,7 +230,7 @@ static Importer::RegisteredImportPlugin registered{
};
wxString QTImportFileHandle::GetFileDescription()
TranslatableString QTImportFileHandle::GetFileDescription()
{
return DESC;
}

View File

@ -218,12 +218,10 @@ void ImportRaw(wxWindow *parent, const wxString &fileName,
totalFrames = 0;
}
wxString msg;
msg.Printf(_("Importing %s"), wxFileName::FileName(fileName).GetFullName());
auto msg = XO("Importing %s").Format( wxFileName::FileName(fileName).GetFullName() );
/* i18n-hint: 'Raw' means 'unprocessed' here and should usually be tanslated.*/
ProgressDialog progress(_("Import Raw"), msg);
ProgressDialog progress(XO("Import Raw"), msg);
size_t block;
do {

View File

@ -762,11 +762,9 @@ void OnResample(const CommandContext &context)
auto flags = UndoPush::AUTOSAVE;
for (auto wt : tracks.Selected< WaveTrack >())
{
wxString msg;
auto msg = XO("Resampling track %d").Format( ++ndx );
msg.Printf(_("Resampling track %d"), ++ndx);
ProgressDialog progress(_("Resample"), msg);
ProgressDialog progress(XO("Resample"), msg);
// The resampling of a track may be stopped by the user. This might
// leave a track with multiple clips in a partially resampled state.

View File

@ -467,7 +467,7 @@ void ExtImportPrefs::DoOnRuleTableSelect (int toprow)
if (item->filter_objects[i] != NULL)
{
PluginList->InsertItem (i + shift,
item->filter_objects[i]->GetPluginFormatDescription());
item->filter_objects[i]->GetPluginFormatDescription().Translation());
}
else
{

View File

@ -998,19 +998,19 @@ ProgressDialog::ProgressDialog()
{
}
ProgressDialog::ProgressDialog(const wxString & title,
const wxString & message /* = {}*/,
ProgressDialog::ProgressDialog(const TranslatableString & title,
const TranslatableString & message /* = {}*/,
int flags /* = pdlgDefaultFlags */,
const wxString & sRemainingLabelText /* = {} */)
const TranslatableString & sRemainingLabelText /* = {} */)
: wxDialogWrapper()
{
Create(title, message, flags, sRemainingLabelText);
}
ProgressDialog::ProgressDialog(const wxString & title,
ProgressDialog::ProgressDialog(const TranslatableString & title,
const MessageTable &columns,
int flags /* = pdlgDefaultFlags */,
const wxString & sRemainingLabelText /* = {} */)
const TranslatableString & sRemainingLabelText /* = {} */)
: wxDialogWrapper()
{
Create(title, columns, flags, sRemainingLabelText);
@ -1110,16 +1110,17 @@ void ProgressDialog::AddMessageAsColumn(wxBoxSizer * pSizer,
// Join strings
auto sText = column[0];
std::for_each( column.begin() + 1, column.end(),
[&](const wxString &text) { sText += wxT("\n") + text; });
[&](const TranslatableString &text)
{ sText.Join( text, wxT("\n") ); });
// Create a statictext object and add to the sizer
wxStaticText* oText = safenew wxStaticText(this,
wxID_ANY,
sText,
sText.Translation(),
wxDefaultPosition,
wxDefaultSize,
wxALIGN_LEFT);
oText->SetName(sText); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
oText->SetName(sText.Translation()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
// If this is the first column then set the mMessage pointer so non-TimerRecord usages
// will still work correctly in SetMessage()
@ -1130,10 +1131,10 @@ void ProgressDialog::AddMessageAsColumn(wxBoxSizer * pSizer,
pSizer->Add(oText, 1, wxEXPAND | wxALL, 5);
}
bool ProgressDialog::Create(const wxString & title,
const wxString & message /* = {} */,
bool ProgressDialog::Create(const TranslatableString & title,
const TranslatableString & message /* = {} */,
int flags /* = pdlgDefaultFlags */,
const wxString & sRemainingLabelText /* = {} */)
const TranslatableString & sRemainingLabelText /* = {} */)
{
MessageTable columns(1);
columns.back().push_back(message);
@ -1143,16 +1144,16 @@ bool ProgressDialog::Create(const wxString & title,
// Record some values used in case of change of message
// TODO: make the following work in case of message tables
wxClientDC dc(this);
dc.GetMultiLineTextExtent(message, &mLastW, &mLastH);
dc.GetMultiLineTextExtent(message.Translation(), &mLastW, &mLastH);
}
return result;
}
bool ProgressDialog::Create(const wxString & title,
bool ProgressDialog::Create(const TranslatableString & title,
const MessageTable & columns,
int flags /* = pdlgDefaultFlags */,
const wxString & sRemainingLabelText /* = {} */)
const TranslatableString & sRemainingLabelText /* = {} */)
{
Init();
@ -1165,7 +1166,7 @@ bool ProgressDialog::Create(const wxString & title,
bool success = wxDialogWrapper::Create(parent,
wxID_ANY,
title,
title.Translation(),
wxDefaultPosition,
wxDefaultSize,
wxDEFAULT_DIALOG_STYLE |
@ -1238,14 +1239,14 @@ bool ProgressDialog::Create(const wxString & title,
}
// Customised "Remaining" label text
wxString sRemainingText = sRemainingLabelText;
auto sRemainingText = sRemainingLabelText;
if (sRemainingText.empty()) {
sRemainingText = _("Remaining Time:");
sRemainingText = XO("Remaining Time:");
}
window = safenew wxStaticText(this,
wxID_ANY,
sRemainingText,
sRemainingText.Translation(),
wxDefaultPosition,
wxDefaultSize,
wxALIGN_RIGHT);
@ -1313,7 +1314,8 @@ bool ProgressDialog::Create(const wxString & title,
//
// Update the time and, optionally, the message
//
ProgressResult ProgressDialog::Update(int value, const wxString & message)
ProgressResult ProgressDialog::Update(
int value, const TranslatableString & message)
{
if (mCancel)
{
@ -1406,7 +1408,8 @@ ProgressResult ProgressDialog::Update(int value, const wxString & message)
//
// Update the time and, optionally, the message
//
ProgressResult ProgressDialog::Update(double current, const wxString & message)
ProgressResult ProgressDialog::Update(
double current, const TranslatableString & message)
{
return Update((int)(current * 1000), message);
}
@ -1414,7 +1417,8 @@ ProgressResult ProgressDialog::Update(double current, const wxString & message)
//
// Update the time and, optionally, the message
//
ProgressResult ProgressDialog::Update(wxULongLong_t current, wxULongLong_t total, const wxString & message)
ProgressResult ProgressDialog::Update(
wxULongLong_t current, wxULongLong_t total, const TranslatableString & message)
{
if (total != 0)
{
@ -1429,7 +1433,8 @@ ProgressResult ProgressDialog::Update(wxULongLong_t current, wxULongLong_t total
//
// Update the time and, optionally, the message
//
ProgressResult ProgressDialog::Update(wxLongLong current, wxLongLong total, const wxString & message)
ProgressResult ProgressDialog::Update(
wxLongLong current, wxLongLong total, const TranslatableString & message)
{
if (total.GetValue() != 0)
{
@ -1444,7 +1449,8 @@ ProgressResult ProgressDialog::Update(wxLongLong current, wxLongLong total, cons
//
// Update the time and, optionally, the message
//
ProgressResult ProgressDialog::Update(wxLongLong_t current, wxLongLong_t total, const wxString & message)
ProgressResult ProgressDialog::Update(
wxLongLong_t current, wxLongLong_t total, const TranslatableString & message)
{
if (total != 0)
{
@ -1459,7 +1465,8 @@ ProgressResult ProgressDialog::Update(wxLongLong_t current, wxLongLong_t total,
//
// Update the time and, optionally, the message
//
ProgressResult ProgressDialog::Update(int current, int total, const wxString & message)
ProgressResult ProgressDialog::Update(
int current, int total, const TranslatableString & message)
{
if (total != 0)
{
@ -1474,7 +1481,8 @@ ProgressResult ProgressDialog::Update(int current, int total, const wxString & m
//
// Update the time and, optionally, the message
//
ProgressResult ProgressDialog::Update(double current, double total, const wxString & message)
ProgressResult ProgressDialog::Update(
double current, double total, const TranslatableString & message)
{
if (total != 0)
{
@ -1489,15 +1497,15 @@ ProgressResult ProgressDialog::Update(double current, double total, const wxStri
//
// Update the message text
//
void ProgressDialog::SetMessage(const wxString & message)
void ProgressDialog::SetMessage(const TranslatableString & message)
{
if (!message.empty())
{
mMessage->SetLabel(message);
mMessage->SetLabel(message.Translation());
int w, h;
wxClientDC dc(mMessage);
dc.GetMultiLineTextExtent(message, &w, &h);
dc.GetMultiLineTextExtent(message.Translation(), &w, &h);
bool sizeUpdated = false;
wxSize ds = GetClientSize();
@ -1532,6 +1540,11 @@ void ProgressDialog::SetMessage(const wxString & message)
}
}
void ProgressDialog::SetTitle(const TranslatableString & message)
{
wxDialogWrapper::SetTitle( message.Translation() );
}
//
// Recursivaly search the window list for the given window.
//
@ -1634,10 +1647,10 @@ bool ProgressDialog::ConfirmAction(const wxString & sPrompt,
}
TimerProgressDialog::TimerProgressDialog(const wxLongLong_t duration,
const wxString & title,
const TranslatableString & title,
const MessageTable & columns,
int flags /* = pdlgDefaultFlags */,
const wxString & sRemainingLabelText /* = {} */)
const TranslatableString & sRemainingLabelText /* = {} */)
: ProgressDialog(title, columns, flags, sRemainingLabelText)
{
mDuration = duration;

View File

@ -58,12 +58,12 @@ public:
ProgressDialog();
// Display a simple message.
ProgressDialog(const wxString & title,
const wxString & message = {},
ProgressDialog(const TranslatableString & title,
const TranslatableString & message = {},
int flags = pdlgDefaultFlags,
const wxString & sRemainingLabelText = {});
const TranslatableString & sRemainingLabelText = {});
using MessageColumn = std::vector< wxString >;
using MessageColumn = std::vector< TranslatableString >;
using MessageTable = std::vector< MessageColumn >;
protected:
@ -72,36 +72,39 @@ protected:
// Each member of a column is a string that should have no newlines,
// and each column should have the same number of elements, to make
// proper correspondences, but this is not checked.
ProgressDialog(const wxString & title,
ProgressDialog(const TranslatableString & title,
const MessageTable & columns,
int flags = pdlgDefaultFlags,
const wxString & sRemainingLabelText = {});
const TranslatableString & sRemainingLabelText = {});
public:
virtual ~ProgressDialog();
bool Create(const wxString & title,
const wxString & message = {},
bool Create(const TranslatableString & title,
const TranslatableString & message = {},
int flags = pdlgDefaultFlags,
const wxString & sRemainingLabelText = {});
const TranslatableString & sRemainingLabelText = {});
void Reinit();
protected:
bool Create(const wxString & title,
bool Create(const TranslatableString & title,
const MessageTable & columns,
int flags = pdlgDefaultFlags,
const wxString & sRemainingLabelText = {});
const TranslatableString & sRemainingLabelText = {});
public:
ProgressResult Update(int value, const wxString & message = {});
ProgressResult Update(double current, const wxString & message = {});
ProgressResult Update(double current, double total, const wxString & message = {});
ProgressResult Update(wxULongLong_t current, wxULongLong_t total, const wxString & message = {});
ProgressResult Update(wxLongLong current, wxLongLong total, const wxString & message = {});
ProgressResult Update(wxLongLong_t current, wxLongLong_t total, const wxString & message = {});
ProgressResult Update(int current, int total, const wxString & message = {});
void SetMessage(const wxString & message);
ProgressResult Update(int value, const TranslatableString & message = {});
ProgressResult Update(double current, const TranslatableString & message = {});
ProgressResult Update(double current, double total, const TranslatableString & message = {});
ProgressResult Update(wxULongLong_t current, wxULongLong_t total, const TranslatableString & message = {});
ProgressResult Update(wxLongLong current, wxLongLong total, const TranslatableString & message = {});
ProgressResult Update(wxLongLong_t current, wxLongLong_t total, const TranslatableString & message = {});
ProgressResult Update(int current, int total, const TranslatableString & message = {});
void SetMessage(const TranslatableString & message);
// overloads and hides the inherited function that takes naked wxString:
void SetTitle(const TranslatableString & title);
protected:
wxWindowRef mHadFocus;
@ -156,10 +159,10 @@ class AUDACITY_DLL_API TimerProgressDialog final : public ProgressDialog
{
public:
TimerProgressDialog(const wxLongLong_t duration,
const wxString &title,
const TranslatableString &title,
const MessageTable & columns,
int flags = pdlgDefaultFlags,
const wxString & sRemainingLabelText = {});
const TranslatableString & sRemainingLabelText = {});
// Oh no, there is an inherited nullary "Update" in wxDialog!
// Choose another name then...