src/toolsets/extprogramtoolset.cpp

changeset 1217
314e12e23c3a
parent 1011
4fdd74a04790
child 1221
7f6715f08faf
--- a/src/toolsets/extprogramtoolset.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/toolsets/extprogramtoolset.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -45,21 +45,21 @@
 
 // =============================================================================
 //
-ConfigOption (QString IsecalcPath)
-ConfigOption (QString IntersectorPath)
-ConfigOption (QString CovererPath)
-ConfigOption (QString RectifierPath)
-ConfigOption (QString YtruderPath)
-ConfigOption (QString Edger2Path)
-ConfigOption (bool IsecalcUsesWine = false)
-ConfigOption (bool IntersectorUsesWine = false)
-ConfigOption (bool CovererUsesWine = false)
-ConfigOption (bool YtruderUsesWine = false)
-ConfigOption (bool RectifierUsesWine = false)
-ConfigOption (bool Edger2UsesWine = false)
+ConfigOption(QString IsecalcPath)
+ConfigOption(QString IntersectorPath)
+ConfigOption(QString CovererPath)
+ConfigOption(QString RectifierPath)
+ConfigOption(QString YtruderPath)
+ConfigOption(QString Edger2Path)
+ConfigOption(bool IsecalcUsesWine = false)
+ConfigOption(bool IntersectorUsesWine = false)
+ConfigOption(bool CovererUsesWine = false)
+ConfigOption(bool YtruderUsesWine = false)
+ConfigOption(bool RectifierUsesWine = false)
+ConfigOption(bool Edger2UsesWine = false)
 
-ExtProgramToolset::ExtProgramToolset (MainWindow* parent) :
-	Toolset (parent)
+ExtProgramToolset::ExtProgramToolset(MainWindow* parent) :
+	Toolset(parent)
 {
 	extProgramInfo[Isecalc].name = "Isecalc";
 	extProgramInfo[Intersector].name = "Intersector";
@@ -69,7 +69,7 @@
 	extProgramInfo[Edger2].name = "Edger2";
 }
 
-bool ExtProgramToolset::makeTempFile (QTemporaryFile& tmp, QString& fname)
+bool ExtProgramToolset::makeTempFile(QTemporaryFile& tmp, QString& fname)
 {
 	if (not tmp.open())
 		return false;
@@ -79,52 +79,52 @@
 	return true;
 }
 
-bool ExtProgramToolset::programUsesWine (ExtProgramType program)
+bool ExtProgramToolset::programUsesWine(ExtProgramType program)
 {
 #ifndef Q_OS_WIN32
-	return getWineSetting (program);
+	return getWineSetting(program);
 #else
 	return false;
 #endif
 }
 
-bool ExtProgramToolset::getWineSetting (ExtProgramType program)
+bool ExtProgramToolset::getWineSetting(ExtProgramType program)
 {
-	return m_window->getConfigValue (externalProgramName (program) + "UsesWine").toBool();
+	return m_window->getConfigValue(externalProgramName(program) + "UsesWine").toBool();
 }
 
-QString ExtProgramToolset::getPathSetting (ExtProgramType program)
+QString ExtProgramToolset::getPathSetting(ExtProgramType program)
 {
-	return m_window->getConfigValue (externalProgramName (program) + "Path").toString();
+	return m_window->getConfigValue(externalProgramName(program) + "Path").toString();
 }
 
-void ExtProgramToolset::setPathSetting (ExtProgramType program, QString value)
+void ExtProgramToolset::setPathSetting(ExtProgramType program, QString value)
 {
-	m_window->getSettings()->setValue (externalProgramName (program) + "Path", QVariant::fromValue (value));
+	m_window->getSettings()->setValue(externalProgramName(program) + "Path", QVariant::fromValue(value));
 }
 
