pub unsafe fn save_from_detailed_view(&self, index: Ref<QModelIndex>) {
        let mut data: HashMap<String, String> = serde_json::from_str(&index.data_1a(UNIT_DATA).to_string().to_std_string()).unwrap();
        let mut errors = vec![];

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

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

        //-----------------------------------------------------------------------//
        // Loc data
        //-----------------------------------------------------------------------//
        data.insert("loc_land_units_onscreen_name".to_owned(), self.loc_land_units_onscreen_name_line_edit.text().to_std_string());
        data.insert("loc_unit_description_historical_texts_text".to_owned(), self.loc_unit_description_historical_text_key_ktexteditor.to_plain_text().to_std_string());
        data.insert("loc_unit_description_short_texts_text".to_owned(), self.loc_unit_description_short_texts_text_ktexteditor.to_plain_text().to_std_string());
        data.insert("loc_unit_description_strengths_weaknesses_texts_text".to_owned(), self.loc_unit_description_strengths_weaknesses_texts_text_ktexteditor.to_plain_text().to_std_string());

        // Update all the referenced keys in our data.
        self.update_keys(&mut data);

        if !errors.is_empty() {
            show_message_warning(&self.tool.message_widget, errors.join("\n"));
        }

        if cfg!(debug_assertions) {
            log::info!("{:#?}", data.iter().sorted_by_key(|x| x.0).collect::<std::collections::BTreeMap<&String, &String>>());
        }
        self.unit_list_model.item_from_index(index).set_data_2a(&QVariant::from_q_string(&QString::from_std_str(&serde_json::to_string(&data).unwrap())), UNIT_DATA);
    }
/// This function saves the data of the detailed view to its item in the faction list.
This function saves the data of the detailed view to its item in the faction list.
This function saves the data of the detailed view to its item in the faction list .
pub unsafe fn save_from_detailed_view(&self, index: Ref<QModelIndex>) {
        let mut data: HashMap<String, String> = serde_json::from_str(&index.data_1a(UNIT_DATA).to_string().to_std_string()).unwrap();
        let mut errors = vec![];
        //-----------------------------------------------------------------------//
        // land_units_tables
        //-----------------------------------------------------------------------//
        if let Err(error) = self.tool.save_definition_from_detailed_view_editor(&mut data, "land_units", &LAND_UNITS_CUSTOM_FIELDS) {
            errors.push(error.to_string());
        }
        //-----------------------------------------------------------------------//
        // main_units_tables
        //-----------------------------------------------------------------------//
        if let Err(error) = self.tool.save_definition_from_detailed_view_editor(&mut data, "main_units", &MAIN_UNITS_CUSTOM_FIELDS) {
            errors.push(error.to_string());
        }
        //-----------------------------------------------------------------------//
        // Loc data
        //-----------------------------------------------------------------------//
        data.insert("loc_land_units_onscreen_name".to_owned(), self.loc_land_units_onscreen_name_line_edit.text().to_std_string());
        data.insert("loc_unit_description_historical_texts_text".to_owned(), self.loc_unit_description_historical_text_key_ktexteditor.to_plain_text().to_std_string());
        data.insert("loc_unit_description_short_texts_text".to_owned(), self.loc_unit_description_short_texts_text_ktexteditor.to_plain_text().to_std_string());
        data.insert("loc_unit_description_strengths_weaknesses_texts_text".to_owned(), self.loc_unit_description_strengths_weaknesses_texts_text_ktexteditor.to_plain_text().to_std_string());
        // Update all the referenced keys in our data.
        self.update_keys(&mut data);
        if !errors.is_empty() {
            show_message_warning(&self.tool.message_widget, errors.join("\n"));
        }
        if cfg!(debug_assertions) {
            log::info!("{:#?}", data.iter().sorted_by_key(|x| x.0).collect::<std::collections::BTreeMap<&String, &String>>());
        }
        self.unit_list_model.item_from_index(index).set_data_2a(&QVariant::from_q_string(&QString::from_std_str(&serde_json::to_string(&data).unwrap())), UNIT_DATA);
    }
pub unsafe fn save_from_detailed_view ( & self , index : Ref < QModelIndex > ) { let mut data : HashMap < String , String > = serde_json :: from_str ( & index . data_1a ( UNIT_DATA ) . to_string ( ) . to_std_string ( ) ) . unwrap ( ) ; let mut errors = vec ! [ ] ; //-----------------------------------------------------------------------// // land_units_tables //-----------------------------------------------------------------------// if let Err ( error ) = self . tool . save_definition_from_detailed_view_editor ( & mut data , " " , & LAND_UNITS_CUSTOM_FIELDS ) { errors . push ( error . to_string ( ) ) ; } //-----------------------------------------------------------------------// // main_units_tables //-----------------------------------------------------------------------// if let Err ( error ) = self . tool . save_definition_from_detailed_view_editor ( & mut data , " " , & MAIN_UNITS_CUSTOM_FIELDS ) { errors . push ( error . to_string ( ) ) ; } //-----------------------------------------------------------------------// // Loc data //-----------------------------------------------------------------------// data . insert ( " " . to_owned ( ) , self . loc_land_units_onscreen_name_line_edit . text ( ) . to_std_string ( ) ) ; data . insert ( " " . to_owned ( ) , self . loc_unit_description_historical_text_key_ktexteditor . to_plain_text ( ) . to_std_string ( ) ) ; data . insert ( " " . to_owned ( ) , self . loc_unit_description_short_texts_text_ktexteditor . to_plain_text ( ) . to_std_string ( ) ) ; data . insert ( " " . to_owned ( ) , self . loc_unit_description_strengths_weaknesses_texts_text_ktexteditor . to_plain_text ( ) . to_std_string ( ) ) ; // Update all the referenced keys in our data. self . update_keys ( & mut data ) ; if ! errors . is_empty ( ) { show_message_warning ( & self . tool . message_widget , errors . join ( " \n " ) ) ; } if cfg ! ( debug_assertions ) { log :: info ! ( " " data iter ( ) sorted_by_key ( x x 0 ) collect std collections BTreeMap String String ( ) ) ; } self . unit_list_model . item_from_index ( index ) . set_data_2a ( & QVariant :: from_q_string ( & QString :: from_std_str ( & serde_json :: to_string ( & data ) . unwrap ( ) ) ) , UNIT_DATA ) ; }
This function saves the data of the detailed view to its item in the faction list.
This function saves the data of the detailed view to its item in the faction list .
&self
index
Ref<QModelIndex>
&self
index
Ref<QModelIndex>