Mercurial > hg > sonic-visualiser
comparison main/MainWindow.cpp @ 1782:95248f6b9b1d
Make the ";"-key versions of these shortcuts the primary ones advertised on the menus (since so few people have an Enter key these days). For SF bug #246 Some shortcuts do not work
author | Chris Cannam |
---|---|
date | Wed, 18 Apr 2018 13:35:32 +0100 |
parents | b660b2fa8411 |
children | 07bd0eaa8114 |
comparison
equal
deleted
inserted
replaced
1781:89cf48de5969 | 1782:95248f6b9b1d |
---|---|
784 menu->addSeparator(); | 784 menu->addSeparator(); |
785 | 785 |
786 m_keyReference->setCategory(tr("Tapping Time Instants")); | 786 m_keyReference->setCategory(tr("Tapping Time Instants")); |
787 | 787 |
788 action = new QAction(tr("&Insert Instant at Playback Position"), this); | 788 action = new QAction(tr("&Insert Instant at Playback Position"), this); |
789 action->setShortcut(tr("Enter")); | 789 action->setShortcut(tr(";")); |
790 action->setStatusTip(tr("Insert a new time instant at the current playback position, in a new layer if necessary")); | 790 action->setStatusTip(tr("Insert a new time instant at the current playback position, in a new layer if necessary")); |
791 connect(action, SIGNAL(triggered()), this, SLOT(insertInstant())); | 791 connect(action, SIGNAL(triggered()), this, SLOT(insertInstant())); |
792 connect(this, SIGNAL(canInsertInstant(bool)), action, SLOT(setEnabled(bool))); | 792 connect(this, SIGNAL(canInsertInstant(bool)), action, SLOT(setEnabled(bool))); |
793 m_keyReference->registerShortcut(action); | 793 m_keyReference->registerShortcut(action); |
794 menu->addAction(action); | 794 menu->addAction(action); |
795 | 795 |
796 // Laptop shortcut (no keypad Enter key) | 796 // Historically this was the main shortcut for "Insert Instant at |
797 QString shortcut(tr(";")); | 797 // Playback Position". Note that Enter refers to the keypad key, |
798 // rather than the Return key, so this doesn't actually exist on | |
799 // many keyboards now. Accordingly the alternative shortcut ";" | |
800 // has been promoted to primary, listed above. Same goes for the | |
801 // shifted version below | |
802 QString shortcut(tr("Enter")); | |
798 connect(new QShortcut(shortcut, this), SIGNAL(activated()), | 803 connect(new QShortcut(shortcut, this), SIGNAL(activated()), |
799 this, SLOT(insertInstant())); | 804 this, SLOT(insertInstant())); |
800 m_keyReference->registerAlternativeShortcut(action, shortcut); | 805 m_keyReference->registerAlternativeShortcut(action, shortcut); |
801 | 806 |
802 action = new QAction(tr("Insert Instants at Selection &Boundaries"), this); | 807 action = new QAction(tr("Insert Instants at Selection &Boundaries"), this); |
803 action->setShortcut(tr("Shift+Enter")); | 808 action->setShortcut(tr("Shift+;")); |
804 action->setStatusTip(tr("Insert new time instants at the start and end of the current selected regions, in a new layer if necessary")); | 809 action->setStatusTip(tr("Insert new time instants at the start and end of the current selected regions, in a new layer if necessary")); |
805 connect(action, SIGNAL(triggered()), this, SLOT(insertInstantsAtBoundaries())); | 810 connect(action, SIGNAL(triggered()), this, SLOT(insertInstantsAtBoundaries())); |
806 connect(this, SIGNAL(canInsertInstantsAtBoundaries(bool)), action, SLOT(setEnabled(bool))); | 811 connect(this, SIGNAL(canInsertInstantsAtBoundaries(bool)), action, SLOT(setEnabled(bool))); |
807 m_keyReference->registerShortcut(action); | 812 m_keyReference->registerShortcut(action); |
808 menu->addAction(action); | 813 menu->addAction(action); |
809 | 814 |
815 shortcut = QString(tr("Shift+Enter")); | |
816 connect(new QShortcut(shortcut, this), SIGNAL(activated()), | |
817 this, SLOT(insertInstantsAtBoundaries())); | |
818 m_keyReference->registerAlternativeShortcut(action, shortcut); | |
819 | |
820 // The previous two actions used shortcuts with the (keypad) Enter | |
821 // key, while this one I (bizarrely) switched from Enter to Return | |
822 // in September 2014. Let's make it consistent with the above by | |
823 // making the primary shortcut for it Ctrl+Shift+; and keeping | |
824 // both Return and Enter as synonyms for ; | |
810 action = new QAction(tr("Insert Item at Selection"), this); | 825 action = new QAction(tr("Insert Item at Selection"), this); |
811 action->setShortcut(tr("Ctrl+Shift+Return")); | 826 action->setShortcut(tr("Ctrl+Shift+;")); |
812 action->setStatusTip(tr("Insert a new note or region item corresponding to the current selection")); | 827 action->setStatusTip(tr("Insert a new note or region item corresponding to the current selection")); |
813 connect(action, SIGNAL(triggered()), this, SLOT(insertItemAtSelection())); | 828 connect(action, SIGNAL(triggered()), this, SLOT(insertItemAtSelection())); |
814 connect(this, SIGNAL(canInsertItemAtSelection(bool)), action, SLOT(setEnabled(bool))); | 829 connect(this, SIGNAL(canInsertItemAtSelection(bool)), action, SLOT(setEnabled(bool))); |
815 m_keyReference->registerShortcut(action); | 830 m_keyReference->registerShortcut(action); |
816 menu->addAction(action); | 831 menu->addAction(action); |
832 | |
833 shortcut = QString(tr("Ctrl+Shift+Enter")); | |
834 connect(new QShortcut(shortcut, this), SIGNAL(activated()), | |
835 this, SLOT(insertItemAtSelection())); | |
836 m_keyReference->registerAlternativeShortcut(action, shortcut); | |
837 | |
838 shortcut = QString(tr("Ctrl+Shift+Return")); | |
839 connect(new QShortcut(shortcut, this), SIGNAL(activated()), | |
840 this, SLOT(insertItemAtSelection())); | |
841 // we had that one for historical compatibility, but let's not | |
842 // register it publicly; having three shortcuts for such an | |
843 // obscure function is really over-egging it | |
817 | 844 |
818 menu->addSeparator(); | 845 menu->addSeparator(); |
819 | 846 |
820 QMenu *numberingMenu = menu->addMenu(tr("Number New Instants with")); | 847 QMenu *numberingMenu = menu->addMenu(tr("Number New Instants with")); |
821 numberingMenu->setTearOffEnabled(true); | 848 numberingMenu->setTearOffEnabled(true); |