pub unsafe fn save_data(
        &self,
        app_ui: &Rc<AppUI>,
        pack_file_contents_ui: &Rc<PackFileContentsUI>,
        global_search_ui: &Rc<GlobalSearchUI>,
        diagnostics_ui: &Rc<DiagnosticsUI>,
        dependencies_ui: &Rc<DependenciesUI>
    ) -> Result<()> {

        // First, save whatever is currently open in the detailed view.
        self.unit_list_view.selection_model().select_q_item_selection_q_flags_selection_flag(&self.unit_list_view.selection_model().selection(), SelectionFlag::Toggle.into());

        // Get each faction's data as a HashMap of data/value.
        let data_to_save = (0..self.unit_list_model.row_count_0a())
            .map(|row| serde_json::from_str(
                &self.unit_list_model.data_2a(
                    &self.unit_list_model.index_2a(row, 0),
                    UNIT_DATA
                ).to_string()
            .to_std_string()).unwrap())
            .collect::<Vec<HashMap<String, String>>>();

        // We have to save the data to the last entry of the keys in out list, so if any of the other fields is edited on it, that edition is kept.
        let land_units_packed_file = self.save_land_units_tables_data(&data_to_save)?;
        let main_units_packed_file = self.save_main_units_tables_data(&data_to_save)?;
        let unit_description_historical_texts_packed_file = self.save_unit_description_historical_texts_tables_data(&data_to_save)?;
        let unit_description_short_texts_packed_file = self.save_unit_description_short_texts_tables_data(&data_to_save)?;
        let unit_description_strengths_weaknesses_texts_packed_file = self.save_unit_description_strengths_weaknesses_texts_tables_data(&data_to_save)?;
        let unit_variants_colours_packed_file = self.save_unit_variants_colours_tables_data(&data_to_save)?;
        let unit_variants_packed_file = self.save_unit_variants_tables_data(&data_to_save)?;
        let variants_packed_file = self.save_variants_tables_data(&data_to_save)?;

        let loc_packed_file = self.save_loc_data(&data_to_save)?;

        let mut variant_meshes_packed_files = self.save_variant_meshes_data(&data_to_save)?;

        // Join all PackedFiles together to pass them to the save function.
        let mut packed_files = vec![
            land_units_packed_file,
            main_units_packed_file,
            unit_description_historical_texts_packed_file,
            unit_description_short_texts_packed_file,
            unit_description_strengths_weaknesses_texts_packed_file,
            unit_variants_colours_packed_file,
            unit_variants_packed_file,
            variants_packed_file,

            loc_packed_file
        ];

        // Also add the edited variant_meshes.
        packed_files.append(&mut variant_meshes_packed_files);

        // Once we got the PackedFiles to save properly edited, call the generic tool `save` function to save them to a PackFile.
        self.tool.save(app_ui, pack_file_contents_ui, global_search_ui, diagnostics_ui, dependencies_ui, &packed_files)
    }
/// This function takes care of saving the data of this Tool into the currently open PackFile, creating a new one if there wasn't one open.
This function takes care of saving the data of this Tool into the currently open PackFile, creating a new one if there wasn't one open.
This function takes care of saving the data of this Tool into the currently open PackFile creating a new one if there wasn ' t one open .
pub unsafe fn save_data(
        &self,
        app_ui: &Rc<AppUI>,
        pack_file_contents_ui: &Rc<PackFileContentsUI>,
        global_search_ui: &Rc<GlobalSearchUI>,
        diagnostics_ui: &Rc<DiagnosticsUI>,
        dependencies_ui: &Rc<DependenciesUI>
    ) -> Result<()> {
        // First, save whatever is currently open in the detailed view.
        self.unit_list_view.selection_model().select_q_item_selection_q_flags_selection_flag(&self.unit_list_view.selection_model().selection(), SelectionFlag::Toggle.into());
        // Get each faction's data as a HashMap of data/value.
        let data_to_save = (0..self.unit_list_model.row_count_0a())
            .map(|row| serde_json::from_str(
                &self.unit_list_model.data_2a(
                    &self.unit_list_model.index_2a(row, 0),
                    UNIT_DATA
                ).to_string()
            .to_std_string()).unwrap())
            .collect::<Vec<HashMap<String, String>>>();
        // We have to save the data to the last entry of the keys in out list, so if any of the other fields is edited on it, that edition is kept.
        let land_units_packed_file = self.save_land_units_tables_data(&data_to_save)?;
        let main_units_packed_file = self.save_main_units_tables_data(&data_to_save)?;
        let unit_description_historical_texts_packed_file = self.save_unit_description_historical_texts_tables_data(&data_to_save)?;
        let unit_description_short_texts_packed_file = self.save_unit_description_short_texts_tables_data(&data_to_save)?;
        let unit_description_strengths_weaknesses_texts_packed_file = self.save_unit_description_strengths_weaknesses_texts_tables_data(&data_to_save)?;
        let unit_variants_colours_packed_file = self.save_unit_variants_colours_tables_data(&data_to_save)?;
        let unit_variants_packed_file = self.save_unit_variants_tables_data(&data_to_save)?;
        let variants_packed_file = self.save_variants_tables_data(&data_to_save)?;
        let loc_packed_file = self.save_loc_data(&data_to_save)?;
        let mut variant_meshes_packed_files = self.save_variant_meshes_data(&data_to_save)?;
        // Join all PackedFiles together to pass them to the save function.
        let mut packed_files = vec![
            land_units_packed_file,
            main_units_packed_file,
            unit_description_historical_texts_packed_file,
            unit_description_short_texts_packed_file,
            unit_description_strengths_weaknesses_texts_packed_file,
            unit_variants_colours_packed_file,
            unit_variants_packed_file,
            variants_packed_file,
            loc_packed_file
        ];
        // Also add the edited variant_meshes.
        packed_files.append(&mut variant_meshes_packed_files);
        // Once we got the PackedFiles to save properly edited, call the generic tool `save` function to save them to a PackFile.
        self.tool.save(app_ui, pack_file_contents_ui, global_search_ui, diagnostics_ui, dependencies_ui, &packed_files)
    }
