mirror of
https://github.com/Xetibo/ReSet.git
synced 2025-07-07 18:47:45 +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
|
@ -1,24 +1,22 @@
|
|||
use std::collections::HashMap;
|
||||
use std::sync::mpsc::{channel, Receiver, Sender};
|
||||
use std::sync::{atomic::AtomicBool, Arc, Weak};
|
||||
use std::thread;
|
||||
use std::sync::{atomic::AtomicBool, Arc};
|
||||
use std::time::Duration;
|
||||
|
||||
use crate::components::base::listEntry::ListEntry;
|
||||
use adw::glib;
|
||||
use adw::glib::Object;
|
||||
use adw::prelude::{BoxExt, ButtonExt, ListBoxRowExt};
|
||||
use adw::prelude::{BoxExt, ListBoxRowExt};
|
||||
use adw::subclass::prelude::ObjectSubclassIsExt;
|
||||
use dbus::arg::RefArg;
|
||||
use dbus::blocking::Connection;
|
||||
use dbus::Error;
|
||||
use dbus::Path;
|
||||
use gtk::glib::Variant;
|
||||
use gtk::prelude::ActionableExt;
|
||||
|
||||
use gtk::{Button, Label, Orientation};
|
||||
use ReSet_Lib::network::network::{AccessPoint, WifiStrength};
|
||||
use ReSet_Lib::signals::{
|
||||
AccessPointAdded, AccessPointRemoved, BluetoothDeviceAdded, BluetoothDeviceRemoved,
|
||||
};
|
||||
use ReSet_Lib::network::network::AccessPoint;
|
||||
use ReSet_Lib::signals::AccessPointAdded;
|
||||
use ReSet_Lib::signals::AccessPointRemoved;
|
||||
use ReSet_Lib::utils::Events;
|
||||
|
||||
use crate::components::wifi::wifiBoxImpl;
|
||||
|
@ -26,6 +24,8 @@ use crate::components::wifi::wifiEntry::WifiEntry;
|
|||
|
||||
use super::savedWifiEntry::SavedWifiEntry;
|
||||
|
||||
use ReSet_Lib::network::connection::Connection as ResetConnection;
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct WifiBox(ObjectSubclass<wifiBoxImpl::WifiBox>)
|
||||
@extends gtk::Box, gtk::Widget,
|
||||
|
@ -42,9 +42,10 @@ impl WifiBox {
|
|||
|
||||
pub fn setupCallbacks(&self) {
|
||||
let selfImp = self.imp();
|
||||
|
||||
selfImp.resetSavedNetworks.set_action_name(Some("navigation.push"));
|
||||
selfImp.resetSavedNetworks.set_action_target_value(Some(&Variant::from("saved")))
|
||||
selfImp.resetSavedNetworks.set_action_target_value(Some(&Variant::from("saved")));
|
||||
|
||||
selfImp.resetAvailableNetworks.set_action_name(Some("navigation.pop"));
|
||||
}
|
||||
|
||||
// pub fn donotdisturb() {
|
||||
|
@ -173,3 +174,25 @@ pub async fn get_stored_connections() -> Vec<(Path<'static>, Vec<u8>)> {
|
|||
dbg!(connections.clone());
|
||||
connections
|
||||
}
|
||||
|
||||
pub fn getConnectionSettings(path: Path<'static>) -> Option<ResetConnection> {
|
||||
let conn = Connection::new_session().unwrap();
|
||||
let proxy = conn.with_proxy(
|
||||
"org.xetibo.ReSet",
|
||||
"/org/xetibo/ReSet",
|
||||
Duration::from_millis(1000),
|
||||
);
|
||||
let res: Result<(HashMap<String, HashMap<String, dbus::arg::Variant<Box<dyn RefArg>>>,>,), Error> =
|
||||
proxy.method_call("org.xetibo.ReSet", "GetConnectionSettings", (path,));
|
||||
if res.is_err() {
|
||||
println!("lol not work");
|
||||
return None;
|
||||
}
|
||||
let (res,) = res.unwrap();
|
||||
let res = ResetConnection::convert_from_propmap(res);
|
||||
if res.is_err() {
|
||||
println!("lol none");
|
||||
return None;
|
||||
}
|
||||
Some(res.unwrap())
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use std::cell::RefCell;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use gtk::{Button, CompositeTemplate, glib, ListBox, Switch};
|
||||
use gtk::{CompositeTemplate, glib, ListBox, Switch};
|
||||
use gtk::prelude::*;
|
||||
use gtk::subclass::prelude::*;
|
||||
use crate::components::wifi::wifiBox;
|
||||
|
@ -8,8 +7,6 @@ use crate::components::wifi::wifiBox;
|
|||
use crate::components::wifi::wifiEntry::WifiEntry;
|
||||
use crate::components::base::listEntry::ListEntry;
|
||||
|
||||
use super::wifiBox::scanForWifi;
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
#[derive(Default, CompositeTemplate)]
|
||||
#[template(resource = "/org/Xetibo/ReSet/resetWiFi.ui")]
|
||||
|
@ -17,8 +14,6 @@ pub struct WifiBox {
|
|||
#[template_child]
|
||||
pub resetWifiDetails: TemplateChild<ListBox>,
|
||||
#[template_child]
|
||||
pub resetWifiSwitchRow: TemplateChild<ListEntry>,
|
||||
#[template_child]
|
||||
pub resetSavedNetworks: TemplateChild<ListEntry>,
|
||||
#[template_child]
|
||||
pub resetWifiSwitch: TemplateChild<Switch>,
|
||||
|
@ -26,6 +21,8 @@ pub struct WifiBox {
|
|||
pub resetWifiList: TemplateChild<ListBox>,
|
||||
#[template_child]
|
||||
pub resetStoredWifiList: TemplateChild<ListBox>,
|
||||
#[template_child]
|
||||
pub resetAvailableNetworks: TemplateChild<ListEntry>,
|
||||
pub wifiEntries: Arc<Mutex<Vec<ListEntry>>>,
|
||||
pub savedWifiEntries: Arc<Mutex<Vec<ListEntry>>>,
|
||||
}
|
||||
|
|
|
@ -1,19 +1,21 @@
|
|||
use crate::components::base::popup::{self, Popup};
|
||||
use crate::components::wifi::wifiEntryImpl;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::time::Duration;
|
||||
|
||||
use adw::glib;
|
||||
use adw::glib::{Object, PropertySet};
|
||||
use adw::prelude::{ButtonExt, EditableExt, EntryExt, PopoverExt};
|
||||
use adw::subclass::prelude::ObjectSubclassIsExt;
|
||||
use dbus::blocking::Connection;
|
||||
use dbus::Error;
|
||||
use glib::{clone, Cast};
|
||||
use glib::{Cast, clone};
|
||||
use gtk::{AlertDialog, GestureClick};
|
||||
use gtk::prelude::WidgetExt;
|
||||
use gtk::{AlertDialog, Editable, GestureClick, PasswordEntry, PasswordEntryBuffer, Window};
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use ReSet_Lib::network::network::{AccessPoint, WifiStrength};
|
||||
|
||||
use crate::components::wifi::wifiBox::getConnectionSettings;
|
||||
use crate::components::wifi::wifiEntryImpl;
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct WifiEntry(ObjectSubclass<wifiEntryImpl::WifiEntry>)
|
||||
@extends gtk::Box, gtk::Widget,
|
||||
|
@ -75,6 +77,15 @@ impl WifiEntry {
|
|||
entry.add_controller(gesture);
|
||||
entry
|
||||
}
|
||||
|
||||
pub fn setupCallbacks(&self) {
|
||||
let selfImp = self.imp();
|
||||
selfImp.resetWifiEditButton.connect_clicked(clone!(@ weak selfImp => move |_| {
|
||||
// TODO open navigationpage
|
||||
let option = getConnectionSettings(selfImp.accessPoint.borrow().associated_connection.clone());
|
||||
dbg!(option);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
pub fn click_stored_network(entry: Arc<WifiEntry>) {
|
||||
|
|
|
@ -16,7 +16,7 @@ pub struct WifiEntry {
|
|||
#[template_child]
|
||||
pub resetWifiLabel: TemplateChild<Label>,
|
||||
#[template_child]
|
||||
pub resetWifiButton: TemplateChild<Button>,
|
||||
pub resetWifiEditButton: TemplateChild<Button>,
|
||||
#[template_child]
|
||||
pub resetWifiConnected: TemplateChild<Image>,
|
||||
#[template_child]
|
||||
|
@ -49,6 +49,9 @@ impl ObjectSubclass for WifiEntry {
|
|||
impl ObjectImpl for WifiEntry {
|
||||
fn constructed(&self) {
|
||||
self.parent_constructed();
|
||||
|
||||
let obj = self.obj();
|
||||
obj.setupCallbacks();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue