MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / buildCoverLogoMarkup

Method buildCoverLogoMarkup

app/src/Sessions/HtmlReport.cpp:308–332  ·  view source on GitHub ↗

* @brief Loads the cover logo as inline SVG or a base64 data URI img tag. */

Source from the content-addressed store, hash-verified

306 * @brief Loads the cover logo as inline SVG or a base64 data URI img tag.
307 */
308QString Sessions::HtmlReport::buildCoverLogoMarkup() const
309{
310 if (m_opts.logoPath.isEmpty() || !QFileInfo::exists(m_opts.logoPath))
311 return QString();
312
313 const QFileInfo fi(m_opts.logoPath);
314 const bool isSvg = fi.suffix().compare("svg", Qt::CaseInsensitive) == 0;
315 if (!isSvg) {
316 const QString dataUri = encodeLogoAsDataUri(m_opts.logoPath);
317 if (dataUri.isEmpty())
318 return QString();
319
320 return QStringLiteral("<img src=\"%1\" alt=\"\">").arg(dataUri);
321 }
322
323 QString markup = readResource(m_opts.logoPath);
324 if (!markup.isEmpty())
325 return markup;
326
327 QFile f(m_opts.logoPath);
328 if (f.open(QIODevice::ReadOnly))
329 markup = QString::fromUtf8(f.readAll());
330
331 return markup;
332}
333
334/**
335 * @brief Builds the first-page cover fragment: logo, company, title, subtitle.

Callers

nothing calls this directly

Calls 4

readResourceFunction · 0.85
isEmptyMethod · 0.80
compareMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected