From 4f73530c4a7a78210592bfd3b2dcc893cf33b62b Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 25 Aug 2019 20:32:40 +0200 Subject: [PATCH] Gerbview: better progress reporter info when loading more than one file --- gerbview/files.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gerbview/files.cpp b/gerbview/files.cpp index 52bb79aef1..33a4a16d45 100644 --- a/gerbview/files.cpp +++ b/gerbview/files.cpp @@ -269,10 +269,7 @@ bool GERBVIEW_FRAME::loadListOfGerberAndDrillFiles( const wxString& aPath, wxString msg; WX_STRING_REPORTER reporter( &msg ); - // Show progress dialog after 1 second of loading - static const long long progressShowDelay = 1000; - - auto startTime = wxGetUTCTimeMillis(); + // Create progress dialog (only used if more than 1 file to load std::unique_ptr progress = nullptr; for( unsigned ii = 0; ii < aFilenameList.GetCount(); ii++ ) @@ -294,20 +291,23 @@ bool GERBVIEW_FRAME::loadListOfGerberAndDrillFiles( const wxString& aPath, continue; } - if( !progress && wxGetUTCTimeMillis() - startTime > progressShowDelay ) + m_lastFileName = filename.GetFullPath(); + + if( !progress && ( aFilenameList.GetCount() > 1 ) ) { progress = std::make_unique( this, _( "Loading Gerber files..." ), 1, false ); progress->SetMaxProgress( aFilenameList.GetCount() - 1 ); - progress->Report( _("Loading Gerber files..." ) ); + progress->Report( wxString::Format( _("Loading %d/%d %s" ), ii+1, + aFilenameList.GetCount(), m_lastFileName ) ); } else if( progress ) { + progress->Report( wxString::Format( _("Loading %d/%d %s" ), ii+1, + aFilenameList.GetCount(), m_lastFileName ) ); progress->KeepRefreshing(); } - m_lastFileName = filename.GetFullPath(); - SetActiveLayer( layer, false ); visibility[ layer ] = true;