Audacity 3.2.0
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 45 of file ErrorDialog.cpp.

52: wxDialogWrapper(parent, wxID_ANY, dlogTitle,
53 wxDefaultPosition, wxDefaultSize,
54 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
55{
56 SetName();
57
58 long buttonMask;
59
60 // only add the help button if we have a URL
61 buttonMask = (helpPage.empty()) ? eOkButton : (eHelpButton | eOkButton);
62 dhelpPage = helpPage;
63 dClose = Close;
64 dModal = modal;
65
67
68 S.SetBorder(2);
69 S.StartHorizontalLay(wxEXPAND, 0);
70 {
71 S.SetBorder(20);
72 wxBitmap bitmap = wxArtProvider::GetBitmap(wxART_WARNING);
73 S.AddWindow(safenew wxStaticBitmap(S.GetParent(), -1, bitmap));
74
75 S.SetBorder(20);
76 S.AddFixedText(message, false, 500);
77 }
78 S.EndHorizontalLay();
79
80 S.SetBorder(2);
81 if (!log.empty())
82 {
83 S.StartHorizontalLay(wxEXPAND, 1);
84 {
85 S.SetBorder(5);
86
87 auto pane = safenew wxCollapsiblePane(S.GetParent(),
88 wxID_ANY,
89 XO("Show &Log...").Translation());
90 S.Style(wxEXPAND | wxALIGN_LEFT);
91 S.Prop(1);
92 S.AddWindow(pane);
93
94 ShuttleGui SI(pane->GetPane(), eIsCreating);
95 auto text = SI.AddTextWindow(log);
96 text->SetInsertionPointEnd();
97 text->ShowPosition(text->GetLastPosition());
98 text->SetMinSize(wxSize(700, 250));
99 }
100 S.EndHorizontalLay();
101 }
102
103 S.SetBorder(2);
104 S.AddStandardButtons(buttonMask);
105
106 Layout();
107 GetSizer()->Fit(this);
108 SetMinSize(GetSize());
109 Center();
110}
XO("Cut/Copy/Paste")
#define safenew
Definition: MemoryX.h:10
@ eIsCreating
Definition: ShuttleGui.h:37
@ eOkButton
Definition: ShuttleGui.h:609
@ eHelpButton
Definition: ShuttleGui.h:613
#define S(N)
Definition: ToChars.cpp:64
ManualPageID dhelpPage
Definition: ErrorDialog.h:39
bool empty() const
Definition: Identifier.h:61
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640

References ShuttleGuiBase::AddTextWindow(), eHelpButton, eIsCreating, eOkButton, S, safenew, 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 128 of file ErrorDialog.cpp.

129{
130 const auto &str = dhelpPage.GET();
131 if( str.StartsWith(wxT("innerlink:")) )
132 {
134 this,
135 TitleText(str.Mid( 10 ) ),
136 HelpText( str.Mid( 10 )),
137 false,
138 true );
139 return;
140 }
142 //OpenInDefaultBrowser( dhelpURL );
143 if(dClose)
144 EndModal(true);
145}
wxT("CloseDown"))
#define str(a)
TranslatableString TitleText(const wxString &Key)
Definition: HelpText.cpp:127
wxString HelpText(const wxString &Key)
Definition: HelpText.cpp:238
static void ShowHelp(wxWindow *parent, const FilePath &localFileName, const URLString &remoteURL, bool bModal=false, bool alwaysDefaultBrowser=false)
Definition: HelpSystem.cpp:231
static void ShowHtmlText(wxWindow *pParent, const TranslatableString &Title, const wxString &HtmlText, bool bIsFile=false, bool bModal=false)
Definition: HelpSystem.cpp:119
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

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

Here is the call graph for this function:

◆ OnOk()

void ErrorDialog::OnOk ( wxCommandEvent &  event)
private

Definition at line 120 of file ErrorDialog.cpp.

121{
122 if (dModal)
123 EndModal(true);
124 else
125 Destroy();
126}

References dModal.

◆ OnPane()

void ErrorDialog::OnPane ( wxCollapsiblePaneEvent &  event)
private

Definition at line 112 of file ErrorDialog.cpp.

113{
114 if (!event.GetCollapsed())
115 {
116 Center();
117 }
118}

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: