r24036 by jghali - Code style fixes

scribus-commit scribus-commit at lists.scribus.net
Fri Sep 25 17:31:15 UTC 2020


Author: jghali
Date: Fri Sep 25 17:31:15 2020
New Revision: 24036

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24036
Log:
Code style fixes

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

Modified: trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24036&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 Sep 25 17:31:15 2020
@@ -8,9 +8,9 @@
 #include <QComboBox>
 #include <QListWidget>
 #include <QTextEdit>
+
 #include "hunspelldialog.h"
 #include "langmgr.h"
-
 
 HunspellDialog::HunspellDialog(QWidget *parent, ScribusDoc *doc, StoryText *iText)
 {
@@ -23,11 +23,11 @@
 	connect (changeAllPushButton, SIGNAL(clicked()), this, SLOT(changeAllWords()));
 	connect (languagesComboBox, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(languageComboChanged(const QString &)));
 
-	m_doc=doc;
-	m_docChanged=false;
-	m_iText=iText;
-	m_returnToDefaultLang=false;
-	m_primaryLangIndex=0;
+	m_doc = doc;
+	m_docChanged = false;
+	m_iText = iText;
+	m_returnToDefaultLang = false;
+	m_primaryLangIndex = 0;
 
 	m_dictionaryMap = nullptr;
 	m_hspellerMap = nullptr;
@@ -37,26 +37,26 @@
 
 void HunspellDialog::set(QMap<QString, QString>* dictionaryMap, QMap<QString, HunspellDict*> *hspellerMap, QList<WordsFound> *wfList)
 {
-	m_dictionaryMap=dictionaryMap;
-	m_hspellerMap=hspellerMap;
-	m_wfList=wfList;
-	bool b=languagesComboBox->blockSignals(true);
+	m_dictionaryMap = dictionaryMap;
+	m_hspellerMap = hspellerMap;
+	m_wfList = wfList;
+	bool b = languagesComboBox->blockSignals(true);
 	languagesComboBox->clear();
 
 	QStringList langsToAdd;
 	auto it = m_dictionaryMap->cbegin();
 	while (it != m_dictionaryMap->cend())
 	{
-		QString lang=LanguageManager::instance()->getLangFromAbbrev(it.key(), true);
+		QString lang = LanguageManager::instance()->getLangFromAbbrev(it.key(), true);
 		if (!langsToAdd.contains(lang))
-			langsToAdd<<(!lang.isEmpty() ? lang : it.key());
+			langsToAdd << (!lang.isEmpty() ? lang : it.key());
 		++it;
 	}
 	languagesComboBox->addItems(langsToAdd);
 	languagesComboBox->setCurrentIndex(0);
-	m_primaryLangIndex=0;
+	m_primaryLangIndex = 0;
 	languagesComboBox->blockSignals(b);
-	m_wfListIndex=0;
+	m_wfListIndex = 0;
 	goToNextWord(0);
 }
 
@@ -71,12 +71,12 @@
 {
 	if (m_returnToDefaultLang)
 	{
-		bool b=languagesComboBox->blockSignals(true);
+		bool b = languagesComboBox->blockSignals(true);
 		languagesComboBox->setCurrentIndex(m_primaryLangIndex);
 		languagesComboBox->blockSignals(b);
 	}
-	if (i>=0)
-		m_wfListIndex=i;
+	if (i >= 0)
+		m_wfListIndex = i;
 	else
 	{
 		do {
@@ -100,7 +100,7 @@
 	setLanguageCombo(currWF.lang);
 	updateSuggestions(currWF.replacements);
 
-	int sentencePos=0;
+	int sentencePos = 0;
 	QString sentence(m_iText->sentence(currWF.start, sentencePos));
 	sentence.insert(currWF.end-sentencePos+currWF.changeOffset,"</b></font>");
 	sentence.insert(currWF.start-sentencePos+currWF.changeOffset,"<font color=red><b>");
@@ -132,10 +132,10 @@
 {
 	if (m_wfList->at(m_wfListIndex).ignore && !m_wfList->at(m_wfListIndex).changed)
 		return;
-	QString wordToChange=m_wfList->at(m_wfListIndex).w;
+	QString wordToChange = m_wfList->at(m_wfListIndex).w;
 	//Do we start from 0 or from the instance of the word where we are... 0 for now
-	for (int i=0;i<m_wfList->count();++i)
-		if (m_wfList->at(i).w==wordToChange)
+	for (int i = 0; i <m_wfList->count(); ++i)
+		if (m_wfList->at(i).w == wordToChange)
 			replaceWord(i);
 	goToNextWord();
 }
@@ -144,40 +144,40 @@
 {
 	//TODO: rehyphenate after the replacement
 	QString newText(suggestionsListWidget->currentItem()->text());
-	int lengthDiff=m_iText->replaceWord(m_wfList->at(i).start+m_wfList->at(i).changeOffset, newText);
-	if (lengthDiff!=0)
-	{
-		for (int k=i; k<m_wfList->count();++k)
-			(*m_wfList)[k].changeOffset+=lengthDiff;
-	}
-	(*m_wfList)[i].changed=true;
-	m_docChanged=true;
+	int lengthDiff = m_iText->replaceWord(m_wfList->at(i).start + m_wfList->at(i).changeOffset, newText);
+	if (lengthDiff != 0)
+	{
+		for (int k = i; k<m_wfList->count(); ++k)
+			(*m_wfList)[k].changeOffset += lengthDiff;
+	}
+	(*m_wfList)[i].changed = true;
+	m_docChanged = true;
 }
 
 void HunspellDialog::languageComboChanged(const QString &newLanguage)
 {
-	m_returnToDefaultLang=true;
-	QString wordLang=LanguageManager::instance()->getAbbrevFromLang(newLanguage, false);
+	m_returnToDefaultLang = true;
+	QString wordLang = LanguageManager::instance()->getAbbrevFromLang(newLanguage, false);
 	if (!m_hspellerMap->contains(wordLang) )
 	{
-		//qDebug()<<"hspeller"<<wordLang<<"does not exist";
-		return;
-	}
-	//qDebug()<<wordLang<<newLanguage;
-	if (m_wfList->count()==0)
-		return;
-	if (m_wfListIndex>=m_wfList->count())
-		m_wfListIndex=0;
-	QString word=m_wfList->at(m_wfListIndex).w;
-	if ((*m_hspellerMap)[wordLang]->spell(word)==0)
+		//qDebug() << "hspeller"<<wordLang<<"does not exist";
+		return;
+	}
+	//qDebug() << wordLang << newLanguage;
+	if (m_wfList->count() == 0)
+		return;
+	if (m_wfListIndex >= m_wfList->count())
+		m_wfListIndex = 0;
+	QString word = m_wfList->at(m_wfListIndex).w;
+	if ((*m_hspellerMap)[wordLang]->spell(word) == 0)
 	{
 		QStringList replacements = (*m_hspellerMap)[wordLang]->suggest(word);
 		updateSuggestions(replacements);
 	}
 	else
 	{
-		(*m_wfList)[m_wfListIndex].changed=true;
-		m_docChanged=true;
+		(*m_wfList)[m_wfListIndex].changed = true;
+		m_docChanged = true;
 		goToNextWord();
 	}
 }
@@ -191,7 +191,7 @@
 	{
 		if (it.key() == newLangAbbrev)
 		{
-			found=true;
+			found = true;
 			break;
 		}
 		++it;

Modified: trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24036&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 Sep 25 17:31:15 2020
@@ -26,7 +26,7 @@
 		void updateSuggestions(QStringList& newSuggestions);
 
 	public slots:
-		void goToNextWord(int i=-1);
+		void goToNextWord(int i = -1);
 		void ignoreAllWords();
 		void changeWord();
 		void changeAllWords();




More information about the scribus-commit mailing list