/// Configures the custom greetings feature; optional strings that will be printed via
/// serial by both Loadstone and the companion demo app. When enabled, they default to
/// a version string containing Git and Cargo information.
Configures the custom greetings feature; optional strings that will be printed via
serial by both Loadstone and the companion demo app. When enabled, they default to
a version string containing Git and Cargo information.
Configures the custom greetings feature ; optional strings that will be printed via serial by both Loadstone and the companion demo app . When enabled they default to a version string containing Git and Cargo information .
pub fn configure_custom_greetings(ui: &mut egui::Ui, greetings: &mut Greetings) {
    let mut greetings_box = matches!(greetings, Greetings::Custom { .. });
    let loadstone_with_version = || {
        format!(
            "-- Loadstone [{}-{}] --",
            env!("CARGO_PKG_VERSION"),
            git_version::git_version!()
        )
    };
    let demo_with_version = || {
        format!(
            "-- Loadstone Demo App [{}-{}] --",
            env!("CARGO_PKG_VERSION"),
            git_version::git_version!()
        )
    };
    ui.horizontal_wrapped(|ui| {
        ui.checkbox(&mut greetings_box, "Custom Greetings");
        match (greetings_box, &greetings) {
            (true, Greetings::Default) => {
                *greetings = Greetings::Custom {
                    loadstone: loadstone_with_version().into(),
                    demo: demo_with_version().into(),
                }
            }
            (false, Greetings::Custom { .. }) => *greetings = Greetings::Default,
            _ => {}
        }
        ui.label("Select custom greetings for Loadstone and the demo application.");
    });
    if let Greetings::Custom { loadstone, demo } = greetings {
        ui.horizontal_wrapped(|ui| {
            ui.text_edit_singleline(loadstone.to_mut());
            ui.label("Custom greeting when booting Loadstone.");
        });
        ui.horizontal_wrapped(|ui| {
            ui.text_edit_singleline(demo.to_mut());
            ui.label("Custom greeting when booting the demo application.");
        });
    }
}
pub fn configure_custom_greetings ( ui : & mut egui :: Ui , greetings : & mut Greetings ) { let mut greetings_box = matches ! ( greetings Greetings Custom { } ) ; let loadstone_with_version = | | { format ! ( " " env ( " " ) git_version git_version ( ) ) } ; let demo_with_version = | | { format ! ( " " env ( " " ) git_version git_version ( ) ) } ; ui . horizontal_wrapped ( | ui | { ui . checkbox ( & mut greetings_box , " " ) ; match ( greetings_box , & greetings ) { ( true , Greetings :: Default ) => { * greetings = Greetings :: Custom { loadstone : loadstone_with_version ( ) . into ( ) , demo : demo_with_version ( ) . into ( ) , } } ( false , Greetings :: Custom { .. } ) => * greetings = Greetings :: Default , _ => { } } ui . label ( " " ) ; } ) ; if let Greetings :: Custom { loadstone , demo } = greetings { ui . horizontal_wrapped ( | ui | { ui . text_edit_singleline ( loadstone . to_mut ( ) ) ; ui . label ( " " ) ; } ) ; ui . horizontal_wrapped ( | ui | { ui . text_edit_singleline ( demo . to_mut ( ) ) ; ui . label ( " " ) ; } ) ; } }
Configures the custom greetings feature; optional strings that will be printed via
serial by both Loadstone and the companion demo app.
Configures the custom greetings feature ; optional strings that will be printed via serial by both Loadstone and the companion demo app .
ui
&mut egui::Ui
greetings
&mut Greetings