Audacity  3.0.3
Classes | Functions
Warning.cpp File Reference
#include "Warning.h"
#include "../ShuttleGui.h"
#include <wx/artprov.h>
#include <wx/button.h>
#include <wx/checkbox.h>
#include <wx/intl.h>
#include <wx/sizer.h>
#include <wx/stattext.h>
#include "wxPanelWrapper.h"
Include dependency graph for Warning.cpp:

Go to the source code of this file.

Classes

class  WarningDialog
 Gives a warning message, that can be dismissed, with crucially the ability to not see similar warnings again for this session. More...
 

Functions

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

Function Documentation

◆ DefaultWarningFooter()

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()

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