Mercurial > hg > sonic-visualiser
comparison main/MainWindow.cpp @ 1358:5b639a383e58 3.0-integration
Merge from branch subdivide-instants
| author | Chris Cannam | 
|---|---|
| date | Fri, 25 Nov 2016 10:08:52 +0000 | 
| parents | 3ef81d81b767 | 
| children | bf4f7a12fee0 7b058ba5fa67 | 
   comparison
  equal
  deleted
  inserted
  replaced
| 1354:ae68ebb5fbe8 | 1358:5b639a383e58 | 
|---|---|
| 839 action = new QAction(tr("Renumber Selected Instants"), this); | 839 action = new QAction(tr("Renumber Selected Instants"), this); | 
| 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); | |
| 845 | |
| 846 menu->addSeparator(); | |
| 847 | |
| 848 action = new QAction(tr("Subdivide Selected Instants..."), this); | |
| 849 action->setStatusTip(tr("Add new instants at regular intervals between the selected instants")); | |
| 850 connect(action, SIGNAL(triggered()), this, SLOT(subdivideInstants())); | |
| 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))); | |
| 844 menu->addAction(action); | 858 menu->addAction(action); | 
| 845 } | 859 } | 
| 846 | 860 | 
| 847 void | 861 void | 
| 848 MainWindow::setupViewMenu() | 862 MainWindow::setupViewMenu() | 
| 4390 { | 4404 { | 
| 4391 if (m_labeller) m_labeller->resetCounters(); | 4405 if (m_labeller) m_labeller->resetCounters(); | 
| 4392 } | 4406 } | 
| 4393 | 4407 | 
| 4394 void | 4408 void | 
| 4409 MainWindow::subdivideInstants() | |
| 4410 { | |
| 4411 QSettings settings; | |
| 4412 settings.beginGroup("MainWindow"); | |
| 4413 int n = settings.value("subdivisions", 4).toInt(); | |
| 4414 | |
| 4415 bool ok; | |
| 4416 | |
| 4417 n = QInputDialog::getInt(this, | |
| 4418 tr("Subdivide instants"), | |
| 4419 tr("Number of subdivisions:"), | |
| 4420 n, 2, 96, 1, &ok); | |
| 4421 | |
| 4422 if (ok) { | |
| 4423 settings.setValue("subdivisions", n); | |
| 4424 subdivideInstantsBy(n); | |
| 4425 } | |
| 4426 | |
| 4427 settings.endGroup(); | |
| 4428 } | |
| 4429 | |
| 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 | |
| 4395 MainWindow::modelGenerationFailed(QString transformName, QString message) | 4453 MainWindow::modelGenerationFailed(QString transformName, QString message) | 
| 4396 { | 4454 { | 
| 4397 emit hideSplash(); | 4455 emit hideSplash(); | 
| 4398 | 4456 | 
| 4399 QString quoted; | 4457 QString quoted; | 
