adf3ff3075
cstdint) Make MessageElement to a class to fit better with the derived classes. Make MessageLayoutElement to a class to fit better with the derived classes. Remove virtual from override functions Replace all instances of boost::signals2 with pajlada::Signals. This lets us properly use clang code model to check for issues. Add missing virtual destructor to AbstractIrcServer Add missing virtual destructor to MessageLayoutElement Remove unused "connectedConnection" connection in TwitchChannel Fix typo in TrimChannelName function Fix typo in MessageParseArgs Replace some raw pointers with unique pointers where it made more sense. This allowed us to remove some manually written destructors whose only purpose was to delete that raw pointer. Reformat: Add namespace comments Reformat: Add empty empty lines between main namespace beginning and end Reformat: Re-order includes Reformat: Fix some includes that used quotes where they should use angle brackets Reformat: Replace some typedef's with using's Filter out more useless warnings
88 lines
3.4 KiB
C++
88 lines
3.4 KiB
C++
#include "behaviourpage.hpp"
|
|
|
|
#include <QFormLayout>
|
|
#include <QGroupBox>
|
|
#include <QLabel>
|
|
#include <QVBoxLayout>
|
|
|
|
#include <util/layoutcreator.hpp>
|
|
|
|
#define WINDOW_TOPMOST "Window always on top (requires restart)"
|
|
#define INPUT_EMPTY "Hide input box when empty"
|
|
#define LAST_MSG "Show last read message indicator (marks the spot where you left the window)"
|
|
#define PAUSE_HOVERING "When hovering"
|
|
|
|
#define LIMIT_CHATTERS_FOR_SMALLER_STREAMERS "Only fetch chatters list for viewers under X viewers"
|
|
|
|
#define STREAMLINK_QUALITY "Choose", "Source", "High", "Medium", "Low", "Audio only"
|
|
|
|
namespace chatterino {
|
|
namespace widgets {
|
|
namespace settingspages {
|
|
|
|
BehaviourPage::BehaviourPage()
|
|
: SettingsPage("Behaviour", ":/images/behave.svg")
|
|
{
|
|
singletons::SettingManager &settings = singletons::SettingManager::getInstance();
|
|
util::LayoutCreator<BehaviourPage> layoutCreator(this);
|
|
|
|
auto layout = layoutCreator.setLayoutType<QVBoxLayout>();
|
|
|
|
auto form = layout.emplace<QFormLayout>().withoutMargin();
|
|
{
|
|
form->addRow("Window:", this->createCheckBox(WINDOW_TOPMOST, settings.windowTopMost));
|
|
form->addRow("Messages:", this->createCheckBox(INPUT_EMPTY, settings.hideEmptyInput));
|
|
form->addRow("", this->createCheckBox(LAST_MSG, settings.showLastMessageIndicator));
|
|
form->addRow("Pause chat:", this->createCheckBox(PAUSE_HOVERING, settings.pauseChatHover));
|
|
|
|
form->addRow("Mouse scroll speed:", this->createMouseScrollSlider());
|
|
form->addRow("Links:", this->createCheckBox("Open links only on double click",
|
|
settings.linksDoubleClickOnly));
|
|
}
|
|
|
|
layout->addSpacing(16);
|
|
|
|
{
|
|
auto group = layout.emplace<QGroupBox>("Auto-completion");
|
|
auto groupLayout = group.setLayoutType<QFormLayout>();
|
|
groupLayout->addRow(
|
|
LIMIT_CHATTERS_FOR_SMALLER_STREAMERS,
|
|
this->createCheckBox("", settings.onlyFetchChattersForSmallerStreamers));
|
|
|
|
groupLayout->addRow("What viewer count counts as a \"smaller streamer\"",
|
|
this->createSpinBox(settings.smallStreamerLimit, 10, 50000));
|
|
}
|
|
|
|
{
|
|
auto group = layout.emplace<QGroupBox>("Streamlink");
|
|
auto groupLayout = group.setLayoutType<QFormLayout>();
|
|
groupLayout->addRow("Streamlink path:", this->createLineEdit(settings.streamlinkPath));
|
|
groupLayout->addRow("Prefered quality:",
|
|
this->createComboBox({STREAMLINK_QUALITY}, settings.preferredQuality));
|
|
groupLayout->addRow("Additional options:", this->createLineEdit(settings.streamlinkOpts));
|
|
}
|
|
|
|
layout->addStretch(1);
|
|
}
|
|
|
|
QSlider *BehaviourPage::createMouseScrollSlider()
|
|
{
|
|
auto slider = new QSlider(Qt::Horizontal);
|
|
|
|
float currentValue = singletons::SettingManager::getInstance().mouseScrollMultiplier;
|
|
int sliderValue = ((currentValue - 0.1f) / 2.f) * 99.f;
|
|
slider->setValue(sliderValue);
|
|
|
|
QObject::connect(slider, &QSlider::valueChanged, [](int newValue) {
|
|
float mul = static_cast<float>(newValue) / 99.f;
|
|
float newSliderValue = (mul * 2.1f) + 0.1f;
|
|
singletons::SettingManager::getInstance().mouseScrollMultiplier = newSliderValue;
|
|
});
|
|
|
|
return slider;
|
|
}
|
|
|
|
} // namespace settingspages
|
|
} // namespace widgets
|
|
} // namespace chatterino
|