From 113ecef6c8dddd7002d4d0f364afbaa045a654cf Mon Sep 17 00:00:00 2001 From: zyz Date: Mon, 9 Dec 2024 15:47:01 +0800 Subject: [PATCH] chore: remove the dependence of pandoc (#385) as title Log: as title --- dde-license-dialog/src/content.cpp | 41 +++++++---------------------- dde-license-dialog/src/mainwindow.h | 2 +- debian/control | 3 +-- 3 files changed, 11 insertions(+), 35 deletions(-) diff --git a/dde-license-dialog/src/content.cpp b/dde-license-dialog/src/content.cpp index ee25f56e3..c289cb465 100644 --- a/dde-license-dialog/src/content.cpp +++ b/dde-license-dialog/src/content.cpp @@ -6,24 +6,17 @@ #include #include -#include #include #include #include #include -#include #include #include #include -#include -#include -#include #include -#include #include #include -#include #include #include #include @@ -177,36 +170,20 @@ int Content::calWidgetWidth() void Content::setSource(const QString &source) { - if (source.isEmpty()) + if (source.isEmpty() || !QFile::exists(source)) return; - // pandoc将md转换成html - static QMap 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(); + QFile file(source); + if (!file.open(QIODevice::Text | QIODevice::ReadOnly)) { + qWarning() << "Set source error: " << file.errorString(); + return; } - m_source->setText(sourceMap[source]); + QTextDocument doc; + doc.setMarkdown(file.readAll()); + file.close(); + m_source->setText(doc.toHtml()); updateWindowHeight(); } diff --git a/dde-license-dialog/src/mainwindow.h b/dde-license-dialog/src/mainwindow.h index 21e17ccc4..1c4585539 100644 --- a/dde-license-dialog/src/mainwindow.h +++ b/dde-license-dialog/src/mainwindow.h @@ -38,7 +38,7 @@ class MainWindow : public DAbstractDialog QString m_enTitle; DIconButton *btnclose; - const int windowFixedWidth = 500; + const int windowFixedWidth = 520; }; #endif // MAINWINDOW_H diff --git a/debian/control b/debian/control index 626cc95ef..32299cda0 100644 --- a/debian/control +++ b/debian/control @@ -30,8 +30,7 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, ${dist:Depends}, startdde (>=5.8.15), x11-xserver-utils, dbus-user-session, - dde-session-shell, - pandoc, + dde-session-shell Provides: lightdm-greeter Recommends: onboard Conflicts: dde-workspace,