pub unsafe fn load_to_detailed_view(&self, index: Ref<QModelIndex>) {

        // If it's the first faction loaded into the detailed view, enable the groupboxes so they can be edited.
        if !self.detailed_view_widget.is_enabled() {
            self.detailed_view_widget.set_enabled(true);
        }

        let data: HashMap<String, String> = serde_json::from_str(&index.data_1a(UNIT_DATA).to_string().to_std_string()).unwrap();
        let mut errors: Vec<String> = vec![];

        // Log in debug mode, for debugging.
        if cfg!(debug_assertions) {
            log::info!("{:#?}", data.iter().sorted_by_key(|x| x.0).collect::<std::collections::BTreeMap<&String, &String>>());
        }

        if let Err(error) = self.tool.load_definition_to_detailed_view_editor(&data, "unit_variants", &UNIT_VARIANTS_CUSTOM_FIELDS) {
            errors.push(error.to_string());
        }

        if let Err(error) = self.tool.load_definition_to_detailed_view_editor(&data, "variants", &VARIANTS_CUSTOM_FIELDS) {
            errors.push(error.to_string());
        }

        // Load custom entries from unit_variants.
        self.tool.load_field_to_detailed_view_editor_string_combo(&data, &self.unit_variants_unit_card_combobox, "unit_variants_unit_card");
        self.tool.load_field_to_detailed_view_editor_string_combo(&data, &self.variants_variant_filename_combobox, "variants_variant_filename");

        // The icon needs to be pulled up from the dependencies cache on load.
        self.load_unit_icon(&data, None);
        self.load_variant_mesh(&data, None);

        // Colours must be loaded into a list, with the same logic as the main faction list.
        self.load_unit_variants_colours(&data);

        // Once everything is loaded, disable the colours section until a colour variant is selected.
        self.unit_variants_colours_widget.set_enabled(false);

        // If we have any errors, show them here.
        if !errors.is_empty() {
            show_message_warning(&self.tool.message_widget, errors.join("\n"));
        }
    }
/// This function loads the data of a faction into the detailed view.
This function loads the data of a faction into the detailed view.
This function loads the data of a faction into the detailed view .
pub unsafe fn load_to_detailed_view(&self, index: Ref<QModelIndex>) {
        // If it's the first faction loaded into the detailed view, enable the groupboxes so they can be edited.
        if !self.detailed_view_widget.is_enabled() {
            self.detailed_view_widget.set_enabled(true);
        }
        let data: HashMap<String, String> = serde_json::from_str(&index.data_1a(UNIT_DATA).to_string().to_std_string()).unwrap();
        let mut errors: Vec<String> = vec![];
        // Log in debug mode, for debugging.
        if cfg!(debug_assertions) {
            log::info!("{:#?}", data.iter().sorted_by_key(|x| x.0).collect::<std::collections::BTreeMap<&String, &String>>());
        }
        if let Err(error) = self.tool.load_definition_to_detailed_view_editor(&data, "unit_variants", &UNIT_VARIANTS_CUSTOM_FIELDS) {
            errors.push(error.to_string());
        }
        if let Err(error) = self.tool.load_definition_to_detailed_view_editor(&data, "variants", &VARIANTS_CUSTOM_FIELDS) {
            errors.push(error.to_string());
        }
        // Load custom entries from unit_variants.
        self.tool.load_field_to_detailed_view_editor_string_combo(&data, &self.unit_variants_unit_card_combobox, "unit_variants_unit_card");
        self.tool.load_field_to_detailed_view_editor_string_combo(&data, &self.variants_variant_filename_combobox, "variants_variant_filename");
        // The icon needs to be pulled up from the dependencies cache on load.
        self.load_unit_icon(&data, None);
        self.load_variant_mesh(&data, None);
        // Colours must be loaded into a list, with the same logic as the main faction list.
        self.load_unit_variants_colours(&data);
        // Once everything is loaded, disable the colours section until a colour variant is selected.
        self.unit_variants_colours_widget.set_enabled(false);
        // If we have any errors, show them here.
        if !errors.is_empty() {
            show_message_warning(&self.tool.message_widget, errors.join("\n"));
        }
    }
pub unsafe fn load_to_detailed_view ( & self , index : Ref < QModelIndex > ) { // If it's the first faction loaded into the detailed view, enable the groupboxes so they can be edited. if ! self . detailed_view_widget . is_enabled ( ) { self . detailed_view_widget . set_enabled ( true ) ; } let data : HashMap < String , String > = serde_json :: from_str ( & index . data_1a ( UNIT_DATA ) . to_string ( ) . to_std_string ( ) ) . unwrap ( ) ; let mut errors : Vec < String > = vec ! [ ] ; // Log in debug mode, for debugging. if cfg ! ( debug_assertions ) { log :: info ! ( " " data iter ( ) sorted_by_key ( x x 0 ) collect std collections BTreeMap String String ( ) ) ; } if let Err ( error ) = self . tool . load_definition_to_detailed_view_editor ( & data , " " , & UNIT_VARIANTS_CUSTOM_FIELDS ) { errors . push ( error . to_string ( ) ) ; } if let Err ( error ) = self . tool . load_definition_to_detailed_view_editor ( & data , " " , & VARIANTS_CUSTOM_FIELDS ) { errors . push ( error . to_string ( ) ) ; } // Load custom entries from unit_variants. self . tool . load_field_to_detailed_view_editor_string_combo ( & data , & self . unit_variants_unit_card_combobox , " " ) ; self . tool . load_field_to_detailed_view_editor_string_combo ( & data , & self . variants_variant_filename_combobox , " " ) ; // The icon needs to be pulled up from the dependencies cache on load. self . load_unit_icon ( & data , None ) ; self . load_variant_mesh ( & data , None ) ; // Colours must be loaded into a list, with the same logic as the main faction list. self . load_unit_variants_colours ( & data ) ; // Once everything is loaded, disable the colours section until a colour variant is selected. self . unit_variants_colours_widget . set_enabled ( false ) ; // If we have any errors, show them here. if ! errors . is_empty ( ) { show_message_warning ( & self . tool . message_widget , errors . join ( " \n " ) ) ; } }
This function loads the data of a faction into the detailed view.
This function loads the data of a faction into the detailed view .
&self
index
Ref<QModelIndex>
&self
index
Ref<QModelIndex>