Audacity  2.2.2
Public Member Functions | Private Member Functions | Private Attributes | List of all members
AutoRecoveryDialog Class Referencefinal

The AutoRecoveryDialog prompts the user whether to recover previous Audacity projects that were closed incorrectly. More...

Inheritance diagram for AutoRecoveryDialog:
wxDialogWrapper wxTabTraversalWrapper< wxDialog >

Public Member Functions

 AutoRecoveryDialog (wxWindow *parent)
 
- Public Member Functions inherited from wxDialogWrapper
 wxDialogWrapper ()
 
 wxDialogWrapper (wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const wxString &name=_("Dialog"))
 
bool Create (wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const wxString &name=_("Dialog"))
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxDialog >
 wxTabTraversalWrapper (Args &&...args)
 

Private Member Functions

void PopulateList ()
 
void PopulateOrExchange (ShuttleGui &S)
 
void OnQuitAudacity (wxCommandEvent &evt)
 
void OnRecoverNone (wxCommandEvent &evt)
 
void OnRecoverAll (wxCommandEvent &evt)
 

Private Attributes

wxListCtrl * mFileList
 

Detailed Description

The AutoRecoveryDialog prompts the user whether to recover previous Audacity projects that were closed incorrectly.

Definition at line 44 of file AutoRecovery.cpp.

Constructor & Destructor Documentation

AutoRecoveryDialog::AutoRecoveryDialog ( wxWindow *  parent)

Definition at line 63 of file AutoRecovery.cpp.

References eIsCreating, and PopulateOrExchange().

63  :
64  wxDialogWrapper(parent, -1, _("Automatic Crash Recovery"),
65  wxDefaultPosition, wxDefaultSize,
66  wxDEFAULT_DIALOG_STYLE & (~wxCLOSE_BOX)) // no close box
67 {
68  SetName(GetTitle());
69  ShuttleGui S(this, eIsCreating);
71 }
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
void PopulateOrExchange(ShuttleGui &S)
_("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

Member Function Documentation

void AutoRecoveryDialog::OnQuitAudacity ( wxCommandEvent &  evt)
private

Definition at line 135 of file AutoRecovery.cpp.

References ID_QUIT_AUDACITY.

136 {
137  EndModal(ID_QUIT_AUDACITY);
138 }
void AutoRecoveryDialog::OnRecoverAll ( wxCommandEvent &  evt)
private

Definition at line 150 of file AutoRecovery.cpp.

References ID_RECOVER_ALL.

151 {
152  EndModal(ID_RECOVER_ALL);
153 }
void AutoRecoveryDialog::OnRecoverNone ( wxCommandEvent &  evt)
private

Definition at line 140 of file AutoRecovery.cpp.

References _(), AudacityMessageBox(), and ID_RECOVER_NONE.

141 {
142  int ret = AudacityMessageBox(
143  _("Are you sure you want to discard all recoverable projects?\n\nChoosing \"Yes\" discards all recoverable projects immediately."),
144  _("Confirm Discard Projects"), wxICON_QUESTION | wxYES_NO | wxNO_DEFAULT, this);
145 
146  if (ret == wxYES)
147  EndModal(ID_RECOVER_NONE);
148 }
int AudacityMessageBox(const wxString &message, const wxString &caption=AudacityMessageBoxCaptionStr(), long style=wxOK|wxCENTRE, wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord)
Definition: ErrorDialog.h:92
_("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
void AutoRecoveryDialog::PopulateList ( )
private

Definition at line 118 of file AutoRecovery.cpp.

References FileNames::AutoSaveDir(), and mFileList.

119 {
120  mFileList->DeleteAllItems();
121 
122  wxDir dir(FileNames::AutoSaveDir());
123  if (!dir.IsOpened())
124  return;
125 
126  wxString filename;
127  int i = 0;
128  for (bool c = dir.GetFirst(&filename, wxT("*.autosave"), wxDIR_FILES);
129  c; c = dir.GetNext(&filename))
130  mFileList->InsertItem(i++, wxFileName{ filename }.GetName());
131 
132  mFileList->SetColumnWidth(0, wxLIST_AUTOSIZE);
133 }
wxListCtrl * mFileList
static wxString AutoSaveDir()
Definition: FileNames.cpp:109
void AutoRecoveryDialog::PopulateOrExchange ( ShuttleGui S)
private

Definition at line 79 of file AutoRecovery.cpp.

References _(), and ID_FILE_LIST.

Referenced by AutoRecoveryDialog().

80 {
81  S.SetBorder(5);
82  S.StartVerticalLay();
83  {
84  S.AddVariableText(_("Some projects were not saved properly the last time Audacity was run.\nFortunately, the following projects can be automatically recovered:"), false);
85 
86  S.StartStatic(_("Recoverable projects"));
87  {
89  /*i18n-hint: (noun). It's the name of the project to recover.*/
90  mFileList->InsertColumn(0, _("Name"));
91  mFileList->SetColumnWidth(0, wxLIST_AUTOSIZE);
92  PopulateList();
93  }
94  S.EndStatic();
95 
96  S.AddVariableText(_("After recovery, save the project to save the changes to disk."), false);
97 
99  {
100  S.Id(ID_QUIT_AUDACITY).AddButton(_("Quit Audacity"));
101  S.Id(ID_RECOVER_NONE).AddButton(_("Discard Projects"));
102  S.Id(ID_RECOVER_ALL).AddButton(_("Recover Projects"));
103  }
104  S.EndHorizontalLay();
105  }
106  S.EndVerticalLay();
107 
108  Layout();
109  Fit();
110  SetMinSize(GetSize());
111 
112  // Sometimes it centers on wxGTK and sometimes it doesn't.
113  // Yielding before centering seems to be a good workaround,
114  // but will leave to implement on a rainy day.
115  Center();
116 }
wxListCtrl * mFileList
void EndHorizontalLay()
void EndVerticalLay()
void StartHorizontalLay(int PositionFlags=wxALIGN_CENTRE, int iProp=1)
wxListCtrl * AddListControlReportMode()
Definition: ShuttleGui.cpp:689
ShuttleGui & Id(int id)
_("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
wxStaticText * AddVariableText(const wxString &Str, bool bCenter=false, int PositionFlags=0)
Definition: ShuttleGui.cpp:414
wxStaticBox * StartStatic(const wxString &Str, int iProp=0)
Definition: ShuttleGui.cpp:763
void SetBorder(int Border)
Definition: ShuttleGui.h:286
wxButton * AddButton(const wxString &Text, int PositionFlags=wxALIGN_CENTRE)
Definition: ShuttleGui.cpp:341
void StartVerticalLay(int iProp=1)

Member Data Documentation

wxListCtrl* AutoRecoveryDialog::mFileList
private

Definition at line 57 of file AutoRecovery.cpp.

Referenced by PopulateList().


The documentation for this class was generated from the following file: