From 5e5f21a31e6870e88a15efbee977a900082b36f6 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 24 Feb 2015 16:26:17 +0100 Subject: [PATCH 01/11] single scroll for the homescreen --- shell/contents/components/HomeLauncherSvg.qml | 3 +- shell/contents/views/Desktop.qml | 216 ++++++++++-------- 2 files changed, 120 insertions(+), 99 deletions(-) diff --git a/shell/contents/components/HomeLauncherSvg.qml b/shell/contents/components/HomeLauncherSvg.qml index a64672ce..1b897900 100644 --- a/shell/contents/components/HomeLauncherSvg.qml +++ b/shell/contents/components/HomeLauncherSvg.qml @@ -21,8 +21,7 @@ Item { MouseArea { anchors.fill: parent propagateComposedEvents: true - drag.target: stripe - drag.axis: Drag.YAxis + onClicked: { if (callback) { callback(); diff --git a/shell/contents/views/Desktop.qml b/shell/contents/views/Desktop.qml index 36cd33bc..b045bb64 100644 --- a/shell/contents/views/Desktop.qml +++ b/shell/contents/views/Desktop.qml @@ -39,6 +39,7 @@ MouseEventListener { property Item wallpaper; property var pendingRemovals: []; property int notificationId: 0; + property int buttonHeight: width/4 /* Notificadtion data object has the following properties: @@ -89,7 +90,7 @@ MouseEventListener { } onPressAndHold: { - containment.action("configure").trigger(); + // containment.action("configure").trigger(); } OfonoManager { @@ -407,121 +408,142 @@ MouseEventListener { colorGroup: PlasmaCore.Theme.ComplementaryColorGroup - ListView { - id: notificationView - spacing: units.smallSpacing - anchors { - top: parent.top - bottom: stripe.top - left: parent.left - right: parent.right - bottomMargin: units.smallSpacing - } - - z: 1 - clip: true - verticalLayoutDirection: ListView.BottomToTop - model: notificationsModel - add: Transition { - NumberAnimation { - properties: "x" - from: notificationView.width - duration: 100 - } - } - - remove: Transition { - NumberAnimation { - properties: "x" - to: notificationView.width - duration: 500 - } - NumberAnimation { - properties: "opacity" - to: 0 - duration: 500 - } - } - - removeDisplaced: Transition { - SequentialAnimation { - PauseAnimation { duration: 600 } - NumberAnimation { properties: "x,y"; duration: 100 } - } - } - - delegate: NotificationStripe {} - } - - SatelliteStripe { - id: stripe - z: 1 - - PlasmaCore.Svg { - id: stripeIcons - imagePath: Qt.resolvedUrl("../images/homescreenicons.svg") - } - - Row { - anchors.fill: parent - property int columns: 4 - property alias buttonHeight: stripe.height - - HomeLauncherSvg { - id: phoneIcon - svg: stripeIcons - elementId: "phone" - callback: function() { - dialerOverlay.open() - } - } - - HomeLauncherSvg { - id: messagingIcon - svg: stripeIcons - elementId: "messaging" - callback: function() { console.log("Start messaging") } - } - - - HomeLauncherSvg { - id: emailIcon - svg: stripeIcons - elementId: "email" - callback: function() { console.log("Start email") } - } - - - HomeLauncherSvg { - id: webIcon - svg: stripeIcons - elementId: "web" - callback: function() { console.log("Start web") } - } - } - } + SatelliteComponents.ApplicationListModel { id: appListModel } + Rectangle { + color: Qt.rgba(0, 0, 0, 0.7 * height / homescreen.height) + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + height: Math.min(applications.contentY + homescreen.height, homescreen.height) + } + Text { + text: applications.contentY + } GridView { id: applications anchors { - top: stripe.bottom + top: parent.top bottom: parent.bottom left: parent.left right: parent.right - topMargin: units.smallSpacing } z: 1 - cellWidth: stripe.height * 2 + cellWidth: homescreen.buttonHeight cellHeight: cellWidth model: appListModel snapMode: GridView.SnapToRow clip: true + header: Item { + z: 999 + width: homescreen.width + height: homescreen.height + ListView { + id: notificationView + spacing: units.smallSpacing + anchors { + bottom: parent.bottom + left: parent.left + right: parent.right + bottomMargin: stripe.height * 2 + } + height: contentHeight + interactive: false + + z: 1 + verticalLayoutDirection: ListView.BottomToTop + model: notificationsModel + + add: Transition { + NumberAnimation { + properties: "x" + from: notificationView.width + duration: 100 + } + } + + remove: Transition { + NumberAnimation { + properties: "x" + to: notificationView.width + duration: 500 + } + NumberAnimation { + properties: "opacity" + to: 0 + duration: 500 + } + } + + removeDisplaced: Transition { + SequentialAnimation { + PauseAnimation { duration: 600 } + NumberAnimation { properties: "x,y"; duration: 100 } + } + } + + delegate: NotificationStripe {} + + } + SatelliteStripe { + id: stripe + z: 99 + y: Math.max(applications.contentY + parent.height, parent.height - height - statusPanel.height) + + PlasmaCore.Svg { + id: stripeIcons + imagePath: Qt.resolvedUrl("../images/homescreenicons.svg") + } + + Row { + anchors.fill: parent + property int columns: 4 + property alias buttonHeight: stripe.height + + HomeLauncherSvg { + id: phoneIcon + svg: stripeIcons + elementId: "phone" + callback: function() { + dialerOverlay.open() + } + } + + HomeLauncherSvg { + id: messagingIcon + svg: stripeIcons + elementId: "messaging" + callback: function() { console.log("Start messaging") } + } + + + HomeLauncherSvg { + id: emailIcon + svg: stripeIcons + elementId: "email" + callback: function() { console.log("Start email") } + } + + + HomeLauncherSvg { + id: webIcon + svg: stripeIcons + elementId: "web" + callback: function() { console.log("Start web") } + } + } + } + } delegate: HomeLauncher {} Component.onCompleted : { console.log("WTF " + width) } + + } } From 6ef98bdb2dcf9e5068f99a93ca5684fe50232084 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 24 Feb 2015 16:37:29 +0100 Subject: [PATCH 02/11] use framesvg --- shell/contents/components/SatelliteStripe.qml | 14 ++++++++++---- shell/contents/views/Desktop.qml | 18 ++++++------------ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/shell/contents/components/SatelliteStripe.qml b/shell/contents/components/SatelliteStripe.qml index 03e1aa91..813576f6 100644 --- a/shell/contents/components/SatelliteStripe.qml +++ b/shell/contents/components/SatelliteStripe.qml @@ -1,10 +1,16 @@ import QtQuick 2.0 import org.kde.plasma.core 2.0 as PlasmaCore -Rectangle { - gradient: Gradient { - GradientStop { position: 0.0; color: "#FFEDDF00" } - GradientStop { position: 3.0; color: "#00EDDF00" } +Item { + PlasmaCore.FrameSvgItem { + z: -1 + imagePath: "widgets/background" + enabledBorders: PlasmaCore.FrameSvgItem.TopBorder | PlasmaCore.FrameSvgItem.BottomBorder + anchors { + fill: parent + topMargin: -margins.top + bottomMargin: -margins.bottom + } } opacity: 0.6 diff --git a/shell/contents/views/Desktop.qml b/shell/contents/views/Desktop.qml index b045bb64..75f4f9e4 100644 --- a/shell/contents/views/Desktop.qml +++ b/shell/contents/views/Desktop.qml @@ -211,6 +211,12 @@ MouseEventListener { } } + Rectangle { + z: 1 + color: Qt.rgba(0, 0, 0, 0.7 * (Math.min(applications.contentY + homescreen.height, homescreen.height) / homescreen.height)) + anchors.fill: parent + } + PlasmaCore.DataSource { id: notificationsSource @@ -414,18 +420,6 @@ MouseEventListener { id: appListModel } - Rectangle { - color: Qt.rgba(0, 0, 0, 0.7 * height / homescreen.height) - anchors { - left: parent.left - right: parent.right - bottom: parent.bottom - } - height: Math.min(applications.contentY + homescreen.height, homescreen.height) - } - Text { - text: applications.contentY - } GridView { id: applications anchors { From 563e306225e8435de62000f69e19d4c08ba14882 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 24 Feb 2015 16:45:17 +0100 Subject: [PATCH 03/11] a big clock this should become an applet too --- shell/contents/views/Desktop.qml | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/shell/contents/views/Desktop.qml b/shell/contents/views/Desktop.qml index 75f4f9e4..1be24b93 100644 --- a/shell/contents/views/Desktop.qml +++ b/shell/contents/views/Desktop.qml @@ -217,6 +217,12 @@ MouseEventListener { anchors.fill: parent } + PlasmaCore.DataSource { + id: timeSource + engine: "time" + connectedSources: ["Local"] + interval: 60 * 1000 + } PlasmaCore.DataSource { id: notificationsSource @@ -317,13 +323,6 @@ MouseEventListener { anchors.fill: parent color: Qt.rgba(0, 0, 0, 0.7) - PlasmaCore.DataSource { - id: timeSource - engine: "time" - connectedSources: ["Local"] - interval: 500 - } - PlasmaCore.IconItem { id: strengthIcon colorGroup: PlasmaCore.ColorScope.colorGroup @@ -438,6 +437,23 @@ MouseEventListener { z: 999 width: homescreen.width height: homescreen.height + + PlasmaComponents.Label { + id: bigClock + anchors { + horizontalCenter: parent.horizontalCenter + top: parent.top + bottom: notificationView.top + } + text: Qt.formatTime(timeSource.data.Local.DateTime, "hh:mm") + color: PlasmaCore.ColorScope.textColor + horizontalAlignment: Qt.AlignHCenter + verticalAlignment: Qt.AlignVCenter + font.pointSize: 40 + style: Text.Raised + styleColor: "black" + } + ListView { id: notificationView spacing: units.smallSpacing From dc1251683442c37164820fa73023bc05acbe1fdd Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 24 Feb 2015 16:49:06 +0100 Subject: [PATCH 04/11] don't use a mouseeventlistener --- shell/contents/views/Desktop.qml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/shell/contents/views/Desktop.qml b/shell/contents/views/Desktop.qml index 1be24b93..670d2869 100644 --- a/shell/contents/views/Desktop.qml +++ b/shell/contents/views/Desktop.qml @@ -30,7 +30,7 @@ import org.kde.kquickcontrolsaddons 2.0 import MeeGo.QOfono 0.2 import "../components" -MouseEventListener { +Item { id: homescreen width: 1080 height: 1920 @@ -89,10 +89,6 @@ MouseEventListener { } } - onPressAndHold: { - // containment.action("configure").trigger(); - } - OfonoManager { id: ofonoManager onAvailableChanged: { @@ -433,11 +429,15 @@ MouseEventListener { model: appListModel snapMode: GridView.SnapToRow clip: true - header: Item { + header: MouseArea { z: 999 width: homescreen.width height: homescreen.height + onPressAndHold: { + containment.action("configure").trigger(); + } + PlasmaComponents.Label { id: bigClock anchors { From 2a1e2934dcd96a1995443bfe399d4a0bf7468275 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 24 Feb 2015 18:30:46 +0100 Subject: [PATCH 05/11] bottom bar always visible --- compositor/contents/Compositor.qml | 25 +++++++++++++++++++++++-- shell/contents/views/Desktop.qml | 13 ++++--------- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/compositor/contents/Compositor.qml b/compositor/contents/Compositor.qml index df8d850e..6a90aa65 100644 --- a/compositor/contents/Compositor.qml +++ b/compositor/contents/Compositor.qml @@ -154,8 +154,8 @@ Rectangle { anchors.left: parent.left anchors.right: parent.right anchors.bottom: parent.bottom - height: compositorRoot.state == "homeScreen" ? 0 : bottomBarHeight - color: Qt.rgba(0, 0, 0, 0.9 + 0.1*windowsZoom.scale) + height: bottomBarHeight + color: Qt.rgba(0, 0, 0, 0.7) Behavior on height { NumberAnimation { @@ -167,11 +167,32 @@ Rectangle { RowLayout { anchors.fill: parent + PlasmaCore.IconItem { + colorGroup: PlasmaCore.Theme.ComplementaryColorGroup + width: units.iconSizes.smallMedium + height: width + source: "distribute-horizontal-x" + enabled: compositorRoot.state != "switcher"; + opacity: enabled ? 1 : 0.6 + + Layout.alignment: Qt.AlignHCenter + Layout.preferredWidth: units.iconSizes.medium + Layout.preferredHeight: units.iconSizes.medium + + MouseArea { + anchors.fill: parent + onClicked: { + compositorRoot.state = "switcher"; + } + } + } PlasmaCore.IconItem { colorGroup: PlasmaCore.Theme.ComplementaryColorGroup width: units.iconSizes.smallMedium height: width source: "go-home" + enabled: compositorRoot.state != "homeScreen"; + opacity: enabled ? 1 : 0.6 Layout.alignment: Qt.AlignHCenter Layout.preferredWidth: units.iconSizes.medium diff --git a/shell/contents/views/Desktop.qml b/shell/contents/views/Desktop.qml index 670d2869..0cbebb1c 100644 --- a/shell/contents/views/Desktop.qml +++ b/shell/contents/views/Desktop.qml @@ -312,7 +312,7 @@ Item { right: parent.right } height: units.iconSizes.small - z: 1 + z: 2 colorGroup: PlasmaCore.Theme.ComplementaryColorGroup Rectangle { @@ -401,16 +401,11 @@ Item { PlasmaCore.ColorScope { z: 1 anchors { - top: statusPanel.bottom - bottom: parent.bottom - left: parent.left - right: parent.right + fill: parent } colorGroup: PlasmaCore.Theme.ComplementaryColorGroup - - SatelliteComponents.ApplicationListModel { id: appListModel } @@ -432,7 +427,7 @@ Item { header: MouseArea { z: 999 width: homescreen.width - height: homescreen.height + height: homescreen.height - units.iconSizes.medium onPressAndHold: { containment.action("configure").trigger(); @@ -504,7 +499,7 @@ Item { SatelliteStripe { id: stripe z: 99 - y: Math.max(applications.contentY + parent.height, parent.height - height - statusPanel.height) + y: Math.max(applications.contentY + parent.height, parent.height - height) PlasmaCore.Svg { id: stripeIcons From 5b39069d98110fe285e947dd97ef6baa2a1de2cf Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 24 Feb 2015 19:29:50 +0100 Subject: [PATCH 06/11] uniform bottom and top bar --- compositor/contents/Compositor.qml | 10 +++++----- shell/contents/views/Desktop.qml | 27 ++++++++++++++------------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/compositor/contents/Compositor.qml b/compositor/contents/Compositor.qml index 6a90aa65..b44f8f0e 100644 --- a/compositor/contents/Compositor.qml +++ b/compositor/contents/Compositor.qml @@ -155,7 +155,7 @@ Rectangle { anchors.right: parent.right anchors.bottom: parent.bottom height: bottomBarHeight - color: Qt.rgba(0, 0, 0, 0.7) + color: Qt.rgba(0, 0, 0, 0.9) Behavior on height { NumberAnimation { @@ -172,8 +172,8 @@ Rectangle { width: units.iconSizes.smallMedium height: width source: "distribute-horizontal-x" - enabled: compositorRoot.state != "switcher"; - opacity: enabled ? 1 : 0.6 + enabled: compositorRoot.state != "switcher" && windowsLayout.children.length > 0 + opacity: enabled ? 1 : 0.2 Layout.alignment: Qt.AlignHCenter Layout.preferredWidth: units.iconSizes.medium @@ -192,7 +192,7 @@ Rectangle { height: width source: "go-home" enabled: compositorRoot.state != "homeScreen"; - opacity: enabled ? 1 : 0.6 + opacity: enabled ? 1 : 0.2 Layout.alignment: Qt.AlignHCenter Layout.preferredWidth: units.iconSizes.medium @@ -211,7 +211,7 @@ Rectangle { height: width source: "window-close" enabled: compositorRoot.currentWindow - opacity: enabled ? 1 : 0.6 + opacity: enabled ? 1 : 0.2 Layout.alignment: Qt.AlignHCenter Layout.preferredWidth: units.iconSizes.medium diff --git a/shell/contents/views/Desktop.qml b/shell/contents/views/Desktop.qml index 0cbebb1c..b6e914e4 100644 --- a/shell/contents/views/Desktop.qml +++ b/shell/contents/views/Desktop.qml @@ -209,7 +209,7 @@ Item { Rectangle { z: 1 - color: Qt.rgba(0, 0, 0, 0.7 * (Math.min(applications.contentY + homescreen.height, homescreen.height) / homescreen.height)) + color: Qt.rgba(0, 0, 0, 0.9 * (Math.min(applications.contentY + homescreen.height, homescreen.height) / homescreen.height)) anchors.fill: parent } @@ -317,7 +317,7 @@ Item { Rectangle { anchors.fill: parent - color: Qt.rgba(0, 0, 0, 0.7) + color: Qt.rgba(0, 0, 0, 0.9) PlasmaCore.IconItem { id: strengthIcon @@ -398,6 +398,7 @@ Item { height: homescreen.height } + PlasmaCore.ColorScope { z: 1 anchors { @@ -458,7 +459,7 @@ Item { right: parent.right bottomMargin: stripe.height * 2 } - height: contentHeight + height: parent.height / 3 interactive: false z: 1 @@ -474,17 +475,17 @@ Item { } remove: Transition { - NumberAnimation { - properties: "x" - to: notificationView.width - duration: 500 - } - NumberAnimation { - properties: "opacity" - to: 0 - duration: 500 - } + NumberAnimation { + properties: "x" + to: notificationView.width + duration: 500 } + NumberAnimation { + properties: "opacity" + to: 0 + duration: 500 + } + } removeDisplaced: Transition { SequentialAnimation { From 62ff6312db9e7b6154607daa65638e24092160d9 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Wed, 25 Feb 2015 19:26:04 +0100 Subject: [PATCH 07/11] add a containment it will replace most of the logic of Desktop.qml --- CMakeLists.txt | 1 + containments/CMakeLists.txt | 2 + .../homescreen/contents/ui/HomeLauncher.qml | 40 +++++ .../contents/ui/HomeLauncherSvg.qml | 33 ++++ .../contents/ui/SatelliteStripe.qml | 21 +++ containments/homescreen/contents/ui/main.qml | 144 ++++++++++++++++++ containments/homescreen/metadata.desktop | 17 +++ 7 files changed, 258 insertions(+) create mode 100644 containments/CMakeLists.txt create mode 100644 containments/homescreen/contents/ui/HomeLauncher.qml create mode 100644 containments/homescreen/contents/ui/HomeLauncherSvg.qml create mode 100644 containments/homescreen/contents/ui/SatelliteStripe.qml create mode 100644 containments/homescreen/contents/ui/main.qml create mode 100644 containments/homescreen/metadata.desktop diff --git a/CMakeLists.txt b/CMakeLists.txt index 644ee2fb..ea29df30 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,3 +42,4 @@ add_subdirectory(bin) add_subdirectory(qmlcomponents) add_subdirectory(services) add_subdirectory(settingsmodules) +add_subdirectory(containments) diff --git a/containments/CMakeLists.txt b/containments/CMakeLists.txt new file mode 100644 index 00000000..7e680eeb --- /dev/null +++ b/containments/CMakeLists.txt @@ -0,0 +1,2 @@ + +plasma_install_package(homescreen org.kde.phone.homescreen) diff --git a/containments/homescreen/contents/ui/HomeLauncher.qml b/containments/homescreen/contents/ui/HomeLauncher.qml new file mode 100644 index 00000000..6e9d143e --- /dev/null +++ b/containments/homescreen/contents/ui/HomeLauncher.qml @@ -0,0 +1,40 @@ +import QtQuick 2.0 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.kio 1.0 as Kio +import org.kde.plasma.components 2.0 as PlasmaComponents + +MouseArea { + id: root + width: applicationsView.cellWidth + height: width + onClicked: { + console.log("Clicked: " + model.ApplicationStorageIdRole) + appListModel.runApplication(model.ApplicationStorageIdRole) + } + + PlasmaCore.IconItem { + id: icon + anchors.centerIn: parent + width: units.iconSizes.large + height: width + source: model.ApplicationIconRole + } + + PlasmaComponents.Label { + visible: text.length > 0 + + anchors { + top: icon.bottom + left: icon.left + right: icon.right + } + + wrapMode: Text.WordWrap + horizontalAlignment: Qt.AlignHCenter + verticalAlignment: Qt.AlignVCenter + + text: model.ApplicationNameRole + font.pixelSize: theme.smallestFont.pixelSize + color: PlasmaCore.ColorScope.textColor + } +} diff --git a/containments/homescreen/contents/ui/HomeLauncherSvg.qml b/containments/homescreen/contents/ui/HomeLauncherSvg.qml new file mode 100644 index 00000000..1b897900 --- /dev/null +++ b/containments/homescreen/contents/ui/HomeLauncherSvg.qml @@ -0,0 +1,33 @@ +import QtQuick 2.0 +import org.kde.plasma.core 2.0 as PlasmaCore + +Item { + id: root + width: parent.width / parent.columns + height: parent.buttonHeight + property var callback + property string text + property string sub + property alias svg: icon.svg + property alias elementId: icon.elementId + + PlasmaCore.SvgItem{ + id: icon + width: units.iconSizes.medium + height: width + anchors.centerIn: parent + } + + MouseArea { + anchors.fill: parent + propagateComposedEvents: true + + onClicked: { + if (callback) { + callback(); + } else { + addNumber(parent.text); + } + } + } +} diff --git a/containments/homescreen/contents/ui/SatelliteStripe.qml b/containments/homescreen/contents/ui/SatelliteStripe.qml new file mode 100644 index 00000000..813576f6 --- /dev/null +++ b/containments/homescreen/contents/ui/SatelliteStripe.qml @@ -0,0 +1,21 @@ +import QtQuick 2.0 +import org.kde.plasma.core 2.0 as PlasmaCore + +Item { + PlasmaCore.FrameSvgItem { + z: -1 + imagePath: "widgets/background" + enabledBorders: PlasmaCore.FrameSvgItem.TopBorder | PlasmaCore.FrameSvgItem.BottomBorder + anchors { + fill: parent + topMargin: -margins.top + bottomMargin: -margins.bottom + } + } + + opacity: 0.6 + height: Math.max(100, units.gridUnit * 2.5) + width: parent.width + y: parent.height / 2 - height / 2 + x: 0 +} diff --git a/containments/homescreen/contents/ui/main.qml b/containments/homescreen/contents/ui/main.qml new file mode 100644 index 00000000..64049843 --- /dev/null +++ b/containments/homescreen/contents/ui/main.qml @@ -0,0 +1,144 @@ +/* + * 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 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.satellite.components 0.1 as SatelliteComponents + +Item { + id: root + width: 640 + height: 480 + + property Item toolBox + property alias appletsSpace: applicationsView.headerItem + property int buttonHeight: width/4 + + Containment.onAppletAdded: { + var container = appletContainerComponent.createObject(appletsSpace) + container.visible = true + print("Applet added: " + applet) + applet.parent = container + container.applet = applet + applet.anchors.fill = applet.parent + applet.visible = true + container.width = 500 + container.height = 500 + } + + Component { + id: appletContainerComponent + Item { + property Item applet + } + } + + Rectangle { + color: Qt.rgba(0, 0, 0, 0.9 * (Math.min(applicationsView.contentY + root.height, root.height) / root.height)) + anchors.fill: parent + } + + PlasmaCore.ColorScope { + anchors.fill: parent + colorGroup: PlasmaCore.Theme.ComplementaryColorGroup + GridView { + id: applicationsView + anchors { + top: parent.top + bottom: parent.bottom + left: parent.left + right: parent.right + } + z: 1 + cellWidth: root.buttonHeight + cellHeight: cellWidth + model: SatelliteComponents.ApplicationListModel { + id: appListModel + } + snapMode: GridView.SnapToRow + //clip: true + delegate: HomeLauncher {} + header: MouseArea { + z: 999 + width: root.width + height: root.height - units.iconSizes.medium + + onPressAndHold: { + containment.action("configure").trigger(); + } + + /*SatelliteStripe { + id: stripe + z: 99 + y: Math.max(applications.contentY + parent.height, parent.height - height) + + PlasmaCore.Svg { + id: stripeIcons + imagePath: Qt.resolvedUrl("../images/homescreenicons.svg") + } + + Row { + anchors.fill: parent + property int columns: 4 + property alias buttonHeight: stripe.height + + HomeLauncherSvg { + id: phoneIcon + svg: stripeIcons + elementId: "phone" + callback: function() { + dialerOverlay.open() + } + } + + HomeLauncherSvg { + id: messagingIcon + svg: stripeIcons + elementId: "messaging" + callback: function() { console.log("Start messaging") } + } + + + HomeLauncherSvg { + id: emailIcon + svg: stripeIcons + elementId: "email" + callback: function() { console.log("Start email") } + } + + + HomeLauncherSvg { + id: webIcon + svg: stripeIcons + elementId: "web" + callback: function() { console.log("Start web") } + } + } + }*/ + } + } + } + + Component.onCompleted: { + print("root Containment loaded") + } +} \ No newline at end of file diff --git a/containments/homescreen/metadata.desktop b/containments/homescreen/metadata.desktop new file mode 100644 index 00000000..5dfc2c2d --- /dev/null +++ b/containments/homescreen/metadata.desktop @@ -0,0 +1,17 @@ +[Desktop Entry] +Encoding=UTF-8 +Keywords= +Name=Phone Homescreen +Type=Service + +X-KDE-ServiceTypes=Plasma/Applet,Plasma/Containment +X-Plasma-API=declarativeappletscript +X-KDE-ParentApp= +X-KDE-PluginInfo-Author=Marco Martin +X-KDE-PluginInfo-Category= +X-KDE-PluginInfo-Email=mart@kde.org +X-KDE-PluginInfo-License=GPLv2+ +X-KDE-PluginInfo-Name=org.kde.phone.homescreen +X-KDE-PluginInfo-Version= +X-KDE-PluginInfo-Website= +X-Plasma-MainScript=ui/main.qml From 700f6c2faefa5a72a1be27388fb3d8e8b0530634 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Wed, 25 Feb 2015 19:38:34 +0100 Subject: [PATCH 08/11] reenable the strip --- containments/homescreen/contents/ui/main.qml | 32 +++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/containments/homescreen/contents/ui/main.qml b/containments/homescreen/contents/ui/main.qml index 64049843..3e05f649 100644 --- a/containments/homescreen/contents/ui/main.qml +++ b/containments/homescreen/contents/ui/main.qml @@ -17,6 +17,7 @@ */ import QtQuick 2.1 +import QtQuick.Layouts 1.1 import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.core 2.0 as PlasmaCore @@ -34,7 +35,7 @@ Item { property int buttonHeight: width/4 Containment.onAppletAdded: { - var container = appletContainerComponent.createObject(appletsSpace) + var container = appletContainerComponent.createObject(appletsSpace.layout) container.visible = true print("Applet added: " + applet) applet.parent = container @@ -49,6 +50,22 @@ Item { id: appletContainerComponent Item { property Item applet + Layout.fillWidth: true + Layout.fillHeight: applet && applet.Layout.fillHeight + Layout.onFillHeightChanged: { + if (plasmoid.formFactor == PlasmaCore.Types.Vertical) { + checkLastSpacer(); + } + } + + Layout.minimumWidth: root.width + Layout.minimumHeight: applet && applet.Layout.minimumHeight > 0 ? applet.Layout.minimumHeight : root.width + + Layout.preferredWidth: root.width + Layout.preferredHeight: applet && applet.Layout.preferredHeight > 0 ? applet.Layout.preferredHeight : root.width + + Layout.maximumWidth: root.width + Layout.maximumHeight: applet && applet.Layout.maximumHeight > 0 ? applet.Layout.maximumHeight : (Layout.fillHeight ? root.height : root.width) } } @@ -68,7 +85,7 @@ Item { left: parent.left right: parent.right } - z: 1 + cellWidth: root.buttonHeight cellHeight: cellWidth model: SatelliteComponents.ApplicationListModel { @@ -79,6 +96,7 @@ Item { delegate: HomeLauncher {} header: MouseArea { z: 999 + property Item layout: mainLayout width: root.width height: root.height - units.iconSizes.medium @@ -86,10 +104,14 @@ Item { containment.action("configure").trigger(); } - /*SatelliteStripe { + ColumnLayout { + id: mainLayout + anchors.fill: parent + } + SatelliteStripe { id: stripe z: 99 - y: Math.max(applications.contentY + parent.height, parent.height - height) + y: Math.max(applicationsView.contentY + parent.height, parent.height - height) PlasmaCore.Svg { id: stripeIcons @@ -133,7 +155,7 @@ Item { callback: function() { console.log("Start web") } } } - }*/ + } } } } From f56a22c9d508ba3d88661f6ff72b56d0700ee327 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Thu, 26 Feb 2015 11:25:00 +0100 Subject: [PATCH 09/11] render the strip icons --- .../contents/images/homescreenicons.svg | 260 ++++++++++++++++++ containments/homescreen/contents/ui/main.qml | 4 +- 2 files changed, 262 insertions(+), 2 deletions(-) create mode 100644 containments/homescreen/contents/images/homescreenicons.svg diff --git a/containments/homescreen/contents/images/homescreenicons.svg b/containments/homescreen/contents/images/homescreenicons.svg new file mode 100644 index 00000000..e3c4edb3 --- /dev/null +++ b/containments/homescreen/contents/images/homescreenicons.svg @@ -0,0 +1,260 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/containments/homescreen/contents/ui/main.qml b/containments/homescreen/contents/ui/main.qml index 3e05f649..7699b4ca 100644 --- a/containments/homescreen/contents/ui/main.qml +++ b/containments/homescreen/contents/ui/main.qml @@ -101,7 +101,7 @@ Item { height: root.height - units.iconSizes.medium onPressAndHold: { - containment.action("configure").trigger(); + plasmoid.action("configure").trigger(); } ColumnLayout { @@ -128,7 +128,7 @@ Item { svg: stripeIcons elementId: "phone" callback: function() { - dialerOverlay.open() + console.log("Start phone") } } From 8dbe6c05462921404f94fe8bd58ab3a5d4d88068 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Thu, 26 Feb 2015 11:34:33 +0100 Subject: [PATCH 10/11] consider the applet minimumheight --- containments/homescreen/contents/ui/main.qml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/containments/homescreen/contents/ui/main.qml b/containments/homescreen/contents/ui/main.qml index 7699b4ca..5092a196 100644 --- a/containments/homescreen/contents/ui/main.qml +++ b/containments/homescreen/contents/ui/main.qml @@ -27,8 +27,8 @@ import org.kde.satellite.components 0.1 as SatelliteComponents Item { id: root - width: 640 - height: 480 + width: 480 + height: 640 property Item toolBox property alias appletsSpace: applicationsView.headerItem @@ -59,13 +59,13 @@ Item { } Layout.minimumWidth: root.width - Layout.minimumHeight: applet && applet.Layout.minimumHeight > 0 ? applet.Layout.minimumHeight : root.width + Layout.minimumHeight: appletsSpace.layout.children.count > 1 ? Math.max(applet.Layout.minimumHeight, root.height / 2) : root.height Layout.preferredWidth: root.width - Layout.preferredHeight: applet && applet.Layout.preferredHeight > 0 ? applet.Layout.preferredHeight : root.width + Layout.preferredHeight: Layout.minimumHeight Layout.maximumWidth: root.width - Layout.maximumHeight: applet && applet.Layout.maximumHeight > 0 ? applet.Layout.maximumHeight : (Layout.fillHeight ? root.height : root.width) + Layout.maximumHeight: Layout.minimumHeight } } @@ -98,7 +98,7 @@ Item { z: 999 property Item layout: mainLayout width: root.width - height: root.height - units.iconSizes.medium + height: Math.max(root.height, (root.height/2) * mainLayout.children.length) onPressAndHold: { plasmoid.action("configure").trigger(); From 897f109cfc67c5ded870442593c0fc9461cac3ee Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Thu, 26 Feb 2015 11:47:20 +0100 Subject: [PATCH 11/11] some fixes in icons sizing --- containments/homescreen/contents/ui/HomeLauncher.qml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/containments/homescreen/contents/ui/HomeLauncher.qml b/containments/homescreen/contents/ui/HomeLauncher.qml index 6e9d143e..1fccfbbb 100644 --- a/containments/homescreen/contents/ui/HomeLauncher.qml +++ b/containments/homescreen/contents/ui/HomeLauncher.qml @@ -15,12 +15,13 @@ MouseArea { PlasmaCore.IconItem { id: icon anchors.centerIn: parent - width: units.iconSizes.large + width: parent.height / 2 height: width source: model.ApplicationIconRole } PlasmaComponents.Label { + id: label visible: text.length > 0 anchors { @@ -32,6 +33,7 @@ MouseArea { wrapMode: Text.WordWrap horizontalAlignment: Qt.AlignHCenter verticalAlignment: Qt.AlignVCenter + maximumLineCount: 2 text: model.ApplicationNameRole font.pixelSize: theme.smallestFont.pixelSize