Skip to content

Commit b43b186

Browse files
committed
Added quotation marks on strings
Quotation marks added on string on command line arguments (not in configuration file). Windows doesn't require them, and it crashes if they are present, therefore quotation marks are disabled on Windows.
1 parent a414c9a commit b43b186

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

argaction.cpp

100644100755
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@ QStringList argAction::getAllArgs(bool getCommentedOptions)
162162
value = i.value().getFunction( i.value().object );
163163
if ( !value.isEmpty() )
164164
{
165+
#ifndef Q_OS_WIN //Crashes if quotation marks are present on Windows... Don't know why... FIXME
166+
if( stringMarks && i.value().getFunction == &getLineEdit )
167+
value = '\"' + value + '\"';
168+
#endif
169+
165170
if( static_cast<QWidget *>(i.value().object)->isEnabled() )
166171
output << i.key() + '=' + value;
167172
else

argaction.h

100644100755
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class argAction
6666
};
6767

6868
QMap<QString,argElement> argList;
69+
bool stringMarks;
6970

7071
public:
7172
explicit argAction();
@@ -75,6 +76,11 @@ class argAction
7576
QStringList getAllArgs(bool getCommentedOptions);
7677
bool setEnabled(const QString key, const bool enabled);
7778

79+
inline void setStringMarks (bool stringMarks)
80+
{
81+
this->stringMarks = stringMarks;
82+
}
83+
7884
inline void insert( const QString argName, QDoubleSpinBox *doubleSpinBox)
7985
{
8086
argList.insert( argName, (argElement){ .setFunction = &setDoubleSpinBox, .getFunction = &getDoubleSpinBox,

mainwindow.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,9 @@ QStringList MainWindow::getCmdLineArguments()
282282
int i;
283283
int pos;
284284

285+
for( i = FILEARGS; i <= AUTOLEVELLERARGS; i++ )
286+
args[i].setStringMarks(true);
287+
285288
arguments += args[ FILEARGS ].getAllArgs(false);
286289
arguments += args[ COMMONARGS ].getAllArgs(false);
287290

@@ -582,6 +585,7 @@ void MainWindow::saveConfFile(const QString filename)
582585

583586
for( int i = COMMONARGS; i <= AUTOLEVELLERARGS; i++ )
584587
{
588+
args[i].setStringMarks(false);
585589
arguments = args[i].getAllArgs(true);
586590
confFile.write( QString("# " + names[i] + " options\n").toLatin1() );
587591

settings.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@
3333
#define PCB2GCODE_GUI_VERSION 0.1
3434

3535
static const char *about_pcb2gcode_str = "pcb2gcode v%1<br>"
36-
"Based on <a href='http://sourceforge.net/projects/pcb2gcode/'>http://sourceforge.net/projects/pcb2gcode/</a><br>"
37-
"Currently developed on <a href='https://github.com/paktan/pcb2gcode'>https://github.com/paktan/pcb2gcode</a>";
36+
"<a href='http://sourceforge.net/projects/pcb2gcode/'>http://sourceforge.net/projects/pcb2gcode/</a><br>";
3837
static const char *about_pcb2gcodegui_str = "pcb2gcodeGUI v%1<br>"
3938
"Created by Nicola Corna (nicola@corna.info)<br>"
4039
"<a href='https://github.com/Corna/pcb2gcodeGUI'>https://github.com/Corna/pcb2gcodeGUI</a>";

0 commit comments

Comments
 (0)