Mercurial > hg > tony
comparison 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 |
comparison
equal
deleted
inserted
replaced
299:a7792e252f92 | 300:38a5663f773f |
---|---|
727 | 727 |
728 m_keyReference->setCategory(tr("Panning and Navigation")); | 728 m_keyReference->setCategory(tr("Panning and Navigation")); |
729 | 729 |
730 QMenu *menu = menuBar()->addMenu(tr("&View")); | 730 QMenu *menu = menuBar()->addMenu(tr("&View")); |
731 menu->setTearOffEnabled(true); | 731 menu->setTearOffEnabled(true); |
732 action = new QAction(tr("Scroll &Left"), this); | 732 action = new QAction(tr("Peek &Left"), this); |
733 action->setShortcut(tr("Left")); | 733 action->setShortcut(tr("Alt+Left")); |
734 action->setStatusTip(tr("Scroll the current pane to the left")); | 734 action->setStatusTip(tr("Scroll the current pane to the left without changing the play position")); |
735 connect(action, SIGNAL(triggered()), this, SLOT(scrollLeft())); | 735 connect(action, SIGNAL(triggered()), this, SLOT(scrollLeft())); |
736 connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool))); | 736 connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool))); |
737 m_keyReference->registerShortcut(action); | 737 m_keyReference->registerShortcut(action); |
738 menu->addAction(action); | 738 menu->addAction(action); |
739 | 739 |
740 action = new QAction(tr("Scroll &Right"), this); | 740 action = new QAction(tr("Peek &Right"), this); |
741 action->setShortcut(tr("Right")); | 741 action->setShortcut(tr("Alt+Right")); |
742 action->setStatusTip(tr("Scroll the current pane to the right")); | 742 action->setStatusTip(tr("Scroll the current pane to the right without changing the play position")); |
743 connect(action, SIGNAL(triggered()), this, SLOT(scrollRight())); | 743 connect(action, SIGNAL(triggered()), this, SLOT(scrollRight())); |
744 connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool))); | |
745 m_keyReference->registerShortcut(action); | |
746 menu->addAction(action); | |
747 | |
748 action = new QAction(tr("&One Note Left"), this); | |
749 action->setShortcut(tr("Ctrl+Left")); | |
750 action->setStatusTip(tr("Move cursor to the preceding note (or silence) onset.")); | |
751 connect(action, SIGNAL(triggered()), this, SLOT(moveOneNoteLeft())); | |
752 connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool))); | |
753 m_keyReference->registerShortcut(action); | |
754 menu->addAction(action); | |
755 | |
756 action = new QAction(tr("O&ne Note Right"), this); | |
757 action->setShortcut(tr("Ctrl+Right")); | |
758 action->setStatusTip(tr("Move cursor to the succeeding note (or silence).")); | |
759 connect(action, SIGNAL(triggered()), this, SLOT(moveOneNoteRight())); | |
760 connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool))); | |
761 m_keyReference->registerShortcut(action); | |
762 menu->addAction(action); | |
763 | |
764 action = new QAction(tr("&Select One Note Left"), this); | |
765 action->setShortcut(tr("Ctrl+Shift+Left")); | |
766 action->setStatusTip(tr("Select to the preceding note (or silence) onset.")); | |
767 connect(action, SIGNAL(triggered()), this, SLOT(selectOneNoteLeft())); | |
768 connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool))); | |
769 m_keyReference->registerShortcut(action); | |
770 menu->addAction(action); | |
771 | |
772 action = new QAction(tr("S&elect One Note Right"), this); | |
773 action->setShortcut(tr("Ctrl+Shift+Right")); | |
774 action->setStatusTip(tr("Select to the succeeding note (or silence).")); | |
775 connect(action, SIGNAL(triggered()), this, SLOT(selectOneNoteRight())); | |
776 connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool))); | 744 connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool))); |
777 m_keyReference->registerShortcut(action); | 745 m_keyReference->registerShortcut(action); |
778 menu->addAction(action); | 746 menu->addAction(action); |
779 | 747 |
780 menu->addSeparator(); | 748 menu->addSeparator(); |
900 connect(rwdStartAction, SIGNAL(triggered()), this, SLOT(rewindStart())); | 868 connect(rwdStartAction, SIGNAL(triggered()), this, SLOT(rewindStart())); |
901 connect(this, SIGNAL(canPlay(bool)), rwdStartAction, SLOT(setEnabled(bool))); | 869 connect(this, SIGNAL(canPlay(bool)), rwdStartAction, SLOT(setEnabled(bool))); |
902 | 870 |
903 QAction *m_rwdAction = toolbar->addAction(il.load("rewind"), | 871 QAction *m_rwdAction = toolbar->addAction(il.load("rewind"), |
904 tr("Rewind")); | 872 tr("Rewind")); |
905 m_rwdAction->setStatusTip(tr("Rewind to the previous time instant or time ruler notch")); | 873 m_rwdAction->setShortcut(tr("Left")); |
874 m_rwdAction->setStatusTip(tr("Rewind to the previous one-second boundary")); | |
906 connect(m_rwdAction, SIGNAL(triggered()), this, SLOT(rewind())); | 875 connect(m_rwdAction, SIGNAL(triggered()), this, SLOT(rewind())); |
907 connect(this, SIGNAL(canRewind(bool)), m_rwdAction, SLOT(setEnabled(bool))); | 876 connect(this, SIGNAL(canRewind(bool)), m_rwdAction, SLOT(setEnabled(bool))); |
877 | |
878 setDefaultFfwdRwdStep(RealTime(1, 0)); | |
908 | 879 |
909 QAction *playAction = toolbar->addAction(il.load("playpause"), | 880 QAction *playAction = toolbar->addAction(il.load("playpause"), |
910 tr("Play / Pause")); | 881 tr("Play / Pause")); |
911 playAction->setCheckable(true); | 882 playAction->setCheckable(true); |
912 playAction->setShortcut(tr("Space")); | 883 playAction->setShortcut(tr("Space")); |
916 playAction, SLOT(setChecked(bool))); | 887 playAction, SLOT(setChecked(bool))); |
917 connect(this, SIGNAL(canPlay(bool)), playAction, SLOT(setEnabled(bool))); | 888 connect(this, SIGNAL(canPlay(bool)), playAction, SLOT(setEnabled(bool))); |
918 | 889 |
919 m_ffwdAction = toolbar->addAction(il.load("ffwd"), | 890 m_ffwdAction = toolbar->addAction(il.load("ffwd"), |
920 tr("Fast Forward")); | 891 tr("Fast Forward")); |
921 m_ffwdAction->setStatusTip(tr("Fast-forward to the next time instant or time ruler notch")); | 892 m_ffwdAction->setShortcut(tr("Right")); |
893 m_ffwdAction->setStatusTip(tr("Fast-forward to the next one-second boundary")); | |
922 connect(m_ffwdAction, SIGNAL(triggered()), this, SLOT(ffwd())); | 894 connect(m_ffwdAction, SIGNAL(triggered()), this, SLOT(ffwd())); |
923 connect(this, SIGNAL(canFfwd(bool)), m_ffwdAction, SLOT(setEnabled(bool))); | 895 connect(this, SIGNAL(canFfwd(bool)), m_ffwdAction, SLOT(setEnabled(bool))); |
924 | 896 |
925 QAction *ffwdEndAction = toolbar->addAction(il.load("ffwd-end"), | 897 QAction *ffwdEndAction = toolbar->addAction(il.load("ffwd-end"), |
926 tr("Fast Forward to End")); | 898 tr("Fast Forward to End")); |
951 connect(m_viewManager, SIGNAL(playLoopModeChanged(bool)), | 923 connect(m_viewManager, SIGNAL(playLoopModeChanged(bool)), |
952 plAction, SLOT(setChecked(bool))); | 924 plAction, SLOT(setChecked(bool))); |
953 connect(plAction, SIGNAL(triggered()), this, SLOT(playLoopToggled())); | 925 connect(plAction, SIGNAL(triggered()), this, SLOT(playLoopToggled())); |
954 connect(this, SIGNAL(canPlay(bool)), plAction, SLOT(setEnabled(bool))); | 926 connect(this, SIGNAL(canPlay(bool)), plAction, SLOT(setEnabled(bool))); |
955 | 927 |
928 QAction *oneLeftAction = new QAction(tr("&One Note Left"), this); | |
929 oneLeftAction->setShortcut(tr("Ctrl+Left")); | |
930 oneLeftAction->setStatusTip(tr("Move cursor to the preceding note (or silence) onset.")); | |
931 connect(oneLeftAction, SIGNAL(triggered()), this, SLOT(moveOneNoteLeft())); | |
932 connect(this, SIGNAL(canScroll(bool)), oneLeftAction, SLOT(setEnabled(bool))); | |
933 | |
934 QAction *oneRightAction = new QAction(tr("O&ne Note Right"), this); | |
935 oneRightAction->setShortcut(tr("Ctrl+Right")); | |
936 oneRightAction->setStatusTip(tr("Move cursor to the succeeding note (or silence).")); | |
937 connect(oneRightAction, SIGNAL(triggered()), this, SLOT(moveOneNoteRight())); | |
938 connect(this, SIGNAL(canScroll(bool)), oneRightAction, SLOT(setEnabled(bool))); | |
939 | |
940 QAction *selectOneLeftAction = new QAction(tr("&Select One Note Left"), this); | |
941 selectOneLeftAction->setShortcut(tr("Ctrl+Shift+Left")); | |
942 selectOneLeftAction->setStatusTip(tr("Select to the preceding note (or silence) onset.")); | |
943 connect(selectOneLeftAction, SIGNAL(triggered()), this, SLOT(selectOneNoteLeft())); | |
944 connect(this, SIGNAL(canScroll(bool)), selectOneLeftAction, SLOT(setEnabled(bool))); | |
945 | |
946 QAction *selectOneRightAction = new QAction(tr("S&elect One Note Right"), this); | |
947 selectOneRightAction->setShortcut(tr("Ctrl+Shift+Right")); | |
948 selectOneRightAction->setStatusTip(tr("Select to the succeeding note (or silence).")); | |
949 connect(selectOneRightAction, SIGNAL(triggered()), this, SLOT(selectOneNoteRight())); | |
950 connect(this, SIGNAL(canScroll(bool)), selectOneRightAction, SLOT(setEnabled(bool))); | |
951 | |
956 m_keyReference->registerShortcut(psAction); | 952 m_keyReference->registerShortcut(psAction); |
957 m_keyReference->registerShortcut(plAction); | 953 m_keyReference->registerShortcut(plAction); |
958 m_keyReference->registerShortcut(playAction); | 954 m_keyReference->registerShortcut(playAction); |
959 m_keyReference->registerShortcut(m_rwdAction); | 955 m_keyReference->registerShortcut(m_rwdAction); |
960 m_keyReference->registerShortcut(m_ffwdAction); | 956 m_keyReference->registerShortcut(m_ffwdAction); |
961 m_keyReference->registerShortcut(rwdStartAction); | 957 m_keyReference->registerShortcut(rwdStartAction); |
962 m_keyReference->registerShortcut(ffwdEndAction); | 958 m_keyReference->registerShortcut(ffwdEndAction); |
959 m_keyReference->registerShortcut(oneLeftAction); | |
960 m_keyReference->registerShortcut(oneRightAction); | |
961 m_keyReference->registerShortcut(selectOneLeftAction); | |
962 m_keyReference->registerShortcut(selectOneRightAction); | |
963 | 963 |
964 menu->addAction(playAction); | 964 menu->addAction(playAction); |
965 menu->addAction(psAction); | 965 menu->addAction(psAction); |
966 menu->addAction(plAction); | 966 menu->addAction(plAction); |
967 menu->addSeparator(); | 967 menu->addSeparator(); |
969 menu->addAction(m_ffwdAction); | 969 menu->addAction(m_ffwdAction); |
970 menu->addSeparator(); | 970 menu->addSeparator(); |
971 menu->addAction(rwdStartAction); | 971 menu->addAction(rwdStartAction); |
972 menu->addAction(ffwdEndAction); | 972 menu->addAction(ffwdEndAction); |
973 menu->addSeparator(); | 973 menu->addSeparator(); |
974 menu->addAction(oneLeftAction); | |
975 menu->addAction(oneRightAction); | |
976 menu->addAction(selectOneLeftAction); | |
977 menu->addAction(selectOneRightAction); | |
978 menu->addSeparator(); | |
974 | 979 |
975 m_rightButtonPlaybackMenu->addAction(playAction); | 980 m_rightButtonPlaybackMenu->addAction(playAction); |
976 m_rightButtonPlaybackMenu->addAction(psAction); | 981 m_rightButtonPlaybackMenu->addAction(psAction); |
977 m_rightButtonPlaybackMenu->addAction(plAction); | 982 m_rightButtonPlaybackMenu->addAction(plAction); |
978 m_rightButtonPlaybackMenu->addSeparator(); | 983 m_rightButtonPlaybackMenu->addSeparator(); |
979 m_rightButtonPlaybackMenu->addAction(m_rwdAction); | 984 m_rightButtonPlaybackMenu->addAction(m_rwdAction); |
980 m_rightButtonPlaybackMenu->addAction(m_ffwdAction); | 985 m_rightButtonPlaybackMenu->addAction(m_ffwdAction); |
981 m_rightButtonPlaybackMenu->addSeparator(); | 986 m_rightButtonPlaybackMenu->addSeparator(); |
982 m_rightButtonPlaybackMenu->addAction(rwdStartAction); | 987 m_rightButtonPlaybackMenu->addAction(rwdStartAction); |
983 m_rightButtonPlaybackMenu->addAction(ffwdEndAction); | 988 m_rightButtonPlaybackMenu->addAction(ffwdEndAction); |
989 m_rightButtonPlaybackMenu->addSeparator(); | |
990 m_rightButtonPlaybackMenu->addAction(oneLeftAction); | |
991 m_rightButtonPlaybackMenu->addAction(oneRightAction); | |
992 m_rightButtonPlaybackMenu->addAction(selectOneLeftAction); | |
993 m_rightButtonPlaybackMenu->addAction(selectOneRightAction); | |
984 m_rightButtonPlaybackMenu->addSeparator(); | 994 m_rightButtonPlaybackMenu->addSeparator(); |
985 | 995 |
986 QAction *fastAction = menu->addAction(tr("Speed Up")); | 996 QAction *fastAction = menu->addAction(tr("Speed Up")); |
987 fastAction->setShortcut(tr("Ctrl+PgUp")); | 997 fastAction->setShortcut(tr("Ctrl+PgUp")); |
988 fastAction->setStatusTip(tr("Time-stretch playback to speed it up without changing pitch")); | 998 fastAction->setStatusTip(tr("Time-stretch playback to speed it up without changing pitch")); |