src/extPrograms.cc

changeset 882
2f3cc8e045d5
parent 880
5dcd2e741d1c
child 927
409b82a4765e
child 944
1a6f1997fcbe
equal deleted inserted replaced
881:82a9c3549db1 882:2f3cc8e045d5
193 // Write the input file 193 // Write the input file
194 QFile f (fname); 194 QFile f (fname);
195 195
196 if (not f.open (QIODevice::WriteOnly | QIODevice::Text)) 196 if (not f.open (QIODevice::WriteOnly | QIODevice::Text))
197 { 197 {
198 CriticalError (format ("Couldn't open temporary file %1 for writing: %2\n", fname, f.errorString())); 198 Critical (format ("Couldn't open temporary file %1 for writing: %2\n", fname, f.errorString()));
199 return; 199 return;
200 } 200 }
201 201
202 WriteObjects (objects, f); 202 WriteObjects (objects, f);
203 f.close(); 203 f.close();
257 proc.setStandardInputFile (input.fileName()); 257 proc.setStandardInputFile (input.fileName());
258 proc.start (path, argv); 258 proc.start (path, argv);
259 259
260 if (not proc.waitForStarted()) 260 if (not proc.waitForStarted())
261 { 261 {
262 CriticalError (format ("Couldn't start %1: %2\n", g_extProgNames[prog], ProcessExtProgError (prog, proc))); 262 Critical (format ("Couldn't start %1: %2\n", g_extProgNames[prog], ProcessExtProgError (prog, proc)));
263 return false; 263 return false;
264 } 264 }
265 265
266 // Write an enter, the utility tools all expect one 266 // Write an enter, the utility tools all expect one
267 input.write ("\n"); 267 input.write ("\n");
278 if (proc.exitCode() != 0) 278 if (proc.exitCode() != 0)
279 err = format ("Program exited abnormally (return code %1).", proc.exitCode()); 279 err = format ("Program exited abnormally (return code %1).", proc.exitCode());
280 280
281 if (not err.isEmpty()) 281 if (not err.isEmpty())
282 { 282 {
283 CriticalError (format ("%1 failed: %2\n", g_extProgNames[prog], err)); 283 Critical (format ("%1 failed: %2\n", g_extProgNames[prog], err));
284 QString filename ("externalProgramOutput.txt"); 284 QString filename ("externalProgramOutput.txt");
285 QFile file (filename); 285 QFile file (filename);
286 286
287 if (file.open (QIODevice::WriteOnly | QIODevice::Text)) 287 if (file.open (QIODevice::WriteOnly | QIODevice::Text))
288 { 288 {
313 // Read the output file 313 // Read the output file
314 QFile f (fname); 314 QFile f (fname);
315 315
316 if (not f.open (QIODevice::ReadOnly)) 316 if (not f.open (QIODevice::ReadOnly))
317 { 317 {
318 CriticalError (format ("Couldn't open temporary file %1 for reading.\n", fname)); 318 Critical (format ("Couldn't open temporary file %1 for reading.\n", fname));
319 return; 319 return;
320 } 320 }
321 321
322 LDObjectList objs = LoadFileContents (&f, null); 322 LDObjectList objs = LoadFileContents (&f, null);
323 323
479 inCol = LDColor::fromIndex (ui.cmb_incol->itemData (ui.cmb_incol->currentIndex()).toInt()); 479 inCol = LDColor::fromIndex (ui.cmb_incol->itemData (ui.cmb_incol->currentIndex()).toInt());
480 cutCol = LDColor::fromIndex (ui.cmb_cutcol->itemData (ui.cmb_cutcol->currentIndex()).toInt()); 480 cutCol = LDColor::fromIndex (ui.cmb_cutcol->itemData (ui.cmb_cutcol->currentIndex()).toInt());
481 481
482 if (inCol == cutCol) 482 if (inCol == cutCol)
483 { 483 {
484 CriticalError ("Cannot use the same color group for both input and cutter!"); 484 Critical ("Cannot use the same color group for both input and cutter!");
485 continue; 485 continue;
486 } 486 }
487 487
488 break; 488 break;
489 } 489 }
573 in1Col = LDColor::fromIndex (ui.cmb_col1->itemData (ui.cmb_col1->currentIndex()).toInt()); 573 in1Col = LDColor::fromIndex (ui.cmb_col1->itemData (ui.cmb_col1->currentIndex()).toInt());
574 in2Col = LDColor::fromIndex (ui.cmb_col2->itemData (ui.cmb_col2->currentIndex()).toInt()); 574 in2Col = LDColor::fromIndex (ui.cmb_col2->itemData (ui.cmb_col2->currentIndex()).toInt());
575 575
576 if (in1Col == in2Col) 576 if (in1Col == in2Col)
577 { 577 {
578 CriticalError ("Cannot use the same color group for both inputs!"); 578 Critical ("Cannot use the same color group for both inputs!");
579 continue; 579 continue;
580 } 580 }
581 581
582 break; 582 break;
583 } 583 }
639 in1Col = LDColor::fromIndex (ui.cmb_col1->itemData (ui.cmb_col1->currentIndex()).toInt()); 639 in1Col = LDColor::fromIndex (ui.cmb_col1->itemData (ui.cmb_col1->currentIndex()).toInt());
640 in2Col = LDColor::fromIndex (ui.cmb_col2->itemData (ui.cmb_col2->currentIndex()).toInt()); 640 in2Col = LDColor::fromIndex (ui.cmb_col2->itemData (ui.cmb_col2->currentIndex()).toInt());
641 641
642 if (in1Col == in2Col) 642 if (in1Col == in2Col)
643 { 643 {
644 CriticalError ("Cannot use the same color group for both input and cutter!"); 644 Critical ("Cannot use the same color group for both input and cutter!");
645 continue; 645 continue;
646 } 646 }
647 647
648 break; 648 break;
649 } 649 }

mercurial