comparison framework/MainWindowBase.cpp @ 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 48cfa4e2bfc1
comparison
equal deleted inserted replaced
578:702272b78bbe 579:1a8a8980f39a
1329 } else if (rdfType == RDFImporter::NotRDF) { 1329 } else if (rdfType == RDFImporter::NotRDF) {
1330 rdf = false; 1330 rdf = false;
1331 } 1331 }
1332 } 1332 }
1333 1333
1334 if (rdf) { 1334 try {
1335 if (rdfSession) { 1335 if (rdf) {
1336 bool cancel = false; 1336 if (rdfSession) {
1337 if (!canImportLayer || shouldCreateNewSessionForRDFAudio(&cancel)) { 1337 bool cancel = false;
1338 return openSession(source); 1338 if (!canImportLayer || shouldCreateNewSessionForRDFAudio(&cancel)) {
1339 } else if (cancel) { 1339 return openSession(source);
1340 return FileOpenCancelled; 1340 } else if (cancel) {
1341 return FileOpenCancelled;
1342 } else {
1343 return openLayer(source);
1344 }
1341 } else { 1345 } else {
1342 return openLayer(source); 1346 if ((status = openSession(source)) != FileOpenFailed) {
1347 return status;
1348 } else if (!canImportLayer) {
1349 return FileOpenWrongMode;
1350 } else if ((status = openLayer(source)) != FileOpenFailed) {
1351 return status;
1352 } else {
1353 return FileOpenFailed;
1354 }
1343 } 1355 }
1356 }
1357
1358 if (audio && (status = openAudio(source, mode)) != FileOpenFailed) {
1359 return status;
1360 } else if ((status = openSession(source)) != FileOpenFailed) {
1361 return status;
1362 } else if ((status = openPlaylist(source, mode)) != FileOpenFailed) {
1363 return status;
1364 } else if (!canImportLayer) {
1365 return FileOpenWrongMode;
1366 } else if ((status = openImage(source)) != FileOpenFailed) {
1367 return status;
1368 } else if ((status = openLayer(source)) != FileOpenFailed) {
1369 return status;
1344 } else { 1370 } else {
1345 if ((status = openSession(source)) != FileOpenFailed) { 1371 return FileOpenFailed;
1346 return status; 1372 }
1347 } else if (!canImportLayer) { 1373 } catch (const InsufficientDiscSpace &e) {
1348 return FileOpenWrongMode; 1374 emit hideSplash();
1349 } else if ((status = openLayer(source)) != FileOpenFailed) { 1375 m_openingAudioFile = false;
1350 return status; 1376 QMessageBox::critical
1351 } else { 1377 (this, tr("Not enough disc space"),
1352 return FileOpenFailed; 1378 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()));
1353 } 1379 return FileOpenFailed;
1354 }
1355 }
1356
1357 if (audio && (status = openAudio(source, mode)) != FileOpenFailed) {
1358 return status;
1359 } else if ((status = openSession(source)) != FileOpenFailed) {
1360 return status;
1361 } else if ((status = openPlaylist(source, mode)) != FileOpenFailed) {
1362 return status;
1363 } else if (!canImportLayer) {
1364 return FileOpenWrongMode;
1365 } else if ((status = openImage(source)) != FileOpenFailed) {
1366 return status;
1367 } else if ((status = openLayer(source)) != FileOpenFailed) {
1368 return status;
1369 } else {
1370 return FileOpenFailed;
1371 } 1380 }
1372 } 1381 }
1373 1382
1374 MainWindowBase::FileOpenStatus 1383 MainWindowBase::FileOpenStatus
1375 MainWindowBase::openAudio(FileSource source, AudioFileOpenMode mode, 1384 MainWindowBase::openAudio(FileSource source, AudioFileOpenMode mode,