From 2a2c2d89866bb684dcb1c6793a8cd64262ff3de6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Tue, 18 Mar 2008 17:31:17 +0000 Subject: [PATCH] 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 --- development/scons/scons_manifest.py | 1 + src/frontends/qt4/GuiPrefs.cpp | 100 +++++---- src/frontends/qt4/GuiPrefs.h | 12 ++ src/frontends/qt4/Makefile.am | 1 + src/frontends/qt4/ui/PrefCompletionUi.ui | 261 +++++++++++++++++++++++ src/frontends/qt4/ui/PrefInputUi.ui | 219 +++---------------- 6 files changed, 362 insertions(+), 232 deletions(-) create mode 100644 src/frontends/qt4/ui/PrefCompletionUi.ui diff --git a/development/scons/scons_manifest.py b/development/scons/scons_manifest.py index 3b6bda5569..fb07075997 100644 --- a/development/scons/scons_manifest.py +++ b/development/scons/scons_manifest.py @@ -928,6 +928,7 @@ src_frontends_qt4_ui_files = Split(''' PDFSupportUi.ui PreambleUi.ui PrefColorsUi.ui + PrefCompletionUi.ui PrefConvertersUi.ui PrefDateUi.ui PrefDisplayUi.ui diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index 6bf30bc31b..de3929ef84 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -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)); diff --git a/src/frontends/qt4/GuiPrefs.h b/src/frontends/qt4/GuiPrefs.h index 77a5382fe3..b7e0afc794 100644 --- a/src/frontends/qt4/GuiPrefs.h +++ b/src/frontends/qt4/GuiPrefs.h @@ -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 diff --git a/src/frontends/qt4/Makefile.am b/src/frontends/qt4/Makefile.am index d148e26356..687c9f7614 100644 --- a/src/frontends/qt4/Makefile.am +++ b/src/frontends/qt4/Makefile.am @@ -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 index 0000000000..131c9042b5 --- /dev/null +++ b/src/frontends/qt4/ui/PrefCompletionUi.ui @@ -0,0 +1,261 @@ + + PrefCompletionUi + + + + 0 + 0 + 480 + 404 + + + + + + + + 9 + + + 6 + + + + + In Math + + + true + + + + 9 + + + 6 + + + + + Show the grey inline completion behind the cursor in math mode after the delay. + + + Automatic in&line completion + + + + + + + Show the popup in math mode after the delay. + + + Automatic p&opup + + + + + + + + + + In Text + + + true + + + + 9 + + + 6 + + + + + Show the grey inline completion behind the cursor in text mode after the delay. + + + Automatic &inline completion + + + + + + + Show the popup after the set delay in text mode. + + + Automatic &popup + + + + + + + Show a small triangle on the cursor if a completion is available in text mode. + + + Cursor i&ndicator + + + + + + + + + + General + + + true + + + + 9 + + + 6 + + + + + 0 + + + 6 + + + + + After the cursor has not moved for this time, the inline completion is shown if it is available. + + + 10.000000000000000 + + + 0.100000000000000 + + + + + + + s inline completion dela&y + + + inlineDelaySB + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 0 + + + 6 + + + + + After the cursor has not moved for this time, the completion popup is shown if it is available. + + + 10.000000000000000 + + + 0.100000000000000 + + + + + + + s popup d&elay + + + popupDelaySB + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + When the TAB completion is not unique, there won't be a delay of the popup. It will be shown right away. + + + Sho&w popup without delay for non-unique completions + + + + + + + Long completions are cut-off and shown with "...". + + + &Use "..." to shorten long completions + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 462 + 16 + + + + + + + + qt_helpers.h + + + + diff --git a/src/frontends/qt4/ui/PrefInputUi.ui b/src/frontends/qt4/ui/PrefInputUi.ui index 3d525662f2..8c52b35b46 100644 --- a/src/frontends/qt4/ui/PrefInputUi.ui +++ b/src/frontends/qt4/ui/PrefInputUi.ui @@ -6,13 +6,19 @@ 0 0 480 - 609 + 228 + + 9 + + + 6 + @@ -25,6 +31,12 @@ true + + 9 + + + 6 + @@ -94,7 +106,7 @@ false - Bro&wse... + B&rowse... false @@ -104,195 +116,6 @@ - - - - Completion - - - true - - - - - - In Text - - - false - - - - - - Show the grey inline completion behind the cursor in text mode after the delay. - - - Automatic inline completion - - - - - - - Show the popup after the set delay in text mode. - - - Automatic popup - - - - - - - Show a small triangle on the cursor if a completion is available in text mode. - - - Cursor indicator - - - - - - - - - - In Math - - - false - - - - - - Show the grey inline completion behind the cursor in math mode after the delay. - - - Automatic inline completion - - - - - - - Show the popup in math mode after the delay. - - - Automatic popup - - - - - - - - - - General - - - - - - - - After the cursor has not moved for this time, the inline completion is shown if it is available. - - - 10.000000000000000 - - - 0.100000000000000 - - - - - - - s inline completion delay - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - After the cursor has not moved for this time, the completion popup is shown if it is available. - - - 10.000000000000000 - - - 0.100000000000000 - - - - - - - s popup delay - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - When the TAB completion is not unique, there won't be a delay of the popup. It will be shown right away. - - - Show popup without delay for non-unique completions - - - - - - - Long completions are cut-off and shown with "...". - - - Use "..." to shorten long completions - - - - - - - - - @@ -305,10 +128,16 @@ true + + 9 + + + 6 + - Wheel scrolling speed: + &Wheel scrolling speed: mouseWheelSpeedSB @@ -323,12 +152,12 @@ 1 - - 0.100000000000000 - 10.000000000000000 + + 0.100000000000000 + 0.100000000000000 -- 2.39.2