mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
homescreens/halcyon: Add search widget open gesture
This commit is contained in:
parent
61375dc48e
commit
213faea679
2 changed files with 29 additions and 15 deletions
|
|
@ -21,15 +21,13 @@ GridView {
|
||||||
id: gridView
|
id: gridView
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
signal launched
|
|
||||||
|
|
||||||
readonly property int reservedSpaceForLabel: metrics.height
|
readonly property int reservedSpaceForLabel: metrics.height
|
||||||
|
|
||||||
cellWidth: width / Math.min(Math.floor(width / (PlasmaCore.Units.iconSizes.huge + Kirigami.Units.largeSpacing * 2)), 8)
|
cellWidth: width / Math.min(Math.floor(width / (PlasmaCore.Units.iconSizes.huge + Kirigami.Units.largeSpacing * 2)), 8)
|
||||||
cellHeight: cellWidth + reservedSpaceForLabel
|
cellHeight: cellWidth + reservedSpaceForLabel
|
||||||
|
|
||||||
property int columns: Math.floor(width / cellWidth)
|
property int columns: Math.floor(width / cellWidth)
|
||||||
property int rows: Math.ceil(model.count / columns)
|
property int rows: Math.ceil(Halcyon.ApplicationListModel.count / columns)
|
||||||
|
|
||||||
cacheBuffer: Math.max(0, rows * cellHeight)
|
cacheBuffer: Math.max(0, rows * cellHeight)
|
||||||
|
|
||||||
|
|
@ -37,13 +35,13 @@ GridView {
|
||||||
|
|
||||||
header: Controls.Control {
|
header: Controls.Control {
|
||||||
implicitWidth: gridView.width
|
implicitWidth: gridView.width
|
||||||
topPadding: PlasmaCore.Units.largeSpacing
|
topPadding: PlasmaCore.Units.largeSpacing + Math.round(gridView.height * 0.2)
|
||||||
bottomPadding: PlasmaCore.Units.largeSpacing
|
bottomPadding: PlasmaCore.Units.largeSpacing
|
||||||
leftPadding: PlasmaCore.Units.smallSpacing
|
leftPadding: PlasmaCore.Units.smallSpacing
|
||||||
|
|
||||||
contentItem: PlasmaExtras.Heading {
|
contentItem: PC3.Label {
|
||||||
color: "white"
|
color: "white"
|
||||||
level: 1
|
font.pointSize: 16
|
||||||
font.weight: Font.Bold
|
font.weight: Font.Bold
|
||||||
text: i18n("Applications")
|
text: i18n("Applications")
|
||||||
}
|
}
|
||||||
|
|
@ -78,7 +76,6 @@ GridView {
|
||||||
|
|
||||||
application.setMinimizedDelegate(delegate);
|
application.setMinimizedDelegate(delegate);
|
||||||
application.runApplication();
|
application.runApplication();
|
||||||
gridView.launched();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,12 +58,37 @@ Item {
|
||||||
id: favouritesList
|
id: favouritesList
|
||||||
clip: true
|
clip: true
|
||||||
interactive: root.interactive
|
interactive: root.interactive
|
||||||
|
boundsMovement: Flickable.StopAtBounds
|
||||||
|
boundsBehavior: Flickable.DragOverBounds
|
||||||
|
|
||||||
property real delegateHeight: PlasmaCore.Units.gridUnit * 3
|
property real delegateHeight: PlasmaCore.Units.gridUnit * 3
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.leftMargin: Math.round(parent.width * 0.1)
|
anchors.leftMargin: Math.round(parent.width * 0.1)
|
||||||
anchors.rightMargin: Math.round(parent.width * 0.1)
|
anchors.rightMargin: Math.round(parent.width * 0.1)
|
||||||
|
|
||||||
|
// search widget open gesture
|
||||||
|
property bool openingSearchWidget: false
|
||||||
|
property real oldVerticalOvershoot: verticalOvershoot
|
||||||
|
onVerticalOvershootChanged: {
|
||||||
|
if (dragging && verticalOvershoot < 0) {
|
||||||
|
if (!openingSearchWidget) {
|
||||||
|
openingSearchWidget = true;
|
||||||
|
root.searchWidget.startGesture();
|
||||||
|
}
|
||||||
|
|
||||||
|
let offset = -(verticalOvershoot - oldVerticalOvershoot);
|
||||||
|
root.searchWidget.updateGestureOffset(-offset);
|
||||||
|
}
|
||||||
|
oldVerticalOvershoot = verticalOvershoot;
|
||||||
|
}
|
||||||
|
onDraggingChanged: {
|
||||||
|
if (!dragging && openingSearchWidget) {
|
||||||
|
openingSearchWidget = false;
|
||||||
|
root.searchWidget.endGesture();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
model: Halcyon.PinnedModel
|
model: Halcyon.PinnedModel
|
||||||
header: MobileShell.BaseItem {
|
header: MobileShell.BaseItem {
|
||||||
topPadding: Math.round(swipeView.height * 0.2)
|
topPadding: Math.round(swipeView.height * 0.2)
|
||||||
|
|
@ -79,7 +104,6 @@ Item {
|
||||||
|
|
||||||
delegate: DrawerListDelegate {
|
delegate: DrawerListDelegate {
|
||||||
id: delegate
|
id: delegate
|
||||||
|
|
||||||
width: favouritesList.width
|
width: favouritesList.width
|
||||||
height: visible ? favouritesList.delegateHeight : 0
|
height: visible ? favouritesList.delegateHeight : 0
|
||||||
}
|
}
|
||||||
|
|
@ -134,13 +158,6 @@ Item {
|
||||||
Layout.rightMargin: column.horizontalMargin
|
Layout.rightMargin: column.horizontalMargin
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
|
||||||
// open search widget when pulled down
|
|
||||||
onDraggingChanged: {
|
|
||||||
if (!dragging && (contentY < originY - PlasmaCore.Units.gridUnit * 3)) {
|
|
||||||
searchWidget.open();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue