Audacity  3.0.3
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 53 of file Warning.cpp.

54 {
55  static auto result = XXO("Don't show this warning again");
56  return result;
57 }

References XXO.

◆ 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 92 of file Warning.cpp.

97 {
98  auto key = WarningDialogKey(internalDialogName);
99  if (!gPrefs->Read(key, (long) true)) {
100  return wxID_OK;
101  }
102 
103  WarningDialog dlog(parent, message, footer, showCancelButton);
104 
105  int retCode = dlog.ShowModal();
106  if (retCode == wxID_CANCEL)
107  return retCode;
108 
109  gPrefs->Write(key, (retCode == wxID_YES));
110  gPrefs->Flush();
111  return wxID_OK;
112 }

References FileConfig::Flush(), gPrefs, key, and WarningDialogKey().

Referenced by ExportCL::CheckFileName(), Exporter::CheckMix(), ProjectAudioManager::OnAudioIOStopRecording(), and ProjectFileManager::SaveAs().

Here is the call graph for this function:
Here is the caller graph for this function:
gPrefs
FileConfig * gPrefs
Definition: Prefs.cpp:70
XXO
#define XXO(s)
Definition: Internat.h:44
FileConfig::Flush
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
Definition: FileConfig.cpp:143
key
static const AudacityProject::AttachedObjects::RegisteredFactory key
Definition: CommandManager.cpp:201
WarningDialogKey
wxString WarningDialogKey(const wxString &internalDialogName)
Definition: Prefs.cpp:415
WarningDialog
Gives a warning message, that can be dismissed, with crucially the ability to not see similar warning...
Definition: Warning.cpp:33