Rename shot_at to iso in code
This commit is contained in:
parent
315da52ce6
commit
d282761b87
10
src/main.rs
10
src/main.rs
@ -187,11 +187,11 @@ impl eframe::App for MyApp {
|
||||
.name
|
||||
.cmp(&self.state.films[roll_2.film].name),
|
||||
RollField::ISO => roll_1
|
||||
.shot_at
|
||||
.iso
|
||||
.unwrap_or(self.state.films[roll_1.film].iso)
|
||||
.cmp(
|
||||
&roll_2
|
||||
.shot_at
|
||||
.iso
|
||||
.unwrap_or(self.state.films[roll_2.film].iso),
|
||||
),
|
||||
};
|
||||
@ -214,12 +214,12 @@ impl eframe::App for MyApp {
|
||||
.push(add_clickable_label(ui, &roll.exposures.len().to_string()));
|
||||
widget_resps
|
||||
.push(add_clickable_label(ui, &self.state.films[roll.film].name));
|
||||
let shot_at_text = if let Some(shot_at) = roll.shot_at {
|
||||
format!("{} ISO", shot_at)
|
||||
let iso_text = if let Some(iso) = roll.iso {
|
||||
format!("{} ISO", iso)
|
||||
} else {
|
||||
format!("{} ISO (box speed)", &self.state.films[roll.film].iso)
|
||||
};
|
||||
widget_resps.push(add_clickable_label(ui, shot_at_text));
|
||||
widget_resps.push(add_clickable_label(ui, iso_text));
|
||||
|
||||
if widget_resps.iter().any(|resp| resp.clicked()) {
|
||||
self.roll_view = Some(RollView::new(i));
|
||||
|
@ -14,7 +14,7 @@ pub struct NewRollWindow {
|
||||
desc: String,
|
||||
date: NaiveDate,
|
||||
film: FilmKey,
|
||||
shot_at: Option<u32>,
|
||||
iso: Option<u32>,
|
||||
exps: u8,
|
||||
show_id_req_err: bool,
|
||||
show_pp_iso_err: bool,
|
||||
@ -33,7 +33,7 @@ impl NewRollWindow {
|
||||
desc: String::new(),
|
||||
date: Local::now().date_naive(),
|
||||
film,
|
||||
shot_at: None,
|
||||
iso: None,
|
||||
exps: 24,
|
||||
show_id_req_err: false,
|
||||
show_pp_iso_err: false,
|
||||
@ -98,19 +98,19 @@ impl NewRollWindow {
|
||||
ui.selectable_value(&mut self.film, i, film.to_string());
|
||||
}
|
||||
});
|
||||
if self.film != old_film && self.shot_at.is_some() {
|
||||
self.shot_at = Some(app_state.films[self.film].iso);
|
||||
if self.film != old_film && self.iso.is_some() {
|
||||
self.iso = Some(app_state.films[self.film].iso);
|
||||
}
|
||||
});
|
||||
ui.horizontal(|ui| {
|
||||
ui.label("Pushed/Pulled: ");
|
||||
let mut check_state = self.shot_at.is_some();
|
||||
let mut check_state = self.iso.is_some();
|
||||
ui.checkbox(&mut check_state, "");
|
||||
if check_state != self.shot_at.is_some() {
|
||||
if check_state != self.iso.is_some() {
|
||||
if check_state {
|
||||
self.shot_at = Some(app_state.films[self.film].iso);
|
||||
self.iso = Some(app_state.films[self.film].iso);
|
||||
} else {
|
||||
self.shot_at = None;
|
||||
self.iso = None;
|
||||
self.show_pp_iso_err = false;
|
||||
}
|
||||
}
|
||||
@ -122,7 +122,7 @@ impl NewRollWindow {
|
||||
);
|
||||
}
|
||||
ui.horizontal(|ui| {
|
||||
if let Some(ref mut iso) = self.shot_at {
|
||||
if let Some(ref mut iso) = self.iso {
|
||||
let label = ui.label("ISO: ");
|
||||
ui.add(DragValue::new(iso).clamp_range(1..=u32::MAX))
|
||||
.labelled_by(label.id);
|
||||
@ -131,7 +131,7 @@ impl NewRollWindow {
|
||||
if ui.button("Submit").clicked() {
|
||||
self.show_id_req_err = self.id.is_empty();
|
||||
self.show_pp_iso_err = self
|
||||
.shot_at
|
||||
.iso
|
||||
.map_or(false, |iso| iso == app_state.films[self.film].iso);
|
||||
if !self.show_id_req_err && !self.show_pp_iso_err {
|
||||
app_state.rolls.push(Roll::new(
|
||||
@ -140,7 +140,7 @@ impl NewRollWindow {
|
||||
self.desc.clone(),
|
||||
self.date,
|
||||
self.film,
|
||||
self.shot_at,
|
||||
self.iso,
|
||||
self.exps,
|
||||
));
|
||||
app_state.resort_roll_list = true;
|
||||
|
@ -52,7 +52,7 @@ pub struct Roll {
|
||||
pub desc: String,
|
||||
pub date: NaiveDate,
|
||||
pub film: FilmKey,
|
||||
pub shot_at: Option<u32>,
|
||||
pub iso: Option<u32>,
|
||||
pub exposures: Vec<Exposure>,
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ impl Roll {
|
||||
desc: String,
|
||||
date: NaiveDate,
|
||||
film: FilmKey,
|
||||
shot_at: Option<u32>,
|
||||
iso: Option<u32>,
|
||||
num_exposures: u8,
|
||||
) -> Self {
|
||||
let mut exposures = Vec::new();
|
||||
@ -79,7 +79,7 @@ impl Roll {
|
||||
desc,
|
||||
date,
|
||||
film,
|
||||
shot_at,
|
||||
iso,
|
||||
exposures,
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ pub struct RollView {
|
||||
exp: u8,
|
||||
editing: bool,
|
||||
edit_roll: Roll,
|
||||
edit_shot_at: Option<u32>,
|
||||
edit_iso: Option<u32>,
|
||||
show_id_req_err: bool,
|
||||
show_pp_iso_err: bool,
|
||||
}
|
||||
@ -28,7 +28,7 @@ impl RollView {
|
||||
exp: 0,
|
||||
editing: false,
|
||||
edit_roll: Roll::default(),
|
||||
edit_shot_at: None,
|
||||
edit_iso: None,
|
||||
show_id_req_err: false,
|
||||
show_pp_iso_err: false,
|
||||
}
|
||||
@ -119,13 +119,13 @@ impl RollView {
|
||||
if self.editing {
|
||||
ui.horizontal(|ui| {
|
||||
ui.label("Pushed/Pulled: ");
|
||||
let mut check_state = self.edit_roll.shot_at.is_some();
|
||||
let mut check_state = self.edit_roll.iso.is_some();
|
||||
ui.checkbox(&mut check_state, "");
|
||||
if check_state != self.edit_roll.shot_at.is_some() {
|
||||
if check_state != self.edit_roll.iso.is_some() {
|
||||
if check_state {
|
||||
self.edit_roll.shot_at = Some(app_state.films[self.edit_roll.film].iso);
|
||||
self.edit_roll.iso = Some(app_state.films[self.edit_roll.film].iso);
|
||||
} else {
|
||||
self.edit_roll.shot_at = None;
|
||||
self.edit_roll.iso = None;
|
||||
self.show_pp_iso_err = false;
|
||||
}
|
||||
}
|
||||
@ -136,7 +136,7 @@ impl RollView {
|
||||
"Error: Push/pull ISO must be different from the roll's box ISO",
|
||||
);
|
||||
}
|
||||
if let Some(ref mut iso) = self.edit_roll.shot_at {
|
||||
if let Some(ref mut iso) = self.edit_roll.iso {
|
||||
ui.horizontal(|ui| {
|
||||
let label = ui.label("ISO: ");
|
||||
ui.add(DragValue::new(iso).clamp_range(1..=u32::MAX))
|
||||
@ -145,7 +145,7 @@ impl RollView {
|
||||
}
|
||||
} else {
|
||||
ui.horizontal(|ui| {
|
||||
if let Some(iso) = roll.shot_at {
|
||||
if let Some(iso) = roll.iso {
|
||||
if iso > app_state.films[roll.film].iso {
|
||||
ui.label(format!(
|
||||
"Pushed {:.2} stops (ISO {})",
|
||||
@ -174,7 +174,7 @@ impl RollView {
|
||||
if ui.button("Done").clicked() {
|
||||
self.show_id_req_err = self.edit_roll.id.is_empty();
|
||||
self.show_pp_iso_err = self
|
||||
.edit_shot_at
|
||||
.edit_iso
|
||||
.map_or(false, |iso| iso == app_state.films[self.edit_roll.film].iso);
|
||||
if !self.show_id_req_err && !self.show_pp_iso_err {
|
||||
let roll_exps = mem::take(&mut roll.exposures);
|
||||
|
Loading…
Reference in New Issue
Block a user