Audacity  3.0.3
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ErrorDialog Class Reference

Gives an Error message with an option for help. More...

#include <ErrorDialog.h>

Inheritance diagram for ErrorDialog:
[legend]
Collaboration diagram for ErrorDialog:
[legend]

Public Member Functions

 ErrorDialog (wxWindow *parent, const TranslatableString &dlogTitle, const TranslatableString &message, const ManualPageID &helpPage, const std::wstring &log, const bool Close=true, const bool modal=true)
 
virtual ~ErrorDialog ()
 
- Public Member Functions inherited from wxDialogWrapper
 wxDialogWrapper ()
 
 wxDialogWrapper (wxWindow *parent, wxWindowID id, const TranslatableString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const TranslatableString &name=XO("Dialog"))
 
bool Create (wxWindow *parent, wxWindowID id, const TranslatableString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const TranslatableString &name=XO("Dialog"))
 
void SetTitle (const TranslatableString &title)
 
void SetLabel (const TranslatableString &title)
 
void SetName (const TranslatableString &title)
 
void SetName ()
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxDialog >
 wxTabTraversalWrapper (Args &&... args)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Private Member Functions

void OnPane (wxCollapsiblePaneEvent &event)
 
void OnOk (wxCommandEvent &event)
 
void OnHelp (wxCommandEvent &event)
 

Private Attributes

ManualPageID dhelpPage
 
bool dClose
 
bool dModal
 

Detailed Description

Gives an Error message with an option for help.

Definition at line 25 of file ErrorDialog.h.

Constructor & Destructor Documentation

◆ ErrorDialog()

ErrorDialog::ErrorDialog ( wxWindow *  parent,
const TranslatableString dlogTitle,
const TranslatableString message,
const ManualPageID helpPage,
const std::wstring &  log,
const bool  Close = true,
const bool  modal = true 
)

Definition at line 49 of file ErrorDialog.cpp.

56 : wxDialogWrapper(parent, wxID_ANY, dlogTitle,
57  wxDefaultPosition, wxDefaultSize,
58  wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
59 {
60  SetName();
61 
62  long buttonMask;
63 
64  // only add the help button if we have a URL
65  buttonMask = (helpPage.empty()) ? eOkButton : (eHelpButton | eOkButton);
66  dhelpPage = helpPage;
67  dClose = Close;
68  dModal = modal;
69 
70  ShuttleGui S(this, eIsCreating);
71 
72  S.SetBorder(2);
73  S.StartHorizontalLay(wxEXPAND, 0);
74  {
75  S.SetBorder(20);
76  wxBitmap bitmap = wxArtProvider::GetBitmap(wxART_WARNING);
77  S.AddWindow(safenew wxStaticBitmap(S.GetParent(), -1, bitmap));
78 
79  S.SetBorder(20);
80  S.AddFixedText(message, false, 500);
81  }
82  S.EndHorizontalLay();
83 
84  S.SetBorder(2);
85  if (!log.empty())
86  {
87  S.StartHorizontalLay(wxEXPAND, 1);
88  {
89  S.SetBorder(5);
90 
91  auto pane = safenew wxCollapsiblePane(S.GetParent(),
92  wxID_ANY,
93  XO("Show &Log...").Translation());
94  S.Style(wxEXPAND | wxALIGN_LEFT);
95  S.Prop(1);
96  S.AddWindow(pane);
97 
98  ShuttleGui SI(pane->GetPane(), eIsCreating);
99  auto text = SI.AddTextWindow(log);
100  text->SetInsertionPointEnd();
101  text->ShowPosition(text->GetLastPosition());
102  text->SetMinSize(wxSize(700, 250));
103  }
104  S.EndHorizontalLay();
105  }
106 
107  S.SetBorder(2);
108  S.AddStandardButtons(buttonMask);
109 
110  Layout();
111  GetSizer()->Fit(this);
112  SetMinSize(GetSize());
113  Center();
114 }

References ShuttleGuiBase::AddFixedText(), ShuttleGui::AddStandardButtons(), ShuttleGuiBase::AddTextWindow(), ShuttleGuiBase::AddWindow(), eHelpButton, eIsCreating, ShuttleGuiBase::EndHorizontalLay(), eOkButton, ShuttleGuiBase::GetParent(), ShuttleGui::Prop(), safenew, ShuttleGuiBase::SetBorder(), ShuttleGuiBase::StartHorizontalLay(), ShuttleGui::Style(), and XO.

Here is the call graph for this function:

◆ ~ErrorDialog()

virtual ErrorDialog::~ErrorDialog ( )
inlinevirtual

Definition at line 36 of file ErrorDialog.h.

36 {}

Member Function Documentation

◆ OnHelp()

void ErrorDialog::OnHelp ( wxCommandEvent &  event)
private

Definition at line 132 of file ErrorDialog.cpp.

133 {
134  const auto &str = dhelpPage.GET();
135  if( str.StartsWith(wxT("innerlink:")) )
136  {
138  this,
139  TitleText(str.Mid( 10 ) ),
140  HelpText( str.Mid( 10 )),
141  false,
142  true );
143  return;
144  }
146  //OpenInDefaultBrowser( dhelpURL );
147  if(dClose)
148  EndModal(true);
149 }

