r23648 by jghali - Code style fixes

scribus-commit scribus-commit at lists.scribus.net
Fri Apr 24 17:31:45 UTC 2020


Author: jghali
Date: Fri Apr 24 17:31:45 2020
New Revision: 23648

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

Modified:
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribusdoc.cpp

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23648&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp	(original)
+++ trunk/Scribus/scribus/scribus.cpp	Fri Apr 24 17:31:45 2020
@@ -1992,7 +1992,7 @@
 			m__arrowKeyDown = false;
 			if ((HaveDoc) && (!zoomSpinBox->hasFocus()) && (!pageSelector->hasFocus()))
 			{
-				int docSelectionCount=doc->m_Selection->count();
+				int docSelectionCount = doc->m_Selection->count();
 				if ((docSelectionCount != 0) && (doc->appMode == modeEditClip) && (doc->nodeEdit.hasNodeSelected()))
 				{
 					PageItem *currItem = doc->m_Selection->itemAt(0);
@@ -2025,7 +2025,7 @@
 	//Do not quit if Preferences or new doc window is open
 	PreferencesDialog *prefsDialog = findChild<PreferencesDialog *>(QString::fromLocal8Bit("PreferencesDialog"));
 	NewDocDialog *newDocWin = findChild<NewDocDialog *>(QString::fromLocal8Bit("NewDocumentWindow"));
-	if (prefsDialog!=nullptr || newDocWin!=nullptr)
+	if (prefsDialog != nullptr || newDocWin != nullptr)
 	{
 		ce->ignore();
 		return;
@@ -2411,7 +2411,7 @@
 
 	ScribusWin* w = new ScribusWin(qwsp, tempDoc);
 	w->setMainWindow(this);
-	if (requiresGUI && view!=nullptr)
+	if (requiresGUI && view != nullptr)
 		actionManager->disconnectNewViewActions();
 
 	ScribusView* tempView = new ScribusView(w, this, tempDoc);
@@ -3295,8 +3295,8 @@
 			scrLayersActions[QString("%1").arg((*it).ID)]->setIcon(pm);
 		}
 	}
-	int currActiveLayer=doc->activeLayer();
-	bool found=false;
+	int currActiveLayer = doc->activeLayer();
+	bool found = false;
 	for (it = doc->Layers.begin(); it != doc->Layers.end(); ++it)
 	{
 		if ((*it).ID == currActiveLayer)
@@ -3489,7 +3489,7 @@
 		recalcColors();
 		doc->RecalcPictures(&ScCore->InputProfiles, &ScCore->InputProfilesCMYK);
 	}
-	int docItemsCount=doc->Items->count();
+	int docItemsCount = doc->Items->count();
 	for (int i = oldItemsCount; i < docItemsCount; ++i)
 	{
 		PageItem *ite = doc->Items->at(i);
@@ -4343,7 +4343,7 @@
 	doc->reorganiseFonts();
 	m_mainWindowStatusLabel->setText( tr("Saving..."));
 	mainWindowProgressBar->reset();
-	bool ret=doc->save(fileName, savedFileName);
+	bool ret = doc->save(fileName, savedFileName);
 	qApp->processEvents();
 	if (ret)
 	{
@@ -4634,12 +4634,12 @@
 		view->requestMode(submodeEndNodeEdit);
 	if (doc->m_Selection->isEmpty())
 		return;
-	int docSelectionCount=doc->m_Selection->count();
+	int docSelectionCount = doc->m_Selection->count();
 	UndoTransaction activeTransaction;
 	PageItem *currItem;
 	for (int i = 0; i < docSelectionCount; ++i)
 	{
-		currItem=doc->m_Selection->itemAt(i);
+		currItem = doc->m_Selection->itemAt(i);
 		if ((currItem->asTextFrame() || currItem->asPathText()) && currItem==storyEditor->currentItem() && doc==storyEditor->currentDocument())
 		{
 				ScMessageBox::critical(this, tr("Cannot Cut In-Use Item"), tr("The item %1 is currently being edited by Story Editor. The cut operation will be cancelled").arg(currItem->itemName()));
@@ -4652,7 +4652,7 @@
 			activeTransaction = m_undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::Cut,"",Um::ICut);
 		else
 		{
-			PageItem* item=doc->m_Selection->itemAt(0);
+			PageItem* item = doc->m_Selection->itemAt(0);
 			activeTransaction = m_undoManager->beginTransaction(item->getUName(), item->getUPixmap(), Um::Cut, "", Um::ICut);
 		}
 	}
@@ -5206,7 +5206,7 @@
 					doc->m_Selection->addItem(currItem);
 				else
 				{
-					if (currItem->OwnPage==docCurrentPage)
+					if (currItem->OwnPage == docCurrentPage)
 						doc->m_Selection->addItem(currItem);
 				}
 			}
@@ -5583,8 +5583,8 @@
 		{
 			locationEntries << CommonStrings::translatePageSetLocString(*pNames);
 		}
-		pageLocationIndex=doc->columnOfPage(doc->currentPageNumber());
-		pageLocationCount=locationEntries.count();
+		pageLocationIndex = doc->columnOfPage(doc->currentPageNumber());
+		pageLocationCount = locationEntries.count();
 	}
 
 	CopyPageToMasterPageDialog copyDialog(doc->MasterNames.count(), doc->pageSets()[doc->pagePositioning()].pageNames, pageLocationIndex, this);
@@ -5967,8 +5967,8 @@
 	}
 	if (doc->m_Selection->count()==1)
 	{
-		PageItem* currItem=doc->m_Selection->itemAt(0);
-		if (currItem!=nullptr)
+		PageItem* currItem = doc->m_Selection->itemAt(0);
+		if (currItem != nullptr)
 			currItem->emitAllToGUI();
 	}
 	//TODO emit from selection, handle group widths
