diff options
author | Marius Kintel <marius@kintel.net> | 2010-07-08 22:49:36 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2010-10-31 00:42:37 (GMT) |
commit | e46f9dab2f3a2652d787b315bcf0d24503e154af (patch) | |
tree | 68e82d45d3230e08e08ac376af27a77372a6487d /src/mainwin.cc | |
parent | b4d03c4d8f6d25faccad1e3e763deaa29d540be0 (diff) |
export to stream for stdout/stderr output support
Diffstat (limited to 'src/mainwin.cc')
-rw-r--r-- | src/mainwin.cc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/mainwin.cc b/src/mainwin.cc index 955921d..af220a3 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -1313,13 +1313,18 @@ void MainWindow::actionExportSTLorOFF(bool) pd->show(); QApplication::processEvents(); - if (stl_mode) - export_stl(this->root_N, stl_filename, pd); - else - export_off(this->root_N, stl_filename, pd); - - PRINTF("%s export finished.", stl_mode ? "STL" : "OFF"); + QFile file(filename); + if (!file.open(QIODevice::ReadWrite)) { + PRINTA("Can't open file \"%1\" for export", filename); + } + else { + QTextStream fstream(&file); + if (stl_mode) export_stl(this->root_N, fstream, pd); + else export_off(this->root_N, fstream, pd); + file.close() + PRINTF("%s export finished.", stl_mode ? "STL" : "OFF"); + } delete pd; clearCurrentOutput(); |