Audacity 3.2.0
Functions
Warning.h File Reference
#include <wx/defs.h>
Include dependency graph for Warning.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

AUDACITY_DLL_API const TranslatableStringDefaultWarningFooter ()
 
AUDACITY_DLL_API int ShowWarningDialog (wxWindow *parent, const wxString &internalDialogName, const TranslatableString &message, bool showCancelButton=false, const TranslatableString &footer=DefaultWarningFooter())
 

Function Documentation

◆ DefaultWarningFooter()

AUDACITY_DLL_API const TranslatableString & DefaultWarningFooter ( )

Definition at line 51 of file Warning.cpp.

52{
53 static auto result = XXO("Don't show this warning again");
54 return result;
55}
XXO("&Cut/Copy/Paste Toolbar")

References XXO().

Here is the call graph for this function:

◆ ShowWarningDialog()

AUDACITY_DLL_API int ShowWarningDialog ( wxWindow *  parent,
const wxString &  internalDialogName,
const TranslatableString message,
bool  showCancelButton = false,
const TranslatableString footer = DefaultWarningFooter() 
)

Displays a warning dialog with a check box. If the user checks the box, the internalDialogName is noted in the preferences. The internalDialogName is never seen by the user; it should be unique to each message.

Definition at line 90 of file Warning.cpp.

95{
96 auto key = WarningDialogKey(internalDialogName);
97 if (!gPrefs->Read(key, (long) true)) {
98 return wxID_OK;
99 }
100
101 WarningDialog dlog(parent, message, footer, showCancelButton);
102
103 int retCode = dlog.ShowModal();
104 if (retCode == wxID_CANCEL)
105 return retCode;
106
107 gPrefs->Write(key, (retCode == wxID_YES));
108 gPrefs->Flush();
109 return wxID_OK;
110}
static const AudacityProject::AttachedObjects::RegisteredFactory key
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
wxString WarningDialogKey(const wxString &internalDialogName)
Definition: Prefs.cpp:510
Gives a warning message, that can be dismissed, with crucially the ability to not see similar warning...
Definition: Warning.cpp:31
virtual bool Flush() noexcept=0
virtual bool Write(const wxString &key, bool value)=0
virtual bool Read(const wxString &key, bool *value) const =0

References audacity::BasicSettings::Flush(), gPrefs, key, audacity::BasicSettings::Read(), WarningDialogKey(), and audacity::BasicSettings::Write().

Referenced by anonymous_namespace{DropoutDetector.cpp}::DropoutSubscription::DropoutSubscription(), and ProjectFileManager::SaveAs().

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