unsafe fn load_data(&self) -> Result<()> {

        // Note: this data is HashMap<DataSource, HashMap<Path, PackedFile>>.
        let receiver = CENTRAL_COMMAND.send_background(Command::GetPackedFilesFromAllSources(self.tool.used_paths.to_vec()));
        let response = CentralCommand::recv(&receiver);
        let mut data = if let Response::HashMapDataSourceHashMapVecStringPackedFile(data) = response { data } else { panic!("{}{:?}", THREADS_COMMUNICATION_ERROR, response); };

        let mut processed_data = HashMap::new();

        // Get the table's data.
        // NOTE: Order matters here.
        get_data_from_all_sources!(self, get_main_units_data, data, processed_data);
        get_data_from_all_sources!(self, get_land_units_data, data, processed_data);
        get_data_from_all_sources!(self, get_unit_description_historical_text_data, data, processed_data);
        get_data_from_all_sources!(self, get_unit_description_short_texts_data, data, processed_data);
        get_data_from_all_sources!(self, get_unit_description_strengths_weaknesses_texts_data, data, processed_data);
        get_data_from_all_sources!(self, get_unit_variants_data, data, processed_data);
        get_data_from_all_sources!(self, get_unit_variants_colours_data, data, processed_data);
        get_data_from_all_sources!(self, get_variants_data, data, processed_data);
        get_data_from_all_sources!(self, get_loc_data, data, processed_data);

        // Once we got everything processed, build the items for the ListView.
        for (key, data) in processed_data.iter().sorted_by_key(|x| x.0) {
            let item = QStandardItem::from_q_string(&QString::from_std_str(&key)).into_ptr();
            item.set_data_2a(&QVariant::from_q_string(&QString::from_std_str(&serde_json::to_string(data).unwrap())), UNIT_DATA);
            self.unit_list_model.append_row_q_standard_item(item);
        }

        // Store the PackedFiles for use when saving.
        *self.tool.packed_files.borrow_mut() = data;
        Ok(())
    }
/// This function loads the data we need for the faction painter to the view, inside items in the ListView.
This function loads the data we need for the faction painter to the view, inside items in the ListView.
This function loads the data we need for the faction painter to the view inside items in the ListView .
unsafe fn load_data(&self) -> Result<()> {
        // Note: this data is HashMap<DataSource, HashMap<Path, PackedFile>>.
        let receiver = CENTRAL_COMMAND.send_background(Command::GetPackedFilesFromAllSources(self.tool.used_paths.to_vec()));
        let response = CentralCommand::recv(&receiver);
        let mut data = if let Response::HashMapDataSourceHashMapVecStringPackedFile(data) = response { data } else { panic!("{}{:?}", THREADS_COMMUNICATION_ERROR, response); };
        let mut processed_data = HashMap::new();
        // Get the table's data.
        // NOTE: Order matters here.
        get_data_from_all_sources!(self, get_main_units_data, data, processed_data);
        get_data_from_all_sources!(self, get_land_units_data, data, processed_data);
        get_data_from_all_sources!(self, get_unit_description_historical_text_data, data, processed_data);
        get_data_from_all_sources!(self, get_unit_description_short_texts_data, data, processed_data);
        get_data_from_all_sources!(self, get_unit_description_strengths_weaknesses_texts_data, data, processed_data);
        get_data_from_all_sources!(self, get_unit_variants_data, data, processed_data);
        get_data_from_all_sources!(self, get_unit_variants_colours_data, data, processed_data);
        get_data_from_all_sources!(self, get_variants_data, data, processed_data);
        get_data_from_all_sources!(self, get_loc_data, data, processed_data);
        // Once we got everything processed, build the items for the ListView.
        for (key, data) in processed_data.iter().sorted_by_key(|x| x.0) {
            let item = QStandardItem::from_q_string(&QString::from_std_str(&key)).into_ptr();
            item.set_data_2a(&QVariant::from_q_string(&QString::from_std_str(&serde_json::to_string(data).unwrap())), UNIT_DATA);
            self.unit_list_model.append_row_q_standard_item(item);
        }
        // Store the PackedFiles for use when saving.
        *self.tool.packed_files.borrow_mut() = data;
        Ok(())
    }
unsafe fn load_data ( & self ) -> Result < ( ) > { // Note: this data is HashMap<DataSource, HashMap<Path, PackedFile>>. let receiver = CENTRAL_COMMAND . send_background ( Command :: GetPackedFilesFromAllSources ( self . tool . used_paths . to_vec ( ) ) ) ; let response = CentralCommand :: recv ( & receiver ) ; let mut data = if let Response :: HashMapDataSourceHashMapVecStringPackedFile ( data ) = response { data } else { panic ! ( " " THREADS_COMMUNICATION_ERROR response ) ; } ; let mut processed_data = HashMap :: new ( ) ; // Get the table's data. // NOTE: Order matters here. get_data_from_all_sources ! ( self get_main_units_data data processed_data ) ; get_data_from_all_sources ! ( self get_land_units_data data processed_data ) ; get_data_from_all_sources ! ( self get_unit_description_historical_text_data data processed_data ) ; get_data_from_all_sources ! ( self get_unit_description_short_texts_data data processed_data ) ; get_data_from_all_sources ! ( self get_unit_description_strengths_weaknesses_texts_data data processed_data ) ; get_data_from_all_sources ! ( self get_unit_variants_data data processed_data ) ; get_data_from_all_sources ! ( self get_unit_variants_colours_data data processed_data ) ; get_data_from_all_sources ! ( self get_variants_data data processed_data ) ; get_data_from_all_sources ! ( self get_loc_data data processed_data ) ; // Once we got everything processed, build the items for the ListView. for ( key , data ) in processed_data . iter ( ) . sorted_by_key ( | x | x . 0 ) { let item = QStandardItem :: from_q_string ( & QString :: from_std_str ( & key ) ) . into_ptr ( ) ; item . set_data_2a ( & QVariant :: from_q_string ( & QString :: from_std_str ( & serde_json :: to_string ( data ) . unwrap ( ) ) ) , UNIT_DATA ) ; self . unit_list_model . append_row_q_standard_item ( item ) ; } // Store the PackedFiles for use when saving. * self . tool . packed_files . borrow_mut ( ) = data ; Ok ( ( ) ) }
This function loads the data we need for the faction painter to the view, inside items in the ListView.
This function loads the data we need for the faction painter to the view inside items in the ListView .
&self
&self