r24134 by jghali - Code style fixes

scribus-commit scribus-commit at lists.scribus.net
Sat Oct 31 20:35:06 UTC 2020


Author: jghali
Date: Sat Oct 31 20:35:06 2020
New Revision: 24134

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

Modified:
    trunk/Scribus/scribus/downloadmanager/scdlmgr.cpp
    trunk/Scribus/scribus/pageitem.cpp
    trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.cpp
    trunk/Scribus/scribus/ui/insertaframe.cpp
    trunk/Scribus/scribus/ui/inspage.cpp
    trunk/Scribus/scribus/ui/loremipsum.cpp

Modified: trunk/Scribus/scribus/downloadmanager/scdlmgr.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24134&path=/trunk/Scribus/scribus/downloadmanager/scdlmgr.cpp
==============================================================================
--- trunk/Scribus/scribus/downloadmanager/scdlmgr.cpp	(original)
+++ trunk/Scribus/scribus/downloadmanager/scdlmgr.cpp	Sat Oct 31 20:35:06 2020
@@ -33,13 +33,13 @@
 void ScDLManager::addURL(const QUrl &url, bool overwrite, const QString& downloadLocation, const QString& destinationLocation, const QString& destinationName)
 {
 	DownloadData d;
-	d.id=m_dlID++;
-	d.name=url.fileName();
-	d.url=url;
-	d.downloadLocation=downloadLocation;
-	d.destinationLocation=destinationLocation;
-	d.destinationName=destinationName;
-	d.state=DownloadData::New;
+	d.id = m_dlID++;
+	d.name = url.fileName();
+	d.url = url;
+	d.downloadLocation = downloadLocation;
+	d.destinationLocation = destinationLocation;
+	d.destinationName = destinationName;
+	d.state = DownloadData::New;
 	m_fileList.append(d);
 
 	m_thread->addURL(url, overwrite, downloadLocation, destinationLocation);
@@ -48,13 +48,13 @@
 void ScDLManager::addURL(const QString &url, bool overwrite, const QString &downloadLocation, const QString& destinationLocation, const QString& destinationName)
 {
 	DownloadData d;
-	d.id=m_dlID++;
-	d.name=QUrl(url).fileName();
-	d.url=url;
-	d.downloadLocation=downloadLocation;
-	d.destinationLocation=destinationLocation;
-	d.destinationName=destinationName;
-	d.state=DownloadData::New;
+	d.id = m_dlID++;
+	d.name = QUrl(url).fileName();
+	d.url = url;
+	d.downloadLocation = downloadLocation;
+	d.destinationLocation = destinationLocation;
+	d.destinationName = destinationName;
+	d.state = DownloadData::New;
 	m_fileList.append(d);
 
 	m_thread->addURL(QUrl(url), overwrite, downloadLocation, destinationLocation);
@@ -65,12 +65,12 @@
 	for(const QString& s : urlList)
 	{
 		DownloadData d;
-		d.id=m_dlID++;
-		d.name=QUrl(s).fileName();
-		d.url=s;
-		d.downloadLocation=downloadLocation;
-		d.destinationLocation=destinationLocation;
-		d.state=DownloadData::New;
+		d.id = m_dlID++;
+		d.name = QUrl(s).fileName();
+		d.url = s;
+		d.downloadLocation = downloadLocation;
+		d.destinationLocation = destinationLocation;
+		d.state = DownloadData::New;
 		m_fileList.append(d);
 	}
 	m_thread->addURLs(urlList, overwrite, downloadLocation, destinationLocation);
@@ -92,7 +92,7 @@
 		if (i.value().state!=DownloadData::Successful && i.value().state!=DownloadData::Failed && i.value().downloadLocation+i.value().name==filename)
 		{
 			//qDebug()<<"starting"<<i.value().downloadLocation+i.value().name<<filename;
-			i.value().state=DownloadData::Started;
+			i.value().state = DownloadData::Started;
 			break;
 		}
 	}
@@ -106,10 +106,10 @@
 	while (i.hasNext())
 	{
 		i.next();
-		if (i.value().state==DownloadData::Started && i.value().downloadLocation+i.value().name==filename)
+		if (i.value().state == DownloadData::Started && i.value().downloadLocation + i.value().name == filename)
 		{
-			//qDebug()<<"success"<<i.value().downloadLocation+i.value().name<<filename;
-			i.value().state=DownloadData::Successful;
+			//qDebug( )<< "success" << i.value().downloadLocation + i.value().name << filename;
+			i.value().state = DownloadData::Successful;
 			break;
 		}
 	}
@@ -123,10 +123,10 @@
 	while (i.hasNext())
 	{
 		i.next();
-		if (i.value().state==DownloadData::Started && i.value().downloadLocation+i.value().name==filename)
+		if (i.value().state == DownloadData::Started && i.value().downloadLocation + i.value().name == filename)
 		{
 			//qDebug()<<"fail"<<i.value().downloadLocation+i.value().name<<filename;
-			i.value().state=DownloadData::Failed;
+			i.value().state = DownloadData::Failed;
 			break;
 		}
 	}

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24134&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp	(original)
+++ trunk/Scribus/scribus/pageitem.cpp	Sat Oct 31 20:35:06 2020
@@ -7379,7 +7379,7 @@
 	ObjAttrVector::const_iterator foundIt = pageItemAttributes.begin();
 	for (ObjAttrVector::const_iterator objAttrIt = pageItemAttributes.begin(); objAttrIt != pageItemAttributes.end(); ++objAttrIt)
 	{
-		if (objAttrIt->name==attributeName)
+		if (objAttrIt->name == attributeName)
 		{
 			++countFound;
 			foundIt=objAttrIt;

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24134&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.cpp	Sat Oct 31 20:35:06 2020
@@ -118,9 +118,9 @@
 		PyErr_SetString(PyExc_ValueError, QString("Cannot accept empty name for pageitem").toLocal8Bit().constData());
 		return nullptr;
 	}
-	for (int i = 0; i<ScCore->primaryMainWindow()->doc->Items->count(); i++)
-	{
-		if (name==ScCore->primaryMainWindow()->doc->Items->at(i)->itemName())
+	for (int i = 0; i < ScCore->primaryMainWindow()->doc->Items->count(); i++)
+	{
+		if (name == ScCore->primaryMainWindow()->doc->Items->at(i)->itemName())
 			return ScCore->primaryMainWindow()->doc->Items->at(i);
 	} // for items
 	PyErr_SetString(NoValidObjectError, QString("Object not found").toLocal8Bit().constData());
@@ -137,9 +137,9 @@
 {
 	if (name.length() == 0)
 		return false;
-	for (int i = 0; i<ScCore->primaryMainWindow()->doc->Items->count(); i++)
-	{
-		if (name==ScCore->primaryMainWindow()->doc->Items->at(i)->itemName())
+	for (int i = 0; i < ScCore->primaryMainWindow()->doc->Items->count(); i++)
+	{
+		if (name == ScCore->primaryMainWindow()->doc->Items->at(i)->itemName())
 			return true;
 	} // for items
 	return false;

Modified: trunk/Scribus/scribus/ui/insertaframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24134&path=/trunk/Scribus/scribus/ui/insertaframe.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/insertaframe.cpp	(original)
+++ trunk/Scribus/scribus/ui/insertaframe.cpp	Sat Oct 31 20:35:06 2020
@@ -102,12 +102,12 @@
 
 	sourceDocLineEdit->setText("");
 	
-	if (m_Doc!=nullptr)
+	if (m_Doc != nullptr)
 	{
 		pageItemMap=m_Doc->getDocItemNames(PageItem::TextFrame);
 		comboBoxLinkToExistingFrameName->addItems(pageItemMap.values());
 	}
-	if (comboBoxLinkToExistingFrameName->count()==0)
+	if (comboBoxLinkToExistingFrameName->count() == 0)
 		checkBoxLinkToExistingFrame->setEnabled(false);
 	
 	connect(typeButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(slotSelectType(int)));
@@ -122,8 +122,8 @@
 
 void InsertAFrame::slotSelectType( int id )
 {
-	checkBoxLinkCreatedTextFrames->setEnabled(id==0);
-	radioButtonImageSize->setVisible(id==1);
+	checkBoxLinkCreatedTextFrames->setEnabled(id == 0);
+	radioButtonImageSize->setVisible(id == 1);
 	switch (id)
 	{
 		case 0:
@@ -157,64 +157,64 @@
 	}
 }
 
-void InsertAFrame::slotSelectPagePlacement( int id )
-{
-	placementPagesLineEdit->setEnabled(id==2);
-	placementPagesRangeButton->setEnabled(id==2);
-	checkBoxLinkCreatedTextFrames->setEnabled(typeButtonGroup->checkedId()==0 && (id!=0));
-}
-
-void InsertAFrame::slotSelectPosition( int id )
-{
-	xPosScrSpinBox->setEnabled(id==3);
-	yPosScrSpinBox->setEnabled(id==3);
-}
-
-void InsertAFrame::slotSelectSize( int id )
-{
-	widthScrSpinBox->setEnabled(id==4);
-	heightScrSpinBox->setEnabled(id==4);
+void InsertAFrame::slotSelectPagePlacement(int id)
+{
+	placementPagesLineEdit->setEnabled(id == 2);
+	placementPagesRangeButton->setEnabled(id == 2);
+	checkBoxLinkCreatedTextFrames->setEnabled(typeButtonGroup->checkedId() == 0 && (id != 0));
+}
+
+void InsertAFrame::slotSelectPosition(int id)
+{
+	xPosScrSpinBox->setEnabled(id == 3);
+	yPosScrSpinBox->setEnabled(id == 3);
+}
+
+void InsertAFrame::slotSelectSize(int id)
+{
+	widthScrSpinBox->setEnabled(id == 4);
+	heightScrSpinBox->setEnabled(id == 4);
 }
 
 void InsertAFrame::getNewFrameProperties(InsertAFrameData &iafData)
 {
-	int type=typeButtonGroup->checkedId();
-	iafData.source="";
+	int type = typeButtonGroup->checkedId();
+	iafData.source.clear();
 	switch (type)
 	{
 		case 0:
-			iafData.frameType=PageItem::TextFrame;
-			iafData.source=QDir::fromNativeSeparators(sourceDocLineEdit->text());
+			iafData.frameType = PageItem::TextFrame;
+			iafData.source = QDir::fromNativeSeparators(sourceDocLineEdit->text());
 			break;
 		case 1:
-			iafData.frameType=PageItem::ImageFrame;
-			iafData.source=QDir::fromNativeSeparators(sourceImageLineEdit->text());
-			break;
-	}
-	iafData.locationType=pagePlacementButtonGroup->checkedId();
-	iafData.pageList=placementPagesLineEdit->text();
-	iafData.positionType=framePositionButtonGroup->checkedId();
-	iafData.sizeType=sizeButtonGroup->checkedId();
+			iafData.frameType = PageItem::ImageFrame;
+			iafData.source = QDir::fromNativeSeparators(sourceImageLineEdit->text());
+			break;
+	}
+	iafData.locationType = pagePlacementButtonGroup->checkedId();
+	iafData.pageList = placementPagesLineEdit->text();
+	iafData.positionType = framePositionButtonGroup->checkedId();
+	iafData.sizeType = sizeButtonGroup->checkedId();
 	int docUnitIndex = m_Doc->unitIndex();
 	double unitRatio = unitGetRatioFromIndex(docUnitIndex);
-	iafData.x=xPosScrSpinBox->value() / unitRatio;
-	iafData.y=yPosScrSpinBox->value() / unitRatio;
-	iafData.width=widthScrSpinBox->value() / unitRatio;
-	iafData.height=heightScrSpinBox->value() / unitRatio;
-	iafData.impsetup=m_ImportSetup;
-	iafData.columnCount=textColumnCountSpinBox->value();
-	iafData.columnGap=textColumnGapScrSpinBox->value();
-	iafData.linkTextFrames=checkBoxLinkCreatedTextFrames->isChecked();
-	iafData.linkToExistingFrame=checkBoxLinkToExistingFrame->isChecked();
-	iafData.linkToExistingFramePtr=nullptr;
-	if (comboBoxLinkToExistingFrameName->count()!=0)
+	iafData.x = xPosScrSpinBox->value() / unitRatio;
+	iafData.y = yPosScrSpinBox->value() / unitRatio;
+	iafData.width = widthScrSpinBox->value() / unitRatio;
+	iafData.height = heightScrSpinBox->value() / unitRatio;
+	iafData.impsetup = m_ImportSetup;
+	iafData.columnCount = textColumnCountSpinBox->value();
+	iafData.columnGap = textColumnGapScrSpinBox->value();
+	iafData.linkTextFrames = checkBoxLinkCreatedTextFrames->isChecked();
+	iafData.linkToExistingFrame = checkBoxLinkToExistingFrame->isChecked();
+	iafData.linkToExistingFramePtr = nullptr;
+	if (comboBoxLinkToExistingFrameName->count() != 0)
 	{
 		QHashIterator<PageItem*, QString> i(pageItemMap);
 		while (i.hasNext())
 		{
 			i.next();
-			if (i.value()==comboBoxLinkToExistingFrameName->currentText())
-				iafData.linkToExistingFramePtr=i.key();
+			if (i.value() == comboBoxLinkToExistingFrameName->currentText())
+				iafData.linkToExistingFramePtr = i.key();
 		}
 	}
 }
@@ -230,7 +230,7 @@
 	else
 		docDir = prefsManager.prefsFile->getContext("dirs")->get("images", ".");
 		
-	QString fileName("");
+	QString fileName;
 	CustomFDialog dia(this, docDir, tr("Open"), formatD, fdShowPreview | fdExistingFiles | fdDisableOk);
 	if (dia.exec() == QDialog::Accepted)
 		fileName = dia.selectedFile();
@@ -240,9 +240,9 @@
 
 void InsertAFrame::locateDocFile()
 {
-	m_ImportSetup.runDialog=false;
+	m_ImportSetup.runDialog = false;
 	gtGetText* gt = new gtGetText(m_Doc);
-	m_ImportSetup=gt->run();
+	m_ImportSetup = gt->run();
 	if (m_ImportSetup.runDialog)
 		sourceDocLineEdit->setText(QDir::toNativeSeparators(m_ImportSetup.filename));
 	delete gt;
@@ -250,7 +250,7 @@
 
 void InsertAFrame::slotCreatePageNumberRange( )
 {
-	if (m_Doc!=nullptr)
+	if (m_Doc != nullptr)
 	{
 		CreateRange cr(placementPagesLineEdit->text(), m_Doc->Pages->count(), this);
 		if (cr.exec())
@@ -266,7 +266,7 @@
 
 void InsertAFrame::slotLinkToExistingFrame(int state)
 {
-	comboBoxLinkToExistingFrameName->setEnabled(state==Qt::Checked);
-	sourceDocLineEdit->setEnabled(state==Qt::Unchecked);
-	selectDocFileButton->setEnabled(state==Qt::Unchecked);
-}
+	comboBoxLinkToExistingFrameName->setEnabled(state == Qt::Checked);
+	sourceDocLineEdit->setEnabled(state == Qt::Unchecked);
+	selectDocFileButton->setEnabled(state == Qt::Unchecked);
+}

Modified: trunk/Scribus/scribus/ui/inspage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24134&path=/trunk/Scribus/scribus/ui/inspage.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/inspage.cpp	(original)
+++ trunk/Scribus/scribus/ui/inspage.cpp	Sat Oct 31 20:35:06 2020
@@ -231,8 +231,8 @@
 	TextLabel1 = new QLabel( tr( "&Size:" ), dsGroupBox7);
 	dsGroupBox7Layout->addWidget( TextLabel1, 0, 0);
 
-	PageSize *ps=new PageSize(m_doc->pageSize());
-	prefsPageSizeName=ps->name();
+	PageSize *ps = new PageSize(m_doc->pageSize());
+	prefsPageSizeName = ps->name();
 	sizeQComboBox = new QComboBox(dsGroupBox7);
 	QStringList insertList(ps->activeSizeTRList());
 	if (insertList.indexOf(prefsPageSizeName)==-1)
@@ -274,7 +274,7 @@
 	dsGroupBox7Layout->addWidget( moveObjectsCheckBox, 3, 0, 1, 4 );
 	dialogLayout->addWidget( dsGroupBox7 );
 	dsGroupBox7->setEnabled(false);
-	bool b=(sizeQComboBox->currentText() == CommonStrings::trCustomPageSize);
+	bool b = (sizeQComboBox->currentText() == CommonStrings::trCustomPageSize);
 	heightSpinBox->setEnabled( b );
 	widthSpinBox->setEnabled( b );
 	delete ps;
@@ -408,10 +408,10 @@
 
 void InsPage::insWherePageDataDisable(int index)
 {
-	insWherePageData->setDisabled((index==2));
+	insWherePageData->setDisabled((index == 2));
 }
 
 void InsPage::enableSizingControls(int state)
 {
-	dsGroupBox7->setEnabled(state==Qt::Checked);
-}
+	dsGroupBox7->setEnabled(state == Qt::Checked);
+}

Modified: trunk/Scribus/scribus/ui/loremipsum.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24134&path=/trunk/Scribus/scribus/ui/loremipsum.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/loremipsum.cpp	(original)
+++ trunk/Scribus/scribus/ui/loremipsum.cpp	Sat Oct 31 20:35:06 2020
@@ -217,7 +217,7 @@
 		}
 		availableLorems[parser->name] = fi.fileName();
 		QTreeWidgetItem *item = new QTreeWidgetItem(loremList);
-		if (parser->name=="la")
+		if (parser->name == "la")
 			item->setText(0, standardloremtext);
 		else
 			item->setText(0, langmgr->getLangFromAbbrev(parser->name, true));
@@ -370,10 +370,10 @@
 		li = loremList->currentItem()->parent();
 
 	QString name;
-	if (li->text(0)==standardloremtext)
-		name="la";
+	if (li->text(0) == standardloremtext)
+		name = "la";
 	else
-		name=LanguageManager::instance()->getAbbrevFromLang(li->text(0), false);
+		name = LanguageManager::instance()->getAbbrevFromLang(li->text(0), false);
 
 	return availableLorems[name];
 }




More information about the scribus-commit mailing list