mirror of
https://github.com/cookiengineer/audacity
synced 2025-04-30 07:39:42 +02:00
Update FAT filesystem messages
This commit is contained in:
parent
bd4cab5e93
commit
6a5d4fdbc0
@ -868,14 +868,16 @@ bool FileNames::IsOnFATFileSystem(const FilePath &path)
|
||||
}
|
||||
#endif
|
||||
|
||||
bool FileNames::FATFilesystemDenied( const FilePath &path, wxWindow *window /* = nullptr */ )
|
||||
bool FileNames::FATFilesystemDenied( const FilePath &path,
|
||||
const TranslatableString &msg,
|
||||
wxWindow *window /* = nullptr */ )
|
||||
{
|
||||
if (FileNames::IsOnFATFileSystem(path))
|
||||
{
|
||||
ShowErrorDialog(
|
||||
window,
|
||||
XO("Unsuitable"),
|
||||
XO("FAT formatted filesystems are unsuitable."),
|
||||
XO("%s\n\nFor tips on suitable drives, click the help button.").Format(msg),
|
||||
"Error:_Unsuitable_drive"
|
||||
);
|
||||
|
||||
|
@ -213,7 +213,9 @@ namespace FileNames
|
||||
|
||||
AUDACITY_DLL_API
|
||||
bool IsOnFATFileSystem(const FilePath &path);
|
||||
bool FATFilesystemDenied(const FilePath &path, wxWindow *window = nullptr);
|
||||
bool FATFilesystemDenied(const FilePath &path,
|
||||
const TranslatableString &msg,
|
||||
wxWindow *window = nullptr);
|
||||
|
||||
AUDACITY_DLL_API
|
||||
//! Give enough of the path to identify the device. (On Windows, drive letter plus ':')
|
||||
|
@ -269,7 +269,7 @@ bool ProjectFileManager::DoSave(const FilePath & fileName, const bool fromSaveAs
|
||||
|
||||
// Some confirmation dialogs
|
||||
{
|
||||
if (FileNames::FATFilesystemDenied(fileName))
|
||||
if (FileNames::FATFilesystemDenied(fileName, XO("Projects cannot be saved to FAT drives.")))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -587,7 +587,7 @@ bool ProjectFileManager::SaveCopy(const FilePath &fileName /* = wxT("") */)
|
||||
|
||||
filename.SetExt(wxT("aup3"));
|
||||
|
||||
if (FileNames::FATFilesystemDenied(filename.GetFullPath()))
|
||||
if (FileNames::FATFilesystemDenied(filename.GetFullPath(), XO("Projects cannot be saved to FAT drives.")))
|
||||
{
|
||||
if (project.mBatchMode)
|
||||
{
|
||||
|
@ -42,14 +42,15 @@ using namespace FileNames;
|
||||
class FilesystemValidator : public wxValidator
|
||||
{
|
||||
public:
|
||||
FilesystemValidator()
|
||||
FilesystemValidator(const TranslatableString &message)
|
||||
: wxValidator()
|
||||
{
|
||||
mMessage = message;
|
||||
}
|
||||
|
||||
virtual wxObject* Clone() const wxOVERRIDE
|
||||
{
|
||||
return safenew FilesystemValidator(*this);
|
||||
return safenew FilesystemValidator(mMessage);
|
||||
}
|
||||
|
||||
virtual bool Validate(wxWindow* WXUNUSED(parent)) wxOVERRIDE
|
||||
@ -59,7 +60,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
if (FATFilesystemDenied(tc->GetValue())) {
|
||||
if (FATFilesystemDenied(tc->GetValue(), mMessage)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -83,12 +84,14 @@ public:
|
||||
wxString path = tc->GetValue();
|
||||
path.insert(tc->GetInsertionPoint(), keycode);
|
||||
|
||||
if (FileNames::FATFilesystemDenied(path)) {
|
||||
if (FileNames::FATFilesystemDenied(path, mMessage)) {
|
||||
evt.Skip(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
TranslatableString mMessage;
|
||||
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
};
|
||||
|
||||
@ -167,8 +170,6 @@ void DirectoriesPrefs::Populate()
|
||||
|
||||
void DirectoriesPrefs::PopulateOrExchange(ShuttleGui &S)
|
||||
{
|
||||
FilesystemValidator validator;
|
||||
|
||||
S.SetBorder(2);
|
||||
S.StartScroller();
|
||||
|
||||
@ -195,7 +196,7 @@ void DirectoriesPrefs::PopulateOrExchange(ShuttleGui &S)
|
||||
{PreferenceKey(Operation::Save, PathType::User),
|
||||
wxT("")},
|
||||
30);
|
||||
mSaveText->SetValidator(validator);
|
||||
mSaveText->SetValidator(FilesystemValidator(XO("Projects cannot be saved to FAT drives.")));
|
||||
S.Id(SaveButtonID).AddButton(XXO("B&rowse..."));
|
||||
|
||||
S.Id(ImportTextID);
|
||||
@ -210,7 +211,6 @@ void DirectoriesPrefs::PopulateOrExchange(ShuttleGui &S)
|
||||
{PreferenceKey(Operation::Export, PathType::User),
|
||||
wxT("")},
|
||||
30);
|
||||
mExportText->SetValidator(validator);
|
||||
S.Id(ExportButtonID).AddButton(XXO("Bro&wse..."));
|
||||
}
|
||||
S.EndMultiColumn();
|
||||
@ -228,7 +228,7 @@ void DirectoriesPrefs::PopulateOrExchange(ShuttleGui &S)
|
||||
{PreferenceKey(Operation::Temp, PathType::_None),
|
||||
wxT("")},
|
||||
30);
|
||||
mTempText->SetValidator(validator);
|
||||
mTempText->SetValidator(FilesystemValidator(XO("Temporary files directory cannot be on a FAT drive.")));
|
||||
S.Id(TempButtonID).AddButton(XXO("Brow&se..."));
|
||||
|
||||
S.AddPrompt(XXO("&Free Space:"));
|
||||
@ -265,7 +265,8 @@ void DirectoriesPrefs::OnTempBrowse(wxCommandEvent &evt)
|
||||
wxFileName tmpDirPath;
|
||||
tmpDirPath.AssignDir(dlog.GetPath());
|
||||
|
||||
if (FATFilesystemDenied(tmpDirPath.GetFullPath())) {
|
||||
if (FATFilesystemDenied(tmpDirPath.GetFullPath(),
|
||||
XO("Temporary files directory cannot be on a FAT drive."))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -336,9 +337,10 @@ void DirectoriesPrefs::OnBrowse(wxCommandEvent &evt)
|
||||
return;
|
||||
}
|
||||
|
||||
if (evt.GetId() == SaveButtonID || evt.GetId() == ExportButtonID)
|
||||
if (evt.GetId() == SaveButtonID)
|
||||
{
|
||||
if (FATFilesystemDenied(dlog.GetPath()))
|
||||
if (FATFilesystemDenied(dlog.GetPath(),
|
||||
XO("Projects cannot be saved to FAT drives.")))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user