r22268 by craig -

scribus-commit scribus-commit at lists.scribus.net
Wed Dec 20 23:01:58 UTC 2017


Author: craig
Date: Wed Dec 20 23:01:58 2017
New Revision: 22268

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22268
Log:
Fix some variable naming, some code organisation in scribus cpp

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

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22268&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp	(original)
+++ trunk/Scribus/scribus/scribus.cpp	Wed Dec 20 23:01:58 2017
@@ -1376,7 +1376,7 @@
 
 void ScribusMainWindow::setStatusBarTextSelectedItemInfo()
 {
-	const uint docSelectionCount = doc->m_Selection->count();
+	const int docSelectionCount = doc->m_Selection->count();
 	if (docSelectionCount == 0)
 	{
 		setStatusBarInfoText("");
@@ -1513,37 +1513,71 @@
 {
 	if (!HaveDoc)
 		return;
-//	const QString& actionName="";
-	if (doc->m_Selection->count() == 1)
-	{
-		PageItem* selItem = doc->m_Selection->itemAt(0);
-		if (((doc->appMode == modeEdit) || (doc->appMode == modeEditTable)) && (selItem->isTextFrame() || selItem->isTable()))
-		{
-			PageItem_TextFrame *currItem;
-			if (doc->appMode == modeEditTable)
-				currItem = selItem->asTable()->activeCell().textFrame();
-			else
-				currItem = selItem->asTextFrame();
-			if (currItem!=NULL)
+	if (doc->m_Selection->count() != 1)
+		return;
+	PageItem* selItem = doc->m_Selection->itemAt(0);
+	if (((doc->appMode == modeEdit) || (doc->appMode == modeEditTable)) && (selItem->isTextFrame() || selItem->isTable()))
+	{
+		PageItem_TextFrame *currItem;
+		if (doc->appMode == modeEditTable)
+			currItem = selItem->asTable()->activeCell().textFrame();
+		else
+			currItem = selItem->asTextFrame();
+		if (currItem!=NULL)
+		{
+			if (unicodevalue!=-1)
 			{
-				if (unicodevalue!=-1)
+				UndoTransaction activeTransaction;
+				if (currItem->HasSel){
+					if (UndoManager::undoEnabled())
+						activeTransaction = m_undoManager->beginTransaction(Um::Selection, Um::IGroup, Um::ReplaceText, "", Um::IDelete);
+					currItem->deleteSelectedTextFromFrame();
+				}
+				if (UndoManager::undoEnabled())
 				{
-					UndoTransaction activeTransaction;
-					if (currItem->HasSel){
-						if (UndoManager::undoEnabled())
-							activeTransaction = m_undoManager->beginTransaction(Um::Selection, Um::IGroup, Um::ReplaceText, "", Um::IDelete);
-						currItem->deleteSelectedTextFromFrame();
+					SimpleState *ss = dynamic_cast<SimpleState*>(m_undoManager->getLastUndo());
+					if (ss && ss->get("ETEA") == "insert_frametext")
+						ss->set("TEXT_STR",ss->get("TEXT_STR") + QString(QChar(unicodevalue)));
+					else {
+						ss = new SimpleState(Um::InsertText,"",Um::ICreate);
+						ss->set("INSERT_FRAMETEXT");
+						ss->set("ETEA", QString("insert_frametext"));
+						ss->set("TEXT_STR", QString(QChar(unicodevalue)));
+						ss->set("START", currItem->itemText.cursorPosition());
+						UndoObject * undoTarget = currItem;
+						if (currItem->isNoteFrame())
+						{
+							undoTarget = doc;
+							ss->set("noteframeName", currItem->getUName());
+						}
+						m_undoManager->action(undoTarget, ss);
 					}
+				}
+				currItem->itemText.insertChars(QString(QChar(unicodevalue)), true);
+				if (activeTransaction)
+					activeTransaction.commit();
+			}
+			else if (unicodevalue==SpecialChars::SHYPHEN.unicode()) //ignore the char as we use an attribute if the text item, for now.
+			{
+				// this code is currently dead since unicodeSoftHyphen
+				// doesn't have unicodevalue == -1 any more
+				if (currItem->itemText.cursorPosition() > 1)
+				{
+#if 0
+					StyleFlag fl = currItem->itemText.item(qMax(currItem->CPos-1,0))->effects();
+					fl |= ScStyle_HyphenationPossible;
+					currItem->itemText.item(qMax(currItem->CPos-1,0))->setEffects(fl);
+#else
 					if (UndoManager::undoEnabled())
 					{
 						SimpleState *ss = dynamic_cast<SimpleState*>(m_undoManager->getLastUndo());
 						if (ss && ss->get("ETEA") == "insert_frametext")
-							ss->set("TEXT_STR",ss->get("TEXT_STR") + QString(QChar(unicodevalue)));
+							ss->set("TEXT_STR",ss->get("TEXT_STR") + QString(SpecialChars::SHYPHEN));
 						else {
 							ss = new SimpleState(Um::InsertText,"",Um::ICreate);
 							ss->set("INSERT_FRAMETEXT");
 							ss->set("ETEA", QString("insert_frametext"));
-							ss->set("TEXT_STR", QString(QChar(unicodevalue)));
+							ss->set("TEXT_STR", QString(SpecialChars::SHYPHEN));
 							ss->set("START", currItem->itemText.cursorPosition());
 							UndoObject * undoTarget = currItem;
 							if (currItem->isNoteFrame())
@@ -1554,50 +1588,14 @@
 							m_undoManager->action(undoTarget, ss);
 						}
 					}
-					currItem->itemText.insertChars(QString(QChar(unicodevalue)), true);
-					if (activeTransaction)
-						activeTransaction.commit();
+					currItem->itemText.insertChars(QString(SpecialChars::SHYPHEN), true);
+#endif
 				}
-				else if (unicodevalue==SpecialChars::SHYPHEN.unicode()) //ignore the char as we use an attribute if the text item, for now.
-				{
-					// this code is currently dead since unicodeSoftHyphen
-					// doesn't have unicodevalue == -1 any more
-					if (currItem->itemText.cursorPosition() > 1)
-					{
-#if 0
-						StyleFlag fl = currItem->itemText.item(qMax(currItem->CPos-1,0))->effects();
-						fl |= ScStyle_HyphenationPossible;
-						currItem->itemText.item(qMax(currItem->CPos-1,0))->setEffects(fl);
-#else
-						if (UndoManager::undoEnabled())
-						{
-							SimpleState *ss = dynamic_cast<SimpleState*>(m_undoManager->getLastUndo());
-							if (ss && ss->get("ETEA") == "insert_frametext")
-								ss->set("TEXT_STR",ss->get("TEXT_STR") + QString(SpecialChars::SHYPHEN));
-							else {
-								ss = new SimpleState(Um::InsertText,"",Um::ICreate);
-								ss->set("INSERT_FRAMETEXT");
-								ss->set("ETEA", QString("insert_frametext"));
-								ss->set("TEXT_STR", QString(SpecialChars::SHYPHEN));
-								ss->set("START", currItem->itemText.cursorPosition());
-								UndoObject * undoTarget = currItem;
-								if (currItem->isNoteFrame())
-								{
-									undoTarget = doc;
-									ss->set("noteframeName", currItem->getUName());
-								}
-								m_undoManager->action(undoTarget, ss);
-							}
-						}
-						currItem->itemText.insertChars(QString(SpecialChars::SHYPHEN), true);
-#endif
-					}
-				}
-				if (doc->appMode == modeEditTable)
-					selItem->asTable()->update();
-				else
-					currItem->update();
 			}
+			if (doc->appMode == modeEditTable)
+				selItem->asTable()->update();
+			else
+				currItem->update();
 		}
 	}
 }
@@ -1888,9 +1886,7 @@
 	{
 		if ((doc->appMode == modePanning) && (k->key() == Qt::Key_Control) && (QApplication::mouseButtons() & Qt::RightButton))
 			view->requestMode(modeNormal);
-	}
-	if (HaveDoc)
-	{
+
 		if (doc->appMode == modeMagnifier)
 			view->setCursor(IconManager::instance()->loadCursor("lupez.png"));
 	}
@@ -1948,10 +1944,10 @@
 	disconnect(mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(newActWin(QMdiSubWindow *)));
 	if (!windows.isEmpty())
 	{
-		uint windowCount=windows.count();
-		for ( uint i = 0; i < windowCount; ++i )
-		{
-			tw = (ScribusWin *)(windows.at(i));
+		int windowCount=windows.count();
+		for ( int i = 0; i < windowCount; ++i )
+		{
+			tw = dynamic_cast<ScribusWin *>(windows.at(i));
 			QMdiSubWindow *tws = windows.at(i);
 			ScribusWin* scw = dynamic_cast<ScribusWin *>(tws->widget());
 			if (scw)
@@ -2040,51 +2036,45 @@
 QStringList ScribusMainWindow::findRecoverableFile()
 {
 	QSet<QString> foundFiles;
+	QDir::SortFlags sortflags = QDir::Name | QDir::Time;
+	QDir::Filters filterflags = QDir::Files | QDir::NoSymLinks | QDir::NoDot | QDir::NoDotDot;
 	if (!m_prefsManager->appPrefs.docSetupPrefs.AutoSaveDir.isEmpty())
 	{
-		QDir dirAuto(m_prefsManager->appPrefs.docSetupPrefs.AutoSaveDir, "*_emergency_*.sla", QDir::Name | QDir::Time, QDir::Files | QDir::NoSymLinks | QDir::NoDot | QDir::NoDotDot);
+		QDir dirAuto(m_prefsManager->appPrefs.docSetupPrefs.AutoSaveDir, "*_emergency_*.sla", sortflags, filterflags);
 		QFileInfoList aList = dirAuto.entryInfoList();
 		if (aList.count() > 0)
 		{
-			for (int a = 0; a < aList.count(); a++)
-			{
-				foundFiles.insert(aList[a].absoluteFilePath());
-			}
-		}
-		QDir dirAuto2(m_prefsManager->appPrefs.docSetupPrefs.AutoSaveDir, "*_autosave_*.sla", QDir::Name | QDir::Time, QDir::Files | QDir::NoSymLinks | QDir::NoDot | QDir::NoDotDot);
+			for (int i = 0; i < aList.count(); i++)
+				foundFiles.insert(aList[i].absoluteFilePath());
+		}
+		QDir dirAuto2(m_prefsManager->appPrefs.docSetupPrefs.AutoSaveDir, "*_autosave_*.sla", sortflags, filterflags);
 		QFileInfoList aList2 = dirAuto2.entryInfoList();
 		if (aList2.count() > 0)
 		{
-			for (int a = 0; a < aList2.count(); a++)
-			{
-				foundFiles.insert(aList2[a].absoluteFilePath());
-			}
-		}
-	}
-	QDir dirDoc(m_prefsManager->documentDir(), "*_emergency_*.sla", QDir::Name | QDir::Time, QDir::Files | QDir::NoSymLinks | QDir::NoDot | QDir::NoDotDot);
+			for (int i = 0; i < aList2.count(); i++)
+				foundFiles.insert(aList2[i].absoluteFilePath());
+		}
+	}
+	QDir dirDoc(m_prefsManager->documentDir(), "*_emergency_*.sla", sortflags, filterflags);
 	QFileInfoList dList = dirDoc.entryInfoList();
-	for (int a = 0; a < dList.count(); a++)
-	{
-		foundFiles.insert(dList[a].absoluteFilePath());
-	}
-	QDir dirDoc2(m_prefsManager->documentDir(), "*_autosave_*.sla", QDir::Name | QDir::Time, QDir::Files | QDir::NoSymLinks | QDir::NoDot | QDir::NoDotDot);
+	for (int i = 0; i < dList.count(); i++)
+		foundFiles.insert(dList[i].absoluteFilePath());
+
+	QDir dirDoc2(m_prefsManager->documentDir(), "*_autosave_*.sla", sortflags, filterflags);
 	QFileInfoList dList2 = dirDoc2.entryInfoList();
-	for (int a = 0; a < dList2.count(); a++)
-	{
-		foundFiles.insert(dList2[a].absoluteFilePath());
-	}
-	QDir dirHome(QDir::toNativeSeparators(QDir::homePath()), "*_emergency_*.sla", QDir::Name | QDir::Time, QDir::Files | QDir::NoSymLinks | QDir::NoDot | QDir::NoDotDot);
+	for (int i = 0; i < dList2.count(); i++)
+		foundFiles.insert(dList2[i].absoluteFilePath());
+
+	QDir dirHome(QDir::toNativeSeparators(QDir::homePath()), "*_emergency_*.sla", sortflags, filterflags);
 	QFileInfoList hList = dirHome.entryInfoList();
-	for (int a = 0; a < hList.count(); a++)
-	{
-		foundFiles.insert(hList[a].absoluteFilePath());
-	}
-	QDir dirHome2(QDir::toNativeSeparators(QDir::homePath()), "*_autosave_*.sla", QDir::Name | QDir::Time, QDir::Files | QDir::NoSymLinks | QDir::NoDot | QDir::NoDotDot);
+	for (int i = 0; i < hList.count(); i++)
+		foundFiles.insert(hList[i].absoluteFilePath());
+
+	QDir dirHome2(QDir::toNativeSeparators(QDir::homePath()), "*_autosave_*.sla", sortflags, filterflags);
 	QFileInfoList hList2 = dirHome2.entryInfoList();
-	for (int a = 0; a < hList2.count(); a++)
-	{
-		foundFiles.insert(hList2[a].absoluteFilePath());
-	}
+	for (int i = 0; i < hList2.count(); i++)
+		foundFiles.insert(hList2[i].absoluteFilePath());
+
 	return foundFiles.toList();
 }
 
@@ -2781,7 +2771,7 @@
 		return;
 	int SelectedType = -1;
 	PageItem *currItem = NULL;
-	const uint docSelectionCount = doc->m_Selection->count();
+	const int docSelectionCount = doc->m_Selection->count();
 	if (docSelectionCount > 0)
 	{
 		currItem = doc->m_Selection->itemAt(0);
@@ -3108,14 +3098,14 @@
 		if(UndoManager::undoEnabled())
 			pasteAction = m_undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::Create,"",Um::ICreate);
 		view->Deselect(true);
-		uint ac = doc->Items->count();
+		int docItemCount = doc->Items->count();
 		bool savedAlignGrid = doc->SnapGrid;
 		bool savedAlignGuides = doc->SnapGuides;
 		bool savedAlignElement = doc->SnapElement;
 		doc->SnapGrid = false;
 		doc->SnapGuides = false;
 		doc->SnapElement = false;
-		if ((view->dragX == 0) && (view->dragY == 0))
+		if ((view->dragX == 0.0) && (view->dragY == 0.0))
 			slotElemRead(data, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), true, true, doc, view);
 		else
 			slotElemRead(data, view->dragX, view->dragY, true, false, doc, view);
@@ -3124,9 +3114,9 @@
 		doc->SnapElement = savedAlignElement;
 		Selection tmpSelection(this, false);
 		tmpSelection.copy(*doc->m_Selection, true);
-		for (int as = ac; as < doc->Items->count(); ++as)
-		{
-			PageItem* currItem = doc->Items->at(as);
+		for (int i = docItemCount; i < doc->Items->count(); ++i)
+		{
+			PageItem* currItem = doc->Items->at(i);
 			doc->setRedrawBounding(currItem);
 			tmpSelection.addItem(currItem, true);
 			if (currItem->isBookmark)
@@ -3205,7 +3195,7 @@
 		if ((testResult != -1) && (testResult >= FORMATID_FIRSTUSER))
 		{
 			const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
-			if( fmt )
+			if (fmt)
 			{
 				doc->dontResize = true;
 				fmt->loadFile(fileName, LoadSavePlugin::lfUseCurrentPage|LoadSavePlugin::lfInteractive);
@@ -3415,7 +3405,7 @@
 			return false;
 		}
 		doc->setLoading(true);
-		uint oldItemsCount = doc->Items->count();
+		int oldItemsCount = doc->Items->count();
 		if(!fl->loadPage(doc, Nr, Mpa, renamedPageName))
 		{
 			delete fl;
@@ -3428,8 +3418,8 @@
 			recalcColors();
 			doc->RecalcPictures(&ScCore->InputProfiles, &ScCore->InputProfilesCMYK);
 		}
-		uint docItemsCount=doc->Items->count();
-		for (uint i = oldItemsCount; i < docItemsCount; ++i)
+		int docItemsCount=doc->Items->count();
+		for (int i = oldItemsCount; i < docItemsCount; ++i)
 		{
 			PageItem *ite = doc->Items->at(i);
 			if ((ite->asTextFrame()) && (ite->isBookmark))
@@ -3485,8 +3475,8 @@
 	// doc multiple times.
 	QString FName = fi.absoluteFilePath();
 	QString platfName(QDir::toNativeSeparators(FName));
-	uint windowCount = windows.count();
-	for ( uint i = 0; i < windowCount; ++i )
+	int windowCount = windows.count();
+	for (int i = 0; i < windowCount; ++i)
 	{
 		QString docNameUnmodified(windows.at(i)->windowTitle());
 		ScribusWin * mx = qobject_cast<ScribusWin*>(windows.at(i)->widget());
@@ -4562,10 +4552,10 @@
 		view->requestMode(submodeEndNodeEdit);
 	if (doc->m_Selection->isEmpty())
 		return;
-	uint docSelectionCount=doc->m_Selection->count();
+	int docSelectionCount=doc->m_Selection->count();
 	UndoTransaction activeTransaction;
 	PageItem *currItem;
-	for (uint i = 0; i < docSelectionCount; ++i)
+	for (int i = 0; i < docSelectionCount; ++i)
 	{
 		currItem=doc->m_Selection->itemAt(i);
 		if ((currItem->asTextFrame() || currItem->asPathText()) && currItem==storyEditor->currentItem() && doc==storyEditor->currentDocument())
@@ -4957,7 +4947,7 @@
 		if (ScMimeData::clipboardHasScribusElem() || ScMimeData::clipboardHasScribusFragment() || internalCopy)
 		{
 			view->Deselect(true);
-			uint docItemCount = doc->Items->count();
+			int docItemCount = doc->Items->count();
 			bool savedAlignGrid = doc->SnapGrid;
 			bool savedAlignGuides = doc->SnapGuides;
 			bool savedAlignElement = doc->SnapElement;
@@ -4988,9 +4978,9 @@
 			doc->SnapGuides = savedAlignGuides;
 			doc->SnapElement = savedAlignElement;
 			doc->m_Selection->delaySignalsOn();
-			for (int as = docItemCount; as < doc->Items->count(); ++as)
+			for (int i = docItemCount; i < doc->Items->count(); ++i)
 			{
-				PageItem* currItem = doc->Items->at(as);
+				PageItem* currItem = doc->Items->at(i);
 				if (currItem->isBookmark)
 					AddBookMark(currItem);
 				doc->m_Selection->addItem(currItem);
@@ -5034,13 +5024,13 @@
 
 	PageItem *currItem;
 	view->Deselect();
-	uint docItemsCount = doc->Items->count();
+	int docItemsCount = doc->Items->count();
 	int docCurrentPage = doc->currentPageNumber();
 	doc->m_Selection->delaySignalsOn();
 	int range = dia->getSelectionRange();
-	for (uint a = 0; a < docItemsCount; ++a)
-	{
-		currItem = doc->Items->at(a);
+	for (int i = 0; i < docItemsCount; ++i)
+	{
+		currItem = doc->Items->at(i);
 		if ((currItem->LayerID == doc->activeLayer()) && (!doc->layerLocked(currItem->LayerID)))
 		{
 			if ((range == 0) && (currItem->OwnPage != docCurrentPage))
@@ -5058,19 +5048,19 @@
 				bool useResize = false;
 				dia->getUsedAttributes(useType, useFill, useLine, useLWidth, usePrint, useLocked, useResize);
 				int Type = 0;
-				QString Fill = "";
-				QString Line = "";
+				QString fill;
+				QString line;
 				double LWidth = 0.0;
 				bool Print = false;
 				bool Locked = false;
 				bool Resize = false;
-				dia->getUsedAttributesValues(Type, Fill, Line, LWidth, Print, Locked, Resize);
+				dia->getUsedAttributesValues(Type, fill, line, LWidth, Print, Locked, Resize);
 				LWidth = LWidth / doc->unitRatio();
 				if ((useType) && (Type != currItem->realItemType()))
 					continue;
-				if ((useFill) && ((Fill != currItem->fillColor()) || (currItem->GrType != 0)))
+				if ((useFill) && ((fill != currItem->fillColor()) || (currItem->GrType != 0)))
 					continue;
-				if ((useLine) && (Line != currItem->lineColor()))
+				if ((useLine) && (line != currItem->lineColor()))
 					continue;
 				if ((useLWidth) && ((LWidth != currItem->lineWidth()) || (currItem->lineColor() == CommonStrings::None)))
 					continue;
@@ -5120,11 +5110,11 @@
 		PageItem *currItem;
 		view->Deselect();
 		doc->m_Selection->delaySignalsOn();
-		uint docItemsCount=doc->Items->count();
+		int docItemsCount=doc->Items->count();
 		int docCurrentPage=doc->currentPageNumber();
-		for (uint a = 0; a < docItemsCount; ++a)
-		{
-			currItem = doc->Items->at(a);
+		for (int i = 0; i < docItemsCount; ++i)
+		{
+			currItem = doc->Items->at(i);
 			if (((currItem->LayerID == doc->activeLayer()) || (doc->layerSelectable(currItem->LayerID))) && (!doc->layerLocked(currItem->LayerID)))
 			{
 				if (docWideSelect)
@@ -5528,7 +5518,7 @@
 
 void ScribusMainWindow::slotZoom(double zoomFactor)
 {
-	double finalZoomFactor;
+	double finalZoomFactor=0.0;
 	//Zoom to Fit
 	if (zoomFactor == -100.0)
 	{
@@ -6103,27 +6093,26 @@
 
 void ScribusMainWindow::setStyleEffects(int s)
 {
-	int c = s & 1919;
-	scrActions["typeEffectNormal"]->setChecked(c==0);
-	scrActions["typeEffectSuperscript"]->setChecked(c & 1);
-	scrActions["typeEffectSubscript"]->setChecked(c & 2);
-	scrActions["typeEffectOutline"]->setChecked(c & 4);
-	scrActions["typeEffectUnderline"]->setChecked(c & 8);
-	scrActions["typeEffectStrikeThrough"]->setChecked(c & 16);
-	scrActions["typeEffectAllCaps"]->setChecked(c & 32);
-	scrActions["typeEffectSmallCaps"]->setChecked(c & 64);
-	scrActions["typeEffectShadow"]->setChecked(c & 256);
-	scrActions["typeEffectUnderlineWords"]->setChecked(c & 512);
+	int i = s & 1919;
+	scrActions["typeEffectNormal"]->setChecked(i==0);
+	scrActions["typeEffectSuperscript"]->setChecked(i & 1);
+	scrActions["typeEffectSubscript"]->setChecked(i & 2);
+	scrActions["typeEffectOutline"]->setChecked(i & 4);
+	scrActions["typeEffectUnderline"]->setChecked(i & 8);
+	scrActions["typeEffectStrikeThrough"]->setChecked(i & 16);
+	scrActions["typeEffectAllCaps"]->setChecked(i & 32);
+	scrActions["typeEffectSmallCaps"]->setChecked(i & 64);
+	scrActions["typeEffectShadow"]->setChecked(i & 256);
+	scrActions["typeEffectUnderlineWords"]->setChecked(i & 512);
 	emit TextEffects(s);
 }
 
 void ScribusMainWindow::setItemEffects(int h)
 {
-	if (!doc->m_Selection->isEmpty())
-	{
-		setStyleEffects(h);
-		doc->itemSelection_SetEffects(h);
-	}
+	if (doc->m_Selection->isEmpty())
+		return;
+	setStyleEffects(h);
+	doc->itemSelection_SetEffects(h);
 }
 
 //CB-->Doc partly
@@ -6238,26 +6227,25 @@
 		view->requestMode(submodeEndNodeEdit);
 	int currentPage = doc->currentPage()->pageNr();
 	QScopedPointer<MovePages> dia(new MovePages(this, currentPage + 1, doc->Pages->count(), true));
-	if (dia->exec())
-	{
-		int from = dia->getFromPage();
-		int to = dia->getToPage();
-		int wie = dia->getWhere();
-		int wo = dia->getWherePage();
-		if (wie == 3)
-		{
-			doc->swapPage(from-1, wo-1);
-			updateGUIAfterPagesChanged();
-			return;
-		}
-		if ((wie < 2) && (from <= wo) && (wo <= to))
-			return;
-		if (wie == 2 && to == signed(doc->Pages->count()))
-			return;
-		doc->movePage(from-1, to, wo-1, wie);
+	if (!dia->exec())
+		return;
+	int from = dia->getFromPage();
+	int to = dia->getToPage();
+	int wie = dia->getWhere();
+	int wo = dia->getWherePage();
+	if (wie == 3)
+	{
+		doc->swapPage(from-1, wo-1);
 		updateGUIAfterPagesChanged();
-		doc->updateEndnotesFrames();
-	}
+		return;
+	}
+	if ((wie < 2) && (from <= wo) && (wo <= to))
+		return;
+	if (wie == 2 && to == signed(doc->Pages->count()))
+		return;
+	doc->movePage(from-1, to, wo-1, wie);
+	updateGUIAfterPagesChanged();
+	doc->updateEndnotesFrames();
 }
 
 void ScribusMainWindow::copyPage()
@@ -6266,20 +6254,18 @@
 		return;
 	if (doc->appMode == modeEditClip)
 		view->requestMode(submodeEndNodeEdit);
-	MovePages *dia = new MovePages(this, doc->currentPage()->pageNr()+1, doc->Pages->count(), false);
-	if (dia->exec())
-	{
-		int pageNumberToCopy=dia->getFromPage()-1;
-		int whereToInsert=dia->getWhere();
-		int copyCount=dia->getCopyCount();
-		int wo = dia->getWherePage();
-		doc->copyPage(pageNumberToCopy, wo, whereToInsert, copyCount);
-		view->Deselect(true);
-		doc->updateEndnotesFrames();
-		updateGUIAfterPagesChanged();
-		slotDocCh();
-	}
-	delete dia;
+	QScopedPointer<MovePages> dia(new MovePages(this, doc->currentPage()->pageNr()+1, doc->Pages->count(), false));
+	if (!dia->exec())
+		return;
+	int pageNumberToCopy=dia->getFromPage()-1;
+	int whereToInsert=dia->getWhere();
+	int copyCount=dia->getCopyCount();
+	int wo = dia->getWherePage();
+	doc->copyPage(pageNumberToCopy, wo, whereToInsert, copyCount);
+	view->Deselect(true);
+	doc->updateEndnotesFrames();
+	updateGUIAfterPagesChanged();
+	slotDocCh();
 }
 
 void ScribusMainWindow::changePageProperties()
@@ -6345,22 +6331,22 @@
 }
 
 //CB-->Doc
-void ScribusMainWindow::setNewAlignment(int a)
+void ScribusMainWindow::setNewAlignment(int i)
 {
 	if (!HaveDoc)
 		return;
-	doc->itemSelection_SetAlignment(a);
-	textPalette->textPal->showAlignment(a);
+	doc->itemSelection_SetAlignment(i);
+	textPalette->textPal->showAlignment(i);
 	PageItem *currItem = doc->m_Selection->itemAt(0);
 	setTBvals(currItem);
 }
 
-void ScribusMainWindow::setNewDirection(int a)
+void ScribusMainWindow::setNewDirection(int i)
 {
 	if (!HaveDoc)
 		return;
-	doc->itemSelection_SetDirection(a);
-	textPalette->textPal->showDirection(a);
+	doc->itemSelection_SetDirection(i);
+	textPalette->textPal->showDirection(i);
 	PageItem *currItem = doc->m_Selection->itemAt(0);
 	setTBvals(currItem);
 }
@@ -6383,27 +6369,27 @@
 	setTBvals(currItem);
 }
 
-void ScribusMainWindow::setAlignmentValue(int a)
-{
-	textPalette->textPal->showAlignment(a);
+void ScribusMainWindow::setAlignmentValue(int i)
+{
+	textPalette->textPal->showAlignment(i);
 	QString alignment[] = {"Left", "Center", "Right", "Block", "Forced"};
-	for (int b=0; b<5; ++b)
-	{
-		QString actionName="align"+alignment[b];
+	for (int j=0; j<5; ++j)
+	{
+		QString actionName="align"+alignment[j];
 		if (scrActions[actionName])
-			scrActions[actionName]->setChecked(a==b);
-	}
-}
-
-void ScribusMainWindow::setDirectionValue(int a)
-{
-	textPalette->textPal->showDirection(a);
+			scrActions[actionName]->setChecked(i==j);
+	}
+}
+
+void ScribusMainWindow::setDirectionValue(int i)
+{
+	textPalette->textPal->showDirection(i);
 	QString direction[] = {"Left", "Right"};
-	for (int b=0; b<2; ++b)
-	{
-		QString actionName="direction"+direction[b];
+	for (int j=0; j<2; ++j)
+	{
+		QString actionName="direction"+direction[j];
 		if (scrActions[actionName])
-			scrActions[actionName]->setChecked(a==b);
+			scrActions[actionName]->setChecked(i==j);
 	}
 }
 
@@ -6444,7 +6430,7 @@
 
 	UndoTransaction trans;
 	if (UndoManager::undoEnabled())
-		trans = m_undoManager->beginTransaction(Um::Selection,Um::IPolygon,Um::Duplicate,"",Um::IMultipleDuplicate);
+		trans = m_undoManager->beginTransaction(Um::Selection, Um::IPolygon, Um::Duplicate, "", Um::IMultipleDuplicate);
 
 	ItemMultipleDuplicateData mdData;
 	memset(&mdData, 0, sizeof(mdData));
@@ -6483,7 +6469,7 @@
 	if (doc->appMode == modeEditClip)
 		view->requestMode(submodeEndNodeEdit);
 	internalCopy = true;
-	MultipleDuplicate *dia = new MultipleDuplicate(doc->unitIndex(), this);
+	QScopedPointer<MultipleDuplicate> dia(new MultipleDuplicate(doc->unitIndex(), this));
 	if (dia->exec())
 	{
 		ItemMultipleDuplicateData mdData;
@@ -6491,7 +6477,6 @@
 		doc->itemSelection_MultipleDuplicate(mdData);
 	}
 	internalCopy = false;
-	delete dia;
 }
 
 void ScribusMainWindow::editItemsFromOutlines(PageItem *ite)
@@ -6685,7 +6670,7 @@
 			for ( int i = 0; i < windowCount; ++i )
 			{
 				QWidget* w = windows.at(i)->widget();
-				ScribusWin* scw = (ScribusWin*) w;
+				ScribusWin* scw = dynamic_cast<ScribusWin *>(w);
 				ScribusView* scw_v = scw->view();
 				if (oldPrefs.displayPrefs.displayScale != m_prefsManager->displayScale())
 				{
@@ -6927,11 +6912,11 @@
 		disconnect(docCheckerPalette, SIGNAL(ignoreAllErrors()), this, SLOT(doPrintPreview()));
 	}
 	PrefsContext* prefs = PrefsManager::instance()->prefsFile->getContext("print_options");
-	QString currentPrinter    = prefs->get("CurrentPrn");
+	QString currentPrinter(prefs->get("CurrentPrn"));
 	PrintEngine currentEngine = (PrintEngine) prefs->get("CurrentPrnEngine", "3").toInt();
 	if ( PPreview::usePostscriptPreview(currentPrinter, currentEngine) && ( !ScCore->haveGS() ) )
 	{
-		QString mess = tr("Ghostscript is missing : PostScript Print Preview is not available")+"\n\n";
+		QString mess(tr("Ghostscript is missing : PostScript Print Preview is not available")+"\n\n");
 		ScMessageBox::warning(this, CommonStrings::trWarning, mess);
 		return;
 	}
@@ -6967,7 +6952,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]);
 	}
 }
@@ -7757,9 +7742,9 @@
 	}
 	slotSelect();
 	appModeHelper->setMasterPageEditMode(false, doc);
-	uint pageCount=doc->DocPages.count();
-	for (uint c=0; c<pageCount; ++c)
-		Apply_MasterPage(doc->DocPages.at(c)->MPageNam, c, false);
+	int pageCount=doc->DocPages.count();
+	for (int i=0; i<pageCount; ++i)
+		Apply_MasterPage(doc->DocPages.at(i)->MPageNam, i, false);
 
 	pagePalette->endMasterPageMode();
 	if (pagePalette->isFloating())
@@ -7850,13 +7835,13 @@
 		return;
 	bool lockObject = false;
 	bool modifyLock = false;
-	uint selectedItemCount=itemSelection->count();
+	int selectedItemCount=itemSelection->count();
 	if (showLockDia)
 	{
-		uint lockedCount=0;
-		for (uint a=0; a<selectedItemCount; ++a)
-		{
-			if (itemSelection->itemAt(a)->locked())
+		int lockedCount=0;
+		for (int i=0; i<selectedItemCount; ++i)
+		{
+			if (itemSelection->itemAt(i)->locked())
 				++lockedCount;
 		}
 		if (lockedCount!=0 && lockedCount!=selectedItemCount)
@@ -8308,14 +8293,14 @@
 //IL	}
 
 	//For each qm file existing, load the file and find the translations of the names
-	QString pfad = ScPaths::instance().translationDir();
-	QDir d2(pfad, "*.*", QDir::Name, QDir::Files | QDir::NoSymLinks);
-	if ((d2.exists()) && (d2.count() != 0))
-	{
-		for (uint dc = 0; dc < d2.count(); dc++)
-		{
-			QFileInfo fi(pfad + d2[dc]);
-			QString ext = fi.suffix().toLower();
+	QString transPath = ScPaths::instance().translationDir();
+	QDir transDir(transPath, "*.*", QDir::Name, QDir::Files | QDir::NoSymLinks);
+	if ((transDir.exists()) && (transDir.count() != 0))
+	{
+		for (int i = 0; i < transDir.count(); i++)
+		{
+			QFileInfo fi(transPath + transDir[i]);
+			QString ext(fi.suffix().toLower());
 			if (ext == "qm")
 			{
  //IL   			QTranslator *trans = new QTranslator(0);
@@ -8453,10 +8438,10 @@
 	if (windows.isEmpty())
 		return;
 
-	uint windowCount = windows.count();
-	for (uint i=0; i<windowCount ; ++i)
-	{
-		ActWin = (ScribusWin*)windows.at(i)->widget();
+	int windowCount = windows.count();
+	for (int i=0; i<windowCount ; ++i)
+	{
+		ActWin = dynamic_cast<ScribusWin*>(windows.at(i)->widget());
 		doc = ActWin->doc();
 		view = ActWin->view();
 		doc->autoSaveTimer->stop();
@@ -8464,7 +8449,7 @@
 		doc->setModified(false);
 		QString base = tr("Document");
 		QString path = m_prefsManager->documentDir();
-		QString fileName = "";
+		QString fileName;
 		if (doc->hasName)
 		{
 			QFileInfo fi(doc->DocName);
@@ -8479,9 +8464,9 @@
 		FileLoader fl(fileName);
 		fl.saveFile(fileName, doc, 0);
 		view->close();
-		uint numPages=doc->Pages->count();
-		for (uint a=0; a<numPages; ++a)
-			delete doc->Pages->at(a);
+		int numPages=doc->Pages->count();
+		for (int j=0; j<numPages; ++j)
+			delete doc->Pages->at(j);
 		delete doc;
 		ActWin->close();
 	}
@@ -8583,7 +8568,7 @@
 		m_undoManager->showObject(Um::GLOBAL_UNDO_MODE);
 	else if (HaveDoc)
 	{
-		uint 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)
@@ -9164,17 +9149,17 @@
 	}
 	patternsDependingOnThis.clear();
 	QStringList mainPatterns = doc->docPatterns.keys();
-	for (int b = 0; b < results.count(); b++)
-	{
-		QString temp = results[b];
-		for (int a = 0; a < mainPatterns.count(); a++)
-		{
-			if (mainPatterns[a] != temp)
+	for (int i = 0; i < results.count(); i++)
+	{
+		QString temp(results[i]);
+		for (int j = 0; j < mainPatterns.count(); j++)
+		{
+			if (mainPatterns[j] != temp)
 			{
 				QStringList subPatterns;
-				subPatterns = doc->getUsedPatternsHelper(mainPatterns[a], subPatterns);
+				subPatterns = doc->getUsedPatternsHelper(mainPatterns[j], subPatterns);
 				if (subPatterns.contains(temp))
-					patternsDependingOnThis.prepend(mainPatterns[a]);
+					patternsDependingOnThis.prepend(mainPatterns[j]);
 			}
 		}
 		patternsDependingOnThis.prepend(temp);
@@ -10051,26 +10036,7 @@
 	HaveNewSel();
 }
 
-
-/*void ScribusMainWindow::testQTQuick2_1()
-{
-	qDebug()<<"Testing Qt Quick 2.0";
-
-	m_qqview = new QQuickView();
-	m_qqview->setSource(QUrl::fromLocalFile(ScPaths::instance().qmlDir() + "qtq_test1.qml"));
-	m_qqview->setFlags(Qt::Tool);
-	m_qqview->setResizeMode(QQuickView::SizeViewToRootObject);
-	QObject *rootObject = dynamic_cast<QObject*>(m_qqview->rootObject());
-	QObject *q_closeCheckBox = rootObject->findChild<QObject*>("closeCheckBox");
-	QObject *q_xSpinBox = rootObject->findChild<QObject*>("xSpinBox");
-	QObject *q_ySpinBox = rootObject->findChild<QObject*>("ySpinBox");
-
-	connect(q_xSpinBox, SIGNAL(editingFinished()), this, SLOT(testQT_slot4()));
-	connect(q_ySpinBox, SIGNAL(valueChanged(int)), this, SLOT(testQT_slot3(int)));
-	connect(q_closeCheckBox, SIGNAL(clicked()), this, SLOT(testQT_slot4()));
-	m_qqview->show();
-}
-
+/*
 void ScribusMainWindow::testQT_slot1(QString s)
 {
 	qDebug()<<"Signal data:"<<s;

Modified: trunk/Scribus/scribus/scribus.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22268&path=/trunk/Scribus/scribus/scribus.h
==============================================================================
--- trunk/Scribus/scribus/scribus.h	(original)
+++ trunk/Scribus/scribus/scribus.h	Wed Dec 20 23:01:58 2017
@@ -479,12 +479,12 @@
 	void generateTableOfContents();
 	void updateDocument();
 
-	void setNewAlignment(int a);
-	void setNewDirection(int a);
+	void setNewAlignment(int i);
+	void setNewDirection(int i);
 	void setNewParStyle(const QString& name);
 	void setNewCharStyle(const QString& name);
-	void setAlignmentValue(int a);
-	void setDirectionValue(int a);
+	void setAlignmentValue(int i);
+	void setDirectionValue(int i);
 	void editItemsFromOutlines(PageItem *ite);
 	//0= center, 1 = top left.
 	void selectItemsFromOutlines(PageItem *ite, bool single = false, int position = 0);
@@ -566,7 +566,6 @@
 	//connected to signal emitted by actions when "Update Marks" menu item is triggered
 	void slotUpdateMarks();
 	bool editMarkDlg(Mark *mrk, PageItem_TextFrame* currItem = NULL);
-//	void testQTQuick2_1();
 //	void testQT_slot1(QString);
 //	void testQT_slot2(double);
 //	void testQT_slot3(int);




More information about the scribus-commit mailing list