]> git.lyx.org Git - features.git/commitdiff
improvements to the Shortcuts UI.
authorJürgen Spitzmüller <spitz@lyx.org>
Mon, 21 Apr 2008 10:10:12 +0000 (10:10 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Mon, 21 Apr 2008 10:10:12 +0000 (10:10 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24412 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiPrefs.cpp
src/frontends/qt4/GuiPrefs.h
src/frontends/qt4/ui/PrefShortcutsUi.ui
src/frontends/qt4/ui/ShortcutUi.ui

index 103003be7acb02005445d859da3f06054aa2cdee..d5e114fb770ef0f9f9d98ec35fb19dc6a1928adb 100644 (file)
@@ -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<QTreeWidgetItem*> 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<QTreeWidgetItem*> 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();
index 36a2b2e15ef3dd632fec9b3ceb6712876198f17d..43a9e16863d12dc7cb1c9a61d43d81c4cc78ebd7 100644 (file)
@@ -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();
index 4c2813530071df27abc795c8a62612ca897ef179..34ce3863ccbf9de5fc02cb475ab34914cd93f0bc 100644 (file)
@@ -27,7 +27,7 @@
    <property name="spacing" >
     <number>6</number>
    </property>
-   <item row="1" column="0" colspan="3" >
+   <item row="3" column="0" colspan="3" >
     <layout class="QHBoxLayout" >
      <property name="margin" >
       <number>0</number>
       <number>6</number>
      </property>
      <item>
-      <widget class="QLabel" name="shortcutsLBL" >
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" >
+        <size>
+         <width>131</width>
+         <height>27</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="modifyPB" >
        <property name="text" >
-        <string>Show ke&amp;y-bindings containing:</string>
+        <string>&amp;Modify</string>
        </property>
-       <property name="buddy" >
-        <cstring>searchLE</cstring>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="removePB" >
+       <property name="text" >
+        <string>Remo&amp;ve</string>
        </property>
       </widget>
      </item>
      <item>
-      <widget class="QLineEdit" name="searchLE" />
+      <widget class="QPushButton" name="newPB" >
+       <property name="text" >
+        <string>Ne&amp;w</string>
+       </property>
+      </widget>
      </item>
     </layout>
    </item>
+   <item row="2" column="0" colspan="3" >
+    <widget class="QTreeWidget" name="shortcutsTW" />
+   </item>
+   <item row="0" column="1" >
+    <widget class="QLineEdit" name="bindFileED" />
+   </item>
+   <item row="0" column="2" >
+    <widget class="QPushButton" name="bindFilePB" >
+     <property name="text" >
+      <string>Br&amp;owse...</string>
+     </property>
+    </widget>
+   </item>
    <item row="0" column="0" >
     <widget class="QLabel" name="bindFileLA" >
      <property name="text" >
      </property>
     </widget>
    </item>
-   <item row="0" column="2" >
-    <widget class="QPushButton" name="bindFilePB" >
-     <property name="text" >
-      <string>Br&amp;owse...</string>
-     </property>
-    </widget>
-   </item>
-   <item row="0" column="1" >
-    <widget class="QLineEdit" name="bindFileED" />
-   </item>
-   <item row="2" column="0" colspan="3" >
-    <widget class="QTreeWidget" name="shortcutsTW" />
-   </item>
-   <item row="3" column="0" colspan="3" >
+   <item row="1" column="0" colspan="3" >
     <layout class="QHBoxLayout" >
      <property name="margin" >
       <number>0</number>
       <number>6</number>
      </property>
      <item>
-      <spacer>
-       <property name="orientation" >
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeHint" >
-        <size>
-         <width>40</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-     <item>
-      <widget class="QPushButton" name="removePB" >
+      <widget class="QLabel" name="shortcutsLBL" >
        <property name="text" >
-        <string>Remo&amp;ve</string>
+        <string>Show ke&amp;y-bindings containing:</string>
+       </property>
+       <property name="buddy" >
+        <cstring>searchLE</cstring>
        </property>
       </widget>
      </item>
      <item>
-      <widget class="QPushButton" name="newPB" >
-       <property name="text" >
-        <string>Ne&amp;w</string>
-       </property>
-      </widget>
+      <widget class="QLineEdit" name="searchLE" />
      </item>
     </layout>
    </item>
index 1315b67fb26602cbd35a05179eb7c0d220cb931d..cabe9b8094fc6a1ab544be7fbdfb9a207b76508d 100644 (file)
@@ -1,7 +1,4 @@
 <ui version="4.0" >
- <author></author>
- <comment></comment>
- <exportmacro></exportmacro>
  <class>shortcutUi</class>
  <widget class="QDialog" name="shortcutUi" >
   <property name="geometry" >
@@ -31,7 +28,7 @@
       <bool>true</bool>
      </property>
      <property name="toolTip" >
-      <string>Enter BibTeX database name</string>
+      <string>Type shortcut while the cursor is in this field</string>
      </property>
      <property name="text" >
       <string/>
@@ -41,7 +38,7 @@
    <item row="0" column="1" colspan="2" >
     <widget class="QLineEdit" name="lfunLE" >
      <property name="toolTip" >
-      <string>Enter BibTeX database name</string>
+      <string>Enter LyX function or command sequence</string>
      </property>
      <property name="text" >
       <string/>
    <item row="1" column="2" >
     <widget class="QPushButton" name="clearPB" >
      <property name="text" >
-      <string>Clear</string>
+      <string>C&amp;lear</string>
      </property>
     </widget>
    </item>
    <item row="0" column="0" >
     <widget class="QLabel" name="lfunLBL" >
      <property name="text" >
-      <string>Function:</string>
+      <string>&amp;Function:</string>
+     </property>
+     <property name="buddy" >
+      <cstring>lfunLE</cstring>
      </property>
     </widget>
    </item>
    <item row="1" column="0" >
     <widget class="QLabel" name="shortcutLBL" >
      <property name="text" >
-      <string>Shortcut</string>
+      <string>&amp;Shortcut:</string>
+     </property>
+     <property name="buddy" >
+      <cstring>shortcutLE</cstring>
      </property>
     </widget>
    </item>
    </item>
   </layout>
  </widget>
- <pixmapfunction></pixmapfunction>
  <customwidgets>
   <customwidget>
    <class>lyx::frontend::ShortcutLineEdit</class>
    <extends>QLineEdit</extends>
    <header>CustomizedWidgets.h</header>
-   <container>0</container>
-   <pixmap></pixmap>
   </customwidget>
  </customwidgets>
  <tabstops>