Mercurial > hg > sonic-visualiser
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 1355:86cd0e81ed07 | 1356:3ef81d81b767 |
|---|---|
| 840 action->setStatusTip(tr("Renumber the selected instants using the current labelling scheme")); | 840 action->setStatusTip(tr("Renumber the selected instants using the current labelling scheme")); |
| 841 connect(action, SIGNAL(triggered()), this, SLOT(renumberInstants())); | 841 connect(action, SIGNAL(triggered()), this, SLOT(renumberInstants())); |
| 842 connect(this, SIGNAL(canRenumberInstants(bool)), action, SLOT(setEnabled(bool))); | 842 connect(this, SIGNAL(canRenumberInstants(bool)), action, SLOT(setEnabled(bool))); |
| 843 // m_keyReference->registerShortcut(action); | 843 // m_keyReference->registerShortcut(action); |
| 844 menu->addAction(action); | 844 menu->addAction(action); |
| 845 | 845 |
| 846 menu->addSeparator(); | |
| 847 | |
| 846 action = new QAction(tr("Subdivide Selected Instants..."), this); | 848 action = new QAction(tr("Subdivide Selected Instants..."), this); |
| 847 action->setStatusTip(tr("Add new instants at regular intervals between the selected instants")); | 849 action->setStatusTip(tr("Add new instants at regular intervals between the selected instants")); |
| 848 connect(action, SIGNAL(triggered()), this, SLOT(subdivideInstants())); | 850 connect(action, SIGNAL(triggered()), this, SLOT(subdivideInstants())); |
| 849 connect(this, SIGNAL(canSubdivideInstants(bool)), action, SLOT(setEnabled(bool))); | 851 connect(this, SIGNAL(canSubdivideInstants(bool)), action, SLOT(setEnabled(bool))); |
| 852 menu->addAction(action); | |
| 853 | |
| 854 action = new QAction(tr("Winnow Selected Instants..."), this); | |
| 855 action->setStatusTip(tr("Remove subdivisions, leaving only every Nth instant")); | |
| 856 connect(action, SIGNAL(triggered()), this, SLOT(winnowInstants())); | |
| 857 connect(this, SIGNAL(canWinnowInstants(bool)), action, SLOT(setEnabled(bool))); | |
| 850 menu->addAction(action); | 858 menu->addAction(action); |
| 851 } | 859 } |
| 852 | 860 |
| 853 void | 861 void |
| 854 MainWindow::setupViewMenu() | 862 MainWindow::setupViewMenu() |
| 4418 | 4426 |
| 4419 settings.endGroup(); | 4427 settings.endGroup(); |
| 4420 } | 4428 } |
| 4421 | 4429 |
| 4422 void | 4430 void |
| 4431 MainWindow::winnowInstants() | |
| 4432 { | |
| 4433 QSettings settings; | |
| 4434 settings.beginGroup("MainWindow"); | |
| 4435 int n = settings.value("winnow-subdivisions", 4).toInt(); | |
| 4436 | |
| 4437 bool ok; | |
| 4438 | |
| 4439 n = QInputDialog::getInt(this, | |
| 4440 tr("Winnow instants"), | |
| 4441 tr("Remove all instants apart from multiples of:"), | |
| 4442 n, 2, 96, 1, &ok); | |
| 4443 | |
| 4444 if (ok) { | |
| 4445 settings.setValue("winnow-subdivisions", n); | |
| 4446 winnowInstantsBy(n); | |
| 4447 } | |
| 4448 | |
| 4449 settings.endGroup(); | |
| 4450 } | |
| 4451 | |
| 4452 void | |
| 4423 MainWindow::modelGenerationFailed(QString transformName, QString message) | 4453 MainWindow::modelGenerationFailed(QString transformName, QString message) |
| 4424 { | 4454 { |
| 4425 emit hideSplash(); | 4455 emit hideSplash(); |
| 4426 | 4456 |
| 4427 QString quoted; | 4457 QString quoted; |
