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.faction_list_view.selection_model().select_q_item_selection_q_flags_selection_flag(&self.faction_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.faction_list_model.row_count_0a())
            .map(|row|
                serde_json::from_str(
                    &self.faction_list_model.data_2a(
                        &self.faction_list_model.index_2a(row, 0),
                        FACTION_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 mut files_to_save = vec![];
        match &*GAME_SELECTED.read().unwrap().get_game_key_name() {
            KEY_WARHAMMER_3 => {
                files_to_save.push(self.save_factions_data(&data_to_save)?);
            }
            _ => {
                files_to_save.push(self.save_faction_banner_data(&data_to_save)?);
                files_to_save.push(self.save_faction_uniform_data(&data_to_save)?);
            }
        };

        // 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, &files_to_save)
    }
/// 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.faction_list_view.selection_model().select_q_item_selection_q_flags_selection_flag(&self.faction_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.faction_list_model.row_count_0a())
            .map(|row|
                serde_json::from_str(
                    &self.faction_list_model.data_2a(
                        &self.faction_list_model.index_2a(row, 0),
                        FACTION_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 mut files_to_save = vec![];
        match &*GAME_SELECTED.read().unwrap().get_game_key_name() {
            KEY_WARHAMMER_3 => {
                files_to_save.push(self.save_factions_data(&data_to_save)?);
            }
            _ => {
                files_to_save.push(self.save_faction_banner_data(&data_to_save)?);
                files_to_save.push(self.save_faction_uniform_data(&data_to_save)?);
            }
        };
        // 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, &files_to_save)
    }
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 . faction_list_view . selection_model ( ) . select_q_item_selection_q_flags_selection_flag ( & self . faction_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 . faction_list_model . row_count_0a ( ) ) . map ( | row | serde_json :: from_str ( & self . faction_list_model . data_2a ( & self . faction_list_model . index_2a ( row , 0 ) , FACTION_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 mut files_to_save = vec ! [ ] ; match & * GAME_SELECTED . read ( ) . unwrap ( ) . get_game_key_name ( ) { KEY_WARHAMMER_3 => { files_to_save . push ( self . save_factions_data ( & data_to_save ) ? ) ; } _ => { files_to_save . push ( self . save_faction_banner_data ( & data_to_save ) ? ) ; files_to_save . push ( self . save_faction_uniform_data ( & data_to_save ) ? ) ; } } ; // 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 , & files_to_save ) }
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>