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)
48 bool canWrite =
false;
52 if (fd != -1 || errno == ENOENT)
68 if (canRead && canWrite)
83 const wxString& appName,
84 const wxString& vendorName,
85 const wxString& localFilename,
86 const wxString& globalFilename,
92 auto result = std::unique_ptr<AudacityFileConfig>{
94 appName, vendorName, localFilename, globalFilename, style, conv } };
110 if (!wxFileExists(backup) || (wxRemove(backup) == 0))
120 if (stream.IsOk() && stream.Close())
122 if (!wxFileExists(backup) || (wxRemove(backup) == 0))
131 if (wxFileExists(backup))
149 wxButton *retryButton;
150 wxButton *quitButton;
153 S.StartVerticalLay(wxEXPAND, 1);
156 S.StartHorizontalLay(wxALIGN_RIGHT, 0);
159 XO(
"The following configuration file could not be accessed:\n\n"
161 "This could be caused by many reasons, but the most likely are that "
162 "the disk is full or you do not have write permissions to the file. "
164 "You can attempt to correct the issue and then click \"Retry\" to continue.\n\n"
165 "If you choose to \"Quit Audacity\", your project may be left in an unsaved "
166 "state which will be recovered the next time you open it.")
171 S.EndHorizontalLay();
174 S.StartHorizontalLay(wxALIGN_RIGHT, 0);
178 wxButton *b =
S.Id(wxID_HELP).AddBitmapButton(wxBitmap(Help_xpm));
179 b->SetToolTip(
XO(
"Help").Translation() );
180 b->SetLabel(
XO(
"Help").Translation());
182 b =
S.Id(wxID_CANCEL).AddButton(
XXO(
"&Quit Audacity"));
183 b =
S.Id(wxID_OK).AddButton(
XXO(
"&Retry"));
184 dlg.SetAffirmativeId(wxID_OK);
189 S.EndHorizontalLay();
194 dlg.GetSizer()->Fit(&dlg);
195 dlg.SetMinSize(dlg.GetSize());
198 auto onButton = [&](wxCommandEvent &e)
200 dlg.EndModal(e.GetId());
203 dlg.Bind(wxEVT_BUTTON, onButton);
205 switch (dlg.ShowModal())
213 "Error:_Audacity_settings_file_unwritable");
221 dlg.Unbind(wxEVT_BUTTON, onButton);
226 auto res = wxFileConfig::RenameEntry(oldName, newName);
236 auto res = wxFileConfig::RenameGroup(oldName, newName);
246 auto res = wxFileConfig::DeleteEntry(
key, bDeleteGroupIfEmpty);
256 auto res = wxFileConfig::DeleteGroup(
key);
266 auto res = wxFileConfig::DeleteAll();
276 bool res = wxFileConfig::DoWriteString(
key, szValue);
286 bool res = wxFileConfig::DoWriteLong(
key, lValue);
295bool AudacityFileConfig::DoWriteBinary(
const wxString&
key,
const wxMemoryBuffer& buf)
297 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.