Wed, 16 Oct 2013 16:47:40 +0300
Removed the List -> QList alias, use QList directly
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 | |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
42 | enum extprog |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
43 | { Isecalc, |
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
|
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 | |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
60 | StringConfig* const g_extProgPaths[] = |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
61 | { &prog_isecalc, |
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
|
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 | |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
77 | BoolConfig* const g_extProgWine[] = |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
78 | { &prog_isecalc_wine, |
300
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 | |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
87 | const char* g_extProgNames[] = |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
88 | { "Isecalc", |
183
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 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
98 | static bool checkProgPath (const extprog prog) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
99 | { alias path = g_extProgPaths[prog]->value; |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
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; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
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]); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
105 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
106 | if (dlg->exec() && !dlg->getPath().isEmpty()) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
107 | { 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
|
108 | 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
|
109 | } |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
110 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
111 | return false; |
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 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
114 | // ============================================================================= |
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
|
115 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
116 | static str processErrorString (QProcess& proc) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
117 | { switch (proc.error()) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
118 | { case QProcess::FailedToStart: |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
119 | return "Failed to start (check your permissions)"; |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
120 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
121 | case QProcess::Crashed: |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
122 | return "Crashed."; |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
123 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
124 | case QProcess::WriteError: |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
125 | case QProcess::ReadError: |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
126 | return "I/O error."; |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
127 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
128 | case QProcess::UnknownError: |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
129 | return "Unknown error"; |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
130 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
131 | case QProcess::Timedout: |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
132 | 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
|
133 | } |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
134 | |
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
|
135 | return ""; |
183
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 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
138 | // ============================================================================= |
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
|
139 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
140 | static bool mkTempFile (QTemporaryFile& tmp, str& fname) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
141 | { if (!tmp.open()) |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
142 | return false; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
143 | |
378 | 144 | fname = tmp.fileName(); |
145 | tmp.close(); | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
146 | return true; |
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 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
149 | // ============================================================================= |
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
|
150 | // ----------------------------------------------------------------------------- |
504
6a1fa662bfc1
Removed the List -> QList alias, use QList directly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
493
diff
changeset
|
151 | void writeObjects (QList<LDObject*>& objects, File& f) |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
152 | { for (LDObject * obj : objects) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
153 | { if (obj->getType() == LDObject::Subfile) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
154 | { LDSubfile* ref = static_cast<LDSubfile*> (obj); |
504
6a1fa662bfc1
Removed the List -> QList alias, use QList directly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
493
diff
changeset
|
155 | QList<LDObject*> objs = ref->inlineContents (LDSubfile::DeepInline); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
156 | |
288
2980d7fd948e
Converted from C-style fopen to the new File class
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
157 | writeObjects (objs, f); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
158 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
159 | for (LDObject * obj : objs) |
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
|
160 | delete obj; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
161 | } |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
162 | else |
378 | 163 | 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
|
164 | } |
e8c47e51e03d
Made drawing an edit mode, allowing me to add more modes in the future
Santeri Piippo <crimsondusk64@gmail.com>
parents:
205
diff
changeset
|
165 | } |
e8c47e51e03d
Made drawing an edit mode, allowing me to add more modes in the future
Santeri Piippo <crimsondusk64@gmail.com>
parents:
205
diff
changeset
|
166 | |
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
|
167 | // ============================================================================= |
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
|
168 | // ----------------------------------------------------------------------------- |
504
6a1fa662bfc1
Removed the List -> QList alias, use QList directly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
493
diff
changeset
|
169 | void writeObjects (QList<LDObject*>& objects, str fname) |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
170 | { // 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
|
171 | File f (fname, File::Write); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
172 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
173 | if (!f) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
174 | { 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
|
175 | return; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
176 | } |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
177 | |
288
2980d7fd948e
Converted from C-style fopen to the new File class
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
178 | writeObjects (objects, f); |
378 | 179 | f.close(); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
180 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
181 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
182 | // ============================================================================= |
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
|
183 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
184 | void writeSelection (str fname) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
185 | { 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
|
186 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
187 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
188 | // ============================================================================= |
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
|
189 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
190 | void writeColorGroup (const short colnum, str fname) |
504
6a1fa662bfc1
Removed the List -> QList alias, use QList directly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
493
diff
changeset
|
191 | { QList<LDObject*> objects; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
192 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
193 | for (LDObject * obj : LDFile::current()->objects()) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
194 | { 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
|
195 | continue; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
196 | |
252
3f9067022d74
Take the aforementioned operator<< into use
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
197 | objects << obj; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
198 | } |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
199 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
200 | writeObjects (objects, fname); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
201 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
202 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
203 | // ============================================================================= |
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
|
204 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
205 | bool runUtilityProcess (extprog prog, str path, str argvstr) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
206 | { QTemporaryFile input, output; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
207 | str inputname, outputname; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
208 | QStringList argv = argvstr.split (" ", QString::SkipEmptyParts); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
209 | |
300
0c7e00cc3d44
Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents:
288
diff
changeset
|
210 | #ifndef _WIN32 |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
211 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
212 | if (*g_extProgWine[prog]) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
213 | { argv.insert (0, path); |
300
0c7e00cc3d44
Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents:
288
diff
changeset
|
214 | path = "wine"; |
0c7e00cc3d44
Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents:
288
diff
changeset
|
215 | } |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
216 | |
300
0c7e00cc3d44
Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents:
288
diff
changeset
|
217 | #endif // _WIN32 |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
218 | |
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 | print ("cmdline: %1 %2\n", path, argv.join (" ")); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
220 | |
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
|
221 | // Temporary files for stdin and stdout |
378 | 222 | 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
|
223 | return false; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
224 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
225 | QProcess proc; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
226 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
227 | // Init stdin |
288
2980d7fd948e
Converted from C-style fopen to the new File class
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
228 | File stdinfp (inputname, File::Write); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
229 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
230 | // Begin! |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
231 | proc.setStandardInputFile (inputname); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
232 | proc.start (path, argv); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
233 | |
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
|
234 | // 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
|
235 | stdinfp.write ("\n"); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
236 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
237 | // Wait while it runs |
378 | 238 | proc.waitForFinished(); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
239 | |
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
|
240 | #ifndef RELEASE |
378 | 241 | 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
|
242 | #endif // RELEASE |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
243 | |
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 | str err = ""; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
245 | |
378 | 246 | if (proc.exitStatus() != QProcess::NormalExit) |
305
401b9e3f2d10
Exported Rectifier interface to .ui file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
303
diff
changeset
|
247 | err = processErrorString (proc); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
248 | |
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
|
249 | // 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
|
250 | 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
|
251 | err = fmt ("Program exited abnormally (return code %1).", proc.exitCode()); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
252 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
253 | if (err.length() > 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
254 | { critical (fmt ("%1 failed: %2\n", g_extProgNames[prog], err)); |
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
|
255 | return false; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
256 | } |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
257 | |
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
|
258 | return true; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
259 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
260 | |
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
|
261 | // ============================================================================= |
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
|
262 | // ----------------------------------------------------------------------------- |
504
6a1fa662bfc1
Removed the List -> QList alias, use QList directly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
493
diff
changeset
|
263 | static void insertOutput (str fname, bool replace, QList<short> colorsToReplace) |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
264 | { |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
265 | #ifndef RELEASE |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
266 | 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
|
267 | #endif // RELEASE |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
268 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
269 | // 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
|
270 | File f (fname, File::Read); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
271 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
272 | if (!f) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
273 | { 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
|
274 | return; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
275 | } |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
276 | |
504
6a1fa662bfc1
Removed the List -> QList alias, use QList directly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
493
diff
changeset
|
277 | QList<LDObject*> objs = loadFileContents (&f, null); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
278 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
279 | // 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
|
280 | if (replace) |
378 | 281 | g_win->deleteSelection(); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
282 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
283 | for (const short colnum : colorsToReplace) |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
252
diff
changeset
|
284 | g_win->deleteByColor (colnum); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
285 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
286 | // Insert the new objects |
378 | 287 | g_win->sel().clear(); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
288 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
289 | for (LDObject * obj : objs) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
290 | { if (!obj->isScemantic()) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
291 | { delete obj; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
292 | continue; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
293 | } |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
294 | |
409
8da2563c645a
Renamed LDOpenFile to LDFile
Santeri Piippo <crimsondusk64@gmail.com>
parents:
402
diff
changeset
|
295 | LDFile::current()->addObject (obj); |
378 | 296 | 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
|
297 | } |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
298 | |
378 | 299 | g_win->fullRefresh(); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
300 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
301 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
302 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
303 | // 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
|
304 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
305 | DEFINE_ACTION (Ytruder, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
306 | { setlocale (LC_ALL, "C"); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
307 | |
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
|
308 | if (!checkProgPath (Ytruder)) |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
309 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
310 | |
345
1376ad3262ba
Converted Ytruder interface to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
343
diff
changeset
|
311 | QDialog* dlg = new QDialog; |
1376ad3262ba
Converted Ytruder interface to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
343
diff
changeset
|
312 | Ui::YtruderUI ui; |
378 | 313 | ui.setupUi (dlg); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
314 | |
378 | 315 | if (!dlg->exec()) |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
316 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
317 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
318 | // Read the user's choices |
345
1376ad3262ba
Converted Ytruder interface to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
343
diff
changeset
|
319 | const enum { Distance, Symmetry, Projection, Radial } mode = |
1376ad3262ba
Converted Ytruder interface to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
343
diff
changeset
|
320 | ui.mode_distance->isChecked() ? Distance : |
1376ad3262ba
Converted Ytruder interface to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
343
diff
changeset
|
321 | ui.mode_symmetry->isChecked() ? Symmetry : |
1376ad3262ba
Converted Ytruder interface to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
343
diff
changeset
|
322 | ui.mode_projection->isChecked() ? Projection : Radial; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
323 | |
345
1376ad3262ba
Converted Ytruder interface to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
343
diff
changeset
|
324 | const Axis axis = |
1376ad3262ba
Converted Ytruder interface to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
343
diff
changeset
|
325 | ui.axis_x->isChecked() ? X : |
1376ad3262ba
Converted Ytruder interface to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
343
diff
changeset
|
326 | ui.axis_y->isChecked() ? Y : Z; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
327 | |
345
1376ad3262ba
Converted Ytruder interface to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
343
diff
changeset
|
328 | const double depth = ui.planeDepth->value(), |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
329 | condAngle = ui.condAngle->value(); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
330 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
331 | QTemporaryFile indat, outdat; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
332 | str inDATName, outDATName; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
333 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
334 | // 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
|
335 | 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
|
336 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
337 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
338 | // Compose the command-line arguments |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
339 | str argv = join ( |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
340 | { (axis == X) ? "-x" : (axis == Y) ? "-y" : "-z", |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
341 | (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
|
342 | depth, |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
343 | "-a", |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
344 | condAngle, |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
345 | inDATName, |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
346 | outDATName |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
347 | }); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
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 | writeSelection (inDATName); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
350 | |
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
|
351 | 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
|
352 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
353 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
354 | insertOutput (outDATName, false, {}); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
355 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
356 | |
301
ef51681bb978
Added an ui file for a to-be edger2 launcher
Santeri Piippo <crimsondusk64@gmail.com>
parents:
300
diff
changeset
|
357 | // ============================================================================= |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
358 | // 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
|
359 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
360 | DEFINE_ACTION (Rectifier, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
361 | { setlocale (LC_ALL, "C"); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
362 | |
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
|
363 | if (!checkProgPath (Rectifier)) |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
364 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
365 | |
305
401b9e3f2d10
Exported Rectifier interface to .ui file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
303
diff
changeset
|
366 | QDialog* dlg = new QDialog; |
401b9e3f2d10
Exported Rectifier interface to .ui file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
303
diff
changeset
|
367 | Ui::RectifierUI ui; |
401b9e3f2d10
Exported Rectifier interface to .ui file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
303
diff
changeset
|
368 | ui.setupUi (dlg); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
369 | |
378 | 370 | if (!dlg->exec()) |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
371 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
372 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
373 | QTemporaryFile indat, outdat; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
374 | str inDATName, outDATName; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
375 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
376 | // 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
|
377 | 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
|
378 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
379 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
380 | // Compose arguments |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
381 | str argv = join ( |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
382 | { (!ui.cb_condense->isChecked()) ? "-q" : "", |
378 | 383 | (!ui.cb_subst->isChecked()) ? "-r" : "", |
384 | (ui.cb_condlineCheck->isChecked()) ? "-a" : "", | |
385 | (ui.cb_colorize->isChecked()) ? "-c" : "", | |
286
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
386 | "-t", |
378 | 387 | ui.dsb_coplthres->value(), |
286
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
388 | inDATName, |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
389 | outDATName |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
390 | }); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
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 | writeSelection (inDATName); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
393 | |
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
|
394 | 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
|
395 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
396 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
397 | insertOutput (outDATName, true, {}); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
398 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
399 | |
301
ef51681bb978
Added an ui file for a to-be edger2 launcher
Santeri Piippo <crimsondusk64@gmail.com>
parents:
300
diff
changeset
|
400 | // ============================================================================= |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
401 | // 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
|
402 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
403 | DEFINE_ACTION (Intersector, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
404 | { setlocale (LC_ALL, "C"); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
405 | |
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
|
406 | if (!checkProgPath (Intersector)) |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
407 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
408 | |
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
|
409 | 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
|
410 | Ui::IntersectorUI ui; |
378 | 411 | ui.setupUi (dlg); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
412 | |
378 | 413 | makeColorSelector (ui.cmb_incol); |
414 | makeColorSelector (ui.cmb_cutcol); | |
415 | ui.cb_repeat->setWhatsThis ("If this is set, " APPNAME " runs Intersector a second time with inverse files to cut the " | |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
416 | " cutter group with the input group. Both groups are cut by the intersection."); |
378 | 417 | ui.cb_edges->setWhatsThis ("Makes " APPNAME " try run Isecalc to create edgelines for the intersection."); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
418 | |
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 | short inCol, cutCol; |
378 | 420 | const bool repeatInverse = ui.cb_repeat->isChecked(); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
421 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
422 | for (;;) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
423 | { 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
|
424 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
425 | |
378 | 426 | inCol = ui.cmb_incol->itemData (ui.cmb_incol->currentIndex()).toInt(); |
427 | cutCol = ui.cmb_cutcol->itemData (ui.cmb_cutcol->currentIndex()).toInt(); | |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
428 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
429 | if (inCol == cutCol) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
430 | { critical ("Cannot use the same color group for both input and cutter!"); |
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
|
431 | 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
|
432 | } |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
433 | |
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
|
434 | break; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
435 | } |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
436 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
437 | // Five temporary files! |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
438 | // indat = input group file |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
439 | // cutdat = cutter group file |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
440 | // outdat = primary output |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
441 | // outdat2 = inverse output |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
442 | // edgesdat = edges output (isecalc) |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
443 | 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
|
444 | str inDATName, cutDATName, outDATName, outDAT2Name, edgesDATName; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
445 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
446 | if (!mkTempFile (indat, inDATName) || !mkTempFile (cutdat, cutDATName) || |
378 | 447 | !mkTempFile (outdat, outDATName) || !mkTempFile (outdat2, outDAT2Name) || |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
448 | !mkTempFile (edgesdat, edgesDATName)) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
449 | { return; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
450 | } |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
451 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
452 | str parms = join ( |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
453 | { (ui.cb_colorize->isChecked()) ? "-c" : "", |
378 | 454 | (ui.cb_nocondense->isChecked()) ? "-t" : "", |
286
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
455 | "-s", |
378 | 456 | ui.dsb_prescale->value() |
286
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
457 | }); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
458 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
459 | str argv_normal = join ( |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
460 | { parms, |
286
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
461 | inDATName, |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
462 | cutDATName, |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
463 | outDATName |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
464 | }); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
465 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
466 | str argv_inverse = join ( |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
467 | { parms, |
286
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
468 | cutDATName, |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
469 | inDATName, |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
470 | outDAT2Name |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
471 | }); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
472 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
473 | writeColorGroup (inCol, inDATName); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
474 | writeColorGroup (cutCol, cutDATName); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
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 (!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
|
477 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
478 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
479 | insertOutput (outDATName, false, {inCol}); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
480 | |
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
|
481 | 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
|
482 | insertOutput (outDAT2Name, false, {cutCol}); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
483 | |
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
|
484 | 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
|
485 | 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
|
486 | checkProgPath (Isecalc) && |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
487 | runUtilityProcess (Isecalc, prog_isecalc, join ( {inDATName, cutDATName, edgesDATName})) |
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
|
488 | ) |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
489 | insertOutput (edgesDATName, false, {}); |
203
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
490 | } |
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
491 | |
301
ef51681bb978
Added an ui file for a to-be edger2 launcher
Santeri Piippo <crimsondusk64@gmail.com>
parents:
300
diff
changeset
|
492 | // ============================================================================= |
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
|
493 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
494 | DEFINE_ACTION (Coverer, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
495 | { setlocale (LC_ALL, "C"); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
496 | |
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
|
497 | if (!checkProgPath (Coverer)) |
203
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
498 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
499 | |
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
|
500 | 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
|
501 | Ui::CovererUI ui; |
378 | 502 | ui.setupUi (dlg); |
503 | makeColorSelector (ui.cmb_col1); | |
504 | makeColorSelector (ui.cmb_col2); | |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
505 | |
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
|
506 | short in1Col, in2Col; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
507 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
508 | for (;;) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
509 | { 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
|
510 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
511 | |
378 | 512 | in1Col = ui.cmb_col1->itemData (ui.cmb_col1->currentIndex()).toInt(); |
513 | in2Col = ui.cmb_col2->itemData (ui.cmb_col2->currentIndex()).toInt(); | |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
514 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
515 | if (in1Col == in2Col) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
516 | { critical ("Cannot use the same color group for both input and cutter!"); |
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
|
517 | 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
|
518 | } |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
519 | |
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
|
520 | break; |
203
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
521 | } |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
522 | |
203
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
523 | QTemporaryFile in1dat, in2dat, outdat; |
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
524 | str in1DATName, in2DATName, outDATName; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
525 | |
203
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
526 | if (!mkTempFile (in1dat, in1DATName) || !mkTempFile (in2dat, in2DATName) || !mkTempFile (outdat, outDATName)) |
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
527 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
528 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
529 | str argv = join ( |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
530 | { (ui.cb_oldsweep->isChecked() ? "-s" : ""), |
378 | 531 | (ui.cb_reverse->isChecked() ? "-r" : ""), |
532 | (ui.dsb_segsplit->value() != 0 ? fmt ("-l %1", ui.dsb_segsplit->value()) : ""), | |
533 | (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
|
534 | in1DATName, |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
535 | in2DATName, |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
536 | outDATName |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
537 | }); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
538 | |
203
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
539 | writeColorGroup (in1Col, in1DATName); |
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
540 | writeColorGroup (in2Col, in2DATName); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
541 | |
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
|
542 | 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
|
543 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
544 | |
203
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
545 | insertOutput (outDATName, false, {}); |
205
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
546 | } |
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
547 | |
301
ef51681bb978
Added an ui file for a to-be edger2 launcher
Santeri Piippo <crimsondusk64@gmail.com>
parents:
300
diff
changeset
|
548 | // ============================================================================= |
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
|
549 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
550 | DEFINE_ACTION (Isecalc, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
551 | { setlocale (LC_ALL, "C"); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
552 | |
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
|
553 | if (!checkProgPath (Isecalc)) |
205
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
554 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
555 | |
302
08bd2c185b25
Converted Isecalc front-end dialog to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
301
diff
changeset
|
556 | Ui::IsecalcUI ui; |
08bd2c185b25
Converted Isecalc front-end dialog to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
301
diff
changeset
|
557 | QDialog* dlg = new QDialog; |
378 | 558 | ui.setupUi (dlg); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
559 | |
378 | 560 | makeColorSelector (ui.cmb_col1); |
561 | makeColorSelector (ui.cmb_col2); | |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
562 | |
302
08bd2c185b25
Converted Isecalc front-end dialog to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
301
diff
changeset
|
563 | short in1Col, in2Col; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
564 | |
302
08bd2c185b25
Converted Isecalc front-end dialog to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
301
diff
changeset
|
565 | // Run the dialog and validate input |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
566 | for (;;) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
567 | { if (!dlg->exec()) |
302
08bd2c185b25
Converted Isecalc front-end dialog to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
301
diff
changeset
|
568 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
569 | |
378 | 570 | in1Col = ui.cmb_col1->itemData (ui.cmb_col1->currentIndex()).toInt(), |
571 | in2Col = ui.cmb_col1->itemData (ui.cmb_col2->currentIndex()).toInt(); | |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
572 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
573 | if (in1Col == in2Col) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
574 | { critical ("Cannot use the same color group for both input and cutter!"); |
302
08bd2c185b25
Converted Isecalc front-end dialog to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
301
diff
changeset
|
575 | continue; |
08bd2c185b25
Converted Isecalc front-end dialog to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
301
diff
changeset
|
576 | } |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
577 | |
302
08bd2c185b25
Converted Isecalc front-end dialog to Designer UI
Santeri Piippo <crimsondusk64@gmail.com>
parents:
301
diff
changeset
|
578 | break; |
205
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
579 | } |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
580 | |
205
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
581 | QTemporaryFile in1dat, in2dat, outdat; |
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
582 | str in1DATName, in2DATName, outDATName; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
583 | |
205
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
584 | if (!mkTempFile (in1dat, in1DATName) || !mkTempFile (in2dat, in2DATName) || !mkTempFile (outdat, outDATName)) |
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
585 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
586 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
587 | str argv = join ( |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
588 | { in1DATName, |
286
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
589 | in2DATName, |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
590 | outDATName |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
591 | }); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
592 | |
205
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
593 | writeColorGroup (in1Col, in1DATName); |
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
594 | writeColorGroup (in2Col, in2DATName); |
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
595 | runUtilityProcess (Isecalc, prog_isecalc, argv); |
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
596 | insertOutput (outDATName, false, {}); |
301
ef51681bb978
Added an ui file for a to-be edger2 launcher
Santeri Piippo <crimsondusk64@gmail.com>
parents:
300
diff
changeset
|
597 | } |
ef51681bb978
Added an ui file for a to-be edger2 launcher
Santeri Piippo <crimsondusk64@gmail.com>
parents:
300
diff
changeset
|
598 | |
ef51681bb978
Added an ui file for a to-be edger2 launcher
Santeri Piippo <crimsondusk64@gmail.com>
parents:
300
diff
changeset
|
599 | // ============================================================================= |
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
|
600 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
601 | DEFINE_ACTION (Edger2, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
602 | { setlocale (LC_ALL, "C"); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
603 | |
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
|
604 | if (!checkProgPath (Edger2)) |
343
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
605 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
606 | |
343
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
607 | 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
|
608 | Ui::Edger2Dialog ui; |
378 | 609 | ui.setupUi (dlg); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
610 | |
378 | 611 | if (!dlg->exec()) |
343
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
612 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
613 | |
343
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
614 | QTemporaryFile in, out; |
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
615 | str inName, outName; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
616 | |
378 | 617 | 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
|
618 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
619 | |
343
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
620 | int unmatched = ui.unmatched->currentIndex(); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
621 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
622 | str argv = join ( |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
623 | { fmt ("-p %1", ui.precision->value()), |
378 | 624 | fmt ("-af %1", ui.flatAngle->value()), |
625 | fmt ("-ac %1", ui.condAngle->value()), | |
626 | fmt ("-ae %1", ui.edgeAngle->value()), | |
343
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
627 | ui.delLines->isChecked() ? "-de" : "", |
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
628 | ui.delCondLines->isChecked() ? "-dc" : "", |
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
629 | ui.colored->isChecked() ? "-c" : "", |
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
630 | ui.bfc->isChecked() ? "-b" : "", |
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
631 | ui.convex->isChecked() ? "-cx" : "", |
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
632 | ui.concave->isChecked() ? "-cv" : "", |
378 | 633 | unmatched == 0 ? "-u+" : (unmatched == 2 ? "-u-" : ""), |
343
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
634 | inName, |
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
635 | outName, |
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
636 | }); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
637 | |
378 | 638 | writeSelection (inName); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
639 | |
378 | 640 | if (!runUtilityProcess (Edger2, prog_edger2, argv)) |
343
75487752f3e6
Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
641 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
642 | |
378 | 643 | insertOutput (outName, true, {}); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
484
diff
changeset
|
644 | } |