r22700 by craig - General refactoring/renaming

scribus-commit scribus-commit at lists.scribus.net
Wed Sep 19 20:55:45 UTC 2018


Author: craig
Date: Wed Sep 19 20:55:45 2018
New Revision: 22700

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22700
Log:
General refactoring/renaming

Modified:
    trunk/Scribus/scribus/canvasmode_create.cpp
    trunk/Scribus/scribus/canvasmode_drawbezier.cpp
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp
    trunk/Scribus/scribus/prefsmanager.cpp
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribus.h
    trunk/Scribus/scribus/scribusapp.cpp
    trunk/Scribus/scribus/ui/fontcombo.cpp
    trunk/Scribus/scribus/units.cpp
    trunk/Scribus/scribus/util.cpp
    trunk/Scribus/scribus/util_file.cpp

Modified: trunk/Scribus/scribus/canvasmode_create.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22700&path=/trunk/Scribus/scribus/canvasmode_create.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_create.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_create.cpp	Wed Sep 19 20:55:45 2018
@@ -246,7 +246,6 @@
 	
 	double newX, newY;
 	PageItem *currItem;
-	QPoint np, np2, mop;
 	QPainter p;
 //	QRect tx;
 	m->accept();

Modified: trunk/Scribus/scribus/canvasmode_drawbezier.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22700&path=/trunk/Scribus/scribus/canvasmode_drawbezier.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_drawbezier.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_drawbezier.cpp	Wed Sep 19 20:55:45 2018
@@ -227,7 +227,6 @@
 	
 	double newX, newY;
 	PageItem *currItem;
-	QPoint np, np2, mop;
 	FPoint npf, npf2;
 //	QRect tx;
 	m->accept();

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22700&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp	Wed Sep 19 20:55:45 2018
@@ -929,7 +929,7 @@
 			bool useMask = true;
 			if ((m_imageInfoRecord.isRequest) && (m_imageInfoRecord.RequestProps.contains(layerNum)))
 				visible = m_imageInfoRecord.RequestProps[layerNum].visible;
-			QString layBlend = "norm";
+			QString layBlend("norm");
 			if ((m_imageInfoRecord.isRequest) && (m_imageInfoRecord.RequestProps.contains(layerNum)))
 				layBlend = m_imageInfoRecord.RequestProps[layerNum].blend;
 			if ((m_imageInfoRecord.isRequest) && (m_imageInfoRecord.RequestProps.contains(layerNum)))
@@ -1006,13 +1006,9 @@
 	{
 		// Do not set m_pixelFormat here as the real pixel format is most probably different than gray
 		if (bitspersample == 1)
-		{
 			m_imageInfoRecord.colorspace = ColorSpaceMonochrome;
-		}
 		else
-		{
 			m_imageInfoRecord.colorspace = ColorSpaceGray;
-		}
 	}
 	else
 	{

Modified: trunk/Scribus/scribus/prefsmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22700&path=/trunk/Scribus/scribus/prefsmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/prefsmanager.cpp	(original)
+++ trunk/Scribus/scribus/prefsmanager.cpp	Wed Sep 19 20:55:45 2018
@@ -927,7 +927,7 @@
 		QFileInfo fd(appPrefs.uiPrefs.RecentDocs[m]);
 		if (fd.exists())
 		{
-			mw->RecentDocs.append(appPrefs.uiPrefs.RecentDocs[m]);
+			mw->m_recentDocsList.append(appPrefs.uiPrefs.RecentDocs[m]);
 			//#9845: ScCore->fileWatcher->addFile(appPrefs.uiPrefs.RecentDocs[m]);
 		}
 	}
@@ -1020,10 +1020,10 @@
 	appPrefs.uiPrefs.mainWinSettings.maximized = ScCore->primaryMainWindow()->isMaximized();
 	appPrefs.uiPrefs.mainWinState = ScCore->primaryMainWindow()->saveState();
 	appPrefs.uiPrefs.RecentDocs.clear();
