r22781 by jghali - small refactoring for pixmap export

scribus-commit scribus-commit at lists.scribus.net
Fri Dec 7 23:47:24 UTC 2018


Author: jghali
Date: Fri Dec  7 23:47:24 2018
New Revision: 22781

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22781
Log:
small refactoring for pixmap export

Modified:
    trunk/Scribus/scribus/plugins/export/pixmapexport/export.cpp

Modified: trunk/Scribus/scribus/plugins/export/pixmapexport/export.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22781&path=/trunk/Scribus/scribus/plugins/export/pixmapexport/export.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/export/pixmapexport/export.cpp	(original)
+++ trunk/Scribus/scribus/plugins/export/pixmapexport/export.cpp	Fri Dec  7 23:47:24 2018
@@ -106,50 +106,51 @@
 	dia->rangeVal->setText(tmp.setNum(doc->currentPageNumber()+1));
 	dia->prefixLineEdit->setText(doc->DocName);
 	// main "loop"
-	if (dia->exec()==QDialog::Accepted)
-	{
-		std::vector<int> pageNs;
-		ex->pageDPI = dia->DPIBox->value();
-		ex->enlargement = dia->enlargementBox->value();
-		ex->quality     = dia->qualityBox->value();
-		ex->exportDir   = QDir::fromNativeSeparators(dia->outputDirectory->text());
-		ex->bitmapType  = dia->bitmapType->currentText();
-		ex->filenamePrefix = dia->prefixLineEdit->text();
-
-		// check availability of the destination
-		QFileInfo fi(ex->exportDir);
-		if (!fi.isDir())
-		{
-			ScMessageBox::warning(doc->scMW(), tr("Save as Image"),
-			                     tr("The target location %1 must be an existing directory").arg(ex->exportDir));
-			return false;
-		}
-		if (!fi.isWritable())
-		{
-			ScMessageBox::warning(doc->scMW(), tr("Save as Image"),
-			                     tr("The target location %1 must be writable").arg(ex->exportDir));
-			return false;
-		}
-
-		QApplication::changeOverrideCursor(QCursor(Qt::WaitCursor));
-		doc->scMW()->mainWindowProgressBar->reset();
-		bool res;
-		if (dia->onePageRadio->isChecked())
-			res = ex->exportCurrent(doc, !dia->noBackground->isChecked());
+	if (dia->exec() != QDialog::Accepted)
+		return true;
+
+	std::vector<int> pageNs;
+	ex->pageDPI = dia->DPIBox->value();
+	ex->enlargement = dia->enlargementBox->value();
+	ex->quality     = dia->qualityBox->value();
+	ex->exportDir   = QDir::fromNativeSeparators(dia->outputDirectory->text());
+	ex->bitmapType  = dia->bitmapType->currentText();
+	ex->filenamePrefix = dia->prefixLineEdit->text();
+
+	// check availability of the destination
+	QFileInfo fi(ex->exportDir);
+	if (!fi.isDir())
+	{
+		ScMessageBox::warning(doc->scMW(), tr("Save as Image"),
+			                    tr("The target location %1 must be an existing directory").arg(ex->exportDir));
+		return false;
+	}
+	if (!fi.isWritable())
+	{
+		ScMessageBox::warning(doc->scMW(), tr("Save as Image"),
+			                    tr("The target location %1 must be writable").arg(ex->exportDir));
+		return false;
+	}
+
+	QApplication::changeOverrideCursor(QCursor(Qt::WaitCursor));
+	doc->scMW()->mainWindowProgressBar->reset();
+	bool res;
+	if (dia->onePageRadio->isChecked())
+		res = ex->exportCurrent(doc, !dia->noBackground->isChecked());
+	else
+	{
+		if (dia->allPagesRadio->isChecked())
+			parsePagesString("*", &pageNs, doc->DocPages.count());
 		else
-		{
-			if (dia->allPagesRadio->isChecked())
-				parsePagesString("*", &pageNs, doc->DocPages.count());
-			else
-				parsePagesString(dia->rangeVal->text(), &pageNs, doc->DocPages.count());
-			res = ex->exportInterval(doc, pageNs, !dia->noBackground->isChecked());
-		}
-		doc->scMW()->mainWindowProgressBar->reset();
-		QApplication::changeOverrideCursor(Qt::ArrowCursor);
+			parsePagesString(dia->rangeVal->text(), &pageNs, doc->DocPages.count());
+		res = ex->exportInterval(doc, pageNs, !dia->noBackground->isChecked());
+	}
+	doc->scMW()->mainWindowProgressBar->reset();
+	QApplication::changeOverrideCursor(Qt::ArrowCursor);
 //		QApplication::restoreOverrideCursor();
-		if (res)
-			doc->scMW()->setStatusBarInfoText( tr("Export successful"));
-	}
+	if (res)
+		doc->scMW()->setStatusBarInfoText( tr("Export successful"));
+
 	return true;
 }
 




More information about the scribus-commit mailing list