mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-25 15:53:52 +02:00
Where FileSelector was used, default to Documents not cwd; save prefs
This commit is contained in:
@@ -39,7 +39,7 @@ KeyConfigPrefs and MousePrefs use.
|
||||
#include "../Internat.h"
|
||||
#include "../ShuttleGui.h"
|
||||
|
||||
#include "FileDialog.h"
|
||||
#include "FileNames.h"
|
||||
|
||||
#if defined(EXPERIMENTAL_KEY_VIEW)
|
||||
|
||||
@@ -333,11 +333,10 @@ void KeyConfigPrefs::RefreshBindings(bool bSort)
|
||||
void KeyConfigPrefs::OnImport(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
wxString file = wxT("Audacity-keys.xml");
|
||||
wxString path = gPrefs->Read(wxT("/DefaultOpenPath"),
|
||||
::wxGetCwd());
|
||||
|
||||
file = FileSelector(_("Select an XML file containing Audacity keyboard shortcuts..."),
|
||||
path,
|
||||
file = FileNames::SelectFile(FileNames::Operation::Open,
|
||||
_("Select an XML file containing Audacity keyboard shortcuts..."),
|
||||
wxEmptyString,
|
||||
file,
|
||||
wxT(""),
|
||||
_("XML files (*.xml)|*.xml|All files|*"),
|
||||
@@ -348,10 +347,6 @@ void KeyConfigPrefs::OnImport(wxCommandEvent & WXUNUSED(event))
|
||||
return;
|
||||
}
|
||||
|
||||
path = wxPathOnly(file);
|
||||
gPrefs->Write(wxT("/DefaultOpenPath"), path);
|
||||
gPrefs->Flush();
|
||||
|
||||
XMLFileReader reader;
|
||||
if (!reader.Parse(mManager, file)) {
|
||||
wxMessageBox(reader.GetErrorStr(),
|
||||
@@ -365,11 +360,10 @@ void KeyConfigPrefs::OnImport(wxCommandEvent & WXUNUSED(event))
|
||||
void KeyConfigPrefs::OnExport(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
wxString file = wxT("Audacity-keys.xml");
|
||||
wxString path = gPrefs->Read(wxT("/DefaultExportPath"),
|
||||
::wxGetCwd());
|
||||
|
||||
file = FileSelector(_("Export Keyboard Shortcuts As:"),
|
||||
path,
|
||||
file = FileNames::SelectFile(FileNames::Operation::Export,
|
||||
_("Export Keyboard Shortcuts As:"),
|
||||
wxEmptyString,
|
||||
file,
|
||||
wxT("xml"),
|
||||
_("XML files (*.xml)|*.xml|All files|*"),
|
||||
@@ -380,10 +374,6 @@ void KeyConfigPrefs::OnExport(wxCommandEvent & WXUNUSED(event))
|
||||
return;
|
||||
}
|
||||
|
||||
path = wxPathOnly(file);
|
||||
gPrefs->Write(wxT("/DefaultExportPath"), path);
|
||||
gPrefs->Flush();
|
||||
|
||||
GuardedCall< void >( [&] {
|
||||
XMLFileWriter prefFile{ file, _("Error Exporting Keyboard Shortcuts") };
|
||||
mManager->WriteXML(prefFile);
|
||||
@@ -993,11 +983,10 @@ void KeyConfigPrefs::RepopulateBindingsList()
|
||||
void KeyConfigPrefs::OnImport(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
wxString file = wxT("Audacity-keys.xml");
|
||||
wxString path = gPrefs->Read(wxT("/DefaultOpenPath"),
|
||||
::wxGetCwd());
|
||||
|
||||
file = FileSelector(_("Select an XML file containing Audacity keyboard shortcuts..."),
|
||||
path,
|
||||
file = FileNames::SelectFile(FileNames::Operation::Open,
|
||||
_("Select an XML file containing Audacity keyboard shortcuts..."),
|
||||
wxEmptyString,
|
||||
file,
|
||||
wxT(""),
|
||||
_("XML files (*.xml)|*.xml|All files|*"),
|
||||
@@ -1008,10 +997,6 @@ void KeyConfigPrefs::OnImport(wxCommandEvent & WXUNUSED(event))
|
||||
return;
|
||||
}
|
||||
|
||||
path = wxPathOnly(file);
|
||||
gPrefs->Write(wxT("/DefaultOpenPath"), path);
|
||||
gPrefs->Flush();
|
||||
|
||||
XMLFileReader reader;
|
||||
if (!reader.Parse(mManager, file)) {
|
||||
wxMessageBox(reader.GetErrorStr(),
|
||||
@@ -1025,10 +1010,9 @@ void KeyConfigPrefs::OnImport(wxCommandEvent & WXUNUSED(event))
|
||||
void KeyConfigPrefs::OnExport(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
wxString file = wxT("Audacity-keys.xml");
|
||||
wxString path = gPrefs->Read(wxT("/DefaultExportPath"),
|
||||
::wxGetCwd());
|
||||
|
||||
file = FileSelector(_("Export Keyboard Shortcuts As:"),
|
||||
file = FileNames::SelectFile(FileNames::Operation::Export,
|
||||
_("Export Keyboard Shortcuts As:"),
|
||||
path,
|
||||
file,
|
||||
wxT("xml"),
|
||||
@@ -1040,10 +1024,6 @@ void KeyConfigPrefs::OnExport(wxCommandEvent & WXUNUSED(event))
|
||||
return;
|
||||
}
|
||||
|
||||
path = wxPathOnly(file);
|
||||
gPrefs->Write(wxT("/DefaultExportPath"), path);
|
||||
gPrefs->Flush();
|
||||
|
||||
GuardedCall< void >( [&] {
|
||||
XMLFileWriter prefFile{ file, _("Error Exporting Keyboard Shortcuts") };
|
||||
mManager->WriteXML(prefFile);
|
||||
|
||||
Reference in New Issue
Block a user