Skip to content

Commit

Permalink
Rename kinetic scroll "sensitivity" to "threshold"
Browse files Browse the repository at this point in the history
Since that's what it really is, so it's more obvious what this setting
does. This inverts the value, 0 threshold is the same as 100 sensitivity
previously. The default value is now 10, since otherwise it's very easy
to make errant inputs with the slightest amount of slop.
  • Loading branch information
askmeaboutlo0m committed Sep 11, 2023
1 parent 6f192df commit 882e943
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
21 changes: 10 additions & 11 deletions src/desktop/dialogs/settingsdialog/userinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,22 +104,21 @@ void UserInterface::initKineticScrolling(
settings.bindKineticScrollGesture(kineticScrollGesture, Qt::UserRole);
form->addRow(tr("Kinetic scrolling:"), kineticScrollGesture);

KisSliderSpinBox *sensitivity = new KisSliderSpinBox;
sensitivity->setRange(0, 100);
sensitivity->setPrefix(tr("Sensitivity: "));
settings.bindKineticScrollSensitivity(sensitivity);
form->addRow(nullptr, sensitivity);
KisSliderSpinBox *threshold = new KisSliderSpinBox;
threshold->setRange(0, 100);
threshold->setPrefix(tr("Threshold: "));
settings.bindKineticScrollThreshold(threshold);
form->addRow(nullptr, threshold);

QCheckBox *hideBars = new QCheckBox(tr("Hide scroll bars"));
settings.bindKineticScrollHideBars(hideBars);
form->addRow(nullptr, hideBars);

settings.bindKineticScrollGesture(
this, [sensitivity, hideBars](int gesture) {
bool enabled = gesture != int(KineticScrollGesture::None);
sensitivity->setEnabled(enabled);
hideBars->setEnabled(enabled);
});
settings.bindKineticScrollGesture(this, [threshold, hideBars](int gesture) {
bool enabled = gesture != int(KineticScrollGesture::None);
threshold->setEnabled(enabled);
hideBars->setEnabled(enabled);
});

form->addRow(
nullptr, utils::note(
Expand Down
2 changes: 1 addition & 1 deletion src/desktop/settings_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ SETTING(interfaceMode , InterfaceMode , "settings/interf
SETTING(inviteLinkType , InviteLinkType , "invites/linktype" , dialogs::InviteDialog::LinkType::Web)
SETTING(inviteIncludePassword , InviteIncludePassword , "invites/includepassword" , false)
SETTING(kineticScrollGesture , KineticScrollGesture , "settings/kineticscroll/gesture" , int(KINETIC_SCROLL_GESTURE_DEFAULT))
SETTING(kineticScrollSensitivity , KineticScrollSensitivity , "settings/kineticscroll/sensititivy" , 100)
SETTING(kineticScrollThreshold , KineticScrollThreshold , "settings/kineticscroll/threshold" , 10)
SETTING(kineticScrollHideBars , KineticScrollHideBars , "settings/kineticscroll/hidebars" , false)
SETTING(language , Language , "settings/language" , QString())
SETTING(lastAnnounce , LastAnnounce , "history/announce" , false)
Expand Down
3 changes: 2 additions & 1 deletion src/desktop/utils/widgetutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ void initKineticScrolling(QAbstractScrollArea *scrollArea)
// SPDX-License-Identifier: GPL-3.0-or-later
// SDPX—SnippetName: Kinetic scroll setup from Krita
if(scrollArea && enabled) {
int sensitivity = settings.kineticScrollSensitivity();
int sensitivity =
100 - qBound(0, settings.kineticScrollThreshold(), 100);
bool hideScrollBars = settings.kineticScrollHideBars();
float resistanceCoefficient = 10.0f;
float dragVelocitySmoothFactor = 1.0f;
Expand Down

0 comments on commit 882e943

Please sign in to comment.