Audacity 3.2.0
Classes | Namespaces | Functions | Variables
DirectoriesPrefs.cpp File Reference
#include "DirectoriesPrefs.h"
#include <math.h>
#include <wx/defs.h>
#include <wx/log.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/dirdlg.h>
#include <wx/filefn.h>
#include <wx/filename.h>
#include "Prefs.h"
#include "ShuttleGui.h"
#include "TempDirectory.h"
#include "AudacityMessageBox.h"
#include "ReadOnlyText.h"
#include "FileNames.h"
Include dependency graph for DirectoriesPrefs.cpp:

Go to the source code of this file.

Classes

class  FilesystemValidator
 

Namespaces

namespace  anonymous_namespace{DirectoriesPrefs.cpp}
 

Functions

 wxBEGIN_EVENT_TABLE (FilesystemValidator, wxValidator) wxEND_EVENT_TABLE() enum
 
bool CreateDirectory (const wxString pathString, const TranslatableString &message)
 
PrefsPanel::Factory DirectoriesPrefsFactory ()
 

Variables

PrefsPanel::Registration anonymous_namespace{DirectoriesPrefs.cpp}::sAttachment
 

Function Documentation

◆ CreateDirectory()

bool CreateDirectory ( const wxString  pathString,
const TranslatableString message 
)

Definition at line 387 of file DirectoriesPrefs.cpp.

387 {
388 const wxFileName path { pathString };
389 int ans = AudacityMessageBox(
390 message +
391 XO("\nDirectory %s does not exist. Create it?")
392 .Format( pathString ),
393 XO("Warning"),
394 wxYES_NO | wxCENTRE | wxICON_EXCLAMATION);
395
396 if (ans != wxYES) {
397 return false;
398 }
399
400 if (!path.Mkdir(0755, wxPATH_MKDIR_FULL)) {
401 /* wxWidgets throws up a decent looking dialog */
402 using namespace BasicUI;
404 XO("Directory creation failed.") +
405 XO("\n%s").Format(message),
407 .Caption(XO("Error"))
408 .IconStyle(Icon::Error)
409 .ButtonStyle(Button::Ok)
410 );
411 return false;
412 }
413 return true;
414}
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
XO("Cut/Copy/Paste")
Abstract base class used in importing a file.
MessageBoxResult ShowMessageBox(const TranslatableString &message, MessageBoxOptions options={})
Show a modal message box with either Ok or Yes and No, and optionally Cancel.
Definition: BasicUI.h:287
MessageBoxOptions && Caption(TranslatableString caption_) &&
Definition: BasicUI.h:101

References AudacityMessageBox(), BasicUI::MessageBoxOptions::Caption(), BasicUI::ShowMessageBox(), and XO().

Referenced by DirectoriesPrefs::Validate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DirectoriesPrefsFactory()

PrefsPanel::Factory DirectoriesPrefsFactory ( )

A PrefsPanel::Factory that creates one DirectoriesPrefs panel. This one is used not only in the Preferences command.

Definition at line 516 of file DirectoriesPrefs.cpp.

517{
518 return [](wxWindow *parent, wxWindowID winid, AudacityProject *)
519 {
520 wxASSERT(parent); // to justify safenew
521 return safenew DirectoriesPrefs(parent, winid);
522 };
523}
#define safenew
Definition: MemoryX.h:10
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
A PrefsPanel used to select directories.

References safenew.

Referenced by AudacityApp::InitTempDir().

Here is the caller graph for this function:

◆ wxBEGIN_EVENT_TABLE()

wxBEGIN_EVENT_TABLE ( FilesystemValidator  ,
wxValidator   
)

Definition at line 107 of file DirectoriesPrefs.cpp.

112{
113 TempTextID = 1000,
114 TempButtonID,
115
116 TextsStart = 1010,
117 OpenTextID,
118 SaveTextID,
119 ImportTextID,
120 ExportTextID,
121 MacrosTextID,
122 TextsEnd,
123
124 ButtonsStart = 1020,
125 OpenButtonID,
129 MacrosButtonID,
130 ButtonsEnd
131};
@ SaveButtonID
@ ImportButtonID
@ ExportButtonID

References ExportButtonID, ImportButtonID, and SaveButtonID.