@@ -77,12 +77,11 @@ MainWindow::MainWindow(QWidget *parent) :
77
77
args[ COMMONARGS ].insert (" zsafe" , ui->zsafeDoubleSpinBox );
78
78
args[ COMMONARGS ].insert (" zchange" , ui->zchangeDoubleSpinBox );
79
79
args[ COMMONARGS ].insert (" zchange-absolute" , ui->zchangeAbsoluteCheckBox );
80
- args[ COMMONARGS ].insert (" vectorial" , ui->vectorialCheckBox );
81
80
args[ COMMONARGS ].insert (" nog64" , ui->nog64CheckBox );
82
81
args[ COMMONARGS ].insert (" tolerance" , ui->toleranceDoubleSpinBox );
83
- args[ COMMONARGS ].insert (" optimise" , ui->optimiseCheckBox );
82
+ args[ COMMONARGS ].insert (" optimise" , ui->optimiseDoubleSpinBox );
84
83
args[ COMMONARGS ].insert (" zero-start" , ui->zerostartCheckBox );
85
- args[ COMMONARGS ].insert (" dpi " , ui->dpiSpinBox );
84
+ args[ COMMONARGS ].insert (" mirror-axis " , ui->mirroraxisDoubleSpinBox );
86
85
args[ COMMONARGS ].insert (" tile-x" , ui->tilexSpinBox );
87
86
args[ COMMONARGS ].insert (" tile-y" , ui->tileySpinBox );
88
87
@@ -108,7 +107,7 @@ MainWindow::MainWindow(QWidget *parent) :
108
107
args[ OUTLINEARGS ].insert (" cut-feed" , ui->cutfeedSpinBox );
109
108
args[ OUTLINEARGS ].insert (" cut-speed" , ui->cutspeedSpinBox );
110
109
args[ OUTLINEARGS ].insert (" cut-infeed" , ui->cutinfeedDoubleSpinBox );
111
- args[ OUTLINEARGS ].insert (" outline-width " , ui->outlinewidthDoubleSpinBox );
110
+ args[ OUTLINEARGS ].insert (" cut-vertfeed " , ui->cutvertfeedSpinBox );
112
111
args[ OUTLINEARGS ].insert (" bridges" , ui->bridgesDoubleSpinBox );
113
112
args[ OUTLINEARGS ].insert (" zbridges" , ui->zbridgesDoubleSpinBox );
114
113
args[ OUTLINEARGS ].insert (" bridgesnum" , ui->bridgesnumSpinBox );
@@ -148,12 +147,7 @@ MainWindow::MainWindow(QWidget *parent) :
148
147
connect (ui->postamblePushButton , SIGNAL (clicked ()), this , SLOT (getPostambleFile ()));
149
148
connect (ui->outputDirPushButton , SIGNAL (clicked ()), this , SLOT (getOutputDirectory ()));
150
149
151
- connect (ui->vectorialCheckBox , SIGNAL (toggled (bool )), this , SLOT (vectorialEnable (bool )));
152
- connect (ui->vectorialCheckBox , SIGNAL (toggled (bool )), this , SLOT (bridgesAvailable ()));
153
- connect (ui->vectorialCheckBox , SIGNAL (toggled (bool )), ui->voronoiCheckBox , SLOT (setEnabled (bool )));
154
150
connect (ui->voronoiCheckBox , SIGNAL (toggled (bool )), this , SLOT (voronoiEnable (bool )));
155
- connect (ui->filloutlineCheckBox , SIGNAL (toggled (bool )), this , SLOT (fillOutlineEnable (bool )));
156
- connect (ui->optimiseCheckBox , SIGNAL (toggled (bool )), this , SLOT (bridgesAvailable ()));
157
151
connect (ui->milldrillCheckBox , SIGNAL (toggled (bool )), ui->milldrilldiameterDoubleSpinBox , SLOT (setEnabled (bool )));
158
152
connect (ui->softwareComboBox , SIGNAL (currentTextChanged (QString)), this , SLOT (updateAlCustomEnableState (QString)));
159
153
@@ -183,8 +177,17 @@ MainWindow::MainWindow(QWidget *parent) :
183
177
settings = new QSettings (QSettings::IniFormat, QSettings::UserScope, " pcb2gcodeGUI" , " " , this );
184
178
185
179
ui->actionAutomatically_generate_previews ->setChecked (settings->value (" autoPreview" , true ).toBool ());
186
- lastDir = settings->value (" lastDir" , QStandardPaths::writableLocation (QStandardPaths::HomeLocation)).toString ();
187
- if (lastDir.isEmpty ())
180
+ lastGcodeDir = settings->value (" lastGcodeDir" , QStandardPaths::writableLocation (QStandardPaths::HomeLocation)).toString ();
181
+ if (lastGcodeDir.isEmpty ())
182
+ QMessageBox::information (this , tr (" Error" ), tr (" Can't retrieve home location" ));
183
+ lastPreambleDir = settings->value (" lastPreambleDir" , QStandardPaths::writableLocation (QStandardPaths::HomeLocation)).toString ();
184
+ if (lastPreambleDir.isEmpty ())
185
+ QMessageBox::information (this , tr (" Error" ), tr (" Can't retrieve home location" ));
186
+ lastOutputDir = settings->value (" lastOutputDir" , QStandardPaths::writableLocation (QStandardPaths::HomeLocation)).toString ();
187
+ if (lastOutputDir.isEmpty ())
188
+ QMessageBox::information (this , tr (" Error" ), tr (" Can't retrieve home location" ));
189
+ lastConfigDir = settings->value (" lastConfigDir" , QStandardPaths::writableLocation (QStandardPaths::HomeLocation)).toString ();
190
+ if (lastConfigDir.isEmpty ())
188
191
QMessageBox::information (this , tr (" Error" ), tr (" Can't retrieve home location" ));
189
192
190
193
this ->resize (settings->value (" Window/width" , this ->width ()).toInt (),
@@ -195,6 +198,8 @@ MainWindow::MainWindow(QWidget *parent) :
195
198
196
199
ui->loadingLabel ->setMovie (&loadingIcon);
197
200
ui->loadingLabel ->hide ();
201
+ ui->mirroraxisDoubleSpinBox ->setEnabled (true );
202
+ ui->cutvertfeedSpinBox ->setEnabled (true );
198
203
}
199
204
200
205
void MainWindow::checkPcb2gcodeVersion ()
@@ -236,41 +241,15 @@ void MainWindow::checkPcb2gcodeVersion()
236
241
}
237
242
}
238
243
239
- void MainWindow::vectorialEnable (bool enable)
240
- {
241
- ui->dpiSpinBox ->setEnabled (!enable);
242
-
243
- if (enable)
244
- {
245
- if (ui->voronoiCheckBox ->isChecked ())
246
- ui->extrapassesSpinBox ->setEnabled (false );
247
-
248
- ui->outlinewidthDoubleSpinBox ->setEnabled (false );
249
- }
250
- else
251
- {
252
- if (ui->filloutlineCheckBox ->isChecked ())
253
- ui->outlinewidthDoubleSpinBox ->setEnabled (true );
254
-
255
- ui->extrapassesSpinBox ->setEnabled (true );
256
- }
257
- }
258
-
259
244
void MainWindow::voronoiEnable (bool enable)
260
245
{
261
246
ui->extrapassesSpinBox ->setEnabled (!enable);
262
247
ui->offsetDoubleSpinBox ->setEnabled (!enable);
263
248
}
264
249
265
- void MainWindow::fillOutlineEnable (bool enable)
266
- {
267
- if (!ui->vectorialCheckBox ->isChecked ())
268
- ui->outlinewidthDoubleSpinBox ->setEnabled (enable);
269
- }
270
-
271
250
void MainWindow::bridgesAvailable ()
272
251
{
273
- bool bridgesEnabled = ui-> vectorialCheckBox -> isChecked () || ui-> optimiseCheckBox -> isChecked () ;
252
+ bool bridgesEnabled = true ;
274
253
275
254
ui->bridgesDoubleSpinBox ->setEnabled (bridgesEnabled);
276
255
ui->zbridgesDoubleSpinBox ->setEnabled (bridgesEnabled);
@@ -312,17 +291,17 @@ void MainWindow::getDrillFile()
312
291
313
292
void MainWindow::getPreambleFile ()
314
293
{
315
- getFilename (ui->preambleLineEdit , tr (" preamble file" ), gcode_file_filter);
294
+ getPreFilename (ui->preambleLineEdit , tr (" preamble file" ), gcode_file_filter);
316
295
}
317
296
318
297
void MainWindow::getPreambletextFile ()
319
298
{
320
- getFilename (ui->preambletextLineEdit , tr (" preamble text file" ), text_file_filter);
299
+ getPreFilename (ui->preambletextLineEdit , tr (" preamble text file" ), text_file_filter);
321
300
}
322
301
323
302
void MainWindow::getPostambleFile ()
324
303
{
325
- getFilename (ui->postambleLineEdit , tr (" postamble file" ), gcode_file_filter);
304
+ getPreFilename (ui->postambleLineEdit , tr (" postamble file" ), gcode_file_filter);
326
305
}
327
306
328
307
void MainWindow::generateImages ()
@@ -358,7 +337,6 @@ void MainWindow::generateImages()
358
337
ui->loadingLabel ->show ();
359
338
360
339
currentImagesFolder = imagesFolder;
361
- vectorial = ui->vectorialCheckBox ->isChecked ();
362
340
fillOutline = ui->filloutlineCheckBox ->isChecked ();
363
341
pcb2gcodeImageProcess.start (PCB2GCODE_EXECUTABLE, arguments, QProcess::ReadOnly);
364
342
}
@@ -385,11 +363,6 @@ void MainWindow::imagesGenerated(int exitCode, QProcess::ExitStatus exitStatus)
385
363
{
386
364
QDir dir (currentImagesFolder);
387
365
388
- if (vectorial)
389
- dir.setNameFilters (QStringList () << " *.svg" );
390
- else
391
- dir.setNameFilters (QStringList () << " *.png" );
392
-
393
366
dir.setFilter (QDir::Files);
394
367
395
368
imagesFilename.clear ();
@@ -405,7 +378,7 @@ void MainWindow::imagesGenerated(int exitCode, QProcess::ExitStatus exitStatus)
405
378
addImageFile (dir, tr (" Input front" ), " original_front" );
406
379
addImageFile (dir, tr (" Input back" ), " original_back" );
407
380
addImageFile (dir, tr (" Input drill" ), " original_drill" );
408
- addImageFile (dir, tr (" Input outline" ), (fillOutline && !vectorial ) ? " outline_filled" : " original_outline" );
381
+ addImageFile (dir, tr (" Input outline" ), (fillOutline) ? " outline_filled" : " original_outline" );
409
382
addImageFile (dir, tr (" Input outline" ), " original_outline" );
410
383
}
411
384
else if (sender () != static_cast <QObject *>(&pcb2gcodeProcess) && !restarted) // Errors from pcb2gcodeProcess are printed in outputWindow
@@ -463,13 +436,29 @@ bool MainWindow::getFilename(QLineEdit *saveTo, const QString name, QString filt
463
436
{
464
437
QString filename;
465
438
466
- filename = QFileDialog::getOpenFileName (this , tr (" Select the " ) + name, lastDir, filter );
439
+ filename = QFileDialog::getOpenFileName (this , tr (" Select the " ) + name, lastGcodeDir, filter );
440
+
441
+ if ( filename.isEmpty () )
442
+ return false ;
443
+ else
444
+ {
445
+ lastGcodeDir = QFileInfo (filename).path ();
446
+ saveTo->setText ( filename );
447
+ return true ;
448
+ }
449
+ }
450
+
451
+ bool MainWindow::getPreFilename (QLineEdit *saveTo, const QString name, QString filter)
452
+ {
453
+ QString filename;
454
+
455
+ filename = QFileDialog::getOpenFileName (this , tr (" Select the " ) + name, lastPreambleDir, filter );
467
456
468
457
if ( filename.isEmpty () )
469
458
return false ;
470
459
else
471
460
{
472
- lastDir = QFileInfo (filename).path ();
461
+ lastPreambleDir = QFileInfo (filename).path ();
473
462
saveTo->setText ( filename );
474
463
return true ;
475
464
}
@@ -479,10 +468,10 @@ void MainWindow::getOutputDirectory()
479
468
{
480
469
QString dirname;
481
470
482
- dirname = QFileDialog::getExistingDirectory (this , tr (" Select the output directory" ), lastDir );
471
+ dirname = QFileDialog::getExistingDirectory (this , tr (" Select the output directory" ), lastOutputDir );
483
472
if ( !dirname.isEmpty () )
484
473
{
485
- lastDir = dirname;
474
+ lastOutputDir = dirname;
486
475
ui->outputDirLineEdit ->setText ( dirname );
487
476
}
488
477
}
@@ -491,11 +480,12 @@ void MainWindow::changeMetricInputUnits(bool metric)
491
480
{
492
481
QDoubleSpinBox *doubleSpinBoxes[] = { ui->zworkDoubleSpinBox , ui->zsafeDoubleSpinBox , ui->offsetDoubleSpinBox ,
493
482
ui->zdrillDoubleSpinBox , ui->zchangeDoubleSpinBox , ui->cutterdiameterDoubleSpinBox ,
494
- ui->zcutDoubleSpinBox , ui->cutinfeedDoubleSpinBox , ui-> outlinewidthDoubleSpinBox ,
483
+ ui->zcutDoubleSpinBox , ui->cutinfeedDoubleSpinBox ,
495
484
ui->bridgesDoubleSpinBox , ui->zbridgesDoubleSpinBox , ui->alxDoubleSpinBox ,
496
- ui->alyDoubleSpinBox , ui->toleranceDoubleSpinBox };
485
+ ui->alyDoubleSpinBox , ui->toleranceDoubleSpinBox , ui->optimiseDoubleSpinBox ,
486
+ ui->mirroraxisDoubleSpinBox };
497
487
498
- QSpinBox *spinBoxes[] = { ui->millfeedSpinBox , ui->drillfeedSpinBox , ui->cutfeedSpinBox , ui->alprobefeedSpinBox };
488
+ QSpinBox *spinBoxes[] = { ui->millfeedSpinBox , ui->drillfeedSpinBox , ui->cutfeedSpinBox , ui->cutvertfeedSpinBox , ui-> alprobefeedSpinBox };
499
489
500
490
const unsigned int doubleSpinBoxesLen = sizeof (doubleSpinBoxes) / sizeof (doubleSpinBoxes[0 ]);
501
491
const unsigned int spinBoxesLen = sizeof (spinBoxes) / sizeof (spinBoxes[0 ]);
@@ -616,7 +606,6 @@ void MainWindow::startPcb2gcode()
616
606
outputTextEdit = pcb2gcodeOutputWindow->getOutputPlainTextEdit ();
617
607
618
608
currentImagesFolder = ui->outputDirLineEdit ->text ();
619
- vectorial = ui->vectorialCheckBox ->isChecked ();
620
609
fillOutline = ui->filloutlineCheckBox ->isChecked ();
621
610
pcb2gcodeProcess.start (PCB2GCODE_EXECUTABLE, arguments, QProcess::ReadOnly);
622
611
}
@@ -770,10 +759,10 @@ void MainWindow::askAndLoadConfFile()
770
759
{
771
760
QString filename;
772
761
773
- filename = QFileDialog::getOpenFileName (this , tr (" Select a configuration file" ), lastDir );
762
+ filename = QFileDialog::getOpenFileName (this , tr (" Select a configuration file" ), lastConfigDir );
774
763
if ( !filename.isEmpty () )
775
764
{
776
- lastDir = QFileInfo (filename).path ();
765
+ lastConfigDir = QFileInfo (filename).path ();
777
766
if ( !loadConfFile (filename) )
778
767
QMessageBox::information (this , tr (" Error" ), tr (" The selected file can't be opened" ));
779
768
}
@@ -855,10 +844,10 @@ void MainWindow::askAndSaveConfFile()
855
844
{
856
845
QString filename;
857
846
858
- filename = QFileDialog::getSaveFileName (this , tr (" Save configuration file" ), lastDir );
847
+ filename = QFileDialog::getSaveFileName (this , tr (" Save configuration file" ), lastConfigDir );
859
848
if ( !filename.isEmpty () )
860
849
{
861
- lastDir = QFileInfo (filename).path ();
850
+ lastConfigDir = QFileInfo (filename).path ();
862
851
saveConfFile (filename);
863
852
}
864
853
}
@@ -966,7 +955,10 @@ void MainWindow::closeEvent(QCloseEvent *)
966
955
QDir ().rmdir (imagesFolder);
967
956
968
957
settings->setValue (" autoPreview" , ui->actionAutomatically_generate_previews ->isChecked ());
969
- settings->setValue (" lastDir" , lastDir);
958
+ settings->setValue (" lastGcodeDir" , lastGcodeDir);
959
+ settings->setValue (" lastPreambleDir" , lastPreambleDir);
960
+ settings->setValue (" lastOutputDir" , lastOutputDir);
961
+ settings->setValue (" lastConfigDir" , lastConfigDir);
970
962
971
963
settings->setValue (" Window/width" , this ->width ());
972
964
settings->setValue (" Window/height" , this ->height ());
0 commit comments