Merge pull request #1207 from 23rd/patch-35-empty-headers

Improved stream header creation.
This commit is contained in:
pajlada 2019-08-17 11:03:12 +02:00 committed by GitHub
commit 246d24d616
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -77,20 +77,15 @@ namespace {
} }
auto formatTooltip(const TwitchChannel::StreamStatus &s) auto formatTooltip(const TwitchChannel::StreamStatus &s)
{ {
return QStringList{"<style>.center { text-align: center; }</style>", return QString("<style>.center { text-align: center; }</style> \
"<p class=\"center\">", <p class=\"center\">%1%2%3%4%5 for %6 with %7 viewers</p>")
s.title.toHtmlEscaped(), .arg(s.title.toHtmlEscaped())
"<br><br>", .arg(s.title.isEmpty() ? QString() : "<br><br>")
s.game.toHtmlEscaped(), .arg(s.game.toHtmlEscaped())
"<br>", .arg(s.game.isEmpty() ? QString() : "<br>")
s.rerun ? "Vod-casting" : "Live", .arg(s.rerun ? "Vod-casting" : "Live")
" for ", .arg(s.uptime)
s.uptime, .arg(QString::number(s.viewerCount));
" with ",
QString::number(s.viewerCount),
" viewers",
"</p>"}
.join("");
} }
auto formatTitle(const TwitchChannel::StreamStatus &s, Settings &settings) auto formatTitle(const TwitchChannel::StreamStatus &s, Settings &settings)
{ {
@ -109,9 +104,9 @@ namespace {
title += " - " + s.uptime; title += " - " + s.uptime;
if (settings.headerViewerCount) if (settings.headerViewerCount)
title += " - " + QString::number(s.viewerCount); title += " - " + QString::number(s.viewerCount);
if (settings.headerGame) if (settings.headerGame && !s.game.isEmpty())
title += " - " + s.game; title += " - " + s.game;
if (settings.headerStreamTitle) if (settings.headerStreamTitle && !s.title.isEmpty())
title += " - " + s.title; title += " - " + s.title;
return title; return title;