Skip to content

Commit 7ff69bc

Browse files
committed
Added " " on log window when a string argument has spaces
1 parent 7704ed6 commit 7ff69bc

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

mainwindow.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,8 @@ QStringList MainWindow::getCmdLineArguments()
310310
void MainWindow::startPcb2gcode()
311311
{
312312
QStringList arguments;
313+
QString arguments_formatted;
314+
int pos;
313315

314316
if( ui->outputDirLineEdit->text().isEmpty() )
315317
getOutputDirectory();
@@ -321,6 +323,16 @@ void MainWindow::startPcb2gcode()
321323
arguments << "--noconfigfile";
322324
arguments += getCmdLineArguments();
323325

326+
for(QStringList::iterator iter = arguments.begin(); iter != arguments.end(); iter++) {
327+
pos = iter->indexOf('=');
328+
if( pos > 0 ) {
329+
if(iter->contains(' '))
330+
arguments_formatted += iter->left( pos + 1 ) + '\"' + iter->right( iter->length() - pos - 1 ) + "\" ";
331+
else
332+
arguments_formatted += *iter + ' ';
333+
}
334+
}
335+
324336
pcb2gcodeOutputWindow = new outputWindow(this);
325337
pcb2gcodeOutputWindow->setWindowTitle(PCB2GCODE_COMMAND_NAME " output");
326338
pcb2gcodeOutputWindow->setWindowFlags( pcb2gcodeOutputWindow->windowFlags() &
@@ -332,7 +344,7 @@ void MainWindow::startPcb2gcode()
332344
connect(killClosePushButton, SIGNAL(clicked()), this, SLOT(killCloseButtonClicked()));
333345

334346
outputTextEdit = pcb2gcodeOutputWindow->getPlainTextEdit();
335-
outputTextEdit->appendPlainText(QString(tr("Starting ")) + PCB2GCODE_EXECUTABLE + ' ' + arguments.join(' ') + '\n' ) ;
347+
outputTextEdit->appendPlainText(QString(tr("Starting ")) + PCB2GCODE_EXECUTABLE + ' ' + arguments_formatted + '\n' ) ;
336348

337349
pcb2gcodeProcess.start(PCB2GCODE_EXECUTABLE, arguments, QProcess::ReadOnly);
338350
}

0 commit comments

Comments
 (0)