mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
add a clock in lockscreen
This commit is contained in:
parent
50fc65fe67
commit
43d0363778
2 changed files with 78 additions and 2 deletions
47
containments/homescreen/contents/ui/Clock.qml
Normal file
47
containments/homescreen/contents/ui/Clock.qml
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2014 Aaron Seigo <aseigo@kde.org>
|
||||||
|
* Copyright 2015 Marco Martin <notmart@gmail.com>
|
||||||
|
*
|
||||||
|
* 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"
|
||||||
|
}
|
||||||
|
|
@ -163,6 +163,27 @@ Item {
|
||||||
model: appListModel
|
model: appListModel
|
||||||
|
|
||||||
snapMode: GridView.SnapToRow
|
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
|
//clip: true
|
||||||
delegate: HomeLauncher {}
|
delegate: HomeLauncher {}
|
||||||
header: MouseArea {
|
header: MouseArea {
|
||||||
|
|
@ -170,7 +191,7 @@ Item {
|
||||||
property Item layout: appletsLayout
|
property Item layout: appletsLayout
|
||||||
property Item lastSpacer: spacer
|
property Item lastSpacer: spacer
|
||||||
width: root.width
|
width: root.width
|
||||||
height: mainLayout.Layout.minimumHeight + stripe.height + units.gridUnit * 2
|
height: mainLayout.Layout.minimumHeight
|
||||||
|
|
||||||
onPressAndHold: {
|
onPressAndHold: {
|
||||||
plasmoid.action("configure").trigger();
|
plasmoid.action("configure").trigger();
|
||||||
|
|
@ -185,7 +206,15 @@ Item {
|
||||||
Item {
|
Item {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.minimumHeight: root.height
|
Layout.minimumHeight: root.height
|
||||||
|
Clock {
|
||||||
|
anchors {
|
||||||
|
horizontalCenter: parent.horizontalCenter
|
||||||
|
bottom: goUp.top
|
||||||
|
margins: units.largeSpacing
|
||||||
|
}
|
||||||
|
}
|
||||||
PlasmaCore.IconItem {
|
PlasmaCore.IconItem {
|
||||||
|
id: goUp
|
||||||
source: "go-up"
|
source: "go-up"
|
||||||
width: units.iconSizes.huge
|
width: units.iconSizes.huge
|
||||||
height: width
|
height: width
|
||||||
|
|
@ -207,7 +236,7 @@ Item {
|
||||||
}
|
}
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: appletsLayout
|
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 {
|
Item {
|
||||||
id: spacer
|
id: spacer
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue