Sat, 24 Aug 2013 16:30:30 +0300
removed unused LabeledWidget
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
3 | * Copyright (C) 2013 Santeri Piippo |
378 | 4 | * |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
378 | 9 | * |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
378 | 14 | * |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | */ |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | |
202
a027f6fc6141
Un-templated CheckBoxGroup, moved it and RadioButton into widgets.cpp/widgets.h; removed license text tab because I think LICENSE is enough.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
198
diff
changeset
|
19 | #include <QProcess> |
a027f6fc6141
Un-templated CheckBoxGroup, moved it and RadioButton into widgets.cpp/widgets.h; removed license text tab because I think LICENSE is enough.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
198
diff
changeset
|
20 | #include <QTemporaryFile> |
a027f6fc6141
Un-templated CheckBoxGroup, moved it and RadioButton into widgets.cpp/widgets.h; removed license text tab because I think LICENSE is enough.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
198
diff
changeset
|
21 | #include <QDialog> |
a027f6fc6141
Un-templated CheckBoxGroup, moved it and RadioButton into widgets.cpp/widgets.h; removed license text tab because I think LICENSE is enough.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
198
diff
changeset
|
22 | #include <QDialogButtonBox> |
a027f6fc6141
Un-templated CheckBoxGroup, moved it and RadioButton into widgets.cpp/widgets.h; removed license text tab because I think LICENSE is enough.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
198
diff
changeset
|
23 | #include <QSpinBox> |
a027f6fc6141
Un-templated CheckBoxGroup, moved it and RadioButton into widgets.cpp/widgets.h; removed license text tab because I think LICENSE is enough.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
198
diff
changeset
|
24 | #include <QCheckBox> |
a027f6fc6141
Un-templated CheckBoxGroup, moved it and RadioButton into widgets.cpp/widgets.h; removed license text tab because I think LICENSE is enough.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
198
diff
changeset
|
25 | #include <QComboBox> |
203
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
26 | #include <QGridLayout> |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | #include "common.h" |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | #include "config.h" |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | #include "misc.h" |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | #include "gui.h" |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | #include "file.h" |
202
a027f6fc6141
Un-templated CheckBoxGroup, moved it and RadioButton into widgets.cpp/widgets.h; removed license text tab because I think LICENSE is enough.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
198
diff
changeset
|
32 | #include "widgets.h" |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | #include "history.h" |
345
1376ad3262ba
Converted Ytruder interface to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
343
diff
changeset
|
34 | #include "ui_ytruder.h" |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
35 | #include "ui_intersector.h" |
305
401b9e3f2d10
Exported Rectifier interface to .ui file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
303
diff
changeset
|
36 | #include "ui_rectifier.h" |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
37 | #include "ui_coverer.h" |
302
08bd2c185b25
Converted Isecalc front-end dialog to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
301
diff
changeset
|
38 | #include "ui_isecalc.h" |
301
ef51681bb978
Added an ui file for a to-be edger2 launcher
Santeri Piippo <crimsondusk64@gmail.com>
parents:
300
diff
changeset
|
39 | #include "ui_edger2.h" |
452
47cc663e4ff4
ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
421
diff
changeset
|
40 | #include "dialogs.h" |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
41 | |
387
248296088f2c
moved ext program action definitions to extprogs.cpp rather than proxying it through gui_editactions.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
382
diff
changeset
|
42 | enum extprog { |
248296088f2c
moved ext program action definitions to extprogs.cpp rather than proxying it through gui_editactions.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
382
diff
changeset
|
43 | Isecalc, |
248296088f2c
moved ext program action definitions to extprogs.cpp rather than proxying it through gui_editactions.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
382
diff
changeset
|
44 | Intersector, |
248296088f2c
moved ext program action definitions to extprogs.cpp rather than proxying it through gui_editactions.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
382
diff
changeset
|
45 | Coverer, |
248296088f2c
moved ext program action definitions to extprogs.cpp rather than proxying it through gui_editactions.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
382
diff
changeset
|
46 | Ytruder, |
248296088f2c
moved ext program action definitions to extprogs.cpp rather than proxying it through gui_editactions.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
382
diff
changeset
|
47 | Rectifier, |
248296088f2c
moved ext program action definitions to extprogs.cpp rather than proxying it through gui_editactions.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
382
diff
changeset
|
48 | Edger2, |
248296088f2c
moved ext program action definitions to extprogs.cpp rather than proxying it through gui_editactions.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
382
diff
changeset
|
49 | }; |
248296088f2c
moved ext program action definitions to extprogs.cpp rather than proxying it through gui_editactions.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
382
diff
changeset
|
50 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
51 | // ============================================================================= |
455
c5d14d112034
Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
454
diff
changeset
|
52 | // ----------------------------------------------------------------------------- |
461
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
460
diff
changeset
|
53 | cfg (String, prog_isecalc, ""); |
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
460
diff
changeset
|
54 | cfg (String, prog_intersector, ""); |
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
460
diff
changeset
|
55 | cfg (String, prog_coverer, ""); |
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
460
diff
changeset
|
56 | cfg (String, prog_ytruder, ""); |
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
460
diff
changeset
|
57 | cfg (String, prog_rectifier, ""); |
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
460
diff
changeset
|
58 | cfg (String, prog_edger2, ""); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
59 | |
461
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
460
diff
changeset
|
60 | StringConfig* const g_extProgPaths[] = { |
452
47cc663e4ff4
ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
421
diff
changeset
|
61 | &prog_isecalc, |
47cc663e4ff4
ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
421
diff
changeset
|
62 | &prog_intersector, |
47cc663e4ff4
ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
421
diff
changeset
|
63 | &prog_coverer, |
47cc663e4ff4
ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
421
diff
changeset
|
64 | &prog_ytruder, |
47cc663e4ff4
ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
421
diff
changeset
|
65 | &prog_rectifier, |
47cc663e4ff4
ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
421
diff
changeset
|
66 | &prog_edger2, |
47cc663e4ff4
ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
421
diff
changeset
|
67 | }; |
47cc663e4ff4
ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
421
diff
changeset
|
68 | |
300
0c7e00cc3d44
Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents:
288
diff
changeset
|
69 | #ifndef _WIN32 |
461
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
460
diff
changeset
|
70 | cfg (Bool, prog_isecalc_wine, false); |
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
460
diff
changeset
|
71 | cfg (Bool, prog_intersector_wine, false); |
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
460
diff
changeset
|
72 | cfg (Bool, prog_coverer_wine, false); |
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
460
diff
changeset
|
73 | cfg (Bool, prog_ytruder_wine, false); |
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
460
diff
changeset
|
74 | cfg (Bool, prog_rectifier_wine, false); |
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
460
diff
changeset
|
75 | cfg (Bool, prog_edger2_wine, false); |
300
0c7e00cc3d44
Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents:
288
diff
changeset
|
76 | |
461
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
460
diff
changeset
|
77 | BoolConfig* const g_extProgWine[] = { |
300
0c7e00cc3d44
Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents:
288
diff
changeset
|
78 | &prog_isecalc_wine, |
0c7e00cc3d44
Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents:
288
diff
changeset
|
79 | &prog_intersector_wine, |
0c7e00cc3d44
Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents:
288
diff
changeset
|
80 | &prog_coverer_wine, |
0c7e00cc3d44
Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents:
288
diff
changeset
|
81 | &prog_ytruder_wine, |
0c7e00cc3d44
Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents:
288
diff
changeset
|
82 | &prog_rectifier_wine, |
301
ef51681bb978
Added an ui file for a to-be edger2 launcher
Santeri Piippo <crimsondusk64@gmail.com>
parents:
300
diff
changeset
|
83 | &prog_edger2_wine, |
300
0c7e00cc3d44
Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents:
288
diff
changeset
|
84 | }; |
0c7e00cc3d44
Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents:
288
diff
changeset
|
85 | #endif // _WIN32 |
0c7e00cc3d44
Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents:
288
diff
changeset
|
86 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
87 | const char* g_extProgNames[] = { |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
88 | "Isecalc", |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
89 | "Intersector", |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
90 | "Coverer", |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
91 | "Ytruder", |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
92 | "Rectifier", |
301
ef51681bb978
Added an ui file for a to-be edger2 launcher
Santeri Piippo <crimsondusk64@gmail.com>
parents:
300
diff
changeset
|
93 | "Edger2" |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
94 | }; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
95 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
96 | // ============================================================================= |
455
c5d14d112034
Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
454
diff
changeset
|
97 | // ----------------------------------------------------------------------------- |
454
d6b4ed3bf169
ask the user for isecalc's path if adding edges to intersector output and no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
452
diff
changeset
|
98 | static bool checkProgPath (const extprog prog) { |
d6b4ed3bf169
ask the user for isecalc's path if adding edges to intersector output and no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
452
diff
changeset
|
99 | alias path = g_extProgPaths[prog]->value; |
d6b4ed3bf169
ask the user for isecalc's path if adding edges to intersector output and no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
452
diff
changeset
|
100 | |
378 | 101 | if (path.length() > 0) |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
102 | return true; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
103 | |
452
47cc663e4ff4
ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
421
diff
changeset
|
104 | ExtProgPathPrompt* dlg = new ExtProgPathPrompt (g_extProgNames[prog]); |
47cc663e4ff4
ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
421
diff
changeset
|
105 | if (dlg->exec() && !dlg->getPath().isEmpty()) { |
454
d6b4ed3bf169
ask the user for isecalc's path if adding edges to intersector output and no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
452
diff
changeset
|
106 | path = dlg->getPath(); |
452
47cc663e4ff4
ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
421
diff
changeset
|
107 | return true; |
47cc663e4ff4
ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
421
diff
changeset
|
108 | } |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
109 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
110 | return false; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
111 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
112 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
113 | // ============================================================================= |
455
c5d14d112034
Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
454
diff
changeset
|
114 | // ----------------------------------------------------------------------------- |
305
401b9e3f2d10
Exported Rectifier interface to .ui file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
303
diff
changeset
|
115 | static str processErrorString (QProcess& proc) { |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
116 | switch (proc.error()) { |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
117 | case QProcess::FailedToStart: |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
118 | return "Failed to start (check your permissions)"; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
119 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
120 | case QProcess::Crashed: |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
121 | return "Crashed."; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
122 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
123 | case QProcess::WriteError: |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
124 | case QProcess::ReadError: |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
125 | return "I/O error."; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
126 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
127 | case QProcess::UnknownError: |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
128 | return "Unknown error"; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
129 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
130 | case QProcess::Timedout: |
378 | 131 | return fmt ("Timed out (30 seconds)"); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
132 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
133 | |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
134 | return ""; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
135 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
136 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
137 | // ============================================================================= |
455
c5d14d112034
Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
454
diff
changeset
|
138 | // ----------------------------------------------------------------------------- |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
139 | static bool mkTempFile (QTemporaryFile& tmp, str& fname) { |
378 | 140 | if (!tmp.open()) |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
141 | return false; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
142 | |
378 | 143 | fname = tmp.fileName(); |
144 | tmp.close(); | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
145 | return true; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
146 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
147 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
148 | // ============================================================================= |
455
c5d14d112034
Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
454
diff
changeset
|
149 | // ----------------------------------------------------------------------------- |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
388
diff
changeset
|
150 | void writeObjects (List<LDObject*>& objects, File& f) { |
207
e8c47e51e03d
Made drawing an edit mode, allowing me to add more modes in the future
Santeri Piippo <crimsondusk64@gmail.com>
parents:
205
diff
changeset
|
151 | for (LDObject* obj : objects) { |
378 | 152 | if (obj->getType() == LDObject::Subfile) { |
460
b230ae09c8e5
Cut the Object-suffix from LDObject types, it doesn't help things at all
Santeri Piippo <crimsondusk64@gmail.com>
parents:
458
diff
changeset
|
153 | LDSubfile* ref = static_cast<LDSubfile*> (obj); |
b230ae09c8e5
Cut the Object-suffix from LDObject types, it doesn't help things at all
Santeri Piippo <crimsondusk64@gmail.com>
parents:
458
diff
changeset
|
154 | List<LDObject*> objs = ref->inlineContents (LDSubfile::DeepInline); |
207
e8c47e51e03d
Made drawing an edit mode, allowing me to add more modes in the future
Santeri Piippo <crimsondusk64@gmail.com>
parents:
205
diff
changeset
|
155 | |
288
2980d7fd948e
Converted from C-style fopen to the new File class
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
156 | writeObjects (objs, f); |
378 | 157 | |
207
e8c47e51e03d
Made drawing an edit mode, allowing me to add more modes in the future
Santeri Piippo <crimsondusk64@gmail.com>
parents:
205
diff
changeset
|
158 | for (LDObject* obj : objs) |
e8c47e51e03d
Made drawing an edit mode, allowing me to add more modes in the future
Santeri Piippo <crimsondusk64@gmail.com>
parents:
205
diff
changeset
|
159 | delete obj; |
288
2980d7fd948e
Converted from C-style fopen to the new File class
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
160 | } else |
378 | 161 | f.write (obj->raw() + "\r\n"); |
207
e8c47e51e03d
Made drawing an edit mode, allowing me to add more modes in the future
Santeri Piippo <crimsondusk64@gmail.com>
parents:
205
diff
changeset
|
162 | } |
e8c47e51e03d
Made drawing an edit mode, allowing me to add more modes in the future
Santeri Piippo <crimsondusk64@gmail.com>
parents:
205
diff
changeset
|
163 | } |
e8c47e51e03d
Made drawing an edit mode, allowing me to add more modes in the future
Santeri Piippo <crimsondusk64@gmail.com>
parents:
205
diff
changeset
|
164 | |
455
c5d14d112034
Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
454
diff
changeset
|
165 | // ============================================================================= |
c5d14d112034
Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
454
diff
changeset
|
166 | // ----------------------------------------------------------------------------- |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
388
diff
changeset
|
167 | void writeObjects (List<LDObject*>& objects, str fname) { |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
168 | // Write the input file |
288
2980d7fd948e
Converted from C-style fopen to the new File class
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
169 | File f (fname, File::Write); |
378 | 170 | |
288
2980d7fd948e
Converted from C-style fopen to the new File class
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
171 | if (!f) { |
286
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
172 | critical (fmt ("Couldn't open temporary file %1 for writing.\n", fname)); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
173 | return; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
174 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
175 | |
288
2980d7fd948e
Converted from C-style fopen to the new File class
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
176 | writeObjects (objects, f); |
378 | 177 | f.close(); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
178 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
179 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
180 | // ============================================================================= |
455
c5d14d112034
Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
454
diff
changeset
|
181 | // ----------------------------------------------------------------------------- |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
182 | void writeSelection (str fname) { |
378 | 183 | writeObjects (g_win->sel(), fname); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
184 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
185 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
186 | // ============================================================================= |
455
c5d14d112034
Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
454
diff
changeset
|
187 | // ----------------------------------------------------------------------------- |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
188 | void writeColorGroup (const short colnum, str fname) { |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
388
diff
changeset
|
189 | List<LDObject*> objects; |
378 | 190 | |
409
8da2563c645a
Renamed LDOpenFile to LDFile
Santeri Piippo <crimsondusk64@gmail.com>
parents:
402
diff
changeset
|
191 | for (LDObject* obj : *LDFile::current()) { |
378 | 192 | if (obj->isColored() == false || obj->color() != colnum) |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
193 | continue; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
194 | |
252
3f9067022d74
Take the aforementioned operator<< into use
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
195 | objects << obj; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
196 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
197 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
198 | writeObjects (objects, fname); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
199 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
200 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
201 | // ============================================================================= |
455
c5d14d112034
Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
454
diff
changeset
|
202 | // ----------------------------------------------------------------------------- |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
203 | bool runUtilityProcess (extprog prog, str path, str argvstr) { |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
204 | QTemporaryFile input, output; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
205 | str inputname, outputname; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
206 | QStringList argv = argvstr.split (" ", QString::SkipEmptyParts); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
207 | |
300
0c7e00cc3d44
Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents:
288
diff
changeset
|
208 | #ifndef _WIN32 |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
209 | if (*g_extProgWine[prog]) { |
300
0c7e00cc3d44
Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents:
288
diff
changeset
|
210 | argv.insert (0, path); |
0c7e00cc3d44
Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents:
288
diff
changeset
|
211 | path = "wine"; |
0c7e00cc3d44
Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents:
288
diff
changeset
|
212 | } |
0c7e00cc3d44
Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents:
288
diff
changeset
|
213 | #endif // _WIN32 |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
214 | |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
215 | print ("cmdline: %1 %2\n", path, argv.join (" ")); |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
216 | |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
217 | // Temporary files for stdin and stdout |
378 | 218 | if (!mkTempFile (input, inputname) || !mkTempFile (output, outputname)) |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
219 | return false; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
220 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
221 | QProcess proc; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
222 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
223 | // Init stdin |
288
2980d7fd948e
Converted from C-style fopen to the new File class
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
224 | File stdinfp (inputname, File::Write); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
225 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
226 | // Begin! |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
227 | proc.setStandardInputFile (inputname); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
228 | proc.start (path, argv); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
229 | |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
230 | // Write an enter, the utility tools all expect one |
288
2980d7fd948e
Converted from C-style fopen to the new File class
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
231 | stdinfp.write ("\n"); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
232 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
233 | // Wait while it runs |
378 | 234 | proc.waitForFinished(); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
235 | |
185
6fea53f1ffc2
Speed up picking - no need to rebuild the object list as its contents do not change while picking. Fixed transparent stuff always being opaque (although it still appears messed up for some reason)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
184
diff
changeset
|
236 | #ifndef RELEASE |
378 | 237 | print ("%1", str (proc.readAllStandardOutput())); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
238 | #endif // RELEASE |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
239 | |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
240 | str err = ""; |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
241 | |
378 | 242 | if (proc.exitStatus() != QProcess::NormalExit) |
305
401b9e3f2d10
Exported Rectifier interface to .ui file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
303
diff
changeset
|
243 | err = processErrorString (proc); |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
244 | |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
245 | // Check the return code |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
246 | if (proc.exitCode() != 0) |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
247 | err = fmt ("Program exited abnormally (return code %1).", proc.exitCode()); |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
248 | |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
249 | if (err.length() > 0) { |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
250 | critical (fmt ("%1 failed: %2\n", g_extProgNames[prog], err)); |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
251 | return false; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
252 | } |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
253 | |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
254 | return true; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
255 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
256 | |
455
c5d14d112034
Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
454
diff
changeset
|
257 | // ============================================================================= |
c5d14d112034
Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
454
diff
changeset
|
258 | // ----------------------------------------------------------------------------- |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
388
diff
changeset
|
259 | static void insertOutput (str fname, bool replace, List<short> colorsToReplace) { |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
260 | #ifndef RELEASE |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
261 | QFile::copy (fname, "./debug_lastOutput"); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
262 | #endif // RELEASE |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
263 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
264 | // Read the output file |
288
2980d7fd948e
Converted from C-style fopen to the new File class
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
265 | File f (fname, File::Read); |
378 | 266 | |
288
2980d7fd948e
Converted from C-style fopen to the new File class
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
267 | if (!f) { |
286
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
268 | critical (fmt ("Couldn't open temporary file %1 for reading.\n", fname)); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
269 | return; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
270 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
271 | |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
388
diff
changeset
|
272 | List<LDObject*> objs = loadFileContents (&f, null); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
273 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
274 | // If we replace the objects, delete the selection now. |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
275 | if (replace) |
378 | 276 | g_win->deleteSelection(); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
277 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
278 | for (const short colnum : colorsToReplace) |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
252
diff
changeset
|
279 | g_win->deleteByColor (colnum); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
280 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
281 | // Insert the new objects |
378 | 282 | g_win->sel().clear(); |
283 | ||
284 | for (LDObject * obj : objs) { | |
285 | if (!obj->isScemantic()) { | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
286 | delete obj; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
287 | continue; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
288 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
289 | |
409
8da2563c645a
Renamed LDOpenFile to LDFile
Santeri Piippo <crimsondusk64@gmail.com>
parents:
402
diff
changeset
|
290 | LDFile::current()->addObject (obj); |
378 | 291 | g_win->sel() << obj; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
292 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
293 | |
378 | 294 | g_win->fullRefresh(); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
295 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
296 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
297 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
298 | // Interface for Ytruder |
455
c5d14d112034
Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
454
diff
changeset
|
299 | // ----------------------------------------------------------------------------- |
387
248296088f2c
moved ext program action definitions to extprogs.cpp rather than proxying it through gui_editactions.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
382
diff
changeset
|
300 | DEFINE_ACTION (Ytruder, 0) { |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
301 | setlocale (LC_ALL, "C"); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
302 | |
454
d6b4ed3bf169
ask the user for isecalc's path if adding edges to intersector output and no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
452
diff
changeset
|
303 | if (!checkProgPath (Ytruder)) |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
304 | return; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
305 | |
345
1376ad3262ba
Converted Ytruder interface to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
343
diff
changeset
|
306 | QDialog* dlg = new QDialog; |
1376ad3262ba
Converted Ytruder interface to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
343
diff
changeset
|
307 | Ui::YtruderUI ui; |
378 | 308 | ui.setupUi (dlg); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
309 | |
378 | 310 | if (!dlg->exec()) |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
311 | return; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
312 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
313 | // Read the user's choices |
345
1376ad3262ba
Converted Ytruder interface to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
343
diff
changeset
|
314 | const enum { Distance, Symmetry, Projection, Radial } mode = |
1376ad3262ba
Converted Ytruder interface to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
343
diff
changeset
|
315 | ui.mode_distance->isChecked() ? Distance : |
1376ad3262ba
Converted Ytruder interface to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
343
diff
changeset
|
316 | ui.mode_symmetry->isChecked() ? Symmetry : |
1376ad3262ba
Converted Ytruder interface to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
343
diff
changeset
|
317 | ui.mode_projection->isChecked() ? Projection : Radial; |
1376ad3262ba
Converted Ytruder interface to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
343
diff
changeset
|
318 | |
1376ad3262ba
Converted Ytruder interface to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
343
diff
changeset
|
319 | const Axis axis = |
1376ad3262ba
Converted Ytruder interface to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
343
diff
changeset
|
320 | ui.axis_x->isChecked() ? X : |
1376ad3262ba
Converted Ytruder interface to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
343
diff
changeset
|
321 | ui.axis_y->isChecked() ? Y : Z; |
1376ad3262ba
Converted Ytruder interface to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
343
diff
changeset
|
322 | |
1376ad3262ba
Converted Ytruder interface to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
343
diff
changeset
|
323 | const double depth = ui.planeDepth->value(), |
1376ad3262ba
Converted Ytruder interface to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
343
diff
changeset
|
324 | condAngle = ui.condAngle->value(); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
325 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
326 | QTemporaryFile indat, outdat; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
327 | str inDATName, outDATName; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
328 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
329 | // Make temp files for the input and output files |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
330 | if (!mkTempFile (indat, inDATName) || !mkTempFile (outdat, outDATName)) |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
331 | return; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
332 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
333 | // Compose the command-line arguments |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
409
diff
changeset
|
334 | str argv = join ({ |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
335 | (axis == X) ? "-x" : (axis == Y) ? "-y" : "-z", |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
336 | (mode == Distance) ? "-d" : (mode == Symmetry) ? "-s" : (mode == Projection) ? "-p" : "-r", |
286
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
337 | depth, |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
338 | "-a", |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
339 | condAngle, |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
340 | inDATName, |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
341 | outDATName |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
342 | }); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
343 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
344 | writeSelection (inDATName); |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
345 | |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
346 | if (!runUtilityProcess (Ytruder, prog_ytruder, argv)) |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
347 | return; |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
348 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
349 | insertOutput (outDATName, false, {}); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
350 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
351 | |
301
ef51681bb978
Added an ui file for a to-be edger2 launcher
Santeri Piippo <crimsondusk64@gmail.com>
parents:
300
diff
changeset
|
352 | // ============================================================================= |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
353 | // Rectifier interface |
455
c5d14d112034
Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
454
diff
changeset
|
354 | // ----------------------------------------------------------------------------- |
387
248296088f2c
moved ext program action definitions to extprogs.cpp rather than proxying it through gui_editactions.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
382
diff
changeset
|
355 | DEFINE_ACTION (Rectifier, 0){ |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
356 | setlocale (LC_ALL, "C"); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
357 | |
454
d6b4ed3bf169
ask the user for isecalc's path if adding edges to intersector output and no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
452
diff
changeset
|
358 | if (!checkProgPath (Rectifier)) |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
359 | return; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
360 | |
305
401b9e3f2d10
Exported Rectifier interface to .ui file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
303
diff
changeset
|
361 | QDialog* dlg = new QDialog; |
401b9e3f2d10
Exported Rectifier interface to .ui file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
303
diff
changeset
|
362 | Ui::RectifierUI ui; |
401b9e3f2d10
Exported Rectifier interface to .ui file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
303
diff
changeset
|
363 | ui.setupUi (dlg); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
364 | |
378 | 365 | if (!dlg->exec()) |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
366 | return; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
367 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
368 | QTemporaryFile indat, outdat; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
369 | str inDATName, outDATName; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
370 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
371 | // Make temp files for the input and output files |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
372 | if (!mkTempFile (indat, inDATName) || !mkTempFile (outdat, outDATName)) |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
373 | return; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
374 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
375 | // Compose arguments |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
409
diff
changeset
|
376 | str argv = join ({ |
378 | 377 | (!ui.cb_condense->isChecked()) ? "-q" : "", |
378 | (!ui.cb_subst->isChecked()) ? "-r" : "", | |
379 | (ui.cb_condlineCheck->isChecked()) ? "-a" : "", | |
380 | (ui.cb_colorize->isChecked()) ? "-c" : "", | |
286
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
381 | "-t", |
378 | 382 | ui.dsb_coplthres->value(), |
286
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
383 | inDATName, |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
384 | outDATName |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
385 | }); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
386 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
387 | writeSelection (inDATName); |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
388 | |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
389 | if (!runUtilityProcess (Rectifier, prog_rectifier, argv)) |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
390 | return; |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
391 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
392 | insertOutput (outDATName, true, {}); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
393 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
394 | |
301
ef51681bb978
Added an ui file for a to-be edger2 launcher
Santeri Piippo <crimsondusk64@gmail.com>
parents:
300
diff
changeset
|
395 | // ============================================================================= |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
396 | // Intersector interface |
455
c5d14d112034
Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
454
diff
changeset
|
397 | // ----------------------------------------------------------------------------- |
387
248296088f2c
moved ext program action definitions to extprogs.cpp rather than proxying it through gui_editactions.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
382
diff
changeset
|
398 | DEFINE_ACTION (Intersector, 0) { |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
399 | setlocale (LC_ALL, "C"); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
400 | |
454
d6b4ed3bf169
ask the user for isecalc's path if adding edges to intersector output and no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
452
diff
changeset
|
401 | if (!checkProgPath (Intersector)) |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
402 | return; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
403 | |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
404 | QDialog* dlg = new QDialog; |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
405 | Ui::IntersectorUI ui; |
378 | 406 | ui.setupUi (dlg); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
407 | |
378 | 408 | makeColorSelector (ui.cmb_incol); |
409 | makeColorSelector (ui.cmb_cutcol); | |
410 | ui.cb_repeat->setWhatsThis ("If this is set, " APPNAME " runs Intersector a second time with inverse files to cut the " | |
411 | " cutter group with the input group. Both groups are cut by the intersection."); | |
412 | ui.cb_edges->setWhatsThis ("Makes " APPNAME " try run Isecalc to create edgelines for the intersection."); | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
413 | |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
414 | short inCol, cutCol; |
378 | 415 | const bool repeatInverse = ui.cb_repeat->isChecked(); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
416 | |
378 | 417 | for (;;) { |
418 | if (!dlg->exec()) | |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
419 | return; |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
420 | |
378 | 421 | inCol = ui.cmb_incol->itemData (ui.cmb_incol->currentIndex()).toInt(); |
422 | cutCol = ui.cmb_cutcol->itemData (ui.cmb_cutcol->currentIndex()).toInt(); | |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
423 | |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
424 | if (inCol == cutCol) { |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
425 | critical ("Cannot use the same color group for both input and cutter!"); |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
426 | continue; |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
427 | } |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
428 | |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
429 | break; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
430 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
431 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
432 | // Five temporary files! |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
433 | // indat = input group file |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
434 | // cutdat = cutter group file |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
435 | // outdat = primary output |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
436 | // outdat2 = inverse output |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
437 | // edgesdat = edges output (isecalc) |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
438 | QTemporaryFile indat, cutdat, outdat, outdat2, edgesdat; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
439 | str inDATName, cutDATName, outDATName, outDAT2Name, edgesDATName; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
440 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
441 | if (!mkTempFile (indat, inDATName) || !mkTempFile (cutdat, cutDATName) || |
378 | 442 | !mkTempFile (outdat, outDATName) || !mkTempFile (outdat2, outDAT2Name) || |
443 | !mkTempFile (edgesdat, edgesDATName)) { | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
444 | return; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
445 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
446 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
409
diff
changeset
|
447 | str parms = join ({ |
378 | 448 | (ui.cb_colorize->isChecked()) ? "-c" : "", |
449 | (ui.cb_nocondense->isChecked()) ? "-t" : "", | |
286
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
450 | "-s", |
378 | 451 | ui.dsb_prescale->value() |
286
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
452 | }); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
453 | |
286
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
454 | str argv_normal = join ({ |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
455 | parms, |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
456 | inDATName, |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
457 | cutDATName, |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
458 | outDATName |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
459 | }); |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
460 | |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
461 | str argv_inverse = join ({ |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
462 | parms, |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
463 | cutDATName, |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
464 | inDATName, |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
465 | outDAT2Name |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
466 | }); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
467 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
468 | writeColorGroup (inCol, inDATName); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
469 | writeColorGroup (cutCol, cutDATName); |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
470 | |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
471 | if (!runUtilityProcess (Intersector, prog_intersector, argv_normal)) |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
472 | return; |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
473 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
474 | insertOutput (outDATName, false, {inCol}); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
475 | |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
476 | if (repeatInverse && runUtilityProcess (Intersector, prog_intersector, argv_inverse)) |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
477 | insertOutput (outDAT2Name, false, {cutCol}); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
478 | |
454
d6b4ed3bf169
ask the user for isecalc's path if adding edges to intersector output and no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
452
diff
changeset
|
479 | if ( |
d6b4ed3bf169
ask the user for isecalc's path if adding edges to intersector output and no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
452
diff
changeset
|
480 | ui.cb_edges->isChecked() && |
d6b4ed3bf169
ask the user for isecalc's path if adding edges to intersector output and no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
452
diff
changeset
|
481 | checkProgPath (Isecalc) && |
d6b4ed3bf169
ask the user for isecalc's path if adding edges to intersector output and no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
452
diff
changeset
|
482 | runUtilityProcess (Isecalc, prog_isecalc, join ({inDATName, cutDATName, edgesDATName})) |
d6b4ed3bf169
ask the user for isecalc's path if adding edges to intersector output and no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
452
diff
changeset
|
483 | ) |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
484 | insertOutput (edgesDATName, false, {}); |
203
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
485 | } |
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
486 | |
301
ef51681bb978
Added an ui file for a to-be edger2 launcher
Santeri Piippo <crimsondusk64@gmail.com>
parents:
300
diff
changeset
|
487 | // ============================================================================= |
455
c5d14d112034
Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
454
diff
changeset
|
488 | // ----------------------------------------------------------------------------- |
387
248296088f2c
moved ext program action definitions to extprogs.cpp rather than proxying it through gui_editactions.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
382
diff
changeset
|
489 | DEFINE_ACTION (Coverer, 0) { |
203
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
490 | setlocale (LC_ALL, "C"); |
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
491 | |
454
d6b4ed3bf169
ask the user for isecalc's path if adding edges to intersector output and no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
452
diff
changeset
|
492 | if (!checkProgPath (Coverer)) |
203
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
493 | return; |
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
494 | |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
495 | QDialog* dlg = new QDialog; |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
496 | Ui::CovererUI ui; |
378 | 497 | ui.setupUi (dlg); |
498 | makeColorSelector (ui.cmb_col1); | |
499 | makeColorSelector (ui.cmb_col2); | |
203
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
500 | |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
501 | short in1Col, in2Col; |
378 | 502 | |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
503 | for (;;) { |
378 | 504 | if (!dlg->exec()) |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
505 | return; |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
506 | |
378 | 507 | in1Col = ui.cmb_col1->itemData (ui.cmb_col1->currentIndex()).toInt(); |
508 | in2Col = ui.cmb_col2->itemData (ui.cmb_col2->currentIndex()).toInt(); | |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
509 | |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
510 | if (in1Col == in2Col) { |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
511 | critical ("Cannot use the same color group for both input and cutter!"); |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
512 | continue; |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
513 | } |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
514 | break; |
203
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
515 | } |
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
516 | |
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
517 | QTemporaryFile in1dat, in2dat, outdat; |
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
518 | str in1DATName, in2DATName, outDATName; |
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
519 | |
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
520 | if (!mkTempFile (in1dat, in1DATName) || !mkTempFile (in2dat, in2DATName) || !mkTempFile (outdat, outDATName)) |
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
521 | return; |
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
522 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
409
diff
changeset
|
523 | str argv = join ({ |
378 | 524 | (ui.cb_oldsweep->isChecked() ? "-s" : ""), |
525 | (ui.cb_reverse->isChecked() ? "-r" : ""), | |
526 | (ui.dsb_segsplit->value() != 0 ? fmt ("-l %1", ui.dsb_segsplit->value()) : ""), | |
527 | (ui.sb_bias->value() != 0 ? fmt ("-s %1", ui.sb_bias->value()) : ""), | |
286
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
528 | in1DATName, |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
529 | in2DATName, |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
530 | outDATName |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
531 | }); |
203
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
532 | |
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
533 | writeColorGroup (in1Col, in1DATName); |
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
534 | writeColorGroup (in2Col, in2DATName); |
303
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
535 | |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
536 | if (!runUtilityProcess (Coverer, prog_coverer, argv)) |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
537 | return; |
8899806d382d
Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
302
diff
changeset
|
538 | |
203
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
539 | insertOutput (outDATName, false, {}); |
205
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
540 | } |
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
541 | |
301
ef51681bb978
Added an ui file for a to-be edger2 launcher
Santeri Piippo <crimsondusk64@gmail.com>
parents:
300
diff
changeset
|
542 | // ============================================================================= |
455
c5d14d112034
Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
454
diff
changeset
|
543 | // ----------------------------------------------------------------------------- |
387
248296088f2c
moved ext program action definitions to extprogs.cpp rather than proxying it through gui_editactions.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
382
diff
changeset
|
544 | DEFINE_ACTION (Isecalc, 0) { |
205
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
545 | setlocale (LC_ALL, "C"); |
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
546 | |
454
d6b4ed3bf169
ask the user for isecalc's path if adding edges to intersector output and no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
452
diff
changeset
|
547 | if (!checkProgPath (Isecalc)) |
205
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
548 | return; |
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
549 | |
302
08bd2c185b25
Converted Isecalc front-end dialog to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
301
diff
changeset
|
550 | Ui::IsecalcUI ui; |
08bd2c185b25
Converted Isecalc front-end dialog to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
301
diff
changeset
|
551 | QDialog* dlg = new QDialog; |
378 | 552 | ui.setupUi (dlg); |
205
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
553 | |
378 | 554 | makeColorSelector (ui.cmb_col1); |
555 | makeColorSelector (ui.cmb_col2); | |
302
08bd2c185b25
Converted Isecalc front-end dialog to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
301
diff
changeset
|
556 | |
08bd2c185b25
Converted Isecalc front-end dialog to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
301
diff
changeset
|
557 | short in1Col, in2Col; |
205
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
558 | |
302
08bd2c185b25
Converted Isecalc front-end dialog to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
301
diff
changeset
|
559 | // Run the dialog and validate input |
378 | 560 | for (;;) { |
561 | if (!dlg->exec()) | |
302
08bd2c185b25
Converted Isecalc front-end dialog to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
301
diff
changeset
|
562 | return; |
08bd2c185b25
Converted Isecalc front-end dialog to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
301
diff
changeset
|
563 | |
378 | 564 | in1Col = ui.cmb_col1->itemData (ui.cmb_col1->currentIndex()).toInt(), |
565 | in2Col = ui.cmb_col1->itemData (ui.cmb_col2->currentIndex()).toInt(); | |
302
08bd2c185b25
Converted Isecalc front-end dialog to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
301
diff
changeset
|
566 | |
08bd2c185b25
Converted Isecalc front-end dialog to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
301
diff
changeset
|
567 | if (in1Col == in2Col) { |
08bd2c185b25
Converted Isecalc front-end dialog to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
301
diff
changeset
|
568 | critical ("Cannot use the same color group for both input and cutter!"); |
08bd2c185b25
Converted Isecalc front-end dialog to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
301
diff
changeset
|
569 | continue; |
08bd2c185b25
Converted Isecalc front-end dialog to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
301
diff
changeset
|
570 | } |
08bd2c185b25
Converted Isecalc front-end dialog to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
301
diff
changeset
|
571 | |
08bd2c185b25
Converted Isecalc front-end dialog to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
301
diff
changeset
|
572 | break; |
205
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
573 | } |
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
574 | |
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
575 | QTemporaryFile in1dat, in2dat, outdat; |
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
576 | str in1DATName, in2DATName, outDATName; |
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
577 | |
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
578 | if (!mkTempFile (in1dat, in1DATName) || !mkTempFile (in2dat, in2DATName) || !mkTempFile (outdat, outDATName)) |
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
579 | return; |
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
580 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
409
diff
changeset
|
581 | str argv = join ({ |
286
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
582 | in1DATName, |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
583 | in2DATName, |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
584 | outDATName |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
585 | }); |
205
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
586 | |
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
587 | writeColorGroup (in1Col, in1DATName); |
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
588 | writeColorGroup (in2Col, in2DATName); |
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
589 | runUtilityProcess (Isecalc, prog_isecalc, argv); |
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
590 | insertOutput (outDATName, false, {}); |
301
ef51681bb978
Added an ui file for a to-be edger2 launcher
Santeri Piippo <crimsondusk64@gmail.com>
parents:
300
diff
changeset
|
591 | } |
ef51681bb978
Added an ui file for a to-be edger2 launcher
Santeri Piippo <crimsondusk64@gmail.com>
parents:
300
diff
changeset
|
592 | |
ef51681bb978
Added an ui file for a to-be edger2 launcher
Santeri Piippo <crimsondusk64@gmail.com>
parents:
300
diff
changeset
|
593 | // ============================================================================= |
455
c5d14d112034
Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
454
diff
changeset
|
594 | // ----------------------------------------------------------------------------- |
382
c1642530ea35
Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
379
diff
changeset
|
595 | DEFINE_ACTION (Edger2, 0) { |
343
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
596 | setlocale (LC_ALL, "C"); |
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
597 | |
454
d6b4ed3bf169
ask the user for isecalc's path if adding edges to intersector output and no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
452
diff
changeset
|
598 | if (!checkProgPath (Edger2)) |
343
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
599 | return; |
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
600 | |
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
601 | QDialog* dlg = new QDialog; |
301
ef51681bb978
Added an ui file for a to-be edger2 launcher
Santeri Piippo <crimsondusk64@gmail.com>
parents:
300
diff
changeset
|
602 | Ui::Edger2Dialog ui; |
378 | 603 | ui.setupUi (dlg); |
343
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
604 | |
378 | 605 | if (!dlg->exec()) |
343
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
606 | return; |
301
ef51681bb978
Added an ui file for a to-be edger2 launcher
Santeri Piippo <crimsondusk64@gmail.com>
parents:
300
diff
changeset
|
607 | |
343
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
608 | QTemporaryFile in, out; |
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
609 | str inName, outName; |
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
610 | |
378 | 611 | if (!mkTempFile (in, inName) || !mkTempFile (out, outName)) |
301
ef51681bb978
Added an ui file for a to-be edger2 launcher
Santeri Piippo <crimsondusk64@gmail.com>
parents:
300
diff
changeset
|
612 | return; |
ef51681bb978
Added an ui file for a to-be edger2 launcher
Santeri Piippo <crimsondusk64@gmail.com>
parents:
300
diff
changeset
|
613 | |
343
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
614 | int unmatched = ui.unmatched->currentIndex(); |
301
ef51681bb978
Added an ui file for a to-be edger2 launcher
Santeri Piippo <crimsondusk64@gmail.com>
parents:
300
diff
changeset
|
615 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
409
diff
changeset
|
616 | str argv = join ({ |
378 | 617 | fmt ("-p %1", ui.precision->value()), |
618 | fmt ("-af %1", ui.flatAngle->value()), | |
619 | fmt ("-ac %1", ui.condAngle->value()), | |
620 | fmt ("-ae %1", ui.edgeAngle->value()), | |
343
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
621 | ui.delLines->isChecked() ? "-de" : "", |
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
622 | ui.delCondLines->isChecked() ? "-dc" : "", |
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
623 | ui.colored->isChecked() ? "-c" : "", |
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
624 | ui.bfc->isChecked() ? "-b" : "", |
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
625 | ui.convex->isChecked() ? "-cx" : "", |
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
626 | ui.concave->isChecked() ? "-cv" : "", |
378 | 627 | unmatched == 0 ? "-u+" : (unmatched == 2 ? "-u-" : ""), |
343
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
628 | inName, |
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
629 | outName, |
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
630 | }); |
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
631 | |
378 | 632 | writeSelection (inName); |
343
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
633 | |
378 | 634 | if (!runUtilityProcess (Edger2, prog_edger2, argv)) |
343
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
635 | return; |
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
636 | |
378 | 637 | insertOutput (outName, true, {}); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
638 | } |