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)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
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 93 of file Warning.cpp.

References gPrefs, and WarningDialogKey().

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

98 {
99  auto key = WarningDialogKey(internalDialogName);
100  if (!gPrefs->Read(key, (long) true)) {
101  return wxID_OK;
102  }
104  WarningDialog dlog(parent, message, footer, showCancelButton);
106  int retCode = dlog.ShowModal();
107  if (retCode == wxID_CANCEL)
108  return retCode;
110  gPrefs->Write(key, (retCode == wxID_YES));
111  gPrefs->Flush();
112  return wxID_OK;
113 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
wxString WarningDialogKey(const wxString &internalDialogName)
Definition: Warning.cpp:115
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 115 of file Warning.cpp.

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

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