AUP3: UP-33 History window shows misleading "space used"
Possible fix...will need feedback.
This commit is contained in:
parent
2accd9e93f
commit
5eb9f75150
|
@ -40,11 +40,13 @@ undo memory so as to free up space.
|
|||
#include "../images/Empty9x16.xpm"
|
||||
#include "UndoManager.h"
|
||||
#include "Project.h"
|
||||
#include "ProjectFileIO.h"
|
||||
#include "ProjectHistory.h"
|
||||
#include "ShuttleGui.h"
|
||||
|
||||
enum {
|
||||
ID_AVAIL = 1000,
|
||||
ID_FILESIZE,
|
||||
ID_TOTAL,
|
||||
ID_LEVELS,
|
||||
ID_DISCARD,
|
||||
|
@ -98,6 +100,11 @@ HistoryDialog::HistoryDialog(AudacityProject *parent, UndoManager *manager):
|
|||
|
||||
S.StartMultiColumn(3, wxCENTRE);
|
||||
{
|
||||
mFileSize = S.Id(ID_FILESIZE)
|
||||
.ConnectRoot(wxEVT_KEY_DOWN, &HistoryDialog::OnChar)
|
||||
.AddTextBox(XXO("&Project file size"), wxT("0"), 10);
|
||||
S.AddVariableText( {} )->Hide();
|
||||
|
||||
mTotal = S.Id(ID_TOTAL)
|
||||
.ConnectRoot(wxEVT_KEY_DOWN, &HistoryDialog::OnChar)
|
||||
.AddTextBox(XXO("&Total space used"), wxT("0"), 10);
|
||||
|
@ -201,6 +208,10 @@ void HistoryDialog::DoUpdate()
|
|||
|
||||
mList->DeleteAllItems();
|
||||
|
||||
wxFileName filename(ProjectFileIO::Get(*mProject).GetFileName());
|
||||
wxULongLong_t filesize = filename.GetSize().GetValue();
|
||||
mFileSize->SetValue(Internat::FormatSize(filesize).Translation());
|
||||
|
||||
wxLongLong_t total = 0;
|
||||
mSelected = mManager->GetCurrentState() - 1;
|
||||
for (i = 0; i < (int)mManager->GetNumStates(); i++) {
|
||||
|
|
|
@ -46,6 +46,7 @@ class HistoryDialog final : public wxDialogWrapper {
|
|||
AudacityProject *mProject;
|
||||
UndoManager *mManager;
|
||||
wxListCtrl *mList;
|
||||
wxTextCtrl *mFileSize;
|
||||
wxTextCtrl *mTotal;
|
||||
wxTextCtrl *mClipboard;
|
||||
wxTextCtrl *mAvail;
|
||||
|
|
|
@ -27,6 +27,7 @@ Paul Licameli split from AudacityProject.cpp
|
|||
#include "SampleBlock.h"
|
||||
#include "Sequence.h"
|
||||
#include "Tags.h"
|
||||
#include "TimeTrack.h"
|
||||
#include "ViewInfo.h"
|
||||
#include "WaveClip.h"
|
||||
#include "WaveTrack.h"
|
||||
|
|
|
@ -44,8 +44,8 @@ wxDEFINE_EVENT(EVT_UNDO_MODIFIED, wxCommandEvent);
|
|||
wxDEFINE_EVENT(EVT_UNDO_OR_REDO, wxCommandEvent);
|
||||
wxDEFINE_EVENT(EVT_UNDO_RESET, wxCommandEvent);
|
||||
|
||||
using ConstSampleBlockPtr = const SampleBlock*;
|
||||
using Set = std::unordered_set<ConstSampleBlockPtr>;
|
||||
using SampleBlockID = long long;
|
||||
using Set = std::unordered_set<SampleBlockID>;
|
||||
|
||||
struct UndoStackElem {
|
||||
|
||||
|
@ -112,7 +112,7 @@ namespace {
|
|||
|
||||
// Accumulate space used by the file if the file was not
|
||||
// yet seen
|
||||
if ( !seen || (seen->count( &*sb ) == 0 ) )
|
||||
if ( !seen || (seen->count( sb->GetBlockID() ) == 0 ) )
|
||||
{
|
||||
unsigned long long usage{ sb->GetSpaceUsage() };
|
||||
result += usage;
|
||||
|
@ -120,7 +120,7 @@ namespace {
|
|||
|
||||
// Add file to current set
|
||||
if (seen)
|
||||
seen->insert( &*sb );
|
||||
seen->insert( sb->GetBlockID() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user