@@ -44,7 +44,8 @@ MainWindow::MainWindow(QWidget *parent) :
4444 scene(this ),
4545 loadingIcon(" :/images/loading.gif" ),
4646 imagesFolder(QStandardPaths::writableLocation(QStandardPaths::TempLocation) +
47- "/pcb2gcode-" + QString::number(QCoreApplication::applicationPid()))
47+ "/pcb2gcode-" + QString::number(QCoreApplication::applicationPid())),
48+ restarted(false )
4849{
4950 checkPcb2gcodeVersion ();
5051
@@ -153,7 +154,7 @@ MainWindow::MainWindow(QWidget *parent) :
153154 connect (ui->vectorialCheckBox , SIGNAL (toggled (bool )), this , SLOT (bridgesAvailable ()));
154155 connect (ui->vectorialCheckBox , SIGNAL (toggled (bool )), ui->voronoiCheckBox , SLOT (setEnabled (bool )));
155156 connect (ui->voronoiCheckBox , SIGNAL (toggled (bool )), this , SLOT (voronoiEnable (bool )));
156- connect (ui->filloutlineCheckBox , SIGNAL (toggled (bool )), ui-> outlinewidthDoubleSpinBox , SLOT (setEnabled (bool )));
157+ connect (ui->filloutlineCheckBox , SIGNAL (toggled (bool )), this , SLOT (fillOutlineEnable (bool )));
157158 connect (ui->optimiseCheckBox , SIGNAL (toggled (bool )), this , SLOT (bridgesAvailable ()));
158159 connect (ui->milldrillCheckBox , SIGNAL (toggled (bool )), ui->milldrilldiameterDoubleSpinBox , SLOT (setEnabled (bool )));
159160 connect (ui->softwareComboBox , SIGNAL (currentTextChanged (QString)), this , SLOT (updateAlCustomEnableState (QString)));
@@ -245,9 +246,16 @@ void MainWindow::vectorialEnable(bool enable)
245246 {
246247 if (ui->voronoiCheckBox ->isChecked ())
247248 ui->extrapassesSpinBox ->setEnabled (false );
249+
250+ ui->outlinewidthDoubleSpinBox ->setEnabled (false );
248251 }
249252 else
253+ {
254+ if (ui->filloutlineCheckBox ->isChecked ())
255+ ui->outlinewidthDoubleSpinBox ->setEnabled (true );
256+
250257 ui->extrapassesSpinBox ->setEnabled (true );
258+ }
251259}
252260
253261void MainWindow::voronoiEnable (bool enable)
@@ -256,6 +264,12 @@ void MainWindow::voronoiEnable(bool enable)
256264 ui->offsetDoubleSpinBox ->setEnabled (!enable);
257265}
258266
267+ void MainWindow::fillOutlineEnable (bool enable)
268+ {
269+ if (!ui->vectorialCheckBox ->isChecked ())
270+ ui->outlinewidthDoubleSpinBox ->setEnabled (enable);
271+ }
272+
259273void MainWindow::bridgesAvailable ()
260274{
261275 bool bridgesEnabled = ui->vectorialCheckBox ->isChecked () || ui->optimiseCheckBox ->isChecked ();
@@ -318,9 +332,6 @@ void MainWindow::generateImages()
318332 QStringList arguments;
319333 bool found_output_dir = false ;
320334
321- loadingIcon.start ();
322- ui->loadingLabel ->show ();
323-
324335 arguments += getCmdLineArguments ();
325336
326337 for (QStringList::iterator i = arguments.begin (); i != arguments.end (); i++)
@@ -339,7 +350,14 @@ void MainWindow::generateImages()
339350 arguments << " --no-export" << " --noconfigfile" ;
340351
341352 if (pcb2gcodeImageProcess.state () != QProcess::NotRunning)
353+ {
354+ restarted = true ;
342355 pcb2gcodeImageProcess.kill ();
356+ pcb2gcodeImageProcess.waitForFinished (1000 );
357+ }
358+
359+ loadingIcon.start ();
360+ ui->loadingLabel ->show ();
343361
344362 currentImagesFolder = imagesFolder;
345363 vectorial = ui->vectorialCheckBox ->isChecked ();
@@ -389,9 +407,10 @@ void MainWindow::imagesGenerated(int exitCode, QProcess::ExitStatus exitStatus)
389407 addImageFile (dir, tr (" Input front" ), " original_front" );
390408 addImageFile (dir, tr (" Input back" ), " original_back" );
391409 addImageFile (dir, tr (" Input drill" ), " original_drill" );
392- addImageFile (dir, tr (" Input outline" ), fillOutline ? " outline_filled" : " original_outline" );
410+ addImageFile (dir, tr (" Input outline" ), (fillOutline && !vectorial) ? " outline_filled" : " original_outline" );
411+ addImageFile (dir, tr (" Input outline" ), " original_outline" );
393412 }
394- else if (sender () != static_cast <QObject *>(&pcb2gcodeProcess)) // Errors from pcb2gcodeProcess are printed in outputWindow
413+ else if (sender () != static_cast <QObject *>(&pcb2gcodeProcess) && !restarted ) // Errors from pcb2gcodeProcess are printed in outputWindow
395414 {
396415 QMessageBox::critical (this , " Error" ,
397416 tr (" Error while processing input files (error code " ) +
@@ -408,6 +427,8 @@ void MainWindow::imagesGenerated(int exitCode, QProcess::ExitStatus exitStatus)
408427 }
409428 else
410429 ui->imageComboBox ->setEnabled (false );
430+
431+ restarted = false ;
411432}
412433
413434void MainWindow::imageSelected (int index)
@@ -565,7 +586,11 @@ void MainWindow::startPcb2gcode()
565586 QStringList arguments;
566587
567588 if (pcb2gcodeImageProcess.state () != QProcess::NotRunning)
589+ {
590+ restarted = true ;
568591 pcb2gcodeImageProcess.kill ();
592+ pcb2gcodeImageProcess.waitForFinished (1000 );
593+ }
569594
570595 if ( ui->outputDirLineEdit ->text ().isEmpty () )
571596 getOutputDirectory ();
0 commit comments