<commit_before>/**
 * Copyright (c) 2015 <NAME>
 *
 * This file is subject to the terms and conditions defined in
 * file 'LICENSE', which is part of this source code package.
 **/

import QtQuick 2.0
import Sailfish.Silica 1.0

Rectangle {
    id: statusRectangle

    property bool hasNew: false
    property bool hasError: false
    property bool isFetching: false

    width: image.width + label.width
           + (label.visible ? 3 : 2) * Theme.paddingSmall
    height: image.height + 2*Theme.paddingSmall

    state: "invisible"

    Image {
        id: image
        anchors {
            left: parent.left
            leftMargin: Theme.paddingSmall
            bottom: parent.bottom
            bottomMargin: Theme.paddingSmall
        }
        height: Theme.iconSizeSmall
        width: Theme.iconSizeSmall
        fillMode: Image.PreserveAspectFit
    }

    Label {
        id: label
        anchors {
            left: image.right
            leftMargin: Theme.paddingSmall
            bottom: parent.bottom
            bottomMargin: Theme.paddingSmall
        }
        font.pixelSize: Theme.fontSizeExtraSmall
    }


    states: [
        State {
          name: "invisible"
          when: !isFetching && !hasNew && !hasError
          PropertyChanges { target: statusRectangle; opacity: 0.0 }
        },
        State {
            name: "new"
            when: !isFetching && hasNew
            PropertyChanges { target: statusRectangle; opacity: 1.0 }
            PropertyChanges { target: image;           source: "image://theme/icon-s-update" }
            PropertyChanges { target: label;           text: "New"; visible: true; }
        },
        State {
            name: "error"
            when: !isFetching && hasError
            PropertyChanges { target: statusRectangle; opacity: 1.0 }
            PropertyChanges { target: image;           source: "image://theme/icon-system-warning" }
            PropertyChanges { target: label;           text: "Error"; visible: true; }
        },
        State {
            name: "fetching"
            when: isFetching
            PropertyChanges { target: statusRectangle; opacity: 1.0 }
            PropertyChanges { target: image;           source: "image://theme/icon-s-sync" }
            PropertyChanges { target: label;           visible: false }
        }]
}<commit_msg>add rotation animation for fetching status<commit_after>/**
 * Copyright (c) 2015 <NAME>
 *
 * This file is subject to the terms and conditions defined in
 * file 'LICENSE', which is part of this source code package.
 **/

import QtQuick 2.0
import Sailfish.Silica 1.0

Rectangle {
    id: statusRectangle

    property bool hasNew: false
    property bool hasError: false
    property bool isFetching: false

    width: image.width + label.width
           + (label.visible ? 3 : 2) * Theme.paddingSmall
    height: image.height + 2*Theme.paddingSmall

    state: "invisible"

    Image {
        id: image
        anchors {
            left: parent.left
            leftMargin: Theme.paddingSmall
            bottom: parent.bottom
            bottomMargin: Theme.paddingSmall
        }
        height: Theme.iconSizeSmall
        width: Theme.iconSizeSmall
        fillMode: Image.PreserveAspectFit

        RotationAnimation on rotation {
            id: imageRotation
            loops: Animation.Infinite
            from: 0
            to: 360
            duration: 1000
        }
    }

    Label {
        id: label
        anchors {
            left: image.right
            leftMargin: Theme.paddingSmall
            bottom: parent.bottom
            bottomMargin: Theme.paddingSmall
        }
        font.pixelSize: Theme.fontSizeExtraSmall
    }


    states: [
        State {
          name: "invisible"
          when: !isFetching && !hasNew && !hasError
          PropertyChanges { target: statusRectangle; opacity: 0.0 }
          PropertyChanges { target: imageRotation;   running: false }
        },
        State {
            name: "new"
            when: !isFetching && hasNew
            PropertyChanges { target: statusRectangle; opacity: 1.0 }
            PropertyChanges { target: image;           source: "image://theme/icon-s-update"; rotation: 0 }
            PropertyChanges { target: label;           text: "New"; visible: true; }
            PropertyChanges { target: imageRotation;   running: false }
        },
        State {
            name: "error"
            when: !isFetching && hasError
            PropertyChanges { target: statusRectangle; opacity: 1.0 }
            PropertyChanges { target: image;           source: "image://theme/icon-system-warning"; rotation: 0 }
            PropertyChanges { target: label;           text: "Error"; visible: true; }
            PropertyChanges { target: imageRotation;   running: false }
        },
        State {
            name: "fetching"
            when: isFetching
            PropertyChanges { target: statusRectangle; opacity: 1.0 }
            PropertyChanges { target: image;           source: "image://theme/icon-s-sync" }
            PropertyChanges { target: label;           visible: false }
            PropertyChanges { target: imageRotation;   running: true }
        }]
}
{'fraction_non_alphanumeric': 0.08878683505549177, 'fraction_numerical': 0.009184845005740528, 'mean_word_length': 1.7729442970822282, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '6520784', 'n_tokens_mistral': 1387, 'n_tokens_neox': 1347, 'n_words': 382}