r23975 by jghali - Code style fixes

scribus-commit scribus-commit at lists.scribus.net
Sat Aug 8 13:32:04 UTC 2020


Author: jghali
Date: Sat Aug  8 13:32:04 2020
New Revision: 23975

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

Modified:
    trunk/Scribus/scribus/ui/prefs_tableofcontents.cpp

Modified: trunk/Scribus/scribus/ui/prefs_tableofcontents.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23975&path=/trunk/Scribus/scribus/ui/prefs_tableofcontents.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_tableofcontents.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_tableofcontents.cpp	Sat Aug  8 13:32:04 2020
@@ -143,7 +143,7 @@
 	connect(itemAttrComboBox, SIGNAL(activated(const QString&)), this, SLOT(itemAttributeSelected(const QString&)));
 }
 
-void Prefs_TableOfContents::selectToC( int numberSelected )
+void Prefs_TableOfContents::selectToC(int numberSelected)
 {
 	numSelected = numberSelected;
 	if (numSelected < 0)
@@ -151,7 +151,8 @@
 	if (localToCSetupVector.isEmpty())
 		return;
 	if (localToCSetupVector.count() < numSelected)
-		numSelected=0;
+		numSelected = 0;
+
 	disconnect( tocListBox, SIGNAL( currentRowChanged(int) ), this, SLOT( selectToC(int) ) );
 	disconnect( itemAttrComboBox, SIGNAL( activated(const QString&) ), this, SLOT( itemAttributeSelected(const QString&) ) );
 	disconnect( itemDestFrameComboBox, SIGNAL( activated(const QString&) ), this, SLOT( itemFrameSelected(const QString&) ) );
@@ -159,20 +160,21 @@
 	disconnect( itemNumberPlacementComboBox, SIGNAL( activated(const QString&) ), this, SLOT( itemPageNumberPlacedSelected(const QString&) ) );
 	disconnect( tocNameLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( setToCName(const QString&) ) );
 	disconnect( itemListNonPrintingCheckBox, SIGNAL( toggled(bool) ), this, SLOT( nonPrintingFramesSelected(bool) ) );
+
 	if (localToCSetupVector[numSelected].itemAttrName == CommonStrings::None)
 		setCurrentComboItem(itemAttrComboBox, CommonStrings::tr_None);
 	else
 		setCurrentComboItem(itemAttrComboBox, localToCSetupVector[numSelected].itemAttrName);
+
 	if (localToCSetupVector[numSelected].pageLocation == NotShown)
 		setCurrentComboItem(itemNumberPlacementComboBox, trStrPNNotShown);
-	else
-		if (localToCSetupVector[numSelected].pageLocation == Beginning)
-			setCurrentComboItem(itemNumberPlacementComboBox, trStrPNBeginning);
-		else
-			setCurrentComboItem(itemNumberPlacementComboBox, trStrPNEnd);
+	else if (localToCSetupVector[numSelected].pageLocation == Beginning)
+		setCurrentComboItem(itemNumberPlacementComboBox, trStrPNBeginning);
+	else
+		setCurrentComboItem(itemNumberPlacementComboBox, trStrPNEnd);
 
 	itemListNonPrintingCheckBox->setChecked(localToCSetupVector[numSelected].listNonPrintingFrames);
-	if (m_Doc!=nullptr)
+	if (m_Doc != nullptr)
 	{
 		if (localToCSetupVector[numSelected].frameName == CommonStrings::None)
 			setCurrentComboItem(itemDestFrameComboBox, CommonStrings::tr_None);
@@ -203,15 +205,15 @@
 
 void Prefs_TableOfContents::addToC()
 {
-	bool found=false;
-	QString newName=tocNameLineEdit->text();
+	bool found = false;
+	QString newName = tocNameLineEdit->text();
 	for (ToCSetupVector::Iterator it = localToCSetupVector.begin(); it!= localToCSetupVector.end(); ++it)
 	{
 		if ((*it).name == newName)
 			found = true;
 	}
 	if (found || newName.isEmpty())
-		newName=tr("Table of Contents %1").arg(localToCSetupVector.count()+1);
+		newName = tr("Table of Contents %1").arg(localToCSetupVector.count()+1);
 	ToCSetup newToCEntry;
 	newToCEntry.name = newName;
 	newToCEntry.itemAttrName = CommonStrings::None;
@@ -257,12 +259,13 @@
 
 void Prefs_TableOfContents::enableGUIWidgets()
 {
-	bool enabled=(localToCSetupVector.count()>0);
+	bool enabled = (localToCSetupVector.count() > 0);
 	tocListBox->setEnabled(enabled);
 	tocDeleteButton->setEnabled(enabled);
 	itemAttrComboBox->setEnabled(enabled);
 	itemNumberPlacementComboBox->setEnabled(enabled);
-	bool haveDoc=enabled && m_Doc!=nullptr;
+
+	bool haveDoc = (enabled && m_Doc != nullptr);
 	itemDestFrameComboBox->setEnabled(haveDoc);
 	itemParagraphStyleComboBox->setEnabled(haveDoc);
 }
@@ -329,77 +332,77 @@
 
 void Prefs_TableOfContents::itemPageNumberPlacedSelected( const QString& pageLocation )
 {
-	int numberSelected=tocListBox->currentRow();
-	if (numberSelected>=0)
-	{
-		int i=0;
-		ToCSetupVector::Iterator it=localToCSetupVector.begin();
-		while (it!= localToCSetupVector.end() && i<numberSelected)
-		{
-			++it;
-			++i;
-		}
-		if (pageLocation==trStrPNBeginning || pageLocation==strPNBeginning)
-			(*it).pageLocation=Beginning;
-		else
-		if (pageLocation==trStrPNEnd || pageLocation==strPNEnd)
-			(*it).pageLocation=End;
-		else
-			(*it).pageLocation=NotShown;
-	}
+	int numberSelected = tocListBox->currentRow();
+	if (numberSelected < 0)
+		return;
+
+	int i = 0;
+	ToCSetupVector::Iterator it = localToCSetupVector.begin();
+	while (it != localToCSetupVector.end() && i < numberSelected)
+	{
+		++it;
+		++i;
+	}
+	if (pageLocation == trStrPNBeginning || pageLocation == strPNBeginning)
+		(*it).pageLocation = Beginning;
+	else
+	if (pageLocation == trStrPNEnd || pageLocation == strPNEnd)
+		(*it).pageLocation = End;
+	else
+		(*it).pageLocation = NotShown;
 }
 
 
 void Prefs_TableOfContents::itemParagraphStyleSelected( const QString& itemStyle )
 {
-	int numberSelected=tocListBox->currentRow();
-	if (numberSelected>=0)
-	{
-		int i=0;
-		ToCSetupVector::Iterator it=localToCSetupVector.begin();
-		while (it!= localToCSetupVector.end() && i<numberSelected)
-		{
-			++it;
-			++i;
-		}
-		if (itemStyle==CommonStrings::tr_None)
-			(*it).textStyle=CommonStrings::None;
-		else
-			(*it).textStyle=itemStyle;
-	}
+	int numberSelected = tocListBox->currentRow();
+	if (numberSelected < 0)
+		return;
+
+	int i = 0;
+	ToCSetupVector::Iterator it=localToCSetupVector.begin();
+	while (it != localToCSetupVector.end() && i < numberSelected)
+	{
+		++it;
+		++i;
+	}
+	if (itemStyle == CommonStrings::tr_None)
+		(*it).textStyle = CommonStrings::None;
+	else
+		(*it).textStyle = itemStyle;
 }
 
 void Prefs_TableOfContents::setToCName( const QString &newName )
 {
-	int numberSelected=tocListBox->currentRow();
-	if (numberSelected!=-1)
-	{
-		tocListBox->item(numberSelected)->setText(newName);
-		int i=0;
-		ToCSetupVector::Iterator it=localToCSetupVector.begin();
-		while (it!= localToCSetupVector.end() && i<numberSelected)
-		{
-			++it;
-			++i;
-		}
-		(*it).name=newName;
-	}
+	int numberSelected = tocListBox->currentRow();
+	if (numberSelected < 0)
+		return;
+
+	tocListBox->item(numberSelected)->setText(newName);
+	int i = 0;
+	ToCSetupVector::Iterator it = localToCSetupVector.begin();
+	while (it != localToCSetupVector.end() && i < numberSelected)
+	{
+		++it;
+		++i;
+	}
+	(*it).name = newName;
 }
 
 
 void Prefs_TableOfContents::nonPrintingFramesSelected( bool showNonPrinting )
 {
-	int numberSelected=tocListBox->currentRow();
-	if (numberSelected>=0)
-	{
-		int i=0;
-		ToCSetupVector::Iterator it=localToCSetupVector.begin();
-		while (it!= localToCSetupVector.end() && i<numberSelected)
-		{
-			++it;
-			++i;
-		}
-		(*it).listNonPrintingFrames=showNonPrinting;
-	}
-}
-
+	int numberSelected = tocListBox->currentRow();
+	if (numberSelected < 0)
+		return;
+
+	int i = 0;
+	ToCSetupVector::Iterator it = localToCSetupVector.begin();
+	while (it != localToCSetupVector.end() && i < numberSelected)
+	{
+		++it;
+		++i;
+	}
+	(*it).listNonPrintingFrames = showNonPrinting;
+}
+




More information about the scribus-commit mailing list