<commit_before>/*
 * Copyright 2011 Intel Corporation.
 *
 * This program is licensed under the terms and conditions of the
 * Apache License, version 2.0.  The full text of the Apache License is at
 * http://www.apache.org/licenses/LICENSE-2.0
 */

import QtQuick 1.1
import QtMobility.contacts 1.1

Image {
    fillMode: Image.PreserveAspectCrop
    asynchronous: true
    smooth: true
    width: UiConstants.ListItemHeightSmall
    height: UiConstants.ListItemHeightSmall
    property Contact contact
    sourceSize.width: width
    clip: true

    onContactChanged: {
        contact.avatar.fieldsChanged.connect(avatarPotentiallyChanged)
        avatarPotentiallyChanged();
    }

    function avatarPotentiallyChanged() {
        source = contact.avatar.imageUrl
        if (source == "")
            source = "image://theme/icon-m-telephony-contact-avatar"
    }

    onStatusChanged: {
        if (status == Image.Error || status == Image.Null) {
            source = "image://theme/icon-m-telephony-contact-avatar"
        }
    }
}<commit_msg>use thumbnailer service for avatar images<commit_after>/*
 * Copyright 2011 Intel Corporation.
 *
 * This program is licensed under the terms and conditions of the
 * Apache License, version 2.0.  The full text of the Apache License is at
 * http://www.apache.org/licenses/LICENSE-2.0
 */

import QtQuick 1.1
import QtMobility.contacts 1.1
import org.nemomobile.thumbnailer 1.0

Image {
    fillMode: Image.PreserveAspectCrop
    asynchronous: true
    width: UiConstants.ListItemHeightSmall
    height: UiConstants.ListItemHeightSmall
    property Contact contact
    sourceSize.width: width
    sourceSize.height: width

    onContactChanged: {
        contact.avatar.fieldsChanged.connect(avatarPotentiallyChanged)
        avatarPotentiallyChanged();
    }

    function avatarPotentiallyChanged() {
        source = "image://nemoThumbnail/" + contact.avatar.imageUrl
        if (source == "")
            source = "image://theme/icon-m-telephony-contact-avatar"
    }

    onStatusChanged: {
        if (status == Image.Error || status == Image.Null) {
            source = "image://theme/icon-m-telephony-contact-avatar"
        }
    }
}
{'fraction_non_alphanumeric': 0.09744990892531877, 'fraction_numerical': 0.011839708561020037, 'mean_word_length': 2.881625441696113, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6109342', 'n_tokens_mistral': 662, 'n_tokens_neox': 630, 'n_words': 153}