Audacity  3.0.3
UnwritableLocationErrorDialog.cpp
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  UnwritableLocationError.h
6 
7  Dmitry Vedenko
8 
9 **********************************************************************/
10 
12 
13 #include "HelpSystem.h"
14 #include "ShuttleGui.h"
15 
16 #include "prefs/PrefsDialog.h"
18 
23 
24 UnwritableLocationErrorDialog::UnwritableLocationErrorDialog(wxWindow* parent, const wxString& path)
26  parent, -1, XO("Error"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX)
27 {
28  ShuttleGui S(this, eIsCreating);
29 
30  S.SetBorder(8);
31 
32  S.StartVerticalLay();
33  {
34  S.AddSpace(0, 12);
35 
37  {
38  S.AddSpace(12, 0);
39 
40  S.StartVerticalLay();
41  {
42  S.AddFixedText(
43  /* i18n-hint: %s is replaced with a directory path. */
44  XO("Unable to write files to directory: %s.").Format(path),
45  false, 500);
46 
47  S.AddFixedText(
48  /* i18n-hint: This message describes the error in the Error dialog. */
49  XO("Please check that the directory exists, has the necessary permissions, and the drive isn't full."),
50  false, 0);
51 
52  S.AddSpace(0, 8);
53 
54  AccessibleLinksFormatter preferencesMessage(
55  /* i18n-hint: %s is replaced with 'Preferences > Directories'. */
56  XO("You can change the directory in %s."));
57 
58  preferencesMessage.FormatLink(
59  /* i18n-hint: Hyperlink title that opens Preferences dialog on Directories page. */
60  wxT("%s"), XO("Preferences > Directories"), [parent, this]() {
61  EndModal(wxID_OK);
62 
63  GlobalPrefsDialog dialog(parent, nullptr);
64 
65  dialog.SelectPageByName(XO("Directories").Translation());
66  dialog.ShowModal();
67  });
68 
69 
70  preferencesMessage.Populate(S);
71  }
72  S.EndVerticalLay();
73 
74  S.AddSpace(12, 0);
75  }
76  S.EndHorizontalLay();
77 
78  S.AddSpace(0, 12);
79 
81  }
82  S.EndVerticalLay();
83 
84  Layout();
85  Fit();
86  Center();
87 }
88 
90 {
91 
92 }
93 
95 {
96  EndModal(wxID_OK);
97 }
98 
100 {
101  HelpSystem::ShowHelp(this, "Error:_Disk_full_or_not_writable", false);
102 }
PrefsDialog::ShowModal
int ShowModal() override
Definition: PrefsDialog.cpp:596
EVT_BUTTON
EVT_BUTTON(wxID_NO, DependencyDialog::OnNo) EVT_BUTTON(wxID_YES
eIsCreating
@ eIsCreating
Definition: ShuttleGui.h:38
ShuttleGuiBase::StartVerticalLay
void StartVerticalLay(int iProp=1)
Definition: ShuttleGui.cpp:1184
HelpSystem.h
eHelpButton
@ eHelpButton
Definition: ShuttleGui.h:604
UnwritableLocationErrorDialog::OnOk
void OnOk(wxCommandEvent &event)
Definition: UnwritableLocationErrorDialog.cpp:94
Format
Abstract base class used in importing a file.
PrefsDialog.h
ShuttleGui::AddSpace
wxSizerItem * AddSpace(int width, int height, int prop=0)
Definition: ShuttleGui.cpp:2459
XO
#define XO(s)
Definition: Internat.h:31
HelpSystem::ShowHelp
static void ShowHelp(wxWindow *parent, const FilePath &localFileName, const URLString &remoteURL, bool bModal=false, bool alwaysDefaultBrowser=false)
Definition: HelpSystem.cpp:237
UnwritableLocationErrorDialog::OnError
void OnError(wxCommandEvent &event)
Definition: UnwritableLocationErrorDialog.cpp:99
ShuttleGuiBase::EndHorizontalLay
void EndHorizontalLay()
Definition: ShuttleGui.cpp:1177
ShuttleGuiBase::StartHorizontalLay
void StartHorizontalLay(int PositionFlags=wxALIGN_CENTRE, int iProp=1)
Definition: ShuttleGui.cpp:1167
ShuttleGuiBase::EndVerticalLay
void EndVerticalLay()
Definition: ShuttleGui.cpp:1203
ShuttleGuiBase::AddFixedText
void AddFixedText(const TranslatableString &Str, bool bCenter=false, int wrapWidth=0)
Definition: ShuttleGui.cpp:440
PrefsDialog::SelectPageByName
void SelectPageByName(const wxString &pageName)
Definition: PrefsDialog.cpp:778
ShuttleGui.h
wxDialogWrapper
Definition: wxPanelWrapper.h:81
eOkButton
@ eOkButton
Definition: ShuttleGui.h:600
UnwritableLocationErrorDialog::~UnwritableLocationErrorDialog
virtual ~UnwritableLocationErrorDialog()
Definition: UnwritableLocationErrorDialog.cpp:89
GlobalPrefsDialog
Definition: PrefsDialog.h:81
ShuttleGui::AddStandardButtons
void AddStandardButtons(long buttons=eOkButton|eCancelButton, wxWindow *extra=NULL)
Definition: ShuttleGui.cpp:2444
UnwritableLocationErrorDialog
An error dialog about unwritable location, that allows to navigate to settings quickly.
Definition: UnwritableLocationErrorDialog.h:18
ShuttleGuiBase::SetBorder
void SetBorder(int Border)
Definition: ShuttleGui.h:489
UnwritableLocationErrorDialog.h
END_EVENT_TABLE
END_EVENT_TABLE()
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631