Replace wxBusyInfo with wxProgressDialog
This commit is contained in:
parent
265febe09a
commit
966daa1c32
|
|
@ -412,16 +412,14 @@ void Browser::OnDragAndDropToSampleListView(wxDropFilesEvent& event)
|
||||||
|
|
||||||
wxBusyCursor busy_cursor;
|
wxBusyCursor busy_cursor;
|
||||||
wxWindowDisabler window_disabler;
|
wxWindowDisabler window_disabler;
|
||||||
wxBusyInfo busy_info("Adding files, please wait...", this);
|
|
||||||
|
|
||||||
wxString name;
|
wxString name;
|
||||||
wxArrayString files;
|
wxArrayString files;
|
||||||
|
wxProgressDialog* progressDialog = new wxProgressDialog("Adding files..", "Adding files, please wait...",
|
||||||
// wxProgressDialog* progressDialog = new wxProgressDialog("Adding files..", "Adding files, please wait...",
|
event.GetNumberOfFiles(), this,
|
||||||
// event.GetNumberOfFiles(), this,
|
wxPD_APP_MODAL | wxPD_SMOOTH | wxPD_CAN_ABORT |
|
||||||
// wxPD_APP_MODAL | wxPD_SMOOTH | wxPD_CAN_ABORT |
|
wxPD_AUTO_HIDE);
|
||||||
// wxPD_CAN_SKIP);
|
progressDialog->CenterOnParent(wxBOTH);
|
||||||
// progressDialog->CenterOnParent(wxBOTH);
|
|
||||||
|
|
||||||
for (int i = 0; i < event.GetNumberOfFiles(); i++)
|
for (int i = 0; i < event.GetNumberOfFiles(); i++)
|
||||||
{
|
{
|
||||||
|
|
@ -434,22 +432,28 @@ void Browser::OnDragAndDropToSampleListView(wxDropFilesEvent& event)
|
||||||
{
|
{
|
||||||
wxDir::GetAllFiles(name, &files);
|
wxDir::GetAllFiles(name, &files);
|
||||||
}
|
}
|
||||||
|
progressDialog->Pulse("Reading Samples",NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
progressDialog->SetRange(files.size());
|
||||||
for (size_t i = 0; i < files.size(); i++)
|
for (size_t i = 0; i < files.size(); i++)
|
||||||
{
|
{
|
||||||
Browser::AddSamples(files[i]);
|
Browser::AddSamples(files[i]);
|
||||||
|
progressDialog->Update(i, wxString::Format("Adding %s", files[i].AfterLast('/')));
|
||||||
|
|
||||||
|
if(progressDialog->WasCancelled())
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
progressDialog->Destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Browser::OnAutoImportDir()
|
void Browser::OnAutoImportDir()
|
||||||
{
|
{
|
||||||
Settings settings(m_ConfigFilepath, m_DatabaseFilepath);
|
Settings settings(this,m_ConfigFilepath, m_DatabaseFilepath);
|
||||||
|
|
||||||
wxBusyCursor busy_cursor;
|
wxBusyCursor busy_cursor;
|
||||||
wxWindowDisabler window_disabler;
|
wxWindowDisabler window_disabler;
|
||||||
wxBusyInfo busy_info("Adding files, please wait...", this);
|
|
||||||
|
|
||||||
wxString dir = settings.GetImportDirPath();
|
wxString dir = settings.GetImportDirPath();
|
||||||
wxString name;
|
wxString name;
|
||||||
|
|
@ -457,6 +461,11 @@ void Browser::OnAutoImportDir()
|
||||||
|
|
||||||
size_t number_of_files = wxDir::GetAllFiles(dir, &files, wxEmptyString, wxDIR_DEFAULT);
|
size_t number_of_files = wxDir::GetAllFiles(dir, &files, wxEmptyString, wxDIR_DEFAULT);
|
||||||
|
|
||||||
|
wxProgressDialog* progressDialog = new wxProgressDialog("Adding files..", "Adding files, please wait...",
|
||||||
|
(int)number_of_files, this,
|
||||||
|
wxPD_APP_MODAL | wxPD_SMOOTH | wxPD_CAN_ABORT |
|
||||||
|
wxPD_AUTO_HIDE);
|
||||||
|
progressDialog->CenterOnParent(wxBOTH);
|
||||||
for ( size_t i = 0; i < number_of_files; i++)
|
for ( size_t i = 0; i < number_of_files; i++)
|
||||||
{
|
{
|
||||||
name = files[i];
|
name = files[i];
|
||||||
|
|
@ -468,12 +477,20 @@ void Browser::OnAutoImportDir()
|
||||||
{
|
{
|
||||||
wxDir::GetAllFiles(name, &files);
|
wxDir::GetAllFiles(name, &files);
|
||||||
}
|
}
|
||||||
|
progressDialog->Pulse("Reading Samples",NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
progressDialog->SetRange(files.size());
|
||||||
|
|
||||||
for (size_t i = 0; i < files.size(); i++)
|
for (size_t i = 0; i < files.size(); i++)
|
||||||
{
|
{
|
||||||
Browser::AddSamples(files[i]);
|
Browser::AddSamples(files[i]);
|
||||||
|
progressDialog->Update(i, wxString::Format("Adding %s", files[i].AfterLast('/')));
|
||||||
|
|
||||||
|
if(progressDialog->WasCancelled())
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
progressDialog->Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogDragResult(wxDragResult result)
|
void LogDragResult(wxDragResult result)
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
#include <wx/mediactrl.h>
|
#include <wx/mediactrl.h>
|
||||||
#include <wx/notebook.h>
|
#include <wx/notebook.h>
|
||||||
#include <wx/panel.h>
|
#include <wx/panel.h>
|
||||||
|
#include <wx/progdlg.h>
|
||||||
#include <wx/setup.h>
|
#include <wx/setup.h>
|
||||||
#include <wx/srchctrl.h>
|
#include <wx/srchctrl.h>
|
||||||
#include <wx/sizer.h>
|
#include <wx/sizer.h>
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ void Database::InsertSample(int favorite, std::string filename,
|
||||||
rc = sqlite3_bind_text(m_Stmt, 10, path.c_str(), path.size(), SQLITE_STATIC);
|
rc = sqlite3_bind_text(m_Stmt, 10, path.c_str(), path.size(), SQLITE_STATIC);
|
||||||
rc = sqlite3_bind_int(m_Stmt, 11, trashed);
|
rc = sqlite3_bind_int(m_Stmt, 11, trashed);
|
||||||
|
|
||||||
rc = sqlite3_step(m_Stmt);
|
rc = sqlite3_step(m_Stmt);
|
||||||
|
|
||||||
if (rc != SQLITE_DONE)
|
if (rc != SQLITE_DONE)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue