fp library wizard: remember last local download directory & refresh download progress dialog.

This commit is contained in:
Tomasz Wlostowski 2015-06-22 14:24:40 +02:00 committed by Maciej Suminski
parent bdf1d1335b
commit c55e729117
2 changed files with 21 additions and 0 deletions

View File

@ -50,6 +50,7 @@
// a key to store the default Kicad Github libs URL
#define KICAD_FPLIBS_URL_KEY wxT( "kicad_fplib_url" )
#define KICAD_FPLIBS_LAST_DOWNLOAD_DIR wxT( "kicad_fplib_last_download_dir" )
// Filters for the file picker
static const int FILTER_COUNT = 4;
@ -303,8 +304,19 @@ WIZARD_FPLIB_TABLE::WIZARD_FPLIB_TABLE( wxWindow* aParent ) :
// Restore the Github url
wxString githubUrl;
wxConfigBase* cfg = Pgm().CommonSettings();
cfg->Read( KICAD_FPLIBS_URL_KEY, &githubUrl );
cfg->Read( KICAD_FPLIBS_LAST_DOWNLOAD_DIR, &m_lastGithubDownloadDirectory );
if( !m_lastGithubDownloadDirectory.IsEmpty() )
{
setDownloadDir( m_lastGithubDownloadDirectory );
m_filePicker->SetPath( m_lastGithubDownloadDirectory );
} else {
m_lastGithubDownloadDirectory = default_path;
}
if( githubUrl.IsEmpty() )
githubUrl = wxT( "https://github.com/KiCad" );
@ -531,6 +543,10 @@ void WIZARD_FPLIB_TABLE::OnBrowseButtonClick( wxCommandEvent& aEvent )
if( !path.IsEmpty() && wxDirExists( path ) )
{
setDownloadDir( path );
wxConfigBase* cfg = Pgm().CommonSettings();
cfg->Write( KICAD_FPLIBS_LAST_DOWNLOAD_DIR, path );
updateGithubControls();
}
}
@ -613,6 +629,8 @@ bool WIZARD_FPLIB_TABLE::downloadGithubLibsFromList( wxArrayString& aUrlList,
wxMkdir( libdst_name );
pdlg.Update( ii, libsrc_name );
pdlg.Refresh();
pdlg.Update();
try
{

View File

@ -273,4 +273,7 @@ protected:
// determine what's the real cause of the event. Therefore here we store the number of the
// selected file type filter.
int m_selectedFilter;
// path to the most recently used download directory from Github.
wxString m_lastGithubDownloadDirectory;
};