/* * Copyright (c) 2018-2020, Andreas Kling * Copyright (c) 2019-2020, William McPherson * Copyright (c) 2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ #include "TrackControlsWidget.h" #include "ProcessorParameterWidget/ParameterWidget.h" #include #include #include #include TrackControlsWidget::TrackControlsWidget(WeakPtr track) : m_track(move(track)) { } ErrorOr> TrackControlsWidget::try_create(WeakPtr track) { auto widget = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) TrackControlsWidget(move(track)))); TRY(widget->try_set_layout()); widget->set_preferred_width(GUI::SpecialDimension::Grow); widget->set_fill_with_background_color(true); auto mastering_parameters = TRY(widget->try_add()); TRY(mastering_parameters->try_set_layout()); auto strong_track = widget->m_track.value(); for (auto& parameter : strong_track->track_mastering()->parameters()) (void)TRY(mastering_parameters->try_add(parameter)); TRY(widget->m_processor_groups.try_append(mastering_parameters)); TRY(widget->add_spacer()); for (auto& processor : strong_track->processor_chain()) { auto processor_parameters = TRY(widget->try_add()); TRY(processor_parameters->try_set_layout()); for (auto& parameter : processor->parameters()) (void)TRY(processor_parameters->try_add(parameter)); TRY(widget->m_processor_groups.try_append(processor_parameters)); } return widget; }