Audacity  3.0.3
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.


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  }
103  WarningDialog dlog(parent, message, footer, showCancelButton);
105  int retCode = dlog.ShowModal();
106  if (retCode == wxID_CANCEL)
107  return retCode;
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:
FileConfig * gPrefs
Definition: Prefs.cpp:70
#define XXO(s)
Definition: Internat.h:44
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
Definition: FileConfig.cpp:143
static const AudacityProject::AttachedObjects::RegisteredFactory key
Definition: CommandManager.cpp:201
wxString WarningDialogKey(const wxString &internalDialogName)
Definition: Prefs.cpp:415
Gives a warning message, that can be dismissed, with crucially the ability to not see similar warning...
Definition: Warning.cpp:33