Mercurial > hg > tony
comparison src/MainWindow.cpp @ 198:bb391844e2aa
Switching pitch candidate no longer wraps around: you can't go higher than the highest or lower than the lowest (though you can go either "up" or "down" if none of the alternate candidates has been selected yet, regardless of whether the candidates are higher or lower than the actual pitch track)
author | Chris Cannam |
---|---|
date | Wed, 05 Mar 2014 11:39:28 +0000 |
parents | 797395e56489 |
children | 0ba33d6c0a71 |
comparison
equal
deleted
inserted
replaced
197:73fafd70996e | 198:bb391844e2aa |
---|---|
551 action = new QAction(tr("Pick Higher Pitch Candidate"), this); | 551 action = new QAction(tr("Pick Higher Pitch Candidate"), this); |
552 action->setShortcut(tr("Ctrl+Up")); | 552 action->setShortcut(tr("Ctrl+Up")); |
553 action->setStatusTip(tr("Switch to the next higher pitch candidate in the selected region")); | 553 action->setStatusTip(tr("Switch to the next higher pitch candidate in the selected region")); |
554 m_keyReference->registerShortcut(action); | 554 m_keyReference->registerShortcut(action); |
555 connect(action, SIGNAL(triggered()), this, SLOT(switchPitchUp())); | 555 connect(action, SIGNAL(triggered()), this, SLOT(switchPitchUp())); |
556 connect(this, SIGNAL(canChangePitchCandidate(bool)), action, SLOT(setEnabled(bool))); | 556 connect(this, SIGNAL(canChangeToHigherCandidate(bool)), action, SLOT(setEnabled(bool))); |
557 menu->addAction(action); | 557 menu->addAction(action); |
558 m_rightButtonMenu->addAction(action); | 558 m_rightButtonMenu->addAction(action); |
559 | 559 |
560 action = new QAction(tr("Pick Lower Pitch Candidate"), this); | 560 action = new QAction(tr("Pick Lower Pitch Candidate"), this); |
561 action->setShortcut(tr("Ctrl+Down")); | 561 action->setShortcut(tr("Ctrl+Down")); |
562 action->setStatusTip(tr("Switch to the next lower pitch candidate in the selected region")); | 562 action->setStatusTip(tr("Switch to the next lower pitch candidate in the selected region")); |
563 m_keyReference->registerShortcut(action); | 563 m_keyReference->registerShortcut(action); |
564 connect(action, SIGNAL(triggered()), this, SLOT(switchPitchDown())); | 564 connect(action, SIGNAL(triggered()), this, SLOT(switchPitchDown())); |
565 connect(this, SIGNAL(canChangePitchCandidate(bool)), action, SLOT(setEnabled(bool))); | 565 connect(this, SIGNAL(canChangeToLowerCandidate(bool)), action, SLOT(setEnabled(bool))); |
566 menu->addAction(action); | 566 menu->addAction(action); |
567 m_rightButtonMenu->addAction(action); | 567 m_rightButtonMenu->addAction(action); |
568 | 568 |
569 menu->addSeparator(); | 569 menu->addSeparator(); |
570 m_rightButtonMenu->addSeparator(); | 570 m_rightButtonMenu->addSeparator(); |
1053 bool haveCurrentTimeValueLayer = | 1053 bool haveCurrentTimeValueLayer = |
1054 (haveCurrentLayer && | 1054 (haveCurrentLayer && |
1055 qobject_cast<TimeValueLayer *>(currentLayer)); | 1055 qobject_cast<TimeValueLayer *>(currentLayer)); |
1056 bool pitchCandidatesVisible = | 1056 bool pitchCandidatesVisible = |
1057 m_analyser->arePitchCandidatesShown(); | 1057 m_analyser->arePitchCandidatesShown(); |
1058 bool haveHigher = | |
1059 m_analyser->haveHigherPitchCandidate(); | |
1060 bool haveLower = | |
1061 m_analyser->haveLowerPitchCandidate(); | |
1058 | 1062 |
1059 emit canChangePlaybackSpeed(true); | 1063 emit canChangePlaybackSpeed(true); |
1060 int v = m_playSpeed->value(); | 1064 int v = m_playSpeed->value(); |
1061 emit canSpeedUpPlayback(v < m_playSpeed->maximum()); | 1065 emit canSpeedUpPlayback(v < m_playSpeed->maximum()); |
1062 emit canSlowDownPlayback(v > m_playSpeed->minimum()); | 1066 emit canSlowDownPlayback(v > m_playSpeed->minimum()); |
1063 | 1067 |
1064 emit canChangePitchCandidate(pitchCandidatesVisible && haveSelection); | 1068 emit canChangePitchCandidate(pitchCandidatesVisible && haveSelection); |
1069 emit canChangeToHigherCandidate(pitchCandidatesVisible && haveSelection && haveHigher); | |
1070 emit canChangeToLowerCandidate(pitchCandidatesVisible && haveSelection && haveLower); | |
1065 | 1071 |
1066 if (pitchCandidatesVisible) { | 1072 if (pitchCandidatesVisible) { |
1067 m_showCandidatesAction->setText(tr("Hide Pitch Candidates")); | 1073 m_showCandidatesAction->setText(tr("Hide Pitch Candidates")); |
1068 m_showCandidatesAction->setStatusTip(tr("Remove the display of alternate pitch candidates for the selected region")); | 1074 m_showCandidatesAction->setStatusTip(tr("Remove the display of alternate pitch candidates for the selected region")); |
1069 } else { | 1075 } else { |