-	uint max = qMin(appPrefs.uiPrefs.recentDocCount, ScCore->primaryMainWindow()->RecentDocs.count());
+	uint max = qMin(appPrefs.uiPrefs.recentDocCount, ScCore->primaryMainWindow()->m_recentDocsList.count());
 	for (uint m = 0; m < max; ++m)
 	{
-		appPrefs.uiPrefs.RecentDocs.append(ScCore->primaryMainWindow()->RecentDocs[m]);
+		appPrefs.uiPrefs.RecentDocs.append(ScCore->primaryMainWindow()->m_recentDocsList[m]);
 	}
 	ScCore->primaryMainWindow()->getDefaultPrinter(appPrefs.printerPrefs.PrinterName, appPrefs.printerPrefs.PrinterFile, appPrefs.printerPrefs.PrinterCommand);
 	SavePrefsXML();

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22700&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp	(original)
+++ trunk/Scribus/scribus/scribus.cpp	Wed Sep 19 20:55:45 2018
@@ -791,7 +791,7 @@
 
 void ScribusMainWindow::initMenuBar()
 {
-	RecentDocs.clear();
+	m_recentDocsList.clear();
 	scrMenuMgr->createMenu("File", ActionManager::defaultMenuNameEntryTranslated("File"));
 	scrMenuMgr->addMenuItemString("fileNew", "File");
 	scrMenuMgr->addMenuItemString("fileNewFromTemplate", "File");
@@ -2105,7 +2105,7 @@
 {
 	bool docSet = false;
 	PrefsContext* docContext = m_prefsManager->prefsFile->getContext("docdirs", false);
-	NewDoc* dia = new NewDoc(this, RecentDocs, true, ScCore->getGuiLanguage());
+	NewDoc* dia = new NewDoc(this, m_recentDocsList, true, ScCore->getGuiLanguage());
 	if (dia->exec())
 	{
 		if (dia->tabSelected() == NewDoc::NewDocumentTab)
@@ -2189,7 +2189,7 @@
 		view->requestMode(submodeEndNodeEdit);
 	bool retVal = false;
 	bool docSet = false;
-	NewDoc* dia = new NewDoc(this, RecentDocs);
+	NewDoc* dia = new NewDoc(this, m_recentDocsList);
 	if (dia->exec())
 	{
 		int facingPages = dia->choosenLayout();
@@ -2940,17 +2940,17 @@
 
 void ScribusMainWindow::updateRecent(const QString& fn)
 {
-	if (RecentDocs.indexOf(fn) != -1)
-		RecentDocs.removeAll(fn);
-	RecentDocs.prepend(fn);
+	if (m_recentDocsList.indexOf(fn) != -1)
+		m_recentDocsList.removeAll(fn);
+	m_recentDocsList.prepend(fn);
 	rebuildRecentFileMenu();
 }
 
 void ScribusMainWindow::removeRecent(const QString& fn, bool fromFileWatcher)
 {
-	if (RecentDocs.indexOf(fn) != -1)
-	{
-		RecentDocs.removeAll(fn);
+	if (m_recentDocsList.indexOf(fn) != -1)
+	{
+		m_recentDocsList.removeAll(fn);
 		//#9845: if (!fromFileWatcher)
 		//#9845:	ScCore->fileWatcher->removeFile(fn);
 	}
@@ -2976,13 +2976,13 @@
 	QString strippedName, localName;
 	scrMenuMgr->clearMenuStrings("FileOpenRecent");
 	scrRecentFileActions.clear();
-	int max = qMin(m_prefsManager->appPrefs.uiPrefs.recentDocCount, RecentDocs.count());
+	int max = qMin(m_prefsManager->appPrefs.uiPrefs.recentDocCount, m_recentDocsList.count());
 	for (int i = 0; i < max; ++i)
 	{
-		strippedName = localName = QDir::toNativeSeparators(RecentDocs[i]);
+		strippedName = localName = QDir::toNativeSeparators(m_recentDocsList[i]);
 		strippedName.remove(QDir::separator());
 		strippedName.prepend(QString("%1").arg(i+1, 2, 10, QChar('0')));
-		scrRecentFileActions.insert(strippedName, new ScrAction(ScrAction::RecentFile, QPixmap(), QPixmap(), QString("%1 &%2").arg(i+1).arg(localName.replace("&","&&")), QKeySequence(), this, RecentDocs[i]));
+		scrRecentFileActions.insert(strippedName, new ScrAction(ScrAction::RecentFile, QPixmap(), QPixmap(), QString("%1 &%2").arg(i+1).arg(localName.replace("&","&&")), QKeySequence(), this, m_recentDocsList[i]));
 		connect( scrRecentFileActions[strippedName], SIGNAL(triggeredData(QString)), this, SLOT(loadRecent(QString)) );
 		scrMenuMgr->addMenuItemString(strippedName, "FileOpenRecent");
 	}
@@ -6845,25 +6845,25 @@
 #else
 	if (!m_prefsManager->appPrefs.uiPrefs.tabbedPalettes.isEmpty())
 	{
-		for (int a = 0; a < m_prefsManager->appPrefs.uiPrefs.tabbedPalettes.count(); a++)
-		{
-			QStringList actTab = m_prefsManager->appPrefs.uiPrefs.tabbedPalettes[a].palettes;
+		for (int i = 0; i < m_prefsManager->appPrefs.uiPrefs.tabbedPalettes.count(); i++)
+		{
+			QStringList actTab = m_prefsManager->appPrefs.uiPrefs.tabbedPalettes[i].palettes;
 			QDockWidget *container = findChild<QDockWidget *>(actTab[0]);
 			QList<QTabBar *> bars = findChildren<QTabBar *>(QString());
 			bool found = false;
-			for (int i = 0; i < bars.count(); ++i)
+			for (int j = 0; j < bars.count(); ++j)
 			{
-				QTabBar *bar = bars[i];
-				for (int ii = 0; ii < bar->count(); ii++)
+				QTabBar *bar = bars[j];
+				for (int k = 0; k < bar->count(); k++)
 				{
-					QObject *obj = (QObject*)bar->tabData(ii).toULongLong();
+					QObject *obj = (QObject*)bar->tabData(k).toULongLong();
 					if (obj != nullptr)
 					{
 						if (obj->objectName() == container->objectName())
 						{
-							if (m_prefsManager->appPrefs.uiPrefs.tabbedPalettes[a].activeTab > -1)
+							if (m_prefsManager->appPrefs.uiPrefs.tabbedPalettes[i].activeTab > -1)
 							{
-								bar->setCurrentIndex(m_prefsManager->appPrefs.uiPrefs.tabbedPalettes[a].activeTab);
+								bar->setCurrentIndex(m_prefsManager->appPrefs.uiPrefs.tabbedPalettes[i].activeTab);
 								found = true;
 								break;
 							}
@@ -6939,7 +6939,7 @@
 	QDir d(prefsManager->preferencesLocation()+"/", "sc.*", QDir::Name, QDir::Files | QDir::NoSymLinks);
 	if ((d.exists()) && (d.count() != 0))
 	{
-		for (uint i = 0; i < d.count(); i++)
+		for (int i = 0; i < d.count(); i++)
 			QFile::remove(prefsManager->preferencesLocation() +"/" + d[i]);
 	}
 }
@@ -6952,12 +6952,12 @@
 		{
 			if (doc->checkerProfiles()[doc->curCheckProfile()].ignoreErrors)
 			{
-				int t = ScMessageBox::warning(this, CommonStrings::trWarning,
+				int i = ScMessageBox::warning(this, CommonStrings::trWarning,
 											"<qt>"+ tr("Scribus has detected some errors. Consider using the Preflight Verifier to correct them")+"</qt>",
 											QMessageBox::Abort | QMessageBox::Ignore,
 											QMessageBox::NoButton,	// GUI default
 											QMessageBox::Ignore);	// batch default
-				if (t == QMessageBox::Abort)
+				if (i == QMessageBox::Abort)
 					return;
 			}
 			else
@@ -8870,14 +8870,14 @@
 		return;
 
 	PageItem_ImageFrame* imageItem=currItem->asImageFrame();
-	int t=QMessageBox::Yes;
+	int i=QMessageBox::Yes;
 	if (imageItem->imageIsAvailable)
-		t = ScMessageBox::warning(this, CommonStrings::trWarning,
+		i = ScMessageBox::warning(this, CommonStrings::trWarning,
 								tr("Do you really want to replace your existing image?"),
 								QMessageBox::Yes | QMessageBox::No,
 								QMessageBox::No,	// GUI default
 								QMessageBox::Yes);	// batch default
-	if (t != QMessageBox::Yes)
+	if (i != QMessageBox::Yes)
 		return;
 
 	imageItem->EmProfile = "";

Modified: trunk/Scribus/scribus/scribus.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22700&path=/trunk/Scribus/scribus/scribus.h
==============================================================================
--- trunk/Scribus/scribus/scribus.h	(original)
+++ trunk/Scribus/scribus/scribus.h	Wed Sep 19 20:55:45 2018
@@ -266,7 +266,7 @@
 	QMultiHash<QString, QActionGroup*> scrActionGroups;
 	ScMWMenuManager* scrMenuMgr;
 	ActionManager* actionManager;
-	QStringList RecentDocs;
+	QStringList m_recentDocsList;
 	QStringList patternsDependingOnThis;
 
 public slots:

Modified: trunk/Scribus/scribus/scribusapp.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22700&path=/trunk/Scribus/scribus/scribusapp.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusapp.cpp	(original)
+++ trunk/Scribus/scribus/scribusapp.cpp	Wed Sep 19 20:55:45 2018
@@ -203,7 +203,8 @@
 		{
 			header=true;
 			version=true;
-		} else if (arg == ARG_HELP || arg == ARG_HELP_SHORT)
+		}
+		else if (arg == ARG_HELP || arg == ARG_HELP_SHORT)
 		{
 			header=true;
 			usage=true;
@@ -222,7 +223,8 @@
 		{
 			header=true;
 			availlangs=true;
-		} else if (arg == ARG_UPGRADECHECK || arg == ARG_UPGRADECHECK_SHORT)
+		}
+		else if (arg == ARG_UPGRADECHECK || arg == ARG_UPGRADECHECK_SHORT)
 		{
 			header=true;
 			runUpgradeCheck=true;
@@ -404,8 +406,7 @@
 				PrefsContext* userprefsContext = prefsFile->getContext("user_preferences");
 				if (userprefsContext)
 				{
-					QString prefslang = userprefsContext->get("gui_language","");
-					prefslang = cleanupLang(prefslang);
+					QString prefslang(cleanupLang(userprefsContext->get("gui_language","")));
 					if (!prefslang.isEmpty())
 						langs.append(prefslang);
 				}

Modified: trunk/Scribus/scribus/ui/fontcombo.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22700&path=/trunk/Scribus/scribus/ui/fontcombo.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/fontcombo.cpp	(original)
+++ trunk/Scribus/scribus/ui/fontcombo.cpp	Wed Sep 19 20:55:45 2018
@@ -648,8 +648,7 @@
 	return QAbstractItemDelegate::helpEvent(event, view, option, index);
 }
 
-QSize FontFamilyDelegate::sizeHint(const QStyleOptionViewItem &option,
-								   const QModelIndex &index) const
+QSize FontFamilyDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
 {
 	QString text(index.data(Qt::DisplayRole).toString());
 	QFont font(option.font);

Modified: trunk/Scribus/scribus/units.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22700&path=/trunk/Scribus/scribus/units.cpp
==============================================================================
--- trunk/Scribus/scribus/units.cpp	(original)
+++ trunk/Scribus/scribus/units.cpp	Wed Sep 19 20:55:45 2018
@@ -139,9 +139,7 @@
 const QString unitGetSuffixFromIndex(const int index)
 {
 	if (index==SC_P)
-	{
 		return "";
-	}
 	return QString(" %1").arg(unitGetStrFromIndex(index));
 }
 
@@ -357,8 +355,8 @@
 		
 	double pts = 0.0, ret = 0.0;
 	//Can make this not convert to points at a later stage, for now, the function exists and works.
-	pts= primaryUnit==0 ? unitValue : unitValue / unitGetRatioFromIndex(primaryUnit);
-	ret= secondaryUnit==0 ? pts : pts * unitGetRatioFromIndex(secondaryUnit);
+	pts = primaryUnit == 0 ? unitValue : unitValue / unitGetRatioFromIndex(primaryUnit);
+	ret = secondaryUnit == 0 ? pts : pts * unitGetRatioFromIndex(secondaryUnit);
 	return ret;
 }
 
@@ -366,15 +364,15 @@
 {
 	QString s;
 
-	if (unitIndex==SC_PICAS)
-	{
-		int a=(static_cast<int>(unitValue))/12;
-		double b=fabs(fmod(unitValue, 12));
-		QString prefix((a==0 && unitValue < 0.0) ? "-" : "");
+	if (unitIndex == SC_PICAS)
+	{
+		int i = (static_cast<int>(unitValue))/12;
+		double d = fabs(fmod(unitValue, 12));
+		QString prefix((i == 0 && unitValue < 0.0) ? "-" : "");
 //		if (round2Precision)
 //			s=QString("%1%2%3%4").arg(prefix).arg(a).arg(unitGetStrFromIndex(unitIndex)).arg(QString::number(b, 'f', unitGetPrecisionFromIndex(unitIndex)));
 //		else
-			s=QString("%1%2%3%4").arg(prefix).arg(a).arg(unitGetStrFromIndex(unitIndex)).arg(b);
+			s=QString("%1%2%3%4").arg(prefix).arg(i).arg(unitGetStrFromIndex(unitIndex)).arg(d);
 	}
 	else
 	{
@@ -383,7 +381,7 @@
 		else
 			s=QString::number(pts2value(unitValue, unitIndex));
 		if (appendSuffix)
-			s += " "+unitGetStrFromIndex(unitIndex);
+			s += " " + unitGetStrFromIndex(unitIndex);
 	}
 	return s;
 }
@@ -414,9 +412,9 @@
 
 bool unitValidForDocUnit(const int index)
 {
-	if (index<UNITMIN || index>UNITMAX)
+	if (index < UNITMIN || index > UNITMAX)
 		return false;
-	if (index==6 || index==7)
+	if (index == SC_DEGREES || index == SC_PERCENT)
 		return false;
 	return true;
 }

Modified: trunk/Scribus/scribus/util.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22700&path=/trunk/Scribus/scribus/util.cpp
==============================================================================
--- trunk/Scribus/scribus/util.cpp	(original)
+++ trunk/Scribus/scribus/util.cpp	Wed Sep 19 20:55:45 2018
@@ -56,8 +56,7 @@
 	if (dotIndex < 0)
 		return lang;
 
-	QString cleanLang = lang.left(dotIndex);
-	return cleanLang;
+	return lang.left(dotIndex);
 }
 
 int System(const QString& exename, const QStringList & args, const QString& fileStdErr, const QString& fileStdOut, const bool* cancel)
@@ -136,15 +135,14 @@
 	QFileInfo fi(f);
 	if (!fi.exists())
 		return false;
-	bool ret;
 	QByteArray bb(f.size(), ' ');
-	if (f.open(QIODevice::ReadOnly))
-	{
-		f.read(bb.data(), f.size());
-		f.close();
-		for (int posi = 0; posi < bb.size(); ++posi)
-			*Buffer += QChar(bb[posi]);
-		/*
+	if (!f.open(QIODevice::ReadOnly))
+		return false;
+	f.read(bb.data(), f.size());
+	f.close();
+	for (int i = 0; i < bb.size(); ++i)
+		*Buffer += QChar(bb[i]);
+	/*
 		int len = bb.size();
 		int oldLen = Buffer->length();
 		Buffer->setLength( oldLen + len + 1);
@@ -155,11 +153,7 @@
 		*ucsString++ = *data++;
 		*ucsString = 0;
 		*/
-		ret = true;
-	}
-	else
-		ret = false;
-	return ret;
+	return true;
 }
 
 bool loadRawText(const QString & filename, QByteArray & buf)
@@ -305,10 +299,10 @@
 {
 	int i = 0;
 	QString out;
-	for( int xi = 0; xi < in->length(); ++xi )
+	for(int j = 0; j < in->length(); ++j)
 	{
 		// Qt4 .cell() added ???
-		out += toHex(QChar(in->at(xi)).cell());
+		out += toHex(QChar(in->at(j)).cell());
 		++i;
 		if ((i>40) && (lang))
 		{
@@ -327,7 +321,7 @@
 
 QString Relative2Path(const QString& File, const QString& baseDir)
 {
-	QString   absPath;
+	QString absPath;
 	QFileInfo fi(File);
 	if (File.isEmpty())
 		absPath = File;

Modified: trunk/Scribus/scribus/util_file.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22700&path=/trunk/Scribus/scribus/util_file.cpp
==============================================================================
--- trunk/Scribus/scribus/util_file.cpp	(original)
+++ trunk/Scribus/scribus/util_file.cpp	Wed Sep 19 20:55:45 2018
@@ -239,7 +239,7 @@
 	return false;
 }
 
-PageItem*  getVectorFileFromData(ScribusDoc *doc, QByteArray &data, const QString& ext, double x, double y, double w, double h)
+PageItem* getVectorFileFromData(ScribusDoc *doc, QByteArray &data, const QString& ext, double x, double y, double w, double h)
 {
 	PageItem* retObj = nullptr;
 




More information about the scribus-commit mailing list