From fbc644fced2fff226804b774ea4b35461776325b Mon Sep 17 00:00:00 2001 From: Devin Lin Date: Fri, 8 Jul 2022 18:34:04 -0400 Subject: [PATCH] mobileshell: Implement base flickable with higher maximum swipe speed --- components/mobileshell/mobileshellplugin.cpp | 3 +++ components/mobileshell/qml/actiondrawer/ActionDrawer.qml | 2 +- components/mobileshell/qml/components/Flickable.qml | 8 ++++++++ components/mobileshell/qml/components/GridView.qml | 9 +++++++++ components/mobileshell/qml/components/ListView.qml | 9 +++++++++ components/mobileshell/resources.qrc | 3 +++ .../default/package/contents/ui/FlickContainer.qml | 2 +- .../package/contents/ui/appdrawer/GridViewAppDrawer.qml | 2 +- .../package/contents/ui/appdrawer/ListViewAppDrawer.qml | 2 +- .../halcyon/package/contents/ui/FavoritesGrid.qml | 2 +- .../halcyon/package/contents/ui/FavoritesView.qml | 1 + .../halcyon/package/contents/ui/FolderGrid.qml | 2 +- .../halcyon/package/contents/ui/GridAppList.qml | 3 ++- 13 files changed, 41 insertions(+), 7 deletions(-) create mode 100644 components/mobileshell/qml/components/Flickable.qml create mode 100644 components/mobileshell/qml/components/GridView.qml create mode 100644 components/mobileshell/qml/components/ListView.qml diff --git a/components/mobileshell/mobileshellplugin.cpp b/components/mobileshell/mobileshellplugin.cpp index 0da279fc..5a8a7de1 100644 --- a/components/mobileshell/mobileshellplugin.cpp +++ b/components/mobileshell/mobileshellplugin.cpp @@ -70,6 +70,9 @@ void MobileShellPlugin::registerTypes(const char *uri) // /components qmlRegisterType(resolvePath("components/BaseItem.qml"), uri, 1, 0, "BaseItem"); qmlRegisterType(resolvePath("components/ExtendedAbstractButton.qml"), uri, 1, 0, "ExtendedAbstractButton"); + qmlRegisterType(resolvePath("components/Flickable.qml"), uri, 1, 0, "Flickable"); + qmlRegisterType(resolvePath("components/GridView.qml"), uri, 1, 0, "GridView"); + qmlRegisterType(resolvePath("components/ListView.qml"), uri, 1, 0, "ListView"); 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"); diff --git a/components/mobileshell/qml/actiondrawer/ActionDrawer.qml b/components/mobileshell/qml/actiondrawer/ActionDrawer.qml index 1ed2863e..46bbe2f3 100644 --- a/components/mobileshell/qml/actiondrawer/ActionDrawer.qml +++ b/components/mobileshell/qml/actiondrawer/ActionDrawer.qml @@ -222,7 +222,7 @@ Item { onFinished: root.opened = true; } - Flickable { + MobileShell.Flickable { id: flickable anchors.fill: parent diff --git a/components/mobileshell/qml/components/Flickable.qml b/components/mobileshell/qml/components/Flickable.qml new file mode 100644 index 00000000..19e9c3b0 --- /dev/null +++ b/components/mobileshell/qml/components/Flickable.qml @@ -0,0 +1,8 @@ +// SPDX-FileCopyrightText: 2022 Devin Lin +// SPDX-License-Identifier: GPL-2.0-or-later + +import QtQuick 2.15 + +Flickable { + maximumFlickVelocity: 5000 +} diff --git a/components/mobileshell/qml/components/GridView.qml b/components/mobileshell/qml/components/GridView.qml new file mode 100644 index 00000000..47fd3478 --- /dev/null +++ b/components/mobileshell/qml/components/GridView.qml @@ -0,0 +1,9 @@ +// SPDX-FileCopyrightText: 2022 Devin Lin +// SPDX-License-Identifier: GPL-2.0-or-later + +import QtQuick 2.15 +import QtQuick.Controls 2.15 + +GridView { + maximumFlickVelocity: 5000 +} diff --git a/components/mobileshell/qml/components/ListView.qml b/components/mobileshell/qml/components/ListView.qml new file mode 100644 index 00000000..06b76003 --- /dev/null +++ b/components/mobileshell/qml/components/ListView.qml @@ -0,0 +1,9 @@ +// SPDX-FileCopyrightText: 2022 Devin Lin +// SPDX-License-Identifier: GPL-2.0-or-later + +import QtQuick 2.15 +import QtQuick.Controls 2.15 + +ListView { + maximumFlickVelocity: 5000 +} diff --git a/components/mobileshell/resources.qrc b/components/mobileshell/resources.qrc index ca8a5ffb..1f3d6baa 100644 --- a/components/mobileshell/resources.qrc +++ b/components/mobileshell/resources.qrc @@ -22,8 +22,11 @@ qml/components/BaseItem.qml qml/components/ExtendedAbstractButton.qml + qml/components/Flickable.qml + qml/components/GridView.qml qml/components/Haptics.qml qml/components/HapticsEffectWrapper.qml + qml/components/ListView.qml qml/components/MarqueeLabel.qml qml/components/StartupFeedback.qml qml/components/util.js diff --git a/containments/homescreens/default/package/contents/ui/FlickContainer.qml b/containments/homescreens/default/package/contents/ui/FlickContainer.qml index 4630b538..4cac37d8 100644 --- a/containments/homescreens/default/package/contents/ui/FlickContainer.qml +++ b/containments/homescreens/default/package/contents/ui/FlickContainer.qml @@ -13,7 +13,7 @@ import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.plasma.private.nanoshell 2.0 as NanoShell import org.kde.plasma.private.mobileshell 1.0 as MobileShell -Flickable { +MobileShell.Flickable { id: root required property var homeScreenState diff --git a/containments/homescreens/default/package/contents/ui/appdrawer/GridViewAppDrawer.qml b/containments/homescreens/default/package/contents/ui/appdrawer/GridViewAppDrawer.qml index f16e7f45..7a0fc4d2 100644 --- a/containments/homescreens/default/package/contents/ui/appdrawer/GridViewAppDrawer.qml +++ b/containments/homescreens/default/package/contents/ui/appdrawer/GridViewAppDrawer.qml @@ -24,7 +24,7 @@ import "../private" AbstractAppDrawer { id: root - contentItem: GridView { + contentItem: MobileShell.GridView { id: gridView clip: true diff --git a/containments/homescreens/default/package/contents/ui/appdrawer/ListViewAppDrawer.qml b/containments/homescreens/default/package/contents/ui/appdrawer/ListViewAppDrawer.qml index 04a4a6df..6b886e67 100644 --- a/containments/homescreens/default/package/contents/ui/appdrawer/ListViewAppDrawer.qml +++ b/containments/homescreens/default/package/contents/ui/appdrawer/ListViewAppDrawer.qml @@ -24,7 +24,7 @@ import "../private" AbstractAppDrawer { id: root - contentItem: ListView { + contentItem: MobileShell.ListView { id: listView clip: true reuseItems: true diff --git a/containments/homescreens/halcyon/package/contents/ui/FavoritesGrid.qml b/containments/homescreens/halcyon/package/contents/ui/FavoritesGrid.qml index 68be3a03..4fdf5496 100644 --- a/containments/homescreens/halcyon/package/contents/ui/FavoritesGrid.qml +++ b/containments/homescreens/halcyon/package/contents/ui/FavoritesGrid.qml @@ -16,7 +16,7 @@ import org.kde.kirigami 2.19 as Kirigami import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.phone.homescreen.halcyon 1.0 as Halcyon -GridView { +MobileShell.GridView { id: root required property var searchWidget diff --git a/containments/homescreens/halcyon/package/contents/ui/FavoritesView.qml b/containments/homescreens/halcyon/package/contents/ui/FavoritesView.qml index cb6ddb82..87d7e37d 100644 --- a/containments/homescreens/halcyon/package/contents/ui/FavoritesView.qml +++ b/containments/homescreens/halcyon/package/contents/ui/FavoritesView.qml @@ -18,6 +18,7 @@ import org.kde.phone.homescreen.halcyon 1.0 as Halcyon Item { id: root + layer.enabled: true required property bool interactive required property var searchWidget diff --git a/containments/homescreens/halcyon/package/contents/ui/FolderGrid.qml b/containments/homescreens/halcyon/package/contents/ui/FolderGrid.qml index 575fa3d9..1ea4201e 100644 --- a/containments/homescreens/halcyon/package/contents/ui/FolderGrid.qml +++ b/containments/homescreens/halcyon/package/contents/ui/FolderGrid.qml @@ -17,7 +17,7 @@ import org.kde.kirigami 2.19 as Kirigami import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.phone.homescreen.halcyon 1.0 as Halcyon -GridView { +MobileShell.GridView { id: root property Halcyon.ApplicationFolder folder: null diff --git a/containments/homescreens/halcyon/package/contents/ui/GridAppList.qml b/containments/homescreens/halcyon/package/contents/ui/GridAppList.qml index 03718ef7..bd0cb212 100644 --- a/containments/homescreens/halcyon/package/contents/ui/GridAppList.qml +++ b/containments/homescreens/halcyon/package/contents/ui/GridAppList.qml @@ -17,8 +17,9 @@ import org.kde.plasma.private.nanoshell 2.0 as NanoShell import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.phone.homescreen.halcyon 1.0 as Halcyon -GridView { +MobileShell.GridView { id: gridView + layer.enabled: true readonly property int reservedSpaceForLabel: metrics.height required property real effectiveContentWidth