mobileshell: Use pointer for haptics

This commit is contained in:
Devin Lin 2022-11-11 11:37:23 -05:00
parent 7d3bf39750
commit 7aaa6f4cd2
2 changed files with 7 additions and 5 deletions

View file

@ -19,7 +19,6 @@
#include <QDBusPendingReply>
#include <QDateTime>
#include <QDebug>
#include <QFeedbackHapticsEffect>
#include <QFile>
#include <QProcess>
@ -29,6 +28,7 @@ ShellUtil::ShellUtil(QObject *parent)
: QObject{parent}
, m_localeConfig{KSharedConfig::openConfig(QStringLiteral("kdeglobals"), KConfig::SimpleConfig)}
, m_launchingApp{nullptr}
, m_hapticsEffect{std::make_unique<QFeedbackHapticsEffect>()}
{
m_localeConfigWatcher = KConfigWatcher::create(m_localeConfig);
@ -137,9 +137,8 @@ void ShellUtil::clearLaunchingApp()
void ShellUtil::buttonVibrate()
{
if (MobileShellSettings::self()->vibrationsEnabled()) {
QFeedbackHapticsEffect rumble;
rumble.setDuration(MobileShellSettings::self()->vibrationDuration());
rumble.setIntensity(MobileShellSettings::self()->vibrationIntensity());
rumble.start();
m_hapticsEffect->setDuration(MobileShellSettings::self()->vibrationDuration());
m_hapticsEffect->setIntensity(MobileShellSettings::self()->vibrationIntensity());
m_hapticsEffect->start();
}
}

View file

@ -7,6 +7,7 @@
#pragma once
#include <QFeedbackHapticsEffect>
#include <QObject>
#include <QQuickItem>
@ -98,4 +99,6 @@ private:
KIO::ApplicationLauncherJob *m_launchingApp;
QVector<qint64> m_launchingAppPids;
std::unique_ptr<QFeedbackHapticsEffect> m_hapticsEffect;
};