Commit f9d48b7fad03ea11a009a40910457534ca4b9684
1 parent
39dd2e34
csvOutput now uses QtUtils::writeFile
Showing
2 changed files
with
8 additions
and
14 deletions
sdk/plugins/output.cpp
| ... | ... | @@ -57,21 +57,15 @@ class csvOutput : public MatrixOutput |
| 57 | 57 | ~csvOutput() |
| 58 | 58 | { |
| 59 | 59 | if (file.isNull() || targetFiles.isEmpty() || queryFiles.isEmpty()) return; |
| 60 | - QFile out(file); | |
| 61 | - bool success = out.open(QFile::WriteOnly); | |
| 62 | - if (!success) qFatal("Output::saveCSV failed to open %s for writing.", qPrintable((QString)file)); | |
| 63 | - out.write("File,"); | |
| 64 | - out.write(qPrintable(targetFiles.names().join(","))); | |
| 65 | - out.write("\n"); | |
| 60 | + QStringList lines; | |
| 61 | + lines.append("File," + targetFiles.names().join(",")); | |
| 66 | 62 | for (int i=0; i<queryFiles.size(); i++) { |
| 67 | - out.write(qPrintable(queryFiles[i].name)); | |
| 68 | - for (int j=0; j<targetFiles.size(); j++) { | |
| 69 | - out.write(","); | |
| 70 | - out.write(qPrintable(toString(i,j))); | |
| 71 | - } | |
| 72 | - out.write("\n"); | |
| 63 | + QStringList words; | |
| 64 | + for (int j=0; j<targetFiles.size(); j++) | |
| 65 | + words.append(toString(i,j)); | |
| 66 | + lines.append(queryFiles[i].name+","+words.join(",")); | |
| 73 | 67 | } |
| 74 | - out.close(); | |
| 68 | + QtUtils::writeFile(file, lines); | |
| 75 | 69 | } |
| 76 | 70 | }; |
| 77 | 71 | ... | ... |