diff --git a/containments/homescreen/package/contents/ui/KRunner.qml b/containments/homescreen/package/contents/ui/KRunner.qml index 3632d87..bd5c667 100644 --- a/containments/homescreen/package/contents/ui/KRunner.qml +++ b/containments/homescreen/package/contents/ui/KRunner.qml @@ -1,123 +1,124 @@ /* * Copyright (C) 2015 Vishesh Handa * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) version 3, or any * later version accepted by the membership of KDE e.V. (or its * successor approved by the membership of KDE e.V.), which shall * act as a proxy defined in Section 6 of version 3 of the license. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . * */ import QtQuick 2.0 import QtQuick.Layouts 1.1 import QtQuick.Window 2.1 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.extras 2.0 as PlasmaExtras import org.kde.milou 0.1 as Milou Rectangle { id: krunner height: childrenRect.height color: listView.visible ? Qt.rgba(0, 0, 0, 0.8) : "transparent" property alias showingResults: listView.visible property int inputHeight: queryField.height + background.fixedMargins.top/2 + background.fixedMargins.bottom + property int topPadding: 0 MouseArea { enabled: listView.visible anchors.fill: parent preventStealing: true onClicked: queryField.text = ""; } PlasmaCore.FrameSvgItem { id: background anchors { left: parent.left right: parent.right top: parent.top } clip: true imagePath: "widgets/background" enabledBorders: PlasmaCore.FrameSvg.BottomBorder height: Math.min(krunner.height, childrenRect.height + fixedMargins.top/2 + fixedMargins.bottom) Behavior on height { NumberAnimation { duration: units.longDuration easing.type: Easing.InOutQuad } } transform: Translate { y: root.locked || editOverlay.visible ? -background.height : 0 Behavior on y { NumberAnimation { duration: units.longDuration easing.type: Easing.InOutQuad } } } ColumnLayout { - height: Qt.inputMethod.keyboardRectangle.height > 0 ? (Math.min(implicitHeight, background.height, Qt.inputMethod.keyboardRectangle.y - plasmoid.availableScreenRect.y)) : implicitHeight + height: Qt.inputMethod.keyboardRectangle.height > 0 ? (Math.min(implicitHeight, background.height, Qt.inputMethod.keyboardRectangle.y - plasmoid.availableScreenRect.y)) : implicitHeight + anchors.topMargin anchors { left: parent.left right: parent.right top: parent.top - topMargin: background.fixedMargins.top / 2 - leftMargin: background.fixedMargins.left / 2 - rightMargin: background.fixedMargins.right / 2 + topMargin: background.fixedMargins.top / 2 + krunner.topPadding + leftMargin: background.fixedMargins.left + rightMargin: background.fixedMargins.right } PlasmaComponents.TextField { id: queryField clearButtonShown: true Layout.fillWidth: true Layout.alignment: Qt.AlignTop Keys.onEscapePressed: runnerWindow.visible = false placeholderText: "Search..." } PlasmaExtras.ScrollArea { visible: listView.count > 0 Layout.fillWidth: true Layout.fillHeight: true Layout.preferredHeight: listView.contentHeight Layout.alignment: Qt.AlignTop Milou.ResultsListView { id: listView queryString: queryField.text highlight: null onActivated: queryField.text = "" onUpdateQueryString: { queryField.text = text queryField.cursorPosition = cursorPosition } } } Keys.onReturnPressed: { if (queryField.texr.length == 0) runnerWindow.visible = false; } Keys.onEnterPressed: { if (queryField.texr.length == 0) runnerWindow.visible = false; } } } } diff --git a/containments/homescreen/package/contents/ui/main.qml b/containments/homescreen/package/contents/ui/main.qml index 135a4b8..fa3a0a3 100644 --- a/containments/homescreen/package/contents/ui/main.qml +++ b/containments/homescreen/package/contents/ui/main.qml @@ -1,336 +1,336 @@ /* * Copyright 2019 Marco Martin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.12 import QtQuick.Layouts 1.1 import QtGraphicalEffects 1.0 import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.draganddrop 2.0 as DragDrop import "launcher" as Launcher import org.kde.plasma.private.containmentlayoutmanager 1.0 as ContainmentLayoutManager import org.kde.phone.homescreen 1.0 Item { id: root width: 640 height: 480 property Item toolBox //BEGIN functions //Autoscroll related functions function scrollUp() { autoScrollTimer.scrollDown = false; autoScrollTimer.running = true; scrollUpIndicator.opacity = 1; scrollDownIndicator.opacity = 0; } function scrollDown() { autoScrollTimer.scrollDown = true; autoScrollTimer.running = true; scrollUpIndicator.opacity = 0; scrollDownIndicator.opacity = 1; } function stopScroll() { autoScrollTimer.running = false; scrollUpIndicator.opacity = 0; scrollDownIndicator.opacity = 0; } function recalculateMaxFavoriteCount() { if (!componentComplete) { return; } plasmoid.nativeInterface.applicationListModel.maxFavoriteCount = Math.floor(Math.min(width, height) / launcher.cellWidth); } //END functions property bool componentComplete: false onWidthChanged: recalculateMaxFavoriteCount() onHeightChanged:recalculateMaxFavoriteCount() Component.onCompleted: { componentComplete = true; recalculateMaxFavoriteCount() } Timer { id: autoScrollTimer property bool scrollDown: true repeat: true interval: 1500 onTriggered: { scrollAnim.to = scrollDown ? //Scroll down Math.min(mainFlickable.contentItem.height - root.height, mainFlickable.contentY + root.height/2) : //Scroll up Math.max(0, mainFlickable.contentY - root.height/2); scrollAnim.running = true; } } Connections { target: plasmoid onEditModeChanged: { appletsLayout.editMode = plasmoid.editMode } } FeedbackWindow { id: feedbackWindow } SequentialAnimation { id: clickFedbackAnimation property Item target NumberAnimation { target: clickFedbackAnimation.target properties: "scale" to: 2 duration: units.longDuration easing.type: Easing.InOutQuad } PauseAnimation { duration: units.shortDuration } NumberAnimation { target: clickFedbackAnimation.target properties: "scale" to: 1 duration: units.longDuration easing.type: Easing.InOutQuad } } Launcher.LauncherDragManager { id: launcherDragManager anchors.fill: parent z: 2 appletsLayout: appletsLayout launcherGrid: launcher favoriteStrip: favoriteStrip } Flickable { id: mainFlickable width: parent.width anchors { fill: parent topMargin: plasmoid.availableScreenRect.y + krunner.inputHeight bottomMargin: plasmoid.screenGeometry.height - plasmoid.availableScreenRect.height - plasmoid.availableScreenRect.y } bottomMargin: favoriteStrip.height contentWidth: width contentHeight: flickableContents.height interactive: !plasmoid.editMode && !launcherDragManager.active PlasmaComponents.ScrollBar.vertical: PlasmaComponents.ScrollBar { id: scrollabr opacity: mainFlickable.moving interactive: false Behavior on opacity { OpacityAnimator { duration: units.longDuration * 2 easing.type: Easing.InOutQuad } } } NumberAnimation { id: scrollAnim target: mainFlickable properties: "contentY" duration: units.longDuration easing.type: Easing.InOutQuad } Column { id: flickableContents width: mainFlickable.width spacing: Math.max(0, favoriteStrip.frame.height - mainFlickable.contentY) DragDrop.DropArea { anchors { left: parent.left right: parent.right } height: mainFlickable.height - favoriteStrip.frame.height //TODO: multiple widgets pages onDragEnter: { event.accept(event.proposedAction); } onDragMove: { appletsLayout.showPlaceHolderAt( Qt.rect(event.x - appletsLayout.defaultItemWidth / 2, event.y - appletsLayout.defaultItemHeight / 2, appletsLayout.defaultItemWidth, appletsLayout.defaultItemHeight) ); } onDragLeave: { appletsLayout.hidePlaceHolder(); } preventStealing: true onDrop: { plasmoid.processMimeData(event.mimeData, event.x - appletsLayout.placeHolder.width / 2, event.y - appletsLayout.placeHolder.height / 2); event.accept(event.proposedAction); appletsLayout.hidePlaceHolder(); } PlasmaCore.Svg { id: arrowsSvg imagePath: "widgets/arrows" colorGroup: PlasmaCore.Theme.ComplementaryColorGroup } PlasmaCore.IconItem { z: 9 anchors { horizontalCenter: parent.horizontalCenter bottom: parent.bottom } source: "arrow-up" width: units.iconSizes.medium height: width colorGroup: PlasmaCore.Theme.ComplementaryColorGroup MouseArea { anchors { fill: parent margins: -units.smallSpacing } onClicked: mainFlickable.flick(0, -mainFlickable.height) } } ContainmentLayoutManager.AppletsLayout { id: appletsLayout anchors.fill: parent cellWidth: Math.floor(width / launcher.columns) cellHeight: launcher.cellHeight configKey: width > height ? "ItemGeometriesHorizontal" : "ItemGeometriesVertical" containment: plasmoid editModeCondition: plasmoid.immutable ? ContainmentLayoutManager.AppletsLayout.Manual : ContainmentLayoutManager.AppletsLayout.AfterPressAndHold // Sets the containment in edit mode when we go in edit mode as well onEditModeChanged: plasmoid.editMode = editMode minimumItemWidth: units.gridUnit * 3 minimumItemHeight: minimumItemWidth defaultItemWidth: units.gridUnit * 6 defaultItemHeight: defaultItemWidth //cellWidth: units.iconSizes.small //cellHeight: cellWidth acceptsAppletCallback: function(applet, x, y) { print("Applet: "+applet+" "+x+" "+y) return true; } appletContainerComponent: ContainmentLayoutManager.BasicAppletContainer { id: appletContainer configOverlayComponent: ConfigOverlay {} onEditModeChanged: { launcherDragManager.active = dragActive || editMode; } onDragActiveChanged: { launcherDragManager.active = dragActive || editMode; } } placeHolder: ContainmentLayoutManager.PlaceHolder {} } } Launcher.LauncherGrid { id: launcher anchors { left: parent.left right: parent.right } favoriteStrip: favoriteStrip appletsLayout: appletsLayout } } } ScrollIndicator { id: scrollUpIndicator anchors { top: parent.top topMargin: units.gridUnit * 2 } elementId: "up-arrow" } ScrollIndicator { id: scrollDownIndicator anchors { bottom: favoriteStrip.top bottomMargin: units.gridUnit } elementId: "down-arrow" } Launcher.FavoriteStrip { id: favoriteStrip anchors { left: parent.left right: parent.right bottom: parent.bottom bottomMargin: plasmoid.screenGeometry.height - plasmoid.availableScreenRect.height - plasmoid.availableScreenRect.y } appletsLayout: appletsLayout launcherGrid: launcher //y: Math.max(krunner.inputHeight, root.height - height - mainFlickable.contentY) } KRunner { id: krunner z: 998 height: plasmoid.availableScreenRect.height + topPadding: plasmoid.availableScreenRect.y anchors { top: parent.top left: parent.left right: parent.right - topMargin: plasmoid.availableScreenRect.y } } } diff --git a/containments/panel/package/contents/ui/main.qml b/containments/panel/package/contents/ui/main.qml index 71814da..37ebfc4 100644 --- a/containments/panel/package/contents/ui/main.qml +++ b/containments/panel/package/contents/ui/main.qml @@ -1,248 +1,267 @@ /* * Copyright 2015 Marco Martin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. */ import QtQuick 2.1 import QtQuick.Layouts 1.3 import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.workspace.components 2.0 as PlasmaWorkspace +import org.kde.taskmanager 0.1 as TaskManager import "LayoutManager.js" as LayoutManager import "quicksettings" PlasmaCore.ColorScope { id: root width: 480 - height: 640 + height: 30 //colorGroup: PlasmaCore.Theme.ComplementaryColorGroup + Plasmoid.backgroundHints: showingApp ? PlasmaCore.Types.StandardBackground : PlasmaCore.Types.NoBackground + property Item toolBox property int buttonHeight: width/4 property bool reorderingApps: false property var layoutManager: LayoutManager + readonly property bool showingApp: tasksModel.activeTask && tasksModel.activeTask.valid && !tasksModel.data(tasksModel.activeTask, TaskManager.AbstractTasksModel.IsFullScreen) + Containment.onAppletAdded: { addApplet(applet, x, y); LayoutManager.save(); } function addApplet(applet, x, y) { var container = appletContainerComponent.createObject(appletIconsRow) print("Applet added: " + applet + " " + applet.title) container.width = units.iconSizes.medium container.height = container.height applet.parent = container; container.applet = applet; applet.anchors.fill = container; applet.visible = true; container.visible = true; if (applet.pluginName == "org.kde.phone.notifications") { //FIXME: make a way to instantiate fullRepresentationItem without the open/close dance applet.expanded = true applet.expanded = false applet.fullRepresentationItem.parent = notificationsParent; notificationsParent.applet = applet; applet.fullRepresentationItem.anchors.fill = notificationsParent; } else { applet.preferredRepresentation = applet.compactRepresentation applet.switchWidth = -1; applet.switchHeight = -1; } } Component.onCompleted: { LayoutManager.plasmoid = plasmoid; LayoutManager.root = root; LayoutManager.layout = appletsLayout; LayoutManager.restore(); } + TaskManager.TasksModel { + id: tasksModel + sortMode: TaskManager.TasksModel.SortVirtualDesktop + groupMode: TaskManager.TasksModel.GroupDisabled + + screenGeometry: plasmoid.screenGeometry + filterByScreen: plasmoid.configuration.showForCurrentScreenOnly + + } + PlasmaCore.DataSource { id: statusNotifierSource engine: "statusnotifieritem" interval: 0 onSourceAdded: { connectSource(source) } Component.onCompleted: { connectedSources = sources } } RowLayout { id: appletsLayout Layout.minimumHeight: Math.max(root.height, Math.round(Layout.preferredHeight / root.height) * root.height) } Component { id: appletContainerComponent Item { //not used yet property bool animationsEnabled: false property Item applet Layout.fillHeight: true Layout.minimumWidth: applet && applet.compactRepresentationItem ? Math.max(applet.compactRepresentationItem.Layout.minimumWidth, appletIconsRow.height) : appletIconsRow.height Layout.maximumWidth: Layout.minimumWidth } } PlasmaCore.DataSource { id: timeSource engine: "time" connectedSources: ["Local"] interval: 60 * 1000 } - Rectangle { + Item { z: 1 //parent: slidingPanel.visible && !slidingPanel.wideScreen ? panelContents : root anchors { left: parent.left right: parent.right bottom: parent.bottom } height: root.height - color: PlasmaCore.ColorScope.backgroundColor + Rectangle { + anchors.fill: parent + color: PlasmaCore.ColorScope.backgroundColor + opacity: showingApp + } Loader { id: strengthLoader height: parent.height width: item ? item.width : 0 source: Qt.resolvedUrl("SignalStrength.qml") } Row { id: sniRow anchors.left: strengthLoader.right height: parent.height Repeater { id: statusNotifierRepeater model: PlasmaCore.SortFilterModel { id: filteredStatusNotifiers filterRole: "Title" sourceModel: PlasmaCore.DataModel { dataSource: statusNotifierSource } } delegate: TaskWidget { } } } PlasmaComponents.Label { id: clock anchors.fill: parent text: Qt.formatTime(timeSource.data.Local.DateTime, "hh:mm") color: PlasmaCore.ColorScope.textColor horizontalAlignment: Qt.AlignHCenter verticalAlignment: Qt.AlignVCenter font.pixelSize: height / 2 } RowLayout { id: appletIconsRow anchors { bottom: parent.bottom right: parent.right } height: parent.height } } MouseArea { z: 99 property int oldMouseY: 0 anchors.fill: parent onPressed: { slidingPanel.drawerX = Math.min(Math.max(0, mouse.x - slidingPanel.drawerWidth/2), slidingPanel.width - slidingPanel.drawerWidth) slidingPanel.userInteracting = true; oldMouseY = mouse.y; slidingPanel.showFullScreen(); } onPositionChanged: { //var factor = (mouse.y - oldMouseY > 0) ? (1 - Math.max(0, (slidingArea.y + slidingPanel.overShoot) / slidingPanel.overShoot)) : 1 var factor = 1; slidingPanel.offset = slidingPanel.offset + (mouse.y - oldMouseY) * factor; oldMouseY = mouse.y; } onReleased: { slidingPanel.userInteracting = false; slidingPanel.updateState(); } } SlidingPanel { id: slidingPanel width: plasmoid.availableScreenRect.width height: plasmoid.availableScreenRect.height peekHeight: quickSettingsParent.height + notificationsParent.minimumHeight + root.height headerHeight: root.height onExpandedChanged: { modeSwitchAnim.running = false; modeSwitchAnim.to = expanded ? width : 0 modeSwitchAnim.running = true; } contents: Item { id: panelContents anchors.fill: parent implicitHeight: slidingPanel.expanded ? (slidingPanel.height-slidingPanel.headerHeight)*0.8 : (quickSettingsParent.height + notificationsParent.height + root.height) Rectangle { id: quickSettingsParent parent: slidingPanel.fixedArea color: PlasmaCore.ColorScope.backgroundColor z: 2 width: parent.width y: Math.min(0, slidingPanel.offset - height - root.height) height: quickSettings.Layout.minimumHeight QuickSettings { id: quickSettings anchors.fill: parent } Rectangle { anchors { left: parent.left right: parent.right bottom:parent.bottom } height: units.devicePixelRatio color: PlasmaCore.ColorScope.textColor opacity: 0.2 visible: slidingPanel.offset + slidingPanel.headerHeight < panelContents.height } } Item { id: notificationsParent anchors { left: parent.left bottom: parent.bottom right: parent.right bottomMargin: root.height } property var applet height: applet ? applet.fullRepresentationItem.Layout.maximumHeight : 0 property int minimumHeight: applet ? applet.fullRepresentationItem.Layout.minimumHeight : 0 } } } }