| 150 | } |
| 151 | |
| 152 | void CommandLineExporter::exportToFile |
| 153 | ( |
| 154 | const ExportFormat *format, |
| 155 | const QString &inputFilePath, |
| 156 | const QString &text, |
| 157 | const QString &outputFilePath, |
| 158 | QString &err |
| 159 | ) |
| 160 | { |
| 161 | Q_D(CommandLineExporter); |
| 162 | |
| 163 | QString stdoutOutput; |
| 164 | QString stderrOutput; |
| 165 | |
| 166 | if (!d->formatToCommandMap.contains(format)) { |
| 167 | err = QObject::tr("%1 format is not supported by this processor.") |
| 168 | .arg(format->name()); |
| 169 | return; |
| 170 | } |
| 171 | |
| 172 | QString command = d->formatToCommandMap.value(format); |
| 173 | |
| 174 | if |
| 175 | ( |
| 176 | ! d->executeCommand |
| 177 | ( |
| 178 | command, |
| 179 | inputFilePath, |
| 180 | text, |
| 181 | outputFilePath, |
| 182 | m_options, |
| 183 | this->m_smartTypographyEnabled, |
| 184 | stdoutOutput, |
| 185 | stderrOutput |
| 186 | ) |
| 187 | ) { |
| 188 | if (!stderrOutput.isNull() && !stderrOutput.isEmpty()) { |
| 189 | err = stderrOutput; |
| 190 | } else { |
| 191 | err = QObject::tr("Failed to execute command: ") |
| 192 | + QString("%1").arg(command); |
| 193 | } |
| 194 | } else { |
| 195 | err = QString(); |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | bool CommandLineExporterPrivate::executeCommand |
| 200 | ( |
nothing calls this directly
no test coverage detected