Mercurial > hg > sonic-visualiser
comparison main/MainWindow.cpp @ 508:26ebbe098bce
Add means to replace the main audio model
author | Chris Cannam |
---|---|
date | Mon, 02 Jul 2012 12:46:25 +0100 |
parents | 22ebffe22f16 |
children | f8833ed742fc |
comparison
equal
deleted
inserted
replaced
507:eb5f79d6eaa9 | 508:26ebbe098bce |
---|---|
460 iaction->setStatusTip(tr("Import an extra audio file into a new pane")); | 460 iaction->setStatusTip(tr("Import an extra audio file into a new pane")); |
461 connect(iaction, SIGNAL(triggered()), this, SLOT(importMoreAudio())); | 461 connect(iaction, SIGNAL(triggered()), this, SLOT(importMoreAudio())); |
462 connect(this, SIGNAL(canImportMoreAudio(bool)), iaction, SLOT(setEnabled(bool))); | 462 connect(this, SIGNAL(canImportMoreAudio(bool)), iaction, SLOT(setEnabled(bool))); |
463 m_keyReference->registerShortcut(iaction); | 463 m_keyReference->registerShortcut(iaction); |
464 | 464 |
465 // We want this one to go on the toolbar now, if we add it at all, | |
466 // but on the menu later | |
467 QAction *raction = new QAction(tr("Replace &Main Audio..."), this); | |
468 raction->setStatusTip(tr("Replace the main audio file of the session with a different file")); | |
469 connect(raction, SIGNAL(triggered()), this, SLOT(replaceMainAudio())); | |
470 connect(this, SIGNAL(canReplaceMainAudio(bool)), raction, SLOT(setEnabled(bool))); | |
471 | |
465 action = new QAction(tr("Open Lo&cation..."), this); | 472 action = new QAction(tr("Open Lo&cation..."), this); |
466 action->setShortcut(tr("Ctrl+Shift+O")); | 473 action->setShortcut(tr("Ctrl+Shift+O")); |
467 action->setStatusTip(tr("Open or import a file from a remote URL")); | 474 action->setStatusTip(tr("Open or import a file from a remote URL")); |
468 connect(action, SIGNAL(triggered()), this, SLOT(openLocation())); | 475 connect(action, SIGNAL(triggered()), this, SLOT(openLocation())); |
469 m_keyReference->registerShortcut(action); | 476 m_keyReference->registerShortcut(action); |
506 action->setStatusTip(tr("Import an existing audio file")); | 513 action->setStatusTip(tr("Import an existing audio file")); |
507 connect(action, SIGNAL(triggered()), this, SLOT(importAudio())); | 514 connect(action, SIGNAL(triggered()), this, SLOT(importAudio())); |
508 m_keyReference->registerShortcut(action); | 515 m_keyReference->registerShortcut(action); |
509 menu->addAction(action); | 516 menu->addAction(action); |
510 */ | 517 */ |
518 | |
519 // the Replace action we made earlier | |
520 menu->addAction(raction); | |
511 | 521 |
512 // the Import action we made earlier | 522 // the Import action we made earlier |
513 menu->addAction(iaction); | 523 menu->addAction(iaction); |
514 | 524 |
515 action = new QAction(tr("&Export Audio File..."), this); | 525 action = new QAction(tr("&Export Audio File..."), this); |
2296 { | 2306 { |
2297 QString path = getOpenFileName(FileFinder::AudioFile); | 2307 QString path = getOpenFileName(FileFinder::AudioFile); |
2298 | 2308 |
2299 if (path != "") { | 2309 if (path != "") { |
2300 if (openAudio(path, CreateAdditionalModel) == FileOpenFailed) { | 2310 if (openAudio(path, CreateAdditionalModel) == FileOpenFailed) { |
2311 emit hideSplash(); | |
2312 QMessageBox::critical(this, tr("Failed to open file"), | |
2313 tr("<b>File open failed</b><p>Audio file \"%1\" could not be opened").arg(path)); | |
2314 } | |
2315 } | |
2316 } | |
2317 | |
2318 void | |
2319 MainWindow::replaceMainAudio() | |
2320 { | |
2321 QString path = getOpenFileName(FileFinder::AudioFile); | |
2322 | |
2323 if (path != "") { | |
2324 if (openAudio(path, ReplaceMainModel) == FileOpenFailed) { | |
2301 emit hideSplash(); | 2325 emit hideSplash(); |
2302 QMessageBox::critical(this, tr("Failed to open file"), | 2326 QMessageBox::critical(this, tr("Failed to open file"), |
2303 tr("<b>File open failed</b><p>Audio file \"%1\" could not be opened").arg(path)); | 2327 tr("<b>File open failed</b><p>Audio file \"%1\" could not be opened").arg(path)); |
2304 } | 2328 } |
2305 } | 2329 } |