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);
}
-GuiSpellchecker::~GuiSpellchecker()
-{
-}
-
-
void GuiSpellchecker::suggestionChanged(QListWidgetItem * item)
{
if (replaceCO->count() != 0)
{
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)
return false;
// reset values to initial
- oldval_ = 0;
- newvalue_ = 0;
+ oldprogress_ = 0;
+ newprogress_ = 0;
count_ = 0;
bool const success = speller_->error().empty();
word_ = nextWord(cur, start);
// end of document
- if (getWord().empty()) {
+ if (word_.word().empty()) {
showSummary();
exitEarly_ = true;
return;
// 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);
}
}
}
- 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;
}
-docstring GuiSpellchecker::getSuggestion() const
-{
- return speller_->nextMiss();
-}
-
-
-docstring GuiSpellchecker::getWord() const
-{
- return word_.word();
-}
-
-
void GuiSpellchecker::ignoreAll()
{
speller_->accept(word_);
public:
GuiSpellchecker(GuiView & lv);
- ~GuiSpellchecker();
public Q_SLOTS:
void suggestionChanged(QListWidgetItem *);
/// 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();
/// 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