diff --git a/src/singletons/Settings.hpp b/src/singletons/Settings.hpp index cd6925d36..d5b0ad881 100644 --- a/src/singletons/Settings.hpp +++ b/src/singletons/Settings.hpp @@ -102,7 +102,7 @@ public: BoolSetting prefixOnlyEmoteCompletion = { "/behaviour/autocompletion/prefixOnlyCompletion", true}; - BoolSetting pauseChatOnHover = {"/behaviour/pauseChatHover", false}; + FloatSetting pauseOnHoverDuration = {"/behaviour/pauseOnHoverDuration", 0}; EnumSetting pauseChatModifier = { "/behaviour/pauseChatModifier", Qt::KeyboardModifier::NoModifier}; BoolSetting autorun = {"/behaviour/autorun", false}; diff --git a/src/widgets/helper/ChannelView.cpp b/src/widgets/helper/ChannelView.cpp index 3395155fa..bc532da3b 100644 --- a/src/widgets/helper/ChannelView.cpp +++ b/src/widgets/helper/ChannelView.cpp @@ -1038,9 +1038,14 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event) } /// Pause on hover - if (getSettings()->pauseChatOnHover.getValue()) + if (float pauseTime = getSettings()->pauseOnHoverDuration; + pauseTime > 0.001f) { - this->pause(PauseReason::Mouse, 500); + this->pause(PauseReason::Mouse, uint(pauseTime * 1000.f)); + } + else if (pauseTime < -0.5f) + { + this->pause(PauseReason::Mouse); } auto tooltipWidget = TooltipWidget::getInstance(); diff --git a/src/widgets/settingspages/GeneralPage.cpp b/src/widgets/settingspages/GeneralPage.cpp index 8a3e0063b..3f2cbb25f 100644 --- a/src/widgets/settingspages/GeneralPage.cpp +++ b/src/widgets/settingspages/GeneralPage.cpp @@ -319,7 +319,26 @@ void GeneralPage::initLayout(SettingsLayout &layout) layout.addCheckbox("Smooth scrolling", s.enableSmoothScrolling); layout.addCheckbox("Smooth scrolling on new messages", s.enableSmoothScrollingNewMessages); - layout.addCheckbox("Pause on hover", s.pauseChatOnHover); + layout.addDropdown( + "Pause on hover", {"Disabled", "0.5s", "1s", "2s", "5s", "Indefinite"}, + s.pauseOnHoverDuration, + [](auto val) { + if (val < -0.5f) + return QString("Indefinite"); + else if (val < 0.001f) + return QString("Disabled"); + else + return QString::number(val) + "s"; + }, + [](auto args) { + if (args.index == 0) + return 0.0f; + else if (args.value == "Indefinite") + return -1.0f; + else + return fuzzyToFloat(args.value, + std::numeric_limits::infinity()); + }); addKeyboardModifierSetting(layout, "Pause while holding a key", s.pauseChatModifier); layout.addCheckbox("Show input when it's empty", s.showEmptyInput);