~ci-train-bot/unity8/unity8-ubuntu-zesty-2167

« back to all changes in this revision

Viewing changes to Greeter/GreeterContent.qml

  • Committer: Michał Sawicz
  • Date: 2013-06-05 22:03:08 UTC
  • Revision ID: michal.sawicz@canonical.com-20130605220308-yny8fv3futtr04fg
Inital unity8 commit.

Previous history can be found at https://code.launchpad.net/~unity-team/unity/phablet

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2013 Canonical, Ltd.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; version 3.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 */
 
16
 
 
17
import QtQuick 2.0
 
18
import Ubuntu.Components 0.1
 
19
import LightDM 0.1 as LightDM
 
20
import "../Components"
 
21
 
 
22
MouseArea {
 
23
    id: root
 
24
    anchors.fill: parent
 
25
 
 
26
    property bool promptless: loginLoader.status == Loader.Ready && LightDM.Greeter.promptless
 
27
    property bool ready: wallpaper.status == Image.Ready
 
28
    property alias leftTeaserPressed: leftTeaser.pressed
 
29
 
 
30
    signal selected(int uid)
 
31
    signal unlocked(int uid)
 
32
 
 
33
    CrossFadeImage {
 
34
        id: wallpaper
 
35
 
 
36
        source: shell.background
 
37
        anchors.fill: parent
 
38
        crossFade: false
 
39
        fadeInFirst: false
 
40
    }
 
41
 
 
42
    Rectangle {
 
43
        anchors.fill: parent
 
44
        color: "black"
 
45
        opacity: 0.4
 
46
    }
 
47
 
 
48
    Clock {
 
49
        id: clock
 
50
        visible: narrowMode
 
51
 
 
52
        anchors {
 
53
            top: parent.top
 
54
            topMargin: units.gu(2)
 
55
            horizontalCenter: parent.horizontalCenter
 
56
        }
 
57
    }
 
58
 
 
59
    MouseArea {
 
60
        id: leftTeaser
 
61
        anchors.fill: parent
 
62
        anchors.rightMargin: parent.width / 2
 
63
    }
 
64
 
 
65
    Loader {
 
66
        id: loginLoader
 
67
        objectName: "loginLoader"
 
68
        anchors {
 
69
            left: parent.left
 
70
            leftMargin: Math.min(parent.width * 0.16, units.gu(20))
 
71
            verticalCenter: parent.verticalCenter
 
72
        }
 
73
        width: units.gu(29)
 
74
        height: parent.height
 
75
 
 
76
        source: greeter.multiUser ? "LoginList.qml" : ""
 
77
 
 
78
        onLoaded: {
 
79
            item.currentIndex = greeterContentLoader.currentIndex
 
80
        }
 
81
 
 
82
        Binding {
 
83
            target: loginLoader.item
 
84
            property: "model"
 
85
            value: greeterContentLoader.model
 
86
        }
 
87
 
 
88
        Connections {
 
89
            target: loginLoader.item
 
90
 
 
91
            onSelected: {
 
92
                root.selected(uid);
 
93
            }
 
94
 
 
95
            onUnlocked: {
 
96
                root.unlocked(uid);
 
97
            }
 
98
 
 
99
            onCurrentIndexChanged: {
 
100
                if (greeterContentLoader.currentIndex !== loginLoader.item.currentIndex) {
 
101
                    greeterContentLoader.currentIndex = loginLoader.item.currentIndex;
 
102
                }
 
103
            }
 
104
        }
 
105
    }
 
106
 
 
107
    Infographics {
 
108
        id: infographics
 
109
        height: narrowMode ? parent.height : 0.75 * parent.height
 
110
        model: greeterContentLoader.infographicModel
 
111
 
 
112
        Component.onCompleted: infographics.updateUsername(greeterContentLoader.currentIndex)
 
113
 
 
114
        Connections {
 
115
            target: root
 
116
            onSelected: infographics.updateUsername(uid)
 
117
        }
 
118
 
 
119
        function updateUsername(uid) {
 
120
            greeterContentLoader.infographicModel.username = greeterContentLoader.model.data(uid, LightDM.UserRoles.NameRole)
 
121
        }
 
122
 
 
123
        anchors {
 
124
            verticalCenter: parent.verticalCenter
 
125
            left: narrowMode ? root.left : loginLoader.right
 
126
            right: root.right
 
127
        }
 
128
    }
 
129
}