pub unsafe fn save_data ( & self , app_ui : & Rc < AppUI > , pack_file_contents_ui : & Rc < PackFileContentsUI > , global_search_ui : & Rc < GlobalSearchUI > , diagnostics_ui : & Rc < DiagnosticsUI > , dependencies_ui : & Rc < DependenciesUI > ) -> Result < ( ) > { // First, save whatever is currently open in the detailed view. self . unit_list_view . selection_model ( ) . select_q_item_selection_q_flags_selection_flag ( & self . unit_list_view . selection_model ( ) . selection ( ) , SelectionFlag :: Toggle . into ( ) ) ; // Get each faction's data as a HashMap of data/value. let data_to_save = ( 0 .. self . unit_list_model . row_count_0a ( ) ) . map ( | row | serde_json :: from_str ( & self . unit_list_model . data_2a ( & self . unit_list_model . index_2a ( row , 0 ) , UNIT_DATA ) . to_string ( ) . to_std_string ( ) ) . unwrap ( ) ) . collect :: < Vec < HashMap < String , String > > > ( ) ; // We have to save the data to the last entry of the keys in out list, so if any of the other fields is edited on it, that edition is kept. let land_units_packed_file = self . save_land_units_tables_data ( & data_to_save ) ? ; let main_units_packed_file = self . save_main_units_tables_data ( & data_to_save ) ? ; let unit_description_historical_texts_packed_file = self . save_unit_description_historical_texts_tables_data ( & data_to_save ) ? ; let unit_description_short_texts_packed_file = self . save_unit_description_short_texts_tables_data ( & data_to_save ) ? ; let unit_description_strengths_weaknesses_texts_packed_file = self . save_unit_description_strengths_weaknesses_texts_tables_data ( & data_to_save ) ? ; let unit_variants_colours_packed_file = self . save_unit_variants_colours_tables_data ( & data_to_save ) ? ; let unit_variants_packed_file = self . save_unit_variants_tables_data ( & data_to_save ) ? ; let variants_packed_file = self . save_variants_tables_data ( & data_to_save ) ? ; let loc_packed_file = self . save_loc_data ( & data_to_save ) ? ; let mut variant_meshes_packed_files = self . save_variant_meshes_data ( & data_to_save ) ? ; // Join all PackedFiles together to pass them to the save function. let mut packed_files = vec ! [ land_units_packed_file main_units_packed_file unit_description_historical_texts_packed_file unit_description_short_texts_packed_file unit_description_strengths_weaknesses_texts_packed_file unit_variants_colours_packed_file unit_variants_packed_file variants_packed_file loc_packed_file ] ; // Also add the edited variant_meshes. packed_files . append ( & mut variant_meshes_packed_files ) ; // Once we got the PackedFiles to save properly edited, call the generic tool `save` function to save them to a PackFile. self . tool . save ( app_ui , pack_file_contents_ui , global_search_ui , diagnostics_ui , dependencies_ui , & packed_files ) }
This function takes care of saving the data of this Tool into the currently open PackFile, creating a new one if there wasn't one open.
This function takes care of saving the data of this Tool into the currently open PackFile creating a new one if there wasn ' t one open .
&self
app_ui
&Rc<AppUI>
pack_file_contents_ui
&Rc<PackFileContentsUI>
global_search_ui
&Rc<GlobalSearchUI>
diagnostics_ui
&Rc<DiagnosticsUI>
dependencies_ui
&Rc<DependenciesUI>
&self
app_ui
&Rc<AppUI>
pack_file_contents_ui
&Rc<PackFileContentsUI>
global_search_ui
&Rc<GlobalSearchUI>
diagnostics_ui
&Rc<DiagnosticsUI>
dependencies_ui
&Rc<DependenciesUI>