comparison main/MainWindow.cpp @ 597:110eecb5d9f6

Reset cyclical counters when document is replaced (#182)
author Chris Cannam
date Wed, 24 Jul 2013 12:02:01 +0100
parents e37154e52d89
children c0a20cd1a9ff
comparison
equal deleted inserted replaced
596:e37154e52d89 597:110eecb5d9f6
773 i->first == Labeller::ValueFromRealTime) { 773 i->first == Labeller::ValueFromRealTime) {
774 numberingMenu->addSeparator(); 774 numberingMenu->addSeparator();
775 } 775 }
776 } 776 }
777 777
778 action = new QAction(tr("Reset Numbering Counters"), this);
779 action->setStatusTip(tr("Reset to 1 all the counters used for counter-based labelling"));
780 connect(action, SIGNAL(triggered()), this, SLOT(resetInstantsCounters()));
781 connect(this, SIGNAL(replacedDocument()), action, SLOT(trigger()));
782 menu->addAction(action);
783
778 action = new QAction(tr("Set Numbering Counters..."), this); 784 action = new QAction(tr("Set Numbering Counters..."), this);
779 action->setStatusTip(tr("Set the counters used for counter-based labelling")); 785 action->setStatusTip(tr("Set the counters used for counter-based labelling"));
780 connect(action, SIGNAL(triggered()), this, SLOT(resetInstantsCounters())); 786 connect(action, SIGNAL(triggered()), this, SLOT(setInstantsCounters()));
781 menu->addAction(action); 787 menu->addAction(action);
782 788
783 action = new QAction(tr("Renumber Selected Instants"), this); 789 action = new QAction(tr("Renumber Selected Instants"), this);
784 action->setStatusTip(tr("Renumber the selected instants using the current labelling scheme")); 790 action->setStatusTip(tr("Renumber the selected instants using the current labelling scheme"));
785 connect(action, SIGNAL(triggered()), this, SLOT(renumberInstants())); 791 connect(action, SIGNAL(triggered()), this, SLOT(renumberInstants()));
4047 settings.setValue("labellercycle", cycle); 4053 settings.setValue("labellercycle", cycle);
4048 settings.endGroup(); 4054 settings.endGroup();
4049 } 4055 }
4050 4056
4051 void 4057 void
4052 MainWindow::resetInstantsCounters() 4058 MainWindow::setInstantsCounters()
4053 { 4059 {
4054 LabelCounterInputDialog dialog(m_labeller, this); 4060 LabelCounterInputDialog dialog(m_labeller, this);
4055 dialog.setWindowTitle(tr("Reset Counters")); 4061 dialog.setWindowTitle(tr("Reset Counters"));
4056 dialog.exec(); 4062 dialog.exec();
4063 }
4064
4065 void
4066 MainWindow::resetInstantsCounters()
4067 {
4068 if (m_labeller) m_labeller->resetCounters();
4057 } 4069 }
4058 4070
4059 void 4071 void
4060 MainWindow::modelGenerationFailed(QString transformName, QString message) 4072 MainWindow::modelGenerationFailed(QString transformName, QString message)
4061 { 4073 {