r21934 by craig - Some code cleaning, mostly courtesy of clazy, part 2

scribus-commit scribus-commit at lists.scribus.net
Thu Apr 20 06:32:20 UTC 2017


Author: craig
Date: Thu Apr 20 06:32:20 2017
New Revision: 21934

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21934
Log:
Some code cleaning, mostly courtesy of clazy, part 2

Modified:
    trunk/Scribus/scribus/canvasmode_imageimport.h
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pdf.cpp
    trunk/Scribus/scribus/pdflib_core.cpp
    trunk/Scribus/scribus/pdfoptionsio.cpp
    trunk/Scribus/scribus/pslib.cpp
    trunk/Scribus/scribus/scpainterex_ps2.cpp
    trunk/Scribus/scribus/scpaths.cpp
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribusXml.cpp
    trunk/Scribus/scribus/ui/propertiespalette_utils.h
    trunk/Scribus/scribus/ui/splash.h

Modified: trunk/Scribus/scribus/canvasmode_imageimport.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21934&path=/trunk/Scribus/scribus/canvasmode_imageimport.h
==============================================================================
--- trunk/Scribus/scribus/canvasmode_imageimport.h	(original)
+++ trunk/Scribus/scribus/canvasmode_imageimport.h	Thu Apr 20 06:32:20 2017
@@ -31,6 +31,7 @@
 
 class CanvasMode_ImageImport : public CanvasMode
 {
+	Q_OBJECT
 public:
 	explicit CanvasMode_ImageImport(ScribusView* view);
 	virtual ~CanvasMode_ImageImport() {}

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pdf.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21934&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pdf.cpp
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pdf.cpp	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pdf.cpp	Thu Apr 20 06:32:20 2017
@@ -120,7 +120,6 @@
 	QFileInfo fi = QFileInfo(fn);
 	if (!fi.exists())
 		return false;
-	QString tmp, BBox;
 	QString tmpFile = QDir::toNativeSeparators(ScPaths::tempFileDir() + "sc.png");
 	QString picFile = QDir::toNativeSeparators(fn);
 	QStringList args;

Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21934&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp	(original)
+++ trunk/Scribus/scribus/pdflib_core.cpp	Thu Apr 20 06:32:20 2017
@@ -807,7 +807,6 @@
 
 QByteArray PDFLibCore::EncString(const QByteArray & in, PdfId ObjNum)
 {
-	QByteArray tmp;
 	if (in.length() < 1)
 		return "<>";
 	if (!Options.Encrypt)
@@ -980,12 +979,6 @@
 	if (!writer.open(fn))
 		return false;
 	
-	QFileInfo fiBase(fn);
-	QString baseDir = fiBase.absolutePath();
-
-//	QString tmp;
-//	QFileInfo fd;
-//	QString fext;
 	inPattern = 0;
 	Bvie = vi;
 	BookMinUse = false;
@@ -1080,7 +1073,6 @@
 	{
 		PutDoc("/OpenAction << /S /JavaScript /JS (this."+Pdf::toPdfDocEncoding(Options.openAction)+"\\(\\)) >>\n");
 	}
-	QString tmp;
 	QDateTime dt = QDateTime::currentDateTime().toUTC();
 	Datum = Pdf::toDateString(dt);
 //    "D:";
@@ -2550,7 +2542,7 @@
 
 bool PDFLibCore::PDF_TemplatePage(const ScPage* pag, bool )
 {
-	QByteArray tmp, tmpOut;
+	QByteArray tmpOut;
 	ActPageP = pag;
 	PageItem* ite;
 	QList<PageItem*> PItems;
@@ -6160,7 +6152,6 @@
 				TransVec.append(a);
 			}
 		}
-		QByteArray TRes("");
 		PdfId patObject = writer.newObject();
 		writer.startObj(patObject);
 		PutDoc("<<\n/Type /Pattern\n");
@@ -10110,7 +10101,6 @@
 	if (ext.isEmpty())
 		ext = getImageType(fn);
 	ScImage img;
-	QByteArray tmp, tmpy, dummy, cmd1, cmd2;
 	QString BBox;
 	QChar  tc;
 	bool   found = false;

Modified: trunk/Scribus/scribus/pdfoptionsio.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21934&path=/trunk/Scribus/scribus/pdfoptionsio.cpp
==============================================================================
--- trunk/Scribus/scribus/pdfoptionsio.cpp	(original)
+++ trunk/Scribus/scribus/pdfoptionsio.cpp	Thu Apr 20 06:32:20 2017
@@ -557,7 +557,7 @@
 	{
 		m_error = QObject::tr("Unable to read settings XML: %1")
 			.arg(QString("Internal error: element named <%1> not expected <%2>")
-					.arg(elem.tagName()).arg(name)
+					.arg(elem.tagName(), name)
 			);
 		return QDomNode().toElement();
 	}

Modified: trunk/Scribus/scribus/pslib.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21934&path=/trunk/Scribus/scribus/pslib.cpp
==============================================================================
--- trunk/Scribus/scribus/pslib.cpp	(original)
+++ trunk/Scribus/scribus/pslib.cpp	Thu Apr 20 06:32:20 2017
@@ -223,7 +223,6 @@
 	optimization = OptimizeCompat;
 	usingGUI=ScCore->usingGUI();
 	abortExport=false;
-	QString tmp, tmp2, tmp3, tmp4, CHset;
 	QStringList wt;
 	Seiten = 0;
 	User = "";
@@ -1238,7 +1237,6 @@
 	else
 	{
 		ScImage image;
-		QByteArray imgArray;
 		image.imgInfo.valid = false;
 		image.imgInfo.clipPath = "";
 		image.imgInfo.PDSpathData.clear();
@@ -1644,7 +1642,6 @@
 				{
 					for (int api = 0; api < Doc->MasterItems.count() && !abortExport; ++api)
 					{
-						QString tmps;
 						PageItem *it = Doc->MasterItems.at(api);
 						if (usingGUI)
 							ScQApp->processEvents();
@@ -2562,10 +2559,6 @@
 
 void PSLib::ProcessPage(ScribusDoc* Doc, ScPage* a, uint PNr, bool sep, bool farb)
 {
-	int b;
-//	int h, s, v, k;
-	QByteArray chstrc;
-	QString chstr, chglyph, tmp;
 	PageItem *c;
 	QList<PageItem*> PItems;
 	int Lnr = 0;
@@ -2578,7 +2571,7 @@
 		Doc->Layers.levelToLayer(ll, Lnr);
 		if (ll.isPrintable && !abortExport)
 		{
-			for (b = 0; b < PItems.count() && !abortExport; ++b)
+			for (int b = 0; b < PItems.count() && !abortExport; ++b)
 			{
 				c = PItems.at(b);
 				if (usingGUI)

Modified: trunk/Scribus/scribus/scpainterex_ps2.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21934&path=/trunk/Scribus/scribus/scpainterex_ps2.cpp
==============================================================================
--- trunk/Scribus/scribus/scpainterex_ps2.cpp	(original)
+++ trunk/Scribus/scribus/scpainterex_ps2.cpp	Thu Apr 20 06:32:20 2017
@@ -997,7 +997,6 @@
 	VColorStopEx stop2( *colorStops[0] );
 	RGBColor rgb;
 	FPoint p1, p2;
-	QColor color;
 
 	if ( gradient.Stops() < 2 ) 
 		return;
@@ -1097,7 +1096,6 @@
 	VColorStopEx stop2( *colorStops[0] );
 	CMYKColor cmyk;
 	FPoint p1, p2;
-	QColor color;
 
 	if ( gradient.Stops() < 2 ) 
 		return;
@@ -1208,7 +1206,6 @@
 	VColorStopEx stop1( *colorStops[gradient.Stops() - 1] );
 	VColorStopEx stop2( *colorStops[gradient.Stops() - 1] );
 	RGBColor rgb;
-	QColor color;
 
 	clipBoxWidth = rect.width();
 	clipBoxHeight = rect.height();
@@ -1291,7 +1288,6 @@
 	VColorStopEx stop1( *colorStops[gradient.Stops() - 1] );
 	VColorStopEx stop2( *colorStops[gradient.Stops() - 1] );
 	CMYKColor cmyk;
-	QColor color;
 
 	clipBoxWidth = rect.width();
 	clipBoxHeight = rect.height();

Modified: trunk/Scribus/scribus/scpaths.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21934&path=/trunk/Scribus/scribus/scpaths.cpp
==============================================================================
--- trunk/Scribus/scribus/scpaths.cpp	(original)
+++ trunk/Scribus/scribus/scpaths.cpp	Thu Apr 20 06:32:20 2017
@@ -255,19 +255,15 @@
 QStringList ScPaths::spellDirs() const
 {
 	//dictionaryPaths
+	QDir d;
+	QStringList spellDirs;
+	spellDirs.append(userDictDir(ScPaths::Spell, false));
+	spellDirs.append(m_shareDir + "dicts/spelling/");
+#ifdef Q_OS_MAC
 	QString macPortsPath("/opt/local/share/hunspell/");
 	QString finkPath("/sw/share/hunspell/");
 	QString osxLibreOfficePath("/Applications/LibreOffice.app/Contents/Resources/extensions");
 	QString osxUserLibreOfficePath(QDir::homePath()+"/Applications/LibreOffice.app/Contents/Resources/extensions");
-	QString linuxLocalPath("/usr/local/share/hunspell/");
-	QString linuxHunspellPath("/usr/share/hunspell/");
-	QString linuxMyspellPath("/usr/share/myspell/");
-	QString windowsLOPath("LibreOffice 3.5/share/extensions");
-	QDir d;
-	QStringList spellDirs;
-	spellDirs.append(userDictDir(ScPaths::Spell, false));
-	spellDirs.append(m_shareDir + "dicts/spelling/");
-#ifdef Q_OS_MAC
 	d.setPath(macPortsPath);
 	if (d.exists())
 		spellDirs.append(macPortsPath);
@@ -294,6 +290,7 @@
 	}
 
 #elif defined(_WIN32)
+//	QString windowsLOPath("LibreOffice 3.5/share/extensions");
 	QString progFiles = windowsSpecialDir(CSIDL_PROGRAM_FILES);
 	d.setPath(progFiles+windowsLOPath);
 	if (d.exists())
@@ -305,6 +302,9 @@
 			spellDirs.append(progFiles+windowsLOPath + "/" + dir + "/");
 	}
 #elif defined(Q_OS_LINUX)
+	QString linuxLocalPath("/usr/local/share/hunspell/");
+	QString linuxHunspellPath("/usr/share/hunspell/");
+	QString linuxMyspellPath("/usr/share/myspell/");
 	d.setPath(linuxHunspellPath);
 	if (d.exists())
 		spellDirs.append(linuxHunspellPath);

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21934&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp	(original)
+++ trunk/Scribus/scribus/scribus.cpp	Thu Apr 20 06:32:20 2017
@@ -1425,7 +1425,7 @@
 				break;
 		}
 		QString txtBody = tr("%1 selected").arg(whatSel) + " : " + tr("Size");
-		setStatusBarInfoText( QString("%1 = %3 x %4").arg(txtBody).arg(widthTxt).arg(heightTxt));
+		setStatusBarInfoText( QString("%1 = %3 x %4").arg(txtBody, widthTxt, heightTxt));
 	}
 	else
 	{
@@ -7233,7 +7233,7 @@
 					qApp->restoreOverrideCursor();
 					QString message = tr("Cannot write the file: \n%1").arg(doc->pdfOptions().fileName);
 					if (!errorMsg.isEmpty())
-						message = QString("%1\n%2").arg(message).arg(errorMsg);
+						message = QString("%1\n%2").arg(message, errorMsg);
 					ScMessageBox::warning(this, CommonStrings::trWarning, message);
 					return;
 				}
@@ -8238,7 +8238,7 @@
 	//Grab the language abbreviation from it, get the full language text
 	//Insert the name as key and a new string list into the map
 	QString hyphDirName = QDir::toNativeSeparators(ScPaths::instance().dictDir()+"/hyph/");
-	QDir hyphDir(hyphDirName, "hyph*.dic", QDir::Name, QDir::Files | QDir::NoSymLinks);
+//	QDir hyphDir(hyphDirName, "hyph*.dic", QDir::Name, QDir::Files | QDir::NoSymLinks);
 //IL	if ((hyphDir.exists()) && (hyphDir.count() != 0))
 //IL	{
 // 		LanguageManager langmgr;
@@ -8312,17 +8312,15 @@
 
 void ScribusMainWindow::ImageEffects()
 {
-	if (HaveDoc)
-	{
-		if (!doc->m_Selection->isEmpty())
-		{
-			PageItem *currItem = doc->m_Selection->itemAt(0);
-			EffectsDialog* dia = new EffectsDialog(this, currItem, doc);
-			if (dia->exec())
-				doc->itemSelection_ApplyImageEffects(dia->effectsList);
-			delete dia;
-		}
-	}
+	if (!HaveDoc)
+		return;
+	if (doc->m_Selection->isEmpty())
+		return;
+	PageItem *currItem = doc->m_Selection->itemAt(0);
+	EffectsDialog* dia = new EffectsDialog(this, currItem, doc);
+	if (dia->exec())
+		doc->itemSelection_ApplyImageEffects(dia->effectsList);
+	delete dia;
 }
 
 QString ScribusMainWindow::fileCollect(bool compress, bool withFonts, const bool withProfiles, const QString& )
@@ -8332,6 +8330,7 @@
 	CollectForOutput_UI c(this, doc, QString::null, withFonts, withProfiles, compress);
 	QString newFileName;
 	QString errorMsg=c.collect(newFileName);
+	qDebug()<<errorMsg;
 	return newFileName;
 }
 

Modified: trunk/Scribus/scribus/scribusXml.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21934&path=/trunk/Scribus/scribus/scribusXml.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusXml.cpp	(original)
+++ trunk/Scribus/scribus/scribusXml.cpp	Thu Apr 20 06:32:20 2017
@@ -157,7 +157,6 @@
 	if (selection->count()==0)
 		return "";
 	double xp, yp, wp, hp;
-	QString tmp, tmpy;
 	PageItem *item;
 	QString documentStr = "";
 	item = selection->itemAt(0);

Modified: trunk/Scribus/scribus/ui/propertiespalette_utils.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21934&path=/trunk/Scribus/scribus/ui/propertiespalette_utils.h
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_utils.h	(original)
+++ trunk/Scribus/scribus/ui/propertiespalette_utils.h	Thu Apr 20 06:32:20 2017
@@ -59,7 +59,7 @@
 
 
 class SCRIBUS_API LineFormatItem : public QListWidgetItem
-{	
+{
 	enum usrType {
 		LineFormatUserType = UserType + 2
 	};
@@ -82,11 +82,12 @@
 
 class SCRIBUS_API LineFormatItemDelegate : public ScListBoxPixmap<37, 37>
 {
-public:
-	LineFormatItemDelegate() : ScListBoxPixmap<37, 37>() {}
-	virtual int rtti() const { return 148523874; }
-	virtual QString text(const QVariant&) const;
-	virtual void redraw(const QVariant&) const;
+	Q_OBJECT
+	public:
+		LineFormatItemDelegate() : ScListBoxPixmap<37, 37>() {}
+		virtual int rtti() const { return 148523874; }
+		virtual QString text(const QVariant&) const;
+		virtual void redraw(const QVariant&) const;
 };
 
 class SCRIBUS_API NameWidget : public QLineEdit
@@ -95,7 +96,7 @@
 
 public:
 	NameWidget(QWidget* parent);
-	~NameWidget() {};
+	~NameWidget() {}
 
 signals:
 	void Leaved();

Modified: trunk/Scribus/scribus/ui/splash.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21934&path=/trunk/Scribus/scribus/ui/splash.h
==============================================================================
--- trunk/Scribus/scribus/ui/splash.h	(original)
+++ trunk/Scribus/scribus/ui/splash.h	Thu Apr 20 06:32:20 2017
@@ -17,13 +17,14 @@
 //! \brief Scribus splash screen
 class SCRIBUS_API ScSplashScreen : public QSplashScreen
 {
+	Q_OBJECT
 	public:
 		/*!
 		\author Franz Schmid
 		\brief Constructor for SplashScreen
 		 */
 		ScSplashScreen ( const QPixmap & pixmap = QPixmap(), Qt::WindowFlags f = 0 );
-		~ScSplashScreen() {};
+		~ScSplashScreen() {}
 		/*!
 		\author Franz Schmid
 		\brief Sets new status on SplashScreen and calls for a SplashScreen::repaint afterwards.




More information about the scribus-commit mailing list