| 1615 | } |
| 1616 | |
| 1617 | void |
| 1618 | PreferencesPanel::onResetShortcutButtonClicked() |
| 1619 | { |
| 1620 | QList<QTreeWidgetItem*> items = _imp->shortcutsTree->selectedItems(); |
| 1621 | if (items.size() > 1) { |
| 1622 | //we do not support selection of more than 1 item |
| 1623 | return; |
| 1624 | } |
| 1625 | |
| 1626 | if ( items.empty() ) { |
| 1627 | _imp->shortcutEditor->setText( QString() ); |
| 1628 | _imp->shortcutEditor->setPlaceholderText( tr("Type to set shortcut") ); |
| 1629 | |
| 1630 | return; |
| 1631 | } |
| 1632 | |
| 1633 | QTreeWidgetItem* selection = items.front(); |
| 1634 | BoundAction* action = _imp->getActionForTreeItem(selection); |
| 1635 | assert(action); |
| 1636 | action->modifiers = action->defaultModifiers; |
| 1637 | KeyBoundAction* ka = dynamic_cast<KeyBoundAction*>(action); |
| 1638 | if (ka) { |
| 1639 | ka->currentShortcut = ka->defaultShortcut; |
| 1640 | appPTR->notifyShortcutChanged(ka); |
| 1641 | } |
| 1642 | setItemShortCutText(selection, action, true); |
| 1643 | |
| 1644 | QString sc, altsc; |
| 1645 | makeItemShortCutText(action, true, &sc, &altsc); |
| 1646 | _imp->shortcutEditor->setText(sc); |
| 1647 | _imp->altShortcutEditor->setText(altsc); |
| 1648 | } |
| 1649 | |
| 1650 | void |
| 1651 | PreferencesPanel::onRestoreDefaultShortcutsButtonClicked() |
nothing calls this directly
no test coverage detected