Audacity 3.2.0
Functions
HelpUtilities.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void AUDACITY_DLL_API ShowDiagnostics (AudacityProject &project, const wxString &info, const TranslatableString &description, const wxString &defaultPath, bool fixedWidth=false)
 

Function Documentation

◆ ShowDiagnostics()

void AUDACITY_DLL_API ShowDiagnostics ( AudacityProject project,
const wxString &  info,
const TranslatableString description,
const wxString &  defaultPath,
bool  fixedWidth = false 
)

Definition at line 24 of file HelpUtilities.cpp.

28{
29 auto &window = GetProjectFrame( project );
30 wxDialogWrapper dlg( &window, wxID_ANY, description);
31 dlg.SetName();
33
34 wxTextCtrl *text;
35 S.StartVerticalLay();
36 {
37 text = S.Id(wxID_STATIC)
38 .Style(wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH)
39 .AddTextWindow("");
40
41 wxButton *save = safenew wxButton(S.GetParent(), wxID_OK, _("&Save"));
42 S.AddStandardButtons(eCancelButton, save);
43 }
44 S.EndVerticalLay();
45
46 if (fixedWidth) {
47 auto style = text->GetDefaultStyle();
48 style.SetFontFamily( wxFONTFAMILY_TELETYPE );
49 text->SetDefaultStyle(style);
50 }
51
52 *text << info;
53
54 dlg.SetSize(350, 450);
55
56 if (dlg.ShowModal() == wxID_OK)
57 {
58 const auto fileDialogTitle = XO("Save %s").Format( description );
59 wxString fName = SelectFile(FileNames::Operation::Export,
60 fileDialogTitle,
61 wxEmptyString,
62 defaultPath,
63 wxT("txt"),
65 wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
66 &window);
67 if (!fName.empty())
68 {
69 if (!text->SaveFile(fName))
70 {
72 XO("Unable to save %s").Format( description ),
73 fileDialogTitle);
74 }
75 }
76 }
77}
wxT("CloseDown"))
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
XO("Cut/Copy/Paste")
#define _(s)
Definition: Internat.h:73
#define safenew
Definition: MemoryX.h:10
AUDACITY_DLL_API wxFrame & GetProjectFrame(AudacityProject &project)
Get the top-level window associated with the project (as a wxFrame only, when you do not need to use ...
FilePath SelectFile(FileNames::Operation op, const TranslatableString &message, const FilePath &default_path, const FilePath &default_filename, const FileExtension &default_extension, const FileTypes &fileTypes, int flags, wxWindow *parent)
Definition: SelectFile.cpp:17
@ eIsCreating
Definition: ShuttleGui.h:37
@ eCancelButton
Definition: ShuttleGui.h:610
const auto project
#define S(N)
Definition: ToChars.cpp:64
FILES_API const FileType TextFiles
Definition: FileNames.h:73
Abstract base class used in importing a file.
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640

References _, AudacityMessageBox(), eCancelButton, eIsCreating, GetProjectFrame(), project, S, safenew, SelectFile(), wxDialogWrapper::SetName(), anonymous_namespace{AudacityDontAskAgainMessageDialog.cpp}::style, FileNames::TextFiles, wxT(), and XO().

Referenced by anonymous_namespace{HelpMenus.cpp}::OnAudioDeviceInfo(), anonymous_namespace{HelpMenus.cpp}::OnMenuTree(), and anonymous_namespace{NoteTrackMenuItems.cpp}::OnMidiDeviceInfo().

Here is the call graph for this function:
Here is the caller graph for this function: