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.banner_groupbox.is_enabled() {
            self.banner_groupbox.set_enabled(true);
        }
        if !self.uniform_groupbox.is_enabled() {
            self.uniform_groupbox.set_enabled(true);
        }

        let data: HashMap<String, String> = serde_json::from_str(&index.data_1a(FACTION_DATA).to_string().to_std_string()).unwrap();
        self.tool.load_field_to_detailed_view_editor_string_label(&data, self.get_ref_faction_name_label(), "screen_name");

        let image = QPixmap::new();
        image.load_from_data_q_byte_array(&index.data_1a(FACTION_ICON).to_byte_array());
        self.get_ref_faction_icon_label().set_pixmap(&image);

        // From here, everything can not exits, depending on our tables.
        let mut missing_fields = vec![];

        if data.get("banner_primary").is_some() {
            self.banner_groupbox.set_checked(true);

            if let Some(field) = self.tool.load_fields_to_detailed_view_editor_combo_color(&data, self.get_ref_banner_colour_primary(), "banner_primary") {
                missing_fields.push(field);
            }
            if let Some(field) = self.tool.load_fields_to_detailed_view_editor_combo_color(&data, self.get_ref_banner_colour_secondary(), "banner_secondary") {
                missing_fields.push(field);
            }
            if let Some(field) = self.tool.load_fields_to_detailed_view_editor_combo_color(&data, self.get_ref_banner_colour_tertiary(), "banner_tertiary") {
                missing_fields.push(field);
            }
        } else {
            self.banner_groupbox.set_checked(false);
        }

        if data.get("uniform_primary").is_some() {
            self.uniform_groupbox.set_checked(true);

            if let Some(field) = self.tool.load_fields_to_detailed_view_editor_combo_color(&data, self.get_ref_uniform_colour_primary(), "uniform_primary") {
                missing_fields.push(field);
            }
            if let Some(field) = self.tool.load_fields_to_detailed_view_editor_combo_color(&data, self.get_ref_uniform_colour_secondary(), "uniform_secondary") {
                missing_fields.push(field);
            }
            if let Some(field) = self.tool.load_fields_to_detailed_view_editor_combo_color(&data, self.get_ref_uniform_colour_tertiary(), "uniform_tertiary") {
                missing_fields.push(field);
            }
        } else {
            self.uniform_groupbox.set_checked(false);
        }

        // If any of the fields failed, report it.
        if !missing_fields.is_empty() {
            show_message_warning(&self.tool.message_widget, ErrorKind::ToolEntryDataNotFound(missing_fields.join(", ")));
        }
    }
