1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-04 14:19:30 +02:00

Bug 2736 - Recent files list can be replaced by ExportCL commands

This commit is contained in:
Leland Lucius 2021-04-08 20:11:42 -05:00
parent 20f9bde218
commit e22af714af
4 changed files with 13 additions and 9 deletions

View File

@ -2202,7 +2202,7 @@ int AudacityApp::OnExit()
} }
} }
FileHistory::Global().Save(*gPrefs, wxT("RecentFiles")); FileHistory::Global().Save(*gPrefs);
FinishPreferences(); FinishPreferences();

View File

@ -165,7 +165,7 @@ bool ExportCLOptions::TransferDataFromWindow()
wxString cmd = mCmd->GetValue(); wxString cmd = mCmd->GetValue();
mHistory.Append(cmd); mHistory.Append(cmd);
mHistory.Save(*gPrefs, wxT("/FileFormats/ExternalProgramHistory")); mHistory.Save(*gPrefs);
gPrefs->Write(wxT("/FileFormats/ExternalProgramExportCommand"), cmd); gPrefs->Write(wxT("/FileFormats/ExternalProgramExportCommand"), cmd);
gPrefs->Flush(); gPrefs->Flush();

View File

@ -114,8 +114,11 @@ void FileHistory::UseMenu(wxMenu *menu)
void FileHistory::Load(wxConfigBase & config, const wxString & group) void FileHistory::Load(wxConfigBase & config, const wxString & group)
{ {
mHistory.clear(); mHistory.clear();
mGroup = group.empty()
? wxT("RecentFiles")
: group;
config.SetPath(group); config.SetPath(mGroup);
wxString file; wxString file;
long ndx; long ndx;
@ -130,11 +133,11 @@ void FileHistory::Load(wxConfigBase & config, const wxString & group)
NotifyMenus(); NotifyMenus();
} }
void FileHistory::Save(wxConfigBase & config, const wxString & group) void FileHistory::Save(wxConfigBase & config)
{ {
config.SetPath(wxT("")); config.SetPath(wxT(""));
config.DeleteGroup(group); config.DeleteGroup(mGroup);
config.SetPath(group); config.SetPath(mGroup);
// Stored in reverse order // Stored in reverse order
int n = mHistory.size() - 1; int n = mHistory.size() - 1;
@ -153,7 +156,7 @@ void FileHistory::NotifyMenus()
for (auto pMenu : mMenus) for (auto pMenu : mMenus)
if (pMenu) if (pMenu)
NotifyMenu(pMenu); NotifyMenu(pMenu);
Save(*gPrefs, wxT("RecentFiles")); Save(*gPrefs);
} }
void FileHistory::NotifyMenu(wxMenu *menu) void FileHistory::NotifyMenu(wxMenu *menu)

View File

@ -48,8 +48,8 @@ class AUDACITY_DLL_API FileHistory
// also whenever the history changes. // also whenever the history changes.
void UseMenu(wxMenu *menu); void UseMenu(wxMenu *menu);
void Load(wxConfigBase& config, const wxString & group); void Load(wxConfigBase& config, const wxString & group = wxEmptyString);
void Save(wxConfigBase& config, const wxString & group); void Save(wxConfigBase& config);
// stl-style accessors // stl-style accessors
using const_iterator = FilePaths::const_iterator; using const_iterator = FilePaths::const_iterator;
@ -71,6 +71,7 @@ class AUDACITY_DLL_API FileHistory
std::vector< wxWeakRef< wxMenu > > mMenus; std::vector< wxWeakRef< wxMenu > > mMenus;
FilePaths mHistory; FilePaths mHistory;
wxString mGroup;
}; };
#endif #endif