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

View File

@ -68,6 +68,8 @@ protected:
private: private:
TranslatableString caption; //!< Stored caption TranslatableString caption; //!< Stored caption
mutable bool moved { false }; //!< Whether @c *this has been the source of a copy 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. //! A MessageBoxException that shows a given, unvarying string.
@ -76,11 +78,14 @@ class SimpleMessageBoxException /* not final */ : public MessageBoxException
public: public:
explicit SimpleMessageBoxException( explicit SimpleMessageBoxException(
const TranslatableString &message_, //<! Message to show 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 } : MessageBoxException{ caption }
, message{ message_ } , message{ message_ }
{} {
helpUrl = helpUrl_;
}
~SimpleMessageBoxException() override; ~SimpleMessageBoxException() override;
SimpleMessageBoxException( const SimpleMessageBoxException& ) = default; SimpleMessageBoxException( const SimpleMessageBoxException& ) = default;

View File

@ -327,21 +327,18 @@ void DBConnection::CheckpointThread()
auto name = fName.GetFullName(); auto name = fName.GetFullName();
auto longname = name + "-wal"; auto longname = name + "-wal";
auto message1 = rc == SQLITE_FULL 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{}; : TranslatableString{};
auto message = XO( 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" "%s\n"
"Nothing has been lost, but you must not remove this file! " ).Format( message1 );
"Copy %s with its log file to another device, open it, and close to make "
"it complete."
).Format( longname, message1, name );
// Throw and catch and AudacityException, enqueuing the // Throw and catch and AudacityException, enqueuing the
// error message box for the event loop in the main thread // error message box for the event loop in the main thread
GuardedCall( [&message]{ GuardedCall( [&message]{
throw SimpleMessageBoxException{ throw SimpleMessageBoxException{
message, XO("Warning") }; } ); message, XO("Warning"), "Error:_Disk_full_or_not_writable" }; } );
// Stop trying to checkpoint // Stop trying to checkpoint
giveUp = true; giveUp = true;