mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
parent
ba1c9598a4
commit
14e80d5012
|
@ -14,7 +14,6 @@ SettingsManager::SettingsManager()
|
|||
, streamlinkPath("/behaviour/streamlink/path", "")
|
||||
, preferredQuality("/behaviour/streamlink/quality", "Choose")
|
||||
, emoteScale(this->settingsItems, "emoteScale", 1.0)
|
||||
, mouseScrollMultiplier(this->settingsItems, "mouseScrollMultiplier", 1.0)
|
||||
, pathHighlightSound(this->settingsItems, "pathHighlightSound", "qrc:/sounds/ping2.wav")
|
||||
, highlightProperties(this->settingsItems, "highlightProperties",
|
||||
QMap<QString, QPair<bool, bool>>())
|
||||
|
|
|
@ -15,6 +15,7 @@ class SettingsManager : public QObject
|
|||
Q_OBJECT
|
||||
|
||||
using BoolSetting = pajlada::Settings::Setting<bool>;
|
||||
using FloatSetting = pajlada::Settings::Setting<float>;
|
||||
|
||||
public:
|
||||
void load();
|
||||
|
@ -43,6 +44,7 @@ public:
|
|||
/// Behaviour
|
||||
BoolSetting allowDuplicateMessages = {"/behaviour/allowDuplicateMessages", true};
|
||||
BoolSetting mentionUsersWithAt = {"/behaviour/mentionUsersWithAt", false};
|
||||
FloatSetting mouseScrollMultiplier = {"/behaviour/mouseScrollMultiplier", 1.0};
|
||||
|
||||
/// Commands
|
||||
BoolSetting allowCommandsAtEnd = {"/commands/allowCommandsAtEnd", false};
|
||||
|
@ -69,7 +71,6 @@ public:
|
|||
pajlada::Settings::Setting<std::string> preferredQuality;
|
||||
|
||||
Setting<float> emoteScale;
|
||||
Setting<float> mouseScrollMultiplier;
|
||||
|
||||
Setting<QString> pathHighlightSound;
|
||||
Setting<QMap<QString, QPair<bool, bool>>> highlightProperties;
|
||||
|
|
|
@ -245,9 +245,8 @@ QString ChannelView::getSelectedText()
|
|||
|
||||
if (first) {
|
||||
first = false;
|
||||
bool isSingleWord =
|
||||
isSingleMessage &&
|
||||
this->selection.max.charIndex - charIndex < part.getCharacterLength();
|
||||
bool isSingleWord = isSingleMessage && this->selection.max.charIndex - charIndex <
|
||||
part.getCharacterLength();
|
||||
|
||||
if (isSingleWord) {
|
||||
// return single word
|
||||
|
@ -526,10 +525,9 @@ void ChannelView::updateMessageBuffer(messages::MessageRef *messageRef, QPixmap
|
|||
// this->selectionMax.messageIndex >= messageIndex) {
|
||||
// painter.fillRect(buffer->rect(), QColor(24, 55, 25));
|
||||
//} else {
|
||||
painter.fillRect(buffer->rect(),
|
||||
(messageRef->getMessage()->getCanHighlightTab())
|
||||
? this->colorScheme.ChatBackgroundHighlighted
|
||||
: this->colorScheme.ChatBackground);
|
||||
painter.fillRect(buffer->rect(), (messageRef->getMessage()->getCanHighlightTab())
|
||||
? this->colorScheme.ChatBackgroundHighlighted
|
||||
: this->colorScheme.ChatBackground);
|
||||
//}
|
||||
|
||||
// draw selection
|
||||
|
@ -716,7 +714,7 @@ void ChannelView::drawMessageSelection(QPainter &painter, messages::MessageRef *
|
|||
void ChannelView::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
if (this->scrollBar.isVisible()) {
|
||||
auto mouseMultiplier = SettingsManager::getInstance().mouseScrollMultiplier.get();
|
||||
float mouseMultiplier = SettingsManager::getInstance().mouseScrollMultiplier;
|
||||
|
||||
this->scrollBar.setDesiredValue(
|
||||
this->scrollBar.getDesiredValue() - event->delta() / 10.0 * mouseMultiplier, true);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue