1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-16 08:09:32 +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 used = projectFileIO.GetCurrentUsage(currentTracks);
auto before = wxFileName(projectFileIO.GetFileName()).GetSize() +
wxFileName(projectFileIO.GetFileName() + wxT("-wal")).GetSize();
auto baseFile = wxFileName(projectFileIO.GetFileName());
auto walFile = wxFileName(projectFileIO.GetFileName() + wxT("-wal"));
auto before = baseFile.GetSize() + walFile.GetSize();
int id = AudacityMessageBox(
XO("Compacting this project will free up disk space by removing unused bytes within the file.\n\n"
@ -179,28 +180,27 @@ void OnCompact(const CommandContext &context)
XO("Compact Project"),
wxYES_NO);
if (id == wxNO)
if (id == wxYES)
{
return;
ProjectHistory::Get(project)
.PushState(XO("Compacted project file"), XO("Compact"), UndoPush::CONSOLIDATE);
auto numStates = undoManager.GetNumStates();
undoManager.RemoveStates(numStates - 1);
clipboard.Clear();
projectFileIO.Compact(currentTracks, true);
auto after = baseFile.GetSize() + walFile.GetSize();
AudacityMessageBox(
XO("Compacting actually freed %s of disk space.")
.Format(Internat::FormatSize((before - after).GetValue())),
XO("Compact Project"));
}
ProjectHistory::Get(project)
.PushState(XO("Compacted project file"), XO("Compact"), UndoPush::CONSOLIDATE);
auto numStates = undoManager.GetNumStates();
undoManager.RemoveStates(numStates - 1);
clipboard.Clear();
projectFileIO.Compact(currentTracks, true);
auto after = wxFileName(projectFileIO.GetFileName()).GetSize() +
wxFileName(projectFileIO.GetFileName() + wxT("-wal")).GetSize();
AudacityMessageBox(
XO("Compacting actually freed %s of disk space.")
.Format(Internat::FormatSize((before - after).GetValue())),
XO("Compact Project"));
currentTracks.reset();
}
void OnSave(const CommandContext &context )