Skip to content

Commit fb909ae

Browse files
committed
Changed default folder to home & changed pcb2gcode.exe path to the same folder of pcb2gcodeGUI
1 parent 4c7f122 commit fb909ae

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

mainwindow.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ MainWindow::MainWindow(QWidget *parent) :
137137
connect(&pcb2gcodeProcess, SIGNAL(readyReadStandardError()), this, SLOT(printOutput()));
138138
connect(&pcb2gcodeProcess, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(changeKillCloseButtonText(QProcess::ProcessState)));
139139

140+
lastDir = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
141+
if( lastDir.isEmpty() )
142+
QMessageBox::information(this, tr("Error"), tr("Can't retrieve home location"));
143+
140144
appDataLocation = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
141145
if( appDataLocation.isEmpty() )
142146
QMessageBox::information(this, tr("Error"), tr("Can't retrieve standard folder location"));
@@ -188,9 +192,12 @@ void MainWindow::getFilename(QLineEdit *saveTo, const QString name)
188192
{
189193
QString filename;
190194

191-
filename = QFileDialog::getOpenFileName(this, tr("Select the") + name, lastDir );
195+
filename = QFileDialog::getOpenFileName(this, tr("Select the ") + name, lastDir );
192196
if( !filename.isEmpty() )
193-
saveTo->setText( filename );
197+
{
198+
lastDir = QFileInfo(filename).path();
199+
saveTo->setText( filename );
200+
}
194201
}
195202

196203
void MainWindow::getOutputDirectory()
@@ -199,7 +206,10 @@ void MainWindow::getOutputDirectory()
199206

200207
dirname = QFileDialog::getExistingDirectory(this, tr("Select the output directory"), lastDir );
201208
if( !dirname.isEmpty() )
209+
{
210+
lastDir = dirname;
202211
ui->outputDirLineEdit->setText( dirname );
212+
}
203213
}
204214

205215
void MainWindow::changeMetricInputUnits(bool metric)
@@ -482,8 +492,11 @@ void MainWindow::askAndLoadConfFile()
482492

483493
filename = QFileDialog::getOpenFileName(this, tr("Select a configuration file"), lastDir );
484494
if( !filename.isEmpty() )
495+
{
496+
lastDir = QFileInfo(filename).path();
485497
if( !loadConfFile(filename) )
486498
QMessageBox::information(this, tr("Error"), tr("The selected file can't be opened"));
499+
}
487500
}
488501

489502
bool MainWindow::loadConfFile(const QString filename)
@@ -549,7 +562,10 @@ void MainWindow::askAndSaveConfFile()
549562

550563
filename = QFileDialog::getSaveFileName(this, tr("Save configuration file"), lastDir);
551564
if( !filename.isEmpty() )
565+
{
566+
lastDir = QFileInfo(filename).path();
552567
saveConfFile(filename);
568+
}
553569
}
554570

555571
void MainWindow::saveConfFile(const QString filename)

mainwindow.ui

100644100755
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
<x>10</x>
5858
<y>10</y>
5959
<width>317</width>
60-
<height>375</height>
60+
<height>301</height>
6161
</rect>
6262
</property>
6363
<layout class="QGridLayout" name="commonGridLayout">
@@ -277,6 +277,9 @@
277277
</item>
278278
<item row="0" column="1">
279279
<layout class="QHBoxLayout" name="inputSystemOfMeasurementHorizontalLayout">
280+
<property name="sizeConstraint">
281+
<enum>QLayout::SetMinimumSize</enum>
282+
</property>
280283
<item>
281284
<widget class="QRadioButton" name="inputMetricRadioButton">
282285
<property name="toolTip">
@@ -313,6 +316,9 @@
313316
</item>
314317
<item row="1" column="1">
315318
<layout class="QHBoxLayout" name="outputSystemOfMeasurementHorizontalLayout">
319+
<property name="sizeConstraint">
320+
<enum>QLayout::SetMinimumSize</enum>
321+
</property>
316322
<item>
317323
<widget class="QRadioButton" name="outputMetricRadioButton">
318324
<property name="toolTip">
@@ -1515,7 +1521,7 @@
15151521
<x>0</x>
15161522
<y>0</y>
15171523
<width>795</width>
1518-
<height>24</height>
1524+
<height>21</height>
15191525
</rect>
15201526
</property>
15211527
<widget class="QMenu" name="menuFile">

settings.h

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
#ifdef Q_OS_WIN
2626
#define PCB2GCODE_COMMAND_NAME "pcb2gcode.exe"
27-
#define PCB2GCODE_EXECUTABLE "pcb2gcode/" PCB2GCODE_COMMAND_NAME
27+
#define PCB2GCODE_EXECUTABLE PCB2GCODE_COMMAND_NAME
2828
#else
2929
#define PCB2GCODE_COMMAND_NAME "pcb2gcode"
3030
#define PCB2GCODE_EXECUTABLE PCB2GCODE_COMMAND_NAME

0 commit comments

Comments
 (0)