comparison framework/MainWindowBase.cpp @ 413:a39a7d6b0f2d

Respond tidily to user cancellation during download, instead of going on to attempt to load the nonexistent file as a non-audio format
author Chris Cannam
date Tue, 09 Sep 2014 16:52:24 +0100
parents 41242512d544
children f32a64149602 9876a1db566c
comparison
equal deleted inserted replaced
411:7709bb9a1130 413:a39a7d6b0f2d
1266 templateName = getDefaultSessionTemplate(); 1266 templateName = getDefaultSessionTemplate();
1267 } 1267 }
1268 1268
1269 // cerr << "template is: \"" << templateName << "\"" << endl; 1269 // cerr << "template is: \"" << templateName << "\"" << endl;
1270 1270
1271 if (!source.isAvailable()) return FileOpenFailed; 1271 if (!source.isAvailable()) {
1272 if (source.wasCancelled()) {
1273 return FileOpenCancelled;
1274 } else {
1275 return FileOpenFailed;
1276 }
1277 }
1278
1272 source.waitForData(); 1279 source.waitForData();
1273 1280
1274 m_openingAudioFile = true; 1281 m_openingAudioFile = true;
1275 1282
1276 int rate = 0; 1283 int rate = 0;
1284 WaveFileModel *newModel = new WaveFileModel(source, rate); 1291 WaveFileModel *newModel = new WaveFileModel(source, rate);
1285 1292
1286 if (!newModel->isOK()) { 1293 if (!newModel->isOK()) {
1287 delete newModel; 1294 delete newModel;
1288 m_openingAudioFile = false; 1295 m_openingAudioFile = false;
1289 return FileOpenFailed; 1296 if (source.wasCancelled()) {
1297 return FileOpenCancelled;
1298 } else {
1299 return FileOpenFailed;
1300 }
1290 } 1301 }
1291 1302
1292 // cerr << "mode = " << mode << endl; 1303 // cerr << "mode = " << mode << endl;
1293 1304
1294 if (mode == AskUser) { 1305 if (mode == AskUser) {