mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
Folio: Add Haptic Feedback
This merge request adds haptic feedback to the folio home screen when: - Pressing and holding on an app icon - Pressing and holding on an widget - Pressing and holding for opening the settings component
This commit is contained in:
parent
be730d36db
commit
8e3e05ddea
6 changed files with 41 additions and 2 deletions
|
|
@ -78,6 +78,10 @@ MobileShell.GridView {
|
|||
id: velocityCalculator
|
||||
}
|
||||
|
||||
MobileShell.HapticsEffect {
|
||||
id: haptics
|
||||
}
|
||||
|
||||
model: folio.ApplicationListSearchModel
|
||||
|
||||
delegate: AppDelegate {
|
||||
|
|
@ -96,6 +100,7 @@ MobileShell.GridView {
|
|||
|
||||
const mappedCoords = root.homeScreen.prepareStartDelegateDrag(model.delegate, appDelegate.delegateItem, true);
|
||||
folio.HomeScreenState.closeAppDrawer();
|
||||
haptics.buttonVibrate();
|
||||
|
||||
// we need to adjust because app drawer delegates have a different size than regular homescreen delegates
|
||||
const centerX = mappedCoords.x + root.cellWidth / 2;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,14 @@ MouseArea {
|
|||
|
||||
signal delegateDragRequested(var item)
|
||||
|
||||
onPressAndHold: folio.HomeScreenState.openSettingsView()
|
||||
onPressAndHold: {
|
||||
folio.HomeScreenState.openSettingsView();
|
||||
haptics.buttonVibrate();
|
||||
}
|
||||
|
||||
MobileShell.HapticsEffect {
|
||||
id: haptics
|
||||
}
|
||||
|
||||
Repeater {
|
||||
id: repeater
|
||||
|
|
@ -121,6 +128,7 @@ MouseArea {
|
|||
);
|
||||
|
||||
contextMenu.open();
|
||||
haptics.buttonVibrate();
|
||||
}
|
||||
|
||||
onPressAndHoldReleased: {
|
||||
|
|
@ -196,6 +204,7 @@ MouseArea {
|
|||
);
|
||||
|
||||
contextMenu.open();
|
||||
haptics.buttonVibrate();
|
||||
}
|
||||
|
||||
onPressAndHoldReleased: {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,10 @@ Folio.DelegateTouchArea {
|
|||
|
||||
property Folio.FolioApplicationFolder folder: folio.HomeScreenState.currentFolder
|
||||
|
||||
MobileShell.HapticsEffect {
|
||||
id: haptics
|
||||
}
|
||||
|
||||
onClicked: close();
|
||||
|
||||
function close() {
|
||||
|
|
@ -260,6 +264,7 @@ Folio.DelegateTouchArea {
|
|||
);
|
||||
|
||||
contextMenu.open();
|
||||
haptics.buttonVibrate();
|
||||
}
|
||||
|
||||
onPressAndHoldReleased: {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,10 @@ Item {
|
|||
property var pageModel
|
||||
property var homeScreen
|
||||
|
||||
MobileShell.HapticsEffect {
|
||||
id: haptics
|
||||
}
|
||||
|
||||
// background when in settings view (for rearranging pages)
|
||||
Rectangle {
|
||||
id: settingsViewBackground
|
||||
|
|
@ -189,6 +193,7 @@ Item {
|
|||
);
|
||||
|
||||
contextMenu.open();
|
||||
haptics.buttonVibrate();
|
||||
}
|
||||
onPressAndHoldReleased: {
|
||||
// cancel the event if the delegate is not dragged
|
||||
|
|
@ -272,6 +277,7 @@ Item {
|
|||
);
|
||||
|
||||
contextMenu.open();
|
||||
haptics.buttonVibrate();
|
||||
}
|
||||
|
||||
onPressAndHoldReleased: {
|
||||
|
|
@ -349,6 +355,7 @@ Item {
|
|||
);
|
||||
|
||||
widgetConfig.startOpen();
|
||||
haptics.buttonVibrate();
|
||||
}
|
||||
|
||||
onPressReleased: {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import QtQuick.Window
|
|||
import QtQuick.Layouts
|
||||
|
||||
import org.kde.plasma.components 3.0 as PC3
|
||||
import org.kde.plasma.private.mobileshell as MobileShell
|
||||
import org.kde.kirigami 2.10 as Kirigami
|
||||
import org.kde.private.mobile.homescreen.folio 1.0 as Folio
|
||||
|
||||
|
|
@ -18,7 +19,14 @@ MouseArea {
|
|||
readonly property real verticalMargin: Math.round((folio.HomeScreenState.pageHeight - folio.HomeScreenState.pageContentHeight) / 2)
|
||||
readonly property real horizontalMargin: Math.round((folio.HomeScreenState.pageWidth - folio.HomeScreenState.pageContentWidth) / 2)
|
||||
|
||||
onPressAndHold: folio.HomeScreenState.openSettingsView()
|
||||
MobileShell.HapticsEffect {
|
||||
id: haptics
|
||||
}
|
||||
|
||||
onPressAndHold: {
|
||||
folio.HomeScreenState.openSettingsView()
|
||||
haptics.buttonVibrate();
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: folio.PageListModel
|
||||
|
|
|
|||
|
|
@ -30,6 +30,10 @@ MouseArea {
|
|||
Kirigami.Theme.inherit: false
|
||||
Kirigami.Theme.colorSet: Kirigami.Theme.Complementary
|
||||
|
||||
MobileShell.HapticsEffect {
|
||||
id: haptics
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Qt.rgba(0, 0, 0, 0.7)
|
||||
|
|
@ -119,6 +123,7 @@ MouseArea {
|
|||
onPressAndHold: {
|
||||
root.requestClose();
|
||||
folio.HomeScreenState.closeSettingsView();
|
||||
haptics.buttonVibrate();
|
||||
|
||||
let mappedCoords = root.homeScreen.prepareStartDelegateDrag(null, delegate, true);
|
||||
const widthOffset = folio.HomeScreenState.pageCellWidth / 2;
|
||||
|
|
|
|||
Loading…
Reference in a new issue