1.9.3 - Only use led indicator if it's enabled

This commit is contained in:
dec05eba
2026-01-08 20:39:53 +01:00
parent 7f43adfbd5
commit fed47000ce
4 changed files with 25 additions and 2 deletions

View File

@@ -108,6 +108,7 @@ namespace gsr {
void on_event(mgl::Event &event);
void recreate_global_hotkeys(const char *hotkey_option);
void update_led_indicator_after_settings_change();
void create_frontpage_ui_components();
void xi_setup();
void handle_xi_events();

View File

@@ -23,6 +23,8 @@ namespace gsr {
void load();
void save();
void on_navigate_away_from_page() override;
std::function<void()> on_config_changed;
private:
std::unique_ptr<ComboBox> create_record_area_box();
std::unique_ptr<Widget> create_record_area();

View File

@@ -525,8 +525,7 @@ namespace gsr {
}
}
// TODO: Only do this if led indicator is enabled (at startup or when changing recording/screenshot settings to enabled it)
led_indicator = std::make_unique<LedIndicator>();
update_led_indicator_after_settings_change();
}
Overlay::~Overlay() {
@@ -1179,6 +1178,15 @@ namespace gsr {
global_hotkeys.reset();
}
void Overlay::update_led_indicator_after_settings_change() {
if(config.record_config.record_options.use_led_indicator || config.replay_config.record_options.use_led_indicator || config.streaming_config.record_options.use_led_indicator || config.screenshot_config.use_led_indicator) {
if(!led_indicator)
led_indicator = std::make_unique<LedIndicator>();
} else {
led_indicator.reset();
}
}
void Overlay::create_frontpage_ui_components() {
bg_screenshot_overlay = mgl::Rectangle(mgl::vec2f(get_theme().window_width, get_theme().window_height));
top_bar_background = mgl::Rectangle(mgl::vec2f(get_theme().window_width, get_theme().window_height*0.06f).floor());
@@ -1269,6 +1277,8 @@ namespace gsr {
record_settings_page->on_config_changed = [this]() {
if(recording_status == RecordingStatus::RECORD)
show_notification("Recording settings have been modified.\nYou may need to restart recording to apply the changes.", notification_timeout_seconds, mgl::Color(255, 255, 255), get_color_theme().tint_color, NotificationType::RECORD);
update_led_indicator_after_settings_change();
};
page_stack.push(std::move(record_settings_page));
} else if(id == "pause") {
@@ -1294,6 +1304,8 @@ namespace gsr {
stream_settings_page->on_config_changed = [this]() {
if(recording_status == RecordingStatus::STREAM)
show_notification("Streaming settings have been modified.\nYou may need to restart streaming to apply the changes.", notification_timeout_seconds, mgl::Color(255, 255, 255), get_color_theme().tint_color, NotificationType::STREAM);
update_led_indicator_after_settings_change();
};
page_stack.push(std::move(stream_settings_page));
} else if(id == "start") {
@@ -1376,6 +1388,9 @@ namespace gsr {
button->set_icon_padding_scale(1.2f);
button->on_click = [&]() {
auto screenshot_settings_page = std::make_unique<ScreenshotSettingsPage>(&gsr_info, config, &page_stack);
screenshot_settings_page->on_config_changed = [this]() {
update_led_indicator_after_settings_change();
};
page_stack.push(std::move(screenshot_settings_page));
};
front_page_ptr->add_widget(std::move(button));

View File

@@ -357,6 +357,8 @@ namespace gsr {
}
void ScreenshotSettingsPage::save() {
Config prev_config = config;
config.screenshot_config.record_area_option = record_area_box_ptr->get_selected_id();
config.screenshot_config.image_width = atoi(image_width_entry_ptr->get_text().c_str());
config.screenshot_config.image_height = atoi(image_height_entry_ptr->get_text().c_str());
@@ -390,5 +392,8 @@ namespace gsr {
}
save_config(config);
if(on_config_changed && config != prev_config)
on_config_changed();
}
}