1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-30 07:39:42 +02:00

UnitaryProject-25 Disk Full Errors

The disk full error text is now shorter/clearer and has a Help button with it.
This commit is contained in:
James Crook 2020-09-10 12:58:14 +01:00
parent 6e4f163317
commit f06b9a9c71
3 changed files with 31 additions and 14 deletions

View File

@ -15,6 +15,7 @@
#include <wx/atomic.h>
#include "widgets/AudacityMessageBox.h"
#include "widgets/ErrorDialog.h"
AudacityException::~AudacityException()
{
@ -40,6 +41,7 @@ MessageBoxException::MessageBoxException( const MessageBoxException& that )
{
caption = that.caption;
moved = that.moved;
helpUrl = that.helpUrl;
that.moved = true;
}
@ -69,12 +71,25 @@ void MessageBoxException::DelayedHandlerAction()
// displays its message. We assume that multiple messages have a
// common cause such as exhaustion of disk space so that the others
// give the user no useful added information.
if ( wxAtomicDec( sOutstandingMessages ) == 0 )
::AudacityMessageBox(
ErrorMessage(),
(caption.empty() ? AudacityMessageBoxCaptionStr() : caption),
wxICON_ERROR
);
if (helpUrl.IsEmpty())
{
::AudacityMessageBox(
ErrorMessage(),
(caption.empty() ? AudacityMessageBoxCaptionStr() : caption),
wxICON_ERROR
);
}
else
{
ShowErrorDialog(
nullptr,
(caption.empty() ? AudacityMessageBoxCaptionStr() : caption),
ErrorMessage(),
helpUrl);
}
moved = true;
}
}

View File

@ -68,6 +68,8 @@ protected:
private:
TranslatableString caption; //!< Stored caption
mutable bool moved { false }; //!< Whether @c *this has been the source of a copy
protected:
mutable wxString helpUrl{ "" };
};
//! A MessageBoxException that shows a given, unvarying string.
@ -76,11 +78,14 @@ class SimpleMessageBoxException /* not final */ : public MessageBoxException
public:
explicit SimpleMessageBoxException(
const TranslatableString &message_, //<! Message to show
const TranslatableString &caption = XO("Message") //<! Short caption in frame around message
const TranslatableString &caption = XO("Message"), //<! Short caption in frame around message
const wxString &helpUrl_ = "" // Optional URL for help.
)
: MessageBoxException{ caption }
, message{ message_ }
{}
{
helpUrl = helpUrl_;
}
~SimpleMessageBoxException() override;
SimpleMessageBoxException( const SimpleMessageBoxException& ) = default;

View File

@ -327,21 +327,18 @@ void DBConnection::CheckpointThread()
auto name = fName.GetFullName();
auto longname = name + "-wal";
auto message1 = rc == SQLITE_FULL
? XO("There is insufficient space in %s.\n" ).Format( path )
? XO("Could not write to %s.\n" ).Format( path )
: TranslatableString{};
auto message = XO(
"The database log file %s could not be cleaned up.\n"
"Disk is full. For tips on freeing up space, click the help button.\n"
"%s\n"
"Nothing has been lost, but you must not remove this file! "
"Copy %s with its log file to another device, open it, and close to make "
"it complete."
).Format( longname, message1, name );
).Format( message1 );
// Throw and catch and AudacityException, enqueuing the
// error message box for the event loop in the main thread
GuardedCall( [&message]{
throw SimpleMessageBoxException{
message, XO("Warning") }; } );
message, XO("Warning"), "Error:_Disk_full_or_not_writable" }; } );
// Stop trying to checkpoint
giveUp = true;