<commit_before>// Copyright (c) 2015 <NAME>.
// Uranium is released under the terms of the AGPLv3 or higher.

import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1

import UM 1.2 as UM
import Cura 1.0 as Cura

import ".."

ScrollView
{
    id: base;

    style: UM.Theme.styles.scrollview;
    flickableItem.flickableDirection: Flickable.VerticalFlick;

    property Action configureSettings;
    signal showTooltip(Item item, point location, string text);
    signal hideTooltip();

    ListView
    {
        id: contents
        spacing: UM.Theme.getSize("default_lining").height;

        model: UM.SettingDefinitionsModel { id: definitionsModel; containerId: Cura.MachineManager.activeDefinitionId }

        delegate: Loader
        {
            id: delegate

            width: UM.Theme.getSize("sidebar").width;
            height: provider.properties.enabled == "True" ? UM.Theme.getSize("section").height : 0
            Behavior on height { NumberAnimation { duration: 100 } }
            opacity: provider.properties.enabled == "True" ? 1 : 0
            Behavior on opacity { NumberAnimation { duration: 100 } }
            enabled: provider.properties.enabled == "True"

            property var definition: model
            property var settingDefinitionsModel: definitionsModel
            property var propertyProvider: provider

            //Qt5.4.2 and earlier has a bug where this causes a crash: https://bugreports.qt.io/browse/QTBUG-35989
            asynchronous: QT_VERSION_STR.split(".")[1] >= 5

            source:
            {
                switch(model.type)
                {
                    case "int":
                        return "SettingTextField.qml"
                    case "float":
                        return "SettingTextField.qml"
                    case "enum":
                        return "SettingComboBox.qml"
                    case "bool":
                        return "SettingCheckBox.qml"
                    case "str":
                        return "SettingTextField.qml"
                    case "category":
                        return "SettingCategory.qml"
                    default:
                        return "SettingUnknown.qml"
                }
            }

            UM.SettingPropertyProvider
            {
                id: provider

                containerStackId: Cura.MachineManager.activeMachineId<commit_msg>Do not load ComboBox items asynchronously<commit_after>// Copyright (c) 2015 <NAME>.
// Uranium is released under the terms of the AGPLv3 or higher.

import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1

import UM 1.2 as UM
import Cura 1.0 as Cura

import ".."

ScrollView
{
    id: base;

    style: UM.Theme.styles.scrollview;
    flickableItem.flickableDirection: Flickable.VerticalFlick;

    property Action configureSettings;
    signal showTooltip(Item item, point location, string text);
    signal hideTooltip();

    ListView
    {
        id: contents
        spacing: UM.Theme.getSize("default_lining").height;

        model: UM.SettingDefinitionsModel { id: definitionsModel; containerId: Cura.MachineManager.activeDefinitionId }

        delegate: Loader
        {
            id: delegate

            width: UM.Theme.getSize("sidebar").width;
            height: provider.properties.enabled == "True" ? UM.Theme.getSize("section").height : 0
            Behavior on height { NumberAnimation { duration: 100 } }
            opacity: provider.properties.enabled == "True" ? 1 : 0
            Behavior on opacity { NumberAnimation { duration: 100 } }
            enabled: provider.properties.enabled == "True"

            property var definition: model
            property var settingDefinitionsModel: definitionsModel
            property var propertyProvider: provider

            //Qt5.4.2 and earlier has a bug where this causes a crash: https://bugreports.qt.io/browse/QTBUG-35989
            //In addition, while it works for 5.5 and higher, the ordering of the actual combo box drop down changes,
            //causing nasty issues when selecting differnt options. So disable asynchronous loading of enum type completely.
            asynchronous: model.type != "enum"

            source:
            {
                switch(model.type)
                {
                    case "int":
                        return "SettingTextField.qml"
                    case "float":
                        return "SettingTextField.qml"
                    case "enum":
                        return "SettingComboBox.qml"
                    case "bool":
                        return "SettingCheckBox.qml"
                    case "str":
                        return "SettingTextField.qml"
                    case "category":
                        return "SettingCategory.qml"
                    default:
                        return "SettingUnknown.qml"
                }
            }

            UM.SettingPropertyProvider
            {
                id: provider

                containerStackId: Cura.MachineManager.activeMachineId
{'fraction_non_alphanumeric': 0.07916024653312789, 'fraction_numerical': 0.01386748844375963, 'mean_word_length': 1.6851085832471562, 'pattern_counts': {'":': 12, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 2, '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': '4213907', 'n_tokens_mistral': 1375, 'n_tokens_neox': 1231, 'n_words': 360}