Mercurial > hg > tony
diff src/MainWindow.cpp @ 300:38a5663f773f
Rework menu entries & shortcuts: left/right now move the playhead a fixed amount, ctrl+left/right still move it note-by-note, and now alt+left/right scroll without moving playhead
author | Chris Cannam |
---|---|
date | Thu, 12 Jun 2014 14:24:48 +0100 |
parents | a7792e252f92 |
children | 528d207fd661 |
line wrap: on
line diff
--- a/src/MainWindow.cpp Thu Jun 12 13:59:55 2014 +0100 +++ b/src/MainWindow.cpp Thu Jun 12 14:24:48 2014 +0100 @@ -729,53 +729,21 @@ QMenu *menu = menuBar()->addMenu(tr("&View")); menu->setTearOffEnabled(true); - action = new QAction(tr("Scroll &Left"), this); - action->setShortcut(tr("Left")); - action->setStatusTip(tr("Scroll the current pane to the left")); + action = new QAction(tr("Peek &Left"), this); + action->setShortcut(tr("Alt+Left")); + action->setStatusTip(tr("Scroll the current pane to the left without changing the play position")); connect(action, SIGNAL(triggered()), this, SLOT(scrollLeft())); connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool))); m_keyReference->registerShortcut(action); menu->addAction(action); - action = new QAction(tr("Scroll &Right"), this); - action->setShortcut(tr("Right")); - action->setStatusTip(tr("Scroll the current pane to the right")); + action = new QAction(tr("Peek &Right"), this); + action->setShortcut(tr("Alt+Right")); + action->setStatusTip(tr("Scroll the current pane to the right without changing the play position")); connect(action, SIGNAL(triggered()), this, SLOT(scrollRight())); connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool))); m_keyReference->registerShortcut(action); menu->addAction(action); - - action = new QAction(tr("&One Note Left"), this); - action->setShortcut(tr("Ctrl+Left")); - action->setStatusTip(tr("Move cursor to the preceding note (or silence) onset.")); - connect(action, SIGNAL(triggered()), this, SLOT(moveOneNoteLeft())); - connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool))); - m_keyReference->registerShortcut(action); - menu->addAction(action); - - action = new QAction(tr("O&ne Note Right"), this); - action->setShortcut(tr("Ctrl+Right")); - action->setStatusTip(tr("Move cursor to the succeeding note (or silence).")); - connect(action, SIGNAL(triggered()), this, SLOT(moveOneNoteRight())); - connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool))); - m_keyReference->registerShortcut(action); - menu->addAction(action); - - action = new QAction(tr("&Select One Note Left"), this); - action->setShortcut(tr("Ctrl+Shift+Left")); - action->setStatusTip(tr("Select to the preceding note (or silence) onset.")); - connect(action, SIGNAL(triggered()), this, SLOT(selectOneNoteLeft())); - connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool))); - m_keyReference->registerShortcut(action); - menu->addAction(action); - - action = new QAction(tr("S&elect One Note Right"), this); - action->setShortcut(tr("Ctrl+Shift+Right")); - action->setStatusTip(tr("Select to the succeeding note (or silence).")); - connect(action, SIGNAL(triggered()), this, SLOT(selectOneNoteRight())); - connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool))); - m_keyReference->registerShortcut(action); - menu->addAction(action); menu->addSeparator(); @@ -902,10 +870,13 @@ QAction *m_rwdAction = toolbar->addAction(il.load("rewind"), tr("Rewind")); - m_rwdAction->setStatusTip(tr("Rewind to the previous time instant or time ruler notch")); + m_rwdAction->setShortcut(tr("Left")); + m_rwdAction->setStatusTip(tr("Rewind to the previous one-second boundary")); connect(m_rwdAction, SIGNAL(triggered()), this, SLOT(rewind())); connect(this, SIGNAL(canRewind(bool)), m_rwdAction, SLOT(setEnabled(bool))); + setDefaultFfwdRwdStep(RealTime(1, 0)); + QAction *playAction = toolbar->addAction(il.load("playpause"), tr("Play / Pause")); playAction->setCheckable(true); @@ -918,7 +889,8 @@ m_ffwdAction = toolbar->addAction(il.load("ffwd"), tr("Fast Forward")); - m_ffwdAction->setStatusTip(tr("Fast-forward to the next time instant or time ruler notch")); + m_ffwdAction->setShortcut(tr("Right")); + m_ffwdAction->setStatusTip(tr("Fast-forward to the next one-second boundary")); connect(m_ffwdAction, SIGNAL(triggered()), this, SLOT(ffwd())); connect(this, SIGNAL(canFfwd(bool)), m_ffwdAction, SLOT(setEnabled(bool))); @@ -953,6 +925,30 @@ connect(plAction, SIGNAL(triggered()), this, SLOT(playLoopToggled())); connect(this, SIGNAL(canPlay(bool)), plAction, SLOT(setEnabled(bool))); + QAction *oneLeftAction = new QAction(tr("&One Note Left"), this); + oneLeftAction->setShortcut(tr("Ctrl+Left")); + oneLeftAction->setStatusTip(tr("Move cursor to the preceding note (or silence) onset.")); + connect(oneLeftAction, SIGNAL(triggered()), this, SLOT(moveOneNoteLeft())); + connect(this, SIGNAL(canScroll(bool)), oneLeftAction, SLOT(setEnabled(bool))); + + QAction *oneRightAction = new QAction(tr("O&ne Note Right"), this); + oneRightAction->setShortcut(tr("Ctrl+Right")); + oneRightAction->setStatusTip(tr("Move cursor to the succeeding note (or silence).")); + connect(oneRightAction, SIGNAL(triggered()), this, SLOT(moveOneNoteRight())); + connect(this, SIGNAL(canScroll(bool)), oneRightAction, SLOT(setEnabled(bool))); + + QAction *selectOneLeftAction = new QAction(tr("&Select One Note Left"), this); + selectOneLeftAction->setShortcut(tr("Ctrl+Shift+Left")); + selectOneLeftAction->setStatusTip(tr("Select to the preceding note (or silence) onset.")); + connect(selectOneLeftAction, SIGNAL(triggered()), this, SLOT(selectOneNoteLeft())); + connect(this, SIGNAL(canScroll(bool)), selectOneLeftAction, SLOT(setEnabled(bool))); + + QAction *selectOneRightAction = new QAction(tr("S&elect One Note Right"), this); + selectOneRightAction->setShortcut(tr("Ctrl+Shift+Right")); + selectOneRightAction->setStatusTip(tr("Select to the succeeding note (or silence).")); + connect(selectOneRightAction, SIGNAL(triggered()), this, SLOT(selectOneNoteRight())); + connect(this, SIGNAL(canScroll(bool)), selectOneRightAction, SLOT(setEnabled(bool))); + m_keyReference->registerShortcut(psAction); m_keyReference->registerShortcut(plAction); m_keyReference->registerShortcut(playAction); @@ -960,6 +956,10 @@ m_keyReference->registerShortcut(m_ffwdAction); m_keyReference->registerShortcut(rwdStartAction); m_keyReference->registerShortcut(ffwdEndAction); + m_keyReference->registerShortcut(oneLeftAction); + m_keyReference->registerShortcut(oneRightAction); + m_keyReference->registerShortcut(selectOneLeftAction); + m_keyReference->registerShortcut(selectOneRightAction); menu->addAction(playAction); menu->addAction(psAction); @@ -971,6 +971,11 @@ menu->addAction(rwdStartAction); menu->addAction(ffwdEndAction); menu->addSeparator(); + menu->addAction(oneLeftAction); + menu->addAction(oneRightAction); + menu->addAction(selectOneLeftAction); + menu->addAction(selectOneRightAction); + menu->addSeparator(); m_rightButtonPlaybackMenu->addAction(playAction); m_rightButtonPlaybackMenu->addAction(psAction); @@ -982,6 +987,11 @@ m_rightButtonPlaybackMenu->addAction(rwdStartAction); m_rightButtonPlaybackMenu->addAction(ffwdEndAction); m_rightButtonPlaybackMenu->addSeparator(); + m_rightButtonPlaybackMenu->addAction(oneLeftAction); + m_rightButtonPlaybackMenu->addAction(oneRightAction); + m_rightButtonPlaybackMenu->addAction(selectOneLeftAction); + m_rightButtonPlaybackMenu->addAction(selectOneRightAction); + m_rightButtonPlaybackMenu->addSeparator(); QAction *fastAction = menu->addAction(tr("Speed Up")); fastAction->setShortcut(tr("Ctrl+PgUp"));