Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Adapt user experience plan agreement md format document #380

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion dde-license-dialog/src/content.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,32 @@ void Content::setSource(const QString &source)
if (source.isEmpty())
return;

m_source->setText(source);
// pandoc将md转换成html
static QMap<QString, QString> sourceMap;
if (sourceMap[source].isEmpty()) {
QProcess process;
QString para;
QString tempPath = QStandardPaths::standardLocations(QStandardPaths::ConfigLocation).first();
tempPath.append("/license_temp.html");
if (QFile::exists(tempPath))
QFile::remove(tempPath);
para = QString("pandoc %1 --output %2").arg(source, tempPath);
QStringList args;
args << "-c";
args << para;
process.start("sh", args);
process.waitForFinished();
process.waitForReadyRead();
QFile file(tempPath);
if (!file.open(QIODevice::Text | QIODevice::ReadOnly)) {
qWarning() << "Set source error: " << file.errorString();
return;
}
sourceMap.insert(source, file.readAll());
file.close();
}

m_source->setText(sourceMap[source]);

updateWindowHeight();
}
Expand Down
Loading