comparison main/MainWindow.cpp @ 1355:86cd0e81ed07 subdivide-instants

Implement "Subdivide Selected Instants". Also add the relabel command to the history, which I previously forgot to do!
author Chris Cannam
date Fri, 25 Nov 2016 09:38:53 +0000
parents ed3009a50f81
children 3ef81d81b767
comparison
equal deleted inserted replaced
1354:ae68ebb5fbe8 1355:86cd0e81ed07
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 action = new QAction(tr("Subdivide Selected Instants..."), this);
847 action->setStatusTip(tr("Add new instants at regular intervals between the selected instants"));
848 connect(action, SIGNAL(triggered()), this, SLOT(subdivideInstants()));
849 connect(this, SIGNAL(canSubdivideInstants(bool)), action, SLOT(setEnabled(bool)));
844 menu->addAction(action); 850 menu->addAction(action);
845 } 851 }
846 852
847 void 853 void
848 MainWindow::setupViewMenu() 854 MainWindow::setupViewMenu()
4390 { 4396 {
4391 if (m_labeller) m_labeller->resetCounters(); 4397 if (m_labeller) m_labeller->resetCounters();
4392 } 4398 }
4393 4399
4394 void 4400 void
4401 MainWindow::subdivideInstants()
4402 {
4403 QSettings settings;
4404 settings.beginGroup("MainWindow");
4405 int n = settings.value("subdivisions", 4).toInt();
4406
4407 bool ok;
4408
4409 n = QInputDialog::getInt(this,
4410 tr("Subdivide instants"),
4411 tr("Number of subdivisions:"),
4412 n, 2, 96, 1, &ok);
4413
4414 if (ok) {
4415 settings.setValue("subdivisions", n);
4416 subdivideInstantsBy(n);
4417 }
4418
4419 settings.endGroup();
4420 }
4421
4422 void
4395 MainWindow::modelGenerationFailed(QString transformName, QString message) 4423 MainWindow::modelGenerationFailed(QString transformName, QString message)
4396 { 4424 {
4397 emit hideSplash(); 4425 emit hideSplash();
4398 4426
4399 QString quoted; 4427 QString quoted;