Mercurial > hg > svapp
changeset 579:1a8a8980f39a 3.0-integration
Handle running out of disc space when trying to open a file
author | Chris Cannam |
---|---|
date | Thu, 05 Jan 2017 13:04:30 +0000 |
parents | 702272b78bbe |
children | 298d864113f0 |
files | framework/MainWindowBase.cpp |
diffstat | 1 files changed, 43 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- 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("<b>Not enough disc space</b><p>There doesn't appear to be enough spare disc space to accommodate any necessary temporary files.</p><p>Please clear some space and try again.</p>").arg(e.what())); + return FileOpenFailed; } }