Mercurial > hg > sonic-visualiser
comparison main/MainWindow.cpp @ 518:90bac2cf39f1
Pull out app name into arg, pull down description label from superclass
author | Chris Cannam |
---|---|
date | Fri, 16 Nov 2012 13:21:44 +0000 |
parents | f8833ed742fc |
children | 581c72fb14a4 |
comparison
equal
deleted
inserted
replaced
517:a830a57084c2 | 518:90bac2cf39f1 |
---|---|
166 m_keyReference(new KeyReference()), | 166 m_keyReference(new KeyReference()), |
167 m_templateWatcher(0) | 167 m_templateWatcher(0) |
168 { | 168 { |
169 Profiler profiler("MainWindow::MainWindow"); | 169 Profiler profiler("MainWindow::MainWindow"); |
170 | 170 |
171 setWindowTitle(tr("Sonic Visualiser")); | 171 setWindowTitle(QApplication::applicationName()); |
172 | 172 |
173 UnitDatabase *udb = UnitDatabase::getInstance(); | 173 UnitDatabase *udb = UnitDatabase::getInstance(); |
174 udb->registerUnit("Hz"); | 174 udb->registerUnit("Hz"); |
175 udb->registerUnit("dB"); | 175 udb->registerUnit("dB"); |
176 udb->registerUnit("s"); | 176 udb->registerUnit("s"); |
428 | 428 |
429 QIcon icon = il.load("filenew"); | 429 QIcon icon = il.load("filenew"); |
430 icon.addPixmap(il.loadPixmap("filenew-22")); | 430 icon.addPixmap(il.loadPixmap("filenew-22")); |
431 QAction *action = new QAction(icon, tr("&New Session"), this); | 431 QAction *action = new QAction(icon, tr("&New Session"), this); |
432 action->setShortcut(tr("Ctrl+N")); | 432 action->setShortcut(tr("Ctrl+N")); |
433 action->setStatusTip(tr("Abandon the current Sonic Visualiser session and start a new one")); | 433 action->setStatusTip(tr("Abandon the current %1 session and start a new one").arg(QApplication::applicationName())); |
434 connect(action, SIGNAL(triggered()), this, SLOT(newSession())); | 434 connect(action, SIGNAL(triggered()), this, SLOT(newSession())); |
435 m_keyReference->registerShortcut(action); | 435 m_keyReference->registerShortcut(action); |
436 menu->addAction(action); | 436 menu->addAction(action); |
437 toolbar->addAction(action); | 437 toolbar->addAction(action); |
438 /* | 438 |
439 icon = il.load("fileopensession"); | |
440 action = new QAction(icon, tr("&Open Session..."), this); | |
441 action->setShortcut(tr("Ctrl+O")); | |
442 action->setStatusTip(tr("Open a previously saved Sonic Visualiser session file")); | |
443 connect(action, SIGNAL(triggered()), this, SLOT(openSession())); | |
444 m_keyReference->registerShortcut(action); | |
445 menu->addAction(action); | |
446 */ | |
447 icon = il.load("fileopen"); | 439 icon = il.load("fileopen"); |
448 icon.addPixmap(il.loadPixmap("fileopen-22")); | 440 icon.addPixmap(il.loadPixmap("fileopen-22")); |
449 action = new QAction(icon, tr("&Open..."), this); | 441 action = new QAction(icon, tr("&Open..."), this); |
450 action->setShortcut(tr("Ctrl+O")); | 442 action->setShortcut(tr("Ctrl+O")); |
451 action->setStatusTip(tr("Open a session file, audio file, or layer")); | 443 action->setStatusTip(tr("Open a session file, audio file, or layer")); |
486 | 478 |
487 icon = il.load("filesave"); | 479 icon = il.load("filesave"); |
488 icon.addPixmap(il.loadPixmap("filesave-22")); | 480 icon.addPixmap(il.loadPixmap("filesave-22")); |
489 action = new QAction(icon, tr("&Save Session"), this); | 481 action = new QAction(icon, tr("&Save Session"), this); |
490 action->setShortcut(tr("Ctrl+S")); | 482 action->setShortcut(tr("Ctrl+S")); |
491 action->setStatusTip(tr("Save the current session into a Sonic Visualiser session file")); | 483 action->setStatusTip(tr("Save the current session into a %1 session file").arg(QApplication::applicationName())); |
492 connect(action, SIGNAL(triggered()), this, SLOT(saveSession())); | 484 connect(action, SIGNAL(triggered()), this, SLOT(saveSession())); |
493 connect(this, SIGNAL(canSave(bool)), action, SLOT(setEnabled(bool))); | 485 connect(this, SIGNAL(canSave(bool)), action, SLOT(setEnabled(bool))); |
494 m_keyReference->registerShortcut(action); | 486 m_keyReference->registerShortcut(action); |
495 menu->addAction(action); | 487 menu->addAction(action); |
496 toolbar->addAction(action); | 488 toolbar->addAction(action); |
497 | 489 |
498 icon = il.load("filesaveas"); | 490 icon = il.load("filesaveas"); |
499 icon.addPixmap(il.loadPixmap("filesaveas-22")); | 491 icon.addPixmap(il.loadPixmap("filesaveas-22")); |
500 action = new QAction(icon, tr("Save Session &As..."), this); | 492 action = new QAction(icon, tr("Save Session &As..."), this); |
501 action->setShortcut(tr("Ctrl+Shift+S")); | 493 action->setShortcut(tr("Ctrl+Shift+S")); |
502 action->setStatusTip(tr("Save the current session into a new Sonic Visualiser session file")); | 494 action->setStatusTip(tr("Save the current session into a new %1 session file").arg(QApplication::applicationName())); |
503 connect(action, SIGNAL(triggered()), this, SLOT(saveSessionAs())); | 495 connect(action, SIGNAL(triggered()), this, SLOT(saveSessionAs())); |
504 menu->addAction(action); | 496 menu->addAction(action); |
505 toolbar->addAction(action); | 497 toolbar->addAction(action); |
506 | 498 |
507 menu->addSeparator(); | 499 menu->addSeparator(); |
583 | 575 |
584 menu->addSeparator(); | 576 menu->addSeparator(); |
585 action = new QAction(il.load("exit"), | 577 action = new QAction(il.load("exit"), |
586 tr("&Quit"), this); | 578 tr("&Quit"), this); |
587 action->setShortcut(tr("Ctrl+Q")); | 579 action->setShortcut(tr("Ctrl+Q")); |
588 action->setStatusTip(tr("Exit Sonic Visualiser")); | 580 action->setStatusTip(tr("Exit %1").arg(QApplication::applicationName())); |
589 connect(action, SIGNAL(triggered()), qApp, SLOT(closeAllWindows())); | 581 connect(action, SIGNAL(triggered()), qApp, SLOT(closeAllWindows())); |
590 m_keyReference->registerShortcut(action); | 582 m_keyReference->registerShortcut(action); |
591 menu->addAction(action); | 583 menu->addAction(action); |
592 } | 584 } |
593 | 585 |
1662 | 1654 |
1663 m_keyReference->setCategory(tr("Help")); | 1655 m_keyReference->setCategory(tr("Help")); |
1664 | 1656 |
1665 IconLoader il; | 1657 IconLoader il; |
1666 | 1658 |
1659 QString name = QApplication::applicationName(); | |
1660 | |
1667 QAction *action = new QAction(il.load("help"), | 1661 QAction *action = new QAction(il.load("help"), |
1668 tr("&Help Reference"), this); | 1662 tr("&Help Reference"), this); |
1669 action->setShortcut(tr("F1")); | 1663 action->setShortcut(tr("F1")); |
1670 action->setStatusTip(tr("Open the Sonic Visualiser reference manual")); | 1664 action->setStatusTip(tr("Open the %1 reference manual").arg(name)); |
1671 connect(action, SIGNAL(triggered()), this, SLOT(help())); | 1665 connect(action, SIGNAL(triggered()), this, SLOT(help())); |
1672 m_keyReference->registerShortcut(action); | 1666 m_keyReference->registerShortcut(action); |
1673 menu->addAction(action); | 1667 menu->addAction(action); |
1674 | 1668 |
1675 action = new QAction(tr("&Key and Mouse Reference"), this); | 1669 action = new QAction(tr("&Key and Mouse Reference"), this); |
1676 action->setShortcut(tr("F2")); | 1670 action->setShortcut(tr("F2")); |
1677 action->setStatusTip(tr("Open a window showing the keystrokes you can use in Sonic Visualiser")); | 1671 action->setStatusTip(tr("Open a window showing the keystrokes you can use in %1").arg(name)); |
1678 connect(action, SIGNAL(triggered()), this, SLOT(keyReference())); | 1672 connect(action, SIGNAL(triggered()), this, SLOT(keyReference())); |
1679 m_keyReference->registerShortcut(action); | 1673 m_keyReference->registerShortcut(action); |
1680 menu->addAction(action); | 1674 menu->addAction(action); |
1681 | 1675 |
1682 action = new QAction(tr("Sonic Visualiser on the &Web"), this); | 1676 action = new QAction(tr("%1 on the &Web").arg(name), this); |
1683 action->setStatusTip(tr("Open the Sonic Visualiser website")); | 1677 action->setStatusTip(tr("Open the %1 website").arg(name)); |
1684 connect(action, SIGNAL(triggered()), this, SLOT(website())); | 1678 connect(action, SIGNAL(triggered()), this, SLOT(website())); |
1685 menu->addAction(action); | 1679 menu->addAction(action); |
1686 | 1680 |
1687 action = new QAction(tr("&About Sonic Visualiser"), this); | 1681 action = new QAction(tr("&About %1").arg(name), this); |
1688 action->setStatusTip(tr("Show information about Sonic Visualiser")); | 1682 action->setStatusTip(tr("Show information about %1").arg(name)); |
1689 connect(action, SIGNAL(triggered()), this, SLOT(about())); | 1683 connect(action, SIGNAL(triggered()), this, SLOT(about())); |
1690 menu->addAction(action); | 1684 menu->addAction(action); |
1691 } | 1685 } |
1692 | 1686 |
1693 void | 1687 void |
2797 m_document = 0; | 2791 m_document = 0; |
2798 m_viewManager->clearSelections(); | 2792 m_viewManager->clearSelections(); |
2799 m_timeRulerLayer = 0; // document owned this | 2793 m_timeRulerLayer = 0; // document owned this |
2800 | 2794 |
2801 m_sessionFile = ""; | 2795 m_sessionFile = ""; |
2802 setWindowTitle(tr("Sonic Visualiser")); | 2796 setWindowTitle(QApplication::applicationName()); |
2803 | 2797 |
2804 CommandHistory::getInstance()->clear(); | 2798 CommandHistory::getInstance()->clear(); |
2805 CommandHistory::getInstance()->documentSaved(); | 2799 CommandHistory::getInstance()->documentSaved(); |
2806 documentRestored(); | 2800 documentRestored(); |
2807 } | 2801 } |
3252 | 3246 |
3253 if (!saveSessionFile(path)) { | 3247 if (!saveSessionFile(path)) { |
3254 QMessageBox::critical(this, tr("Failed to save file"), | 3248 QMessageBox::critical(this, tr("Failed to save file"), |
3255 tr("<b>Save failed</b><p>Session file \"%1\" could not be saved.").arg(path)); | 3249 tr("<b>Save failed</b><p>Session file \"%1\" could not be saved.").arg(path)); |
3256 } else { | 3250 } else { |
3257 setWindowTitle(tr("Sonic Visualiser: %1") | 3251 setWindowTitle(tr("%1: %1") |
3252 .arg(QApplication::applicationName()) | |
3258 .arg(QFileInfo(path).fileName())); | 3253 .arg(QFileInfo(path).fileName())); |
3259 m_sessionFile = path; | 3254 m_sessionFile = path; |
3260 CommandHistory::getInstance()->documentSaved(); | 3255 CommandHistory::getInstance()->documentSaved(); |
3261 documentRestored(); | 3256 documentRestored(); |
3262 m_recentFiles.addFile(path); | 3257 m_recentFiles.addFile(path); |