@@ -77,12 +77,11 @@ MainWindow::MainWindow(QWidget *parent) :
7777 args[ COMMONARGS ].insert (" zsafe" , ui->zsafeDoubleSpinBox );
7878 args[ COMMONARGS ].insert (" zchange" , ui->zchangeDoubleSpinBox );
7979 args[ COMMONARGS ].insert (" zchange-absolute" , ui->zchangeAbsoluteCheckBox );
80- args[ COMMONARGS ].insert (" vectorial" , ui->vectorialCheckBox );
8180 args[ COMMONARGS ].insert (" nog64" , ui->nog64CheckBox );
8281 args[ COMMONARGS ].insert (" tolerance" , ui->toleranceDoubleSpinBox );
83- args[ COMMONARGS ].insert (" optimise" , ui->optimiseCheckBox );
82+ args[ COMMONARGS ].insert (" optimise" , ui->optimiseDoubleSpinBox );
8483 args[ COMMONARGS ].insert (" zero-start" , ui->zerostartCheckBox );
85- args[ COMMONARGS ].insert (" dpi " , ui->dpiSpinBox );
84+ args[ COMMONARGS ].insert (" mirror-axis " , ui->mirroraxisDoubleSpinBox );
8685 args[ COMMONARGS ].insert (" tile-x" , ui->tilexSpinBox );
8786 args[ COMMONARGS ].insert (" tile-y" , ui->tileySpinBox );
8887
@@ -108,7 +107,7 @@ MainWindow::MainWindow(QWidget *parent) :
108107 args[ OUTLINEARGS ].insert (" cut-feed" , ui->cutfeedSpinBox );
109108 args[ OUTLINEARGS ].insert (" cut-speed" , ui->cutspeedSpinBox );
110109 args[ OUTLINEARGS ].insert (" cut-infeed" , ui->cutinfeedDoubleSpinBox );
111- args[ OUTLINEARGS ].insert (" outline-width " , ui->outlinewidthDoubleSpinBox );
110+ args[ OUTLINEARGS ].insert (" cut-vertfeed " , ui->cutvertfeedSpinBox );
112111 args[ OUTLINEARGS ].insert (" bridges" , ui->bridgesDoubleSpinBox );
113112 args[ OUTLINEARGS ].insert (" zbridges" , ui->zbridgesDoubleSpinBox );
114113 args[ OUTLINEARGS ].insert (" bridgesnum" , ui->bridgesnumSpinBox );
@@ -148,12 +147,7 @@ MainWindow::MainWindow(QWidget *parent) :
148147 connect (ui->postamblePushButton , SIGNAL (clicked ()), this , SLOT (getPostambleFile ()));
149148 connect (ui->outputDirPushButton , SIGNAL (clicked ()), this , SLOT (getOutputDirectory ()));
150149
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 )));
154150 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 ()));
157151 connect (ui->milldrillCheckBox , SIGNAL (toggled (bool )), ui->milldrilldiameterDoubleSpinBox , SLOT (setEnabled (bool )));
158152 connect (ui->softwareComboBox , SIGNAL (currentTextChanged (QString)), this , SLOT (updateAlCustomEnableState (QString)));
159153
@@ -183,8 +177,17 @@ MainWindow::MainWindow(QWidget *parent) :
183177 settings = new QSettings (QSettings::IniFormat, QSettings::UserScope, " pcb2gcodeGUI" , " " , this );
184178
185179 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 ())
188191 QMessageBox::information (this , tr (" Error" ), tr (" Can't retrieve home location" ));
189192
190193 this ->resize (settings->value (" Window/width" , this ->width ()).toInt (),
@@ -195,6 +198,8 @@ MainWindow::MainWindow(QWidget *parent) :
195198
196199 ui->loadingLabel ->setMovie (&loadingIcon);
197200 ui->loadingLabel ->hide ();
201+ ui->mirroraxisDoubleSpinBox ->setEnabled (true );
202+ ui->cutvertfeedSpinBox ->setEnabled (true );
198203}
199204
200205void MainWindow::checkPcb2gcodeVersion ()
@@ -236,41 +241,15 @@ void MainWindow::checkPcb2gcodeVersion()
236241 }
237242}
238243
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-
259244void MainWindow::voronoiEnable (bool enable)
260245{
261246 ui->extrapassesSpinBox ->setEnabled (!enable);
262247 ui->offsetDoubleSpinBox ->setEnabled (!enable);
263248}
264249
265- void MainWindow::fillOutlineEnable (bool enable)
266- {
267- if (!ui->vectorialCheckBox ->isChecked ())
268- ui->outlinewidthDoubleSpinBox ->setEnabled (enable);
269- }
270-
271250void MainWindow::bridgesAvailable ()
272251{
273- bool bridgesEnabled = ui-> vectorialCheckBox -> isChecked () || ui-> optimiseCheckBox -> isChecked () ;
252+ bool bridgesEnabled = true ;
274253
275254 ui->bridgesDoubleSpinBox ->setEnabled (bridgesEnabled);
276255 ui->zbridgesDoubleSpinBox ->setEnabled (bridgesEnabled);
@@ -312,17 +291,17 @@ void MainWindow::getDrillFile()
312291
313292void MainWindow::getPreambleFile ()
314293{
315- getFilename (ui->preambleLineEdit , tr (" preamble file" ), gcode_file_filter);
294+ getPreFilename (ui->preambleLineEdit , tr (" preamble file" ), gcode_file_filter);
316295}
317296
318297void MainWindow::getPreambletextFile ()
319298{
320- getFilename (ui->preambletextLineEdit , tr (" preamble text file" ), text_file_filter);
299+ getPreFilename (ui->preambletextLineEdit , tr (" preamble text file" ), text_file_filter);
321300}
322301
323302void MainWindow::getPostambleFile ()
324303{
325- getFilename (ui->postambleLineEdit , tr (" postamble file" ), gcode_file_filter);
304+ getPreFilename (ui->postambleLineEdit , tr (" postamble file" ), gcode_file_filter);
326305}
327306
328307void MainWindow::generateImages ()
@@ -358,7 +337,6 @@ void MainWindow::generateImages()
358337 ui->loadingLabel ->show ();
359338
360339 currentImagesFolder = imagesFolder;
361- vectorial = ui->vectorialCheckBox ->isChecked ();
362340 fillOutline = ui->filloutlineCheckBox ->isChecked ();
363341 pcb2gcodeImageProcess.start (PCB2GCODE_EXECUTABLE, arguments, QProcess::ReadOnly);
364342}
@@ -385,11 +363,6 @@ void MainWindow::imagesGenerated(int exitCode, QProcess::ExitStatus exitStatus)
385363 {
386364 QDir dir (currentImagesFolder);
387365
388- if (vectorial)
389- dir.setNameFilters (QStringList () << " *.svg" );
390- else
391- dir.setNameFilters (QStringList () << " *.png" );
392-
393366 dir.setFilter (QDir::Files);
394367
395368 imagesFilename.clear ();
@@ -405,7 +378,7 @@ void MainWindow::imagesGenerated(int exitCode, QProcess::ExitStatus exitStatus)
405378 addImageFile (dir, tr (" Input front" ), " original_front" );
406379 addImageFile (dir, tr (" Input back" ), " original_back" );
407380 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" );
409382 addImageFile (dir, tr (" Input outline" ), " original_outline" );
410383 }
411384 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
463436{
464437 QString filename;
465438
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 );
467456
468457 if ( filename.isEmpty () )
469458 return false ;
470459 else
471460 {
472- lastDir = QFileInfo (filename).path ();
461+ lastPreambleDir = QFileInfo (filename).path ();
473462 saveTo->setText ( filename );
474463 return true ;
475464 }
@@ -479,10 +468,10 @@ void MainWindow::getOutputDirectory()
479468{
480469 QString dirname;
481470
482- dirname = QFileDialog::getExistingDirectory (this , tr (" Select the output directory" ), lastDir );
471+ dirname = QFileDialog::getExistingDirectory (this , tr (" Select the output directory" ), lastOutputDir );
483472 if ( !dirname.isEmpty () )
484473 {
485- lastDir = dirname;
474+ lastOutputDir = dirname;
486475 ui->outputDirLineEdit ->setText ( dirname );
487476 }
488477}
@@ -491,11 +480,12 @@ void MainWindow::changeMetricInputUnits(bool metric)
491480{
492481 QDoubleSpinBox *doubleSpinBoxes[] = { ui->zworkDoubleSpinBox , ui->zsafeDoubleSpinBox , ui->offsetDoubleSpinBox ,
493482 ui->zdrillDoubleSpinBox , ui->zchangeDoubleSpinBox , ui->cutterdiameterDoubleSpinBox ,
494- ui->zcutDoubleSpinBox , ui->cutinfeedDoubleSpinBox , ui-> outlinewidthDoubleSpinBox ,
483+ ui->zcutDoubleSpinBox , ui->cutinfeedDoubleSpinBox ,
495484 ui->bridgesDoubleSpinBox , ui->zbridgesDoubleSpinBox , ui->alxDoubleSpinBox ,
496- ui->alyDoubleSpinBox , ui->toleranceDoubleSpinBox };
485+ ui->alyDoubleSpinBox , ui->toleranceDoubleSpinBox , ui->optimiseDoubleSpinBox ,
486+ ui->mirroraxisDoubleSpinBox };
497487
498- QSpinBox *spinBoxes[] = { ui->millfeedSpinBox , ui->drillfeedSpinBox , ui->cutfeedSpinBox , ui->alprobefeedSpinBox };
488+ QSpinBox *spinBoxes[] = { ui->millfeedSpinBox , ui->drillfeedSpinBox , ui->cutfeedSpinBox , ui->cutvertfeedSpinBox , ui-> alprobefeedSpinBox };
499489
500490 const unsigned int doubleSpinBoxesLen = sizeof (doubleSpinBoxes) / sizeof (doubleSpinBoxes[0 ]);
501491 const unsigned int spinBoxesLen = sizeof (spinBoxes) / sizeof (spinBoxes[0 ]);
@@ -616,7 +606,6 @@ void MainWindow::startPcb2gcode()
616606 outputTextEdit = pcb2gcodeOutputWindow->getOutputPlainTextEdit ();
617607
618608 currentImagesFolder = ui->outputDirLineEdit ->text ();
619- vectorial = ui->vectorialCheckBox ->isChecked ();
620609 fillOutline = ui->filloutlineCheckBox ->isChecked ();
621610 pcb2gcodeProcess.start (PCB2GCODE_EXECUTABLE, arguments, QProcess::ReadOnly);
622611 }
@@ -770,10 +759,10 @@ void MainWindow::askAndLoadConfFile()
770759{
771760 QString filename;
772761
773- filename = QFileDialog::getOpenFileName (this , tr (" Select a configuration file" ), lastDir );
762+ filename = QFileDialog::getOpenFileName (this , tr (" Select a configuration file" ), lastConfigDir );
774763 if ( !filename.isEmpty () )
775764 {
776- lastDir = QFileInfo (filename).path ();
765+ lastConfigDir = QFileInfo (filename).path ();
777766 if ( !loadConfFile (filename) )
778767 QMessageBox::information (this , tr (" Error" ), tr (" The selected file can't be opened" ));
779768 }
@@ -855,10 +844,10 @@ void MainWindow::askAndSaveConfFile()
855844{
856845 QString filename;
857846
858- filename = QFileDialog::getSaveFileName (this , tr (" Save configuration file" ), lastDir );
847+ filename = QFileDialog::getSaveFileName (this , tr (" Save configuration file" ), lastConfigDir );
859848 if ( !filename.isEmpty () )
860849 {
861- lastDir = QFileInfo (filename).path ();
850+ lastConfigDir = QFileInfo (filename).path ();
862851 saveConfFile (filename);
863852 }
864853}
@@ -966,7 +955,10 @@ void MainWindow::closeEvent(QCloseEvent *)
966955 QDir ().rmdir (imagesFolder);
967956
968957 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);
970962
971963 settings->setValue (" Window/width" , this ->width ());
972964 settings->setValue (" Window/height" , this ->height ());
0 commit comments