Skip to content

Commit

Permalink
fix: Adapt user experience plan agreement md format document (#380)
Browse files Browse the repository at this point in the history
Log: Adapt user experience plan agreement md format document
Bug: https://pms.uniontech.com/bug-view-281497.html

Co-authored-by: swq <shenwenqi@uniontech.com>
  • Loading branch information
swq11 and swq authored Nov 5, 2024
1 parent 2e96449 commit 90219af
Showing 1 changed file with 26 additions and 1 deletion.
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

0 comments on commit 90219af

Please sign in to comment.