mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-02 17:54:45 +00:00
Remove QtFeedback dependency
This commit is contained in:
parent
3353cfc498
commit
2201ebd1d7
8 changed files with 48 additions and 52 deletions
|
|
@ -46,7 +46,6 @@ find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED
|
||||||
Qml
|
Qml
|
||||||
Quick
|
Quick
|
||||||
QuickCompiler
|
QuickCompiler
|
||||||
Feedback
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if (QUICK_COMPILER)
|
if (QUICK_COMPILER)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||||
|
|
||||||
set(mobileshellplugin_SRCS
|
set(mobileshellplugin_SRCS
|
||||||
mobileshellplugin.cpp
|
mobileshellplugin.cpp
|
||||||
haptics.cpp
|
|
||||||
mobileshellsettings.cpp
|
mobileshellsettings.cpp
|
||||||
quicksetting.cpp
|
quicksetting.cpp
|
||||||
quicksettingsmodel.cpp
|
quicksettingsmodel.cpp
|
||||||
|
|
@ -38,7 +37,6 @@ target_link_libraries(mobileshellplugin
|
||||||
Qt::Qml
|
Qt::Qml
|
||||||
Qt::Gui
|
Qt::Gui
|
||||||
Qt::Quick
|
Qt::Quick
|
||||||
Qt::Feedback
|
|
||||||
KF5::ConfigWidgets # for KStandardAction
|
KF5::ConfigWidgets # for KStandardAction
|
||||||
KF5::KIOGui
|
KF5::KIOGui
|
||||||
KF5::Plasma
|
KF5::Plasma
|
||||||
|
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
/*
|
|
||||||
* 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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
|
||||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
class Haptics : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
static Haptics *self();
|
|
||||||
|
|
||||||
Q_INVOKABLE void buttonVibrate();
|
|
||||||
};
|
|
||||||
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
#include "taskswitcher/displaysmodel.h"
|
#include "taskswitcher/displaysmodel.h"
|
||||||
|
|
||||||
#include "haptics.h"
|
|
||||||
#include "mobileshellsettings.h"
|
#include "mobileshellsettings.h"
|
||||||
#include "quicksetting.h"
|
#include "quicksetting.h"
|
||||||
#include "quicksettingsmodel.h"
|
#include "quicksettingsmodel.h"
|
||||||
|
|
@ -39,10 +38,6 @@ void MobileShellPlugin::registerTypes(const char *uri)
|
||||||
return ShellUtil::instance();
|
return ShellUtil::instance();
|
||||||
});
|
});
|
||||||
|
|
||||||
qmlRegisterSingletonType<Haptics>(uri, 1, 0, "Haptics", [](QQmlEngine *, QJSEngine *) -> QObject * {
|
|
||||||
return Haptics::self();
|
|
||||||
});
|
|
||||||
|
|
||||||
qmlRegisterSingletonType<MobileShellSettings>(uri, 1, 0, "MobileShellSettings", [](QQmlEngine *, QJSEngine *) -> QObject * {
|
qmlRegisterSingletonType<MobileShellSettings>(uri, 1, 0, "MobileShellSettings", [](QQmlEngine *, QJSEngine *) -> QObject * {
|
||||||
return MobileShellSettings::self();
|
return MobileShellSettings::self();
|
||||||
});
|
});
|
||||||
|
|
@ -82,6 +77,7 @@ void MobileShellPlugin::registerTypes(const char *uri)
|
||||||
|
|
||||||
// /components
|
// /components
|
||||||
qmlRegisterType(resolvePath("components/BaseItem.qml"), uri, 1, 0, "BaseItem");
|
qmlRegisterType(resolvePath("components/BaseItem.qml"), uri, 1, 0, "BaseItem");
|
||||||
|
qmlRegisterSingletonType(resolvePath("components/Haptics.qml"), uri, 1, 0, "Haptics");
|
||||||
qmlRegisterType(resolvePath("components/StartupFeedback.qml"), uri, 1, 0, "StartupFeedback");
|
qmlRegisterType(resolvePath("components/StartupFeedback.qml"), uri, 1, 0, "StartupFeedback");
|
||||||
qmlRegisterType(resolvePath("components/VelocityCalculator.qml"), uri, 1, 0, "VelocityCalculator");
|
qmlRegisterType(resolvePath("components/VelocityCalculator.qml"), uri, 1, 0, "VelocityCalculator");
|
||||||
|
|
||||||
|
|
|
||||||
31
components/mobileshell/qml/components/Haptics.qml
Normal file
31
components/mobileshell/qml/components/Haptics.qml
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||||
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
import QtQuick 2.15
|
||||||
|
import QtFeedback 5.0
|
||||||
|
|
||||||
|
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||||
|
|
||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
QtObject {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
function buttonVibrate() {
|
||||||
|
if (MobileShell.MobileShellSettings.vibrationsEnabled) {
|
||||||
|
if (hapticsEffect.status == Loader.Ready) {
|
||||||
|
hapticsEffect.item.intensity = 0.5;
|
||||||
|
hapticsEffect.item.duration = 100;
|
||||||
|
hapticsEffect.item.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
hapticsEffect.setSource("HapticsEffectWrapper.qml");
|
||||||
|
}
|
||||||
|
|
||||||
|
property var hapticsEffect: Loader {}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||||
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
import QtQuick 2.15
|
||||||
|
import QtFeedback 5.0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Private component that wraps a QtFeedback HapticsEffect, so that we can optionally load
|
||||||
|
* this component.
|
||||||
|
*/
|
||||||
|
|
||||||
|
HapticsEffect {}
|
||||||
|
|
@ -21,6 +21,8 @@
|
||||||
<file>qml/actiondrawer/PortraitContentContainer.qml</file>
|
<file>qml/actiondrawer/PortraitContentContainer.qml</file>
|
||||||
|
|
||||||
<file>qml/components/BaseItem.qml</file>
|
<file>qml/components/BaseItem.qml</file>
|
||||||
|
<file>qml/components/Haptics.qml</file>
|
||||||
|
<file>qml/components/HapticsEffectWrapper.qml</file>
|
||||||
<file>qml/components/MarqueeLabel.qml</file>
|
<file>qml/components/MarqueeLabel.qml</file>
|
||||||
<file>qml/components/StartupFeedback.qml</file>
|
<file>qml/components/StartupFeedback.qml</file>
|
||||||
<file>qml/components/util.js</file>
|
<file>qml/components/util.js</file>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue