Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
Plasma Mobile
Commits
2201ebd1
Commit
2201ebd1
authored
Apr 29, 2022
by
Devin Lin
🎨
Browse files
Remove QtFeedback dependency
parent
3353cfc4
Pipeline
#169864
passed with stage
in 1 minute and 19 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
2201ebd1
...
...
@@ -46,7 +46,6 @@ find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED
Qml
Quick
QuickCompiler
Feedback
)
if
(
QUICK_COMPILER
)
...
...
components/mobileshell/CMakeLists.txt
View file @
2201ebd1
...
...
@@ -6,7 +6,6 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
set
(
mobileshellplugin_SRCS
mobileshellplugin.cpp
haptics.cpp
mobileshellsettings.cpp
quicksetting.cpp
quicksettingsmodel.cpp
...
...
@@ -38,7 +37,6 @@ target_link_libraries(mobileshellplugin
Qt::Qml
Qt::Gui
Qt::Quick
Qt::Feedback
KF5::ConfigWidgets
# for KStandardAction
KF5::KIOGui
KF5::Plasma
...
...
components/mobileshell/haptics.cpp
deleted
100644 → 0
View file @
3353cfc4
/*
* 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
();
}
}
components/mobileshell/mobileshellplugin.cpp
View file @
2201ebd1
...
...
@@ -19,7 +19,6 @@
#include
"taskswitcher/displaysmodel.h"
#include
"haptics.h"
#include
"mobileshellsettings.h"
#include
"quicksetting.h"
#include
"quicksettingsmodel.h"
...
...
@@ -39,10 +38,6 @@ void MobileShellPlugin::registerTypes(const char *uri)
return
ShellUtil
::
instance
();
});
qmlRegisterSingletonType
<
Haptics
>
(
uri
,
1
,
0
,
"Haptics"
,
[](
QQmlEngine
*
,
QJSEngine
*
)
->
QObject
*
{
return
Haptics
::
self
();
});
qmlRegisterSingletonType
<
MobileShellSettings
>
(
uri
,
1
,
0
,
"MobileShellSettings"
,
[](
QQmlEngine
*
,
QJSEngine
*
)
->
QObject
*
{
return
MobileShellSettings
::
self
();
});
...
...
@@ -82,6 +77,7 @@ void MobileShellPlugin::registerTypes(const char *uri)
// /components
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/VelocityCalculator.qml"
),
uri
,
1
,
0
,
"VelocityCalculator"
);
...
...
components/mobileshell/qml/components/Haptics.qml
0 → 100644
View file @
2201ebd1
/*
* 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
{}
}
components/mobileshell/
haptics.h
→
components/mobileshell/
qml/components/HapticsEffectWrapper.qml
View file @
2201ebd1
...
...
@@ -3,16 +3,12 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
import
QtQuick
2.15
import
QtFeedback
5.0
#include
<QObject>
class
Haptics
:
public
QObject
{
Q_OBJECT
public:
static
Haptics
*
self
();
/**
* Private component that wraps a QtFeedback HapticsEffect, so that we can optionally load
* this component.
*/
Q_INVOKABLE
void
buttonVibrate
();
};
HapticsEffect
{}
components/mobileshell/resources.qrc
View file @
2201ebd1
...
...
@@ -21,6 +21,8 @@
<file>qml/actiondrawer/PortraitContentContainer.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/StartupFeedback.qml</file>
<file>qml/components/util.js</file>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment