Skip to content

Commit 831bd14

Browse files
committed
Major update
* Add image preview (original, traced, masked and final result) * Add check for pcb2gcode version at startup * Rewrite argaction with virtual classes and templates * Update the layout and make the windows resizable * Replace the pcb2gcode argument names with descriptive text * Bump version to 1.3.2
1 parent 026de9f commit 831bd14

19 files changed

+2927
-2056
lines changed

README.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
# pcb2gcodeGUI
2-
A simple GUI for pcb2gcode.
3-
The minimum required Qt's version is 5.0.2.
4-
After building it, download pcb2gcode
5-
from https://github.com/pcb2gcode/pcb2gcode/releases
6-
or follow the instructions in the [README](https://github.com/pcb2gcode/pcb2gcode/blob/master/README.md) to build
7-
the latest git version, then copy the pcb2gcode binary in the same folder of pcb2gcodeGUI.
2+
A GUI for [pcb2gcode](https://github.com/pcb2gcode/pcb2gcode).
83

94
## Build
10-
### Build on Debian Jessie/Sid, Ubuntu Trusty/Utopic/Vivid
5+
### Build on Debian Jessie or newer, Ubuntu Trusty or newer
116

12-
sudo apt-get install build-essential git qt5-default
7+
sudo apt-get install build-essential git qt5-default libqt5svg5-dev
138
git clone https://github.com/pcb2gcode/pcb2gcodeGUI.git
149
cd pcb2gcodeGUI/
1510
qmake
1611
make
1712
sudo make install
1813

19-
Now just run the built executable with
14+
Now follow the installations in the pcb2gcode's [README](https://github.com/pcb2gcode/pcb2gcode/blob/master/README.md)
15+
and install pcb2gcode.
16+
Now you can run pcb2gcodeGUI with
2017

2118
pcb2gcodeGUI
2219

@@ -38,8 +35,19 @@ and do an apt-update
3835
then follow the instructions for Debian Jessie
3936

4037
### Build on Windows
41-
The easiest way to build pcb2gcodeGUI on windows is by downloading
42-
the Qt SDK from here http://www.qt.io/download-open-source/ and
43-
building it within Qt Creator. After that, download a pcb2gcode
44-
Windows build and put it in the same folder of the pcb2gcodeGUI
45-
binary
38+
Note that pre-built binaries for Windows are available in the [release page](https://github.com/pcb2gcode/pcb2gcodeGUI/releases).
39+
40+
To build pcb2gcodeGUI on Windows download the [Qt SDK](http://www.qt.io/download-open-source/)
41+
and install it, then open pcb2gcodeGUI.pro inside Qt creator, select "Release" and build it.
42+
43+
You can also build pcb2gcodeGUI statically with [MSYS2](http://sourceforge.net/projects/msys2/):
44+
* Download MSYS2
45+
* Install the required build packages (follow the instructions for pcb2gcode)
46+
* `pacman -S mingw-w64-i686-qt5-static` (or `pacman -S mingw-w64-x86_64-qt5-static` if you want a 64-bit binary)
47+
* `git clone https://github.com/pcb2gcode/pcb2gcodeGUI.git`
48+
* `cd pcb2gcodeGUI/`
49+
* `/mingw32/qt5-static/bin/qmake.exe` (or `/mingw64/qt5-static/bin/qmake.exe` for the 64-bit binary)
50+
* `make`
51+
52+
Then copy pcb2gcodeGUI.exe and a pcb2gcode binary (download it from the [release page](https://github.com/pcb2gcode/pcb2gcode/releases)
53+
or [build it](https://github.com/pcb2gcode/pcb2gcode/blob/master/README.md)) in the same folder.

argaction.cpp

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015 Nicola Corna (nicola@corna.info)
2+
* Copyright (c) 2015-2016 Nicola Corna (nicola@corna.info)
33
*
44
* This file is part of pcb2gcodeGUI.
55
*
@@ -19,7 +19,8 @@
1919

2020
#include "argaction.h"
2121

22-
bool argDoubleSpinBox::setValue(const QString value)
22+
template<>
23+
bool argBase<QDoubleSpinBox>::setValue(const QString value)
2324
{
2425
bool ok;
2526
const double numericalValue = value.toDouble(&ok);
@@ -30,12 +31,14 @@ bool argDoubleSpinBox::setValue(const QString value)
3031
return ok;
3132
}
3233

33-
QString argDoubleSpinBox::getValue()
34+
template<>
35+
QString argBase<QDoubleSpinBox>::getValue()
3436
{
3537
return QString::number(object->value(), 'f', 4);
3638
}
3739

38-
bool argSpinBox::setValue(const QString value)
40+
template<>
41+
bool argBase<QSpinBox>::setValue(const QString value)
3942
{
4043
bool ok;
4144
double numericalValue = value.toInt(&ok);
@@ -46,12 +49,14 @@ bool argSpinBox::setValue(const QString value)
4649
return ok;
4750
}
4851

49-
QString argSpinBox::getValue()
52+
template<>
53+
QString argBase<QSpinBox>::getValue()
5054
{
5155
return QString::number(object->value());
5256
}
5357

54-
bool argCheckBox::setValue(const QString value)
58+
template<>
59+
bool argBase<QCheckBox>::setValue(const QString value)
5560
{
5661
if(value == "1" || value.compare("true", Qt::CaseInsensitive) == 0)
5762
{
@@ -67,26 +72,30 @@ bool argCheckBox::setValue(const QString value)
6772
return false;
6873
}
6974

70-
QString argCheckBox::getValue()
75+
template<>
76+
QString argBase<QCheckBox>::getValue()
7177
{
7278
if(object->isChecked())
7379
return "true";
7480
else
7581
return "false";
7682
}
7783

78-
bool argLineEdit::setValue(const QString value)
84+
template<>
85+
bool argBase<QLineEdit>::setValue(const QString value)
7986
{
8087
object->setText(value);
8188
return true;
8289
}
8390

84-
QString argLineEdit::getValue()
91+
template<>
92+
QString argBase<QLineEdit>::getValue()
8593
{
8694
return object->text();
8795
}
8896

89-
bool argComboBox::setValue(const QString value)
97+
template<>
98+
bool argBase<QComboBox>::setValue(const QString value)
9099
{
91100
const int index = object->findText(value, Qt::MatchFixedString);
92101

@@ -99,56 +108,61 @@ bool argComboBox::setValue(const QString value)
99108
return false;
100109
}
101110

102-
QString argComboBox::getValue()
111+
template<>
112+
QString argBase<QComboBox>::getValue()
103113
{
104114
return object->currentText();
105115
}
106116

107-
bool argRadioButtonPair::setValue(const QString value)
117+
template<>
118+
bool argBase<QButtonGroup>::setValue(const QString value)
108119
{
109120
if(value == "1" || value.compare("true", Qt::CaseInsensitive) == 0)
110121
{
111-
object.first->setChecked(true);
112-
object.second->setChecked(false);
122+
object->button(0)->setChecked(true);
113123
return true;
114124
}
115125
else if(value == "0" || value.compare("false", Qt::CaseInsensitive) == 0)
116126
{
117-
object.first->setChecked(false);
118-
object.second->setChecked(true);
127+
object->button(1)->setChecked(true);
119128
return true;
120129
}
121130
else
122131
return false;
123132
}
124133

125-
QString argRadioButtonPair::getValue()
134+
template<>
135+
QString argBase<QButtonGroup>::getValue()
126136
{
127-
if(object.first->isChecked())
137+
if(object->checkedId() == 0)
128138
return "true";
129139
else
130140
return "false";
131141
}
132142

133-
bool argRadioButtonPair::setEnabled(bool enabled)
143+
template<>
144+
void argBase<QButtonGroup>::setEnabled(bool enabled)
134145
{
135-
object.first->setEnabled(enabled);
136-
object.second->setEnabled(enabled);
146+
QList<QAbstractButton *> buttons = object->buttons();
137147

138-
return true;
148+
for (QAbstractButton *button : buttons)
149+
{
150+
button->setEnabled(enabled);
151+
}
139152
}
140153

141-
bool argRadioButtonPair::getEnabled()
154+
template<>
155+
bool argBase<QButtonGroup>::getEnabled()
142156
{
143-
return object.first->isEnabled();
157+
return object->button(0)->isEnabled();
144158
}
145159

146160
QStringList argAction::getAllArgs(const QString prepend, bool getCommentedOptions)
147161
{
148162
QStringList output;
149163
QString value;
150164

151-
for(QMap<QString, argBase *>::const_iterator i = objects.constBegin(); i != objects.constEnd(); i++)
165+
for (auto i = objects.constBegin(); i != objects.constEnd(); i++)
152166
{
153167
value = i.value()->getValue();
154168
if ( !value.isEmpty() )

0 commit comments

Comments
 (0)