Mercurial > hg > tony
comparison src/MainWindow.cpp @ 427:46003a5a8736
Wire up reset-analysis-options
author | Chris Cannam |
---|---|
date | Mon, 30 Mar 2015 17:27:56 +0100 |
parents | ad8f94fb334d |
children | 9dad69cbf452 |
comparison
equal
deleted
inserted
replaced
426:835ce4c21362 | 427:46003a5a8736 |
---|---|
743 QAction *action = 0; | 743 QAction *action = 0; |
744 | 744 |
745 QMenu *menu = menuBar()->addMenu(tr("&Analysis")); | 745 QMenu *menu = menuBar()->addMenu(tr("&Analysis")); |
746 menu->setTearOffEnabled(true); | 746 menu->setTearOffEnabled(true); |
747 | 747 |
748 m_autoAnalyse = new QAction(tr("Auto-Analyse &New Audio"), this); | |
749 m_autoAnalyse->setStatusTip(tr("Automatically trigger analysis upon opening of a new audio file.")); | |
750 m_autoAnalyse->setCheckable(true); | |
751 connect(m_autoAnalyse, SIGNAL(triggered()), this, SLOT(autoAnalysisToggled())); | |
752 menu->addAction(m_autoAnalyse); | |
753 | |
754 action = new QAction(tr("&Analyse Now!"), this); | |
755 action->setStatusTip(tr("Trigger analysis of pitches and notes. (This will delete all existing pitches and notes.)")); | |
756 connect(action, SIGNAL(triggered()), this, SLOT(analyseNow())); | |
757 menu->addAction(action); | |
758 m_keyReference->registerShortcut(action); | |
759 | |
760 menu->addSeparator(); | |
761 | |
762 m_precise = new QAction(tr("&Unbiased Timing (slow)"), this); | |
763 m_precise->setStatusTip(tr("Use a symmetric window in YIN to remove frequency-dependent timing bias. (This is slow!)")); | |
764 m_precise->setCheckable(true); | |
765 connect(m_precise, SIGNAL(triggered()), this, SLOT(precisionAnalysisToggled())); | |
766 menu->addAction(m_precise); | |
767 | |
768 m_lowamp = new QAction(tr("&Penalise Soft Pitches"), this); | |
769 m_lowamp->setStatusTip(tr("Reduce the likelihood of detecting a pitch when the signal has low amplitude.")); | |
770 m_lowamp->setCheckable(true); | |
771 connect(m_lowamp, SIGNAL(triggered()), this, SLOT(lowampAnalysisToggled())); | |
772 menu->addAction(m_lowamp); | |
773 | |
774 m_onset = new QAction(tr("&High Onset Sensitivity"), this); | |
775 m_onset->setStatusTip(tr("Increase likelihood of separating notes, especially consecutive notes at the same pitch.")); | |
776 m_onset->setCheckable(true); | |
777 connect(m_onset, SIGNAL(triggered()), this, SLOT(onsetAnalysisToggled())); | |
778 menu->addAction(m_onset); | |
779 | |
780 m_prune = new QAction(tr("&Drop Short Notes"), this); | |
781 m_prune->setStatusTip(tr("Duration-based pruning: automatic note estimator will not output notes of less than 100ms duration.")); | |
782 m_prune->setCheckable(true); | |
783 connect(m_prune, SIGNAL(triggered()), this, SLOT(pruneAnalysisToggled())); | |
784 menu->addAction(m_prune); | |
785 | |
786 menu->addSeparator(); | |
787 | |
788 action = new QAction(tr("Reset Options to Defaults"), this); | |
789 action->setStatusTip(tr("Reset all of the Analyse menu options to their default settings.")); | |
790 connect(action, SIGNAL(triggered()), this, SLOT(resetAnalyseOptions())); | |
791 menu->addAction(action); | |
792 | |
793 updateAnalyseStates(); | |
794 } | |
795 | |
796 void | |
797 MainWindow::resetAnalyseOptions() | |
798 { | |
799 //!!! oh no, we need to update the menu states as well... | |
800 QSettings settings; | |
801 settings.beginGroup("Analyser"); | |
802 settings.setValue("auto-analysis", true); | |
803 settings.setValue("precision-analysis", false); | |
804 settings.setValue("lowamp-analysis", true); | |
805 settings.setValue("onset-analysis", true); | |
806 settings.setValue("prune-analysis", true); | |
807 settings.endGroup(); | |
808 updateAnalyseStates(); | |
809 } | |
810 | |
811 void | |
812 MainWindow::updateAnalyseStates() | |
813 { | |
748 QSettings settings; | 814 QSettings settings; |
749 settings.beginGroup("Analyser"); | 815 settings.beginGroup("Analyser"); |
750 bool autoAnalyse = settings.value("auto-analysis", true).toBool(); | 816 bool autoAnalyse = settings.value("auto-analysis", true).toBool(); |
751 bool precise = settings.value("precision-analysis", false).toBool(); | 817 bool precise = settings.value("precision-analysis", false).toBool(); |
752 bool lowamp = settings.value("lowamp-analysis", true).toBool(); | 818 bool lowamp = settings.value("lowamp-analysis", true).toBool(); |
753 bool onset = settings.value("onset-analysis", true).toBool(); | 819 bool onset = settings.value("onset-analysis", true).toBool(); |
754 bool prune = settings.value("prune-analysis", true).toBool(); | 820 bool prune = settings.value("prune-analysis", true).toBool(); |
755 settings.endGroup(); | 821 settings.endGroup(); |
756 | 822 |
757 action = new QAction(tr("Auto-Analyse &New Audio"), this); | 823 m_autoAnalyse->setChecked(autoAnalyse); |
758 action->setStatusTip(tr("Automatically trigger analysis upon opening of a new audio file.")); | 824 m_precise->setChecked(precise); |
759 action->setCheckable(true); | 825 m_lowamp->setChecked(lowamp); |
760 action->setChecked(autoAnalyse); | 826 m_onset->setChecked(onset); |
761 connect(action, SIGNAL(triggered()), this, SLOT(autoAnalysisToggled())); | 827 m_prune->setChecked(prune); |
762 menu->addAction(action); | |
763 | |
764 action = new QAction(tr("&Analyse Now!"), this); | |
765 action->setStatusTip(tr("Trigger analysis of pitches and notes. (This will delete all existing pitches and notes.)")); | |
766 connect(action, SIGNAL(triggered()), this, SLOT(analyseNow())); | |
767 menu->addAction(action); | |
768 m_keyReference->registerShortcut(action); | |
769 | |
770 menu->addSeparator(); | |
771 | |
772 action = new QAction(tr("&Unbiased Timing (slow)"), this); | |
773 action->setStatusTip(tr("Use a symmetric window in YIN to remove frequency-dependent timing bias. (This is slow!)")); | |
774 action->setCheckable(true); | |
775 action->setChecked(precise); | |
776 connect(action, SIGNAL(triggered()), this, SLOT(precisionAnalysisToggled())); | |
777 menu->addAction(action); | |
778 | |
779 action = new QAction(tr("&Penalise Soft Pitches"), this); | |
780 action->setStatusTip(tr("Reduce the likelihood of detecting a pitch when the signal has low amplitude.")); | |
781 action->setCheckable(true); | |
782 action->setChecked(lowamp); | |
783 connect(action, SIGNAL(triggered()), this, SLOT(lowampAnalysisToggled())); | |
784 menu->addAction(action); | |
785 | |
786 action = new QAction(tr("&High Onset Sensitivity"), this); | |
787 action->setStatusTip(tr("Increase likelihood of separating notes, especially consecutive notes at the same pitch.")); | |
788 action->setCheckable(true); | |
789 action->setChecked(onset); | |
790 connect(action, SIGNAL(triggered()), this, SLOT(onsetAnalysisToggled())); | |
791 menu->addAction(action); | |
792 | |
793 action = new QAction(tr("&Drop Short Notes"), this); | |
794 action->setStatusTip(tr("Duration-based pruning: automatic note estimator will not output notes of less than 100ms duration.")); | |
795 action->setCheckable(true); | |
796 action->setChecked(prune); | |
797 connect(action, SIGNAL(triggered()), this, SLOT(pruneAnalysisToggled())); | |
798 menu->addAction(action); | |
799 | |
800 menu->addSeparator(); | |
801 | |
802 action = new QAction(tr("Reset Options to Defaults"), this); | |
803 action->setStatusTip(tr("Reset all of the Analyse menu options to their default settings.")); | |
804 connect(action, SIGNAL(triggered()), this, SLOT(resetAnalyseOptions())); | |
805 menu->addAction(action); | |
806 } | 828 } |
807 | 829 |
808 void | 830 void |
809 MainWindow::autoAnalysisToggled() | 831 MainWindow::autoAnalysisToggled() |
810 { | 832 { |