Mercurial > hg > tony
comparison src/MainWindow.cpp @ 323:8a884e1e3912
Wire up analysis menu functions to (stub) slots and (real) settings
author | Chris Cannam |
---|---|
date | Fri, 13 Jun 2014 14:06:48 +0100 |
parents | 68779eb910c7 |
children | ac662fca8058 d4c70bef4c25 |
comparison
equal
deleted
inserted
replaced
322:f48bf05409f5 | 323:8a884e1e3912 |
---|---|
815 m_keyReference->setCategory(tr("Analysis")); | 815 m_keyReference->setCategory(tr("Analysis")); |
816 | 816 |
817 action = new QAction(tr("&Analyse now"), this); | 817 action = new QAction(tr("&Analyse now"), this); |
818 action->setShortcut(tr("Ctrl+P")); | 818 action->setShortcut(tr("Ctrl+P")); |
819 action->setStatusTip(tr("Analyse audio now to extract pitches and notes. (This will delete all existing pitches and notes.)")); | 819 action->setStatusTip(tr("Analyse audio now to extract pitches and notes. (This will delete all existing pitches and notes.)")); |
820 connect(action, SIGNAL(triggered()), this, SLOT(analyseNow())); | |
820 menu->addAction(action); | 821 menu->addAction(action); |
821 m_keyReference->registerShortcut(action); | 822 m_keyReference->registerShortcut(action); |
822 | 823 |
823 menu->addSeparator(); | 824 menu->addSeparator(); |
825 | |
826 QSettings settings; | |
827 settings.beginGroup("Analyser"); | |
828 bool autoAnalyse = settings.value("auto-analysis", true).toBool(); | |
829 bool precise = settings.value("precision-analysis", false).toBool(); | |
830 settings.endGroup(); | |
824 | 831 |
825 action = new QAction(tr("Automatically Analyse &New Audio"), this); | 832 action = new QAction(tr("Automatically Analyse &New Audio"), this); |
826 action->setCheckable(true); | 833 action->setCheckable(true); |
827 action->setChecked(true); | 834 action->setChecked(autoAnalyse); |
835 connect(action, SIGNAL(triggered()), this, SLOT(autoAnalysisToggled())); | |
828 menu->addAction(action); | 836 menu->addAction(action); |
829 | 837 |
830 action = new QAction(tr("Analyse &Without Frequency-dependent Timing Bias (slow)"), this); | 838 action = new QAction(tr("Analyse &Without Frequency-dependent Timing Bias (slow)"), this); |
831 action->setCheckable(true); | 839 action->setCheckable(true); |
832 action->setChecked(false); | 840 action->setChecked(precise); |
833 | 841 connect(action, SIGNAL(triggered()), this, SLOT(precisionAnalysisToggled())); |
834 menu->addAction(action); | 842 menu->addAction(action); |
835 | 843 } |
844 | |
845 void | |
846 MainWindow::autoAnalysisToggled() | |
847 { | |
848 QAction *a = qobject_cast<QAction *>(sender()); | |
849 if (!a) return; | |
850 | |
851 bool set = a->isChecked(); | |
852 | |
853 QSettings settings; | |
854 settings.beginGroup("Analyser"); | |
855 settings.setValue("auto-analysis", set); | |
856 settings.endGroup(); | |
857 } | |
858 | |
859 void | |
860 MainWindow::precisionAnalysisToggled() | |
861 { | |
862 QAction *a = qobject_cast<QAction *>(sender()); | |
863 if (!a) return; | |
864 | |
865 bool set = a->isChecked(); | |
866 | |
867 QSettings settings; | |
868 settings.beginGroup("Analyser"); | |
869 settings.setValue("precision-analysis", set); | |
870 settings.endGroup(); | |
871 | |
872 analyseNow(); | |
836 } | 873 } |
837 | 874 |
838 void | 875 void |
839 MainWindow::setupHelpMenu() | 876 MainWindow::setupHelpMenu() |
840 { | 877 { |
2945 m_playTarget, SLOT(setOutputGain(float))); | 2982 m_playTarget, SLOT(setOutputGain(float))); |
2946 } | 2983 } |
2947 } | 2984 } |
2948 | 2985 |
2949 void | 2986 void |
2987 MainWindow::analyseNow() | |
2988 { | |
2989 //!!! | |
2990 cerr << "analyseNow called" << endl; | |
2991 } | |
2992 | |
2993 void | |
2950 MainWindow::analyseNewMainModel() | 2994 MainWindow::analyseNewMainModel() |
2951 { | 2995 { |
2952 WaveFileModel *model = getMainModel(); | 2996 WaveFileModel *model = getMainModel(); |
2953 | 2997 |
2954 cerr << "MainWindow::analyseNewMainModel: main model is " << model << endl; | 2998 cerr << "MainWindow::analyseNewMainModel: main model is " << model << endl; |