Refactor GUI to be more modular - #31
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the GUI into modular pieces by extracting configs, messages, and view components, and replaces the old monolithic amp.rs with a new AmplifierApp.
- Reorganized module structure under
src/gui - Introduced per-stage config and message modules
- Created reusable widget and stage view components
Reviewed Changes
Copilot reviewed 23 out of 24 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/gui/mod.rs | Updated root module to export app, components, config, and messages |
| src/gui/messages.rs | Extracted all GUI message enums into a dedicated module |
| src/gui/config/*.rs | Added individual config modules (filter, preamp, etc.) each with to_stage |
| src/gui/components/widgets/common.rs | Refactored common widget imports and cleaned up labeled_slider layout |
| src/gui/components/stages/*.rs | Moved each stage’s UI into its own view function in separate files |
| src/gui/components/stage_list.rs | Added StageList component to render the list of stages |
| src/gui/components/control.rs | Added Control component for stage type selection and adding stages |
| src/gui/app.rs | Introduced AmplifierApp and build_amplifier_chain logic |
| src/gui/amp.rs | Removed the old, monolithic GUI implementation file |
Comments suppressed due to low confidence (4)
src/gui/app.rs:182
- Stage names passed to
to_stageare inconsistent with display names (no space inToneStack). Consider using "Tone Stack {idx}" to match the user-facing label.
cfg.to_stage(&format!("ToneStack {idx}"), sample_rate),
src/gui/config/preamp.rs:21
- [nitpick] The
to_stagemethod forPreampConfigomits asample_rateparameter, unlike other configs. Consider standardizing allto_stagesignatures to acceptsample_ratefor consistency.
pub fn to_stage(&self, name: &str) -> PreampStage {
src/gui/config/tonestack.rs:1
- [nitpick] Consider adding unit tests for
ToneStackConfig::to_stageto verify that it constructs aToneStackStagewith correct default and custom parameters.
use crate::sim::stages::tonestack::{ToneStackModel, ToneStackStage};
src/gui/components/stages/tonestack.rs:20
- The
model_pickerrow is missing.spacing()and.align_y()modifiers, which may break its layout. Add.spacing(10).align_y(Alignment::Center)to match other stage pickers.
let model_picker = row![
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.