/// 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.banner_groupbox.is_enabled() {
            self.banner_groupbox.set_enabled(true);
        }
        if !self.uniform_groupbox.is_enabled() {
            self.uniform_groupbox.set_enabled(true);
        }
        let data: HashMap<String, String> = serde_json::from_str(&index.data_1a(FACTION_DATA).to_string().to_std_string()).unwrap();
        self.tool.load_field_to_detailed_view_editor_string_label(&data, self.get_ref_faction_name_label(), "screen_name");
        let image = QPixmap::new();
        image.load_from_data_q_byte_array(&index.data_1a(FACTION_ICON).to_byte_array());
        self.get_ref_faction_icon_label().set_pixmap(&image);
        // From here, everything can not exits, depending on our tables.
        let mut missing_fields = vec![];
        if data.get("banner_primary").is_some() {
            self.banner_groupbox.set_checked(true);
            if let Some(field) = self.tool.load_fields_to_detailed_view_editor_combo_color(&data, self.get_ref_banner_colour_primary(), "banner_primary") {
                missing_fields.push(field);
            }
            if let Some(field) = self.tool.load_fields_to_detailed_view_editor_combo_color(&data, self.get_ref_banner_colour_secondary(), "banner_secondary") {
                missing_fields.push(field);
            }
            if let Some(field) = self.tool.load_fields_to_detailed_view_editor_combo_color(&data, self.get_ref_banner_colour_tertiary(), "banner_tertiary") {
                missing_fields.push(field);
            }
        } else {
            self.banner_groupbox.set_checked(false);
        }
        if data.get("uniform_primary").is_some() {
            self.uniform_groupbox.set_checked(true);
            if let Some(field) = self.tool.load_fields_to_detailed_view_editor_combo_color(&data, self.get_ref_uniform_colour_primary(), "uniform_primary") {
                missing_fields.push(field);
            }
            if let Some(field) = self.tool.load_fields_to_detailed_view_editor_combo_color(&data, self.get_ref_uniform_colour_secondary(), "uniform_secondary") {
                missing_fields.push(field);
            }
            if let Some(field) = self.tool.load_fields_to_detailed_view_editor_combo_color(&data, self.get_ref_uniform_colour_tertiary(), "uniform_tertiary") {
                missing_fields.push(field);
            }
        } else {
            self.uniform_groupbox.set_checked(false);
        }
        // If any of the fields failed, report it.
        if !missing_fields.is_empty() {
            show_message_warning(&self.tool.message_widget, ErrorKind::ToolEntryDataNotFound(missing_fields.join(", ")));
        }
    }
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 . banner_groupbox . is_enabled ( ) { self . banner_groupbox . set_enabled ( true ) ; } if ! self . uniform_groupbox . is_enabled ( ) { self . uniform_groupbox . set_enabled ( true ) ; } let data : HashMap < String , String > = serde_json :: from_str ( & index . data_1a ( FACTION_DATA ) . to_string ( ) . to_std_string ( ) ) . unwrap ( ) ; self . tool . load_field_to_detailed_view_editor_string_label ( & data , self . get_ref_faction_name_label ( ) , " " ) ; let image = QPixmap :: new ( ) ; image . load_from_data_q_byte_array ( & index . data_1a ( FACTION_ICON ) . to_byte_array ( ) ) ; self . get_ref_faction_icon_label ( ) . set_pixmap ( & image ) ; // From here, everything can not exits, depending on our tables. let mut missing_fields = vec ! [ ] ; if data . get ( " " ) . is_some ( ) { self . banner_groupbox . set_checked ( true ) ; if let Some ( field ) = self . tool . load_fields_to_detailed_view_editor_combo_color ( & data , self . get_ref_banner_colour_primary ( ) , " " ) { missing_fields . push ( field ) ; } if let Some ( field ) = self . tool . load_fields_to_detailed_view_editor_combo_color ( & data , self . get_ref_banner_colour_secondary ( ) , " " ) { missing_fields . push ( field ) ; } if let Some ( field ) = self . tool . load_fields_to_detailed_view_editor_combo_color ( & data , self . get_ref_banner_colour_tertiary ( ) , " " ) { missing_fields . push ( field ) ; } } else { self . banner_groupbox . set_checked ( false ) ; } if data . get ( " " ) . is_some ( ) { self . uniform_groupbox . set_checked ( true ) ; if let Some ( field ) = self . tool . load_fields_to_detailed_view_editor_combo_color ( & data , self . get_ref_uniform_colour_primary ( ) , " " ) { missing_fields . push ( field ) ; } if let Some ( field ) = self . tool . load_fields_to_detailed_view_editor_combo_color ( & data , self . get_ref_uniform_colour_secondary ( ) , " " ) { missing_fields . push ( field ) ; } if let Some ( field ) = self . tool . load_fields_to_detailed_view_editor_combo_color ( & data , self . get_ref_uniform_colour_tertiary ( ) , " " ) { missing_fields . push ( field ) ; } } else { self . uniform_groupbox . set_checked ( false ) ; } // If any of the fields failed, report it. if ! missing_fields . is_empty ( ) { show_message_warning ( & self . tool . message_widget , ErrorKind :: ToolEntryDataNotFound ( missing_fields . join ( " " ) ) ) ; } }
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>