-void ExtProgramToolset::setWineSetting (ExtProgramType program, bool value)
+void ExtProgramToolset::setWineSetting(ExtProgramType program, bool value)
 {
-	m_window->getSettings()->setValue (externalProgramName (program) + "UsesWine", QVariant::fromValue (value));
+	m_window->getSettings()->setValue(externalProgramName(program) + "UsesWine", QVariant::fromValue(value));
 }
 
-QString ExtProgramToolset::externalProgramName (ExtProgramType program)
+QString ExtProgramToolset::externalProgramName(ExtProgramType program)
 {
 	return extProgramInfo[program].name;
 }
 
-bool ExtProgramToolset::checkExtProgramPath (ExtProgramType program)
+bool ExtProgramToolset::checkExtProgramPath(ExtProgramType program)
 {
-	QString path = getPathSetting (program);
+	QString path = getPathSetting(program);
 
 	if (not path.isEmpty())
 		return true;
 
-	ExtProgPathPrompt* dialog = new ExtProgPathPrompt (externalProgramName (program));
+	ExtProgPathPrompt* dialog = new ExtProgPathPrompt(externalProgramName(program));
 
 	if (dialog->exec() and not dialog->getPath().isEmpty())
 	{
-		setPathSetting (program, dialog->getPath());
+		setPathSetting(program, dialog->getPath());
 		return true;
 	}
 
@@ -133,28 +133,28 @@
 
 // =============================================================================
 //
-QString ExtProgramToolset::errorCodeString (ExtProgramType program, QProcess& process)
+QString ExtProgramToolset::errorCodeString(ExtProgramType program, QProcess& process)
 {
-	switch (process.error())
+	switch(process.error())
 	{
 	case QProcess::FailedToStart:
-		if (programUsesWine (program))
-			return tr ("Program failed to start, make sure that Wine is installed and check your permissions.");
+		if (programUsesWine(program))
+			return tr("Program failed to start, make sure that Wine is installed and check your permissions.");
 
-		return tr ("Program failed to start, %1check your permissions");
+		return tr("Program failed to start, %1check your permissions");
 
 	case QProcess::Crashed:
-		return tr ("Crashed.");
+		return tr("Crashed.");
 
 	case QProcess::WriteError:
 	case QProcess::ReadError:
-		return tr ("I/O error.");
+		return tr("I/O error.");
 
 	case QProcess::UnknownError:
-		return tr ("Unknown error");
+		return tr("Unknown error");
 
 	case QProcess::Timedout:
-		return tr ("Timed out (30 seconds)");
+		return tr("Timed out(30 seconds)");
 	}
 
 	return "";
@@ -162,64 +162,64 @@
 
 // =============================================================================
 //
-void ExtProgramToolset::writeObjects (const LDObjectList& objects, QFile& f)
+void ExtProgramToolset::writeObjects(const LDObjectList& objects, QFile& f)
 {
 	for (LDObject* obj : objects)
 	{
 		if (obj->type() == OBJ_SubfileReference)
 		{
-			LDSubfileReference* ref = static_cast<LDSubfileReference*> (obj);
-			LDObjectList objs = ref->inlineContents (true, false);
-			writeObjects (objs, f);
+			LDSubfileReference* ref = static_cast<LDSubfileReference*>(obj);
+			LDObjectList objs = ref->inlineContents(true, false);
+			writeObjects(objs, f);
 
 			for (LDObject* obj : objs)
 				obj->destroy();
 		}
 		else if (obj->type() == OBJ_BezierCurve)
 		{
-			LDBezierCurve* curve = static_cast<LDBezierCurve*> (obj);
+			LDBezierCurve* curve = static_cast<LDBezierCurve*>(obj);
 			LDObjectList objs = curve->rasterize();
-			writeObjects (objs, f);
+			writeObjects(objs, f);
 
 			for (LDObject* obj : objs)
 				obj->destroy();
 		}
 		else
-			f.write ((obj->asText() + "\r\n").toUtf8());
+			f.write((obj->asText() + "\r\n").toUtf8());
 	}
 }
 
 // =============================================================================
 //
-void ExtProgramToolset::writeObjects (const LDObjectList& objects, QString fname)
+void ExtProgramToolset::writeObjects(const LDObjectList& objects, QString fname)
 {
 	// Write the input file
-	QFile f (fname);
+	QFile f(fname);
 
-	if (not f.open (QIODevice::WriteOnly | QIODevice::Text))
+	if (not f.open(QIODevice::WriteOnly | QIODevice::Text))
 	{
-		Critical (format ("Couldn't open temporary file %1 for writing: %2\n", fname, f.errorString()));
+		Critical(format("Couldn't open temporary file %1 for writing: %2\n", fname, f.errorString()));
 		return;
 	}
 
-	writeObjects (objects, f);
+	writeObjects(objects, f);
 	f.close();
 
 #ifdef DEBUG
-	QFile::copy (fname, "debug_lastInput");
+	QFile::copy(fname, "debug_lastInput");
 #endif
 }
 
 // =============================================================================
 //
-void ExtProgramToolset::writeSelection (QString fname)
+void ExtProgramToolset::writeSelection(QString fname)
 {
-	writeObjects (selectedObjects(), fname);
+	writeObjects(selectedObjects(), fname);
 }
 
 // =============================================================================
 //
-void ExtProgramToolset::writeColorGroup (LDColor color, QString fname)
+void ExtProgramToolset::writeColorGroup(LDColor color, QString fname)
 {
 	LDObjectList objects;
 
@@ -231,26 +231,26 @@
 		objects << obj;
 	}
 
-	writeObjects (objects, fname);
+	writeObjects(objects, fname);
 }
 
 // =============================================================================
 //
-bool ExtProgramToolset::runExtProgram (ExtProgramType program, QString argvstr)
+bool ExtProgramToolset::runExtProgram(ExtProgramType program, QString argvstr)
 {
-	QString path = getPathSetting (program);
+	QString path = getPathSetting(program);
 	QTemporaryFile input;
-	QStringList argv = argvstr.split (" ", QString::SkipEmptyParts);
+	QStringList argv = argvstr.split(" ", QString::SkipEmptyParts);
 
 #ifndef Q_OS_WIN32
-	if (programUsesWine (program))
+	if (programUsesWine(program))
 	{
-		argv.insert (0, path);
+		argv.insert(0, path);
 		path = "wine";
 	}
 #endif // Q_OS_WIN32
 
-	print ("Running command: %1 %2\n", path, argv.join (" "));
+	print("Running command: %1 %2\n", path, argv.join(" "));
 
 	if (not input.open())
 		return false;
@@ -258,18 +258,18 @@
 	QProcess process;
 
 	// Begin!
-	process.setStandardInputFile (input.fileName());
-	process.start (path, argv);
+	process.setStandardInputFile(input.fileName());
+	process.start(path, argv);
 
 	if (not process.waitForStarted())
 	{
-		Critical (format ("Couldn't start %1: %2\n", externalProgramName (program),
-			errorCodeString (program, process)));
+		Critical(format("Couldn't start %1: %2\n", externalProgramName(program),
+			errorCodeString(program, process)));
 		return false;
 	}
 
 	// Write an enter, the utility tools all expect one
-	input.write ("\n");
+	input.write("\n");
 
 	// Wait while it runs
 	process.waitForFinished();
@@ -277,28 +277,28 @@
 	QString err = "";
 
 	if (process.exitStatus() != QProcess::NormalExit)
-		err = errorCodeString (program, process);
+		err = errorCodeString(program, process);
 
 	// Check the return code
 	if (process.exitCode() != 0)
-		err = format ("Program exited abnormally (return code %1).",  process.exitCode());
+		err = format("Program exited abnormally(return code %1).",  process.exitCode());
 
 	if (not err.isEmpty())
 	{
-		Critical (format ("%1 failed: %2\n", externalProgramName (program), err));
-		QString filename ("externalProgramOutput.txt");
-		QFile file (filename);
+		Critical(format("%1 failed: %2\n", externalProgramName(program), err));
+		QString filename("externalProgramOutput.txt");
+		QFile file(filename);
 
-		if (file.open (QIODevice::WriteOnly | QIODevice::Text))
+		if (file.open(QIODevice::WriteOnly | QIODevice::Text))
 		{
-			file.write (process.readAllStandardOutput());
-			file.write (process.readAllStandardError());
-			print ("Wrote output and error logs to %1", QFileInfo (file).absoluteFilePath());
+			file.write(process.readAllStandardOutput());
+			file.write(process.readAllStandardError());
+			print("Wrote output and error logs to %1", QFileInfo(file).absoluteFilePath());
 		}
 		else
 		{
-			print ("Couldn't open %1 for writing: %2",
-				QFileInfo (filename).absoluteFilePath(), file.errorString());
+			print("Couldn't open %1 for writing: %2",
+				QFileInfo(filename).absoluteFilePath(), file.errorString());
 		}
 
 		return false;
@@ -309,31 +309,31 @@
 
 // =============================================================================
 //
-void ExtProgramToolset::insertOutput (QString fname, bool replace, QList<LDColor> colorsToReplace)
+void ExtProgramToolset::insertOutput(QString fname, bool replace, QList<LDColor> colorsToReplace)
 {
 #ifdef DEBUG
-	QFile::copy (fname, "./debug_lastOutput");
+	QFile::copy(fname, "./debug_lastOutput");
 #endif
 
 	// Read the output file
-	QFile f (fname);
+	QFile f(fname);
 
-	if (not f.open (QIODevice::ReadOnly))
+	if (not f.open(QIODevice::ReadOnly))
 	{
-		Critical (format ("Couldn't open temporary file %1 for reading.\n", fname));
+		Critical(format("Couldn't open temporary file %1 for reading.\n", fname));
 		return;
 	}
 
 	// TODO: I don't like how I need to go to the document manager to load objects from a file...
 	// We're not loading this as a document so it shouldn't be necessary.
-	LDObjectList objs = m_documents->loadFileContents (&f, nullptr, nullptr);
+	LDObjectList objs = m_documents->loadFileContents(&f, nullptr, nullptr);
 
 	// If we replace the objects, delete the selection now.
 	if (replace)
 		m_window->deleteSelection();
 
 	for (LDColor color : colorsToReplace)
-		m_window->deleteByColor (color);
+		m_window->deleteByColor(color);
 
 	// Insert the new objects
 	currentDocument()->clearSelection();
@@ -346,7 +346,7 @@
 			continue;
 		}
 
-		currentDocument()->addObject (obj);
+		currentDocument()->addObject(obj);
 		obj->select();
 	}
 
@@ -358,14 +358,14 @@
 // =============================================================================
 void ExtProgramToolset::ytruder()
 {
-	setlocale (LC_ALL, "C");
+	setlocale(LC_ALL, "C");
 
-	if (not checkExtProgramPath (Ytruder))
+	if (not checkExtProgramPath(Ytruder))
 		return;
 
 	QDialog* dlg = new QDialog;
 	Ui::YtruderUI ui;
-	ui.setupUi (dlg);
+	ui.setupUi(dlg);
 
 	if (not dlg->exec())
 		return;
@@ -387,14 +387,14 @@
 	QString inDATName, outDATName;
 
 	// Make temp files for the input and output files
-	if (not makeTempFile (indat, inDATName) or not makeTempFile (outdat, outDATName))
+	if (not makeTempFile(indat, inDATName) or not makeTempFile(outdat, outDATName))
 		return;
 
 	// Compose the command-line arguments
-	QString argv = Join (
+	QString argv = Join(
 	{
-		(axis == X) ? "-x" : (axis == Y) ? "-y" : "-z",
-		(mode == Distance) ? "-d" : (mode == Symmetry) ? "-s" : (mode == Projection) ? "-p" : "-r",
+		(axis == X) ? "-x" :(axis == Y) ? "-y" : "-z",
+		(mode == Distance) ? "-d" :(mode == Symmetry) ? "-s" :(mode == Projection) ? "-p" : "-r",
 		depth,
 		"-a",
 		condAngle,
@@ -402,12 +402,12 @@
 		outDATName
 	});
 
-	writeSelection (inDATName);
+	writeSelection(inDATName);
 
-	if (not runExtProgram (Ytruder, argv))
+	if (not runExtProgram(Ytruder, argv))
 		return;
 
-	insertOutput (outDATName, false, {});
+	insertOutput(outDATName, false, {});
 }
 
 // =============================================================================
@@ -415,14 +415,14 @@
 // =============================================================================
 void ExtProgramToolset::rectifier()
 {
-	setlocale (LC_ALL, "C");
+	setlocale(LC_ALL, "C");
 
-	if (not checkExtProgramPath (Rectifier))
+	if (not checkExtProgramPath(Rectifier))
 		return;
 
 	QDialog* dlg = new QDialog;
 	Ui::RectifierUI ui;
-	ui.setupUi (dlg);
+	ui.setupUi(dlg);
 
 	if (not dlg->exec())
 		return;
@@ -431,11 +431,11 @@
 	QString inDATName, outDATName;
 
 	// Make temp files for the input and output files
-	if (not makeTempFile (indat, inDATName) or not makeTempFile (outdat, outDATName))
+	if (not makeTempFile(indat, inDATName) or not makeTempFile(outdat, outDATName))
 		return;
 
 	// Compose arguments
-	QString argv = Join (
+	QString argv = Join(
 	{
 		(not ui.cb_condense->isChecked()) ? "-q" : "",
 		(not ui.cb_subst->isChecked()) ? "-r" : "",
@@ -447,12 +447,12 @@
 		outDATName
 	});
 
-	writeSelection (inDATName);
+	writeSelection(inDATName);
 
-	if (not runExtProgram (Rectifier, argv))
+	if (not runExtProgram(Rectifier, argv))
 		return;
 
-	insertOutput (outDATName, true, {});
+	insertOutput(outDATName, true, {});
 }
 
 // =============================================================================
@@ -460,19 +460,19 @@
 // =============================================================================
 void ExtProgramToolset::intersector()
 {
-	setlocale (LC_ALL, "C");
+	setlocale(LC_ALL, "C");
 
-	if (not checkExtProgramPath (Intersector))
+	if (not checkExtProgramPath(Intersector))
 		return;
 
 	QDialog* dlg = new QDialog;
 	Ui::IntersectorUI ui;
-	ui.setupUi (dlg);
-	guiUtilities()->fillUsedColorsToComboBox (ui.cmb_incol);
-	guiUtilities()->fillUsedColorsToComboBox (ui.cmb_cutcol);
-	ui.cb_repeat->setWhatsThis ("If this is set, " APPNAME " runs Intersector a second time with inverse files to cut "
+	ui.setupUi(dlg);
+	guiUtilities()->fillUsedColorsToComboBox(ui.cmb_incol);
+	guiUtilities()->fillUsedColorsToComboBox(ui.cmb_cutcol);
+	ui.cb_repeat->setWhatsThis("If this is set, " APPNAME " runs Intersector a second time with inverse files to cut "
 								" the cutter group with the input group. Both groups are cut by the intersection.");
-	ui.cb_edges->setWhatsThis ("Makes " APPNAME " try run Isecalc to create edgelines for the intersection.");
+	ui.cb_edges->setWhatsThis("Makes " APPNAME " try run Isecalc to create edgelines for the intersection.");
 
 	LDColor inCol, cutCol;
 	const bool repeatInverse = ui.cb_repeat->isChecked();
@@ -482,12 +482,12 @@
 		if (not dlg->exec())
 			return;
 
-		inCol = ui.cmb_incol->itemData (ui.cmb_incol->currentIndex()).toInt();
-		cutCol = ui.cmb_cutcol->itemData (ui.cmb_cutcol->currentIndex()).toInt();
+		inCol = ui.cmb_incol->itemData(ui.cmb_incol->currentIndex()).toInt();
+		cutCol = ui.cmb_cutcol->itemData(ui.cmb_cutcol->currentIndex()).toInt();
 
 		if (inCol == cutCol)
 		{
-			Critical ("Cannot use the same color group for both input and cutter!");
+			Critical("Cannot use the same color group for both input and cutter!");
 			continue;
 		}
 
@@ -499,20 +499,20 @@
 	// cutdat = cutter group file
 	// outdat = primary output
 	// outdat2 = inverse output
-	// edgesdat = edges output (isecalc)
+	// edgesdat = edges output(isecalc)
 	QTemporaryFile indat, cutdat, outdat, outdat2, edgesdat;
 	QString inDATName, cutDATName, outDATName, outDAT2Name, edgesDATName;
 
-	if (not makeTempFile (indat, inDATName) or
-		not makeTempFile (cutdat, cutDATName) or
-		not makeTempFile (outdat, outDATName) or
-		not makeTempFile (outdat2, outDAT2Name) or
-		not makeTempFile (edgesdat, edgesDATName))
+	if (not makeTempFile(indat, inDATName) or
+		not makeTempFile(cutdat, cutDATName) or
+		not makeTempFile(outdat, outDATName) or
+		not makeTempFile(outdat2, outDAT2Name) or
+		not makeTempFile(edgesdat, edgesDATName))
 	{
 		return;
 	}
 
-	QString parms = Join (
+	QString parms = Join(
 	{
 		(ui.cb_colorize->isChecked()) ? "-c" : "",
 		(ui.cb_nocondense->isChecked()) ? "-t" : "",
@@ -520,7 +520,7 @@
 		ui.dsb_prescale->value()
 	});
 
-	QString argv_normal = Join (
+	QString argv_normal = Join(
 	{
 		parms,
 		inDATName,
@@ -528,7 +528,7 @@
 		outDATName
 	});
 
-	QString argv_inverse = Join (
+	QString argv_inverse = Join(
 	{
 		parms,
 		cutDATName,
@@ -536,22 +536,22 @@
 		outDAT2Name
 	});
 
-	writeColorGroup (inCol, inDATName);
-	writeColorGroup (cutCol, cutDATName);
+	writeColorGroup(inCol, inDATName);
+	writeColorGroup(cutCol, cutDATName);
 
-	if (not runExtProgram (Intersector, argv_normal))
+	if (not runExtProgram(Intersector, argv_normal))
 		return;
 
-	insertOutput (outDATName, false, {inCol});
+	insertOutput(outDATName, false, {inCol});
 
-	if (repeatInverse and runExtProgram (Intersector, argv_inverse))
-		insertOutput (outDAT2Name, false, {cutCol});
+	if (repeatInverse and runExtProgram(Intersector, argv_inverse))
+		insertOutput(outDAT2Name, false, {cutCol});
 
 	if (ui.cb_edges->isChecked()
-		and checkExtProgramPath (Isecalc)
-		and runExtProgram (Isecalc, Join ({inDATName, cutDATName, edgesDATName})))
+		and checkExtProgramPath(Isecalc)
+		and runExtProgram(Isecalc, Join({inDATName, cutDATName, edgesDATName})))
 	{
-		insertOutput (edgesDATName, false, {});
+		insertOutput(edgesDATName, false, {});
 	}
 }
 
@@ -559,16 +559,16 @@
 //
 void ExtProgramToolset::coverer()
 {
-	setlocale (LC_ALL, "C");
+	setlocale(LC_ALL, "C");
 
-	if (not checkExtProgramPath (Coverer))
+	if (not checkExtProgramPath(Coverer))
 		return;
 
 	QDialog* dlg = new QDialog;
 	Ui::CovererUI ui;
-	ui.setupUi (dlg);
-	guiUtilities()->fillUsedColorsToComboBox (ui.cmb_col1);
-	guiUtilities()->fillUsedColorsToComboBox (ui.cmb_col2);
+	ui.setupUi(dlg);
+	guiUtilities()->fillUsedColorsToComboBox(ui.cmb_col1);
+	guiUtilities()->fillUsedColorsToComboBox(ui.cmb_col2);
 
 	LDColor in1Col, in2Col;
 
@@ -577,12 +577,12 @@
 		if (not dlg->exec())
 			return;
 
-		in1Col = ui.cmb_col1->itemData (ui.cmb_col1->currentIndex()).toInt();
-		in2Col = ui.cmb_col2->itemData (ui.cmb_col2->currentIndex()).toInt();
+		in1Col = ui.cmb_col1->itemData(ui.cmb_col1->currentIndex()).toInt();
+		in2Col = ui.cmb_col2->itemData(ui.cmb_col2->currentIndex()).toInt();
 
 		if (in1Col == in2Col)
 		{
-			Critical ("Cannot use the same color group for both inputs!");
+			Critical("Cannot use the same color group for both inputs!");
 			continue;
 		}
 
@@ -592,48 +592,48 @@
 	QTemporaryFile in1dat, in2dat, outdat;
 	QString in1DATName, in2DATName, outDATName;
 
-	if (not makeTempFile (in1dat, in1DATName) or
-		not makeTempFile (in2dat, in2DATName) or
-		not makeTempFile (outdat, outDATName))
+	if (not makeTempFile(in1dat, in1DATName) or
+		not makeTempFile(in2dat, in2DATName) or
+		not makeTempFile(outdat, outDATName))
 	{
 		return;
 	}
 
-	QString argv = Join (
+	QString argv = Join(
 	{
 		(ui.cb_oldsweep->isChecked() ? "-s" : ""),
 		(ui.cb_reverse->isChecked() ? "-r" : ""),
-		(ui.dsb_segsplit->value() != 0 ? format ("-l %1", ui.dsb_segsplit->value()) : ""),
-		(ui.sb_bias->value() != 0 ? format ("-s %1", ui.sb_bias->value()) : ""),
+		(ui.dsb_segsplit->value() != 0 ? format("-l %1", ui.dsb_segsplit->value()) : ""),
+		(ui.sb_bias->value() != 0 ? format("-s %1", ui.sb_bias->value()) : ""),
 		in1DATName,
 		in2DATName,
 		outDATName
 	});
 
-	writeColorGroup (in1Col, in1DATName);
-	writeColorGroup (in2Col, in2DATName);
+	writeColorGroup(in1Col, in1DATName);
+	writeColorGroup(in2Col, in2DATName);
 
-	if (not runExtProgram (Coverer, argv))
+	if (not runExtProgram(Coverer, argv))
 		return;
 
-	insertOutput (outDATName, false, {});
+	insertOutput(outDATName, false, {});
 }
 
 // =============================================================================
 //
 void ExtProgramToolset::isecalc()
 {
-	setlocale (LC_ALL, "C");
+	setlocale(LC_ALL, "C");
 
-	if (not checkExtProgramPath (Isecalc))
+	if (not checkExtProgramPath(Isecalc))
 		return;
 
 	Ui::IsecalcUI ui;
 	QDialog* dlg = new QDialog;
-	ui.setupUi (dlg);
+	ui.setupUi(dlg);
 
-	guiUtilities()->fillUsedColorsToComboBox (ui.cmb_col1);
-	guiUtilities()->fillUsedColorsToComboBox (ui.cmb_col2);
+	guiUtilities()->fillUsedColorsToComboBox(ui.cmb_col1);
+	guiUtilities()->fillUsedColorsToComboBox(ui.cmb_col2);
 
 	LDColor in1Col, in2Col;
 
@@ -643,12 +643,12 @@
 		if (not dlg->exec())
 			return;
 
-		in1Col = ui.cmb_col1->itemData (ui.cmb_col1->currentIndex()).toInt();
-		in2Col = ui.cmb_col2->itemData (ui.cmb_col2->currentIndex()).toInt();
+		in1Col = ui.cmb_col1->itemData(ui.cmb_col1->currentIndex()).toInt();
+		in2Col = ui.cmb_col2->itemData(ui.cmb_col2->currentIndex()).toInt();
 
 		if (in1Col == in2Col)
 		{
-			Critical ("Cannot use the same color group for both input and cutter!");
+			Critical("Cannot use the same color group for both input and cutter!");
 			continue;
 		}
 
@@ -658,38 +658,38 @@
 	QTemporaryFile in1dat, in2dat, outdat;
 	QString in1DATName, in2DATName, outDATName;
 
-	if (not makeTempFile (in1dat, in1DATName) or
-		not makeTempFile (in2dat, in2DATName) or
-		not makeTempFile (outdat, outDATName))
+	if (not makeTempFile(in1dat, in1DATName) or
+		not makeTempFile(in2dat, in2DATName) or
+		not makeTempFile(outdat, outDATName))
 	{
 		return;
 	}
 
-	QString argv = Join (
+	QString argv = Join(
 	{
 		in1DATName,
 		in2DATName,
 		outDATName
 	});
 
-	writeColorGroup (in1Col, in1DATName);
-	writeColorGroup (in2Col, in2DATName);
-	runExtProgram (Isecalc, argv);
-	insertOutput (outDATName, false, {});
+	writeColorGroup(in1Col, in1DATName);
+	writeColorGroup(in2Col, in2DATName);
+	runExtProgram(Isecalc, argv);
+	insertOutput(outDATName, false, {});
 }
 
 // =============================================================================
 //
 void ExtProgramToolset::edger2()
 {
-	setlocale (LC_ALL, "C");
+	setlocale(LC_ALL, "C");
 
-	if (not checkExtProgramPath (Edger2))
+	if (not checkExtProgramPath(Edger2))
 		return;
 
 	QDialog* dlg = new QDialog;
 	Ui::Edger2Dialog ui;
-	ui.setupUi (dlg);
+	ui.setupUi(dlg);
 
 	if (not dlg->exec())
 		return;
@@ -697,32 +697,32 @@
 	QTemporaryFile in, out;
 	QString inName, outName;
 
-	if (not makeTempFile (in, inName) or not makeTempFile (out, outName))
+	if (not makeTempFile(in, inName) or not makeTempFile(out, outName))
 		return;
 
 	int unmatched = ui.unmatched->currentIndex();
 
-	QString argv = Join (
+	QString argv = Join(
 	{
-		format ("-p %1", ui.precision->value()),
-		format ("-af %1", ui.flatAngle->value()),
-		format ("-ac %1", ui.condAngle->value()),
-		format ("-ae %1", ui.edgeAngle->value()),
+		format("-p %1", ui.precision->value()),
+		format("-af %1", ui.flatAngle->value()),
+		format("-ac %1", ui.condAngle->value()),
+		format("-ae %1", ui.edgeAngle->value()),
 		ui.delLines->isChecked()     ? "-de" : "",
 		ui.delCondLines->isChecked() ? "-dc" : "",
 		ui.colored->isChecked()      ? "-c" : "",
 		ui.bfc->isChecked()          ? "-b" : "",
 		ui.convex->isChecked()       ? "-cx" : "",
 		ui.concave->isChecked()      ? "-cv" : "",
-		unmatched == 0 ? "-u+" : (unmatched == 2 ? "-u-" : ""),
+		unmatched == 0 ? "-u+" :(unmatched == 2 ? "-u-" : ""),
 		inName,
 		outName,
 	});
 
-	writeSelection (inName);
+	writeSelection(inName);
 
-	if (not runExtProgram (Edger2, argv))
+	if (not runExtProgram(Edger2, argv))
 		return;
 
-	insertOutput (outName, true, {});
+	insertOutput(outName, true, {});
 }

mercurial