~renatofilho/address-book-app/fix-1375513

« back to all changes in this revision

Viewing changes to src/imports/Ubuntu/Contacts/ContactDetailAvatarView.qml

  • Committer: Renato Araujo Oliveira Filho
  • Date: 2014-09-18 18:56:15 UTC
  • mfrom: (296.6.2 fix-1368701)
  • Revision ID: renato.filho@canonical.com-20140918185615-vb6gqvktvrdiar1n
Changed avatar view visuals.
Move favorite action to avatar view area.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 */
16
16
 
17
17
import QtQuick 2.2
 
18
import QtGraphicalEffects 1.0
18
19
import QtContacts 5.0
 
20
import Ubuntu.Components 1.1
19
21
 
20
22
ContactDetailBase {
21
23
    id: root
22
24
 
23
 
    implicitHeight: units.gu(8)
24
 
    implicitWidth: units.gu(10)
 
25
    implicitHeight: units.gu(12)
 
26
    implicitWidth: parent.width
25
27
 
26
28
    Connections {
27
29
        id: connections
31
33
        onContactChanged: avatar.reload()
32
34
    }
33
35
 
 
36
    Image {
 
37
        id: imageBg
 
38
 
 
39
        source: avatar.avatarUrl
 
40
        anchors.fill: parent
 
41
        fillMode: Image.PreserveAspectCrop
 
42
        visible: false
 
43
    }
 
44
 
 
45
    FastBlur {
 
46
        anchors.fill: imageBg
 
47
        source: imageBg
 
48
        radius: 32
 
49
        visible: avatar.avatarUrl !== avatar.fallbackAvatarUrl
 
50
    }
 
51
 
34
52
    ContactAvatar {
35
53
        id: avatar
36
54
        objectName: "contactAvatarDetail"
37
55
 
38
56
        contactElement: root.contact
 
57
        height: units.gu(8)
 
58
        width: height
 
59
 
39
60
        anchors {
40
 
            fill: parent
 
61
            left: parent.left
 
62
            verticalCenter: parent.verticalCenter
41
63
            leftMargin: units.gu(2)
42
64
        }
 
65
 
 
66
    }
 
67
 
 
68
    ActionButton {
 
69
        id: favImage
 
70
 
 
71
        iconName: root.contact && root.contact.favorite.favorite ? "starred" : "non-starred"
 
72
        height: units.gu(4)
 
73
        iconSize: height
 
74
        width: height
 
75
        anchors {
 
76
            right: parent.right
 
77
            rightMargin: units.gu(2)
 
78
            verticalCenter: parent.verticalCenter
 
79
        }
 
80
 
 
81
        onClicked: {
 
82
            root.contact.favorite.favorite = !root.contact.favorite.favorite
 
83
            root.contact.save()
 
84
        }
43
85
    }
44
86
}