AUP3: Rename empty project after importing AU* projects
This commit is contained in:
parent
df4f3bd4e2
commit
17268edf4b
|
@ -1156,16 +1156,25 @@ bool ProjectFileManager::Import(
|
|||
const FilePath &fileName, WaveTrackArray* pTrackArray /*= NULL*/)
|
||||
{
|
||||
auto &project = mProject;
|
||||
auto &projectFileIO = ProjectFileIO::Get(project);
|
||||
auto oldTags = Tags::Get( project ).shared_from_this();
|
||||
bool initiallyEmpty = TrackList::Get(project).empty();
|
||||
TrackHolders newTracks;
|
||||
TranslatableString errorMessage;
|
||||
|
||||
// Handle AUP3 ("project") files directly
|
||||
if (fileName.AfterLast('.').IsSameAs(wxT("aup3"), false)) {
|
||||
auto &projectFileIO = ProjectFileIO::Get(project);
|
||||
|
||||
if (projectFileIO.ImportProject(fileName)) {
|
||||
auto &history = ProjectHistory::Get(project);
|
||||
|
||||
// If the project was clean and temporary (not permanently saved), then set
|
||||
// the filename to the just imported path.
|
||||
if (initiallyEmpty && projectFileIO.IsTemporary()) {
|
||||
project.SetProjectName(wxFileName(fileName).GetName());
|
||||
projectFileIO.SetProjectTitle();
|
||||
}
|
||||
|
||||
history.PushState(XO("Imported '%s'").Format(fileName), XO("Import"));
|
||||
|
||||
FileHistory::Global().Append(fileName);
|
||||
|
@ -1218,6 +1227,13 @@ bool ProjectFileManager::Import(
|
|||
|
||||
// Handle AUP ("legacy project") files directly
|
||||
if (fileName.AfterLast('.').IsSameAs(wxT("aup"), false)) {
|
||||
// If the project was clean and temporary (not permanently saved), then set
|
||||
// the filename to the just imported path.
|
||||
if (initiallyEmpty && projectFileIO.IsTemporary()) {
|
||||
project.SetProjectName(wxFileName(fileName).GetName());
|
||||
projectFileIO.SetProjectTitle();
|
||||
}
|
||||
|
||||
auto &history = ProjectHistory::Get( project );
|
||||
|
||||
history.PushState(XO("Imported '%s'").Format( fileName ), XO("Import"));
|
||||
|
|
Loading…
Reference in New Issue