~nik90/ubuntu-clock-app/world-clock-part1

« back to all changes in this revision

Viewing changes to timer/TimerScript.js

  • Committer: Tarmac
  • Author(s): Nekhelesh Ramananthan
  • Date: 2013-05-24 19:33:29 UTC
  • mfrom: (86.1.10 timer-animations)
  • Revision ID: tarmac-20130524193329-xr9n84761ghyimro
Adds animation to timer page while view/hiding the saved preset list similar to the stopwatch page animations. Fixes: https://bugs.launchpad.net/bugs/1168325.

Approved by Renato Araujo Oliveira Filho, Ubuntu Phone Apps Jenkins Bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 */
19
19
 
20
20
Qt.include("../common/ClockUtils.js")
21
 
Qt.include("../common/Constants.js")
22
21
 
23
22
// Function to return total seconds.
24
23
function totalSeconds ( hou, min, sec ) {
35
34
    return Utils.hmsToString(hor, min, sec);
36
35
}
37
36
 
38
 
// Show/Hide Timer Page
39
 
function showTimerPage ( mode ) {
40
 
    analogTimer.visible = mode;
41
 
 
42
 
    // TODO: Remove these anchor changes once the flickable is implemented.
43
 
    if (mode) {
44
 
        timerPage.viewState = "TIMER";
45
 
        buttonTimer.visible = true
46
 
        buttonTimer.anchors.bottom = timerPage.bottom;
47
 
        buttonTimer.anchors.bottomMargin = units.gu(1);
48
 
 
49
 
        addPreset.visible = true;
50
 
        editPreset.visible = true;
51
 
        deletePreset.visible = false;
52
 
 
53
 
        toolbarTimer.back.visible = false;
54
 
        toolbarTimer.lock = false;
55
 
        toolbarTimer.active = false;
56
 
    }
57
 
}
58
 
 
59
 
// Show/Hide Add Preset Page
60
 
function showAddPresetPage ( mode ) {
61
 
    analogTimer.visible = mode;
62
 
    addPresetCircleDone.visible = mode;
63
 
    namePreset.visible = mode;
64
 
    buttonTimer.visible = !mode
65
 
 
66
 
    if (mode) {
67
 
        timerPage.viewState = "ADDPRESET";
68
 
    }
69
 
}
70
 
 
71
 
// Show/Hide View Preset Page
72
 
function showViewPresetPage ( mode ) {
73
 
    listPreset.visible = mode;
74
 
 
75
 
    //TODO: These anchors changes should be removed once a flickable is used.
76
 
    if (mode) {
77
 
        timerPage.viewState = "SAVEDPRESETS";
78
 
        buttonTimer.visible = true
79
 
        buttonTimer.anchors.bottom = topTimerRow.bottom;
80
 
        buttonTimer.anchors.bottomMargin = -units.gu(10);
81
 
    }
82
 
}
83
 
 
84
37
// Call Workerscript to populate the preset list
85
38
function populatePreset () {
86
39
    var msg = {'action': 'appendPreset', 'model': listModel, 'array': storageTimer.getTimerValue()};
87
40
    worker.sendMessage(msg);
 
41
    timerPage.lastindex = -1;
88
42
}
89
43
 
90
44
// Read preset from internal databese and populate the preset list