mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-28 06:08:40 +02:00
Break cycle of Prefs, Languages, FileNames
This commit is contained in:
parent
7d75f1bfc4
commit
a08bd5782b
@ -1358,13 +1358,15 @@ bool AudacityApp::OnInit()
|
||||
#endif
|
||||
|
||||
// Initialize preferences and language
|
||||
InitPreferences();
|
||||
wxFileName configFileName(FileNames::DataDir(), wxT("audacity.cfg"));
|
||||
InitPreferences( configFileName );
|
||||
PopulatePreferences();
|
||||
// This test must follow PopulatePreferences, because if an error message
|
||||
// must be shown, we need internationalization to have been initialized
|
||||
// first, which was done in PopulatePreferences
|
||||
if ( !CheckWritablePreferences() ) {
|
||||
::AudacityMessageBox( UnwritablePreferencesErrorMessage() );
|
||||
::AudacityMessageBox(
|
||||
UnwritablePreferencesErrorMessage( configFileName ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -60,10 +60,8 @@
|
||||
#include <wx/filename.h>
|
||||
#include <wx/stdpaths.h>
|
||||
|
||||
#include "FileNames.h"
|
||||
#include "Internat.h"
|
||||
#include "MemoryX.h"
|
||||
#include "Languages.h"
|
||||
|
||||
std::unique_ptr<AudacityPrefs> ugPrefs {};
|
||||
|
||||
@ -206,12 +204,10 @@ bool AudacityPrefs::GetEditClipsCanMove()
|
||||
return editClipsCanMove;
|
||||
}
|
||||
|
||||
void InitPreferences()
|
||||
void InitPreferences( const wxFileName &configFileName )
|
||||
{
|
||||
wxString appName = wxTheApp->GetAppName();
|
||||
|
||||
wxFileName configFileName(FileNames::DataDir(), wxT("audacity.cfg"));
|
||||
|
||||
ugPrefs = std::make_unique<AudacityPrefs>
|
||||
(appName, wxEmptyString,
|
||||
configFileName.GetFullPath(),
|
||||
@ -226,9 +222,8 @@ bool CheckWritablePreferences()
|
||||
return gPrefs->Write("/TEST", true) && gPrefs->Flush();
|
||||
}
|
||||
|
||||
wxString UnwritablePreferencesErrorMessage()
|
||||
wxString UnwritablePreferencesErrorMessage( const wxFileName &configFileName )
|
||||
{
|
||||
wxFileName configFileName(FileNames::DataDir(), wxT("audacity.cfg"));
|
||||
return wxString::Format(
|
||||
_("Audacity cannot start because the settings file at %s is not writable."),
|
||||
configFileName.GetFullPath()
|
||||
|
@ -37,9 +37,11 @@
|
||||
#include <wx/fileconf.h> // to inherit wxFileConfig
|
||||
#include <wx/event.h> // to declare custom event types
|
||||
|
||||
void InitPreferences();
|
||||
class wxFileName;
|
||||
|
||||
void InitPreferences( const wxFileName &configFileName );
|
||||
bool CheckWritablePreferences();
|
||||
wxString UnwritablePreferencesErrorMessage();
|
||||
wxString UnwritablePreferencesErrorMessage( const wxFileName &configFileName );
|
||||
void FinishPreferences();
|
||||
|
||||
class AudacityPrefs;
|
||||
|
Loading…
x
Reference in New Issue
Block a user