Make Emotes Tooltip Preview disablable in the Settings

This commit is contained in:
rexim 2019-05-28 23:43:36 +07:00
parent a569985315
commit 8b79faf958
3 changed files with 3 additions and 2 deletions

View file

@ -192,6 +192,7 @@ public:
QStringSetting currentVersion = {"/misc/currentVersion", ""}; QStringSetting currentVersion = {"/misc/currentVersion", ""};
BoolSetting loadTwitchMessageHistoryOnConnect = { BoolSetting loadTwitchMessageHistoryOnConnect = {
"/misc/twitch/loadMessageHistoryOnConnect", true}; "/misc/twitch/loadMessageHistoryOnConnect", true};
BoolSetting emotesTooltipPreview = {"/misc/emotesTooltipPreview", false};
QStringSetting cachePath = {"/cache/path", ""}; QStringSetting cachePath = {"/cache/path", ""};

View file

@ -1219,7 +1219,7 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event)
{ {
auto emoteElement = dynamic_cast<const EmoteElement*>(&hoverLayoutElement->getCreator()); auto emoteElement = dynamic_cast<const EmoteElement*>(&hoverLayoutElement->getCreator());
if (emoteElement) { if (emoteElement && getSettings()->emotesTooltipPreview.getValue()) {
auto pixmap = emoteElement->getEmote()->images.getImage(3.0)->pixmap(); auto pixmap = emoteElement->getEmote()->images.getImage(3.0)->pixmap();
if (pixmap) { if (pixmap) {
QBuffer buffer; QBuffer buffer;
@ -1227,7 +1227,6 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event)
// FIXME: Inject image directly into tooltipWidget without base64 bs // FIXME: Inject image directly into tooltipWidget without base64 bs
// FIXME: Gifs are not animated // FIXME: Gifs are not animated
// FIXME: No way to opt-out
tooltipWidget->setText( tooltipWidget->setText(
QString("<img src='data:image/png;base64,%1' /><br/>%2x%3<br/>%4") QString("<img src='data:image/png;base64,%1' /><br/>%2x%3<br/>%4")

View file

@ -270,6 +270,7 @@ void GeneralPage::initLayout(SettingsLayout &layout)
layout.addCheckbox("Double click links to open", s.linksDoubleClickOnly); layout.addCheckbox("Double click links to open", s.linksDoubleClickOnly);
layout.addCheckbox("Unshorten links", s.unshortLinks); layout.addCheckbox("Unshorten links", s.unshortLinks);
layout.addCheckbox("Show live indicator in tabs", s.showTabLive); layout.addCheckbox("Show live indicator in tabs", s.showTabLive);
layout.addCheckbox("Show emote preview in tooltip on hover", s.emotesTooltipPreview);
layout.addSpacing(16); layout.addSpacing(16);
layout.addSeperator(); layout.addSeperator();