2023-10-22 03:59:27 +00:00
|
|
|
// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
|
|
|
|
|
// SPDX-License-Identifier: LGPL-2.0-or-later
|
|
|
|
|
|
|
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Window
|
|
|
|
|
import QtQuick.Layouts
|
2023-11-05 05:14:39 +00:00
|
|
|
import QtQuick.Effects
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2023-11-05 05:14:39 +00:00
|
|
|
import org.kde.plasma.components 3.0 as PC3
|
2023-11-02 11:08:17 +00:00
|
|
|
import org.kde.plasma.private.mobileshell.state as MobileShellState
|
|
|
|
|
import org.kde.plasma.private.mobileshell as MobileShell
|
2023-10-22 03:59:27 +00:00
|
|
|
import org.kde.private.mobile.homescreen.folio 1.0 as Folio
|
2023-11-05 05:14:39 +00:00
|
|
|
import org.kde.kirigami as Kirigami
|
2023-10-22 03:59:27 +00:00
|
|
|
|
|
|
|
|
import "./delegate"
|
2023-11-05 05:14:39 +00:00
|
|
|
import "./private"
|
2023-10-22 03:59:27 +00:00
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
id: root
|
2024-06-21 04:42:14 +00:00
|
|
|
property Folio.HomeScreen folio
|
Folio/Halcyon: Expand Background Blur Effect using a MaskLayer
This merge request expands upon the folio and halcyon background blur effects, making the folio background blur include the backgrounds of folder icons, the favorites bar, and wallpaper selector, and for halcyon, it now includes the folder icons, app library, search, and wallpaper selector. To accomplish this, a mask layer plugin was created to easily attach to these elements. This way, we can use a `OpacityMask` to cut out from the existing blur layer, thus hopefully keeping the performance cost low. And with my limited testing, it does at least seems to run about the same on my oneplus 6t, though it is not really a low end device, so I can not fairly judge the impact for something slower (eg. PinePhone). To be on the safe side, a third option was also added to the folio settings, allowing for the ability to toggle back to the old functionality if needed.




