comparison main/MainWindow.cpp @ 192:d3477f673fb4

* Add Reset Counters... function
author Chris Cannam
date Wed, 10 Oct 2007 10:22:34 +0000
parents 89a41f3d24d1
children 4e030ebb6b36
comparison
equal deleted inserted replaced
191:1ded52c7f31c 192:d3477f673fb4
43 #include "widgets/LayerTree.h" 43 #include "widgets/LayerTree.h"
44 #include "widgets/ListInputDialog.h" 44 #include "widgets/ListInputDialog.h"
45 #include "widgets/SubdividingMenu.h" 45 #include "widgets/SubdividingMenu.h"
46 #include "widgets/NotifyingPushButton.h" 46 #include "widgets/NotifyingPushButton.h"
47 #include "widgets/KeyReference.h" 47 #include "widgets/KeyReference.h"
48 #include "widgets/LabelCounterInputDialog.h"
48 #include "audioio/AudioCallbackPlaySource.h" 49 #include "audioio/AudioCallbackPlaySource.h"
49 #include "audioio/AudioCallbackPlayTarget.h" 50 #include "audioio/AudioCallbackPlayTarget.h"
50 #include "audioio/AudioTargetFactory.h" 51 #include "audioio/AudioTargetFactory.h"
51 #include "audioio/PlaySpeedRangeMapper.h" 52 #include "audioio/PlaySpeedRangeMapper.h"
52 #include "data/fileio/DataFileReaderFactory.h" 53 #include "data/fileio/DataFileReaderFactory.h"
764 numberingGroup->addAction(action); 765 numberingGroup->addAction(action);
765 numberingMenu->addAction(action); 766 numberingMenu->addAction(action);
766 m_numberingActions[action] = (int)i->first; 767 m_numberingActions[action] = (int)i->first;
767 768
768 if (i->first == Labeller::ValueFromTwoLevelCounter) { 769 if (i->first == Labeller::ValueFromTwoLevelCounter) {
770
769 QMenu *cycleMenu = numberingMenu->addMenu(tr("Cycle size")); 771 QMenu *cycleMenu = numberingMenu->addMenu(tr("Cycle size"));
770 QActionGroup *cycleGroup = new QActionGroup(this); 772 QActionGroup *cycleGroup = new QActionGroup(this);
771 773
772 int cycles[] = { 2, 3, 4, 5, 6, 7, 8, 10, 12, 16 }; 774 int cycles[] = { 2, 3, 4, 5, 6, 7, 8, 10, 12, 16 };
773 for (int i = 0; i < sizeof(cycles)/sizeof(cycles[0]); ++i) { 775 for (int i = 0; i < sizeof(cycles)/sizeof(cycles[0]); ++i) {
776 action->setCheckable(true); 778 action->setCheckable(true);
777 action->setChecked(cycles[i] == m_labeller->getCounterCycleSize()); 779 action->setChecked(cycles[i] == m_labeller->getCounterCycleSize());
778 cycleGroup->addAction(action); 780 cycleGroup->addAction(action);
779 cycleMenu->addAction(action); 781 cycleMenu->addAction(action);
780 } 782 }
783
784 action = new QAction(tr("Reset Counters..."), this);
785 connect(action, SIGNAL(triggered()), this, SLOT(resetInstantsCounters()));
786 numberingMenu->addAction(action);
781 } 787 }
782 788
783 if (i->first == Labeller::ValueNone || 789 if (i->first == Labeller::ValueNone ||
784 i->first == Labeller::ValueFromTwoLevelCounter || 790 i->first == Labeller::ValueFromTwoLevelCounter ||
785 i->first == Labeller::ValueFromRealTime) { 791 i->first == Labeller::ValueFromRealTime) {
2474 int cycle = a->text().toInt(); 2480 int cycle = a->text().toInt();
2475 if (cycle == 0) return; 2481 if (cycle == 0) return;
2476 2482
2477 if (m_labeller) m_labeller->setCounterCycleSize(cycle); 2483 if (m_labeller) m_labeller->setCounterCycleSize(cycle);
2478 2484
2479
2480 QSettings settings; 2485 QSettings settings;
2481 settings.beginGroup("MainWindow"); 2486 settings.beginGroup("MainWindow");
2482 settings.setValue("labellercycle", cycle); 2487 settings.setValue("labellercycle", cycle);
2483 settings.endGroup(); 2488 settings.endGroup();
2489 }
2490
2491 void
2492 MainWindow::resetInstantsCounters()
2493 {
2494 LabelCounterInputDialog dialog(m_labeller, this);
2495 dialog.exec();
2484 } 2496 }
2485 2497
2486 void 2498 void
2487 MainWindow::renumberInstants() 2499 MainWindow::renumberInstants()
2488 { 2500 {