mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Simplifications
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28975 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
34bddccb13
commit
a7dfd5796f
@ -50,7 +50,7 @@ namespace frontend {
|
||||
|
||||
GuiSpellchecker::GuiSpellchecker(GuiView & lv)
|
||||
: GuiDialog(lv, "spellchecker", qt_("Spellchecker")), exitEarly_(false),
|
||||
oldval_(0), newvalue_(0), count_(0), speller_(0)
|
||||
oldprogress_(0), newprogress_(0), count_(0), speller_(0)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
@ -74,11 +74,6 @@ GuiSpellchecker::GuiSpellchecker(GuiView & lv)
|
||||
}
|
||||
|
||||
|
||||
GuiSpellchecker::~GuiSpellchecker()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GuiSpellchecker::suggestionChanged(QListWidgetItem * item)
|
||||
{
|
||||
if (replaceCO->count() != 0)
|
||||
@ -170,15 +165,15 @@ void GuiSpellchecker::partialUpdate(int state)
|
||||
{
|
||||
switch (state) {
|
||||
case SPELL_PROGRESSED:
|
||||
spellcheckPR->setValue(getProgress());
|
||||
spellcheckPR->setValue(oldprogress_);
|
||||
break;
|
||||
|
||||
case SPELL_FOUND_WORD: {
|
||||
wordED->setText(toqstr(getWord()));
|
||||
wordED->setText(toqstr(word_.word()));
|
||||
suggestionsLW->clear();
|
||||
|
||||
docstring w;
|
||||
while (!(w = getSuggestion()).empty())
|
||||
while (!(w = speller_->nextMiss()).empty())
|
||||
suggestionsLW->addItem(toqstr(w));
|
||||
|
||||
if (suggestionsLW->count() == 0)
|
||||
@ -202,8 +197,8 @@ bool GuiSpellchecker::initialiseParams(string const &)
|
||||
return false;
|
||||
|
||||
// reset values to initial
|
||||
oldval_ = 0;
|
||||
newvalue_ = 0;
|
||||
oldprogress_ = 0;
|
||||
newprogress_ = 0;
|
||||
count_ = 0;
|
||||
|
||||
bool const success = speller_->error().empty();
|
||||
@ -273,7 +268,7 @@ void GuiSpellchecker::check()
|
||||
word_ = nextWord(cur, start);
|
||||
|
||||
// end of document
|
||||
if (getWord().empty()) {
|
||||
if (word_.word().empty()) {
|
||||
showSummary();
|
||||
exitEarly_ = true;
|
||||
return;
|
||||
@ -283,10 +278,10 @@ void GuiSpellchecker::check()
|
||||
|
||||
// Update slider if and only if value has changed
|
||||
float progress = total ? float(start)/total : 1;
|
||||
newvalue_ = int(100.0 * progress);
|
||||
if (newvalue_!= oldval_) {
|
||||
newprogress_ = int(100.0 * progress);
|
||||
if (newprogress_!= oldprogress_) {
|
||||
LYXERR(Debug::GUI, "Updating spell progress.");
|
||||
oldval_ = newvalue_;
|
||||
oldprogress_ = newprogress_;
|
||||
// set progress bar
|
||||
partialUpdate(SPELL_PROGRESSED);
|
||||
}
|
||||
@ -302,7 +297,7 @@ void GuiSpellchecker::check()
|
||||
}
|
||||
}
|
||||
|
||||
LYXERR(Debug::GUI, "Found word \"" << to_utf8(getWord()) << "\"");
|
||||
LYXERR(Debug::GUI, "Found word \"" << to_utf8(word_.word()) << "\"");
|
||||
|
||||
int const size = cur.selEnd().pos() - cur.selBegin().pos();
|
||||
cur.pos() -= size;
|
||||
@ -368,18 +363,6 @@ void GuiSpellchecker::insert()
|
||||
}
|
||||
|
||||
|
||||
docstring GuiSpellchecker::getSuggestion() const
|
||||
{
|
||||
return speller_->nextMiss();
|
||||
}
|
||||
|
||||
|
||||
docstring GuiSpellchecker::getWord() const
|
||||
{
|
||||
return word_.word();
|
||||
}
|
||||
|
||||
|
||||
void GuiSpellchecker::ignoreAll()
|
||||
{
|
||||
speller_->accept(word_);
|
||||
|
@ -33,7 +33,6 @@ class GuiSpellchecker : public GuiDialog, public Ui::SpellcheckerUi
|
||||
|
||||
public:
|
||||
GuiSpellchecker(GuiView & lv);
|
||||
~GuiSpellchecker();
|
||||
|
||||
public Q_SLOTS:
|
||||
void suggestionChanged(QListWidgetItem *);
|
||||
@ -81,16 +80,6 @@ private:
|
||||
/// check text until next misspelled/unknown word
|
||||
/// returns true when finished
|
||||
void check();
|
||||
/// get suggestion
|
||||
docstring getSuggestion() const;
|
||||
/// get word
|
||||
docstring getWord() const;
|
||||
/// returns progress value
|
||||
int getProgress() const { return oldval_; }
|
||||
/// returns word count
|
||||
int getCount() const { return count_; }
|
||||
/// give error message is spellchecker dies
|
||||
bool checkAlive();
|
||||
/// show count of checked words at normal exit
|
||||
void showSummary();
|
||||
|
||||
@ -99,8 +88,8 @@ private:
|
||||
/// current word being checked and lang code
|
||||
WordLangTuple word_;
|
||||
/// values for progress
|
||||
int oldval_;
|
||||
int newvalue_;
|
||||
int oldprogress_;
|
||||
int newprogress_;
|
||||
/// word count
|
||||
int count_;
|
||||
/// The actual spellchecker object
|
||||
|
Loading…
Reference in New Issue
Block a user