hide link preview image if in streamer mode
This commit is contained in:
@@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
|
constexpr int cooldownInS = 10;
|
||||||
|
|
||||||
const QStringList &broadcastingBinaries()
|
const QStringList &broadcastingBinaries()
|
||||||
{
|
{
|
||||||
#ifdef USEWINSDK
|
#ifdef USEWINSDK
|
||||||
@@ -25,6 +27,17 @@ bool isInStreamerMode()
|
|||||||
#ifdef USEWINSDK
|
#ifdef USEWINSDK
|
||||||
if (IsWindowsVistaOrGreater())
|
if (IsWindowsVistaOrGreater())
|
||||||
{
|
{
|
||||||
|
static bool cache = false;
|
||||||
|
static QDateTime time = QDateTime();
|
||||||
|
|
||||||
|
if (time.isValid() &&
|
||||||
|
time.addSecs(cooldownInS) > QDateTime::currentDateTime())
|
||||||
|
{
|
||||||
|
return cache;
|
||||||
|
}
|
||||||
|
|
||||||
|
time = QDateTime::currentDateTime();
|
||||||
|
|
||||||
WTS_PROCESS_INFO *pWPIs = nullptr;
|
WTS_PROCESS_INFO *pWPIs = nullptr;
|
||||||
DWORD dwProcCount = 0;
|
DWORD dwProcCount = 0;
|
||||||
|
|
||||||
@@ -38,12 +51,17 @@ bool isInStreamerMode()
|
|||||||
reinterpret_cast<char16_t *>(pWPIs[i].pProcessName));
|
reinterpret_cast<char16_t *>(pWPIs[i].pProcessName));
|
||||||
|
|
||||||
if (broadcastingBinaries().contains(processName))
|
if (broadcastingBinaries().contains(processName))
|
||||||
|
{
|
||||||
|
cache = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (pWPIs)
|
if (pWPIs)
|
||||||
WTSFreeMemory(pWPIs);
|
WTSFreeMemory(pWPIs);
|
||||||
|
|
||||||
|
cache = false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#include "util/Clipboard.hpp"
|
#include "util/Clipboard.hpp"
|
||||||
#include "util/DistanceBetweenPoints.hpp"
|
#include "util/DistanceBetweenPoints.hpp"
|
||||||
#include "util/IncognitoBrowser.hpp"
|
#include "util/IncognitoBrowser.hpp"
|
||||||
|
#include "util/StreamerMode.hpp"
|
||||||
#include "util/Twitch.hpp"
|
#include "util/Twitch.hpp"
|
||||||
#include "widgets/Scrollbar.hpp"
|
#include "widgets/Scrollbar.hpp"
|
||||||
#include "widgets/TooltipWidget.hpp"
|
#include "widgets/TooltipWidget.hpp"
|
||||||
@@ -1315,7 +1316,7 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event)
|
|||||||
{
|
{
|
||||||
auto element = &hoverLayoutElement->getCreator();
|
auto element = &hoverLayoutElement->getCreator();
|
||||||
auto thumbnailSize = getSettings()->thumbnailSize;
|
auto thumbnailSize = getSettings()->thumbnailSize;
|
||||||
if (thumbnailSize == 0)
|
if (thumbnailSize == 0 || isInStreamerMode())
|
||||||
{
|
{
|
||||||
tooltipPreviewImage.setImage(nullptr);
|
tooltipPreviewImage.setImage(nullptr);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user