View Issue Details

IDProjectCategoryView StatusLast Update
0015870ScribusInternalpublic2019-12-08 21:24
Reporterale Assigned Toale  
PrioritynormalSeverityminorReproducibilityN/A
Status closedResolutionfixed 
Product Version1.5.6.svn 
Target VersionFixed in Version1.5.6.svn 
Summary0015870: Remove some unused class variables, variables, ifs and commented out code
Description- baseX and base Y are set but never used
- docWidth and docHeight can directly be set, without any if or temporary variables (and are only used in one function)
TagsNo tags attached.
PatchYes

Activities

ale

2019-10-23 13:14

manager  

pdfimport-unused.diff (3,855 bytes)
diff --git a/scribus/plugins/import/pdf/importpdf.cpp b/scribus/plugins/import/pdf/importpdf.cpp
index ffd8837c4..0a0d527ed 100644
--- a/scribus/plugins/import/pdf/importpdf.cpp
+++ b/scribus/plugins/import/pdf/importpdf.cpp
@@ -143,30 +143,6 @@ QImage PdfPlug::readThumbnail(const QString& fName)
 	}
 	return QImage();
 }
-/*	Old Code to be backed up
-	QString tmp, cmd1, cmd2;
-	QString pdfFile = QDir::toNativeSeparators(fName);
-	QString tmpFile = QDir::toNativeSeparators(ScPaths::tempFileDir() + "sc.png");
-	int ret = -1;
-	tmp.setNum(1);
-	QStringList args;
-	args.append("-r72");
-	args.append("-sOutputFile="+tmpFile);
-	args.append("-dFirstPage="+tmp);
-	args.append("-dLastPage="+tmp);
-	args.append(pdfFile);
-	ret = callGS(args);
-	if (ret == 0)
-	{
-		QImage image;
-		image.load(tmpFile);
-		QFile::remove(tmpFile);
-		image.setText("XSize", QString("%1").arg(image.width()));
-		image.setText("YSize", QString("%1").arg(image.height()));
-		return image;
-	}
-	return QImage();
-*/
 
 bool PdfPlug::import(const QString& fNameIn, const TransactionSettings& trSettings, int flags, bool showProgress)
 {
@@ -177,7 +153,6 @@ bool PdfPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	interactive = (flags & LoadSavePlugin::lfInteractive);
 	importerFlags = flags;
 	cancel = false;
-	double b, h;
 	bool ret = false;
 	QFileInfo fi = QFileInfo(fNameIn);
 	if ( !ScCore->usingGUI() )
@@ -206,28 +181,18 @@ bool PdfPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	else
 		progressDialog = nullptr;
 /* Set default Page to size defined in Preferences */
-	b = 0.0;
-	h = 0.0;
 	if (progressDialog)
 	{
 		progressDialog->setOverallProgress(1);
 		qApp->processEvents();
 	}
-	if (b == 0.0)
-		b = PrefsManager::instance().appPrefs.docSetupPrefs.pageWidth;
-	if (h == 0.0)
-		h = PrefsManager::instance().appPrefs.docSetupPrefs.pageHeight;
-	docWidth = b;
-	docHeight = h;
-	baseX = 0;
-	baseY = 0;
+	double docWidth = PrefsManager::instance().appPrefs.docSetupPrefs.pageWidth;
+	double docHeight = PrefsManager::instance().appPrefs.docSetupPrefs.pageHeight;
 	if (!interactive || (flags & LoadSavePlugin::lfInsertPage))
 	{
 		m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 		m_Doc->addPage(0);
 		m_Doc->view()->addPage(0, true);
-		baseX = 0;
-		baseY = 0;
 	}
 	else
 	{
@@ -236,17 +201,9 @@ bool PdfPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 			m_Doc=ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, 0, 0, 0, 0, 1, "Custom", true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
-			baseX = 0;
-			baseY = 0;
-			baseX = m_Doc->currentPage()->xOffset();
-			baseY = m_Doc->currentPage()->yOffset();
 		}
 	}
-	if ((!ret) && (interactive))
-	{
-		baseX = m_Doc->currentPage()->xOffset();
-		baseY = m_Doc->currentPage()->yOffset();
-	}
+
 	if ((ret) || (!interactive))
 	{
 		if (docWidth > docHeight)
@@ -488,11 +445,6 @@ bool PdfPlug::convert(const QString& fn)
 						useMediaBox = gFalse;
 					if (cropped)
 						useMediaBox = gTrue;
-				/*	if (cb > Media_Box)
-					{
-						cropped = true;
-						contentRect = cb;
-					} */
 					delete optImp;
 					qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
 					if (progressDialog)
diff --git a/scribus/plugins/import/pdf/importpdf.h b/scribus/plugins/import/pdf/importpdf.h
index 9dbfecc15..c478231b2 100644
--- a/scribus/plugins/import/pdf/importpdf.h
+++ b/scribus/plugins/import/pdf/importpdf.h
@@ -84,10 +84,6 @@ private:
 	QString UnicodeParsedString(POPPLER_CONST GooString *s1);
 	
 	QList<PageItem*> Elements;
-	double baseX, baseY;
-	double docWidth;
-	double docHeight;
-	qreal scPg;
 
 	QStringList importedColors;
 
pdfimport-unused.diff (3,855 bytes)

ale

2019-10-24 16:27

manager   ~0046856

thanks!
a.l.e

Issue History

Date Modified Username Field Change
2019-10-23 13:14 ale New Issue
2019-10-23 13:14 ale File Added: pdfimport-unused.diff
2019-10-23 13:17 ale Summary remove some unused class variables, variables, ifs and commented out code => [PATCH] remove some unused class variables, variables, ifs and commented out code
2019-10-23 13:17 ale Patch No => Yes
2019-10-24 13:59 jghali Category Import / Export => Internal
2019-10-24 14:19 jghali Summary [PATCH] remove some unused class variables, variables, ifs and commented out code => Remove some unused class variables, variables, ifs and commented out code
2019-10-24 14:43 jghali Assigned To => jghali
2019-10-24 14:43 jghali Status new => resolved
2019-10-24 14:43 jghali Resolution open => fixed
2019-10-24 14:43 jghali Fixed in Version => 1.5.6.svn
2019-10-24 14:43 jghali Assigned To jghali => ale
2019-10-24 16:27 ale Note Added: 0046856
2019-12-08 21:24 cbradney Status resolved => closed