Implement Microphone UI

Improve Audio UI
You won't believe what happened (gone sexual)
This commit is contained in:
takotori 2023-11-12 17:43:01 +01:00
parent d07180e2c7
commit 35c58e2fcd
36 changed files with 1380 additions and 399 deletions

View file

@ -0,0 +1,15 @@
use crate::components::input::inputStreamEntryImpl;
use adw::glib;
use adw::glib::Object;
glib::wrapper! {
pub struct InputStreamEntry(ObjectSubclass<inputStreamEntryImpl::InputStreamEntry>)
@extends gtk::Box, gtk::Widget,
@implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable;
}
impl InputStreamEntry {
pub fn new() -> Self {
Object::builder().build()
}
}

View file

@ -0,0 +1,40 @@
use gtk::{Button, CompositeTemplate, glib, Label, ProgressBar, Scale};
use gtk::subclass::prelude::*;
use crate::components::input::inputStreamEntry;
#[allow(non_snake_case)]
#[derive(Default, CompositeTemplate)]
#[template(resource = "/org/Xetibo/ReSet/resetInputStreamEntry.ui")]
pub struct InputStreamEntry {
#[template_child]
pub resetSourceName: TemplateChild<Label>,
#[template_child]
pub resetSourceMute: TemplateChild<Button>,
#[template_child]
pub resetVolumeSlider: TemplateChild<Scale>,
#[template_child]
pub resetVolumePercentage: TemplateChild<Label>,
#[template_child]
pub resetVolumeMeter: TemplateChild<ProgressBar>,
}
#[glib::object_subclass]
impl ObjectSubclass for InputStreamEntry {
const NAME: &'static str = "resetInputStreamEntry";
type Type = inputStreamEntry::InputStreamEntry;
type ParentType = gtk::Box;
fn class_init(klass: &mut Self::Class) {
klass.bind_template();
}
fn instance_init(obj: &glib::subclass::InitializingObject<Self>) {
obj.init_template();
}
}
impl BoxImpl for InputStreamEntry {}
impl ObjectImpl for InputStreamEntry {}
impl WidgetImpl for InputStreamEntry {}

View file

@ -0,0 +1,5 @@
#![allow(non_snake_case)]
pub mod inputStreamEntry;
pub mod sourceBox;
pub mod sourceBoxImpl;
pub mod inputStreamEntryImpl;

View file

@ -0,0 +1,26 @@
use crate::components::input::sourceBoxImpl;
use adw::glib;
use adw::glib::Object;
use glib::subclass::prelude::ObjectSubclassIsExt;
use glib::Variant;
use gtk::prelude::ActionableExt;
glib::wrapper! {
pub struct SourceBox(ObjectSubclass<sourceBoxImpl::SourceBox>)
@extends gtk::Box, gtk::Widget,
@implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable;
}
impl SourceBox {
pub fn new() -> Self {
Object::builder().build()
}
pub fn setupCallbacks(&self) {
let selfImp = self.imp();
selfImp.resetSourceRow.set_action_name(Some("navigation.push"));
selfImp.resetSourceRow.set_action_target_value(Some(&Variant::from("sources")));
selfImp.resetInputStreamButton.set_action_name(Some("navigation.pop"));
}
}

View file

@ -0,0 +1,52 @@
use gtk::{CompositeTemplate, DropDown, TemplateChild, glib};
use gtk::prelude::*;
use gtk::subclass::prelude::*;
use crate::components::base::listEntry::ListEntry;
use crate::components::input::inputStreamEntry::InputStreamEntry;
use crate::components::input::sourceBox;
#[allow(non_snake_case)]
#[derive(Default, CompositeTemplate)]
#[template(resource = "/org/Xetibo/ReSet/resetMicrophone.ui")]
pub struct SourceBox {
#[template_child]
pub resetSourceDropdown: TemplateChild<DropDown>,
#[template_child]
pub resetSourceRow: TemplateChild<ListEntry>,
#[template_child]
pub resetInputStreamButton: TemplateChild<ListEntry>,
}
#[glib::object_subclass]
impl ObjectSubclass for SourceBox {
const NAME: &'static str = "resetMicrophone";
type Type = sourceBox::SourceBox;
type ParentType = gtk::Box;
fn class_init(klass: &mut Self::Class) {
InputStreamEntry::ensure_type();
ListEntry::ensure_type();
klass.bind_template();
}
fn instance_init(obj: &glib::subclass::InitializingObject<Self>) {
obj.init_template();
}
}
impl BoxImpl for SourceBox {}
impl ObjectImpl for SourceBox {
fn constructed(&self) {
let obj = self.obj();
obj.setupCallbacks();
}
}
impl ListBoxRowImpl for SourceBox {}
impl WidgetImpl for SourceBox {}
impl WindowImpl for SourceBox {}
impl ApplicationWindowImpl for SourceBox {}