renamed change_scene_on_hotkey

This commit is contained in:
Nickiel12 2022-06-19 20:21:10 -07:00
parent 230614b626
commit dd9ceb6bc3
4 changed files with 10 additions and 9 deletions

View file

@ -93,7 +93,7 @@ fn update_all(state: &StreamState, socket: &Socket) {
socket.send(StateUpdate::StreamRunning(state.stream_running).to_json().to_string()); socket.send(StateUpdate::StreamRunning(state.stream_running).to_json().to_string());
socket.send(StateUpdate::StreamSoundToggleOn(state.stream_is_muted).to_json().to_string()); socket.send(StateUpdate::StreamSoundToggleOn(state.stream_is_muted).to_json().to_string());
socket.send(StateUpdate::ToggleComputerSoundOn(state.computer_sound_is_on).to_json().to_string()); socket.send(StateUpdate::ToggleComputerSoundOn(state.computer_sound_is_on).to_json().to_string());
socket.send(StateUpdate::ChangeSceneOnChangeSlide(state.change_scene_on_change_slide_hotkey).to_json().to_string()); socket.send(StateUpdate::ChangeSceneOnChangeSlide(state.change_scene_on_slide_hotkey).to_json().to_string());
socket.send(StateUpdate::SceneIsAugmented(state.scene_is_augmented).to_json().to_string()); socket.send(StateUpdate::SceneIsAugmented(state.scene_is_augmented).to_json().to_string());
socket.send(StateUpdate::TimerCanRun(state.timer_can_run).to_json().to_string()); socket.send(StateUpdate::TimerCanRun(state.timer_can_run).to_json().to_string());
socket.send(StateUpdate::TimerLength(state.timer_length).to_json().to_string()); socket.send(StateUpdate::TimerLength(state.timer_length).to_json().to_string());

View file

@ -40,7 +40,8 @@ impl MessageHandler for StreamState {
hotkey_handler.prev_slide(false); hotkey_handler.prev_slide(false);
}, },
} }
if self.change_scene_on_change_slide_hotkey {
if self.change_scene_on_slide_hotkey {
if self.timer_can_run { if self.timer_can_run {
self.timer_finished = false; self.timer_finished = false;
self.timer_start = SystemTime::now(); self.timer_start = SystemTime::now();
@ -51,7 +52,7 @@ impl MessageHandler for StreamState {
return (None, Some(instructions)) return (None, Some(instructions))
} else {return (None, None)} } else {return (None, None)}
} }
StateUpdate::ChangeSceneOnChangeSlide(value) => {self.change_scene_on_change_slide_hotkey = value; return (Some(update), None)}, StateUpdate::ChangeSceneOnChangeSlide(value) => {self.change_scene_on_slide_hotkey = value; return (Some(update), None)},
StateUpdate::SceneIsAugmented(value) => { StateUpdate::SceneIsAugmented(value) => {
if value { if value {
let mut instructions = Vec::new(); let mut instructions = Vec::new();

View file

@ -9,7 +9,7 @@ pub struct StreamState {
pub stream_is_muted: bool, pub stream_is_muted: bool,
pub computer_sound_is_on: bool, pub computer_sound_is_on: bool,
pub change_scene_on_change_slide_hotkey: bool, pub change_scene_on_slide_hotkey: bool,
pub scene_is_augmented: bool, pub scene_is_augmented: bool,
pub timer_can_run: bool, pub timer_can_run: bool,
@ -32,7 +32,7 @@ impl Default for StreamState {
stream_is_muted: false, stream_is_muted: false,
computer_sound_is_on: true, computer_sound_is_on: true,
change_scene_on_change_slide_hotkey: true, change_scene_on_slide_hotkey: true,
scene_is_augmented: false, scene_is_augmented: false,
timer_can_run: true, timer_can_run: true,
@ -60,7 +60,7 @@ impl StreamState {
StateUpdate::StreamRunning(new_val) => {self.stream_running = new_val;}, StateUpdate::StreamRunning(new_val) => {self.stream_running = new_val;},
StateUpdate::StreamSoundToggleOn(new_val) => {self.stream_is_muted = new_val;}, StateUpdate::StreamSoundToggleOn(new_val) => {self.stream_is_muted = new_val;},
StateUpdate::ToggleComputerSoundOn(new_val) => {self.computer_sound_is_on = new_val;}, StateUpdate::ToggleComputerSoundOn(new_val) => {self.computer_sound_is_on = new_val;},
StateUpdate::ChangeSceneOnChangeSlide(new_val) => {self.change_scene_on_change_slide_hotkey = new_val;}, StateUpdate::ChangeSceneOnChangeSlide(new_val) => {self.change_scene_on_slide_hotkey = new_val;},
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;},

View file

@ -31,7 +31,7 @@ fn create_stream_states_class() {
assert_eq!(stream_state.stream_running, false); assert_eq!(stream_state.stream_running, false);
assert_eq!(stream_state.stream_is_muted, false); assert_eq!(stream_state.stream_is_muted, false);
assert_eq!(stream_state.computer_sound_is_on, true); assert_eq!(stream_state.computer_sound_is_on, true);
assert_eq!(stream_state.change_scene_on_change_slide_hotkey, true); assert_eq!(stream_state.change_scene_on_slide_hotkey, true);
assert_eq!(stream_state.scene_is_augmented, false); assert_eq!(stream_state.scene_is_augmented, false);
assert_eq!(stream_state.timer_text, "0.0"); assert_eq!(stream_state.timer_text, "0.0");
@ -119,9 +119,9 @@ fn test_updating() {
stream_state.update(StateUpdate::ToggleComputerSoundOn(false)); stream_state.update(StateUpdate::ToggleComputerSoundOn(false));
assert_eq!(stream_state.computer_sound_is_on, false); assert_eq!(stream_state.computer_sound_is_on, false);
assert_eq!(stream_state.change_scene_on_change_slide_hotkey, true); assert_eq!(stream_state.change_scene_on_slide_hotkey, true);
stream_state.update(StateUpdate::ChangeSceneOnChangeSlide(false)); stream_state.update(StateUpdate::ChangeSceneOnChangeSlide(false));
assert_eq!(stream_state.change_scene_on_change_slide_hotkey, false); assert_eq!(stream_state.change_scene_on_slide_hotkey, false);
assert_eq!(stream_state.scene_is_augmented, false); assert_eq!(stream_state.scene_is_augmented, false);
stream_state.update(StateUpdate::SceneIsAugmented(true)); stream_state.update(StateUpdate::SceneIsAugmented(true));