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_tab_widget.is_enabled() {
            self.detailed_view_tab_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![];

        // 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>>());
        }

        //-----------------------------------------------------------------------//
        // land_units_tables
        //-----------------------------------------------------------------------//
        if let Err(error) = self.tool.load_definition_to_detailed_view_editor(&data, "land_units", &LAND_UNITS_CUSTOM_FIELDS) {
            errors.push(error.to_string());
        }

        //-----------------------------------------------------------------------//
        // main_units_tables
        //-----------------------------------------------------------------------//
        if let Err(error) = self.tool.load_definition_to_detailed_view_editor(&data, "main_units", &MAIN_UNITS_CUSTOM_FIELDS) {
            errors.push(error.to_string());
        }

        //-----------------------------------------------------------------------//
        // Loc data
        //-----------------------------------------------------------------------//
        self.tool.load_field_to_detailed_view_editor_string_short(&data, &self.loc_land_units_onscreen_name_line_edit, "loc_land_units_onscreen_name");
        self.tool.load_field_to_detailed_view_editor_string_long(&data, &self.loc_unit_description_historical_text_key_ktexteditor, "loc_unit_description_historical_texts_text");
        self.tool.load_field_to_detailed_view_editor_string_long(&data, &self.loc_unit_description_short_texts_text_ktexteditor, "loc_unit_description_short_texts_text");
        self.tool.load_field_to_detailed_view_editor_string_long(&data, &self.loc_unit_description_strengths_weaknesses_texts_text_ktexteditor, "loc_unit_description_strengths_weaknesses_texts_text");

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

        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_tab_widget.is_enabled() {
            self.detailed_view_tab_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![];
        // 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>>());
        }
        //-----------------------------------------------------------------------//
        // land_units_tables
        //-----------------------------------------------------------------------//
        if let Err(error) = self.tool.load_definition_to_detailed_view_editor(&data, "land_units", &LAND_UNITS_CUSTOM_FIELDS) {
            errors.push(error.to_string());
        }
        //-----------------------------------------------------------------------//
        // main_units_tables
        //-----------------------------------------------------------------------//
        if let Err(error) = self.tool.load_definition_to_detailed_view_editor(&data, "main_units", &MAIN_UNITS_CUSTOM_FIELDS) {
            errors.push(error.to_string());
        }
        //-----------------------------------------------------------------------//
        // Loc data
        //-----------------------------------------------------------------------//
        self.tool.load_field_to_detailed_view_editor_string_short(&data, &self.loc_land_units_onscreen_name_line_edit, "loc_land_units_onscreen_name");
        self.tool.load_field_to_detailed_view_editor_string_long(&data, &self.loc_unit_description_historical_text_key_ktexteditor, "loc_unit_description_historical_texts_text");
        self.tool.load_field_to_detailed_view_editor_string_long(&data, &self.loc_unit_description_short_texts_text_ktexteditor, "loc_unit_description_short_texts_text");
        self.tool.load_field_to_detailed_view_editor_string_long(&data, &self.loc_unit_description_strengths_weaknesses_texts_text_ktexteditor, "loc_unit_description_strengths_weaknesses_texts_text");
        // The icon needs to be pulled up from the dependencies cache on load.
        self.load_unit_icons(&data);
        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_tab_widget . is_enabled ( ) { self . detailed_view_tab_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 ! [ ] ; // 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 ( ) ) ; } //-----------------------------------------------------------------------// // land_units_tables //-----------------------------------------------------------------------// if let Err ( error ) = self . tool . load_definition_to_detailed_view_editor ( & data , " " , & LAND_UNITS_CUSTOM_FIELDS ) { errors . push ( error . to_string ( ) ) ; } //-----------------------------------------------------------------------// // main_units_tables //-----------------------------------------------------------------------// if let Err ( error ) = self . tool . load_definition_to_detailed_view_editor ( & data , " " , & MAIN_UNITS_CUSTOM_FIELDS ) { errors . push ( error . to_string ( ) ) ; } //-----------------------------------------------------------------------// // Loc data //-----------------------------------------------------------------------// self . tool . load_field_to_detailed_view_editor_string_short ( & data , & self . loc_land_units_onscreen_name_line_edit , " " ) ; self . tool . load_field_to_detailed_view_editor_string_long ( & data , & self . loc_unit_description_historical_text_key_ktexteditor , " " ) ; self . tool . load_field_to_detailed_view_editor_string_long ( & data , & self . loc_unit_description_short_texts_text_ktexteditor , " " ) ; self . tool . load_field_to_detailed_view_editor_string_long ( & data , & self . loc_unit_description_strengths_weaknesses_texts_text_ktexteditor , " " ) ; // The icon needs to be pulled up from the dependencies cache on load. self . load_unit_icons ( & data ) ; 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>