diff --git a/.gitignore b/.gitignore
index 09aae68f..f26d0577 100644
--- a/.gitignore
+++ b/.gitignore
@@ -69,3 +69,7 @@ build-debug/
.idea/
cmake-build-debug/
.vscode/
+
+# Local tooling
+.mimosa
+.zcode/
\ No newline at end of file
diff --git a/src/base/LemonBase.hpp b/src/base/LemonBase.hpp
index cd182c84..6bb9a924 100644
--- a/src/base/LemonBase.hpp
+++ b/src/base/LemonBase.hpp
@@ -9,6 +9,7 @@
//
#include
#include
+#include
#include
#include
@@ -22,6 +23,22 @@
#define LEMON_BUILD_EXTRA_INFO QString(LEMON_BUILD_EXTRA_INFO_STR)
namespace Lemon {
+ // The CJK-capable UI font of the application, shared by the main window
+ // (main.cpp) and the source code viewer. Missing families fall back to the
+ // platform default font, so listing them unconditionally is safe.
+ inline QFont uiFont() {
+ QFont font;
+#ifdef Q_OS_WIN32
+ font.setFamilies({"Microsoft YaHei"});
+ font.setHintingPreference(QFont::PreferNoHinting);
+#elif defined(Q_OS_LINUX)
+ font.setFamilies({"Noto Sans CJK SC", "WenQuanYi Micro Hei"});
+#elif defined(Q_OS_MAC)
+ font.setFamilies({"PingFang SC"});
+#endif
+ return font;
+ }
+
inline QStringList LemonAssetsPaths(const QString &dirName) {
#define makeAbs(p) QDir(p).absolutePath()
// Configuration Path
diff --git a/src/component/exportutil/exportutil.cpp b/src/component/exportutil/exportutil.cpp
index 3b92e4be..05aac62a 100644
--- a/src/component/exportutil/exportutil.cpp
+++ b/src/component/exportutil/exportutil.cpp
@@ -235,7 +235,6 @@ auto ExportUtil::getContestantHtmlCode(Contest *contest, Contestant *contestant,
htmlCode += "
";
}
- htmlCode += QString("%1
").arg(tr("Return to top"));
return htmlCode;
}
/*
@@ -269,7 +268,7 @@ void ExportUtil::writeHtml(QTextStream &out, Contest *contest) {
out << R"()";
// Style sheet
- out << "";
+ // The popup helper is emitted in so that it is already defined while
+ // the rest of a large (tens of MB) document is still parsing; everything it
+ // touches at call time (style sheet, templates, body dataset) is looked up
+ // lazily. Clicking a link before the per-contestant templates have been
+ // parsed shows a "still loading" alert instead of doing nothing silently.
+ out << R"LEMONJS(
+
+ )LEMONJS";
+
out << "" << contest->getContestTitle().toHtmlEscaped() << " : " << tr("Contest Result")
<< "";
- out << "";
+ out << QString(R"()")
+ .arg(tr("The browser blocked the popup window. Please allow popups for this page and try again.")
+ .toHtmlEscaped(),
+ tr("The details are still loading. Please try again in a moment.")
+ .toHtmlEscaped());
out << "";
out << "" << contest->getContestTitle().toHtmlEscaped() << " : " << tr("Rank List")
<< "
";
- out << "" << tr("Click names or task scores to jump to details. Judged By LemonLime") << "
";
+ out << ""
+ << tr("Click names or task scores to view details in a popup window. Judged By LemonLime") << "
";
out << R"()";
out << QString(R"(| %1 | )").arg(tr("Rank"));
out << QString(R"(%1 | )").arg(tr("Name"));
@@ -314,7 +372,7 @@ void ExportUtil::writeHtml(QTextStream &out, Contest *contest) {
for (const auto &[contestant, allScore, sourceIndex, rank] : rankContestants(contestantList)) {
out << "
";
out << QString("| %1 | ").arg(rank);
- out << QString(R"(%2 | )")
+ out << QString(R"LEMON(%2 | )LEMON")
.arg(sourceIndex)
.arg(contestant->getContestantName().toHtmlEscaped());
@@ -368,7 +426,7 @@ void ExportUtil::writeHtml(QTextStream &out, Contest *contest) {
h *= 360, s *= 100, l *= 100;
out << QString(
- R"(%1 | )")
+ R"LEMON(%1 | )LEMON")
.arg(score)
.arg(h)
.arg(s)
@@ -376,7 +434,7 @@ void ExportUtil::writeHtml(QTextStream &out, Contest *contest) {
.arg(sourceIndex)
.arg(j);
} else {
- out << QString(R"(%1 | )")
+ out << QString(R"LEMON(%1 | )LEMON")
.arg(tr("Invalid"))
.arg(sourceIndex)
.arg(j);
@@ -387,25 +445,20 @@ void ExportUtil::writeHtml(QTextStream &out, Contest *contest) {
out << "
";
+ // Contestant details are stored as text templates instead of DOM nodes, so that
+ // browsers only render the details actually opened in a popup window (#235)
for (int i = 0; i < contestantList.size(); i++) {
- out << QString("
").arg(i) << "";
+ out << QString(R"(";
}
out << QString(R"()")
.arg(LEMON_VERSION_STRING)
.arg(LEMON_VERSION_BUILD);
- out << R"(
-
- )";
out << "";
out << "