17#include "../images/Help.xpm"
20#include <wx/bmpbuttn.h>
22#include <wx/wfstream.h>
25 const wxString& appName,
26 const wxString& vendorName,
27 const wxString& localFilename,
28 const wxString& globalFilename,
32: wxFileConfig{ appName, vendorName, localFilename, globalFilename,
style, conv }
33, mLocalFilename(localFilename)
40 SetExpandEnvVars(
false);
54 bool canWrite =
false;
58 if (fd != -1 || errno == ENOENT)
74 if (canRead && canWrite)
89 const wxString& appName,
90 const wxString& vendorName,
91 const wxString& localFilename,
92 const wxString& globalFilename,
98 auto result = std::unique_ptr<AudacityFileConfig>{
100 appName, vendorName, localFilename, globalFilename,
style, conv } };
116 if (!wxFileExists(backup) || (wxRemove(backup) == 0))
126 if (stream.IsOk() && stream.Close())
128 if (!wxFileExists(backup) || (wxRemove(backup) == 0))
137 if (wxFileExists(backup))
155 wxButton *retryButton;
156 wxButton *quitButton;
159 S.StartVerticalLay(wxEXPAND, 1);
162 S.StartHorizontalLay(wxALIGN_RIGHT, 0);
165 XO(
"The following configuration file could not be accessed:\n\n"
167 "This could be caused by many reasons, but the most likely are that "
168 "the disk is full or you do not have write permissions to the file. "
170 "You can attempt to correct the issue and then click \"Retry\" to continue.\n\n"
171 "If you choose to \"Quit Audacity\", your project may be left in an unsaved "
172 "state which will be recovered the next time you open it.")
177 S.EndHorizontalLay();
180 S.StartHorizontalLay(wxALIGN_RIGHT, 0);
184 wxButton *b =
S.Id(wxID_HELP).AddBitmapButton(wxBitmap(Help_xpm));
185 b->SetToolTip(
XO(
"Help").Translation() );
186 b->SetLabel(
XO(
"Help").Translation());
188 b =
S.Id(wxID_CANCEL).AddButton(
XXO(
"&Quit Audacity"));
189 b =
S.Id(wxID_OK).AddButton(
XXO(
"&Retry"));
190 dlg.SetAffirmativeId(wxID_OK);
195 S.EndHorizontalLay();
200 dlg.GetSizer()->Fit(&dlg);
201 dlg.SetMinSize(dlg.GetSize());
204 auto onButton = [&](wxCommandEvent &e)
206 dlg.EndModal(e.GetId());
209 dlg.Bind(wxEVT_BUTTON, onButton);
211 switch (dlg.ShowModal())
219 "Error:_Audacity_settings_file_unwritable");
227 dlg.Unbind(wxEVT_BUTTON, onButton);
232 auto res = wxFileConfig::RenameEntry(oldName, newName);
242 auto res = wxFileConfig::RenameGroup(oldName, newName);
252 auto res = wxFileConfig::DeleteEntry(
key, bDeleteGroupIfEmpty);
262 auto res = wxFileConfig::DeleteGroup(
key);
272 auto res = wxFileConfig::DeleteAll();
282 bool res = wxFileConfig::DoWriteString(
key, szValue);
292 bool res = wxFileConfig::DoWriteLong(
key, lValue);
301bool AudacityFileConfig::DoWriteBinary(
const wxString&
key,
const wxMemoryBuffer& buf)
303 bool res = wxFileConfig::DoWriteBinary(
key, buf);
XXO("&Cut/Copy/Paste Toolbar")
Our own specialisation of FileConfig.
const wxString mLocalFilename
bool DeleteAll() override
static std::unique_ptr< AudacityFileConfig > Create(const wxString &appName={}, const wxString &vendorName={}, const wxString &localFilename={}, const wxString &globalFilename={}, long style=wxCONFIG_USE_LOCAL_FILE|wxCONFIG_USE_GLOBAL_FILE, const wxMBConv &conv=wxConvAuto())
Require a call to this factory, to guarantee proper two-phase initialization.
AudacityFileConfig(const wxString &appName, const wxString &vendorName, const wxString &localFilename, const wxString &globalFilename, long style, const wxMBConv &conv)
Disallow direct constructor call, because a two-phase initialization is required.
bool RenameEntry(const wxString &oldName, const wxString &newName) override
bool DeleteGroup(const wxString &key) override
~AudacityFileConfig() override
bool DoWriteLong(const wxString &key, long lValue) override
bool DoWriteString(const wxString &key, const wxString &szValue) override
bool RenameGroup(const wxString &oldName, const wxString &newName) override
bool Flush(bool bCurrentOnly) override
bool DeleteEntry(const wxString &key, bool bDeleteGroupIfEmpty) override
static const wxString HelpHostname
static const wxString HelpServerHomeDir
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
bool OpenInDefaultBrowser(const wxString &url)
Open an URL in default browser.