Mercurial > hg > sonic-visualiser
diff main/MainWindow.cpp @ 1356:3ef81d81b767 subdivide-instants
Add Winnow as well
author | Chris Cannam |
---|---|
date | Fri, 25 Nov 2016 09:57:36 +0000 |
parents | 86cd0e81ed07 |
children | bf4f7a12fee0 7b058ba5fa67 |
line wrap: on
line diff
--- a/main/MainWindow.cpp Fri Nov 25 09:38:53 2016 +0000 +++ b/main/MainWindow.cpp Fri Nov 25 09:57:36 2016 +0000 @@ -842,12 +842,20 @@ connect(this, SIGNAL(canRenumberInstants(bool)), action, SLOT(setEnabled(bool))); // m_keyReference->registerShortcut(action); menu->addAction(action); - + + menu->addSeparator(); + action = new QAction(tr("Subdivide Selected Instants..."), this); action->setStatusTip(tr("Add new instants at regular intervals between the selected instants")); connect(action, SIGNAL(triggered()), this, SLOT(subdivideInstants())); connect(this, SIGNAL(canSubdivideInstants(bool)), action, SLOT(setEnabled(bool))); menu->addAction(action); + + action = new QAction(tr("Winnow Selected Instants..."), this); + action->setStatusTip(tr("Remove subdivisions, leaving only every Nth instant")); + connect(action, SIGNAL(triggered()), this, SLOT(winnowInstants())); + connect(this, SIGNAL(canWinnowInstants(bool)), action, SLOT(setEnabled(bool))); + menu->addAction(action); } void @@ -4420,6 +4428,28 @@ } void +MainWindow::winnowInstants() +{ + QSettings settings; + settings.beginGroup("MainWindow"); + int n = settings.value("winnow-subdivisions", 4).toInt(); + + bool ok; + + n = QInputDialog::getInt(this, + tr("Winnow instants"), + tr("Remove all instants apart from multiples of:"), + n, 2, 96, 1, &ok); + + if (ok) { + settings.setValue("winnow-subdivisions", n); + winnowInstantsBy(n); + } + + settings.endGroup(); +} + +void MainWindow::modelGenerationFailed(QString transformName, QString message) { emit hideSplash();