mirror of
https://github.com/Xetibo/ReSet.git
synced 2025-07-01 15:57:46 +02:00
Implement Microphone UI
Improve Audio UI You won't believe what happened (gone sexual)
This commit is contained in:
parent
d07180e2c7
commit
35c58e2fcd
36 changed files with 1380 additions and 399 deletions
27
src/components/output/audioBox.rs
Normal file
27
src/components/output/audioBox.rs
Normal file
|
@ -0,0 +1,27 @@
|
|||
use adw::glib;
|
||||
use adw::glib::Object;
|
||||
use glib::subclass::prelude::ObjectSubclassIsExt;
|
||||
use glib::Variant;
|
||||
use gtk::prelude::ActionableExt;
|
||||
use crate::components::base::listEntry::ListEntry;
|
||||
use crate::components::output::audioBoxImpl;
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct AudioBox(ObjectSubclass<audioBoxImpl::AudioBox>)
|
||||
@extends gtk::Box, gtk::Widget,
|
||||
@implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable;
|
||||
}
|
||||
|
||||
impl AudioBox {
|
||||
pub fn new() -> Self {
|
||||
Object::builder().build()
|
||||
}
|
||||
|
||||
pub fn setupCallbacks(&self) {
|
||||
let selfImp = self.imp();
|
||||
selfImp.resetSinksRow.set_action_name(Some("navigation.push"));
|
||||
selfImp.resetSinksRow.set_action_target_value(Some(&Variant::from("outputDevices")));
|
||||
|
||||
selfImp.resetOutputStreamButton.set_action_name(Some("navigation.pop"));
|
||||
}
|
||||
}
|
53
src/components/output/audioBoxImpl.rs
Normal file
53
src/components/output/audioBoxImpl.rs
Normal file
|
@ -0,0 +1,53 @@
|
|||
use gtk::{CompositeTemplate, DropDown, TemplateChild, glib, Button};
|
||||
use gtk::prelude::*;
|
||||
use gtk::subclass::prelude::*;
|
||||
use crate::components::output::audioBox;
|
||||
use crate::components::output::audioSource::AudioSourceEntry;
|
||||
use crate::components::base::listEntry::ListEntry;
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
#[derive(Default, CompositeTemplate)]
|
||||
#[template(resource = "/org/Xetibo/ReSet/resetAudio.ui")]
|
||||
pub struct AudioBox {
|
||||
#[template_child]
|
||||
pub resetOutputDevice: TemplateChild<DropDown>,
|
||||
#[template_child]
|
||||
pub resetSinksRow: TemplateChild<ListEntry>,
|
||||
#[template_child]
|
||||
pub resetOutputStreamButton: TemplateChild<ListEntry>,
|
||||
}
|
||||
|
||||
|
||||
#[glib::object_subclass]
|
||||
impl ObjectSubclass for AudioBox {
|
||||
const NAME: &'static str = "resetAudio";
|
||||
type Type = audioBox::AudioBox;
|
||||
type ParentType = gtk::Box;
|
||||
|
||||
fn class_init(klass: &mut Self::Class) {
|
||||
AudioSourceEntry::ensure_type();
|
||||
ListEntry::ensure_type();
|
||||
klass.bind_template();
|
||||
}
|
||||
|
||||
fn instance_init(obj: &glib::subclass::InitializingObject<Self>) {
|
||||
obj.init_template();
|
||||
}
|
||||
}
|
||||
|
||||
impl BoxImpl for AudioBox {}
|
||||
|
||||
impl ObjectImpl for AudioBox {
|
||||
fn constructed(&self) {
|
||||
let obj = self.obj();
|
||||
obj.setupCallbacks();
|
||||
}
|
||||
}
|
||||
|
||||
impl ListBoxRowImpl for AudioBox {}
|
||||
|
||||
impl WidgetImpl for AudioBox {}
|
||||
|
||||
impl WindowImpl for AudioBox {}
|
||||
|
||||
impl ApplicationWindowImpl for AudioBox {}
|
15
src/components/output/audioSource.rs
Normal file
15
src/components/output/audioSource.rs
Normal file
|
@ -0,0 +1,15 @@
|
|||
use adw::glib;
|
||||
use adw::glib::Object;
|
||||
use crate::components::output::audioSourceImpl;
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct AudioSourceEntry(ObjectSubclass<audioSourceImpl::AudioSourceEntry>)
|
||||
@extends gtk::Box, gtk::Widget,
|
||||
@implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable;
|
||||
}
|
||||
|
||||
impl AudioSourceEntry {
|
||||
pub fn new() -> Self {
|
||||
Object::builder().build()
|
||||
}
|
||||
}
|
40
src/components/output/audioSourceImpl.rs
Normal file
40
src/components/output/audioSourceImpl.rs
Normal file
|
@ -0,0 +1,40 @@
|
|||
use gtk::{Button, CompositeTemplate, glib, Image, Label, ProgressBar, Scale};
|
||||
use gtk::subclass::prelude::*;
|
||||
use crate::components::output::audioSource;
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
#[derive(Default, CompositeTemplate)]
|
||||
#[template(resource = "/org/Xetibo/ReSet/resetOutputStreamEntry.ui")]
|
||||
pub struct AudioSourceEntry {
|
||||
#[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 AudioSourceEntry {
|
||||
const NAME: &'static str = "resetOutputStreamEntry";
|
||||
type Type = audioSource::AudioSourceEntry;
|
||||
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 AudioSourceEntry {}
|
||||
|
||||
impl ObjectImpl for AudioSourceEntry {}
|
||||
|
||||
impl WidgetImpl for AudioSourceEntry {}
|
5
src/components/output/mod.rs
Normal file
5
src/components/output/mod.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
#![allow(non_snake_case)]
|
||||
pub mod audioSource;
|
||||
pub mod audioBox;
|
||||
pub mod audioBoxImpl;
|
||||
pub mod audioSourceImpl;
|
Loading…
Add table
Add a link
Reference in a new issue