From 208f9b093cb594091dac489927775413ab392901 Mon Sep 17 00:00:00 2001 From: mmb L Date: Sat, 8 Aug 2020 20:43:26 +0800 Subject: [PATCH] Added setting to auto close user popup (#1833) * Set autoclose as true by default to match stable version (2.1.7) behavior --- src/singletons/Settings.hpp | 1 + src/widgets/helper/ChannelView.cpp | 4 ++++ src/widgets/settingspages/GeneralPage.cpp | 2 ++ 3 files changed, 7 insertions(+) diff --git a/src/singletons/Settings.hpp b/src/singletons/Settings.hpp index fea6d253c..869fcdf0e 100644 --- a/src/singletons/Settings.hpp +++ b/src/singletons/Settings.hpp @@ -126,6 +126,7 @@ public: BoolSetting showParts = {"/behaviour/showParts", false}; FloatSetting mouseScrollMultiplier = {"/behaviour/mouseScrollMultiplier", 1.0}; + BoolSetting autoCloseUserPopup = {"/behaviour/autoCloseUserPopup", true}; // BoolSetting twitchSeperateWriteConnection = // {"/behaviour/twitchSeperateWriteConnection", false}; diff --git a/src/widgets/helper/ChannelView.cpp b/src/widgets/helper/ChannelView.cpp index 57ff77a7c..6cc53b415 100644 --- a/src/widgets/helper/ChannelView.cpp +++ b/src/widgets/helper/ChannelView.cpp @@ -1817,6 +1817,10 @@ void ChannelView::hideEvent(QHideEvent *) void ChannelView::showUserInfoPopup(const QString &userName) { auto *userPopup = new UserInfoPopup; + if (getSettings()->autoCloseUserPopup) + { + userPopup->setActionOnFocusLoss(BaseWindow::Delete); + } userPopup->setData(userName, this->hasSourceChannel() ? this->sourceChannel_ : this->channel_); QPoint offset(int(150 * this->scale()), int(70 * this->scale())); diff --git a/src/widgets/settingspages/GeneralPage.cpp b/src/widgets/settingspages/GeneralPage.cpp index 02bfae09e..69786092f 100644 --- a/src/widgets/settingspages/GeneralPage.cpp +++ b/src/widgets/settingspages/GeneralPage.cpp @@ -509,6 +509,8 @@ void GeneralPage::initLayout(SettingsLayout &layout) s.mentionUsersWithComma); layout.addCheckbox("Show joined users (< 1000 chatters)", s.showJoins); layout.addCheckbox("Show parted users (< 1000 chatters)", s.showParts); + layout.addCheckbox("Automatically close user popup when it loses focus", + s.autoCloseUserPopup); layout.addCheckbox("Lowercase domains (anti-phishing)", s.lowercaseDomains); layout.addCheckbox("Bold @usernames", s.boldUsernames); layout.addCheckbox("Try to find usernames without @ prefix",