# HG changeset patch # User Chris Cannam # Date 1483621470 0 # Node ID 1a8a8980f39a8e735c90837a4c2260248aafe7f1 # Parent 702272b78bbe54671b0c2fccb78ab74b85d9bfcb Handle running out of disc space when trying to open a file diff -r 702272b78bbe -r 1a8a8980f39a framework/MainWindowBase.cpp --- a/framework/MainWindowBase.cpp Wed Jan 04 19:10:32 2017 +0000 +++ b/framework/MainWindowBase.cpp Thu Jan 05 13:04:30 2017 +0000 @@ -1331,43 +1331,52 @@ } } - if (rdf) { - if (rdfSession) { - bool cancel = false; - if (!canImportLayer || shouldCreateNewSessionForRDFAudio(&cancel)) { - return openSession(source); - } else if (cancel) { - return FileOpenCancelled; + try { + if (rdf) { + if (rdfSession) { + bool cancel = false; + if (!canImportLayer || shouldCreateNewSessionForRDFAudio(&cancel)) { + return openSession(source); + } else if (cancel) { + return FileOpenCancelled; + } else { + return openLayer(source); + } } else { - return openLayer(source); - } - } else { - if ((status = openSession(source)) != FileOpenFailed) { - return status; - } else if (!canImportLayer) { - return FileOpenWrongMode; - } else if ((status = openLayer(source)) != FileOpenFailed) { - return status; - } else { - return FileOpenFailed; + if ((status = openSession(source)) != FileOpenFailed) { + return status; + } else if (!canImportLayer) { + return FileOpenWrongMode; + } else if ((status = openLayer(source)) != FileOpenFailed) { + return status; + } else { + return FileOpenFailed; + } } } - } - - if (audio && (status = openAudio(source, mode)) != FileOpenFailed) { - return status; - } else if ((status = openSession(source)) != FileOpenFailed) { - return status; - } else if ((status = openPlaylist(source, mode)) != FileOpenFailed) { - return status; - } else if (!canImportLayer) { - return FileOpenWrongMode; - } else if ((status = openImage(source)) != FileOpenFailed) { - return status; - } else if ((status = openLayer(source)) != FileOpenFailed) { - return status; - } else { - return FileOpenFailed; + + if (audio && (status = openAudio(source, mode)) != FileOpenFailed) { + return status; + } else if ((status = openSession(source)) != FileOpenFailed) { + return status; + } else if ((status = openPlaylist(source, mode)) != FileOpenFailed) { + return status; + } else if (!canImportLayer) { + return FileOpenWrongMode; + } else if ((status = openImage(source)) != FileOpenFailed) { + return status; + } else if ((status = openLayer(source)) != FileOpenFailed) { + return status; + } else { + return FileOpenFailed; + } + } catch (const InsufficientDiscSpace &e) { + emit hideSplash(); + m_openingAudioFile = false; + QMessageBox::critical + (this, tr("Not enough disc space"), + tr("Not enough disc space
There doesn't appear to be enough spare disc space to accommodate any necessary temporary files.
Please clear some space and try again.
").arg(e.what())); + return FileOpenFailed; } }