// Copyright 2023 System76 // SPDX-License-Identifier: GPL-3.0-only use cosmic::{iced, widget::settings}; use cosmic_settings_page::{self as page, section, Section}; use slotmap::SlotMap; #[derive(Default)] pub struct Page; impl page::Page for Page { fn content( &self, sections: &mut SlotMap>, ) -> Option { Some(vec![ sections.insert(output()), sections.insert(input()), sections.insert(alerts()), sections.insert(applications()), ]) } fn info(&self) -> page::Info { page::Info::new("sound", "multimedia-volume-control-symbolic") .title(fl!("sound")) .description(fl!("sound", "desc")) } } impl page::AutoBind for Page {} fn alerts() -> Section { Section::default() .title(fl!("sound-alerts")) .descriptions(vec![ fl!("sound-alerts", "volume"), fl!("sound-alerts", "sound"), ]) .view::(|_binder, _page, section| { settings::view_section(§ion.title) .add(settings::item( §ion.descriptions[0], iced::widget::text("TODO"), )) .add(settings::item( §ion.descriptions[1], iced::widget::text("TODO"), )) .into() }) } fn applications() -> Section { Section::default() .title(fl!("sound-applications")) .descriptions(vec![fl!("sound-applications", "desc")]) .view::(|_binder, _page, section| { settings::view_section(§ion.title) .add(settings::item( §ion.descriptions[0], iced::widget::text("TODO"), )) .into() }) } fn input() -> Section { Section::default() .title(fl!("sound-input")) .descriptions(vec![ fl!("sound-input", "volume"), fl!("sound-input", "device"), fl!("sound-input", "level"), ]) .view::(|_binder, _page, section| { settings::view_section(§ion.title) .add(settings::item( §ion.descriptions[0], iced::widget::text("TODO"), )) .add(settings::item( §ion.descriptions[1], iced::widget::text("TODO"), )) .add(settings::item( §ion.descriptions[2], iced::widget::text("TODO"), )) .into() }) } fn output() -> Section { Section::default() .title(fl!("sound-output")) .descriptions(vec![ fl!("sound-output", "volume"), fl!("sound-output", "device"), fl!("sound-output", "level"), fl!("sound-output", "config"), fl!("sound-output", "balance"), ]) .view::(|_binder, _page, section| { settings::view_section(§ion.title) .add(settings::item( §ion.descriptions[0], iced::widget::text("TODO"), )) .add(settings::item( §ion.descriptions[1], iced::widget::text("TODO"), )) .add(settings::item( §ion.descriptions[2], iced::widget::text("TODO"), )) .add(settings::item( §ion.descriptions[3], iced::widget::text("TODO"), )) .into() }) }