2025-06-27 18:27:30 +00:00
|
|
|
property MobileShell.MaskManager maskManager
|
2023-10-22 03:59:27 +00:00
|
|
|
|
|
|
|
|
property int pageNum
|
|
|
|
|
|
|
|
|
|
property var pageModel
|
|
|
|
|
property var homeScreen
|
|
|
|
|
|
2025-05-01 09:04:38 +00:00
|
|
|
MobileShell.HapticsEffect {
|
|
|
|
|
id: haptics
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
// background when in settings view (for rearranging pages)
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: settingsViewBackground
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
color: Qt.rgba(255, 255, 255, 0.2)
|
2024-06-21 04:42:14 +00:00
|
|
|
opacity: folio.HomeScreenState.settingsOpenProgress
|
2023-10-22 03:59:27 +00:00
|
|
|
radius: Kirigami.Units.largeSpacing
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// square that shows when hovering over a spot to drop a delegate on
|
|
|
|
|
PlaceholderDelegate {
|
|
|
|
|
id: dragDropFeedback
|
2024-06-21 04:42:14 +00:00
|
|
|
folio: root.folio
|
|
|
|
|
width: folio.HomeScreenState.pageCellWidth
|
|
|
|
|
height: folio.HomeScreenState.pageCellHeight
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2024-06-21 04:42:14 +00:00
|
|
|
property var dropPosition: folio.HomeScreenState.dragState.candidateDropPosition
|
|
|
|
|
property var dropDelegate: folio.HomeScreenState.dragState.dropDelegate
|
2023-11-05 05:14:39 +00:00
|
|
|
property bool dropDelegateIsWidget: dropDelegate && dropDelegate.type === Folio.FolioDelegate.Widget
|
2023-10-22 03:59:27 +00:00
|
|
|
|
|
|
|
|
// only show if it is an empty spot on this page
|
2024-06-21 04:42:14 +00:00
|
|
|
visible: folio.HomeScreenState.swipeState === Folio.HomeScreenState.DraggingDelegate &&
|
Folio/Halcyon: Expand Background Blur Effect using a MaskLayer
This merge request expands upon the folio and halcyon background blur effects, making the folio background blur include the backgrounds of folder icons, the favorites bar, and wallpaper selector, and for halcyon, it now includes the folder icons, app library, search, and wallpaper selector. To accomplish this, a mask layer plugin was created to easily attach to these elements. This way, we can use a `OpacityMask` to cut out from the existing blur layer, thus hopefully keeping the performance cost low. And with my limited testing, it does at least seems to run about the same on my oneplus 6t, though it is not really a low end device, so I can not fairly judge the impact for something slower (eg. PinePhone). To be on the safe side, a third option was also added to the folio settings, allowing for the ability to toggle back to the old functionality if needed.




2025-06-27 18:27:30 +00:00
|
|
|
dropPosition.location === Folio.DelegateDragPosition.Pages &&
|
|
|
|
|
dropPosition.page === root.pageNum &&
|
|
|
|
|
!dropDelegateIsWidget &&
|
|
|
|
|
folio.HomeScreenState.getPageDelegateAt(root.pageNum, dropPosition.pageRow, dropPosition.pageColumn) === null
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2024-06-21 04:42:14 +00:00
|
|
|
x: dropPosition.pageColumn * folio.HomeScreenState.pageCellWidth
|
|
|
|
|
y: dropPosition.pageRow * folio.HomeScreenState.pageCellHeight
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
|
2023-11-05 05:14:39 +00:00
|
|
|
// square that shows when a widget hovers over a spot to drop a delegate on
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: widgetDragDropFeedback
|
2024-06-21 04:42:14 +00:00
|
|
|
width: (dropDelegateIsWidget ? dropDelegate.widget.gridWidth : 0) * folio.HomeScreenState.pageCellWidth
|
|
|
|
|
height: (dropDelegateIsWidget ? dropDelegate.widget.gridHeight : 0) * folio.HomeScreenState.pageCellHeight
|
2023-11-05 05:14:39 +00:00
|
|
|
|
2024-06-21 04:42:14 +00:00
|
|
|
property var dropPosition: folio.HomeScreenState.dragState.candidateDropPosition
|
|
|
|
|
property var dropDelegate: folio.HomeScreenState.dragState.dropDelegate
|
2023-11-05 05:14:39 +00:00
|
|
|
property bool dropDelegateIsWidget: dropDelegate && dropDelegate.type === Folio.FolioDelegate.Widget
|
|
|
|
|
|
|
|
|
|
// only show if the widget can be placed here
|
2024-06-21 04:42:14 +00:00
|
|
|
visible: folio.HomeScreenState.swipeState === Folio.HomeScreenState.DraggingDelegate &&
|
Folio/Halcyon: Expand Background Blur Effect using a MaskLayer
This merge request expands upon the folio and halcyon background blur effects, making the folio background blur include the backgrounds of folder icons, the favorites bar, and wallpaper selector, and for halcyon, it now includes the folder icons, app library, search, and wallpaper selector. To accomplish this, a mask layer plugin was created to easily attach to these elements. This way, we can use a `OpacityMask` to cut out from the existing blur layer, thus hopefully keeping the performance cost low. And with my limited testing, it does at least seems to run about the same on my oneplus 6t, though it is not really a low end device, so I can not fairly judge the impact for something slower (eg. PinePhone). To be on the safe side, a third option was also added to the folio settings, allowing for the ability to toggle back to the old functionality if needed.




2025-06-27 18:27:30 +00:00
|
|
|
dropPosition.location === Folio.DelegateDragPosition.Pages &&
|
|
|
|
|
dropPosition.page === root.pageNum &&
|
|
|
|
|
dropDelegateIsWidget &&
|
|
|
|
|
pageModel.canAddDelegate(dropPosition.pageRow, dropPosition.pageColumn, dropDelegate)
|
2023-11-05 05:14:39 +00:00
|
|
|
|
2024-07-27 04:02:05 +00:00
|
|
|
radius: Kirigami.Units.cornerRadius
|
2023-11-05 05:14:39 +00:00
|
|
|
color: Qt.rgba(255, 255, 255, 0.3)
|
|
|
|
|
|
2024-06-21 04:42:14 +00:00
|
|
|
x: dropPosition.pageColumn * folio.HomeScreenState.pageCellWidth
|
|
|
|
|
y: dropPosition.pageRow * folio.HomeScreenState.pageCellHeight
|
2023-11-05 05:14:39 +00:00
|
|
|
|
|
|
|
|
layer.enabled: true
|
|
|
|
|
layer.effect: DelegateShadow {}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// repeater of all delegates in the page
|
2023-10-22 03:59:27 +00:00
|
|
|
Repeater {
|
|
|
|
|
model: root.pageModel
|
|
|
|
|
|
|
|
|
|
delegate: Item {
|
|
|
|
|
id: delegate
|
|
|
|
|
|
|
|
|
|
property Folio.FolioPageDelegate pageDelegate: model.delegate
|
|
|
|
|
property int row: pageDelegate.row
|
|
|
|
|
property int column: pageDelegate.column
|
|
|
|
|
|
2024-06-21 04:42:14 +00:00
|
|
|
property var dragState: folio.HomeScreenState.dragState
|
2023-10-22 03:59:27 +00:00
|
|
|
|
|
|
|
|
property bool isDropPositionThis: dragState.candidateDropPosition.location === Folio.DelegateDragPosition.Pages &&
|
Folio/Halcyon: Expand Background Blur Effect using a MaskLayer
This merge request expands upon the folio and halcyon background blur effects, making the folio background blur include the backgrounds of folder icons, the favorites bar, and wallpaper selector, and for halcyon, it now includes the folder icons, app library, search, and wallpaper selector. To accomplish this, a mask layer plugin was created to easily attach to these elements. This way, we can use a `OpacityMask` to cut out from the existing blur layer, thus hopefully keeping the performance cost low. And with my limited testing, it does at least seems to run about the same on my oneplus 6t, though it is not really a low end device, so I can not fairly judge the impact for something slower (eg. PinePhone). To be on the safe side, a third option was also added to the folio settings, allowing for the ability to toggle back to the old functionality if needed.




2025-06-27 18:27:30 +00:00
|
|
|
dragState.candidateDropPosition.page === root.pageNum &&
|
|
|
|
|
dragState.candidateDropPosition.pageRow === delegate.pageDelegate.row &&
|
|
|
|
|
dragState.candidateDropPosition.pageColumn === delegate.pageDelegate.column
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2024-06-21 04:42:14 +00:00
|
|
|
property bool isAppHoveredOver: folio.HomeScreenState.swipeState === Folio.HomeScreenState.DraggingDelegate &&
|
Folio/Halcyon: Expand Background Blur Effect using a MaskLayer
This merge request expands upon the folio and halcyon background blur effects, making the folio background blur include the backgrounds of folder icons, the favorites bar, and wallpaper selector, and for halcyon, it now includes the folder icons, app library, search, and wallpaper selector. To accomplish this, a mask layer plugin was created to easily attach to these elements. This way, we can use a `OpacityMask` to cut out from the existing blur layer, thus hopefully keeping the performance cost low. And with my limited testing, it does at least seems to run about the same on my oneplus 6t, though it is not really a low end device, so I can not fairly judge the impact for something slower (eg. PinePhone). To be on the safe side, a third option was also added to the folio settings, allowing for the ability to toggle back to the old functionality if needed.




2025-06-27 18:27:30 +00:00
|
|
|
dragState.dropDelegate &&
|
|
|
|
|
dragState.dropDelegate.type === Folio.FolioDelegate.Application &&
|
|
|
|
|
isDropPositionThis
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2023-11-05 05:14:39 +00:00
|
|
|
implicitWidth: loader.item ? loader.item.implicitWidth : 0
|
|
|
|
|
implicitHeight: loader.item ? loader.item.implicitHeight : 0
|
|
|
|
|
width: loader.item ? loader.item.width : 0
|
|
|
|
|
height: loader.item ? loader.item.height : 0
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2024-06-21 04:42:14 +00:00
|
|
|
x: column * folio.HomeScreenState.pageCellWidth
|
|
|
|
|
y: row * folio.HomeScreenState.pageCellHeight
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2024-06-21 04:42:14 +00:00
|
|
|
visible: row >= 0 && row < folio.HomeScreenState.pageRows &&
|
Folio/Halcyon: Expand Background Blur Effect using a MaskLayer
This merge request expands upon the folio and halcyon background blur effects, making the folio background blur include the backgrounds of folder icons, the favorites bar, and wallpaper selector, and for halcyon, it now includes the folder icons, app library, search, and wallpaper selector. To accomplish this, a mask layer plugin was created to easily attach to these elements. This way, we can use a `OpacityMask` to cut out from the existing blur layer, thus hopefully keeping the performance cost low. And with my limited testing, it does at least seems to run about the same on my oneplus 6t, though it is not really a low end device, so I can not fairly judge the impact for something slower (eg. PinePhone). To be on the safe side, a third option was also added to the folio settings, allowing for the ability to toggle back to the old functionality if needed.




2025-06-27 18:27:30 +00:00
|
|
|
column >= 0 && column < folio.HomeScreenState.pageColumns
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2024-03-05 03:24:44 +00:00
|
|
|
// called when we want to delete this delegate
|
|
|
|
|
function removeSelf() {
|
|
|
|
|
// remove from model
|
|
|
|
|
root.pageModel.removeDelegate(delegate.row, delegate.column);
|
2024-06-21 04:42:14 +00:00
|
|
|
|
|
|
|
|
// TODO: this doesn't work, because the removeDelegate calls removes this entire object and the calls fail
|
|
|
|
|
// // delete empty pages at the end, and snap position to page that exists
|
|
|
|
|
// folio.PageListModel.deleteEmptyPagesAtEnd();
|
|
|
|
|
// folio.HomeScreenState.snapPage();
|
2024-03-05 03:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
Loader {
|
2023-11-05 05:14:39 +00:00
|
|
|
id: loader
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.left: parent.left
|
2023-10-22 03:59:27 +00:00
|
|
|
|
|
|
|
|
sourceComponent: {
|
|
|
|
|
if (delegate.pageDelegate.type === Folio.FolioDelegate.Application) {
|
|
|
|
|
return appComponent;
|
|
|
|
|
} else if (delegate.pageDelegate.type === Folio.FolioDelegate.Folder) {
|
|
|
|
|
return folderComponent;
|
2023-11-05 05:14:39 +00:00
|
|
|
} else if (delegate.pageDelegate.type === Folio.FolioDelegate.Widget) {
|
|
|
|
|
return widgetComponent;
|
2023-10-22 03:59:27 +00:00
|
|
|
} else {
|
|
|
|
|
return noneComponent;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Component {
|
|
|
|
|
id: noneComponent
|
|
|
|
|
|
|
|
|
|
Item {}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Component {
|
|
|
|
|
id: appComponent
|
|
|
|
|
|
|
|
|
|
AppDelegate {
|
|
|
|
|
id: appDelegate
|
2024-06-21 04:42:14 +00:00
|
|
|
folio: root.folio
|
Folio/Halcyon: Expand Background Blur Effect using a MaskLayer
This merge request expands upon the folio and halcyon background blur effects, making the folio background blur include the backgrounds of folder icons, the favorites bar, and wallpaper selector, and for halcyon, it now includes the folder icons, app library, search, and wallpaper selector. To accomplish this, a mask layer plugin was created to easily attach to these elements. This way, we can use a `OpacityMask` to cut out from the existing blur layer, thus hopefully keeping the performance cost low. And with my limited testing, it does at least seems to run about the same on my oneplus 6t, though it is not really a low end device, so I can not fairly judge the impact for something slower (eg. PinePhone). To be on the safe side, a third option was also added to the folio settings, allowing for the ability to toggle back to the old functionality if needed.




2025-06-27 18:27:30 +00:00
|
|
|
maskManager: root.maskManager
|
2024-06-21 04:42:14 +00:00
|
|
|
name: folio.FolioSettings.showPagesAppLabels ? delegate.pageDelegate.application.name : ""
|
2023-10-22 03:59:27 +00:00
|
|
|
application: delegate.pageDelegate.application
|
|
|
|
|
turnToFolder: delegate.isAppHoveredOver
|
2024-06-21 04:42:14 +00:00
|
|
|
turnToFolderAnimEnabled: folio.HomeScreenState.swipeState === Folio.HomeScreenState.DraggingDelegate
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2024-06-21 04:42:14 +00:00
|
|
|
implicitWidth: folio.HomeScreenState.pageCellWidth
|
|
|
|
|
implicitHeight: folio.HomeScreenState.pageCellHeight
|
|
|
|
|
width: folio.HomeScreenState.pageCellWidth
|
|
|
|
|
height: folio.HomeScreenState.pageCellHeight
|
2023-11-05 05:14:39 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
// do not show if the drop animation is running to this delegate
|
|
|
|
|
visible: !(root.homeScreen.dropAnimationRunning && delegate.isDropPositionThis)
|
|
|
|
|
|
|
|
|
|
// don't show label in drag and drop mode
|
|
|
|
|
labelOpacity: delegate.opacity
|
|
|
|
|
|
|
|
|
|
onPressAndHold: {
|
2025-04-21 14:01:54 +00:00
|
|
|
// prevent editing if lock layout is enabled
|
|
|
|
|
if (folio.FolioSettings.lockLayout) return;
|
|
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
let mappedCoords = root.homeScreen.prepareStartDelegateDrag(delegate.pageDelegate, appDelegate.delegateItem);
|
2024-06-21 04:42:14 +00:00
|
|
|
folio.HomeScreenState.startDelegatePageDrag(
|
2023-10-22 03:59:27 +00:00
|
|
|
mappedCoords.x,
|
|
|
|
|
mappedCoords.y,
|
2023-11-05 05:14:39 +00:00
|
|
|
appDelegate.pressPosition.x,
|
|
|
|
|
appDelegate.pressPosition.y,
|
2023-10-22 03:59:27 +00:00
|
|
|
root.pageNum,
|
|
|
|
|
delegate.pageDelegate.row,
|
|
|
|
|
delegate.pageDelegate.column
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
contextMenu.open();
|
2025-05-01 09:04:38 +00:00
|
|
|
haptics.buttonVibrate();
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
onPressAndHoldReleased: {
|
|
|
|
|
// cancel the event if the delegate is not dragged
|
2024-06-21 04:42:14 +00:00
|
|
|
if (folio.HomeScreenState.swipeState === Folio.HomeScreenState.AwaitingDraggingDelegate) {
|
2023-10-22 03:59:27 +00:00
|
|
|
homeScreen.cancelDelegateDrag();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onRightMousePress: {
|
|
|
|
|
contextMenu.open();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ContextMenuLoader {
|
|
|
|
|
id: contextMenu
|
|
|
|
|
|
|
|
|
|
// close menu when drag starts
|
|
|
|
|
Connections {
|
2024-06-21 04:42:14 +00:00
|
|
|
target: folio.HomeScreenState
|
2023-10-22 03:59:27 +00:00
|
|
|
|
|
|
|
|
function onSwipeStateChanged() {
|
2024-06-21 04:42:14 +00:00
|
|
|
if (folio.HomeScreenState.swipeState === Folio.HomeScreenState.DraggingDelegate) {
|
2023-10-22 03:59:27 +00:00
|
|
|
contextMenu.close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
actions: [
|
|
|
|
|
Kirigami.Action {
|
|
|
|
|
icon.name: "emblem-favorite"
|
|
|
|
|
text: i18n("Remove")
|
2025-04-21 14:01:54 +00:00
|
|
|
enabled: !folio.FolioSettings.lockLayout
|
2024-03-05 03:24:44 +00:00
|
|
|
onTriggered: delegate.removeSelf()
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Component {
|
|
|
|
|
id: folderComponent
|
|
|
|
|
|
|
|
|
|
AppFolderDelegate {
|
|
|
|
|
id: appFolderDelegate
|
2024-06-21 04:42:14 +00:00
|
|
|
folio: root.folio
|
Folio/Halcyon: Expand Background Blur Effect using a MaskLayer
This merge request expands upon the folio and halcyon background blur effects, making the folio background blur include the backgrounds of folder icons, the favorites bar, and wallpaper selector, and for halcyon, it now includes the folder icons, app library, search, and wallpaper selector. To accomplish this, a mask layer plugin was created to easily attach to these elements. This way, we can use a `OpacityMask` to cut out from the existing blur layer, thus hopefully keeping the performance cost low. And with my limited testing, it does at least seems to run about the same on my oneplus 6t, though it is not really a low end device, so I can not fairly judge the impact for something slower (eg. PinePhone). To be on the safe side, a third option was also added to the folio settings, allowing for the ability to toggle back to the old functionality if needed.




2025-06-27 18:27:30 +00:00
|
|
|
maskManager: root.maskManager
|
2024-06-21 04:42:14 +00:00
|
|
|
name: folio.FolioSettings.showPagesAppLabels ? delegate.pageDelegate.folder.name : ""
|
2023-10-22 03:59:27 +00:00
|
|
|
folder: delegate.pageDelegate.folder
|
|
|
|
|
|
2024-06-21 04:42:14 +00:00
|
|
|
implicitWidth: folio.HomeScreenState.pageCellWidth
|
|
|
|
|
implicitHeight: folio.HomeScreenState.pageCellHeight
|
|
|
|
|
width: folio.HomeScreenState.pageCellWidth
|
|
|
|
|
height: folio.HomeScreenState.pageCellHeight
|
2023-11-05 05:14:39 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
// do not show if the drop animation is running to this delegate, and the drop delegate is a folder
|
|
|
|
|
visible: !(root.homeScreen.dropAnimationRunning &&
|
Folio/Halcyon: Expand Background Blur Effect using a MaskLayer
This merge request expands upon the folio and halcyon background blur effects, making the folio background blur include the backgrounds of folder icons, the favorites bar, and wallpaper selector, and for halcyon, it now includes the folder icons, app library, search, and wallpaper selector. To accomplish this, a mask layer plugin was created to easily attach to these elements. This way, we can use a `OpacityMask` to cut out from the existing blur layer, thus hopefully keeping the performance cost low. And with my limited testing, it does at least seems to run about the same on my oneplus 6t, though it is not really a low end device, so I can not fairly judge the impact for something slower (eg. PinePhone). To be on the safe side, a third option was also added to the folio settings, allowing for the ability to toggle back to the old functionality if needed.




2025-06-27 18:27:30 +00:00
|
|
|
delegate.isDropPositionThis &&
|
|
|
|
|
delegate.dragState.dropDelegate.type === Folio.FolioDelegate.Folder)
|
2023-10-22 03:59:27 +00:00
|
|
|
|
|
|
|
|
// don't show label in drag and drop mode
|
|
|
|
|
labelOpacity: delegate.opacity
|
|
|
|
|
|
|
|
|
|
appHoveredOver: delegate.isAppHoveredOver
|
|
|
|
|
|
|
|
|
|
onAfterClickAnimation: {
|
|
|
|
|
const pos = homeScreen.prepareFolderOpen(appFolderDelegate.contentItem);
|
2024-06-21 04:42:14 +00:00
|
|
|
folio.HomeScreenState.openFolder(pos.x, pos.y, folder);
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onPressAndHold: {
|
2025-04-21 14:01:54 +00:00
|
|
|
// prevent editing if lock layout is enabled
|
|
|
|
|
if (folio.FolioSettings.lockLayout) return;
|
|
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
let mappedCoords = root.homeScreen.prepareStartDelegateDrag(delegate.pageDelegate, appFolderDelegate.delegateItem);
|
2024-06-21 04:42:14 +00:00
|
|
|
folio.HomeScreenState.startDelegatePageDrag(
|
2023-10-22 03:59:27 +00:00
|
|
|
mappedCoords.x,
|
|
|
|
|
mappedCoords.y,
|
2023-11-05 05:14:39 +00:00
|
|
|
appFolderDelegate.pressPosition.x,
|
|
|
|
|
appFolderDelegate.pressPosition.y,
|
2023-10-22 03:59:27 +00:00
|
|
|
root.pageNum,
|
|
|
|
|
delegate.pageDelegate.row,
|
|
|
|
|
delegate.pageDelegate.column
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
contextMenu.open();
|
2025-05-01 09:04:38 +00:00
|
|
|
haptics.buttonVibrate();
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onPressAndHoldReleased: {
|
|
|
|
|
// cancel the event if the delegate is not dragged
|
2024-06-21 04:42:14 +00:00
|
|
|
if (folio.HomeScreenState.swipeState === Folio.HomeScreenState.AwaitingDraggingDelegate) {
|
2023-10-22 03:59:27 +00:00
|
|
|
homeScreen.cancelDelegateDrag();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onRightMousePress: {
|
|
|
|
|
contextMenu.open();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ContextMenuLoader {
|
|
|
|
|
id: contextMenu
|
|
|
|
|
|
|
|
|
|
// close menu when drag starts
|
|
|
|
|
Connections {
|
2024-06-21 04:42:14 +00:00
|
|
|
target: folio.HomeScreenState
|
2023-10-22 03:59:27 +00:00
|
|
|
|
|
|
|
|
function onSwipeStateChanged() {
|
2024-06-21 04:42:14 +00:00
|
|
|
if (folio.HomeScreenState.swipeState === Folio.HomeScreenState.DraggingDelegate) {
|
2023-10-22 03:59:27 +00:00
|
|
|
contextMenu.close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
actions: [
|
|
|
|
|
Kirigami.Action {
|
|
|
|
|
icon.name: "emblem-favorite"
|
|
|
|
|
text: i18n("Remove")
|
2025-04-21 14:01:54 +00:00
|
|
|
enabled: !folio.FolioSettings.lockLayout
|
2024-03-06 14:19:03 +00:00
|
|
|
onTriggered: deleteDialog.open()
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
]
|
2024-03-06 14:19:03 +00:00
|
|
|
|
|
|
|
|
ConfirmDeleteFolderDialogLoader {
|
|
|
|
|
id: deleteDialog
|
|
|
|
|
parent: root.homeScreen
|
|
|
|
|
onAccepted: delegate.removeSelf()
|
|
|
|
|
}
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-11-05 05:14:39 +00:00
|
|
|
|
|
|
|
|
Component {
|
|
|
|
|
id: widgetComponent
|
|
|
|
|
|
|
|
|
|
WidgetDelegate {
|
|
|
|
|
id: widgetDelegate
|
2024-06-21 04:42:14 +00:00
|
|
|
folio: root.folio
|
2023-11-05 05:14:39 +00:00
|
|
|
|
|
|
|
|
// don't reparent applet if the drop animation is running to this delegate
|
|
|
|
|
// background: there is only one "visual" instance of the widget, once this delegate loads
|
|
|
|
|
// it will reparent it to here (but we don't want it to happen while the drop animation is running)
|
|
|
|
|
property bool suppressAppletReparent: (root.homeScreen.currentlyDraggedWidget === delegate.pageDelegate.widget)
|
Folio/Halcyon: Expand Background Blur Effect using a MaskLayer
This merge request expands upon the folio and halcyon background blur effects, making the folio background blur include the backgrounds of folder icons, the favorites bar, and wallpaper selector, and for halcyon, it now includes the folder icons, app library, search, and wallpaper selector. To accomplish this, a mask layer plugin was created to easily attach to these elements. This way, we can use a `OpacityMask` to cut out from the existing blur layer, thus hopefully keeping the performance cost low. And with my limited testing, it does at least seems to run about the same on my oneplus 6t, though it is not really a low end device, so I can not fairly judge the impact for something slower (eg. PinePhone). To be on the safe side, a third option was also added to the folio settings, allowing for the ability to toggle back to the old functionality if needed.




2025-06-27 18:27:30 +00:00
|
|
|
&& delegate.isDropPositionThis
|
2023-11-05 05:14:39 +00:00
|
|
|
|
|
|
|
|
visible: !suppressAppletReparent
|
|
|
|
|
widget: suppressAppletReparent ? null : delegate.pageDelegate.widget
|
|
|
|
|
|
|
|
|
|
onStartEditMode: (pressPoint) => {
|
2025-04-21 14:01:54 +00:00
|
|
|
// prevent editing if lock layout is enabled
|
|
|
|
|
if (folio.FolioSettings.lockLayout) return;
|
|
|
|
|
|
2023-11-05 05:14:39 +00:00
|
|
|
let mappedCoords = root.homeScreen.prepareStartDelegateDrag(delegate.pageDelegate, widgetDelegate);
|
2024-06-21 04:42:14 +00:00
|
|
|
folio.HomeScreenState.startDelegatePageDrag(
|
2023-11-05 05:14:39 +00:00
|
|
|
mappedCoords.x,
|
|
|
|
|
mappedCoords.y,
|
|
|
|
|
pressPoint.x - mappedCoords.x,
|
|
|
|
|
pressPoint.y - mappedCoords.y,
|
|
|
|
|
root.pageNum,
|
|
|
|
|
delegate.pageDelegate.row,
|
|
|
|
|
delegate.pageDelegate.column
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
widgetConfig.startOpen();
|
2025-05-01 09:04:38 +00:00
|
|
|
haptics.buttonVibrate();
|
2023-11-05 05:14:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onPressReleased: {
|
|
|
|
|
// cancel the event if the delegate is not dragged
|
2024-06-21 04:42:14 +00:00
|
|
|
if (folio.HomeScreenState.swipeState === Folio.HomeScreenState.AwaitingDraggingDelegate) {
|
|
|
|
|
folio.HomeScreenState.cancelDelegateDrag();
|
2023-11-05 05:14:39 +00:00
|
|
|
widgetConfig.fullyOpen();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-21 14:01:54 +00:00
|
|
|
layer.enabled: widgetDelegate.editMode && folio.FolioSettings.lockLayout === false
|
2023-11-05 05:14:39 +00:00
|
|
|
layer.effect: DarkenEffect {}
|
|
|
|
|
|
|
|
|
|
PC3.ToolTip {
|
|
|
|
|
visible: widgetDelegate.editMode && pressed
|
|
|
|
|
text: i18n('Release to configure, drag to move')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WidgetDelegateConfig {
|
|
|
|
|
id: widgetConfig
|
2024-06-21 04:42:14 +00:00
|
|
|
folio: root.folio
|
2023-11-05 05:14:39 +00:00
|
|
|
homeScreen: root.homeScreen
|
|
|
|
|
|
|
|
|
|
pageModel: root.pageModel
|
|
|
|
|
pageDelegate: delegate.pageDelegate
|
|
|
|
|
widget: delegate.pageDelegate.widget
|
|
|
|
|
|
|
|
|
|
pageNum: root.pageNum
|
|
|
|
|
row: delegate.row
|
|
|
|
|
column: delegate.column
|
|
|
|
|
|
|
|
|
|
widgetWidth: widgetDelegate.widgetWidth
|
|
|
|
|
widgetHeight: widgetDelegate.widgetHeight
|
|
|
|
|
widgetX: delegate.x + root.anchors.leftMargin + root.homeScreen.leftMargin
|
|
|
|
|
widgetY: delegate.y + root.anchors.topMargin + root.homeScreen.topMargin
|
|
|
|
|
|
|
|
|
|
topWidgetBackgroundPadding: widgetDelegate.topWidgetBackgroundPadding
|
|
|
|
|
bottomWidgetBackgroundPadding: widgetDelegate.bottomWidgetBackgroundPadding
|
|
|
|
|
leftWidgetBackgroundPadding: widgetDelegate.leftWidgetBackgroundPadding
|
|
|
|
|
rightWidgetBackgroundPadding: widgetDelegate.rightWidgetBackgroundPadding
|
|
|
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
|
|
onRemoveRequested: {
|
|
|
|
|
if (widget.applet) {
|
|
|
|
|
widget.destroyApplet();
|
|
|
|
|
}
|
2024-03-05 03:24:44 +00:00
|
|
|
delegate.removeSelf();
|
2023-11-05 05:14:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onClosed: widgetDelegate.editMode = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|