]> git.lyx.org Git - features.git/commitdiff
Move completion to a pane of its own.
authorJürgen Spitzmüller <spitz@lyx.org>
Tue, 18 Mar 2008 17:31:17 +0000 (17:31 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Tue, 18 Mar 2008 17:31:17 +0000 (17:31 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23811 a592a061-630c-0410-9148-cb99ea01b6c8

development/scons/scons_manifest.py
src/frontends/qt4/GuiPrefs.cpp
src/frontends/qt4/GuiPrefs.h
src/frontends/qt4/Makefile.am
src/frontends/qt4/ui/PrefCompletionUi.ui [new file with mode: 0644]
src/frontends/qt4/ui/PrefInputUi.ui

index 3b6bda5569dd2e71fab8c9940ea746f7a25cd93c..fb07075997ae14c76dca5d93558cfadbb092136d 100644 (file)
@@ -928,6 +928,7 @@ src_frontends_qt4_ui_files = Split('''
     PDFSupportUi.ui
     PreambleUi.ui
     PrefColorsUi.ui
+    PrefCompletionUi.ui
     PrefConvertersUi.ui
     PrefDateUi.ui
     PrefDisplayUi.ui
index 6bf30bc31bf5714f4137db03f573ad3e61a2ab0b..de3929ef845b567f723995a0deba783b7cb199f7 100644 (file)
@@ -390,24 +390,6 @@ PrefInput::PrefInput(GuiPreferences * form, QWidget * parent)
                this, SIGNAL(changed()));
        connect(secondKeymapED, SIGNAL(textChanged(QString)),
                this, SIGNAL(changed()));
-       connect(inlineDelaySB, SIGNAL(valueChanged(double)),
-               this, SIGNAL(changed()));
-       connect(inlineMathCB, SIGNAL(clicked()),
-               this, SIGNAL(changed()));
-       connect(inlineTextCB, SIGNAL(clicked()),
-               this, SIGNAL(changed()));
-       connect(inlineDotsCB, SIGNAL(clicked()),
-               this, SIGNAL(changed()));
-       connect(popupDelaySB, SIGNAL(valueChanged(double)),
-               this, SIGNAL(changed()));
-       connect(popupMathCB, SIGNAL(clicked()),
-               this, SIGNAL(changed()));
-       connect(popupTextCB, SIGNAL(clicked()),
-               this, SIGNAL(changed()));
-       connect(popupAfterCompleteCB, SIGNAL(clicked()),
-               this, SIGNAL(changed()));
-       connect(cursorTextCB, SIGNAL(clicked()),
-               this, SIGNAL(changed()));
        connect(mouseWheelSpeedSB, SIGNAL(valueChanged(double)),
                this, SIGNAL(changed()));
 }
@@ -419,16 +401,6 @@ void PrefInput::apply(LyXRC & rc) const
        rc.use_kbmap = keymapCB->isChecked();
        rc.primary_kbmap = internal_path(fromqstr(firstKeymapED->text()));
        rc.secondary_kbmap = internal_path(fromqstr(secondKeymapED->text()));
-       rc.completion_inline_delay = inlineDelaySB->value();
-       rc.completion_inline_math = inlineMathCB->isChecked();
-       rc.completion_inline_text = inlineTextCB->isChecked();
-       rc.completion_inline_dots = inlineDotsCB->isChecked() ? 13 : -1;
-       rc.completion_popup_delay = popupDelaySB->value();
-       rc.completion_popup_math = popupMathCB->isChecked();
-       rc.completion_popup_text = popupTextCB->isChecked();
-       rc.completion_cursor_text = cursorTextCB->isChecked();
-       rc.completion_popup_after_complete
-       = popupAfterCompleteCB->isChecked();
        rc.mouse_wheel_speed = mouseWheelSpeedSB->value();
 }
 
@@ -439,15 +411,6 @@ void PrefInput::update(LyXRC const & rc)
        keymapCB->setChecked(rc.use_kbmap);
        firstKeymapED->setText(toqstr(external_path(rc.primary_kbmap)));
        secondKeymapED->setText(toqstr(external_path(rc.secondary_kbmap)));
-       inlineDelaySB->setValue(rc.completion_inline_delay);
-       inlineMathCB->setChecked(rc.completion_inline_math);
-       inlineTextCB->setChecked(rc.completion_inline_text);
-       inlineDotsCB->setChecked(rc.completion_inline_dots != -1);
-       popupDelaySB->setValue(rc.completion_popup_delay);
-       popupMathCB->setChecked(rc.completion_popup_math);
-       popupTextCB->setChecked(rc.completion_popup_text);
-       cursorTextCB->setChecked(rc.completion_cursor_text);
-       popupAfterCompleteCB->setChecked(rc.completion_popup_after_complete);
        mouseWheelSpeedSB->setValue(rc.mouse_wheel_speed);
 }
 
@@ -485,6 +448,68 @@ void PrefInput::on_keymapCB_toggled(bool keymap)
 }
 
 
+/////////////////////////////////////////////////////////////////////
+//
+// PrefCompletion
+//
+/////////////////////////////////////////////////////////////////////
+
+PrefCompletion::PrefCompletion(GuiPreferences * form, QWidget * parent)
+       : PrefModule(qt_("Input Completion"), form, parent)
+{
+       setupUi(this);
+
+       connect(inlineDelaySB, SIGNAL(valueChanged(double)),
+               this, SIGNAL(changed()));
+       connect(inlineMathCB, SIGNAL(clicked()),
+               this, SIGNAL(changed()));
+       connect(inlineTextCB, SIGNAL(clicked()),
+               this, SIGNAL(changed()));
+       connect(inlineDotsCB, SIGNAL(clicked()),
+               this, SIGNAL(changed()));
+       connect(popupDelaySB, SIGNAL(valueChanged(double)),
+               this, SIGNAL(changed()));
+       connect(popupMathCB, SIGNAL(clicked()),
+               this, SIGNAL(changed()));
+       connect(popupTextCB, SIGNAL(clicked()),
+               this, SIGNAL(changed()));
+       connect(popupAfterCompleteCB, SIGNAL(clicked()),
+               this, SIGNAL(changed()));
+       connect(cursorTextCB, SIGNAL(clicked()),
+               this, SIGNAL(changed()));
+}
+
+
+void PrefCompletion::apply(LyXRC & rc) const
+{
+       rc.completion_inline_delay = inlineDelaySB->value();
+       rc.completion_inline_math = inlineMathCB->isChecked();
+       rc.completion_inline_text = inlineTextCB->isChecked();
+       rc.completion_inline_dots = inlineDotsCB->isChecked() ? 13 : -1;
+       rc.completion_popup_delay = popupDelaySB->value();
+       rc.completion_popup_math = popupMathCB->isChecked();
+       rc.completion_popup_text = popupTextCB->isChecked();
+       rc.completion_cursor_text = cursorTextCB->isChecked();
+       rc.completion_popup_after_complete =
+               popupAfterCompleteCB->isChecked();
+}
+
+
+void PrefCompletion::update(LyXRC const & rc)
+{
+       inlineDelaySB->setValue(rc.completion_inline_delay);
+       inlineMathCB->setChecked(rc.completion_inline_math);
+       inlineTextCB->setChecked(rc.completion_inline_text);
+       inlineDotsCB->setChecked(rc.completion_inline_dots != -1);
+       popupDelaySB->setValue(rc.completion_popup_delay);
+       popupMathCB->setChecked(rc.completion_popup_math);
+       popupTextCB->setChecked(rc.completion_popup_text);
+       cursorTextCB->setChecked(rc.completion_cursor_text);
+       popupAfterCompleteCB->setChecked(rc.completion_popup_after_complete);
+}
+
+
+
 /////////////////////////////////////////////////////////////////////
 //
 // PrefLatex
@@ -2377,6 +2402,7 @@ GuiPreferences::GuiPreferences(GuiView & lv)
        add(new PrefColors(this));
        add(new PrefDisplay);
        add(new PrefInput(this));
+       add(new PrefCompletion(this));
 
        add(new PrefPaths(this));
 
index 77a5382fe3f7a7998a88d44feecd102c0cb3cf82..b7e0afc794b7d5c813199433f6316f09a3149b7e 100644 (file)
@@ -31,6 +31,7 @@
 #include "ui_PrefInputUi.h"
 #include "ui_PrefLatexUi.h"
 #include "ui_PrefScreenFontsUi.h"
+#include "ui_PrefCompletionUi.h"
 #include "ui_PrefColorsUi.h"
 #include "ui_PrefDisplayUi.h"
 #include "ui_PrefEditUi.h"
@@ -126,6 +127,17 @@ private:
 };
 
 
+class PrefCompletion : public PrefModule, public Ui::PrefCompletionUi
+{
+       Q_OBJECT
+public:
+       PrefCompletion(GuiPreferences * form, QWidget * parent = 0);
+
+       virtual void apply(LyXRC & rc) const;
+       virtual void update(LyXRC const & rc);
+};
+
+
 class PrefLatex : public PrefModule, public Ui::PrefLatexUi
 {
        Q_OBJECT
index d148e26356c8ce5d1c2d23902bb8413e0798a6bb..687c9f761419f474c3b968f241518be8dc1f5212 100644 (file)
@@ -265,6 +265,7 @@ UIFILES = \
        PDFSupportUi.ui \
        PreambleUi.ui \
        PrefColorsUi.ui \
+       PrefCompletionUi.ui \
        PrefConvertersUi.ui \
        PrefDateUi.ui \
        PrefDisplayUi.ui \
diff --git a/src/frontends/qt4/ui/PrefCompletionUi.ui b/src/frontends/qt4/ui/PrefCompletionUi.ui
new file mode 100644 (file)
index 0000000..131c904
--- /dev/null
@@ -0,0 +1,261 @@
+<ui version="4.0" >
+ <class>PrefCompletionUi</class>
+ <widget class="QWidget" name="PrefCompletionUi" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>480</width>
+    <height>404</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string/>
+  </property>
+  <layout class="QGridLayout" >
+   <property name="margin" >
+    <number>9</number>
+   </property>
+   <property name="spacing" >
+    <number>6</number>
+   </property>
+   <item row="1" column="0" >
+    <widget class="QGroupBox" name="groupBox_3" >
+     <property name="title" >
+      <string>In Math</string>
+     </property>
+     <property name="flat" >
+      <bool>true</bool>
+     </property>
+     <layout class="QVBoxLayout" >
+      <property name="margin" >
+       <number>9</number>
+      </property>
+      <property name="spacing" >
+       <number>6</number>
+      </property>
+      <item>
+       <widget class="QCheckBox" name="inlineMathCB" >
+        <property name="toolTip" >
+         <string>Show the grey inline completion behind the cursor in math mode after the delay.</string>
+        </property>
+        <property name="text" >
+         <string>Automatic in&amp;line completion</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QCheckBox" name="popupMathCB" >
+        <property name="toolTip" >
+         <string>Show the popup in math mode after the delay.</string>
+        </property>
+        <property name="text" >
+         <string>Automatic p&amp;opup</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="0" column="0" >
+    <widget class="QGroupBox" name="groupBox_2" >
+     <property name="title" >
+      <string>In Text</string>
+     </property>
+     <property name="flat" >
+      <bool>true</bool>
+     </property>
+     <layout class="QVBoxLayout" >
+      <property name="margin" >
+       <number>9</number>
+      </property>
+      <property name="spacing" >
+       <number>6</number>
+      </property>
+      <item>
+       <widget class="QCheckBox" name="inlineTextCB" >
+        <property name="toolTip" >
+         <string>Show the grey inline completion behind the cursor in text mode after the delay.</string>
+        </property>
+        <property name="text" >
+         <string>Automatic &amp;inline completion</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QCheckBox" name="popupTextCB" >
+        <property name="toolTip" >
+         <string>Show the popup after the set delay in text mode.</string>
+        </property>
+        <property name="text" >
+         <string>Automatic &amp;popup</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QCheckBox" name="cursorTextCB" >
+        <property name="toolTip" >
+         <string>Show a small triangle on the cursor if a completion is available in text mode.</string>
+        </property>
+        <property name="text" >
+         <string>Cursor i&amp;ndicator</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="2" column="0" >
+    <widget class="QGroupBox" name="groupBox_4" >
+     <property name="title" >
+      <string>General</string>
+     </property>
+     <property name="flat" >
+      <bool>true</bool>
+     </property>
+     <layout class="QVBoxLayout" >
+      <property name="margin" >
+       <number>9</number>
+      </property>
+      <property name="spacing" >
+       <number>6</number>
+      </property>
+      <item>
+       <layout class="QHBoxLayout" >
+        <property name="margin" >
+         <number>0</number>
+        </property>
+        <property name="spacing" >
+         <number>6</number>
+        </property>
+        <item>
+         <widget class="QDoubleSpinBox" name="inlineDelaySB" >
+          <property name="toolTip" >
+           <string>After the cursor has not moved for this time, the inline completion is shown if it is available.</string>
+          </property>
+          <property name="maximum" >
+           <double>10.000000000000000</double>
+          </property>
+          <property name="singleStep" >
+           <double>0.100000000000000</double>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QLabel" name="label_4" >
+          <property name="text" >
+           <string>s inline completion dela&amp;y</string>
+          </property>
+          <property name="buddy" >
+           <cstring>inlineDelaySB</cstring>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <spacer>
+          <property name="orientation" >
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeHint" >
+           <size>
+            <width>40</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <layout class="QHBoxLayout" >
+        <property name="margin" >
+         <number>0</number>
+        </property>
+        <property name="spacing" >
+         <number>6</number>
+        </property>
+        <item>
+         <widget class="QDoubleSpinBox" name="popupDelaySB" >
+          <property name="toolTip" >
+           <string>After the cursor has not moved for this time, the completion popup is shown if it is available.</string>
+          </property>
+          <property name="maximum" >
+           <double>10.000000000000000</double>
+          </property>
+          <property name="singleStep" >
+           <double>0.100000000000000</double>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QLabel" name="label_3" >
+          <property name="text" >
+           <string>s popup d&amp;elay</string>
+          </property>
+          <property name="buddy" >
+           <cstring>popupDelaySB</cstring>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <spacer>
+          <property name="orientation" >
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeHint" >
+           <size>
+            <width>40</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <widget class="QCheckBox" name="popupAfterCompleteCB" >
+        <property name="toolTip" >
+         <string>When the TAB completion is not unique, there won't be a delay of the popup. It will be shown right away.</string>
+        </property>
+        <property name="text" >
+         <string>Sho&amp;w popup without delay for non-unique completions</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QCheckBox" name="inlineDotsCB" >
+        <property name="toolTip" >
+         <string>Long completions are cut-off and shown with "...".</string>
+        </property>
+        <property name="text" >
+         <string>&amp;Use "..." to shorten long completions</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="3" column="0" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeType" >
+      <enum>QSizePolicy::Expanding</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>462</width>
+       <height>16</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <includes>
+  <include location="local" >qt_helpers.h</include>
+ </includes>
+ <resources/>
+ <connections/>
+</ui>
index 3d525662f23498eebb56f2994e48e3b0add3795a..8c52b35b4627f9aac42194ffc48c675d6a4c4c72 100644 (file)
@@ -6,13 +6,19 @@
     <x>0</x>
     <y>0</y>
     <width>480</width>
-    <height>609</height>
+    <height>228</height>
    </rect>
   </property>
   <property name="windowTitle" >
    <string/>
   </property>
   <layout class="QVBoxLayout" >
+   <property name="margin" >
+    <number>9</number>
+   </property>
+   <property name="spacing" >
+    <number>6</number>
+   </property>
    <item>
     <widget class="QGroupBox" name="keyboardGB" >
      <property name="title" >
       <bool>true</bool>
      </property>
      <layout class="QGridLayout" >
+      <property name="margin" >
+       <number>9</number>
+      </property>
+      <property name="spacing" >
+       <number>6</number>
+      </property>
       <item row="0" column="0" colspan="3" >
        <widget class="QCheckBox" name="keymapCB" >
         <property name="text" >
          <bool>false</bool>
         </property>
         <property name="text" >
-         <string>Bro&amp;wse...</string>
+         <string>B&amp;rowse...</string>
         </property>
         <property name="autoDefault" >
          <bool>false</bool>
      </layout>
     </widget>
    </item>
-   <item>
-    <widget class="QGroupBox" name="groupBox" >
-     <property name="title" >
-      <string>Completion</string>
-     </property>
-     <property name="flat" >
-      <bool>true</bool>
-     </property>
-     <layout class="QVBoxLayout" >
-      <item>
-       <widget class="QGroupBox" name="groupBox_2" >
-        <property name="title" >
-         <string>In Text</string>
-        </property>
-        <property name="flat" >
-         <bool>false</bool>
-        </property>
-        <layout class="QVBoxLayout" >
-         <item>
-          <widget class="QCheckBox" name="inlineTextCB" >
-           <property name="toolTip" >
-            <string>Show the grey inline completion behind the cursor in text mode after the delay.</string>
-           </property>
-           <property name="text" >
-            <string>Automatic inline completion</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QCheckBox" name="popupTextCB" >
-           <property name="toolTip" >
-            <string>Show the popup after the set delay in text mode.</string>
-           </property>
-           <property name="text" >
-            <string>Automatic popup</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QCheckBox" name="cursorTextCB" >
-           <property name="toolTip" >
-            <string>Show a small triangle on the cursor if a completion is available in text mode.</string>
-           </property>
-           <property name="text" >
-            <string>Cursor indicator</string>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </widget>
-      </item>
-      <item>
-       <widget class="QGroupBox" name="groupBox_3" >
-        <property name="title" >
-         <string>In Math</string>
-        </property>
-        <property name="flat" >
-         <bool>false</bool>
-        </property>
-        <layout class="QVBoxLayout" >
-         <item>
-          <widget class="QCheckBox" name="inlineMathCB" >
-           <property name="toolTip" >
-            <string>Show the grey inline completion behind the cursor in math mode after the delay.</string>
-           </property>
-           <property name="text" >
-            <string>Automatic inline completion</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QCheckBox" name="popupMathCB" >
-           <property name="toolTip" >
-            <string>Show the popup in math mode after the delay.</string>
-           </property>
-           <property name="text" >
-            <string>Automatic popup</string>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </widget>
-      </item>
-      <item>
-       <widget class="QGroupBox" name="groupBox_4" >
-        <property name="title" >
-         <string>General</string>
-        </property>
-        <layout class="QVBoxLayout" >
-         <item>
-          <layout class="QHBoxLayout" >
-           <item>
-            <widget class="QDoubleSpinBox" name="inlineDelaySB" >
-             <property name="toolTip" >
-              <string>After the cursor has not moved for this time, the inline completion is shown if it is available.</string>
-             </property>
-             <property name="maximum" >
-              <double>10.000000000000000</double>
-             </property>
-             <property name="singleStep" >
-              <double>0.100000000000000</double>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <widget class="QLabel" name="label_4" >
-             <property name="text" >
-              <string>s inline completion delay</string>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <spacer>
-             <property name="orientation" >
-              <enum>Qt::Horizontal</enum>
-             </property>
-             <property name="sizeHint" >
-              <size>
-               <width>40</width>
-               <height>20</height>
-              </size>
-             </property>
-            </spacer>
-           </item>
-          </layout>
-         </item>
-         <item>
-          <layout class="QHBoxLayout" >
-           <item>
-            <widget class="QDoubleSpinBox" name="popupDelaySB" >
-             <property name="toolTip" >
-              <string>After the cursor has not moved for this time, the completion popup is shown if it is available.</string>
-             </property>
-             <property name="maximum" >
-              <double>10.000000000000000</double>
-             </property>
-             <property name="singleStep" >
-              <double>0.100000000000000</double>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <widget class="QLabel" name="label_3" >
-             <property name="text" >
-              <string>s popup delay</string>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <spacer>
-             <property name="orientation" >
-              <enum>Qt::Horizontal</enum>
-             </property>
-             <property name="sizeHint" >
-              <size>
-               <width>40</width>
-               <height>20</height>
-              </size>
-             </property>
-            </spacer>
-           </item>
-          </layout>
-         </item>
-         <item>
-          <widget class="QCheckBox" name="popupAfterCompleteCB" >
-           <property name="toolTip" >
-            <string>When the TAB completion is not unique, there won't be a delay of the popup. It will be shown right away.</string>
-           </property>
-           <property name="text" >
-            <string>Show popup without delay for non-unique completions</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QCheckBox" name="inlineDotsCB" >
-           <property name="toolTip" >
-            <string>Long completions are cut-off and shown with "...".</string>
-           </property>
-           <property name="text" >
-            <string>Use "..." to shorten long completions</string>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
    <item>
     <widget class="QGroupBox" name="mouseGB" >
      <property name="title" >
       <bool>true</bool>
      </property>
      <layout class="QGridLayout" >
+      <property name="margin" >
+       <number>9</number>
+      </property>
+      <property name="spacing" >
+       <number>6</number>
+      </property>
       <item row="0" column="0" >
        <widget class="QLabel" name="scrollingSpeedLA" >
         <property name="text" >
-         <string>Wheel scrolling speed:</string>
+         <string>&amp;Wheel scrolling speed:</string>
         </property>
         <property name="buddy" >
          <cstring>mouseWheelSpeedSB</cstring>
         <property name="decimals" >
          <number>1</number>
         </property>
-        <property name="minimum" >
-         <double>0.100000000000000</double>
-        </property>
         <property name="maximum" >
          <double>10.000000000000000</double>
         </property>
+        <property name="minimum" >
+         <double>0.100000000000000</double>
+        </property>
         <property name="singleStep" >
          <double>0.100000000000000</double>
         </property>