get_local_option for ui style, todo: set_local_option

This commit is contained in:
open-trade 2021-12-29 17:53:36 +08:00
parent 365fc90d8b
commit 3491c79cbc
5 changed files with 9 additions and 5 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ extractor
__pycache__
src/version.rs
*dmg
sciter.dll

View File

@ -191,7 +191,8 @@ mod cpal_impl {
let (device, config) = get_device()?;
let sp = sp.clone();
let err_fn = move |err| {
log::error!("an error occurred on stream: {}", err);
// too many UnknownErrno, will improve later
log::trace!("an error occurred on stream: {}", err);
};
// Sample rate must be one of 8000, 12000, 16000, 24000, or 48000.
let sample_rate_0 = config.sample_rate().0;

View File

@ -277,6 +277,10 @@ impl UI {
}
}
fn get_local_option(&self, key: String) -> String {
Config::get_option(&key)
}
fn get_peer_option(&self, id: String, name: String) -> String {
let c = PeerConfig::load(&id);
c.options.get(&name).unwrap_or(&"".to_owned()).to_owned()
@ -603,6 +607,7 @@ impl sciter::EventHandler for UI {
fn modify_default_login();
fn get_options();
fn get_option(String);
fn get_local_option(String);
fn get_peer_option(String, String);
fn set_peer_option(String, String, String);
fn test_if_valid_server(String);

View File

@ -6,7 +6,7 @@ function getSessionsStyleOption(type) {
}
function getSessionsStyle(type) {
var v = handler.get_option(getSessionsStyleOption(type));
var v = handler.get_local_option(getSessionsStyleOption(type));
if (!v) v = type == "ab" ? "list" : "tile";
return v;
}

View File

@ -80,9 +80,6 @@ impl sciter::EventHandler for Handler {
fn attached(&mut self, root: HELEMENT) {
self.write().unwrap().element = Some(Element::from(root));
if self.is_port_forward() {
return;
}
}
fn detached(&mut self, _root: HELEMENT) {