mirror of
https://repo.dec05eba.com/gpu-screen-recorder-ui
synced 2026-05-05 06:20:44 +09:00
Only show app audio option if using pipewire
This commit is contained in:
@@ -45,6 +45,7 @@ namespace gsr {
|
||||
const mgl::vec2f parent_inner_size = parent_widget ? parent_widget->get_inner_size() : mgl::vec2f(0.0f, 0.0f);
|
||||
|
||||
const float spacing = floor(spacing_scale * get_theme().window_height);
|
||||
bool first_visible_widget = true;
|
||||
switch(orientation) {
|
||||
case Orientation::VERTICAL: {
|
||||
for(size_t i = 0; i < widgets.size(); ++i) {
|
||||
@@ -52,8 +53,9 @@ namespace gsr {
|
||||
if(!widget->visible)
|
||||
continue;
|
||||
|
||||
if(i > 0)
|
||||
if(!first_visible_widget)
|
||||
draw_pos.y += spacing;
|
||||
first_visible_widget = false;
|
||||
|
||||
const auto widget_size = widget->get_size();
|
||||
// TODO: Do this parent widget alignment for horizontal alignment and for other types of widget alignment
|
||||
@@ -79,8 +81,9 @@ namespace gsr {
|
||||
if(!widget->visible)
|
||||
continue;
|
||||
|
||||
if(i > 0)
|
||||
if(!first_visible_widget)
|
||||
draw_pos.x += spacing;
|
||||
first_visible_widget = false;
|
||||
|
||||
const auto widget_size = widget->get_size();
|
||||
if(content_alignment == Alignment::CENTER)
|
||||
@@ -145,6 +148,7 @@ namespace gsr {
|
||||
|
||||
mgl::vec2f size;
|
||||
const float spacing = floor(spacing_scale * get_theme().window_height);
|
||||
bool first_visible_widget = true;
|
||||
switch(orientation) {
|
||||
case Orientation::VERTICAL: {
|
||||
for(size_t i = 0; i < widgets.size(); ++i) {
|
||||
@@ -152,8 +156,9 @@ namespace gsr {
|
||||
if(!widget->visible)
|
||||
continue;
|
||||
|
||||
if(i > 0)
|
||||
if(!first_visible_widget)
|
||||
size.y += spacing;
|
||||
first_visible_widget = false;
|
||||
|
||||
const auto widget_size = widget->get_size();
|
||||
size.x = std::max(size.x, widget_size.x);
|
||||
@@ -167,8 +172,9 @@ namespace gsr {
|
||||
if(!widget->visible)
|
||||
continue;
|
||||
|
||||
if(i > 0)
|
||||
if(!first_visible_widget)
|
||||
size.x += spacing;
|
||||
first_visible_widget = false;
|
||||
|
||||
const auto widget_size = widget->get_size();
|
||||
size.x += widget_size.x;
|
||||
|
||||
@@ -238,7 +238,9 @@ namespace gsr {
|
||||
std::unique_ptr<Widget> SettingsPage::create_audio_device_section() {
|
||||
auto audio_devices_section_list = std::make_unique<List>(List::Orientation::VERTICAL);
|
||||
audio_devices_section_list_ptr = audio_devices_section_list.get();
|
||||
audio_devices_section_list->add_widget(std::make_unique<Label>(&get_theme().title_font, "Audio devices", get_color_theme().text_color));
|
||||
auto audio_devices_label = std::make_unique<Label>(&get_theme().title_font, "Audio devices", get_color_theme().text_color);
|
||||
audio_devices_label_ptr = audio_devices_label.get();
|
||||
audio_devices_section_list->add_widget(std::move(audio_devices_label));
|
||||
audio_devices_section_list->add_widget(create_add_audio_device_button());
|
||||
audio_devices_section_list->add_widget(create_audio_device_track_section());
|
||||
return audio_devices_section_list;
|
||||
@@ -321,7 +323,9 @@ namespace gsr {
|
||||
auto audio_section = std::make_unique<Subsection>("Audio", std::move(audio_device_section_list), mgl::vec2f(settings_scrollable_page_ptr->get_inner_size().x, 0.0f));
|
||||
|
||||
audio_device_section_list_ptr->add_widget(create_audio_type_button());
|
||||
audio_device_section_list_ptr->add_widget(std::make_unique<LineSeparator>(LineSeparator::Orientation::HORIZONTAL, audio_section->get_inner_size().x));
|
||||
auto audio_type_line_sep = std::make_unique<LineSeparator>(LineSeparator::Orientation::HORIZONTAL, audio_section->get_inner_size().x);
|
||||
audio_type_line_sep_ptr = audio_type_line_sep.get();
|
||||
audio_device_section_list_ptr->add_widget(std::move(audio_type_line_sep));
|
||||
audio_device_section_list_ptr->add_widget(create_audio_device_section());
|
||||
audio_device_section_list_ptr->add_widget(create_application_audio_section());
|
||||
//audio_device_section_list_ptr->add_widget(std::make_unique<LineSeparator>(LineSeparator::Orientation::HORIZONTAL, audio_section->get_inner_size().x));
|
||||
@@ -572,6 +576,13 @@ namespace gsr {
|
||||
}
|
||||
};
|
||||
audio_type_radio_button_ptr->on_selection_changed("", "audio_devices");
|
||||
|
||||
if(!gsr_info.system_info.supports_app_audio) {
|
||||
audio_type_radio_button_ptr->set_visible(false);
|
||||
audio_type_line_sep_ptr->set_visible(false);
|
||||
audio_devices_label_ptr->set_visible(false);
|
||||
application_audio_section_list_ptr->set_visible(false);
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsPage::add_page_specific_widgets() {
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace gsr {
|
||||
static const float margin_bottom_scale = 0.012f;
|
||||
static const float margin_left_scale = 0.015f;
|
||||
static const float margin_right_scale = 0.015f;
|
||||
static const float title_spacing_scale = 0.015f;
|
||||
static const float title_spacing_scale = 0.010f;
|
||||
|
||||
Subsection::Subsection(const char *title, std::unique_ptr<Widget> inner_widget, mgl::vec2f size) :
|
||||
label(&get_theme().title_font, title, get_color_theme().text_color),
|
||||
|
||||
Reference in New Issue
Block a user