mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
homescreens: Update API usage to match changes for Plasmoid & Containment
This commit is contained in:
parent
2b613a1c89
commit
8a577f9a57
3 changed files with 152 additions and 146 deletions
|
|
@ -1,7 +1,5 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org>
|
||||
* SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
*/
|
||||
// SPDX-FileCopyrightText: 2021-2023 Devin Lin <devin@kde.org>
|
||||
// SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Window
|
||||
|
|
@ -20,6 +18,7 @@ import "../components" as Components
|
|||
* The base homescreen component, implementing features that simplify
|
||||
* homescreen implementation.
|
||||
*/
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
|
|
@ -58,15 +57,15 @@ Item {
|
|||
property real rightMargin
|
||||
|
||||
function evaluateMargins() {
|
||||
topMargin = plasmoid.availableScreenRect.y
|
||||
topMargin = Plasmoid.availableScreenRect.y
|
||||
// add a specific check for the nav panel for now, since the gesture mode still technically has height
|
||||
bottomMargin = ShellSettings.Settings.navigationPanelEnabled ? root.height - (plasmoid.availableScreenRect.y + plasmoid.availableScreenRect.height) : 0;
|
||||
leftMargin = plasmoid.availableScreenRect.x
|
||||
rightMargin = root.width - (plasmoid.availableScreenRect.x + plasmoid.availableScreenRect.width)
|
||||
bottomMargin = ShellSettings.Settings.navigationPanelEnabled ? root.height - (Plasmoid.availableScreenRect.y + Plasmoid.availableScreenRect.height) : 0;
|
||||
leftMargin = Plasmoid.availableScreenRect.x
|
||||
rightMargin = root.width - (Plasmoid.availableScreenRect.x + Plasmoid.availableScreenRect.width)
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: plasmoid
|
||||
target: Plasmoid
|
||||
|
||||
// avoid binding loops with root.height and root.width changing along with the availableScreenRect
|
||||
function onAvailableScreenRectChanged() {
|
||||
|
|
|
|||
|
|
@ -18,21 +18,9 @@ import org.kde.plasma.private.mobileshell.state 1.0 as MobileShellState
|
|||
import org.kde.private.mobile.homescreen.folio 1.0 as Folio
|
||||
import org.kde.plasma.private.mobileshell.windowplugin as WindowPlugin
|
||||
|
||||
MobileShell.HomeScreen {
|
||||
|
||||
ContainmentItem {
|
||||
id: root
|
||||
width: 640
|
||||
height: 480
|
||||
|
||||
onResetHomeScreenPosition: {
|
||||
homescreen.homeScreenState.animateGoToPageIndex(0, PlasmaCore.Units.longDuration);
|
||||
homescreen.homeScreenState.closeAppDrawer();
|
||||
}
|
||||
|
||||
onHomeTriggered: {
|
||||
searchWidget.close();
|
||||
}
|
||||
|
||||
property bool componentComplete: false
|
||||
|
||||
Component.onCompleted: {
|
||||
// ensure the gestures work immediately on load
|
||||
|
|
@ -60,28 +48,42 @@ MobileShell.HomeScreen {
|
|||
searchWidget.close();
|
||||
}
|
||||
|
||||
} else if (homescreen.homeScreenState.currentView === HomeScreenState.PageView) {
|
||||
homescreen.homeScreenState.openAppDrawer();
|
||||
} else if (folioHomeScreen.homeScreenState.currentView === HomeScreenState.PageView) {
|
||||
folioHomeScreen.homeScreenState.openAppDrawer();
|
||||
} else {
|
||||
homescreen.homeScreenState.closeAppDrawer();
|
||||
folioHomeScreen.homeScreenState.closeAppDrawer();
|
||||
}
|
||||
}
|
||||
|
||||
MobileShell.HomeScreen {
|
||||
id: homeScreen
|
||||
|
||||
onResetHomeScreenPosition: {
|
||||
folioHomeScreen.homeScreenState.animateGoToPageIndex(0, PlasmaCore.Units.longDuration);
|
||||
folioHomeScreen.homeScreenState.closeAppDrawer();
|
||||
}
|
||||
|
||||
onHomeTriggered: {
|
||||
searchWidget.close();
|
||||
}
|
||||
|
||||
property bool componentComplete: false
|
||||
|
||||
contentItem: Item {
|
||||
// homescreen component
|
||||
HomeScreen {
|
||||
id: homescreen
|
||||
id: folioHomeScreen
|
||||
anchors.fill: parent
|
||||
|
||||
topMargin: root.topMargin
|
||||
bottomMargin: root.bottomMargin
|
||||
leftMargin: root.leftMargin
|
||||
rightMargin: root.rightMargin
|
||||
topMargin: homeScreen.topMargin
|
||||
bottomMargin: homeScreen.bottomMargin
|
||||
leftMargin: homeScreen.leftMargin
|
||||
rightMargin: homeScreen.rightMargin
|
||||
|
||||
opacity: (1 - searchWidget.openFactor)
|
||||
|
||||
// make the homescreen not interactable when task switcher or startup feedback is on
|
||||
interactive: !root.overlayShown
|
||||
interactive: !homeScreen.overlayShown
|
||||
}
|
||||
|
||||
// search component
|
||||
|
|
@ -91,15 +93,15 @@ MobileShell.HomeScreen {
|
|||
|
||||
visible: openFactor > 0
|
||||
|
||||
topMargin: root.topMargin
|
||||
bottomMargin: root.bottomMargin
|
||||
leftMargin: root.leftMargin
|
||||
rightMargin: root.rightMargin
|
||||
topMargin: homeScreen.topMargin
|
||||
bottomMargin: homeScreen.bottomMargin
|
||||
leftMargin: homeScreen.leftMargin
|
||||
rightMargin: homeScreen.rightMargin
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: homescreen.homeScreenState
|
||||
target: folioHomeScreen.homeScreenState
|
||||
|
||||
function onSwipeDownGestureBegin() {
|
||||
searchWidget.startGesture();
|
||||
|
|
@ -120,4 +122,4 @@ MobileShell.HomeScreen {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,33 +14,15 @@ import org.kde.plasma.private.mobileshell.state as MobileShellState
|
|||
import org.kde.private.mobile.homescreen.halcyon as Halcyon
|
||||
import org.kde.plasma.private.mobileshell.windowplugin as WindowPlugin
|
||||
|
||||
MobileShell.HomeScreen {
|
||||
ContainmentItem {
|
||||
id: root
|
||||
|
||||
onResetHomeScreenPosition: {
|
||||
homescreen.triggerHomescreen();
|
||||
}
|
||||
|
||||
onHomeTriggered: {
|
||||
search.close();
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
Halcyon.ApplicationListModel.loadApplications();
|
||||
Halcyon.PinnedModel.applet = plasmoid.nativeInterface;
|
||||
Halcyon.PinnedModel.applet = Plasmoid.nativeInterface;
|
||||
forceActiveFocus();
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: darkenBackground
|
||||
color: root.overlayShown ? 'transparent' : (homescreen.page == 1 ? Qt.rgba(0, 0, 0, 0.7) : Qt.rgba(0, 0, 0, 0.2))
|
||||
anchors.fill: parent
|
||||
z: -1
|
||||
Behavior on color {
|
||||
ColorAnimation { duration: PlasmaCore.Units.longDuration }
|
||||
}
|
||||
}
|
||||
|
||||
Plasmoid.onActivated: {
|
||||
// there's a couple of steps:
|
||||
// - minimize windows (only if we are in an app)
|
||||
|
|
@ -58,30 +40,52 @@ MobileShell.HomeScreen {
|
|||
search.close();
|
||||
}
|
||||
|
||||
homescreen.page = 0;
|
||||
halcyonHomeScreen.page = 0;
|
||||
|
||||
WindowPlugin.WindowUtil.isShowingDesktop = true;
|
||||
} else if (homescreen.page == 0) {
|
||||
homescreen.page = 1;
|
||||
} else if (halcyonHomeScreen.page == 0) {
|
||||
halcyonHomeScreen.page = 1;
|
||||
} else {
|
||||
WindowPlugin.WindowUtil.isShowingDesktop = false;
|
||||
homescreen.page = 0;
|
||||
halcyonHomeScreen.page = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: darkenBackground
|
||||
color: homeScreen.overlayShown ? 'transparent' : (halcyonHomeScreen.page == 1 ? Qt.rgba(0, 0, 0, 0.7) : Qt.rgba(0, 0, 0, 0.2))
|
||||
anchors.fill: parent
|
||||
z: -1
|
||||
Behavior on color {
|
||||
ColorAnimation { duration: PlasmaCore.Units.longDuration }
|
||||
}
|
||||
}
|
||||
|
||||
MobileShell.HomeScreen {
|
||||
id: homeScreen
|
||||
anchors.fill: parent
|
||||
|
||||
onResetHomeScreenPosition: {
|
||||
halcyonHomeScreen.triggerHomescreen();
|
||||
}
|
||||
|
||||
onHomeTriggered: {
|
||||
search.close();
|
||||
}
|
||||
|
||||
// homescreen component
|
||||
contentItem: Item {
|
||||
HomeScreen {
|
||||
id: homescreen
|
||||
id: halcyonHomeScreen
|
||||
anchors.fill: parent
|
||||
|
||||
topMargin: root.topMargin
|
||||
bottomMargin: root.bottomMargin
|
||||
leftMargin: root.leftMargin
|
||||
rightMargin: root.rightMargin
|
||||
topMargin: homeScreen.topMargin
|
||||
bottomMargin: homeScreen.bottomMargin
|
||||
leftMargin: homeScreen.leftMargin
|
||||
rightMargin: homeScreen.rightMargin
|
||||
|
||||
// make the homescreen not interactable when task switcher or startup feedback is on
|
||||
interactive: !root.overlayShown
|
||||
interactive: !homeScreen.overlayShown
|
||||
searchWidget: search
|
||||
}
|
||||
|
||||
|
|
@ -93,10 +97,11 @@ MobileShell.HomeScreen {
|
|||
|
||||
onActionTriggered: search.close()
|
||||
|
||||
topMargin: root.topMargin
|
||||
bottomMargin: root.bottomMargin
|
||||
leftMargin: root.leftMargin
|
||||
rightMargin: root.rightMargin
|
||||
topMargin: homeScreen.topMargin
|
||||
bottomMargin: homeScreen.bottomMargin
|
||||
leftMargin: homeScreen.leftMargin
|
||||
rightMargin: homeScreen.rightMargin
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue