More robust handling of default curves:
When looking for default curves, EQDefaultCurves.xml is searched for in the DataDir first, then the exeDir, then the error dialog is popped up. Error dialog stays open while user visits web site to get EQDefaultCurves.xml. The 'normal' set of curves EQCurves.xml is still in DataDir.
This commit is contained in:
parent
6a341a94c5
commit
959c2909f3
|
@ -1,96 +0,0 @@
|
|||
<equalizationeffect>
|
||||
<curve name="AM Radio">
|
||||
<point f="20.000000000000" d="-63.670000000000"/>
|
||||
<point f="31.000000000000" d="-33.219000000000"/>
|
||||
<point f="50.000000000000" d="-3.010000000000"/>
|
||||
<point f="63.000000000000" d="-0.106000000000"/>
|
||||
<point f="100.000000000000" d="0.000000000000"/>
|
||||
<point f="2500.000000000000" d="0.000000000000"/>
|
||||
<point f="4000.000000000000" d="-0.614000000000"/>
|
||||
<point f="5000.000000000000" d="-8.059000000000"/>
|
||||
<point f="8000.000000000000" d="-39.981000000000"/>
|
||||
<point f="20000.000000000000" d="-103.651000000000"/>
|
||||
<point f="48000.000000000000" d="-164.485000000000"/>
|
||||
</curve>
|
||||
<curve name="Telephone">
|
||||
<point f="20.000000000000" d="-94.087000000000"/>
|
||||
<point f="200.000000000000" d="-14.254000000000"/>
|
||||
<point f="250.000000000000" d="-7.243000000000"/>
|
||||
<point f="315.000000000000" d="-2.245000000000"/>
|
||||
<point f="400.000000000000" d="-0.414000000000"/>
|
||||
<point f="500.000000000000" d="0.000000000000"/>
|
||||
<point f="2500.000000000000" d="0.000000000000"/>
|
||||
<point f="3150.000000000000" d="-0.874000000000"/>
|
||||
<point f="4000.000000000000" d="-3.992000000000"/>
|
||||
<point f="5000.000000000000" d="-9.993000000000"/>
|
||||
<point f="48000.000000000000" d="-88.117000000000"/>
|
||||
</curve>
|
||||
<curve name="Walkie-talkie">
|
||||
<point f="100.000000000000" d="-120.000000000000"/>
|
||||
<point f="101.000000000000" d="0.000000000000"/>
|
||||
<point f="2000.000000000000" d="0.000000000000"/>
|
||||
<point f="2001.000000000000" d="-120.000000000000"/>
|
||||
</curve>
|
||||
<curve name="100Hz Rumble">
|
||||
<point f="20.000000000000" d="-80.000000000000"/>
|
||||
<point f="49.237316986327" d="-33.107692718506"/>
|
||||
<point f="54.196034330446" d="-29.553844451904"/>
|
||||
<point f="88.033573501041" d="-6.923076629639"/>
|
||||
<point f="95.871851182279" d="-4.523078918457"/>
|
||||
<point f="108.957037410504" d="-1.938461303711"/>
|
||||
<point f="123.828171198057" d="-0.738462448120"/>
|
||||
<point f="149.228077614658" d="-0.092308044434"/>
|
||||
</curve>
|
||||
<curve name="RIAA">
|
||||
<point f="20.000000000000" d="19.274000000000"/>
|
||||
<point f="25.000000000000" d="18.954000000000"/>
|
||||
<point f="31.000000000000" d="18.516000000000"/>
|
||||
<point f="40.000000000000" d="17.792000000000"/>
|
||||
<point f="50.000000000000" d="16.946000000000"/>
|
||||
<point f="63.000000000000" d="15.852000000000"/>
|
||||
<point f="80.000000000000" d="14.506000000000"/>
|
||||
<point f="100.000000000000" d="13.088000000000"/>
|
||||
<point f="125.000000000000" d="11.563000000000"/>
|
||||
<point f="160.000000000000" d="9.809000000000"/>
|
||||
<point f="200.000000000000" d="8.219000000000"/>
|
||||
<point f="250.000000000000" d="6.677000000000"/>
|
||||
<point f="315.000000000000" d="5.179000000000"/>
|
||||
<point f="400.000000000000" d="3.784000000000"/>
|
||||
<point f="500.000000000000" d="2.648000000000"/>
|
||||
<point f="630.000000000000" d="1.642000000000"/>
|
||||
<point f="800.000000000000" d="0.751000000000"/>
|
||||
<point f="1000.000000000000" d="0.000000000000"/>
|
||||
<point f="1250.000000000000" d="-0.744000000000"/>
|
||||
<point f="1600.000000000000" d="-1.643000000000"/>
|
||||
<point f="2000.000000000000" d="-2.589000000000"/>
|
||||
<point f="2500.000000000000" d="-3.700000000000"/>
|
||||
<point f="3150.000000000000" d="-5.038000000000"/>
|
||||
<point f="4000.000000000000" d="-6.605000000000"/>
|
||||
<point f="5000.000000000000" d="-8.210000000000"/>
|
||||
<point f="6300.000000000000" d="-9.980000000000"/>
|
||||
<point f="8000.000000000000" d="-11.894000000000"/>
|
||||
<point f="10000.000000000000" d="-13.734000000000"/>
|
||||
<point f="12500.000000000000" d="-15.609000000000"/>
|
||||
<point f="16000.000000000000" d="-17.708000000000"/>
|
||||
<point f="20000.000000000000" d="-19.620000000000"/>
|
||||
<point f="25000.000000000000" d="-21.542000000000"/>
|
||||
<point f="48000.000000000000" d="-27.187000000000"/>
|
||||
</curve>
|
||||
<curve name="Bass Boost">
|
||||
<point f="100.000000000000" d="9.000000000000"/>
|
||||
<point f="500.000000000000" d="0.000000000000"/>
|
||||
</curve>
|
||||
<curve name="Bass Cut">
|
||||
<point f="150.000000000000" d="-50.000000000000"/>
|
||||
<point f="300.000000000000" d="0.000000000000"/>
|
||||
</curve>
|
||||
<curve name="Treble Boost">
|
||||
<point f="4000.000000000000" d="0.000000000000"/>
|
||||
<point f="5000.000000000000" d="9.000000000000"/>
|
||||
</curve>
|
||||
<curve name="Treble Cut">
|
||||
<point f="6000.000000000000" d="0.000000000000"/>
|
||||
<point f="10000.000000000000" d="-110.000000000000"/>
|
||||
</curve>
|
||||
<curve name="unnamed"/>
|
||||
</equalizationeffect>
|
|
@ -964,7 +964,7 @@ EqualizationDialog::~EqualizationDialog()
|
|||
//
|
||||
void EqualizationDialog::LoadCurves(wxString fileName, bool append)
|
||||
{
|
||||
// Construct default curve filename
|
||||
// Construct normal curve filename
|
||||
//
|
||||
// LLL: Wouldn't you know that as of WX 2.6.2, there is a conflict
|
||||
// between wxStandardPaths and wxConfig under Linux. The latter
|
||||
|
@ -975,22 +975,31 @@ void EqualizationDialog::LoadCurves(wxString fileName, bool append)
|
|||
if(fileName == wxT(""))
|
||||
fn = wxFileName( FileNames::DataDir(), wxT("EQCurves.xml") );
|
||||
else
|
||||
fn = wxFileName(fileName);
|
||||
fn = wxFileName(fileName); // user is loading a specific set of curves
|
||||
|
||||
// If it doesn't exist...
|
||||
// If requested file doesn't exist...
|
||||
if( !fn.FileExists() )
|
||||
{ // Fallback to the default curves file in exe directory
|
||||
wxFileName exePath(PlatformCompatibility::GetExecutablePath());
|
||||
fn = wxFileName( exePath.GetPath(), wxT("EQCurves.xml") );
|
||||
wxString fullFn = fn.GetFullPath();
|
||||
{
|
||||
// look in data dir first, in case the user has their own defaults (maybe downloaded ones)
|
||||
fn = wxFileName( FileNames::DataDir(), wxT("EQDefaultCurves.xml") );
|
||||
if( !fn.FileExists() )
|
||||
{ // Default file not found. Give up and advise user
|
||||
{ // Default file not found in the data dir. Fall back to exe dir.
|
||||
wxFileName exePath(PlatformCompatibility::GetExecutablePath());
|
||||
fn = wxFileName( exePath.GetPath(), wxT("EQDefaultCurves.xml") );
|
||||
}
|
||||
if( !fn.FileExists() )
|
||||
{
|
||||
wxString errorMessage;
|
||||
errorMessage.Printf(_("EQCurves.xml not found on your system.\nPlease press 'help' to visit the download page.\n\nSave the curves at %s"), FileNames::DataDir().c_str());
|
||||
ShowErrorDialog(this, _("EQCurves.xml missing"),
|
||||
errorMessage, wxT("http://wiki.audacityteam.org/wiki/EQCurvesDownload"));
|
||||
mCurves.Add( _("unnamed") ); // we still need a default curve to use
|
||||
return;
|
||||
errorMessage.Printf(_("EQCurves.xml and EQDefaultCurves.xml were not found on your system.\nPlease press 'help' to visit the download page.\n\nSave the curves at %s"), FileNames::DataDir().c_str());
|
||||
ShowErrorDialog(this, _("EQCurves.xml and EQDefaultCurves.xml missing"),
|
||||
errorMessage, wxT("http://wiki.audacityteam.org/wiki/EQCurvesDownload"), false);
|
||||
// Have another go at finding EQCurves.xml in the data dir, in case 'help' helped
|
||||
fn = wxFileName( FileNames::DataDir(), wxT("EQDefaultCurves.xml") );
|
||||
if( !fn.FileExists() )
|
||||
{
|
||||
mCurves.Add( _("unnamed") ); // we still need a default curve to use
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3222,10 +3231,6 @@ void EditCurvesDialog::OnExport( wxCommandEvent &event )
|
|||
|
||||
void EditCurvesDialog::OnLibrary( wxCommandEvent &event )
|
||||
{
|
||||
/* Original code, now simpler
|
||||
wxString message = _("Please press 'help' to visit the download page.");
|
||||
ShowErrorDialog(this, _("Get more curves"),
|
||||
message, wxT("http://wiki.audacityteam.org/wiki/EQCurvesDownload")); */
|
||||
wxLaunchDefaultBrowser(wxT("http://wiki.audacityteam.org/wiki/EQCurvesDownload"));
|
||||
}
|
||||
|
||||
|
@ -3234,7 +3239,8 @@ void EditCurvesDialog::OnDefaults( wxCommandEvent &event )
|
|||
EQCurveArray temp;
|
||||
temp = mParent->mCurves;
|
||||
wxFileName exePath(PlatformCompatibility::GetExecutablePath());
|
||||
mParent->LoadCurves(wxFileName( exePath.GetPath(), wxT("EQCurves.xml")).GetFullPath() );
|
||||
// we expect this to fail in LoadCurves (due to a lack of path) and handle that there
|
||||
mParent->LoadCurves( wxT("EQDefaultCurves.xml") );
|
||||
mEditCurves = mParent->mCurves;
|
||||
mParent->mCurves = temp;
|
||||
PopulateList(0); // update the EditCurvesDialog dialog
|
||||
|
|
|
@ -43,10 +43,12 @@ class ErrorDialog : public wxDialog
|
|||
ErrorDialog(wxWindow *parent,
|
||||
const wxString & dlogTitle,
|
||||
const wxString & message,
|
||||
const wxString & helpURL);
|
||||
const wxString & helpURL,
|
||||
const bool Close = true);
|
||||
|
||||
private:
|
||||
wxString dhelpURL;
|
||||
bool dClose;
|
||||
|
||||
void OnOk( wxCommandEvent &event );
|
||||
void OnHelp( wxCommandEvent &event );
|
||||
|
@ -63,10 +65,12 @@ ErrorDialog::ErrorDialog(
|
|||
wxWindow *parent,
|
||||
const wxString & dlogTitle,
|
||||
const wxString & message,
|
||||
const wxString & helpURL):
|
||||
const wxString & helpURL,
|
||||
const bool Close):
|
||||
wxDialog(parent, (wxWindowID)-1, dlogTitle)
|
||||
{
|
||||
dhelpURL = helpURL;
|
||||
dClose = Close;
|
||||
|
||||
ShuttleGui S(this, eIsCreating);
|
||||
|
||||
|
@ -116,7 +120,6 @@ ErrorDialog::ErrorDialog(
|
|||
|
||||
void ErrorDialog::OnOk(wxCommandEvent &event)
|
||||
{
|
||||
|
||||
EndModal(true);
|
||||
}
|
||||
|
||||
|
@ -234,15 +237,17 @@ void ErrorDialog::OnHelp(wxCommandEvent &event)
|
|||
return;
|
||||
}
|
||||
OpenInDefaultBrowser( dhelpURL );
|
||||
EndModal(true);
|
||||
if(dClose)
|
||||
EndModal(true);
|
||||
}
|
||||
|
||||
void ShowErrorDialog(wxWindow *parent,
|
||||
const wxString &dlogTitle,
|
||||
const wxString &message,
|
||||
const wxString &helpURL)
|
||||
const wxString &helpURL,
|
||||
const bool Close)
|
||||
{
|
||||
ErrorDialog dlog(parent, dlogTitle, message, helpURL);
|
||||
ErrorDialog dlog(parent, dlogTitle, message, helpURL, Close);
|
||||
dlog.CentreOnParent();
|
||||
dlog.ShowModal();
|
||||
}
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
void ShowErrorDialog(wxWindow *parent,
|
||||
const wxString &dlogTitle,
|
||||
const wxString &message,
|
||||
const wxString &helpURL);
|
||||
const wxString &helpURL,
|
||||
bool Close = true);
|
||||
|
||||
/// Displays cutable information in a text ctrl, with an OK button.
|
||||
void ShowInfoDialog( wxWindow *parent,
|
||||
|
|
Loading…
Reference in New Issue