Audacity  2.2.2
Functions
Warning.h File Reference
#include "../Audacity.h"
#include <wx/defs.h>
#include <wx/window.h>

Go to the source code of this file.

Functions

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

Function Documentation

const wxString& DefaultWarningFooter ( )

Definition at line 56 of file Warning.cpp.

References _().

57 {
58  return _("Don't show this warning again");
59 }
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom"))), OnMoveTrack) void TrackMenuTable::OnSetName(wxCommandEvent &)
int ShowWarningDialog ( wxWindow *  parent,
const wxString &  internalDialogName,
const wxString &  message,
bool  showCancelButton = false,
const wxString &  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.

References gPrefs, and WarningDialogKey().

Referenced by Exporter::CheckMix(), DirManager::DirManager(), AudacityProject::OnAudioIOStopRecording(), and AudacityProject::SaveAs().

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 }
wxString WarningDialogKey(const wxString &internalDialogName)
Definition: Warning.cpp:114
wxFileConfig * gPrefs
Definition: Prefs.cpp:72
Gives a warning message, that can be dismissed, with crucially the ability to not see similar warning...
Definition: Warning.cpp:35
wxString WarningDialogKey ( const wxString &  internalDialogName)

Return the config file key associated with a warning dialog identified by internalDialogName. When the box is checked, the value at the key becomes false.

Definition at line 114 of file Warning.cpp.

Referenced by RecordingPrefs::PopulateOrExchange(), ShowWarningDialog(), and AudioIO::StartStream().

115 {
116  return wxT("/Warnings/") + internalDialogName;
117 }