Thanks to visit codestin.com
Credit goes to github.com

Skip to content

GUI based settings menu that derives off config.template.toml. #17

@THEGOLDENPRO

Description

@THEGOLDENPRO

GUI based settings menu that derives off what is specified in config.template.toml, including the TOML comments and keyboard keybinds. To implement this we'll need to be able to parse the toml config and also parse the documentation embedded in the comments, this might require a custom written solution. Then this settings panel should be merged into the cirrus toolkit to be used in other applications.

  • Macro to "stringify" a config struct's field (&config.camera.resolution) to a string version (assert(&string, "config.camera.resolution")).
  • Init settings widget once and make add_section() idempotent.
  • Parse the template config and it's comments.
  • Limit max size of settings menu or widget.
  • Find the toml docstring of the corresponding config key path.
  • Create method in Settings widget (add_section()) to allow for construction of sections in the settings panel.
  • Get type of provided config variable to mutate in add_section().
  • Infer type of input widget in Settings widget when type of provided config variable is established.
  • Allow developer to override settings section title and dropdown widget choices for certain types (check what else should be implemented to SectionDisplayInfo).
  • Implement and render the rest of the section types.
  • Show section despite config key not existing in template config.
  • Implement combo box choices for other section types.
  • Some sort of separate system that keeps the user's config.toml up to date with the config struct. Implement ConfigManager #16
  • ConfigManager::update() should request for egui redraw to keep the auto save scheduler going when the app is not updating (e.g: the user stopped interacting with the window).
  • CTRL + S force triggers the config manager to save to disk right away.
  • Leaving the settings menu will auto save.
  • Finish implementation in Aeternum
  • Finish Roseate implementation

Cirrus PR: #14

WIP screenshot from Aeternum

Image
# config.template.toml

[misc]
# Folder located at:
# Linux: ~/.config/cloudy/aeternum/models
# Mac: ~/Library/Application Support/cloudy/aeternum/models
# Windows: %AppData%\cloudy\aeternum\models
enable_custom_folder = true
Settings::new(&self.config_template_string)
    .add_section::<bool>(
        Section::new(
            config_key_path!(self.config.misc.enable_custom_folder),
            &mut self.config.misc.enable_custom_folder,
            SectionDisplayInfo::default()
        ).into()
    )
    .show(ctx, ui, &self.theme);

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions