@@ -17,6 +17,7 @@
1717import "Gradient.js" as Gradient
1818import QtQuick 2.4
1919import Ubuntu.Components 1.3
20+import Powerd 0.1
2021
2122Item {
2223 id: infographic
@@ -25,7 +26,7 @@ Item {
2526
2627 property int animDuration: 10
2728
28− property int currentDay: -1 // Boot time value
29+ property int currentWeekDay
2930
3031 QtObject {
3132 id: d
@@ -58,22 +59,40 @@ Item {
5859 onDataDisappeared: startShowAnimation() // show "no data" label
5960 }
6061
62+ Connections {
63+ id: screenState
64+ target: Powerd
6165
62− function startShowAnimation() {
63− if(currentDay !== model.currentDay){
64− currentDay = model.currentDay
65− model.nextDataSource();
66− }else{
67− dotHideAnimTimer.stop()
68− notification.hideAnim.stop()
69−
70− if (d.useDotAnimation) {
71− dotShowAnimTimer.startFromBeginning()
66+ onStatusChanged: {
67+ if(Powerd.status === Powerd.On){
68+ handleScreenOn()
7269 }
73− notification.showAnim.start()
7470 }
7571 }
7672
73+ function handleScreenOn(){
74+ var today = new Date().getDay()
75+ if(infographic.currentWeekDay !== today){
76+ infographic.currentWeekDay = today
77+ reloadUserData();
78+ }
79+ }
80+
81+ function reloadUserData(){
82+ d.useDotAnimation = false
83+ infographic.model.nextDataSource()
84+ }
85+
86+ function startShowAnimation() {
87+ dotHideAnimTimer.stop()
88+ notification.hideAnim.stop()
89+
90+ if (d.useDotAnimation) {
91+ dotShowAnimTimer.startFromBeginning()
92+ }
93+ notification.showAnim.start()
94+ }
95+
7796 function startHideAnimation() {
7897 dotShowAnimTimer.stop()
7998 circleChangeAnimTimer.stop()
@@ -89,7 +108,10 @@ Item {
89108
90109 visible: model.username !== ""
91110
92− Component.onCompleted: startShowAnimation()
111+ Component.onCompleted: {
112+ currentWeekDay = new Date().getDay()
113+ startShowAnimation()
114+ }
93115
94116 Item {
95117 id: dataCircle
@@ -413,8 +435,7 @@ Item {
413435
414436 onDoubleClicked: {
415437 if (!d.animating) {
416− d.useDotAnimation = false
417− infographic.model.nextDataSource()
438+ reloadUserData()
418439 }
419440 }
420441 }