Changed Streamer Mode settings (#2001)

There's now a new (yet another, sigh) section in Settings -> General, which lets you set streamer mode to 'enable/disable/detect obs' and there are also separate settings for each of the things that streamer mode covers. I just have to add ping sounds and PR is ready to be merged :)

* Show "Streamer Mode" image as link thumbnails if applicable

* Moved hideViewerCountAndDuration to streamerMode settings

Set it to false by default (just how it used to be under /misc settings, also reworked live tooltip to be a bit prettier and say "<Streamer Mode>" in gray instead of "Live with <hidden> for <hidden> viewers"
This commit is contained in:
Paweł
2020-10-11 13:52:14 +02:00
committed by GitHub
parent 56828f2d81
commit 2232c6d925
10 changed files with 164 additions and 66 deletions
+56 -21
View File
@@ -12,6 +12,7 @@
#include "singletons/WindowManager.hpp"
#include "util/LayoutCreator.hpp"
#include "util/LayoutHelper.hpp"
#include "util/StreamerMode.hpp"
#include "widgets/Label.hpp"
#include "widgets/TooltipWidget.hpp"
#include "widgets/dialogs/SettingsDialog.hpp"
@@ -86,30 +87,64 @@ namespace {
}
auto formatTooltip(const TwitchChannel::StreamStatus &s, QString thumbnail)
{
return QString("<style>.center { text-align: center; }</style> \
<p class=\"center\">%1%2%3%4%5%6 for %7 with %8 viewers</p>")
.arg(s.title.toHtmlEscaped())
.arg(s.title.isEmpty() ? QString() : "<br><br>")
.arg(getSettings()->thumbnailSizeStream.getValue() > 0
? ((thumbnail.isEmpty()
? "Couldn't fetch thumbnail"
: "<img src=\"data:image/jpg;base64, " +
thumbnail + "\"/>") +
"<br>")
: QString())
.arg(s.game.toHtmlEscaped())
.arg(s.game.isEmpty() ? QString() : "<br>")
.arg(s.rerun ? "Vod-casting" : "Live")
.arg(getSettings()->hideViewerCountAndDuration ? "&lt;Hidden&gt;"
: s.uptime)
.arg(getSettings()->hideViewerCountAndDuration
? "&lt;Hidden&gt;"
: QString::number(s.viewerCount));
auto title = [&s]() -> QString {
if (s.title.isEmpty())
{
return QStringLiteral("");
}
return s.title.toHtmlEscaped() + "<br><br>";
}();
auto tooltip = [&thumbnail]() -> QString {
if (getSettings()->thumbnailSizeStream.getValue() == 0)
{
return QStringLiteral("");
}
if (thumbnail.isEmpty())
{
return QStringLiteral("Couldn't fetch thumbnail<br>");
}
return "<img src=\"data:image/jpg;base64, " + thumbnail + "\"><br>";
}();
auto game = [&s]() -> QString {
if (s.game.isEmpty())
{
return QStringLiteral("");
}
return s.game.toHtmlEscaped() + "<br>";
}();
auto extraStreamData = [&s]() -> QString {
if (isInStreamerMode() &&
getSettings()->streamerModeHideViewerCountAndDuration)
{
return QStringLiteral(
"<span style=\"color: #808892;\">&lt;Streamer "
"Mode&gt;</span>");
}
return QString("%1 for %2 with %3 viewers")
.arg(s.rerun ? "Vod-casting" : "Live")
.arg(s.uptime)
.arg(QString::number(s.viewerCount));
}();
return QString("<p style=\"text-align: center;\">" + //
title + //
tooltip + //
game + //
extraStreamData + //
"</p>" //
);
}
auto formatOfflineTooltip(const TwitchChannel::StreamStatus &s)
{
return QString("<style>.center { text-align: center; }</style> \
<p class=\"center\">Offline<br>%1</p>")
return QString("<p style=\"text-align: center;\">Offline<br>%1</p>")
.arg(s.title.toHtmlEscaped());
}
auto formatTitle(const TwitchChannel::StreamStatus &s, Settings &settings)