~renatofilho/ubuntu-calendar-app/optimize

« back to all changes in this revision

Viewing changes to TimeLineBase.qml

  • Committer: Renato Araujo Oliveira Filho
  • Date: 2016-03-01 17:47:15 UTC
  • Revision ID: renato.filho@canonical.com-20160301174715-fh3rgeliq2an784k
Update current time separator line every 5 minutes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
151
151
        var eventInfo = CanlendarCanvas.parseDayEvents(startDate, itemsOfTheDay)
152
152
        eventLayoutHelper.sendMessage({'events': eventInfo})
153
153
 
154
 
        if(intern.now.isSameDay( bubbleOverLay.day )) {
155
 
            bubbleOverLay.showSeparator();
156
 
        }
157
 
 
 
154
        bubbleOverLay.showSeparator();
158
155
        intern.busy = false
159
156
    }
160
157
 
183
180
    }
184
181
 
185
182
    function showSeparator() {
186
 
        var y = ((intern.now.getMinutes() * hourHeight) / 60) + intern.now.getHours() * hourHeight;
187
 
        separator.y = y;
188
 
        separator.visible = true;
 
183
        intern.now = new Date();
 
184
        if (intern.now.isSameDay(bubbleOverLay.day) ) {
 
185
            var y = ((intern.now.getMinutes() * hourHeight) / 60) + intern.now.getHours() * hourHeight;
 
186
            separator.y = y;
 
187
            separator.visible = true;
 
188
        } else {
 
189
            separator.visible = false;
 
190
        }
189
191
    }
190
192
 
191
193
    Component.onCompleted: bubbleOverLay.idleCreateEvents();
269
271
                creatingEvent = false
270
272
            }
271
273
        }
272
 
 
273
 
        onPressed: {
274
 
            intern.now = new Date();
275
 
            if( intern.now.isSameDay( bubbleOverLay.day ) ) {
276
 
                bubbleOverLay.showSeparator();
277
 
            }
278
 
        }
279
274
    }
280
275
 
281
276
    TimeSeparator {
287
282
        z: 1000
288
283
    }
289
284
 
 
285
    Timer {
 
286
        id: separtorUpdateTimer
 
287
        interval: 300000 // every 5 minutes
 
288
        running: true
 
289
        repeat: true
 
290
        onTriggered: showSeparator()
 
291
    }
 
292
 
290
293
    QtObject {
291
294
        id: intern
292
295