mirror of
https://repo.dec05eba.com/gpu-screen-recorder-ui
synced 2026-03-31 09:17:04 +09:00
1.9.3 - Only use led indicator if it's enabled
This commit is contained in:
@@ -108,6 +108,7 @@ namespace gsr {
|
|||||||
void on_event(mgl::Event &event);
|
void on_event(mgl::Event &event);
|
||||||
|
|
||||||
void recreate_global_hotkeys(const char *hotkey_option);
|
void recreate_global_hotkeys(const char *hotkey_option);
|
||||||
|
void update_led_indicator_after_settings_change();
|
||||||
void create_frontpage_ui_components();
|
void create_frontpage_ui_components();
|
||||||
void xi_setup();
|
void xi_setup();
|
||||||
void handle_xi_events();
|
void handle_xi_events();
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ namespace gsr {
|
|||||||
void load();
|
void load();
|
||||||
void save();
|
void save();
|
||||||
void on_navigate_away_from_page() override;
|
void on_navigate_away_from_page() override;
|
||||||
|
|
||||||
|
std::function<void()> on_config_changed;
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<ComboBox> create_record_area_box();
|
std::unique_ptr<ComboBox> create_record_area_box();
|
||||||
std::unique_ptr<Widget> create_record_area();
|
std::unique_ptr<Widget> create_record_area();
|
||||||
|
|||||||
@@ -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)
|
update_led_indicator_after_settings_change();
|
||||||
led_indicator = std::make_unique<LedIndicator>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Overlay::~Overlay() {
|
Overlay::~Overlay() {
|
||||||
@@ -1179,6 +1178,15 @@ namespace gsr {
|
|||||||
global_hotkeys.reset();
|
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() {
|
void Overlay::create_frontpage_ui_components() {
|
||||||
bg_screenshot_overlay = mgl::Rectangle(mgl::vec2f(get_theme().window_width, get_theme().window_height));
|
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());
|
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]() {
|
record_settings_page->on_config_changed = [this]() {
|
||||||
if(recording_status == RecordingStatus::RECORD)
|
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);
|
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));
|
page_stack.push(std::move(record_settings_page));
|
||||||
} else if(id == "pause") {
|
} else if(id == "pause") {
|
||||||
@@ -1294,6 +1304,8 @@ namespace gsr {
|
|||||||
stream_settings_page->on_config_changed = [this]() {
|
stream_settings_page->on_config_changed = [this]() {
|
||||||
if(recording_status == RecordingStatus::STREAM)
|
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);
|
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));
|
page_stack.push(std::move(stream_settings_page));
|
||||||
} else if(id == "start") {
|
} else if(id == "start") {
|
||||||
@@ -1376,6 +1388,9 @@ namespace gsr {
|
|||||||
button->set_icon_padding_scale(1.2f);
|
button->set_icon_padding_scale(1.2f);
|
||||||
button->on_click = [&]() {
|
button->on_click = [&]() {
|
||||||
auto screenshot_settings_page = std::make_unique<ScreenshotSettingsPage>(&gsr_info, config, &page_stack);
|
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));
|
page_stack.push(std::move(screenshot_settings_page));
|
||||||
};
|
};
|
||||||
front_page_ptr->add_widget(std::move(button));
|
front_page_ptr->add_widget(std::move(button));
|
||||||
|
|||||||
@@ -357,6 +357,8 @@ namespace gsr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ScreenshotSettingsPage::save() {
|
void ScreenshotSettingsPage::save() {
|
||||||
|
Config prev_config = config;
|
||||||
|
|
||||||
config.screenshot_config.record_area_option = record_area_box_ptr->get_selected_id();
|
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_width = atoi(image_width_entry_ptr->get_text().c_str());
|
||||||
config.screenshot_config.image_height = atoi(image_height_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);
|
save_config(config);
|
||||||
|
|
||||||
|
if(on_config_changed && config != prev_config)
|
||||||
|
on_config_changed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user