Implement mouse scroll speed setting

Fixes #145
This commit is contained in:
Rasmus Karlsson
2017-12-19 02:47:55 +01:00
parent ba1c9598a4
commit 14e80d5012
4 changed files with 19 additions and 16 deletions
+11 -6
View File
@@ -1,5 +1,6 @@
#include "widgets/settingsdialog.hpp"
#include "accountmanager.hpp"
#include "debug/log.hpp"
#include "twitch/twitchmessagebuilder.hpp"
#include "twitch/twitchuser.hpp"
#include "widgets/helper/settingsdialogtab.hpp"
@@ -315,12 +316,19 @@ QVBoxLayout *SettingsDialog::createBehaviourTab()
form->addRow(
"", createCheckbox("Show last read message indicator", settings.showLastMessageIndicator));
// auto v = new QVBoxLayout();
// v->addWidget(new QLabel("Mouse scroll speed"));
auto scroll = new QSlider(Qt::Horizontal);
form->addRow("Mouse scroll speed:", scroll);
float currentValue = SettingsManager::getInstance().mouseScrollMultiplier;
int scrollValue = ((currentValue - 0.1f) / 2.f) * 99.f;
scroll->setValue(scrollValue);
connect(scroll, &QSlider::valueChanged, [](int newValue) {
float mul = static_cast<float>(newValue) / 99.f;
float newScrollValue = (mul * 2.1f) + 0.1f;
SettingsManager::getInstance().mouseScrollMultiplier = newScrollValue;
});
form->addRow("Streamlink path:", createLineEdit(settings.streamlinkPath));
form->addRow(this->createCombobox(
"Preferred quality:", settings.preferredQuality,
@@ -329,9 +337,6 @@ QVBoxLayout *SettingsDialog::createBehaviourTab()
setting = newValue.toStdString();
}));
// v->addWidget(scroll);
// v->addStretch(1);
// vbox->addLayout(v);
layout->addLayout(form);
return layout;