mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
added setting for pause on hover length
This commit is contained in:
parent
602a66f5bc
commit
3a9f9fa17b
3 changed files with 28 additions and 4 deletions
|
@ -102,7 +102,7 @@ public:
|
|||
BoolSetting prefixOnlyEmoteCompletion = {
|
||||
"/behaviour/autocompletion/prefixOnlyCompletion", true};
|
||||
|
||||
BoolSetting pauseChatOnHover = {"/behaviour/pauseChatHover", false};
|
||||
FloatSetting pauseOnHoverDuration = {"/behaviour/pauseOnHoverDuration", 0};
|
||||
EnumSetting<Qt::KeyboardModifier> pauseChatModifier = {
|
||||
"/behaviour/pauseChatModifier", Qt::KeyboardModifier::NoModifier};
|
||||
BoolSetting autorun = {"/behaviour/autorun", false};
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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<float>(
|
||||
"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<float>::infinity());
|
||||
});
|
||||
addKeyboardModifierSetting(layout, "Pause while holding a key",
|
||||
s.pauseChatModifier);
|
||||
layout.addCheckbox("Show input when it's empty", s.showEmptyInput);
|
||||
|
|
Loading…
Reference in a new issue