Add thumbnails to link tooltips if available (#1664)

This feature is off by default and can be enabled in the settings with the "Show link thumbnail" setting. This feature also requires the "Show link info when hovering" setting to be enabled.

thumbnails support is only there for direct image links, twitch clips, and youtube links. can be expanded in the future in the /api repo

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
Daniel Pasch
2020-05-10 12:11:10 +02:00
committed by GitHub
parent 1a4a468ab1
commit 8532c6d3bc
11 changed files with 140 additions and 27 deletions
+25
View File
@@ -521,6 +521,31 @@ void GeneralPage::initLayout(SettingsLayout &layout)
},
[](auto args) { return fuzzyToFloat(args.value, 63.f); });
layout.addCheckbox("Show link info when hovering", s.linkInfoTooltip);
layout.addDropdown<int>(
"Show link thumbnail", {"Off", "Small", "Medium", "Large"},
s.thumbnailSize,
[](auto val) {
if (val == 0)
return QString("Off");
else if (val == 100)
return QString("Small");
else if (val == 200)
return QString("Medium");
else if (val == 300)
return QString("Large");
else
return QString::number(val);
},
[](auto args) {
if (args.value == "Small")
return 100;
else if (args.value == "Medium")
return 200;
else if (args.value == "Large")
return 300;
return fuzzyToInt(args.value, 0);
});
layout.addCheckbox("Double click to open links and other elements in chat",
s.linksDoubleClickOnly);
layout.addCheckbox("Unshorten links", s.unshortLinks);