1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-17 00:20:06 +02:00

AUP3: Small cleanup

This commit is contained in:
Leland Lucius 2020-08-01 21:40:54 -05:00
parent 913c41e6e8
commit c29c6b1b15

View File

@ -162,8 +162,9 @@ void OnCompact(const CommandContext &context)
int64_t total = projectFileIO.GetTotalUsage(); int64_t total = projectFileIO.GetTotalUsage();
int64_t used = projectFileIO.GetCurrentUsage(currentTracks); int64_t used = projectFileIO.GetCurrentUsage(currentTracks);
auto before = wxFileName(projectFileIO.GetFileName()).GetSize() + auto baseFile = wxFileName(projectFileIO.GetFileName());
wxFileName(projectFileIO.GetFileName() + wxT("-wal")).GetSize(); auto walFile = wxFileName(projectFileIO.GetFileName() + wxT("-wal"));
auto before = baseFile.GetSize() + walFile.GetSize();
int id = AudacityMessageBox( int id = AudacityMessageBox(
XO("Compacting this project will free up disk space by removing unused bytes within the file.\n\n" XO("Compacting this project will free up disk space by removing unused bytes within the file.\n\n"
@ -179,11 +180,8 @@ void OnCompact(const CommandContext &context)
XO("Compact Project"), XO("Compact Project"),
wxYES_NO); wxYES_NO);
if (id == wxNO) if (id == wxYES)
{ {
return;
}
ProjectHistory::Get(project) ProjectHistory::Get(project)
.PushState(XO("Compacted project file"), XO("Compact"), UndoPush::CONSOLIDATE); .PushState(XO("Compacted project file"), XO("Compact"), UndoPush::CONSOLIDATE);
@ -194,8 +192,7 @@ void OnCompact(const CommandContext &context)
projectFileIO.Compact(currentTracks, true); projectFileIO.Compact(currentTracks, true);
auto after = wxFileName(projectFileIO.GetFileName()).GetSize() + auto after = baseFile.GetSize() + walFile.GetSize();
wxFileName(projectFileIO.GetFileName() + wxT("-wal")).GetSize();
AudacityMessageBox( AudacityMessageBox(
XO("Compacting actually freed %s of disk space.") XO("Compacting actually freed %s of disk space.")
@ -203,6 +200,9 @@ void OnCompact(const CommandContext &context)
XO("Compact Project")); XO("Compact Project"));
} }
currentTracks.reset();
}
void OnSave(const CommandContext &context ) void OnSave(const CommandContext &context )
{ {
auto &project = context.project; auto &project = context.project;