@@ -44,7 +44,8 @@ MainWindow::MainWindow(QWidget *parent) :
44
44
scene(this ),
45
45
loadingIcon(" :/images/loading.gif" ),
46
46
imagesFolder(QStandardPaths::writableLocation(QStandardPaths::TempLocation) +
47
- "/pcb2gcode-" + QString::number(QCoreApplication::applicationPid()))
47
+ "/pcb2gcode-" + QString::number(QCoreApplication::applicationPid())),
48
+ restarted(false )
48
49
{
49
50
checkPcb2gcodeVersion ();
50
51
@@ -153,7 +154,7 @@ MainWindow::MainWindow(QWidget *parent) :
153
154
connect (ui->vectorialCheckBox , SIGNAL (toggled (bool )), this , SLOT (bridgesAvailable ()));
154
155
connect (ui->vectorialCheckBox , SIGNAL (toggled (bool )), ui->voronoiCheckBox , SLOT (setEnabled (bool )));
155
156
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 )));
157
158
connect (ui->optimiseCheckBox , SIGNAL (toggled (bool )), this , SLOT (bridgesAvailable ()));
158
159
connect (ui->milldrillCheckBox , SIGNAL (toggled (bool )), ui->milldrilldiameterDoubleSpinBox , SLOT (setEnabled (bool )));
159
160
connect (ui->softwareComboBox , SIGNAL (currentTextChanged (QString)), this , SLOT (updateAlCustomEnableState (QString)));
@@ -245,9 +246,16 @@ void MainWindow::vectorialEnable(bool enable)
245
246
{
246
247
if (ui->voronoiCheckBox ->isChecked ())
247
248
ui->extrapassesSpinBox ->setEnabled (false );
249
+
250
+ ui->outlinewidthDoubleSpinBox ->setEnabled (false );
248
251
}
249
252
else
253
+ {
254
+ if (ui->filloutlineCheckBox ->isChecked ())
255
+ ui->outlinewidthDoubleSpinBox ->setEnabled (true );
256
+
250
257
ui->extrapassesSpinBox ->setEnabled (true );
258
+ }
251
259
}
252
260
253
261
void MainWindow::voronoiEnable (bool enable)
@@ -256,6 +264,12 @@ void MainWindow::voronoiEnable(bool enable)
256
264
ui->offsetDoubleSpinBox ->setEnabled (!enable);
257
265
}
258
266
267
+ void MainWindow::fillOutlineEnable (bool enable)
268
+ {
269
+ if (!ui->vectorialCheckBox ->isChecked ())
270
+ ui->outlinewidthDoubleSpinBox ->setEnabled (enable);
271
+ }
272
+
259
273
void MainWindow::bridgesAvailable ()
260
274
{
261
275
bool bridgesEnabled = ui->vectorialCheckBox ->isChecked () || ui->optimiseCheckBox ->isChecked ();
@@ -318,9 +332,6 @@ void MainWindow::generateImages()
318
332
QStringList arguments;
319
333
bool found_output_dir = false ;
320
334
321
- loadingIcon.start ();
322
- ui->loadingLabel ->show ();
323
-
324
335
arguments += getCmdLineArguments ();
325
336
326
337
for (QStringList::iterator i = arguments.begin (); i != arguments.end (); i++)
@@ -339,7 +350,14 @@ void MainWindow::generateImages()
339
350
arguments << " --no-export" << " --noconfigfile" ;
340
351
341
352
if (pcb2gcodeImageProcess.state () != QProcess::NotRunning)
353
+ {
354
+ restarted = true ;
342
355
pcb2gcodeImageProcess.kill ();
356
+ pcb2gcodeImageProcess.waitForFinished (1000 );
357
+ }
358
+
359
+ loadingIcon.start ();
360
+ ui->loadingLabel ->show ();
343
361
344
362
currentImagesFolder = imagesFolder;
345
363
vectorial = ui->vectorialCheckBox ->isChecked ();
@@ -389,9 +407,10 @@ void MainWindow::imagesGenerated(int exitCode, QProcess::ExitStatus exitStatus)
389
407
addImageFile (dir, tr (" Input front" ), " original_front" );
390
408
addImageFile (dir, tr (" Input back" ), " original_back" );
391
409
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" );
393
412
}
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
395
414
{
396
415
QMessageBox::critical (this , " Error" ,
397
416
tr (" Error while processing input files (error code " ) +
@@ -408,6 +427,8 @@ void MainWindow::imagesGenerated(int exitCode, QProcess::ExitStatus exitStatus)
408
427
}
409
428
else
410
429
ui->imageComboBox ->setEnabled (false );
430
+
431
+ restarted = false ;
411
432
}
412
433
413
434
void MainWindow::imageSelected (int index)
@@ -565,7 +586,11 @@ void MainWindow::startPcb2gcode()
565
586
QStringList arguments;
566
587
567
588
if (pcb2gcodeImageProcess.state () != QProcess::NotRunning)
589
+ {
590
+ restarted = true ;
568
591
pcb2gcodeImageProcess.kill ();
592
+ pcb2gcodeImageProcess.waitForFinished (1000 );
593
+ }
569
594
570
595
if ( ui->outputDirLineEdit ->text ().isEmpty () )
571
596
getOutputDirectory ();
0 commit comments