bug fixes

This commit is contained in:
Nickiel12 2021-12-31 19:34:40 -08:00
parent 480f5b0c11
commit 1738a030c4
2 changed files with 24 additions and 37 deletions

View file

@ -13,8 +13,9 @@ impl MessageHandler for StreamState {
fn handle_update(&mut self, update: StateUpdate, hotkey_handler: &Hotkeys) fn handle_update(&mut self, update: StateUpdate, hotkey_handler: &Hotkeys)
-> (Option<StateUpdate>, Option<Vec<StateUpdate>>) { -> (Option<StateUpdate>, Option<Vec<StateUpdate>>) {
if update != StateUpdate::UpdateClient && update != StateUpdate::ChangeSlide(SlideChange::Next) && if update != StateUpdate::UpdateClient && update != StateUpdate::ChangeSlide(SlideChange::NextApp) &&
update != StateUpdate::ChangeSlide(SlideChange::Previous){ update != StateUpdate::ChangeSlide(SlideChange::PreviousApp) && update != StateUpdate::ChangeSlide(SlideChange::PreviousHotkey)
&& update != StateUpdate::ChangeSlide(SlideChange::NextHotkey) {
self.update(update.clone()); self.update(update.clone());
} }
@ -29,12 +30,18 @@ impl MessageHandler for StreamState {
self.timer_start = SystemTime::now(); self.timer_start = SystemTime::now();
} }
match direction { match direction {
SlideChange::Next => { SlideChange::NextHotkey => {
hotkey_handler.next_slide(); hotkey_handler.next_slide(true);
},
SlideChange::NextApp => {
hotkey_handler.next_slide(false);
},
SlideChange::PreviousHotkey => {
hotkey_handler.prev_slide(true);
},
SlideChange::PreviousApp => {
hotkey_handler.prev_slide(false);
}, },
SlideChange::Previous => {
hotkey_handler.prev_slide();
}
} }
if self.change_scene_on_change_slide_hotkey { if self.change_scene_on_change_slide_hotkey {
let mut instructions = Vec::new(); let mut instructions = Vec::new();
@ -75,22 +82,24 @@ impl MessageHandler for StreamState {
StateUpdate::SubScene(value) => { StateUpdate::SubScene(value) => {
if value.get_type() == Scenes::Camera { if value.get_type() == Scenes::Camera {
if self.current_scene == Scenes::Camera { if self.current_scene == Scenes::Camera {
hotkey_handler.change_scene(Scenes::Camera, Some(self.camera_sub_scene)); hotkey_handler.change_scene(Scenes::Camera, Some(value));
} }
self.camera_sub_scene = value; self.camera_sub_scene = value;
return (Some(update), None) return (Some(update), None)
} else if value.get_type() == Scenes::Screen { } else if value.get_type() == Scenes::Screen {
if self.current_scene == Scenes::Screen{ if self.current_scene == Scenes::Screen{
hotkey_handler.change_scene(Scenes::Screen, Some(self.screen_sub_scene)); hotkey_handler.change_scene(Scenes::Screen, Some(value));
} }
self.screen_sub_scene = value; self.screen_sub_scene = value;
return (Some(update), None) return (Some(update), None)
} }
}, },
StateUpdate::Scene(value) => { StateUpdate::Scene(value) => {
println!("dong: {:?}", value);
if value == Scenes::Screen { if value == Scenes::Screen {
println!("doink: {:?}", self.current_scene);
if self.current_scene != Scenes::Screen { if self.current_scene != Scenes::Screen {
println!("ping");
self.timer_start = SystemTime::now(); self.timer_start = SystemTime::now();
self.timer_finished = false; self.timer_finished = false;
} }
@ -98,7 +107,6 @@ impl MessageHandler for StreamState {
self.timer_finished = true; self.timer_finished = true;
} }
if self.current_scene != value { if self.current_scene != value {
match self.current_scene { match self.current_scene {
Scenes::Camera => { Scenes::Camera => {

View file

@ -64,11 +64,11 @@ impl StreamState {
StateUpdate::TimerCanRun(new_val) => {self.timer_can_run = new_val;}, StateUpdate::TimerCanRun(new_val) => {self.timer_can_run = new_val;},
StateUpdate::TimerLength(new_val) => {self.timer_length = new_val;}, StateUpdate::TimerLength(new_val) => {self.timer_length = new_val;},
StateUpdate::TimerText(new_val) => {self.timer_text = new_val;}, StateUpdate::TimerText(new_val) => {self.timer_text = new_val;},
StateUpdate::Scene(new_val) => {self.change_scene(&new_val)},
StateUpdate::SubScene(new_val) => {self.change_sub_scene(&new_val)},
StateUpdate::SceneIsAugmented(new_val) => { StateUpdate::SceneIsAugmented(new_val) => {
self.scene_is_augmented = new_val; self.scene_is_augmented = new_val;
self.change_scene(&Scenes::Augmented)}, self.change_scene(&Scenes::Augmented)},
StateUpdate::Scene(_) => {},
StateUpdate::SubScene(_) => {},
StateUpdate::ComputerMediaDoPause => {}, StateUpdate::ComputerMediaDoPause => {},
StateUpdate::ChangeSlide(_value) => {panic!("Stream_states_class is not supposed to get this update type");}, StateUpdate::ChangeSlide(_value) => {panic!("Stream_states_class is not supposed to get this update type");},
StateUpdate::UpdateClient => {}, StateUpdate::UpdateClient => {},
@ -82,25 +82,4 @@ impl StreamState {
Scenes::Screen => {self.current_scene = *scene}, Scenes::Screen => {self.current_scene = *scene},
} }
} }
pub fn change_sub_scene(&mut self, scene: &SubScenes) {
match scene {
SubScenes::CameraDefault | SubScenes::CameraWithUpperRight |
SubScenes::CameraWithLargeUpperRight | SubScenes::CameraWithLowerRight
=> {StreamState::set_camera_scene(self, scene)},
SubScenes::ScreenDefault | SubScenes::ScreenWithUpperRight |
SubScenes::ScreenWithLowerRight
=> {StreamState::set_screen_scene(self, scene)},
}
}
fn set_camera_scene(&mut self, scene: &SubScenes) {
self.camera_sub_scene = scene.clone();
self.current_scene = Scenes::Camera;
}
fn set_screen_scene(&mut self, scene: &SubScenes) {
self.screen_sub_scene = scene.clone();
self.current_scene = Scenes::Screen;
}
} }