Mercurial > hg > tony
diff 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 |
line wrap: on
line diff
--- a/src/MainWindow.cpp Fri Jun 13 13:51:25 2014 +0100 +++ b/src/MainWindow.cpp Fri Jun 13 14:06:48 2014 +0100 @@ -817,22 +817,59 @@ action = new QAction(tr("&Analyse now"), this); action->setShortcut(tr("Ctrl+P")); action->setStatusTip(tr("Analyse audio now to extract pitches and notes. (This will delete all existing pitches and notes.)")); + connect(action, SIGNAL(triggered()), this, SLOT(analyseNow())); menu->addAction(action); m_keyReference->registerShortcut(action); menu->addSeparator(); + QSettings settings; + settings.beginGroup("Analyser"); + bool autoAnalyse = settings.value("auto-analysis", true).toBool(); + bool precise = settings.value("precision-analysis", false).toBool(); + settings.endGroup(); + action = new QAction(tr("Automatically Analyse &New Audio"), this); action->setCheckable(true); - action->setChecked(true); + action->setChecked(autoAnalyse); + connect(action, SIGNAL(triggered()), this, SLOT(autoAnalysisToggled())); menu->addAction(action); action = new QAction(tr("Analyse &Without Frequency-dependent Timing Bias (slow)"), this); action->setCheckable(true); - action->setChecked(false); - + action->setChecked(precise); + connect(action, SIGNAL(triggered()), this, SLOT(precisionAnalysisToggled())); menu->addAction(action); - +} + +void +MainWindow::autoAnalysisToggled() +{ + QAction *a = qobject_cast<QAction *>(sender()); + if (!a) return; + + bool set = a->isChecked(); + + QSettings settings; + settings.beginGroup("Analyser"); + settings.setValue("auto-analysis", set); + settings.endGroup(); +} + +void +MainWindow::precisionAnalysisToggled() +{ + QAction *a = qobject_cast<QAction *>(sender()); + if (!a) return; + + bool set = a->isChecked(); + + QSettings settings; + settings.beginGroup("Analyser"); + settings.setValue("precision-analysis", set); + settings.endGroup(); + + analyseNow(); } void @@ -2947,6 +2984,13 @@ } void +MainWindow::analyseNow() +{ + //!!! + cerr << "analyseNow called" << endl; +} + +void MainWindow::analyseNewMainModel() { WaveFileModel *model = getMainModel();