| 620 | } // PreferencesPanel::createPluginsView |
| 621 | |
| 622 | void |
| 623 | PreferencesPanel::createShortcutEditor(QTreeWidgetItem* uiPageTreeItem) |
| 624 | { |
| 625 | _imp->shortcutsFrame = dynamic_cast<QFrame*>( createPageMainWidget(this) ); |
| 626 | _imp->shortcutsLayout = new QVBoxLayout(_imp->shortcutsFrame); |
| 627 | _imp->shortcutsTree = new HackedTreeWidget(_imp->shortcutsFrame); |
| 628 | _imp->shortcutsTree->setColumnCount(3); |
| 629 | QStringList headers; |
| 630 | headers << tr("Command") << tr("Shortcut") << tr("Alt. Shortcut"); |
| 631 | _imp->shortcutsTree->setHeaderLabels(headers); |
| 632 | _imp->shortcutsTree->setSelectionMode(QAbstractItemView::SingleSelection); |
| 633 | _imp->shortcutsTree->setAttribute(Qt::WA_MacShowFocusRect, 0); |
| 634 | _imp->shortcutsTree->setSortingEnabled(false); |
| 635 | _imp->shortcutsTree->setToolTip( NATRON_NAMESPACE::convertFromPlainText( |
| 636 | tr("In this table is represented each action of the application that can have a possible keybind/mouse shortcut." |
| 637 | " Note that this table also have some special assignments which also involve the mouse. " |
| 638 | "You cannot assign a keybind to a shortcut involving the mouse and vice versa. " |
| 639 | "Note that internally %1 does an emulation of a three-button mouse " |
| 640 | "if your computer doesn't have one, that is: \n" |
| 641 | "---> Middle mouse button is emulated by holding down Options (alt) coupled with a left click.\n " |
| 642 | "---> Right mouse button is emulated by holding down Command (cmd) coupled with a left click.").arg( QString::fromUtf8(NATRON_APPLICATION_NAME) ), NATRON_NAMESPACE::WhiteSpaceNormal) ); |
| 643 | _imp->shortcutsTree->setItemDelegate( new ShortcutDelegate(_imp->shortcutsTree) ); |
| 644 | |
| 645 | const AppShortcuts & appShortcuts = appPTR->getAllShortcuts(); |
| 646 | |
| 647 | for (AppShortcuts::const_iterator it = appShortcuts.begin(); it != appShortcuts.end(); ++it) { |
| 648 | GuiAppShorcuts::iterator foundGuiGroup = _imp->buildShortcutsGroupHierarchy(it->first); |
| 649 | assert( foundGuiGroup != _imp->appShortcuts.end() ); |
| 650 | |
| 651 | for (GroupShortcuts::const_iterator it2 = it->second.begin(); it2 != it->second.end(); ++it2) { |
| 652 | _imp->makeGuiActionForShortcut(foundGuiGroup, it2->second); |
| 653 | } |
| 654 | } |
| 655 | |
| 656 | _imp->shortcutsTree->resizeColumnToContents(0); |
| 657 | QObject::connect( _imp->shortcutsTree, SIGNAL(itemSelectionChanged()), this, SLOT(onShortcutsSelectionChanged()) ); |
| 658 | |
| 659 | _imp->shortcutsLayout->addWidget(_imp->shortcutsTree); |
| 660 | |
| 661 | _imp->shortcutGroup = new QWidget(_imp->shortcutsFrame); |
| 662 | _imp->shortcutsLayout->addWidget(_imp->shortcutGroup); |
| 663 | |
| 664 | _imp->shortcutGroupLayout = new QHBoxLayout(_imp->shortcutGroup); |
| 665 | _imp->shortcutGroupLayout->setContentsMargins(0, 0, 0, 0); |
| 666 | |
| 667 | _imp->shortcutLabel = new Label(_imp->shortcutGroup); |
| 668 | _imp->shortcutLabel->setText( tr("Sequence:") ); |
| 669 | _imp->shortcutGroupLayout->addWidget(_imp->shortcutLabel); |
| 670 | |
| 671 | _imp->shortcutEditor = new KeybindRecorder(_imp->shortcutGroup); |
| 672 | _imp->shortcutEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); |
| 673 | _imp->shortcutEditor->setPlaceholderText( tr("Type to set shortcut") ); |
| 674 | _imp->shortcutGroupLayout->addWidget(_imp->shortcutEditor); |
| 675 | |
| 676 | _imp->altShortcutGroup = new QWidget(this); |
| 677 | _imp->shortcutsLayout->addWidget(_imp->altShortcutGroup); |
| 678 | |
| 679 | _imp->altShortcutGroupLayout = new QHBoxLayout(_imp->altShortcutGroup); |
nothing calls this directly
no test coverage detected