#include "FeelPage.hpp" #include "Application.hpp" #include "util/LayoutCreator.hpp" #include #include #include #include #define PAUSE_HOVERING "When hovering" #define SCROLL_SMOOTH "Smooth scrolling" #define SCROLL_NEWMSG "Smooth scrolling for new messages" #define LIMIT_CHATTERS_FOR_SMALLER_STREAMERS \ "Only fetch chatters list for viewers under X viewers" namespace chatterino { FeelPage::FeelPage() : SettingsPage("Feel", ":/settings/behave.svg") { LayoutCreator layoutCreator(this); auto layout = layoutCreator.setLayoutType(); // layout.append(this->createCheckBox("Use a seperate write connection.", // getSettings()->twitchSeperateWriteConnection)); layout.append(this->createCheckBox(SCROLL_SMOOTH, getSettings()->enableSmoothScrolling)); layout.append(this->createCheckBox( SCROLL_NEWMSG, getSettings()->enableSmoothScrollingNewMessages)); auto form = layout.emplace().withoutMargin(); { form->addRow( "", this->createCheckBox( "Show which users joined the channel (up to 1000 chatters)", getSettings()->showJoins)); form->addRow( "", this->createCheckBox( "Show which users parted the channel (up to 1000 chatters)", getSettings()->showParts)); form->addRow("Pause chat:", this->createCheckBox(PAUSE_HOVERING, getSettings()->pauseChatHover)); form->addRow("Mouse scroll speed:", this->createMouseScrollSlider()); form->addRow("Links:", this->createCheckBox("Open links only on double click", getSettings()->linksDoubleClickOnly)); form->addRow("", this->createCheckBox("Show link info in tooltips", getSettings()->enableLinkInfoTooltip)); } layout->addSpacing(16); { auto group = layout.emplace("Auto-completion"); auto groupLayout = group.setLayoutType(); groupLayout->addRow( LIMIT_CHATTERS_FOR_SMALLER_STREAMERS, this->createCheckBox( "", getSettings()->onlyFetchChattersForSmallerStreamers)); groupLayout->addRow( "What viewer count counts as a \"smaller streamer\"", this->createSpinBox(getSettings()->smallStreamerLimit, 10, 50000)); } { auto group = layout.emplace("Misc"); auto groupLayout = group.setLayoutType(); groupLayout.append(this->createCheckBox("Show whispers inline", getSettings()->inlineWhispers)); } layout->addStretch(1); } QSlider *FeelPage::createMouseScrollSlider() { auto slider = new QSlider(Qt::Horizontal); float currentValue = getSettings()->mouseScrollMultiplier; int sliderValue = int(((currentValue - 0.1f) / 2.f) * 99.f); slider->setValue(sliderValue); QObject::connect(slider, &QSlider::valueChanged, [=](int newValue) { float mul = static_cast(newValue) / 99.f; float newSliderValue = (mul * 2.1f) + 0.1f; getSettings()->mouseScrollMultiplier = newSliderValue; }); return slider; } } // namespace chatterino