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.


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


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  }
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