From: Jürgen Spitzmüller Date: Mon, 21 Apr 2008 10:10:12 +0000 (+0000) Subject: improvements to the Shortcuts UI. X-Git-Tag: 1.6.10~5063 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=5084d54f411a91f90b86815bfb4a20c16b370af3;p=features.git improvements to the Shortcuts UI. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24412 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index 103003be7a..d5e114fb77 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -1972,7 +1972,6 @@ PrefShortcuts::PrefShortcuts(GuiPreferences * form, QWidget * parent) shortcutsTW->setSortingEnabled(true); // Multi-selection can be annoying. // shortcutsTW->setSelectionMode(QAbstractItemView::MultiSelection); - shortcutsTW->header()->resizeSection(0, 200); connect(bindFilePB, SIGNAL(clicked()), this, SLOT(select_bind())); @@ -2085,6 +2084,9 @@ void PrefShortcuts::updateShortcutsTW() shortcutsTW->sortItems(0, Qt::AscendingOrder); QList items = shortcutsTW->selectedItems(); removePB->setEnabled(!items.isEmpty() && !items[0]->text(1).isEmpty()); + modifyPB->setEnabled(!items.isEmpty()); + + shortcutsTW->resizeColumnToContents(0); } @@ -2178,6 +2180,7 @@ void PrefShortcuts::on_shortcutsTW_itemSelectionChanged() { QList items = shortcutsTW->selectedItems(); removePB->setEnabled(!items.isEmpty() && !items[0]->text(1).isEmpty()); + modifyPB->setEnabled(!items.isEmpty()); if (items.isEmpty()) return; @@ -2190,13 +2193,17 @@ void PrefShortcuts::on_shortcutsTW_itemSelectionChanged() void PrefShortcuts::on_shortcutsTW_itemDoubleClicked() +{ + modifyShortcut(); +} + + +void PrefShortcuts::modifyShortcut() { QTreeWidgetItem * item = shortcutsTW->currentItem(); if (item->flags() & Qt::ItemIsSelectable) { shortcut_->lfunLE->setText(item->text(0)); - // clear the shortcut because I assume that a user will enter - // a new shortcut. - shortcut_->shortcutLE->reset(); + shortcut_->shortcutLE->setText(item->text(1)); shortcut_->shortcutLE->setFocus(); shortcut_->exec(); } @@ -2215,6 +2222,12 @@ void PrefShortcuts::select_bind() } +void PrefShortcuts::on_modifyPB_pressed() +{ + modifyShortcut(); +} + + void PrefShortcuts::on_newPB_pressed() { shortcut_->lfunLE->clear(); diff --git a/src/frontends/qt4/GuiPrefs.h b/src/frontends/qt4/GuiPrefs.h index 36a2b2e15e..43a9e16863 100644 --- a/src/frontends/qt4/GuiPrefs.h +++ b/src/frontends/qt4/GuiPrefs.h @@ -399,6 +399,7 @@ public: void apply(LyXRC & rc) const; void update(LyXRC const & rc); void updateShortcutsTW(); + void modifyShortcut(); /// void setItemType(QTreeWidgetItem * item, item_type tag); QTreeWidgetItem * insertShortcutItem(FuncRequest const & lfun, @@ -406,6 +407,7 @@ public: public Q_SLOTS: void select_bind(); + void on_modifyPB_pressed(); void on_newPB_pressed(); void on_removePB_pressed(); void on_searchLE_textEdited(); diff --git a/src/frontends/qt4/ui/PrefShortcutsUi.ui b/src/frontends/qt4/ui/PrefShortcutsUi.ui index 4c28135300..34ce3863cc 100644 --- a/src/frontends/qt4/ui/PrefShortcutsUi.ui +++ b/src/frontends/qt4/ui/PrefShortcutsUi.ui @@ -27,7 +27,7 @@ 6 - + 0 @@ -36,20 +36,54 @@ 6 - + + + Qt::Horizontal + + + + 131 + 27 + + + + + + - Show ke&y-bindings containing: + &Modify - - searchLE + + + + + + Remo&ve - + + + Ne&w + + + + + + + + + + + + Br&owse... + + + @@ -60,20 +94,7 @@ - - - - Br&owse... - - - - - - - - - - + 0 @@ -82,31 +103,17 @@ 6 - - - Qt::Horizontal - - - - 40 - 20 - - - - - - + - Remo&ve + Show ke&y-bindings containing: + + + searchLE - - - Ne&w - - + diff --git a/src/frontends/qt4/ui/ShortcutUi.ui b/src/frontends/qt4/ui/ShortcutUi.ui index 1315b67fb2..cabe9b8094 100644 --- a/src/frontends/qt4/ui/ShortcutUi.ui +++ b/src/frontends/qt4/ui/ShortcutUi.ui @@ -1,7 +1,4 @@ - - - shortcutUi @@ -31,7 +28,7 @@ true - Enter BibTeX database name + Type shortcut while the cursor is in this field @@ -41,7 +38,7 @@ - Enter BibTeX database name + Enter LyX function or command sequence @@ -51,21 +48,27 @@ - Clear + C&lear - Function: + &Function: + + + lfunLE - Shortcut + &Shortcut: + + + shortcutLE @@ -120,14 +123,11 @@ - lyx::frontend::ShortcutLineEdit QLineEdit
CustomizedWidgets.h
- 0 -