History

Merge branch 'master' of https://github.com/highfidelity/hifi into authentication

Stephen Birarda committed 12 years ago

Commit 66817542 parents ea61ccf 8e097be38 files · +1152 −268Browse files

Showing the changes to interface/src/Menu.cpp (1 of 38 files). Show all

Unified · Split

interface/src/Menu.cpp+45−1
@@ -161,6 +161,15 @@ Menu::Menu() : · 160 unmodified lines
161 161
162 162
163 QMenu* editMenu = addMenu("Edit");163 QMenu* editMenu = addMenu("Edit");
164
165 QUndoStack* undoStack = Application::getInstance()->getUndoStack();
166 QAction* undoAction = undoStack->createUndoAction(editMenu);
167 undoAction->setShortcut(Qt::CTRL | Qt::Key_Z);
168 addActionToQMenuAndActionHash(editMenu, undoAction);
169
170 QAction* redoAction = undoStack->createRedoAction(editMenu);
171 redoAction->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_Z);
172 addActionToQMenuAndActionHash(editMenu, redoAction);
164 173
165 addActionToQMenuAndActionHash(editMenu,174 addActionToQMenuAndActionHash(editMenu,
166 MenuOption::Preferences,175 MenuOption::Preferences,
@@ -183,7 +192,7 @@ Menu::Menu() : · 16 unmodified lines
183#ifdef HAVE_QXMPP192#ifdef HAVE_QXMPP
184 _chatAction = addActionToQMenuAndActionHash(toolsMenu,193 _chatAction = addActionToQMenuAndActionHash(toolsMenu,
185 MenuOption::Chat,194 MenuOption::Chat,
186 Qt::Key_Return,195 0,
187 this,196 this,
188 SLOT(showChat()));197 SLOT(showChat()));
189 198
@@ -620,6 +629,41 @@ QAction* Menu::addActionToQMenuAndActionHash(QMenu* destinationMenu, · 430 unmodified lines
620 return action;629 return action;
621}630}
622 631
632QAction* Menu::addActionToQMenuAndActionHash(QMenu* destinationMenu,
633 QAction* action,
634 const QString& actionName,
635 const QKeySequence& shortcut,
636 QAction::MenuRole role,
637 int menuItemLocation) {
638 QAction* actionBefore = NULL;
639
640 if (menuItemLocation >= 0 && destinationMenu->actions().size() > menuItemLocation) {
641 actionBefore = destinationMenu->actions()[menuItemLocation];
642 }
643
644 if (!actionName.isEmpty()) {
645 action->setText(actionName);
646 }
647
648 if (shortcut != 0) {
649 action->setShortcut(shortcut);
650 }
651
652 if (role != QAction::NoRole) {
653 action->setMenuRole(role);
654 }
655
656 if (!actionBefore) {
657 destinationMenu->addAction(action);
658 } else {
659 destinationMenu->insertAction(actionBefore, action);
660 }
661
662 _actionHash.insert(action->text(), action);
663
664 return action;
665}
666
623QAction* Menu::addCheckableActionToQMenuAndActionHash(QMenu* destinationMenu,667QAction* Menu::addCheckableActionToQMenuAndActionHash(QMenu* destinationMenu,
624 const QString& actionName,668 const QString& actionName,
625 const QKeySequence& shortcut,669 const QKeySequence& shortcut,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t