mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Add language selector to the spell chekcer dialog (bug 2208).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33381 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e1c713faf0
commit
fef95cecbd
@ -13,6 +13,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "GuiSpellchecker.h"
|
||||
#include "GuiApplication.h"
|
||||
|
||||
#include "qt_helpers.h"
|
||||
|
||||
@ -77,6 +78,12 @@ GuiSpellchecker::GuiSpellchecker(GuiView & lv)
|
||||
connect(d->ui.suggestionsLW, SIGNAL(itemDoubleClicked(QListWidgetItem*)),
|
||||
this, SLOT(on_replacePB_clicked()));
|
||||
|
||||
// language
|
||||
QAbstractItemModel * language_model = guiApp->languageModel();
|
||||
// FIXME: it would be nice if sorting was enabled/disabled via a checkbox.
|
||||
language_model->sort(0);
|
||||
d->ui.languageCO->setModel(language_model);
|
||||
|
||||
d->ui.wordED->setReadOnly(true);
|
||||
|
||||
d->ui.suggestionsLW->installEventFilter(this);
|
||||
@ -146,6 +153,18 @@ void GuiSpellchecker::updateView()
|
||||
}
|
||||
|
||||
|
||||
void GuiSpellchecker::on_languageCO_activated(int index)
|
||||
{
|
||||
string const lang =
|
||||
fromqstr(d->ui.languageCO->itemData(index).toString());
|
||||
if (d->word_.lang()->lang() == lang)
|
||||
// nothing changed
|
||||
return;
|
||||
dispatch(FuncRequest(LFUN_LANGUAGE, lang));
|
||||
check();
|
||||
}
|
||||
|
||||
|
||||
void GuiSpellchecker::on_ignoreAllPB_clicked()
|
||||
{
|
||||
/// replace all occurances of word
|
||||
@ -283,6 +302,10 @@ void GuiSpellchecker::check()
|
||||
d->ui.spellcheckPR->setValue(progress_bar);
|
||||
// set suggestions
|
||||
updateSuggestions(suggestions);
|
||||
// set language
|
||||
int const pos = d->ui.languageCO->findData(toqstr(word_lang.lang()->lang()));
|
||||
if (pos != -1)
|
||||
d->ui.languageCO->setCurrentIndex(pos);
|
||||
|
||||
// FIXME: if we used a lfun like in find/replace, dispatch would do
|
||||
// that for us
|
||||
|
@ -39,6 +39,7 @@ private Q_SLOTS:
|
||||
void on_replaceAllPB_clicked();
|
||||
void on_suggestionsLW_itemClicked(QListWidgetItem *);
|
||||
void on_replaceCO_highlighted(const QString & str);
|
||||
void on_languageCO_activated(int index);
|
||||
void on_ignoreAllPB_clicked();
|
||||
void on_addPB_clicked();
|
||||
void on_ignorePB_clicked();
|
||||
|
@ -6,7 +6,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>259</width>
|
||||
<height>506</height>
|
||||
<height>528</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
@ -21,23 +21,30 @@
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="TextLabel3" >
|
||||
<widget class="QLabel" name="languageLA" >
|
||||
<property name="text" >
|
||||
<string>Unknown word:</string>
|
||||
<string>&Language:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>wordED</cstring>
|
||||
<cstring>languageCO</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<item row="0" column="1" colspan="2" >
|
||||
<widget class="QComboBox" name="languageCO" >
|
||||
<property name="toolTip" >
|
||||
<string>The checked language. Switching this alters the language of the checked word.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2" >
|
||||
<widget class="QLineEdit" name="wordED" >
|
||||
<property name="toolTip" >
|
||||
<string>Current word</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<item row="3" column="2" >
|
||||
<widget class="QPushButton" name="findNextPB" >
|
||||
<property name="toolTip" >
|
||||
<string>Replace word with current choice</string>
|
||||
@ -47,7 +54,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<item row="4" column="0" colspan="2" >
|
||||
<widget class="QLabel" name="TextLabel1" >
|
||||
<property name="text" >
|
||||
<string>Re&placement:</string>
|
||||
@ -57,7 +64,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<item row="5" column="0" colspan="2" >
|
||||
<widget class="QComboBox" name="replaceCO" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
@ -87,7 +94,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" >
|
||||
<item row="5" column="2" >
|
||||
<widget class="QPushButton" name="replacePB" >
|
||||
<property name="toolTip" >
|
||||
<string>Replace word with current choice</string>
|
||||
@ -97,7 +104,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" >
|
||||
<item row="6" column="0" colspan="2" >
|
||||
<widget class="QLabel" name="TextLabel2" >
|
||||
<property name="text" >
|
||||
<string>S&uggestions:</string>
|
||||
@ -107,7 +114,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" >
|
||||
<item row="6" column="2" >
|
||||
<widget class="QPushButton" name="replaceAllPB" >
|
||||
<property name="toolTip" >
|
||||
<string>Replace word with current choice</string>
|
||||
@ -117,10 +124,10 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item rowspan="5" row="5" column="0" >
|
||||
<item rowspan="4" row="7" column="0" colspan="2" >
|
||||
<widget class="QListWidget" name="suggestionsLW" />
|
||||
</item>
|
||||
<item row="6" column="1" >
|
||||
<item row="7" column="2" >
|
||||
<widget class="QPushButton" name="ignorePB" >
|
||||
<property name="toolTip" >
|
||||
<string>Ignore this word</string>
|
||||
@ -130,7 +137,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1" >
|
||||
<item row="8" column="2" >
|
||||
<widget class="QPushButton" name="ignoreAllPB" >
|
||||
<property name="toolTip" >
|
||||
<string>Ignore this word throughout this session</string>
|
||||
@ -140,7 +147,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1" >
|
||||
<item row="9" column="2" >
|
||||
<widget class="QPushButton" name="addPB" >
|
||||
<property name="toolTip" >
|
||||
<string>Add the word to your personal dictionary</string>
|
||||
@ -150,7 +157,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1" >
|
||||
<item row="10" column="2" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
@ -166,7 +173,7 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="10" column="0" >
|
||||
<item row="11" column="0" colspan="2" >
|
||||
<widget class="QProgressBar" name="spellcheckPR" >
|
||||
<property name="value" >
|
||||
<number>24</number>
|
||||
@ -176,13 +183,30 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1" >
|
||||
<item row="11" column="2" >
|
||||
<widget class="QPushButton" name="closePB" >
|
||||
<property name="text" >
|
||||
<string>&Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2" >
|
||||
<widget class="QLabel" name="TextLabel3" >
|
||||
<property name="text" >
|
||||
<string>Unknown word:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>wordED</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3" >
|
||||
<widget class="Line" name="line" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
Loading…
Reference in New Issue
Block a user