References dClose, dhelpPage, Identifier::GET(), HelpText(), HelpSystem::ShowHelp(), HelpSystem::ShowHtmlText(), str, and TitleText().

Here is the call graph for this function:

◆ OnOk()

void ErrorDialog::OnOk ( wxCommandEvent &  event)
private

Definition at line 124 of file ErrorDialog.cpp.

125 {
126  if (dModal)
127  EndModal(true);
128  else
129  Destroy();
130 }

References dModal.

◆ OnPane()

void ErrorDialog::OnPane ( wxCollapsiblePaneEvent &  event)
private

Definition at line 116 of file ErrorDialog.cpp.

117 {
118  if (!event.GetCollapsed())
119  {
120  Center();
121  }
122 }

Member Data Documentation

◆ dClose

bool ErrorDialog::dClose
private

Definition at line 40 of file ErrorDialog.h.

Referenced by OnHelp().

◆ dhelpPage

ManualPageID ErrorDialog::dhelpPage
private

Definition at line 39 of file ErrorDialog.h.

Referenced by OnHelp().

◆ dModal

bool ErrorDialog::dModal
private

Definition at line 41 of file ErrorDialog.h.

Referenced by OnOk().


The documentation for this class was generated from the following files:
eIsCreating
@ eIsCreating
Definition: ShuttleGui.h:38
eHelpButton
@ eHelpButton
Definition: ShuttleGui.h:604
str
#define str(a)
Definition: DBConnection.cpp:30
ErrorDialog::dhelpPage
ManualPageID dhelpPage
Definition: ErrorDialog.h:39
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
HelpSystem::ShowHtmlText
static void ShowHtmlText(wxWindow *pParent, const TranslatableString &Title, const wxString &HtmlText, bool bIsFile=false, bool bModal=false)
Definition: HelpSystem.cpp:125
ErrorDialog::dClose
bool dClose
Definition: ErrorDialog.h:40
Identifier::GET
const wxString & GET() const
Explicit conversion to wxString, meant to be ugly-looking and demanding of a comment why it's correct...
Definition: Identifier.h:66
ErrorDialog::dModal
bool dModal
Definition: ErrorDialog.h:41
eOkButton
@ eOkButton
Definition: ShuttleGui.h:600
wxDialogWrapper::wxDialogWrapper
wxDialogWrapper()
Definition: wxPanelWrapper.h:84
wxDialogWrapper::SetName
void SetName()
Definition: wxPanelWrapper.cpp:81
HelpText
AUDACITY_DLL_API wxString HelpText(const wxString &Key)
safenew
#define safenew
Definition: MemoryX.h:10
TitleText
AUDACITY_DLL_API TranslatableString TitleText(const wxString &Key)
Identifier::empty
bool empty() const
Definition: Identifier.h:61
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631