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", "")
|
, streamlinkPath("/behaviour/streamlink/path", "")
|
||||||
, preferredQuality("/behaviour/streamlink/quality", "Choose")
|
, preferredQuality("/behaviour/streamlink/quality", "Choose")
|
||||||
, emoteScale(this->settingsItems, "emoteScale", 1.0)
|
, emoteScale(this->settingsItems, "emoteScale", 1.0)
|
||||||
, mouseScrollMultiplier(this->settingsItems, "mouseScrollMultiplier", 1.0)
|
|
||||||
, pathHighlightSound(this->settingsItems, "pathHighlightSound", "qrc:/sounds/ping2.wav")
|
, pathHighlightSound(this->settingsItems, "pathHighlightSound", "qrc:/sounds/ping2.wav")
|
||||||
, highlightProperties(this->settingsItems, "highlightProperties",
|
, highlightProperties(this->settingsItems, "highlightProperties",
|
||||||
QMap<QString, QPair<bool, bool>>())
|
QMap<QString, QPair<bool, bool>>())
|
||||||
|
|
|
@ -15,6 +15,7 @@ class SettingsManager : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
using BoolSetting = pajlada::Settings::Setting<bool>;
|
using BoolSetting = pajlada::Settings::Setting<bool>;
|
||||||
|
using FloatSetting = pajlada::Settings::Setting<float>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void load();
|
void load();
|
||||||
|
@ -43,6 +44,7 @@ public:
|
||||||
/// Behaviour
|
/// Behaviour
|
||||||
BoolSetting allowDuplicateMessages = {"/behaviour/allowDuplicateMessages", true};
|
BoolSetting allowDuplicateMessages = {"/behaviour/allowDuplicateMessages", true};
|
||||||
BoolSetting mentionUsersWithAt = {"/behaviour/mentionUsersWithAt", false};
|
BoolSetting mentionUsersWithAt = {"/behaviour/mentionUsersWithAt", false};
|
||||||
|
FloatSetting mouseScrollMultiplier = {"/behaviour/mouseScrollMultiplier", 1.0};
|
||||||
|
|
||||||
/// Commands
|
/// Commands
|
||||||
BoolSetting allowCommandsAtEnd = {"/commands/allowCommandsAtEnd", false};
|
BoolSetting allowCommandsAtEnd = {"/commands/allowCommandsAtEnd", false};
|
||||||
|
@ -69,7 +71,6 @@ public:
|
||||||
pajlada::Settings::Setting<std::string> preferredQuality;
|
pajlada::Settings::Setting<std::string> preferredQuality;
|
||||||
|
|
||||||
Setting<float> emoteScale;
|
Setting<float> emoteScale;
|
||||||
Setting<float> mouseScrollMultiplier;
|
|
||||||
|
|
||||||
Setting<QString> pathHighlightSound;
|
Setting<QString> pathHighlightSound;
|
||||||
Setting<QMap<QString, QPair<bool, bool>>> highlightProperties;
|
Setting<QMap<QString, QPair<bool, bool>>> highlightProperties;
|
||||||
|
|
|
@ -245,9 +245,8 @@ QString ChannelView::getSelectedText()
|
||||||
|
|
||||||
if (first) {
|
if (first) {
|
||||||
first = false;
|
first = false;
|
||||||
bool isSingleWord =
|
bool isSingleWord = isSingleMessage && this->selection.max.charIndex - charIndex <
|
||||||
isSingleMessage &&
|
part.getCharacterLength();
|
||||||
this->selection.max.charIndex - charIndex < part.getCharacterLength();
|
|
||||||
|
|
||||||
if (isSingleWord) {
|
if (isSingleWord) {
|
||||||
// return single word
|
// return single word
|
||||||
|
@ -526,8 +525,7 @@ void ChannelView::updateMessageBuffer(messages::MessageRef *messageRef, QPixmap
|
||||||
// this->selectionMax.messageIndex >= messageIndex) {
|
// this->selectionMax.messageIndex >= messageIndex) {
|
||||||
// painter.fillRect(buffer->rect(), QColor(24, 55, 25));
|
// painter.fillRect(buffer->rect(), QColor(24, 55, 25));
|
||||||
//} else {
|
//} else {
|
||||||
painter.fillRect(buffer->rect(),
|
painter.fillRect(buffer->rect(), (messageRef->getMessage()->getCanHighlightTab())
|
||||||
(messageRef->getMessage()->getCanHighlightTab())
|
|
||||||
? this->colorScheme.ChatBackgroundHighlighted
|
? this->colorScheme.ChatBackgroundHighlighted
|
||||||
: this->colorScheme.ChatBackground);
|
: this->colorScheme.ChatBackground);
|
||||||
//}
|
//}
|
||||||
|
@ -716,7 +714,7 @@ void ChannelView::drawMessageSelection(QPainter &painter, messages::MessageRef *
|
||||||
void ChannelView::wheelEvent(QWheelEvent *event)
|
void ChannelView::wheelEvent(QWheelEvent *event)
|
||||||
{
|
{
|
||||||
if (this->scrollBar.isVisible()) {
|
if (this->scrollBar.isVisible()) {
|
||||||
auto mouseMultiplier = SettingsManager::getInstance().mouseScrollMultiplier.get();
|
float mouseMultiplier = SettingsManager::getInstance().mouseScrollMultiplier;
|
||||||
|
|
||||||
this->scrollBar.setDesiredValue(
|
this->scrollBar.setDesiredValue(
|
||||||
this->scrollBar.getDesiredValue() - event->delta() / 10.0 * mouseMultiplier, true);
|
this->scrollBar.getDesiredValue() - event->delta() / 10.0 * mouseMultiplier, true);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "widgets/settingsdialog.hpp"
|
#include "widgets/settingsdialog.hpp"
|
||||||
#include "accountmanager.hpp"
|
#include "accountmanager.hpp"
|
||||||
|
#include "debug/log.hpp"
|
||||||
#include "twitch/twitchmessagebuilder.hpp"
|
#include "twitch/twitchmessagebuilder.hpp"
|
||||||
#include "twitch/twitchuser.hpp"
|
#include "twitch/twitchuser.hpp"
|
||||||
#include "widgets/helper/settingsdialogtab.hpp"
|
#include "widgets/helper/settingsdialogtab.hpp"
|
||||||
|
@ -315,12 +316,19 @@ QVBoxLayout *SettingsDialog::createBehaviourTab()
|
||||||
form->addRow(
|
form->addRow(
|
||||||
"", createCheckbox("Show last read message indicator", settings.showLastMessageIndicator));
|
"", 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);
|
auto scroll = new QSlider(Qt::Horizontal);
|
||||||
form->addRow("Mouse scroll speed:", scroll);
|
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("Streamlink path:", createLineEdit(settings.streamlinkPath));
|
||||||
form->addRow(this->createCombobox(
|
form->addRow(this->createCombobox(
|
||||||
"Preferred quality:", settings.preferredQuality,
|
"Preferred quality:", settings.preferredQuality,
|
||||||
|
@ -329,9 +337,6 @@ QVBoxLayout *SettingsDialog::createBehaviourTab()
|
||||||
setting = newValue.toStdString();
|
setting = newValue.toStdString();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// v->addWidget(scroll);
|
|
||||||
// v->addStretch(1);
|
|
||||||
// vbox->addLayout(v);
|
|
||||||
layout->addLayout(form);
|
layout->addLayout(form);
|
||||||
|
|
||||||
return layout;
|
return layout;
|
||||||
|
|
Loading…
Reference in a new issue