@@ -7457,7 +7457,7 @@
 {
 	bool b = layerMenu->blockSignals(true);
 	layerMenu->clear();
-	if (doc==nullptr)
+	if (doc == nullptr)
 	{
 		layerMenu->blockSignals(b);
 		return;
@@ -7465,7 +7465,7 @@
 
 	QStringList newNames;
 	doc->orderedLayerList(&newNames);
-	for (QStringList::Iterator it=newNames.begin(); it!=newNames.end(); ++it)
+	for (QStringList::Iterator it = newNames.begin(); it !=  newNames.end(); ++it)
 	{
 		QPixmap pm(20,15);
 		pm.fill(doc->Layers.layerByName(*it)->markerColor);
@@ -7487,8 +7487,8 @@
 	if (!HaveDoc)
 		return;
 	int level = doc->layerCount()-l-1;
-	int layerID=doc->layerIDFromLevel(level);
-	if (layerID==-1)
+	int layerID = doc->layerIDFromLevel(level);
+	if (layerID == -1)
 		return;
 	doc->setActiveLayer(layerID);
 	changeLayer(doc->activeLayer());
@@ -7784,8 +7784,8 @@
 	}
 	slotSelect();
 	appModeHelper->setMasterPageEditMode(false, doc);
-	int pageCount=doc->DocPages.count();
-	for (int i=0; i<pageCount; ++i)
+	int pageCount = doc->DocPages.count();
+	for (int i = 0; i < pageCount; ++i)
 		Apply_MasterPage(doc->DocPages.at(i)->masterPageName(), i, false);
 
 	pagePalette->endMasterPageMode();
@@ -7941,8 +7941,8 @@
 	tmpl << state->get("MASTERPAGE");
 	QString pageName = state->get("PAGENAME");
 	bool savedMasterPageMode = state->getBool("MASTER_PAGE_MODE");
-	bool currMasterPageMode=doc->masterPageMode();
-	if (currMasterPageMode!=savedMasterPageMode)
+	bool currMasterPageMode = doc->masterPageMode();
+	if (currMasterPageMode != savedMasterPageMode)
 		doc->setMasterPageMode(savedMasterPageMode);
 	if (pagenr == 1)
 	{
@@ -8008,8 +8008,8 @@
 
 	int delFrom = 0;
 	int delTo = 0;
-	bool currMasterPageMode=doc->masterPageMode();
-	if (currMasterPageMode!=savedMasterPageMode)
+	bool currMasterPageMode = doc->masterPageMode();
+	if (currMasterPageMode != savedMasterPageMode)
 		doc->setMasterPageMode(savedMasterPageMode);
 	switch (where)
 	{
@@ -8508,8 +8508,8 @@
 		FileLoader fl(fileName);
 		fl.saveFile(fileName, doc, nullptr);
 		view->close();
-		int numPages=doc->Pages->count();
-		for (int j=0; j<numPages; ++j)
+		int numPages = doc->Pages->count();
+		for (int j = 0; j < numPages; ++j)
 			delete doc->Pages->at(j);
 		delete doc;
 		ActWin->close();
@@ -8622,7 +8622,7 @@
 		m_undoManager->showObject(Um::GLOBAL_UNDO_MODE);
 	else if (HaveDoc)
 	{
-		int docSelectionCount=doc->m_Selection->count();
+		int docSelectionCount = doc->m_Selection->count();
 		if (docSelectionCount == 1)
 			m_undoManager->showObject(doc->m_Selection->itemAt(0)->getUId());
 		else if (docSelectionCount == 0)
@@ -8723,16 +8723,16 @@
 	LanguageManager::instance()->languageChange();
 	qApp->setLayoutDirection(QLocale(ScCore->getGuiLanguage()).textDirection());
 	//Update actions
-	if (actionManager!=nullptr)
+	if (actionManager != nullptr)
 	{
 		actionManager->languageChange();
 		ScCore->pluginManager->languageChange();
 		initKeyboardShortcuts();
 	}
 	//Update menu texts
-	if (scrMenuMgr!=nullptr && !scrMenuMgr->empty())
+	if (scrMenuMgr != nullptr && !scrMenuMgr->empty())
 		scrMenuMgr->languageChange();
-	if (m_undoManager!=nullptr)
+	if (m_undoManager != nullptr)
 		m_undoManager->languageChange();
 	statusBarLanguageChange();
 	viewToolBar->languageChange();

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23648&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp	(original)
+++ trunk/Scribus/scribus/scribusdoc.cpp	Fri Apr 24 17:31:45 2020
@@ -4844,7 +4844,7 @@
 
 bool ScribusDoc::changePageProperties(double initialTop, double initialBottom, double initialLeft, double initialRight, double initialHeight, double initialWidth, double height, double width, int orientation, const QString& pageSize, int marginPreset, bool moveObjects, int pageNumber, int pageType)
 {
-	if (pageNumber == -1 || m_currentPage ==nullptr)
+	if (pageNumber == -1 || m_currentPage == nullptr)
 		return false;
 
 	QRectF pagebox(m_currentPage->xOffset(), m_currentPage->yOffset(), qMax( m_currentPage->width(), width), qMax(m_currentPage->height(), height));
@@ -6364,7 +6364,7 @@
 			newItem = new PageItem_PolyLine(*oldItem);
 			break;
 		case PageItem::PathText:
-			if (secondaryItem==nullptr)
+			if (secondaryItem == nullptr)
 				return nullptr;
 			if (UndoManager::undoEnabled())
 				transactionConversion = m_undoManager->beginTransaction(m_currentPage->getUName(), nullptr, Um::PathText, "", Um::ITextFrame);
@@ -6848,32 +6848,32 @@
 	bool empty=m_docPrefsData.docSectionMap.isEmpty();
 	if (empty)
 	{
-		newSection.number=0;
-		newSection.name="0";
-		newSection.fromindex=0;
-		newSection.toindex=docPageCount-1;
-		newSection.type=Type_1_2_3;
-		newSection.sectionstartindex=1;
-		newSection.reversed=false;
-		newSection.active=true;
-		newSection.pageNumberFillChar=QChar();
-		newSection.pageNumberWidth=0;
+		newSection.number = 0;
+		newSection.name = "0";
+		newSection.fromindex = 0;
+		newSection.toindex = docPageCount-1;
+		newSection.type = Type_1_2_3;
+		newSection.sectionstartindex = 1;
+		newSection.reversed = false;
+		newSection.active = true;
+		newSection.pageNumberFillChar = QChar();
+		newSection.pageNumberWidth = 0;
 		m_docPrefsData.docSectionMap.insert(newSection.number, newSection);
 	}
 	else if (number!=-1)
 	{
-		newSection.number=number;
-		newSection.name=name;
-		newSection.fromindex=fromindex;
-		newSection.toindex=toindex;
+		newSection.number = number;
+		newSection.name = name;
+		newSection.fromindex = fromindex;
+		newSection.toindex = toindex;
 		if (newSection.toindex > (uint) docPageCount - 1)
 			newSection.toindex = docPageCount - 1;
-		newSection.type=type;
-		newSection.sectionstartindex=sectionstartindex;
-		newSection.reversed=reversed;
-		newSection.active=active;
-		newSection.pageNumberFillChar=fillChar;
-		newSection.pageNumberWidth=fieldWidth;
+		newSection.type = type;
+		newSection.sectionstartindex = sectionstartindex;
+		newSection.reversed = reversed;
+		newSection.active = active;
+		newSection.pageNumberFillChar = fillChar;
+		newSection.pageNumberWidth = fieldWidth;
 		m_docPrefsData.docSectionMap.insert(newSection.number, newSection);
 	}
 }
@@ -6883,27 +6883,27 @@
 {
 	if (!m_docPrefsData.docSectionMap.contains(number))
 		return false;
-	if (m_docPrefsData.docSectionMap.count()<=1)
+	if (m_docPrefsData.docSectionMap.count() <= 1)
 		return false;
-	QMap<uint, DocumentSection>::Iterator itprev=m_docPrefsData.docSectionMap.begin();
-	QMap<uint, DocumentSection>::Iterator it=itprev;
+	QMap<uint, DocumentSection>::Iterator itprev = m_docPrefsData.docSectionMap.begin();
+	QMap<uint, DocumentSection>::Iterator it = itprev;
 	uint currMaxIndex = itprev.value().toindex;
 	for ( ; it != m_docPrefsData.docSectionMap.end(); ++it)
 	{
 		currMaxIndex=it.value().toindex;
 
-		if (it.key()!=number)
-			itprev=it;
+		if (it.key() != number)
+			itprev = it;
 		else
 			break;
 	}
 	if (it != itprev)
-		itprev.value().toindex=currMaxIndex;
+		itprev.value().toindex = currMaxIndex;
 	else {
 		// special case: delete first section
 		QMap<uint, DocumentSection>::Iterator itnext = it;
 		++itnext;
-		itnext.value().fromindex=it.value().fromindex;
+		itnext.value().fromindex = it.value().fromindex;
 	}
 	m_docPrefsData.docSectionMap.erase(it);
 	return true;
@@ -10649,7 +10649,7 @@
 		for (int a = 0; a < m_Selection->count(); ++a)
 		{
 			PageItem_ImageFrame* imageItem=m_Selection->itemAt(a)->asImageFrame();
-			if (imageItem==nullptr)
+			if (imageItem == nullptr)
 				continue;
 			imageItem->setImageVisible(!imageItem->imageVisible());
 			imageItem->update();
@@ -13400,7 +13400,7 @@
 
 void ScribusDoc::setCurrentPage(ScPage *newPage)
 {
-	if (newPage==nullptr)
+	if (newPage == nullptr)
 		return;
 	m_currentPage = newPage;
 	if (m_ScMW)
@@ -17241,7 +17241,7 @@
 			while (markPos > -1)
 			{
 				if (mrk->isType(MARKNoteFrameType) && markPos > 1 && item->itemText.text(markPos -1) == SpecialChars::PARSEP)
-					item->itemText.removeChars(markPos - 1,2);
+					item->itemText.removeChars(markPos - 1, 2);
 				else
 					item->itemText.removeChars(markPos, 1);
 				found = true;




More information about the scribus-commit mailing list