feat: Add initial Sound Mapping

This commit is contained in:
Fabio Lenherr / DashieTM 2023-11-13 18:12:36 +01:00
parent 679b4f0331
commit 5999bb1b45
8 changed files with 206 additions and 52 deletions

View file

@ -1,12 +1,12 @@
use gtk::prelude::FrameExt;
use std::sync::Arc;
use std::sync::atomic::Ordering;
use std::sync::Arc;
use crate::components::base::settingBox::SettingBox;
use crate::components::base::utils::Listeners;
use crate::components::bluetooth::bluetoothBox::BluetoothBox;
use crate::components::input::sourceBox::SourceBox;
use crate::components::output::audioBox::AudioBox;
use crate::components::output::audioBox::{populate_streams, AudioBox, populate_sinks};
use crate::components::wifi::wifiBox::{scanForWifi, show_stored_connections, WifiBox};
use gtk::prelude::WidgetExt;
use gtk::{FlowBox, Frame, Label};
@ -16,7 +16,7 @@ pub const HANDLE_CONNECTIVITY_CLICK: fn(Arc<Listeners>, FlowBox) =
listeners.pulse_listener.store(false, Ordering::SeqCst);
let wifiBox = Arc::new(WifiBox::new());
show_stored_connections(wifiBox.clone());
scanForWifi(listeners.clone(),wifiBox.clone());
scanForWifi(listeners.clone(), wifiBox.clone());
let wifiFrame = wrapInFrame(SettingBox::new(&*wifiBox));
let bluetoothFrame = wrapInFrame(SettingBox::new(&BluetoothBox::new()));
resetMain.remove_all();
@ -30,7 +30,7 @@ pub const HANDLE_WIFI_CLICK: fn(Arc<Listeners>, FlowBox) =
listeners.bluetooth_listener.store(false, Ordering::SeqCst);
listeners.pulse_listener.store(false, Ordering::SeqCst);
let wifiBox = Arc::new(WifiBox::new());
scanForWifi(listeners.clone(),wifiBox.clone());
scanForWifi(listeners.clone(), wifiBox.clone());
let wifiFrame = wrapInFrame(SettingBox::new(&*wifiBox));
resetMain.remove_all();
resetMain.insert(&wifiFrame, -1);
@ -63,7 +63,10 @@ pub const HANDLE_AUDIO_CLICK: fn(Arc<Listeners>, FlowBox) =
listeners.stop_network_listener();
listeners.bluetooth_listener.store(false, Ordering::SeqCst);
listeners.pulse_listener.store(true, Ordering::SeqCst);
let audioFrame = wrapInFrame(SettingBox::new(&AudioBox::new()));
let audioOutput = Arc::new(AudioBox::new());
populate_streams(listeners.clone(), audioOutput.clone());
populate_sinks(audioOutput.clone());
let audioFrame = wrapInFrame(SettingBox::new(&*audioOutput));
let sourceFrame = wrapInFrame(SettingBox::new(&SourceBox::new()));
resetMain.remove_all();
resetMain.insert(&audioFrame, -1);
@ -76,7 +79,10 @@ pub const HANDLE_VOLUME_CLICK: fn(Arc<Listeners>, FlowBox) =
listeners.stop_network_listener();
listeners.bluetooth_listener.store(false, Ordering::SeqCst);
listeners.pulse_listener.store(false, Ordering::SeqCst);
let audioFrame = wrapInFrame(SettingBox::new(&AudioBox::new()));
let audioOutput = Arc::new(AudioBox::new());
populate_streams(listeners.clone(), audioOutput.clone());
populate_sinks(audioOutput.clone());
let audioFrame = wrapInFrame(SettingBox::new(&*audioOutput));
resetMain.remove_all();
resetMain.insert(&audioFrame, -1);
resetMain.set_max_children_per_line(1);