r24126 by jghali - Show spellcheck dialog to user faster by extracting suggestions only when they are about to be displayed to user

scribus-commit scribus-commit at lists.scribus.net
Fri Oct 30 12:54:38 UTC 2020


Author: jghali
Date: Fri Oct 30 12:54:37 2020
New Revision: 24126

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24126
Log:
Show spellcheck dialog to user faster by extracting suggestions only when they are about to be displayed to user

Modified:
    trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp
    trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.h
    trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp
    trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginstructs.h

Modified: trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24126&path=/trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp	(original)
+++ trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp	Fri Oct 30 12:54:37 2020
@@ -73,7 +73,15 @@
 	goToNextWord(0);
 }
 
-void HunspellDialog::updateSuggestions(QStringList &newSuggestions)
+void HunspellDialog::updateSuggestions(const WordsFound& wordFound)
+{
+	QStringList suggestions;
+	if (m_hspellerMap->contains(wordFound.lang))
+		suggestions = (*m_hspellerMap)[wordFound.lang]->suggest(wordFound.w);
+	updateSuggestions(suggestions);
+}
+
+void HunspellDialog::updateSuggestions(const QStringList &newSuggestions)
 {
 	suggestionsListWidget->clear();
 	suggestionsListWidget->addItems(newSuggestions);
@@ -111,7 +119,7 @@
 	statusLabel->setText("");
 	currWF = m_wfList->at(m_wfListIndex);
 	setLanguageCombo(currWF.lang);
-	updateSuggestions(currWF.replacements);
+	updateSuggestions(currWF);
 
 	int sentencePos = 0;
 	QString sentence(m_iText->sentence(currWF.start + currWF.changeOffset, sentencePos));

Modified: trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24126&path=/trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.h
==============================================================================
--- trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.h	(original)
+++ trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.h	Fri Oct 30 12:54:37 2020
@@ -25,7 +25,9 @@
 
 		void set(QMap<QString, QString>* dictionaryMap, QMap<QString, HunspellDict*> *hspellerMap, QList<WordsFound>* wfList);
 		bool docChanged() {return m_docChanged;}
-		void updateSuggestions(QStringList& newSuggestions);
+
+		void updateSuggestions(const WordsFound& wordFound);
+		void updateSuggestions(const QStringList& newSuggestions);
 
 	public slots:
 		void goToNextWord(int i = -1);

Modified: trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24126&path=/trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp	(original)
+++ trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp	Fri Oct 30 12:54:37 2020
@@ -178,7 +178,6 @@
 			wf.ignore = false;
 			wf.changeOffset = 0;
 			wf.lang = wordLang;
-			wf.replacements = hspellerMap[wordLang]->suggest(word);
 			wordsToCorrect.append(wf);
 		}
 		currPos = iText->nextWord(wordStart);

Modified: trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginstructs.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24126&path=/trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginstructs.h
==============================================================================
--- trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginstructs.h	(original)
+++ trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginstructs.h	Fri Oct 30 12:54:37 2020
@@ -8,7 +8,6 @@
 	int start;
 	int end;
 	QString w;
-	QStringList replacements;
 	bool changed;
 	bool ignore;
 	int changeOffset;




More information about the scribus-commit mailing list