| 90 | } |
| 91 | |
| 92 | QString CMakeCommandsContents::descriptionForIdentifier(const QString& id, CMakeDocumentation::Type t) const |
| 93 | { |
| 94 | QString desc; |
| 95 | if(args[t].size() != 0) { |
| 96 | desc = CMake::executeProcess(CMakeBuilderSettings::self()->cmakeExecutable().toLocalFile(), { args[t], id.simplified() }); |
| 97 | desc.remove(QLatin1String(":ref:")); |
| 98 | |
| 99 | const QString rst2html = QStandardPaths::findExecutable(QStringLiteral("rst2html")); |
| 100 | if (rst2html.isEmpty()) { |
| 101 | desc = (QLatin1String("<html><body><pre><code>") + desc.toHtmlEscaped() + QLatin1String("</code></pre>") |
| 102 | + i18n("<p>For better CMake documentation rendering, install rst2html.</p>") |
| 103 | + QLatin1String("</body></html>")); |
| 104 | } else { |
| 105 | QProcess p; |
| 106 | p.start(rst2html, { QStringLiteral("--no-toc-backlinks"), QStringLiteral("--quiet") }); |
| 107 | p.write(desc.toUtf8()); |
| 108 | p.closeWriteChannel(); |
| 109 | p.waitForFinished(); |
| 110 | desc = QString::fromUtf8(p.readAllStandardOutput()); |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | return desc; |
| 115 | } |
| 116 | |
| 117 | |
| 118 | void CMakeCommandsContents::showItemAt(const QModelIndex& idx) const |
no test coverage detected