Audacity  2.2.2
Classes | Functions
Warning.cpp File Reference
#include "../Audacity.h"
#include "Warning.h"
#include "../Prefs.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 "../Internat.h"

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 wxString & DefaultWarningFooter ()
int ShowWarningDialog (wxWindow *parent, const wxString &internalDialogName, const wxString &message, bool showCancelButton, const wxString &footer)
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")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), 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  }
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 }
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 }