Move completion to a pane of its own.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23811 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2008-03-18 17:31:17 +00:00
parent ffeb40141f
commit 2a2c2d8986
6 changed files with 362 additions and 232 deletions

View 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

View 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));

View 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

View File

@ -265,6 +265,7 @@ UIFILES = \
PDFSupportUi.ui \
PreambleUi.ui \
PrefColorsUi.ui \
PrefCompletionUi.ui \
PrefConvertersUi.ui \
PrefDateUi.ui \
PrefDisplayUi.ui \

View File

@ -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>

View 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" >
@ -25,6 +31,12 @@
<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" >
@ -94,7 +106,7 @@
<bool>false</bool>
</property>
<property name="text" >
<string>Bro&amp;wse...</string>
<string>B&amp;rowse...</string>
</property>
<property name="autoDefault" >
<bool>false</bool>
@ -104,195 +116,6 @@
</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" >
@ -305,10 +128,16 @@
<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>
@ -323,12 +152,12 @@
<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>