diff --git a/containments/homescreen/contents/ui/Clock.qml b/containments/homescreen/contents/ui/Clock.qml new file mode 100644 index 00000000..9118eaf7 --- /dev/null +++ b/containments/homescreen/contents/ui/Clock.qml @@ -0,0 +1,47 @@ +/* + * Copyright 2014 Aaron Seigo + * Copyright 2015 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.1 +import QtQuick.Layouts 1.1 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents + + +PlasmaComponents.Label { + id: bigClock + + PlasmaCore.DataSource { + id: timeSource + engine: "time" + connectedSources: ["Local"] + interval: 60 * 1000 + } + + Layout.minimumWidth: implicitWidth + Layout.minimumHeight: implicitHeight + + 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" +} diff --git a/containments/homescreen/contents/ui/main.qml b/containments/homescreen/contents/ui/main.qml index c911f960..613d5da0 100644 --- a/containments/homescreen/contents/ui/main.qml +++ b/containments/homescreen/contents/ui/main.qml @@ -163,6 +163,27 @@ Item { model: appListModel snapMode: GridView.SnapToRow + + onFlickingChanged: { + if (!draggingVertically && contentY < -root.height*2) { + scrollAnim.to = Math.round(contentY/root.height) * root.height + scrollAnim.running = true; + } + } + onDraggingVerticallyChanged: { + if (!draggingVertically && contentY < -root.height*2) { + scrollAnim.to = Math.round(contentY/root.height) * root.height + scrollAnim.running = true; + } + } + NumberAnimation { + id: scrollAnim + target: applicationsView + properties: "contentY" + duration: units.longDuration + easing.type: Easing.InOutQuad + } + //clip: true delegate: HomeLauncher {} header: MouseArea { @@ -170,7 +191,7 @@ Item { property Item layout: appletsLayout property Item lastSpacer: spacer width: root.width - height: mainLayout.Layout.minimumHeight + stripe.height + units.gridUnit * 2 + height: mainLayout.Layout.minimumHeight onPressAndHold: { plasmoid.action("configure").trigger(); @@ -185,7 +206,15 @@ Item { Item { Layout.fillWidth: true Layout.minimumHeight: root.height + Clock { + anchors { + horizontalCenter: parent.horizontalCenter + bottom: goUp.top + margins: units.largeSpacing + } + } PlasmaCore.IconItem { + id: goUp source: "go-up" width: units.iconSizes.huge height: width @@ -207,7 +236,7 @@ Item { } ColumnLayout { id: appletsLayout - Layout.minimumHeight: Math.max(root.height, Layout.preferredHeight) + Layout.minimumHeight: Math.max(root.height, Math.round(Layout.preferredHeight / root.height) * root.height) Item { id: spacer Layout.fillWidth: true