added setting to open links in incognito by default

This commit is contained in:
fourtf 2019-09-08 14:59:51 +02:00
parent 9d2665ab17
commit 87c0ff76e7
3 changed files with 13 additions and 9 deletions

View file

@ -204,6 +204,7 @@ public:
BoolSetting loadTwitchMessageHistoryOnConnect = {
"/misc/twitch/loadMessageHistoryOnConnect", true};
IntSetting emotesTooltipPreview = {"/misc/emotesTooltipPreview", 0};
BoolSetting openLinksIncognito = {"/misc/openLinksIncognito", 0};
QStringSetting cachePath = {"/cache/path", ""};

View file

@ -1528,14 +1528,8 @@ void ChannelView::addContextMenuItems(
QString url = hoveredElement->getLink().value;
// open link
bool incognitoByDefault = supportsIncognitoLinks() &&
layout->getMessage()->loginName == "hemirt";
menu->addAction("Open link", [url, incognitoByDefault] {
if (incognitoByDefault)
openLinkIncognito(url);
else
QDesktopServices::openUrl(QUrl(url));
});
menu->addAction("Open link",
[url] { QDesktopServices::openUrl(QUrl(url)); });
// open link default
if (supportsIncognitoLinks())
{
@ -1701,7 +1695,10 @@ void ChannelView::handleLinkClick(QMouseEvent *event, const Link &link,
case Link::Url:
{
QDesktopServices::openUrl(QUrl(link.value));
if (getSettings()->openLinksIncognito && supportsIncognitoLinks())
openLinkIncognito(link.value);
else
QDesktopServices::openUrl(QUrl(link.value));
}
break;

View file

@ -11,6 +11,7 @@
#include "singletons/WindowManager.hpp"
#include "util/FuzzyConvert.hpp"
#include "util/Helpers.hpp"
#include "util/IncognitoBrowser.hpp"
#include "widgets/BaseWindow.hpp"
#include "widgets/helper/Line.hpp"
@ -377,6 +378,11 @@ void GeneralPage::initLayout(SettingsLayout &layout)
layout.addTitle("Miscellaneous");
if (supportsIncognitoLinks())
{
layout.addCheckbox("Open links in incognito/private mode",
s.openLinksIncognito);
}
layout.addCheckbox("Show moderation messages", s.hideModerationActions,
true);
layout.addCheckbox("Random username color for users who never set a color",