Skip to content

Commit

Permalink
fix(UI): Increased period duration limits
Browse files Browse the repository at this point in the history
  • Loading branch information
mfep committed May 11, 2024
1 parent 677f3f2 commit 4f128b7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
22 changes: 13 additions & 9 deletions src/exercise_editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ pub enum ExerciseEditorOutput {
Create(ExerciseSetup),
}

pub const SPIN_ROW_LOWER: f64 = 1f64;
pub const SPIN_ROW_UPPER: f64 = 1000000f64;
pub const SPIN_ROW_STEP: f64 = 1f64;

#[relm4::component(pub)]
impl relm4::SimpleComponent for ExerciseEditor {
type Init = (ExerciseEditorRole, ExerciseSetup);
Expand Down Expand Up @@ -78,9 +82,9 @@ impl relm4::SimpleComponent for ExerciseEditor {
set_title: "Number of sets",
#[wrap(Some)]
set_adjustment = &gtk::Adjustment {
set_lower: 1f64,
set_upper: 999f64,
set_step_increment: 1f64,
set_lower: SPIN_ROW_LOWER,
set_upper: SPIN_ROW_UPPER,
set_step_increment: SPIN_ROW_STEP,
add_binding: (&model.sets, "value"),
},
},
Expand All @@ -89,9 +93,9 @@ impl relm4::SimpleComponent for ExerciseEditor {
set_subtitle: "seconds",
#[wrap(Some)]
set_adjustment = &gtk::Adjustment {
set_lower: 1f64,
set_upper: 999f64,
set_step_increment: 1f64,
set_lower: SPIN_ROW_LOWER,
set_upper: SPIN_ROW_UPPER,
set_step_increment: SPIN_ROW_STEP,
add_binding: (&model.rest_s, "value"),
},
},
Expand All @@ -100,9 +104,9 @@ impl relm4::SimpleComponent for ExerciseEditor {
set_subtitle: "seconds",
#[wrap(Some)]
set_adjustment = &gtk::Adjustment {
set_lower: 1f64,
set_upper: 999f64,
set_step_increment: 1f64,
set_lower: SPIN_ROW_LOWER,
set_upper: SPIN_ROW_UPPER,
set_step_increment: SPIN_ROW_STEP,
add_binding: (&model.exercise_s, "value"),
},
},
Expand Down
9 changes: 6 additions & 3 deletions src/settings_dialog.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use crate::settings::*;
use crate::{
exercise_editor::{SPIN_ROW_STEP, SPIN_ROW_UPPER},
settings::*,
};

use relm4::{
self,
Expand Down Expand Up @@ -35,8 +38,8 @@ impl Component for SettingsDialogModel {
#[name = "warmup_adjust"]
set_adjustment = &gtk::Adjustment {
set_lower: 0.0,
set_upper: 999.0,
set_step_increment: 1.0,
set_upper: SPIN_ROW_UPPER,
set_step_increment: SPIN_ROW_STEP,
add_binding: (&init.warmup_s, "value"),
},
},
Expand Down

0 comments on commit 4f128b7

Please sign in to comment.