Changeset View
Changeset View
Standalone View
Standalone View
lookandfeel/contents/components/Clock.qml
Show All 26 Lines | |||||
27 | Item { | 27 | Item { | ||
28 | // If we're using software rendering, draw outlines instead of shadows | 28 | // If we're using software rendering, draw outlines instead of shadows | ||
29 | // See https://bugs.kde.org/show_bug.cgi?id=398317 | 29 | // See https://bugs.kde.org/show_bug.cgi?id=398317 | ||
30 | readonly property bool softwareRendering: GraphicsInfo.api === GraphicsInfo.Software | 30 | readonly property bool softwareRendering: GraphicsInfo.api === GraphicsInfo.Software | ||
31 | 31 | | |||
32 | width: clock.implicitWidth | 32 | width: clock.implicitWidth | ||
33 | height: clock.implicitHeight | 33 | height: clock.implicitHeight | ||
34 | 34 | | |||
35 | DropShadow { | ||||
36 | id: clockShadow | ||||
37 | visible: !softwareRendering | ||||
38 | anchors.fill: clock | ||||
39 | source: clock | ||||
40 | horizontalOffset: 0 | ||||
41 | verticalOffset: 2 | ||||
42 | radius: 14 | ||||
43 | samples: 32 | ||||
44 | spread: 0.3 | ||||
45 | color: ColorScope.backgroundColor | ||||
46 | } | ||||
47 | | ||||
35 | ColumnLayout { | 48 | ColumnLayout { | ||
36 | id: clock | 49 | id: clock | ||
37 | Label { | 50 | Label { | ||
38 | text: Qt.formatTime(timeSource.data["Local"]["DateTime"]) | 51 | text: Qt.formatTime(timeSource.data["Local"]["DateTime"]) | ||
39 | style: softwareRendering ? Text.Outline : undefined | 52 | style: softwareRendering ? Text.Outline : undefined | ||
40 | styleColor: softwareRendering ? ColorScope.backgroundColor : undefined | 53 | styleColor: softwareRendering ? ColorScope.backgroundColor : undefined | ||
41 | font.pointSize: 48 | 54 | font.pointSize: 48 | ||
42 | Layout.alignment: Qt.AlignHCenter | 55 | Layout.alignment: Qt.AlignHCenter | ||
43 | } | 56 | } | ||
44 | Label { | 57 | Label { | ||
45 | text: Qt.formatDate(timeSource.data["Local"]["DateTime"], Qt.DefaultLocaleLongDate) | 58 | text: Qt.formatDate(timeSource.data["Local"]["DateTime"], Qt.DefaultLocaleLongDate) | ||
46 | style: softwareRendering ? Text.Outline : undefined | 59 | style: softwareRendering ? Text.Outline : undefined | ||
47 | styleColor: softwareRendering ? ColorScope.backgroundColor : undefined | 60 | styleColor: softwareRendering ? ColorScope.backgroundColor : undefined | ||
48 | font.pointSize: 24 | 61 | font.pointSize: 24 | ||
49 | Layout.alignment: Qt.AlignHCenter | 62 | Layout.alignment: Qt.AlignHCenter | ||
50 | } | 63 | } | ||
51 | DataSource { | 64 | DataSource { | ||
52 | id: timeSource | 65 | id: timeSource | ||
53 | engine: "time" | 66 | engine: "time" | ||
54 | connectedSources: ["Local"] | 67 | connectedSources: ["Local"] | ||
55 | interval: 1000 | 68 | interval: 1000 | ||
56 | } | 69 | } | ||
57 | } | 70 | } | ||
58 | | ||||
59 | layer.enabled: !softwareRendering | | |||
60 | layer.effect: DropShadow { | | |||
61 | horizontalOffset: 0 | | |||
62 | verticalOffset: 2 | | |||
63 | radius: 14 | | |||
64 | samples: 32 | | |||
65 | spread: 0.3 | | |||
66 | color: ColorScope.backgroundColor | | |||
67 | } | | |||
68 | } | 71 | } |