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

@ -1,39 +1,40 @@
use gtk::prelude::FrameExt;
use std::sync::Arc;
use crate::components::audio::audioBox::AudioBox;
use crate::components::output::audioBox::AudioBox;
use crate::components::base::settingBox::SettingBox;
use crate::components::bluetooth::bluetoothBox::BluetoothBox;
use crate::components::wifi::wifiBox::{scanForWifi, show_stored_connections, WifiBox};
use adw::prelude::ButtonExt;
use glib::clone;
use glib::subclass::types::ObjectSubclassIsExt;
use gtk::{FlowBox, Label};
use gtk::{FlowBox, Frame, Label,};
use gtk::prelude::WidgetExt;
use crate::components::input::sourceBox;
use crate::components::input::sourceBox::SourceBox;
pub const HANDLE_CONNECTIVITY_CLICK: fn(FlowBox) = |resetMain: FlowBox| {
let wifiBox = Arc::new(WifiBox::new());
show_stored_connections(wifiBox.clone());
scanForWifi(wifiBox.clone());
let wifiBox = SettingBox::new(&*wifiBox, "WiFi");
let bluetoothBox = SettingBox::new(&BluetoothBox::new(), "Bluetooth");
let wifiFrame = wrapInFrame(SettingBox::new(&*wifiBox));
let bluetoothFrame = wrapInFrame(SettingBox::new(&BluetoothBox::new()));
resetMain.remove_all();
resetMain.insert(&wifiBox, -1);
resetMain.insert(&bluetoothBox, -1);
resetMain.insert(&wifiFrame, -1);
resetMain.insert(&bluetoothFrame, -1);
resetMain.set_max_children_per_line(2);
};
pub const HANDLE_WIFI_CLICK: fn(FlowBox) = |resetMain: FlowBox| {
let wifiBox = Arc::new(WifiBox::new());
scanForWifi(wifiBox.clone());
let wifiBox = SettingBox::new(&*wifiBox, "WiFi");
let wifiFrame = wrapInFrame(SettingBox::new(&*wifiBox));
resetMain.remove_all();
resetMain.insert(&wifiBox, -1);
resetMain.insert(&wifiFrame, -1);
resetMain.set_max_children_per_line(1);
};
pub const HANDLE_BLUETOOTH_CLICK: fn(FlowBox) = |resetMain: FlowBox| {
let bluetoothBox = SettingBox::new(&BluetoothBox::new(), "Bluetooth");
let bluetoothFrame = wrapInFrame(SettingBox::new(&BluetoothBox::new()));
resetMain.remove_all();
resetMain.insert(&bluetoothBox, -1);
resetMain.insert(&bluetoothFrame, -1);
resetMain.set_max_children_per_line(1);
};
@ -45,23 +46,25 @@ pub const HANDLE_VPN_CLICK: fn(FlowBox) = |resetMain: FlowBox| {
};
pub const HANDLE_AUDIO_CLICK: fn(FlowBox) = |resetMain: FlowBox| {
let audioBox = SettingBox::new(&AudioBox::new(), "Audio");
let audioFrame = wrapInFrame(SettingBox::new(&AudioBox::new()));
let sourceFrame = wrapInFrame(SettingBox::new(&SourceBox::new()));
resetMain.remove_all();
resetMain.insert(&audioBox, -1);
resetMain.set_max_children_per_line(1);
resetMain.insert(&audioFrame, -1);
resetMain.insert(&sourceFrame, -1);
resetMain.set_max_children_per_line(2);
};
pub const HANDLE_VOLUME_CLICK: fn(FlowBox) = |resetMain: FlowBox| {
let audioBox = SettingBox::new(&AudioBox::new(), "Audio");
let audioFrame = wrapInFrame(SettingBox::new(&AudioBox::new()));
resetMain.remove_all();
resetMain.insert(&audioBox, -1);
resetMain.insert(&audioFrame, -1);
resetMain.set_max_children_per_line(1);
};
pub const HANDLE_MICROPHONE_CLICK: fn(FlowBox) = |resetMain: FlowBox| {
let label = Label::new(Some("not implemented yet"));
let sourceFrame = wrapInFrame(SettingBox::new(&SourceBox::new()));
resetMain.remove_all();
resetMain.insert(&label, -1);
resetMain.insert(&sourceFrame, -1);
resetMain.set_max_children_per_line(1);
};
@ -96,3 +99,10 @@ pub const HANDLE_KEYBOARD_CLICK: fn(FlowBox) = |resetMain: FlowBox| {
pub const HANDLE_HOME: fn(FlowBox) = |resetMain: FlowBox| {
resetMain.remove_all();
};
fn wrapInFrame(widget: SettingBox) -> Frame {
let frame = Frame::new(None);
frame.set_child(Some(&widget));
frame.add_css_class("resetSettingFrame");
frame
}

View file

@ -165,14 +165,14 @@ impl Window {
let audioList = vec![
SidebarEntry::new(
"Volume",
"Output",
"audio-volume-high-symbolic",
Categories::Audio,
true,
HANDLE_VOLUME_CLICK,
),
SidebarEntry::new(
"Microphone",
"Input",
"audio-input-microphone-symbolic",
Categories::Audio,
true,