src/extPrograms.cc

changeset 861
83426c5fa732
parent 859
ebc7a186699c
child 879
c5b3bc08e609
equal deleted inserted replaced
860:a496e72af069 861:83426c5fa732
95 "Edger2" 95 "Edger2"
96 }; 96 };
97 97
98 // ============================================================================= 98 // =============================================================================
99 // 99 //
100 static bool mkTempFile (QTemporaryFile& tmp, QString& fname) 100 static bool MakeTempFile (QTemporaryFile& tmp, QString& fname)
101 { 101 {
102 if (not tmp.open()) 102 if (not tmp.open())
103 return false; 103 return false;
104 104
105 fname = tmp.fileName(); 105 fname = tmp.fileName();
107 return true; 107 return true;
108 } 108 }
109 109
110 // ============================================================================= 110 // =============================================================================
111 // 111 //
112 static bool checkProgPath (const extprog prog) 112 static bool CheckExtProgramPath (const extprog prog)
113 { 113 {
114 QString& path = *g_extProgPaths[prog]; 114 QString& path = *g_extProgPaths[prog];
115 115
116 if (path.length() > 0) 116 if (not path.isEmpty())
117 return true; 117 return true;
118 118
119 ExtProgPathPrompt* dlg = new ExtProgPathPrompt (g_extProgNames[prog]); 119 ExtProgPathPrompt* dlg = new ExtProgPathPrompt (g_extProgNames[prog]);
120 120
121 if (dlg->exec() and not dlg->getPath().isEmpty()) 121 if (dlg->exec() and not dlg->getPath().isEmpty())
127 return false; 127 return false;
128 } 128 }
129 129
130 // ============================================================================= 130 // =============================================================================
131 // 131 //
132 static QString processErrorString (extprog prog, QProcess& proc) 132 static QString ProcessExtProgError (extprog prog, QProcess& proc)
133 { 133 {
134 switch (proc.error()) 134 switch (proc.error())
135 { 135 {
136 case QProcess::FailedToStart: 136 case QProcess::FailedToStart:
137 { 137 {
164 return ""; 164 return "";
165 } 165 }
166 166
167 // ============================================================================= 167 // =============================================================================
168 // 168 //
169 static void writeObjects (const LDObjectList& objects, QFile& f) 169 static void WriteObjects (const LDObjectList& objects, QFile& f)
170 { 170 {
171 for (LDObjectPtr obj : objects) 171 for (LDObjectPtr obj : objects)
172 { 172 {
173 if (obj->type() == OBJ_Subfile) 173 if (obj->type() == OBJ_Subfile)
174 { 174 {
175 LDSubfilePtr ref = obj.staticCast<LDSubfile>(); 175 LDSubfilePtr ref = obj.staticCast<LDSubfile>();
176 LDObjectList objs = ref->inlineContents (true, false); 176 LDObjectList objs = ref->inlineContents (true, false);
177 177
178 writeObjects (objs, f); 178 WriteObjects (objs, f);
179 179
180 for (LDObjectPtr obj : objs) 180 for (LDObjectPtr obj : objs)
181 obj->destroy(); 181 obj->destroy();
182 } 182 }
183 else 183 else
185 } 185 }
186 } 186 }
187 187
188 // ============================================================================= 188 // =============================================================================
189 // 189 //
190 static void writeObjects (const LDObjectList& objects, QString fname) 190 static void WriteObjects (const LDObjectList& objects, QString fname)
191 { 191 {
192 // Write the input file 192 // Write the input file
193 QFile f (fname); 193 QFile f (fname);
194 194
195 if (not f.open (QIODevice::WriteOnly | QIODevice::Text)) 195 if (not f.open (QIODevice::WriteOnly | QIODevice::Text))
196 { 196 {
197 critical (format ("Couldn't open temporary file %1 for writing: %2\n", fname, f.errorString())); 197 CriticalError (format ("Couldn't open temporary file %1 for writing: %2\n", fname, f.errorString()));
198 return; 198 return;
199 } 199 }
200 200
201 writeObjects (objects, f); 201 WriteObjects (objects, f);
202 f.close(); 202 f.close();
203 203
204 #ifdef DEBUG 204 #ifdef DEBUG
205 QFile::copy (fname, "debug_lastInput"); 205 QFile::copy (fname, "debug_lastInput");
206 #endif 206 #endif
207 } 207 }
208 208
209 // ============================================================================= 209 // =============================================================================
210 // 210 //
211 void writeSelection (QString fname) 211 void WriteSelection (QString fname)
212 { 212 {
213 writeObjects (selection(), fname); 213 WriteObjects (Selection(), fname);
214 } 214 }
215 215
216 // ============================================================================= 216 // =============================================================================
217 // 217 //
218 void writeColorGroup (LDColor color, QString fname) 218 void WriteColorGroup (LDColor color, QString fname)
219 { 219 {
220 LDObjectList objects; 220 LDObjectList objects;
221 221
222 for (LDObjectPtr obj : getCurrentDocument()->objects()) 222 for (LDObjectPtr obj : CurrentDocument()->objects())
223 { 223 {
224 if (not obj->isColored() or obj->color() != color) 224 if (not obj->isColored() or obj->color() != color)
225 continue; 225 continue;
226 226
227 objects << obj; 227 objects << obj;
228 } 228 }
229 229
230 writeObjects (objects, fname); 230 WriteObjects (objects, fname);
231 } 231 }
232 232
233 // ============================================================================= 233 // =============================================================================
234 // 234 //
235 bool runUtilityProcess (extprog prog, QString path, QString argvstr) 235 bool RunExtProgram (extprog prog, QString path, QString argvstr)
236 { 236 {
237 QTemporaryFile input; 237 QTemporaryFile input;
238 QStringList argv = argvstr.split (" ", QString::SkipEmptyParts); 238 QStringList argv = argvstr.split (" ", QString::SkipEmptyParts);
239 239
240 #ifndef _WIN32 240 #ifndef _WIN32
256 proc.setStandardInputFile (input.fileName()); 256 proc.setStandardInputFile (input.fileName());
257 proc.start (path, argv); 257 proc.start (path, argv);
258 258
259 if (not proc.waitForStarted()) 259 if (not proc.waitForStarted())
260 { 260 {
261 critical (format ("Couldn't start %1: %2\n", g_extProgNames[prog], processErrorString (prog, proc))); 261 CriticalError (format ("Couldn't start %1: %2\n", g_extProgNames[prog], ProcessExtProgError (prog, proc)));
262 return false; 262 return false;
263 } 263 }
264 264
265 // Write an enter, the utility tools all expect one 265 // Write an enter, the utility tools all expect one
266 input.write ("\n"); 266 input.write ("\n");
269 proc.waitForFinished(); 269 proc.waitForFinished();
270 270
271 QString err = ""; 271 QString err = "";
272 272
273 if (proc.exitStatus() != QProcess::NormalExit) 273 if (proc.exitStatus() != QProcess::NormalExit)
274 err = processErrorString (prog, proc); 274 err = ProcessExtProgError (prog, proc);
275 275
276 // Check the return code 276 // Check the return code
277 if (proc.exitCode() != 0) 277 if (proc.exitCode() != 0)
278 err = format ("Program exited abnormally (return code %1).", proc.exitCode()); 278 err = format ("Program exited abnormally (return code %1).", proc.exitCode());
279 279
280 if (not err.isEmpty()) 280 if (not err.isEmpty())
281 { 281 {
282 critical (format ("%1 failed: %2\n", g_extProgNames[prog], err)); 282 CriticalError (format ("%1 failed: %2\n", g_extProgNames[prog], err));
283 return false; 283 return false;
284 } 284 }
285 285
286 return true; 286 return true;
287 } 287 }
288 288
289 // ============================================================================= 289 // =============================================================================
290 // 290 //
291 static void insertOutput (QString fname, bool replace, QList<LDColor> colorsToReplace) 291 static void InsertOutput (QString fname, bool replace, QList<LDColor> colorsToReplace)
292 { 292 {
293 #ifdef DEBUG 293 #ifdef DEBUG
294 QFile::copy (fname, "./debug_lastOutput"); 294 QFile::copy (fname, "./debug_lastOutput");
295 #endif // RELEASE 295 #endif // RELEASE
296 296
297 // Read the output file 297 // Read the output file
298 QFile f (fname); 298 QFile f (fname);
299 299
300 if (not f.open (QIODevice::ReadOnly)) 300 if (not f.open (QIODevice::ReadOnly))
301 { 301 {
302 critical (format ("Couldn't open temporary file %1 for reading.\n", fname)); 302 CriticalError (format ("Couldn't open temporary file %1 for reading.\n", fname));
303 return; 303 return;
304 } 304 }
305 305
306 LDObjectList objs = loadFileContents (&f, null); 306 LDObjectList objs = LoadFileContents (&f, null);
307 307
308 // If we replace the objects, delete the selection now. 308 // If we replace the objects, delete the selection now.
309 if (replace) 309 if (replace)
310 g_win->deleteSelection(); 310 g_win->deleteSelection();
311 311
312 for (LDColor color : colorsToReplace) 312 for (LDColor color : colorsToReplace)
313 g_win->deleteByColor (color); 313 g_win->deleteByColor (color);
314 314
315 // Insert the new objects 315 // Insert the new objects
316 getCurrentDocument()->clearSelection(); 316 CurrentDocument()->clearSelection();
317 317
318 for (LDObjectPtr obj : objs) 318 for (LDObjectPtr obj : objs)
319 { 319 {
320 if (not obj->isScemantic()) 320 if (not obj->isScemantic())
321 { 321 {
322 obj->destroy(); 322 obj->destroy();
323 continue; 323 continue;
324 } 324 }
325 325
326 getCurrentDocument()->addObject (obj); 326 CurrentDocument()->addObject (obj);
327 obj->select(); 327 obj->select();
328 } 328 }
329 329
330 g_win->doFullRefresh(); 330 g_win->doFullRefresh();
331 } 331 }
335 // ============================================================================= 335 // =============================================================================
336 void MainWindow::slot_actionYtruder() 336 void MainWindow::slot_actionYtruder()
337 { 337 {
338 setlocale (LC_ALL, "C"); 338 setlocale (LC_ALL, "C");
339 339
340 if (not checkProgPath (Ytruder)) 340 if (not CheckExtProgramPath (Ytruder))
341 return; 341 return;
342 342
343 QDialog* dlg = new QDialog; 343 QDialog* dlg = new QDialog;
344 Ui::YtruderUI ui; 344 Ui::YtruderUI ui;
345 ui.setupUi (dlg); 345 ui.setupUi (dlg);
362 362
363 QTemporaryFile indat, outdat; 363 QTemporaryFile indat, outdat;
364 QString inDATName, outDATName; 364 QString inDATName, outDATName;
365 365
366 // Make temp files for the input and output files 366 // Make temp files for the input and output files
367 if (not mkTempFile (indat, inDATName) or not mkTempFile (outdat, outDATName)) 367 if (not MakeTempFile (indat, inDATName) or not MakeTempFile (outdat, outDATName))
368 return; 368 return;
369 369
370 // Compose the command-line arguments 370 // Compose the command-line arguments
371 QString argv = Join ( 371 QString argv = Join (
372 { 372 {
377 condAngle, 377 condAngle,
378 inDATName, 378 inDATName,
379 outDATName 379 outDATName
380 }); 380 });
381 381
382 writeSelection (inDATName); 382 WriteSelection (inDATName);
383 383
384 if (not runUtilityProcess (Ytruder, cfg::YtruderPath, argv)) 384 if (not RunExtProgram (Ytruder, cfg::YtruderPath, argv))
385 return; 385 return;
386 386
387 insertOutput (outDATName, false, {}); 387 InsertOutput (outDATName, false, {});
388 } 388 }
389 389
390 // ============================================================================= 390 // =============================================================================
391 // Rectifier interface 391 // Rectifier interface
392 // ============================================================================= 392 // =============================================================================
393 void MainWindow::slot_actionRectifier() 393 void MainWindow::slot_actionRectifier()
394 { 394 {
395 setlocale (LC_ALL, "C"); 395 setlocale (LC_ALL, "C");
396 396
397 if (not checkProgPath (Rectifier)) 397 if (not CheckExtProgramPath (Rectifier))
398 return; 398 return;
399 399
400 QDialog* dlg = new QDialog; 400 QDialog* dlg = new QDialog;
401 Ui::RectifierUI ui; 401 Ui::RectifierUI ui;
402 ui.setupUi (dlg); 402 ui.setupUi (dlg);
406 406
407 QTemporaryFile indat, outdat; 407 QTemporaryFile indat, outdat;
408 QString inDATName, outDATName; 408 QString inDATName, outDATName;
409 409
410 // Make temp files for the input and output files 410 // Make temp files for the input and output files
411 if (not mkTempFile (indat, inDATName) or not mkTempFile (outdat, outDATName)) 411 if (not MakeTempFile (indat, inDATName) or not MakeTempFile (outdat, outDATName))
412 return; 412 return;
413 413
414 // Compose arguments 414 // Compose arguments
415 QString argv = Join ( 415 QString argv = Join (
416 { 416 {
422 ui.dsb_coplthres->value(), 422 ui.dsb_coplthres->value(),
423 inDATName, 423 inDATName,
424 outDATName 424 outDATName
425 }); 425 });
426 426
427 writeSelection (inDATName); 427 WriteSelection (inDATName);
428 428
429 if (not runUtilityProcess (Rectifier, cfg::RectifierPath, argv)) 429 if (not RunExtProgram (Rectifier, cfg::RectifierPath, argv))
430 return; 430 return;
431 431
432 insertOutput (outDATName, true, {}); 432 InsertOutput (outDATName, true, {});
433 } 433 }
434 434
435 // ============================================================================= 435 // =============================================================================
436 // Intersector interface 436 // Intersector interface
437 // ============================================================================= 437 // =============================================================================
438 void MainWindow::slot_actionIntersector() 438 void MainWindow::slot_actionIntersector()
439 { 439 {
440 setlocale (LC_ALL, "C"); 440 setlocale (LC_ALL, "C");
441 441
442 if (not checkProgPath (Intersector)) 442 if (not CheckExtProgramPath (Intersector))
443 return; 443 return;
444 444
445 QDialog* dlg = new QDialog; 445 QDialog* dlg = new QDialog;
446 Ui::IntersectorUI ui; 446 Ui::IntersectorUI ui;
447 ui.setupUi (dlg); 447 ui.setupUi (dlg);
448 448
449 makeColorComboBox (ui.cmb_incol); 449 MakeColorComboBox (ui.cmb_incol);
450 makeColorComboBox (ui.cmb_cutcol); 450 MakeColorComboBox (ui.cmb_cutcol);
451 ui.cb_repeat->setWhatsThis ("If this is set, " APPNAME " runs Intersector a second time with inverse files to cut the " 451 ui.cb_repeat->setWhatsThis ("If this is set, " APPNAME " runs Intersector a second time with inverse files to cut the "
452 " cutter group with the input group. Both groups are cut by the intersection."); 452 " cutter group with the input group. Both groups are cut by the intersection.");
453 ui.cb_edges->setWhatsThis ("Makes " APPNAME " try run Isecalc to create edgelines for the intersection."); 453 ui.cb_edges->setWhatsThis ("Makes " APPNAME " try run Isecalc to create edgelines for the intersection.");
454 454
455 LDColor inCol, cutCol; 455 LDColor inCol, cutCol;
463 inCol = LDColor::fromIndex (ui.cmb_incol->itemData (ui.cmb_incol->currentIndex()).toInt()); 463 inCol = LDColor::fromIndex (ui.cmb_incol->itemData (ui.cmb_incol->currentIndex()).toInt());
464 cutCol = LDColor::fromIndex (ui.cmb_cutcol->itemData (ui.cmb_cutcol->currentIndex()).toInt()); 464 cutCol = LDColor::fromIndex (ui.cmb_cutcol->itemData (ui.cmb_cutcol->currentIndex()).toInt());
465 465
466 if (inCol == cutCol) 466 if (inCol == cutCol)
467 { 467 {
468 critical ("Cannot use the same color group for both input and cutter!"); 468 CriticalError ("Cannot use the same color group for both input and cutter!");
469 continue; 469 continue;
470 } 470 }
471 471
472 break; 472 break;
473 } 473 }
479 // outdat2 = inverse output 479 // outdat2 = inverse output
480 // edgesdat = edges output (isecalc) 480 // edgesdat = edges output (isecalc)
481 QTemporaryFile indat, cutdat, outdat, outdat2, edgesdat; 481 QTemporaryFile indat, cutdat, outdat, outdat2, edgesdat;
482 QString inDATName, cutDATName, outDATName, outDAT2Name, edgesDATName; 482 QString inDATName, cutDATName, outDATName, outDAT2Name, edgesDATName;
483 483
484 if (not mkTempFile (indat, inDATName) or 484 if (not MakeTempFile (indat, inDATName) or
485 not mkTempFile (cutdat, cutDATName) or 485 not MakeTempFile (cutdat, cutDATName) or
486 not mkTempFile (outdat, outDATName) or 486 not MakeTempFile (outdat, outDATName) or
487 not mkTempFile (outdat2, outDAT2Name) or 487 not MakeTempFile (outdat2, outDAT2Name) or
488 not mkTempFile (edgesdat, edgesDATName)) 488 not MakeTempFile (edgesdat, edgesDATName))
489 { 489 {
490 return; 490 return;
491 } 491 }
492 492
493 QString parms = Join ( 493 QString parms = Join (
512 cutDATName, 512 cutDATName,
513 inDATName, 513 inDATName,
514 outDAT2Name 514 outDAT2Name
515 }); 515 });
516 516
517 writeColorGroup (inCol, inDATName); 517 WriteColorGroup (inCol, inDATName);
518 writeColorGroup (cutCol, cutDATName); 518 WriteColorGroup (cutCol, cutDATName);
519 519
520 if (not runUtilityProcess (Intersector, cfg::IntersectorPath, argv_normal)) 520 if (not RunExtProgram (Intersector, cfg::IntersectorPath, argv_normal))
521 return; 521 return;
522 522
523 insertOutput (outDATName, false, {inCol}); 523 InsertOutput (outDATName, false, {inCol});
524 524
525 if (repeatInverse and runUtilityProcess (Intersector, cfg::IntersectorPath, argv_inverse)) 525 if (repeatInverse and RunExtProgram (Intersector, cfg::IntersectorPath, argv_inverse))
526 insertOutput (outDAT2Name, false, {cutCol}); 526 InsertOutput (outDAT2Name, false, {cutCol});
527 527
528 if (ui.cb_edges->isChecked() and checkProgPath (Isecalc) and 528 if (ui.cb_edges->isChecked() and CheckExtProgramPath (Isecalc) and
529 runUtilityProcess (Isecalc, cfg::IsecalcPath, Join ({inDATName, cutDATName, edgesDATName}))) 529 RunExtProgram (Isecalc, cfg::IsecalcPath, Join ({inDATName, cutDATName, edgesDATName})))
530 { 530 {
531 insertOutput (edgesDATName, false, {}); 531 InsertOutput (edgesDATName, false, {});
532 } 532 }
533 } 533 }
534 534
535 // ============================================================================= 535 // =============================================================================
536 // 536 //
537 void MainWindow::slot_actionCoverer() 537 void MainWindow::slot_actionCoverer()
538 { 538 {
539 setlocale (LC_ALL, "C"); 539 setlocale (LC_ALL, "C");
540 540
541 if (not checkProgPath (Coverer)) 541 if (not CheckExtProgramPath (Coverer))
542 return; 542 return;
543 543
544 QDialog* dlg = new QDialog; 544 QDialog* dlg = new QDialog;
545 Ui::CovererUI ui; 545 Ui::CovererUI ui;
546 ui.setupUi (dlg); 546 ui.setupUi (dlg);
547 makeColorComboBox (ui.cmb_col1); 547 MakeColorComboBox (ui.cmb_col1);
548 makeColorComboBox (ui.cmb_col2); 548 MakeColorComboBox (ui.cmb_col2);
549 549
550 LDColor in1Col, in2Col; 550 LDColor in1Col, in2Col;
551 551
552 forever 552 forever
553 { 553 {
557 in1Col = LDColor::fromIndex (ui.cmb_col1->itemData (ui.cmb_col1->currentIndex()).toInt()); 557 in1Col = LDColor::fromIndex (ui.cmb_col1->itemData (ui.cmb_col1->currentIndex()).toInt());
558 in2Col = LDColor::fromIndex (ui.cmb_col2->itemData (ui.cmb_col2->currentIndex()).toInt()); 558 in2Col = LDColor::fromIndex (ui.cmb_col2->itemData (ui.cmb_col2->currentIndex()).toInt());
559 559
560 if (in1Col == in2Col) 560 if (in1Col == in2Col)
561 { 561 {
562 critical ("Cannot use the same color group for both inputs!"); 562 CriticalError ("Cannot use the same color group for both inputs!");
563 continue; 563 continue;
564 } 564 }
565 565
566 break; 566 break;
567 } 567 }
568 568
569 QTemporaryFile in1dat, in2dat, outdat; 569 QTemporaryFile in1dat, in2dat, outdat;
570 QString in1DATName, in2DATName, outDATName; 570 QString in1DATName, in2DATName, outDATName;
571 571
572 if (not mkTempFile (in1dat, in1DATName) or 572 if (not MakeTempFile (in1dat, in1DATName) or
573 not mkTempFile (in2dat, in2DATName) or 573 not MakeTempFile (in2dat, in2DATName) or
574 not mkTempFile (outdat, outDATName)) 574 not MakeTempFile (outdat, outDATName))
575 { 575 {
576 return; 576 return;
577 } 577 }
578 578
579 QString argv = Join ( 579 QString argv = Join (
585 in1DATName, 585 in1DATName,
586 in2DATName, 586 in2DATName,
587 outDATName 587 outDATName
588 }); 588 });
589 589
590 writeColorGroup (in1Col, in1DATName); 590 WriteColorGroup (in1Col, in1DATName);
591 writeColorGroup (in2Col, in2DATName); 591 WriteColorGroup (in2Col, in2DATName);
592 592
593 if (not runUtilityProcess (Coverer, cfg::CovererPath, argv)) 593 if (not RunExtProgram (Coverer, cfg::CovererPath, argv))
594 return; 594 return;
595 595
596 insertOutput (outDATName, false, {}); 596 InsertOutput (outDATName, false, {});
597 } 597 }
598 598
599 // ============================================================================= 599 // =============================================================================
600 // 600 //
601 void MainWindow::slot_actionIsecalc() 601 void MainWindow::slot_actionIsecalc()
602 { 602 {
603 setlocale (LC_ALL, "C"); 603 setlocale (LC_ALL, "C");
604 604
605 if (not checkProgPath (Isecalc)) 605 if (not CheckExtProgramPath (Isecalc))
606 return; 606 return;
607 607
608 Ui::IsecalcUI ui; 608 Ui::IsecalcUI ui;
609 QDialog* dlg = new QDialog; 609 QDialog* dlg = new QDialog;
610 ui.setupUi (dlg); 610 ui.setupUi (dlg);
611 611
612 makeColorComboBox (ui.cmb_col1); 612 MakeColorComboBox (ui.cmb_col1);
613 makeColorComboBox (ui.cmb_col2); 613 MakeColorComboBox (ui.cmb_col2);
614 614
615 LDColor in1Col, in2Col; 615 LDColor in1Col, in2Col;
616 616
617 // Run the dialog and validate input 617 // Run the dialog and validate input
618 forever 618 forever
623 in1Col = LDColor::fromIndex (ui.cmb_col1->itemData (ui.cmb_col1->currentIndex()).toInt()); 623 in1Col = LDColor::fromIndex (ui.cmb_col1->itemData (ui.cmb_col1->currentIndex()).toInt());
624 in2Col = LDColor::fromIndex (ui.cmb_col2->itemData (ui.cmb_col2->currentIndex()).toInt()); 624 in2Col = LDColor::fromIndex (ui.cmb_col2->itemData (ui.cmb_col2->currentIndex()).toInt());
625 625
626 if (in1Col == in2Col) 626 if (in1Col == in2Col)
627 { 627 {
628 critical ("Cannot use the same color group for both input and cutter!"); 628 CriticalError ("Cannot use the same color group for both input and cutter!");
629 continue; 629 continue;
630 } 630 }
631 631
632 break; 632 break;
633 } 633 }
634 634
635 QTemporaryFile in1dat, in2dat, outdat; 635 QTemporaryFile in1dat, in2dat, outdat;
636 QString in1DATName, in2DATName, outDATName; 636 QString in1DATName, in2DATName, outDATName;
637 637
638 if (not mkTempFile (in1dat, in1DATName) or 638 if (not MakeTempFile (in1dat, in1DATName) or
639 not mkTempFile (in2dat, in2DATName) or 639 not MakeTempFile (in2dat, in2DATName) or
640 not mkTempFile (outdat, outDATName)) 640 not MakeTempFile (outdat, outDATName))
641 { 641 {
642 return; 642 return;
643 } 643 }
644 644
645 QString argv = Join ( 645 QString argv = Join (
647 in1DATName, 647 in1DATName,
648 in2DATName, 648 in2DATName,
649 outDATName 649 outDATName
650 }); 650 });
651 651
652 writeColorGroup (in1Col, in1DATName); 652 WriteColorGroup (in1Col, in1DATName);
653 writeColorGroup (in2Col, in2DATName); 653 WriteColorGroup (in2Col, in2DATName);
654 runUtilityProcess (Isecalc, cfg::IsecalcPath, argv); 654 RunExtProgram (Isecalc, cfg::IsecalcPath, argv);
655 insertOutput (outDATName, false, {}); 655 InsertOutput (outDATName, false, {});
656 } 656 }
657 657
658 // ============================================================================= 658 // =============================================================================
659 // 659 //
660 void MainWindow::slot_actionEdger2() 660 void MainWindow::slot_actionEdger2()
661 { 661 {
662 setlocale (LC_ALL, "C"); 662 setlocale (LC_ALL, "C");
663 663
664 if (not checkProgPath (Edger2)) 664 if (not CheckExtProgramPath (Edger2))
665 return; 665 return;
666 666
667 QDialog* dlg = new QDialog; 667 QDialog* dlg = new QDialog;
668 Ui::Edger2Dialog ui; 668 Ui::Edger2Dialog ui;
669 ui.setupUi (dlg); 669 ui.setupUi (dlg);
672 return; 672 return;
673 673
674 QTemporaryFile in, out; 674 QTemporaryFile in, out;
675 QString inName, outName; 675 QString inName, outName;
676 676
677 if (not mkTempFile (in, inName) or not mkTempFile (out, outName)) 677 if (not MakeTempFile (in, inName) or not MakeTempFile (out, outName))
678 return; 678 return;
679 679
680 int unmatched = ui.unmatched->currentIndex(); 680 int unmatched = ui.unmatched->currentIndex();
681 681
682 QString argv = Join ( 682 QString argv = Join (
694 unmatched == 0 ? "-u+" : (unmatched == 2 ? "-u-" : ""), 694 unmatched == 0 ? "-u+" : (unmatched == 2 ? "-u-" : ""),
695 inName, 695 inName,
696 outName, 696 outName,
697 }); 697 });
698 698
699 writeSelection (inName); 699 WriteSelection (inName);
700 700
701 if (not runUtilityProcess (Edger2, cfg::Edger2Path, argv)) 701 if (not RunExtProgram (Edger2, cfg::Edger2Path, argv))
702 return; 702 return;
703 703
704 insertOutput (outName, true, {}); 704 InsertOutput (outName, true, {});
705 } 705 }

mercurial