mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2025-01-08 23:19:26 +00:00
gupax: disable FileSelector ui if thread exists
This commit is contained in:
parent
51df689cb0
commit
adaaca394a
2 changed files with 31 additions and 28 deletions
|
@ -59,6 +59,7 @@ pub const GUPAX_AUTO_UPDATE: &'static str = "Automatically check for updates at
|
||||||
pub const GUPAX_UPDATE_VIA_TOR: &'static str = "Update through the Tor network. Tor is embedded within Gupax; a Tor system proxy is not required";
|
pub const GUPAX_UPDATE_VIA_TOR: &'static str = "Update through the Tor network. Tor is embedded within Gupax; a Tor system proxy is not required";
|
||||||
pub const GUPAX_ASK_BEFORE_QUIT: &'static str = "Ask before quitting Gupax";
|
pub const GUPAX_ASK_BEFORE_QUIT: &'static str = "Ask before quitting Gupax";
|
||||||
pub const GUPAX_SAVE_BEFORE_QUIT: &'static str = "Automatically save any changed settings before quitting";
|
pub const GUPAX_SAVE_BEFORE_QUIT: &'static str = "Automatically save any changed settings before quitting";
|
||||||
|
pub const GUPAX_SELECT: &'static str = "Open a file explorer to select a file";
|
||||||
pub const GUPAX_PATH_P2POOL: &'static str = "The location of the P2Pool binary: Both absolute and relative paths are accepted; A red [X] will appear if there is no file found at the given path";
|
pub const GUPAX_PATH_P2POOL: &'static str = "The location of the P2Pool binary: Both absolute and relative paths are accepted; A red [X] will appear if there is no file found at the given path";
|
||||||
pub const GUPAX_PATH_XMRIG: &'static str = "The location of the XMRig binary: Both absolute and relative paths are accepted; A red [X] will appear if there is no file found at the given path";
|
pub const GUPAX_PATH_XMRIG: &'static str = "The location of the XMRig binary: Both absolute and relative paths are accepted; A red [X] will appear if there is no file found at the given path";
|
||||||
// P2Pool
|
// P2Pool
|
||||||
|
|
58
src/gupax.rs
58
src/gupax.rs
|
@ -152,20 +152,21 @@ impl Gupax {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
ui.spacing_mut().text_edit_width = ui.available_width() - SPACE;
|
ui.spacing_mut().text_edit_width = ui.available_width() - SPACE;
|
||||||
if ui.button("Select File").clicked() {
|
ui.set_enabled(!file_window.lock().unwrap().thread);
|
||||||
if file_window.lock().unwrap().thread == false {
|
if ui.button("Select").on_hover_text(GUPAX_SELECT).clicked() {
|
||||||
let file_window = Arc::clone(file_window);
|
file_window.lock().unwrap().thread = true;
|
||||||
thread::spawn(move|| {
|
let file_window = Arc::clone(file_window);
|
||||||
match rfd::FileDialog::new().set_title("Select P2Pool Binary for Gupax").pick_file() {
|
thread::spawn(move|| {
|
||||||
Some(path) => {
|
match rfd::FileDialog::new().set_title("Select P2Pool Binary for Gupax").pick_file() {
|
||||||
info!("Gupax | [{}] path selected for P2Pool", path.display());
|
Some(path) => {
|
||||||
file_window.lock().unwrap().p2pool_path = path.display().to_string();
|
info!("Gupax | [{}] path selected for P2Pool", path.display());
|
||||||
file_window.lock().unwrap().picked_p2pool = true;
|
file_window.lock().unwrap().p2pool_path = path.display().to_string();
|
||||||
},
|
file_window.lock().unwrap().picked_p2pool = true;
|
||||||
None => info!("Gupax | No path selected for P2Pool"),
|
},
|
||||||
};
|
None => info!("Gupax | No path selected for P2Pool"),
|
||||||
});
|
};
|
||||||
}
|
file_window.lock().unwrap().thread = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
ui.text_edit_singleline(&mut self.p2pool_path).on_hover_text(GUPAX_PATH_P2POOL);
|
ui.text_edit_singleline(&mut self.p2pool_path).on_hover_text(GUPAX_PATH_P2POOL);
|
||||||
});
|
});
|
||||||
|
@ -185,20 +186,21 @@ impl Gupax {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
ui.spacing_mut().text_edit_width = ui.available_width() - SPACE;
|
ui.spacing_mut().text_edit_width = ui.available_width() - SPACE;
|
||||||
if ui.button("Select File").clicked() {
|
ui.set_enabled(!file_window.lock().unwrap().thread);
|
||||||
if file_window.lock().unwrap().thread == false {
|
if ui.button("Select").on_hover_text(GUPAX_SELECT).clicked() {
|
||||||
let file_window = Arc::clone(file_window);
|
file_window.lock().unwrap().thread = true;
|
||||||
thread::spawn(move|| {
|
let file_window = Arc::clone(file_window);
|
||||||
match rfd::FileDialog::new().set_title("Select XMRig Binary for Gupax").pick_file() {
|
thread::spawn(move|| {
|
||||||
Some(path) => {
|
match rfd::FileDialog::new().set_title("Select XMRig Binary for Gupax").pick_file() {
|
||||||
info!("Gupax | [{}] path selected for XMRig", path.display());
|
Some(path) => {
|
||||||
file_window.lock().unwrap().xmrig_path = path.display().to_string();
|
info!("Gupax | [{}] path selected for XMRig", path.display());
|
||||||
file_window.lock().unwrap().picked_xmrig = true;
|
file_window.lock().unwrap().xmrig_path = path.display().to_string();
|
||||||
},
|
file_window.lock().unwrap().picked_xmrig = true;
|
||||||
None => info!("Gupax | No path selected for XMRig"),
|
},
|
||||||
};
|
None => info!("Gupax | No path selected for XMRig"),
|
||||||
});
|
};
|
||||||
}
|
file_window.lock().unwrap().thread = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
ui.text_edit_singleline(&mut self.xmrig_path).on_hover_text(GUPAX_PATH_XMRIG);
|
ui.text_edit_singleline(&mut self.xmrig_path).on_hover_text(GUPAX_PATH_XMRIG);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue