Mercurial > hg > sonic-visualiser
comparison main/MainWindow.cpp @ 247:587c79827c69
* (failed) attempt to hide splash screen when error occurs on startup
author | Chris Cannam |
---|---|
date | Tue, 11 Mar 2008 09:23:48 +0000 |
parents | 0c868fb3623c |
children | 842745edded8 |
comparison
equal
deleted
inserted
replaced
244:a47d7116aedf | 247:587c79827c69 |
---|---|
1972 { | 1972 { |
1973 QString path = getOpenFileName(FileFinder::AudioFile); | 1973 QString path = getOpenFileName(FileFinder::AudioFile); |
1974 | 1974 |
1975 if (path != "") { | 1975 if (path != "") { |
1976 if (openAudio(path, ReplaceMainModel) == FileOpenFailed) { | 1976 if (openAudio(path, ReplaceMainModel) == FileOpenFailed) { |
1977 emit hideSplash(); | |
1977 QMessageBox::critical(this, tr("Failed to open file"), | 1978 QMessageBox::critical(this, tr("Failed to open file"), |
1978 tr("<b>File open failed</b><p>Audio file \"%1\" could not be opened").arg(path)); | 1979 tr("<b>File open failed</b><p>Audio file \"%1\" could not be opened").arg(path)); |
1979 } | 1980 } |
1980 } | 1981 } |
1981 } | 1982 } |
1985 { | 1986 { |
1986 QString path = getOpenFileName(FileFinder::AudioFile); | 1987 QString path = getOpenFileName(FileFinder::AudioFile); |
1987 | 1988 |
1988 if (path != "") { | 1989 if (path != "") { |
1989 if (openAudio(path, CreateAdditionalModel) == FileOpenFailed) { | 1990 if (openAudio(path, CreateAdditionalModel) == FileOpenFailed) { |
1991 emit hideSplash(); | |
1990 QMessageBox::critical(this, tr("Failed to open file"), | 1992 QMessageBox::critical(this, tr("Failed to open file"), |
1991 tr("<b>File open failed</b><p>Audio file \"%1\" could not be opened").arg(path)); | 1993 tr("<b>File open failed</b><p>Audio file \"%1\" could not be opened").arg(path)); |
1992 } | 1994 } |
1993 } | 1995 } |
1994 } | 1996 } |
2122 if (path != "") { | 2124 if (path != "") { |
2123 | 2125 |
2124 FileOpenStatus status = openLayer(path); | 2126 FileOpenStatus status = openLayer(path); |
2125 | 2127 |
2126 if (status == FileOpenFailed) { | 2128 if (status == FileOpenFailed) { |
2129 emit hideSplash(); | |
2127 QMessageBox::critical(this, tr("Failed to open file"), | 2130 QMessageBox::critical(this, tr("Failed to open file"), |
2128 tr("<b>File open failed</b><p>Layer file %1 could not be opened.").arg(path)); | 2131 tr("<b>File open failed</b><p>Layer file %1 could not be opened.").arg(path)); |
2129 return; | 2132 return; |
2130 } else if (status == FileOpenWrongMode) { | 2133 } else if (status == FileOpenWrongMode) { |
2134 emit hideSplash(); | |
2131 QMessageBox::critical(this, tr("Failed to open file"), | 2135 QMessageBox::critical(this, tr("Failed to open file"), |
2132 tr("<b>Audio required</b><p>Please load at least one audio file before importing annotation data")); | 2136 tr("<b>Audio required</b><p>Please load at least one audio file before importing annotation data")); |
2133 } | 2137 } |
2134 } | 2138 } |
2135 } | 2139 } |
2393 QString path = getOpenFileName(FileFinder::SessionFile); | 2397 QString path = getOpenFileName(FileFinder::SessionFile); |
2394 | 2398 |
2395 if (path.isEmpty()) return; | 2399 if (path.isEmpty()) return; |
2396 | 2400 |
2397 if (openSessionFile(path) == FileOpenFailed) { | 2401 if (openSessionFile(path) == FileOpenFailed) { |
2402 emit hideSplash(); | |
2398 QMessageBox::critical(this, tr("Failed to open file"), | 2403 QMessageBox::critical(this, tr("Failed to open file"), |
2399 tr("<b>File open failed</b><p>Session file \"%1\" could not be opened").arg(path)); | 2404 tr("<b>File open failed</b><p>Session file \"%1\" could not be opened").arg(path)); |
2400 } | 2405 } |
2401 } | 2406 } |
2402 | 2407 |
2412 if (path.isEmpty()) return; | 2417 if (path.isEmpty()) return; |
2413 | 2418 |
2414 FileOpenStatus status = open(path, AskUser); | 2419 FileOpenStatus status = open(path, AskUser); |
2415 | 2420 |
2416 if (status == FileOpenFailed) { | 2421 if (status == FileOpenFailed) { |
2422 emit hideSplash(); | |
2417 QMessageBox::critical(this, tr("Failed to open file"), | 2423 QMessageBox::critical(this, tr("Failed to open file"), |
2418 tr("<b>File open failed</b><p>File \"%1\" could not be opened").arg(path)); | 2424 tr("<b>File open failed</b><p>File \"%1\" could not be opened").arg(path)); |
2419 } else if (status == FileOpenWrongMode) { | 2425 } else if (status == FileOpenWrongMode) { |
2426 emit hideSplash(); | |
2420 QMessageBox::critical(this, tr("Failed to open file"), | 2427 QMessageBox::critical(this, tr("Failed to open file"), |
2421 tr("<b>Audio required</b><p>Please load at least one audio file before importing annotation data")); | 2428 tr("<b>Audio required</b><p>Please load at least one audio file before importing annotation data")); |
2422 } | 2429 } |
2423 } | 2430 } |
2424 | 2431 |
2442 if (text.isEmpty()) return; | 2449 if (text.isEmpty()) return; |
2443 | 2450 |
2444 FileOpenStatus status = open(text); | 2451 FileOpenStatus status = open(text); |
2445 | 2452 |
2446 if (status == FileOpenFailed) { | 2453 if (status == FileOpenFailed) { |
2454 emit hideSplash(); | |
2447 QMessageBox::critical(this, tr("Failed to open location"), | 2455 QMessageBox::critical(this, tr("Failed to open location"), |
2448 tr("<b>Open failed</b><p>URL \"%1\" could not be opened").arg(text)); | 2456 tr("<b>Open failed</b><p>URL \"%1\" could not be opened").arg(text)); |
2449 } else if (status == FileOpenWrongMode) { | 2457 } else if (status == FileOpenWrongMode) { |
2458 emit hideSplash(); | |
2450 QMessageBox::critical(this, tr("Failed to open location"), | 2459 QMessageBox::critical(this, tr("Failed to open location"), |
2451 tr("<b>Audio required</b><p>Please load at least one audio file before importing annotation data")); | 2460 tr("<b>Audio required</b><p>Please load at least one audio file before importing annotation data")); |
2452 } | 2461 } |
2453 } | 2462 } |
2454 | 2463 |
2468 if (path == "") return; | 2477 if (path == "") return; |
2469 | 2478 |
2470 FileOpenStatus status = open(path); | 2479 FileOpenStatus status = open(path); |
2471 | 2480 |
2472 if (status == FileOpenFailed) { | 2481 if (status == FileOpenFailed) { |
2482 emit hideSplash(); | |
2473 QMessageBox::critical(this, tr("Failed to open location"), | 2483 QMessageBox::critical(this, tr("Failed to open location"), |
2474 tr("<b>Open failed</b><p>File or URL \"%1\" could not be opened").arg(path)); | 2484 tr("<b>Open failed</b><p>File or URL \"%1\" could not be opened").arg(path)); |
2475 } else if (status == FileOpenWrongMode) { | 2485 } else if (status == FileOpenWrongMode) { |
2486 emit hideSplash(); | |
2476 QMessageBox::critical(this, tr("Failed to open location"), | 2487 QMessageBox::critical(this, tr("Failed to open location"), |
2477 tr("<b>Audio required</b><p>Please load at least one audio file before importing annotation data")); | 2488 tr("<b>Audio required</b><p>Please load at least one audio file before importing annotation data")); |
2478 } | 2489 } |
2479 } | 2490 } |
2480 | 2491 |
2504 for (QStringList::iterator i = uriList.begin(); i != uriList.end(); ++i) { | 2515 for (QStringList::iterator i = uriList.begin(); i != uriList.end(); ++i) { |
2505 | 2516 |
2506 FileOpenStatus status = open(*i, ReplaceCurrentPane); | 2517 FileOpenStatus status = open(*i, ReplaceCurrentPane); |
2507 | 2518 |
2508 if (status == FileOpenFailed) { | 2519 if (status == FileOpenFailed) { |
2520 emit hideSplash(); | |
2509 QMessageBox::critical(this, tr("Failed to open dropped URL"), | 2521 QMessageBox::critical(this, tr("Failed to open dropped URL"), |
2510 tr("<b>Open failed</b><p>Dropped URL \"%1\" could not be opened").arg(*i)); | 2522 tr("<b>Open failed</b><p>Dropped URL \"%1\" could not be opened").arg(*i)); |
2511 } else if (status == FileOpenWrongMode) { | 2523 } else if (status == FileOpenWrongMode) { |
2524 emit hideSplash(); | |
2512 QMessageBox::critical(this, tr("Failed to open dropped URL"), | 2525 QMessageBox::critical(this, tr("Failed to open dropped URL"), |
2513 tr("<b>Audio required</b><p>Please load at least one audio file before importing annotation data")); | 2526 tr("<b>Audio required</b><p>Please load at least one audio file before importing annotation data")); |
2514 } | 2527 } |
2515 } | 2528 } |
2516 } | 2529 } |
2629 // Called before some destructive operation (e.g. new session, | 2642 // Called before some destructive operation (e.g. new session, |
2630 // exit program). Return true if we can safely proceed, false to | 2643 // exit program). Return true if we can safely proceed, false to |
2631 // cancel. | 2644 // cancel. |
2632 | 2645 |
2633 if (!m_documentModified) return true; | 2646 if (!m_documentModified) return true; |
2647 | |
2648 emit hideSplash(); | |
2634 | 2649 |
2635 int button = | 2650 int button = |
2636 QMessageBox::warning(this, | 2651 QMessageBox::warning(this, |
2637 tr("Session modified"), | 2652 tr("Session modified"), |
2638 tr("<b>Session modified</b><p>The current session has been modified.<br>Do you want to save it?"), | 2653 tr("<b>Session modified</b><p>The current session has been modified.<br>Do you want to save it?"), |
3200 void | 3215 void |
3201 MainWindow::sampleRateMismatch(size_t requested, size_t actual, | 3216 MainWindow::sampleRateMismatch(size_t requested, size_t actual, |
3202 bool willResample) | 3217 bool willResample) |
3203 { | 3218 { |
3204 if (!willResample) { | 3219 if (!willResample) { |
3220 emit hideSplash(); | |
3205 QMessageBox::information | 3221 QMessageBox::information |
3206 (this, tr("Sample rate mismatch"), | 3222 (this, tr("Sample rate mismatch"), |
3207 tr("<b>Wrong sample rate</b><p>The sample rate of this audio file (%1 Hz) does not match\nthe current playback rate (%2 Hz).<p>The file will play at the wrong speed and pitch.<p>Change the <i>Resample mismatching files on import</i> option under <i>File</i> -> <i>Preferences</i> if you want to alter this behaviour.") | 3223 tr("<b>Wrong sample rate</b><p>The sample rate of this audio file (%1 Hz) does not match\nthe current playback rate (%2 Hz).<p>The file will play at the wrong speed and pitch.<p>Change the <i>Resample mismatching files on import</i> option under <i>File</i> -> <i>Preferences</i> if you want to alter this behaviour.") |
3208 .arg(requested).arg(actual)); | 3224 .arg(requested).arg(actual)); |
3209 } | 3225 } |
3297 } | 3313 } |
3298 | 3314 |
3299 void | 3315 void |
3300 MainWindow::modelGenerationFailed(QString transformName, QString message) | 3316 MainWindow::modelGenerationFailed(QString transformName, QString message) |
3301 { | 3317 { |
3318 emit hideSplash(); | |
3319 | |
3302 if (message != "") { | 3320 if (message != "") { |
3303 | 3321 |
3304 QMessageBox::warning | 3322 QMessageBox::warning |
3305 (this, | 3323 (this, |
3306 tr("Failed to generate layer"), | 3324 tr("Failed to generate layer"), |
3318 } | 3336 } |
3319 | 3337 |
3320 void | 3338 void |
3321 MainWindow::modelGenerationWarning(QString transformName, QString message) | 3339 MainWindow::modelGenerationWarning(QString transformName, QString message) |
3322 { | 3340 { |
3341 emit hideSplash(); | |
3342 | |
3323 QMessageBox::warning | 3343 QMessageBox::warning |
3324 (this, tr("Warning"), message, QMessageBox::Ok); | 3344 (this, tr("Warning"), message, QMessageBox::Ok); |
3325 } | 3345 } |
3326 | 3346 |
3327 void | 3347 void |
3328 MainWindow::modelRegenerationFailed(QString layerName, | 3348 MainWindow::modelRegenerationFailed(QString layerName, |
3329 QString transformName, QString message) | 3349 QString transformName, QString message) |
3330 { | 3350 { |
3351 emit hideSplash(); | |
3352 | |
3331 if (message != "") { | 3353 if (message != "") { |
3332 | 3354 |
3333 QMessageBox::warning | 3355 QMessageBox::warning |
3334 (this, | 3356 (this, |
3335 tr("Failed to regenerate layer"), | 3357 tr("Failed to regenerate layer"), |
3348 | 3370 |
3349 void | 3371 void |
3350 MainWindow::modelRegenerationWarning(QString layerName, | 3372 MainWindow::modelRegenerationWarning(QString layerName, |
3351 QString transformName, QString message) | 3373 QString transformName, QString message) |
3352 { | 3374 { |
3375 emit hideSplash(); | |
3376 | |
3353 QMessageBox::warning | 3377 QMessageBox::warning |
3354 (this, tr("Warning"), tr("<b>Warning when regenerating layer</b><p>When regenerating the derived layer \"%1\" using new data model as input:<p>%2").arg(layerName).arg(message), QMessageBox::Ok); | 3378 (this, tr("Warning"), tr("<b>Warning when regenerating layer</b><p>When regenerating the derived layer \"%1\" using new data model as input:<p>%2").arg(layerName).arg(message), QMessageBox::Ok); |
3355 } | 3379 } |
3356 | 3380 |
3357 void | 3381 void |
3358 MainWindow::alignmentFailed(QString transformName, QString message) | 3382 MainWindow::alignmentFailed(QString transformName, QString message) |
3359 { | 3383 { |
3384 emit hideSplash(); | |
3385 | |
3360 QMessageBox::warning | 3386 QMessageBox::warning |
3361 (this, | 3387 (this, |
3362 tr("Failed to calculate alignment"), | 3388 tr("Failed to calculate alignment"), |
3363 tr("<b>Alignment calculation failed</b><p>Failed to calculate an audio alignment using transform \"%1\":<p>%2") | 3389 tr("<b>Alignment calculation failed</b><p>Failed to calculate an audio alignment using transform \"%1\":<p>%2") |
3364 .arg(transformName).arg(message), | 3390 .arg(transformName).arg(message), |