1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-25 17:08:07 +02:00

Uses of BasicUI::MakeGenericProgress

This commit is contained in:
Paul Licameli 2021-02-19 12:26:45 -05:00
parent 333aa10624
commit 0c8b4e32fc
3 changed files with 22 additions and 30 deletions

View File

@ -13,8 +13,6 @@
#include <atomic> #include <atomic>
#include <thread> #include <thread>
#include <wx/progdlg.h>
#if defined(__WXMSW__) #if defined(__WXMSW__)
#include <wx/evtloop.h> #include <wx/evtloop.h>
#endif #endif
@ -22,6 +20,7 @@
#include "wxFileNameWrapper.h" #include "wxFileNameWrapper.h"
#include "AudacityLogger.h" #include "AudacityLogger.h"
#include "AudioIOBase.h" #include "AudioIOBase.h"
#include "BasicUI.h"
#include "FileNames.h" #include "FileNames.h"
#include "Internat.h" #include "Internat.h"
#include "Languages.h" #include "Languages.h"
@ -44,11 +43,10 @@ void Generate(wxDebugReport::Context ctx)
{ {
// Provides a progress dialog with indeterminate mode // Provides a progress dialog with indeterminate mode
wxGenericProgressDialog pd(XO("Audacity Support Data").Translation(), using namespace BasicUI;
XO("This may take several seconds").Translation(), auto pd = MakeGenericProgress({},
300000, // range XO("Audacity Support Data"), XO("This may take several seconds"));
nullptr, // parent wxASSERT(pd);
wxPD_APP_MODAL | wxPD_ELAPSED_TIME | wxPD_SMOOTH);
std::atomic_bool done = {false}; std::atomic_bool done = {false};
auto thread = std::thread([&] auto thread = std::thread([&]
@ -87,7 +85,7 @@ void Generate(wxDebugReport::Context ctx)
while (!done) while (!done)
{ {
wxMilliSleep(50); wxMilliSleep(50);
pd.Pulse(); pd->Pulse();
} }
thread.join(); thread.join();
} }

View File

@ -13,10 +13,10 @@ Paul Licameli -- split from ProjectFileIO.cpp
#include "sqlite3.h" #include "sqlite3.h"
#include <wx/progdlg.h>
#include <wx/string.h> #include <wx/string.h>
#include "AudacityLogger.h" #include "AudacityLogger.h"
#include "BasicUI.h"
#include "FileNames.h" #include "FileNames.h"
#include "Internat.h" #include "Internat.h"
#include "Project.h" #include "Project.h"
@ -240,17 +240,16 @@ bool DBConnection::Close()
} }
// Provides a progress dialog with indeterminate mode // Provides a progress dialog with indeterminate mode
wxGenericProgressDialog pd(title.Translation(), using namespace BasicUI;
XO("This may take several seconds").Translation(), auto pd = MakeGenericProgress({},
300000, // range title, XO("This may take several seconds"));
nullptr, // parent wxASSERT(pd);
wxPD_APP_MODAL | wxPD_ELAPSED_TIME | wxPD_SMOOTH);
// Wait for the checkpoints to end // Wait for the checkpoints to end
while (mCheckpointPending || mCheckpointActive) while (mCheckpointPending || mCheckpointActive)
{ {
wxMilliSleep(50); wxMilliSleep(50);
pd.Pulse(); pd->Pulse();
} }
} }

View File

@ -14,7 +14,6 @@ Paul Licameli split from AudacityProject.cpp
#include <sqlite3.h> #include <sqlite3.h>
#include <wx/crt.h> #include <wx/crt.h>
#include <wx/frame.h> #include <wx/frame.h>
#include <wx/progdlg.h>
#include <wx/sstream.h> #include <wx/sstream.h>
#include <wx/xml/xml.h> #include <wx/xml/xml.h>
@ -1171,20 +1170,17 @@ bool ProjectFileIO::RenameOrWarn(const FilePath &src, const FilePath &dst)
done = true; done = true;
}); });
auto &window = GetProjectFrame( mProject );
// Provides a progress dialog with indeterminate mode // Provides a progress dialog with indeterminate mode
wxGenericProgressDialog pd(XO("Copying Project").Translation(), using namespace BasicUI;
XO("This may take several seconds").Translation(), auto pd = MakeGenericProgress(*ProjectFramePlacement(&mProject),
300000, // range XO("Copying Project"), XO("This may take several seconds"));
&window, // parent wxASSERT(pd);
wxPD_APP_MODAL | wxPD_ELAPSED_TIME | wxPD_SMOOTH);
// Wait for the checkpoints to end // Wait for the checkpoints to end
while (!done) while (!done)
{ {
wxMilliSleep(50); wxMilliSleep(50);
pd.Pulse(); pd->Pulse();
} }
thread.join(); thread.join();
@ -2102,17 +2098,16 @@ bool ProjectFileIO::SaveProject(
}); });
// Provides a progress dialog with indeterminate mode // Provides a progress dialog with indeterminate mode
wxGenericProgressDialog pd(XO("Syncing").Translation(), using namespace BasicUI;
XO("This may take several seconds").Translation(), auto pd = MakeGenericProgress({},
300000, // range XO("Syncing"), XO("This may take several seconds"));
nullptr, // parent wxASSERT(pd);
wxPD_APP_MODAL | wxPD_ELAPSED_TIME | wxPD_SMOOTH);
// Wait for the checkpoints to end // Wait for the checkpoints to end
while (!done) while (!done)
{ {
wxMilliSleep(50); wxMilliSleep(50);
pd.Pulse(); pd->Pulse();
} }
thread.join(); thread.join();