shift-shell/components/mobileshell/haptics.cpp
Devin Lin 3353cfc498 kcm: Add vibration setting for shell, and add vibrations
We can control shell vibrations from here, which can be replaced once there is a mechanism to control system-wide vibrations for QtFeedback.
2022-04-29 16:15:59 -04:00

26 lines
531 B
C++

/*
* SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "haptics.h"
#include <QFeedbackHapticsEffect>
#include "mobileshellsettings.h"
Haptics *Haptics::self()
{
static Haptics *singleton = new Haptics();
return singleton;
}
void Haptics::buttonVibrate()
{
if (MobileShellSettings::self()->vibrationsEnabled()) {
QFeedbackHapticsEffect rumble;
rumble.setIntensity(0.5);
rumble.setDuration(100);
rumble.start();
}
}