MCPcopy Create free account
hub / github.com/audacity/audacity / SetProjectTitle

Method SetProjectTitle

libraries/lib-project-file-io/ProjectFileIO.cpp:1566–1602  ·  view source on GitHub ↗

Pass a number in to show project number, or -1 not to.

Source from the content-addressed store, hash-verified

1564
1565// Pass a number in to show project number, or -1 not to.
1566void ProjectFileIO::SetProjectTitle(int number)
1567{
1568 auto &project = mProject;
1569 wxString name = project.GetProjectName();
1570
1571 // If we are showing project numbers, then we also explicitly show "<untitled>" if there
1572 // is none.
1573 if (number >= 0)
1574 {
1575 name =
1576 /* i18n-hint: The %02i is the project number, the %s is the project name.*/
1577 XO("[Project %02i] Audacity \"%s\"")
1578 .Format( number + 1,
1579 name.empty() ? XO("<untitled>") : Verbatim((const char *)name))
1580 .Translation();
1581 }
1582 // If we are not showing numbers, then <untitled> shows as 'Audacity'.
1583 else if (name.empty())
1584 {
1585 name = _TS("Audacity");
1586 }
1587
1588 if (mRecovered)
1589 {
1590 name += wxT(" ");
1591 /* i18n-hint: E.g this is recovered audio that had been lost.*/
1592 name += _("(Recovered)");
1593 }
1594
1595 if (name != mTitle) {
1596 mTitle = name;
1597 BasicUI::CallAfter( [wThis = weak_from_this()]{
1598 if (auto pThis = wThis.lock())
1599 pThis->Publish(ProjectFileIOMessage::ProjectTitleChange);
1600 } );
1601 }
1602}
1603
1604const FilePath &ProjectFileIO::GetFileName() const
1605{

Callers 6

FixupProjectFunction · 0.80
DoImportMIDIFunction · 0.80
DoSaveMethod · 0.80
AddImportedTracksMethod · 0.80
DoImportMethod · 0.80
RefreshAllTitlesFunction · 0.80

Calls 7

VerbatimFunction · 0.85
CallAfterFunction · 0.85
GetProjectNameMethod · 0.80
TranslationMethod · 0.80
emptyMethod · 0.45
lockMethod · 0.45
PublishMethod · 0.45

Tested by

no test coverage detected