33 #include "../mainwindow.h" |
33 #include "../mainwindow.h" |
34 #include "../lddocument.h" |
34 #include "../lddocument.h" |
35 #include "../editHistory.h" |
35 #include "../editHistory.h" |
36 #include "../documentmanager.h" |
36 #include "../documentmanager.h" |
37 #include "../grid.h" |
37 #include "../grid.h" |
|
38 #include "../parser.h" |
38 #include "../dialogs/externalprogrampathdialog.h" |
39 #include "../dialogs/externalprogrampathdialog.h" |
39 #include "extprogramtoolset.h" |
40 #include "extprogramtoolset.h" |
40 #include "ui_ytruderdialog.h" |
41 #include "ui_ytruderdialog.h" |
41 #include "ui_intersectordialog.h" |
42 #include "ui_intersectordialog.h" |
42 #include "ui_rectifierdialog.h" |
43 #include "ui_rectifierdialog.h" |
307 QString message = format(tr("Couldn't open temporary file %1 for reading.\n"), fname); |
308 QString message = format(tr("Couldn't open temporary file %1 for reading.\n"), fname); |
308 QMessageBox::critical(m_window, tr("Error running external program"), message); |
309 QMessageBox::critical(m_window, tr("Error running external program"), message); |
309 return; |
310 return; |
310 } |
311 } |
311 |
312 |
312 // TODO: I don't like how I need to go to the document manager to load objects from a file... |
|
313 // We're not loading this as a document so it shouldn't be necessary. |
|
314 Model model {m_documents}; |
313 Model model {m_documents}; |
315 m_documents->loadFileContents(&f, model, nullptr, nullptr); |
314 Parser parser {f}; |
|
315 parser.parseBody(model); |
316 |
316 |
317 // If we replace the objects, delete the selection now. |
317 // If we replace the objects, delete the selection now. |
318 if (replace) |
318 if (replace) |
319 m_window->deleteSelection(); |
319 m_window->deleteSelection(); |
320 |
320 |