feat: upgrade deps and adapt code to breaking changes

This commit is contained in:
Cyrix126 2024-08-20 12:31:07 +02:00
parent baa70cd458
commit 9057bd12ee
18 changed files with 1657 additions and 1541 deletions

1324
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -32,11 +32,11 @@ distro = []
clap = {version="4.5", features=["cargo", "derive"]} clap = {version="4.5", features=["cargo", "derive"]}
anyhow = "1.0.86" anyhow = "1.0.86"
benri = "0.1.12" benri = "0.1.12"
bytes = "1.6.1" bytes = "1.7.1"
dirs = "5.0.1" dirs = "5.0.1"
#-------------------------------------------------------------------------------- #--------------------------------------------------------------------------------
egui = "0.27.2" egui = {git="https://github.com/emilk/egui", rev="9a1e358"}
egui_extras = { version = "0.27.2", features = ["image"] } egui_extras = {git="https://github.com/emilk/egui", rev="9a1e358", features = ["image"] }
## 2023-12-28: https://github.com/hinto-janai/gupax/issues/68 ## 2023-12-28: https://github.com/hinto-janai/gupax/issues/68
## ##
## 2024-03-18: Both `glow` and `wgpu` seem to crash: ## 2024-03-18: Both `glow` and `wgpu` seem to crash:
@ -48,28 +48,28 @@ egui_extras = { version = "0.27.2", features = ["image"] }
## Using [wgpu] actually crashes macOS (fixed in 0.20.x though). ## Using [wgpu] actually crashes macOS (fixed in 0.20.x though).
#-------------------------------------------------------------------------------- #--------------------------------------------------------------------------------
env_logger = "0.11.4" env_logger = "0.11.5"
figment = { version = "0.10.19", features = ["toml"] } figment = { version = "0.10.19", features = ["toml"] }
reqwest = {version = "0.12.5", default-features=false, features=["json", "rustls-tls"]} reqwest = {version = "0.12.7", default-features=false, features=["json", "rustls-tls"]}
image = { version = "0.25.2", features = ["png"] } image = { version = "0.25.2", features = ["png"] }
log = "0.4.22" log = "0.4.22"
num-format = { version = "0.4.4", default-features = false } num-format = { version = "0.4.4", default-features = false }
once_cell = "1.19.0" once_cell = "1.19.0"
portable-pty = "0.8.1" portable-pty = "0.8.1"
rand = "0.8.5" rand = "0.8.5"
regex = { version = "1.10.5", default-features = false, features = ["perf"] } regex = { version = "1.10.6", default-features = false, features = ["perf"] }
rfd = "0.14.1" rfd = "0.14.1"
serde = { version = "1.0.204", features = ["rc", "derive"] } serde = { version = "1.0.208", features = ["rc", "derive"] }
serde_json = "1.0.120" serde_json = "1.0.125"
sysinfo = { version = "0.30.13", default-features = false } sysinfo = { version = "0.31.2", default-features = false, features=["system"] }
# tls-api = "0.9.0" # tls-api = "0.9.0"
tokio = { version = "1.39.1", features = ["rt", "time", "macros", "process", "rt-multi-thread"] } tokio = { version = "1.39.3", features = ["rt", "time", "macros", "process", "rt-multi-thread"] }
toml = { version = "0.8.15", features = ["preserve_order"] } toml = { version = "0.8.19", features = ["preserve_order"] }
walkdir = "2.5.0" walkdir = "2.5.0"
zeroize = "1.8.1" zeroize = "1.8.1"
strsim = "0.11.1" strsim = "0.11.1"
strip-ansi-escapes = "0.2.0" strip-ansi-escapes = "0.2.0"
derive_more = {version="0.99.18", default-features=false, features=["display"]} derive_more = {version="1.0.0", default-features=false, features=["display"]}
serde-this-or-that = "0.4.2" serde-this-or-that = "0.4.2"
readable = "0.16" readable = "0.16"
chrono = {version="0.4.38", default-features=false, features=["clock", "std"]} chrono = {version="0.4.38", default-features=false, features=["clock", "std"]}
@ -77,15 +77,15 @@ enclose = "1.2.0"
bounded-vec-deque = {version="0.1.1", default-features=false} bounded-vec-deque = {version="0.1.1", default-features=false}
cfg-if = "1.0" cfg-if = "1.0"
flexi_logger = "0.28" flexi_logger = "0.28"
# eframe = { version = "0.28.1", features = ["wgpu"] }
eframe = {git="https://github.com/emilk/egui", rev="9a1e358", features=["wgpu"]}
# Unix dependencies # Unix dependencies
[target.'cfg(unix)'.dependencies] [target.'cfg(unix)'.dependencies]
eframe = { version = "0.27.2", features = ["wgpu"] }
tar = "0.4.41" tar = "0.4.41"
flate2 = "1.0" flate2 = "1.0"
sudo = "0.6.0" sudo = "0.6.0"
# macOS # macOS
[target.'cfg(target_os = "macos")'.dependencies] [target.'cfg(target_os = "macos")'.dependencies]
eframe = { version = "0.27.2", features = ["wgpu"] }
# On apple-darwin targets there is an issue with the native and rustls # On apple-darwin targets there is an issue with the native and rustls
# tls implementation so this makes it fall back to the openssl variant. # tls implementation so this makes it fall back to the openssl variant.
# #
@ -99,7 +99,7 @@ eframe = { version = "0.27.2", features = ["wgpu"] }
# linked as well which causes problems, so statically link it. # linked as well which causes problems, so statically link it.
lzma-sys = { version = "0.1", features = ["static"] } lzma-sys = { version = "0.1", features = ["static"] }
[dev-dependencies] [dev-dependencies]
egui = {version = "0.27.2", features=["callstack"]} egui = {git="https://github.com/emilk/egui", rev="9a1e358", features=["callstack"]}
# [target.'cfg(not(target_os = "macos"))'.dependencies] # [target.'cfg(not(target_os = "macos"))'.dependencies]
# tls-api-native-tls = "0.9.0" # tls-api-native-tls = "0.9.0"
@ -107,11 +107,10 @@ egui = {version = "0.27.2", features=["callstack"]}
# Windows dependencies # Windows dependencies
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
# glow start on windows but not wgpu # glow start on windows but not wgpu
eframe = { version = "0.27.2", features = ["wgpu"] }
# need the same version that eframe is using with egui_wgpu # need the same version that eframe is using with egui_wgpu
# feature angle to enable support for old cpu on Windows # feature angle to enable support for old cpu on Windows
wgpu = {version = "0.19.4", features=["angle"]} wgpu = {version = "22.1.0", features=["angle"]}
zip = "2.1.5" zip = "2.2.0"
is_elevated = "0.1.2" is_elevated = "0.1.2"
# For Windows build (icon) # For Windows build (icon)

View file

@ -147,7 +147,7 @@ impl crate::app::App {
} }
fn save_reset_ui(&mut self, ui: &mut Ui, size: Vec2, key: &KeyPressed, wants_input: bool) { fn save_reset_ui(&mut self, ui: &mut Ui, size: Vec2, key: &KeyPressed, wants_input: bool) {
ui.group(|ui| { ui.group(|ui| {
ui.set_enabled(self.diff); ui.add_enabled_ui(self.diff, |ui| {
let width = size.x / 2.0; let width = size.x / 2.0;
let size = vec2(width, size.y); let size = vec2(width, size.y);
if key.is_r() && !wants_input && self.diff if key.is_r() && !wants_input && self.diff
@ -207,6 +207,7 @@ impl crate::app::App {
), ),
}; };
} }
})
}); });
} }
fn status_submenu(&mut self, ui: &mut Ui, height: f32) { fn status_submenu(&mut self, ui: &mut Ui, height: f32) {
@ -378,7 +379,7 @@ impl crate::app::App {
ui_enabled = false; ui_enabled = false;
text = format!("Error: {}", P2POOL_PATH_NOT_VALID); text = format!("Error: {}", P2POOL_PATH_NOT_VALID);
} }
ui.set_enabled(ui_enabled); ui.add_enabled_ui(ui_enabled, |ui| {
let color = if ui_enabled { GREEN } else { RED }; let color = if ui_enabled { GREEN } else { RED };
if (ui_enabled && key.is_up() && !wants_input) if (ui_enabled && key.is_up() && !wants_input)
|| ui || ui
@ -396,6 +397,7 @@ impl crate::app::App {
self.gather_backup_hosts(), self.gather_backup_hosts(),
); );
} }
});
} }
}); });
} }
@ -529,7 +531,7 @@ impl crate::app::App {
ui_enabled = false; ui_enabled = false;
text = format!("Error: {}", XMRIG_PATH_NOT_VALID); text = format!("Error: {}", XMRIG_PATH_NOT_VALID);
} }
ui.set_enabled(ui_enabled); ui.add_enabled_ui(ui_enabled, |ui| {
let color = if ui_enabled { GREEN } else { RED }; let color = if ui_enabled { GREEN } else { RED };
if (ui_enabled && key.is_up() && !wants_input) if (ui_enabled && key.is_up() && !wants_input)
|| ui || ui
@ -552,6 +554,7 @@ impl crate::app::App {
self.error_state.ask_sudo(&self.sudo); self.error_state.ask_sudo(&self.sudo);
} }
} }
});
} }
}); });
} }
@ -637,7 +640,7 @@ impl crate::app::App {
let ui_enabled = Regexes::addr_ok(&self.state.p2pool.address) let ui_enabled = Regexes::addr_ok(&self.state.p2pool.address)
&& self.state.xvb.token.len() == 9 && self.state.xvb.token.len() == 9
&& self.state.xvb.token.parse::<u32>().is_ok(); && self.state.xvb.token.parse::<u32>().is_ok();
ui.set_enabled(ui_enabled); ui.add_enabled_ui(ui_enabled, |ui| {
let color = if ui_enabled { GREEN } else { RED }; let color = if ui_enabled { GREEN } else { RED };
if (ui_enabled && key.is_up() && !wants_input) if (ui_enabled && key.is_up() && !wants_input)
|| ui || ui
@ -654,6 +657,7 @@ impl crate::app::App {
&self.state.xmrig_proxy, &self.state.xmrig_proxy,
); );
} }
});
} }
}); });
} }
@ -726,7 +730,7 @@ impl crate::app::App {
ui_enabled = false; ui_enabled = false;
text = format!("Error: {}", XMRIG_PROXY_PATH_NOT_VALID); text = format!("Error: {}", XMRIG_PROXY_PATH_NOT_VALID);
} }
ui.set_enabled(ui_enabled); ui.add_enabled_ui(ui_enabled, |ui| {
let color = if ui_enabled { GREEN } else { RED }; let color = if ui_enabled { GREEN } else { RED };
if (ui_enabled && key.is_up() && !wants_input) if (ui_enabled && key.is_up() && !wants_input)
|| ui || ui
@ -744,6 +748,7 @@ impl crate::app::App {
&self.state.gupax.absolute_xp_path, &self.state.gupax.absolute_xp_path,
); );
} }
});
} }
}); });
} }

View file

@ -45,23 +45,31 @@ impl Gupax {
// If [Gupax] is being built for a Linux distro, // If [Gupax] is being built for a Linux distro,
// disable built-in updating completely. // disable built-in updating completely.
#[cfg(feature = "distro")] #[cfg(feature = "distro")]
ui.set_enabled(false); ui.disable(true);
#[cfg(feature = "distro")] #[cfg(feature = "distro")]
ui.add_sized([width, button], Button::new("Updates are disabled")) ui.add_sized([width, button], Button::new("Updates are disabled"))
.on_disabled_hover_text(DISTRO_NO_UPDATE); .on_disabled_hover_text(DISTRO_NO_UPDATE);
#[cfg(not(feature = "distro"))] #[cfg(not(feature = "distro"))]
ui.set_enabled(!updating && *lock!(restart) == Restart::No); ui.add_enabled_ui(!updating && *lock!(restart) == Restart::No, |ui| {
#[cfg(not(feature = "distro"))] #[cfg(not(feature = "distro"))]
if ui if ui
.add_sized([width, button], Button::new("Check for updates")) .add_sized([width, button], Button::new("Check for updates"))
.on_hover_text(GUPAX_UPDATE) .on_hover_text(GUPAX_UPDATE)
.clicked() .clicked()
{ {
Update::spawn_thread(og, self, state_path, update, error_state, restart); Update::spawn_thread(
og,
self,
state_path,
update,
error_state,
restart,
);
} }
}); });
});
ui.vertical(|ui| { ui.vertical(|ui| {
ui.set_enabled(updating); ui.add_enabled_ui(updating, |ui| {
let prog = *lock2!(update, prog); let prog = *lock2!(update, prog);
let msg = format!("{}\n{}{}", *lock2!(update, msg), prog, "%"); let msg = format!("{}\n{}{}", *lock2!(update, msg), prog, "%");
ui.add_sized([width, height * 1.4], Label::new(RichText::new(msg))); ui.add_sized([width, height * 1.4], Label::new(RichText::new(msg)));
@ -75,6 +83,7 @@ impl Gupax {
ui.add_sized(size, ProgressBar::new(lock2!(update, prog).round() / 100.0)); ui.add_sized(size, ProgressBar::new(lock2!(update, prog).round() / 100.0));
}); });
}); });
});
debug!("Gupaxx Tab | Rendering bool buttons"); debug!("Gupaxx Tab | Rendering bool buttons");
ui.horizontal(|ui| { ui.horizontal(|ui| {
@ -165,7 +174,7 @@ impl Gupax {
.on_hover_text(P2POOL_PATH_OK); .on_hover_text(P2POOL_PATH_OK);
} }
ui.spacing_mut().text_edit_width = ui.available_width() - SPACE; ui.spacing_mut().text_edit_width = ui.available_width() - SPACE;
ui.set_enabled(!lock!(file_window).thread); ui.add_enabled_ui(!lock!(file_window).thread, |ui| {
if ui.button("Open").on_hover_text(GUPAX_SELECT).clicked() { if ui.button("Open").on_hover_text(GUPAX_SELECT).clicked() {
Self::spawn_file_window_thread(file_window, FileType::P2pool); Self::spawn_file_window_thread(file_window, FileType::P2pool);
} }
@ -175,6 +184,7 @@ impl Gupax {
) )
.on_hover_text(GUPAX_PATH_P2POOL); .on_hover_text(GUPAX_PATH_P2POOL);
}); });
});
ui.horizontal(|ui| { ui.horizontal(|ui| {
if self.xmrig_path.is_empty() { if self.xmrig_path.is_empty() {
ui.add_sized( ui.add_sized(
@ -202,7 +212,7 @@ impl Gupax {
.on_hover_text(XMRIG_PATH_OK); .on_hover_text(XMRIG_PATH_OK);
} }
ui.spacing_mut().text_edit_width = ui.available_width() - SPACE; ui.spacing_mut().text_edit_width = ui.available_width() - SPACE;
ui.set_enabled(!lock!(file_window).thread); ui.add_enabled_ui(!lock!(file_window).thread, |ui| {
if ui.button("Open").on_hover_text(GUPAX_SELECT).clicked() { if ui.button("Open").on_hover_text(GUPAX_SELECT).clicked() {
Self::spawn_file_window_thread(file_window, FileType::Xmrig); Self::spawn_file_window_thread(file_window, FileType::Xmrig);
} }
@ -212,6 +222,7 @@ impl Gupax {
) )
.on_hover_text(GUPAX_PATH_XMRIG); .on_hover_text(GUPAX_PATH_XMRIG);
}); });
});
ui.horizontal(|ui| { ui.horizontal(|ui| {
if self.xmrig_proxy_path.is_empty() { if self.xmrig_proxy_path.is_empty() {
ui.add_sized( ui.add_sized(
@ -241,7 +252,7 @@ impl Gupax {
.on_hover_text(XMRIG_PROXY_PATH_OK); .on_hover_text(XMRIG_PROXY_PATH_OK);
} }
ui.spacing_mut().text_edit_width = ui.available_width() - SPACE; ui.spacing_mut().text_edit_width = ui.available_width() - SPACE;
ui.set_enabled(!lock!(file_window).thread); ui.add_enabled_ui(!lock!(file_window).thread, |ui| {
if ui.button("Open").on_hover_text(GUPAX_SELECT).clicked() { if ui.button("Open").on_hover_text(GUPAX_SELECT).clicked() {
Self::spawn_file_window_thread(file_window, FileType::XmrigProxy); Self::spawn_file_window_thread(file_window, FileType::XmrigProxy);
} }
@ -252,6 +263,7 @@ impl Gupax {
.on_hover_text(GUPAX_PATH_XMRIG_PROXY); .on_hover_text(GUPAX_PATH_XMRIG_PROXY);
}); });
}); });
});
let mut guard = lock!(file_window); let mut guard = lock!(file_window);
if guard.picked_p2pool { if guard.picked_p2pool {
self.p2pool_path.clone_from(&guard.p2pool_path); self.p2pool_path.clone_from(&guard.p2pool_path);
@ -365,7 +377,7 @@ impl Gupax {
let height = height / 3.5; let height = height / 3.5;
let size = vec2(width, height); let size = vec2(width, height);
ui.horizontal(|ui| { ui.horizontal(|ui| {
ui.set_enabled(self.ratio != Ratio::Height); ui.add_enabled_ui(self.ratio != Ratio::Height, |ui| {
ui.add_sized( ui.add_sized(
size, size,
Label::new(format!( Label::new(format!(
@ -382,8 +394,9 @@ impl Gupax {
) )
.on_hover_text(GUPAX_WIDTH); .on_hover_text(GUPAX_WIDTH);
}); });
});
ui.horizontal(|ui| { ui.horizontal(|ui| {
ui.set_enabled(self.ratio != Ratio::Width); ui.add_enabled_ui(self.ratio != Ratio::Width, |ui| {
ui.add_sized( ui.add_sized(
size, size,
Label::new(format!( Label::new(format!(
@ -400,6 +413,7 @@ impl Gupax {
) )
.on_hover_text(GUPAX_HEIGHT); .on_hover_text(GUPAX_HEIGHT);
}); });
});
ui.horizontal(|ui| { ui.horizontal(|ui| {
ui.add_sized( ui.add_sized(
size, size,

View file

@ -154,7 +154,7 @@ impl P2pool {
let text = format!("{}\n Currently selected node: {}. {}\n Current amount of nodes: {}/1000", text, self.selected_index+1, self.selected_name, node_vec_len); let text = format!("{}\n Currently selected node: {}. {}\n Current amount of nodes: {}/1000", text, self.selected_index+1, self.selected_name, node_vec_len);
// If the node already exists, show [Save] and mutate the already existing node // If the node already exists, show [Save] and mutate the already existing node
if exists { if exists {
ui.set_enabled(!incorrect_input && save_diff); ui.add_enabled_ui(!incorrect_input && save_diff, |ui|{
if ui.add_sized([width, text_edit], Button::new("Save")).on_hover_text(text).clicked() { if ui.add_sized([width, text_edit], Button::new("Save")).on_hover_text(text).clicked() {
let node = Node { let node = Node {
ip: self.ip.clone(), ip: self.ip.clone(),
@ -168,9 +168,10 @@ impl P2pool {
self.selected_zmq.clone_from(&self.zmq); self.selected_zmq.clone_from(&self.zmq);
info!("Node | S | [index: {}, name: \"{}\", ip: \"{}\", rpc: {}, zmq: {}]", existing_index+1, self.name, self.ip, self.rpc, self.zmq); info!("Node | S | [index: {}, name: \"{}\", ip: \"{}\", rpc: {}, zmq: {}]", existing_index+1, self.name, self.ip, self.rpc, self.zmq);
} }
});
// Else, add to the list // Else, add to the list
} else { } else {
ui.set_enabled(!incorrect_input && node_vec_len < 1000); ui.add_enabled_ui(!incorrect_input && node_vec_len < 1000, |ui| {
if ui.add_sized([width, text_edit], Button::new("Add")).on_hover_text(text).clicked() { if ui.add_sized([width, text_edit], Button::new("Add")).on_hover_text(text).clicked() {
let node = Node { let node = Node {
ip: self.ip.clone(), ip: self.ip.clone(),
@ -185,11 +186,12 @@ impl P2pool {
self.selected_zmq.clone_from(&self.zmq); self.selected_zmq.clone_from(&self.zmq);
info!("Node | A | [index: {}, name: \"{}\", ip: \"{}\", rpc: {}, zmq: {}]", node_vec_len, self.name, self.ip, self.rpc, self.zmq); info!("Node | A | [index: {}, name: \"{}\", ip: \"{}\", rpc: {}, zmq: {}]", node_vec_len, self.name, self.ip, self.rpc, self.zmq);
} }
});
} }
}); });
// [Delete] // [Delete]
ui.horizontal(|ui| { ui.horizontal(|ui| {
ui.set_enabled(node_vec_len > 1); ui.add_enabled_ui(node_vec_len > 1, |ui|{
let text = format!("{}\n Currently selected node: {}. {}\n Current amount of nodes: {}/1000", LIST_DELETE, self.selected_index+1, self.selected_name, node_vec_len); let text = format!("{}\n Currently selected node: {}. {}\n Current amount of nodes: {}/1000", LIST_DELETE, self.selected_index+1, self.selected_name, node_vec_len);
if ui.add_sized([width, text_edit], Button::new("Delete")).on_hover_text(text).clicked() { if ui.add_sized([width, text_edit], Button::new("Delete")).on_hover_text(text).clicked() {
let new_name; let new_name;
@ -218,14 +220,17 @@ impl P2pool {
info!("Node | D | [index: {}, name: \"{}\", ip: \"{}\", rpc: {}, zmq: {}]", self.selected_index, self.selected_name, self.selected_ip, self.selected_rpc, self.selected_zmq); info!("Node | D | [index: {}, name: \"{}\", ip: \"{}\", rpc: {}, zmq: {}]", self.selected_index, self.selected_name, self.selected_ip, self.selected_rpc, self.selected_zmq);
} }
}); });
});
ui.horizontal(|ui| { ui.horizontal(|ui| {
ui.set_enabled(!self.name.is_empty() || !self.ip.is_empty() || !self.rpc.is_empty() || !self.zmq.is_empty()); ui.add_enabled_ui(!self.name.is_empty() || !self.ip.is_empty() || !self.rpc.is_empty() || !self.zmq.is_empty(), |ui|{
if ui.add_sized([width, text_edit], Button::new("Clear")).on_hover_text(LIST_CLEAR).clicked() { if ui.add_sized([width, text_edit], Button::new("Clear")).on_hover_text(LIST_CLEAR).clicked() {
self.name.clear(); self.name.clear();
self.ip.clear(); self.ip.clear();
self.rpc.clear(); self.rpc.clear();
self.zmq.clear(); self.zmq.clear();
} }
});
}); });
}); });
}); });

View file

@ -130,7 +130,9 @@ impl P2pool {
self.arguments.truncate(1024); self.arguments.truncate(1024);
}) })
}); });
ui.set_enabled(self.arguments.is_empty()); if !self.arguments.is_empty() {
ui.disable()
}
} }
//---------------------------------------------------------------------------------------------------- Address //---------------------------------------------------------------------------------------------------- Address

View file

@ -138,7 +138,7 @@ impl P2pool {
ui.vertical(|ui| { ui.vertical(|ui| {
let height = height / 2.0; let height = height / 2.0;
let pinging = lock!(ping).pinging; let pinging = lock!(ping).pinging;
ui.set_enabled(pinging); ui.add_enabled_ui(pinging, |ui| {
let prog = lock!(ping).prog.round(); let prog = lock!(ping).prog.round();
let msg = RichText::new(format!("{} ... {}%", lock!(ping).msg, prog)); let msg = RichText::new(format!("{} ... {}%", lock!(ping).msg, prog));
let height = height / 1.25; let height = height / 1.25;
@ -155,6 +155,7 @@ impl P2pool {
ui.add_space(space_h); ui.add_space(space_h);
}); });
}); });
});
debug!("P2Pool Tab | Rendering [Auto-*] buttons"); debug!("P2Pool Tab | Rendering [Auto-*] buttons");
ui.group(|ui| { ui.group(|ui| {

View file

@ -120,12 +120,13 @@ impl Status {
ui.add_sized([width, text], ProgressBar::new(percent / 100.0)); ui.add_sized([width, text], ProgressBar::new(percent / 100.0));
} }
} else { } else {
ui.set_enabled(xmrig_alive); ui.add_enabled_ui(xmrig_alive, |ui| {
ui.add_sized( ui.add_sized(
[width, double], [width, double],
Label::new("XMRig is offline. Hashrate cannot be determined."), Label::new("XMRig is offline. Hashrate cannot be determined."),
); );
ui.add_sized([width, text], ProgressBar::new(0.0)); ui.add_sized([width, text], ProgressBar::new(0.0));
});
} }
}); });

View file

@ -156,7 +156,7 @@ impl Status {
self.manual_hash = true; self.manual_hash = true;
} }
ui.separator(); ui.separator();
ui.set_enabled(self.manual_hash); ui.add_enabled_ui(self.manual_hash, |ui| {
if ui if ui
.add_sized( .add_sized(
[button, text], [button, text],
@ -206,10 +206,11 @@ impl Status {
[button * 14.0, text], [button * 14.0, text],
Slider::new(&mut self.hashrate, 1.0..=1_000.0), Slider::new(&mut self.hashrate, 1.0..=1_000.0),
); );
});
}) })
}); });
// Actual stats // Actual stats
ui.set_enabled(p2pool_alive); ui.add_enabled_ui(p2pool_alive, |ui| {
let text = height / 25.0; let text = height / 25.0;
let width = (width / 3.0) - (SPACE * 1.666); let width = (width / 3.0) - (SPACE * 1.666);
let min_height = ui.available_height() / 1.3; let min_height = ui.available_height() / 1.3;
@ -272,10 +273,15 @@ impl Status {
); );
ui.add_sized( ui.add_sized(
[width, text], [width, text],
Label::new(RichText::new("P2Pool Block Mean").underline().color(BONE)), Label::new(
RichText::new("P2Pool Block Mean").underline().color(BONE),
),
) )
.on_hover_text(STATUS_SUBMENU_P2POOL_BLOCK_MEAN); .on_hover_text(STATUS_SUBMENU_P2POOL_BLOCK_MEAN);
ui.add_sized([width, text], Label::new(api.p2pool_block_mean.to_string())); ui.add_sized(
[width, text],
Label::new(api.p2pool_block_mean.to_string()),
);
ui.add_sized( ui.add_sized(
[width, text], [width, text],
Label::new( Label::new(
@ -312,10 +318,15 @@ impl Status {
); );
ui.add_sized( ui.add_sized(
[width, text], [width, text],
Label::new(RichText::new("P2Pool Block Mean").underline().color(BONE)), Label::new(
RichText::new("P2Pool Block Mean").underline().color(BONE),
),
) )
.on_hover_text(STATUS_SUBMENU_P2POOL_BLOCK_MEAN); .on_hover_text(STATUS_SUBMENU_P2POOL_BLOCK_MEAN);
ui.add_sized([width, text], Label::new(api.p2pool_block_mean.to_string())); ui.add_sized(
[width, text],
Label::new(api.p2pool_block_mean.to_string()),
);
ui.add_sized( ui.add_sized(
[width, text], [width, text],
Label::new( Label::new(
@ -325,7 +336,10 @@ impl Status {
), ),
) )
.on_hover_text(STATUS_SUBMENU_P2POOL_SHARE_MEAN); .on_hover_text(STATUS_SUBMENU_P2POOL_SHARE_MEAN);
ui.add_sized([width, text], Label::new(api.p2pool_share_mean.to_string())); ui.add_sized(
[width, text],
Label::new(api.p2pool_share_mean.to_string()),
);
ui.add_sized( ui.add_sized(
[width, text], [width, text],
Label::new( Label::new(
@ -335,7 +349,10 @@ impl Status {
), ),
) )
.on_hover_text(STATUS_SUBMENU_SOLO_BLOCK_MEAN); .on_hover_text(STATUS_SUBMENU_SOLO_BLOCK_MEAN);
ui.add_sized([width, text], Label::new(api.solo_block_mean.to_string())); ui.add_sized(
[width, text],
Label::new(api.solo_block_mean.to_string()),
);
} }
}) })
}); });
@ -345,10 +362,14 @@ impl Status {
if self.manual_hash { if self.manual_hash {
let hashrate = let hashrate =
Hash::convert_to_hash(self.hashrate, self.hash_metric) as u64; Hash::convert_to_hash(self.hashrate, self.hash_metric) as u64;
let user_p2pool_percent = let user_p2pool_percent = PubP2poolApi::calculate_dominance(
PubP2poolApi::calculate_dominance(hashrate, api.p2pool_hashrate_u64); hashrate,
let user_monero_percent = api.p2pool_hashrate_u64,
PubP2poolApi::calculate_dominance(hashrate, api.monero_hashrate_u64); );
let user_monero_percent = PubP2poolApi::calculate_dominance(
hashrate,
api.monero_hashrate_u64,
);
ui.add_sized( ui.add_sized(
[width, text], [width, text],
Label::new(RichText::new("P2Pool Miners").underline().color(BONE)), Label::new(RichText::new("P2Pool Miners").underline().color(BONE)),
@ -357,7 +378,9 @@ impl Status {
ui.add_sized([width, text], Label::new(api.miners.as_str())); ui.add_sized([width, text], Label::new(api.miners.as_str()));
ui.add_sized( ui.add_sized(
[width, text], [width, text],
Label::new(RichText::new("P2Pool Dominance").underline().color(BONE)), Label::new(
RichText::new("P2Pool Dominance").underline().color(BONE),
),
) )
.on_hover_text(STATUS_SUBMENU_P2POOL_DOMINANCE); .on_hover_text(STATUS_SUBMENU_P2POOL_DOMINANCE);
ui.add_sized([width, text], Label::new(api.p2pool_percent.as_str())); ui.add_sized([width, text], Label::new(api.p2pool_percent.as_str()));
@ -390,7 +413,9 @@ impl Status {
ui.add_sized([width, text], Label::new(api.miners.as_str())); ui.add_sized([width, text], Label::new(api.miners.as_str()));
ui.add_sized( ui.add_sized(
[width, text], [width, text],
Label::new(RichText::new("P2Pool Dominance").underline().color(BONE)), Label::new(
RichText::new("P2Pool Dominance").underline().color(BONE),
),
) )
.on_hover_text(STATUS_SUBMENU_P2POOL_DOMINANCE); .on_hover_text(STATUS_SUBMENU_P2POOL_DOMINANCE);
ui.add_sized([width, text], Label::new(api.p2pool_percent.as_str())); ui.add_sized([width, text], Label::new(api.p2pool_percent.as_str()));
@ -403,7 +428,10 @@ impl Status {
), ),
) )
.on_hover_text(STATUS_SUBMENU_YOUR_P2POOL_DOMINANCE); .on_hover_text(STATUS_SUBMENU_YOUR_P2POOL_DOMINANCE);
ui.add_sized([width, text], Label::new(api.user_p2pool_percent.as_str())); ui.add_sized(
[width, text],
Label::new(api.user_p2pool_percent.as_str()),
);
ui.add_sized( ui.add_sized(
[width, text], [width, text],
Label::new( Label::new(
@ -413,7 +441,10 @@ impl Status {
), ),
) )
.on_hover_text(STATUS_SUBMENU_YOUR_MONERO_DOMINANCE); .on_hover_text(STATUS_SUBMENU_YOUR_MONERO_DOMINANCE);
ui.add_sized([width, text], Label::new(api.user_monero_percent.as_str())); ui.add_sized(
[width, text],
Label::new(api.user_monero_percent.as_str()),
);
} }
}) })
}); });
@ -425,5 +456,6 @@ impl Status {
) )
.on_hover_text(STATUS_SUBMENU_PROGRESS_BAR); .on_hover_text(STATUS_SUBMENU_PROGRESS_BAR);
drop(api); drop(api);
});
} }
} }

View file

@ -142,7 +142,7 @@ fn p2pool(
ui.set_min_height(min_size.y * 34.0); ui.set_min_height(min_size.y * 34.0);
ui.set_min_size(min_size); ui.set_min_size(min_size);
debug!("Status Tab | Rendering [P2Pool]"); debug!("Status Tab | Rendering [P2Pool]");
ui.set_enabled(p2pool_alive); ui.add_enabled_ui(p2pool_alive, |ui| {
ui.add_sized( ui.add_sized(
size, size,
Label::new( Label::new(
@ -271,6 +271,7 @@ fn p2pool(
ui.add_sized(size, Label::new(&img.address)); ui.add_sized(size, Label::new(&img.address));
drop(img); drop(img);
drop(api); drop(api);
});
}) })
}) })
}); });
@ -287,7 +288,7 @@ fn xmrig_proxy(
ui.vertical(|ui| { ui.vertical(|ui| {
ui.set_min_height(min_size.y * 34.0); ui.set_min_height(min_size.y * 34.0);
debug!("Status Tab | Rendering [XMRig-Proxy]"); debug!("Status Tab | Rendering [XMRig-Proxy]");
ui.set_enabled(xmrig_proxy_alive); ui.add_enabled_ui(xmrig_proxy_alive, |ui| {
ui.set_min_size(min_size); ui.set_min_size(min_size);
ui.add_sized( ui.add_sized(
size, size,
@ -340,6 +341,7 @@ fn xmrig_proxy(
.on_hover_text(STATUS_XMRIG_PROXY_POOL); .on_hover_text(STATUS_XMRIG_PROXY_POOL);
ui.add_sized(size, Label::new(api.node.to_string())); ui.add_sized(size, Label::new(api.node.to_string()));
drop(api); drop(api);
});
}) })
}); });
} }
@ -359,7 +361,7 @@ fn xmrig(
ui.set_min_height(min_size.y * 34.0); ui.set_min_height(min_size.y * 34.0);
ui.spacing_mut().item_spacing = Vec2::new(2.0, 2.0); ui.spacing_mut().item_spacing = Vec2::new(2.0, 2.0);
debug!("Status Tab | Rendering [XMRig]"); debug!("Status Tab | Rendering [XMRig]");
ui.set_enabled(xmrig_alive); ui.add_enabled_ui(xmrig_alive, |ui| {
// ui.set_min_size(min_size); // ui.set_min_size(min_size);
ui.add_sized( ui.add_sized(
size, size,
@ -423,6 +425,7 @@ fn xmrig(
Label::new(format!("{}/{}", &lock!(xmrig_img).threads, max_threads)), Label::new(format!("{}/{}", &lock!(xmrig_img).threads, max_threads)),
); );
drop(api); drop(api);
});
}) })
// }) // })
}); });
@ -437,7 +440,8 @@ fn xvb(ui: &mut Ui, min_size: Vec2, size: Vec2, xvb_alive: bool, xvb_api: &Arc<M
ui.set_min_height(min_size.y * 34.0); ui.set_min_height(min_size.y * 34.0);
ui.vertical(|ui| { ui.vertical(|ui| {
debug!("Status Tab | Rendering [XvB]"); debug!("Status Tab | Rendering [XvB]");
ui.set_enabled(enabled); // for now there is no API ping or /health, so we verify if the field reward_yearly is empty or not. ui.add_enabled_ui(enabled, |ui| {
// for now there is no API ping or /health, so we verify if the field reward_yearly is empty or not.
// ui.set_min_size(min_size); // ui.set_min_size(min_size);
ui.add_sized( ui.add_sized(
size, size,
@ -544,6 +548,7 @@ fn xvb(ui: &mut Ui, min_size: Vec2, size: Vec2, xvb_alive: bool, xvb_api: &Arc<M
)), )),
); );
} }
});
}) })
// by round // by round
}); });

View file

@ -119,7 +119,8 @@ impl Xmrig {
self.arguments.truncate(1024); self.arguments.truncate(1024);
}) })
}); });
ui.set_enabled(self.arguments.is_empty()); ui.add_enabled_ui(self.arguments.is_empty(), |ui|{
//---------------------------------------------------------------------------------------------------- Address //---------------------------------------------------------------------------------------------------- Address
debug!("XMRig Tab | Rendering [Address]"); debug!("XMRig Tab | Rendering [Address]");
ui.group(|ui| { ui.group(|ui| {
@ -149,6 +150,7 @@ impl Xmrig {
.on_hover_text(XMRIG_ADDRESS); .on_hover_text(XMRIG_ADDRESS);
self.address.truncate(95); self.address.truncate(95);
}); });
});
} }
//---------------------------------------------------------------------------------------------------- Threads //---------------------------------------------------------------------------------------------------- Threads
@ -321,7 +323,7 @@ impl Xmrig {
let text = format!("{}\n Currently selected pool: {}. {}\n Current amount of pools: {}/1000", text, self.selected_index+1, self.selected_name, pool_vec_len); let text = format!("{}\n Currently selected pool: {}. {}\n Current amount of pools: {}/1000", text, self.selected_index+1, self.selected_name, pool_vec_len);
// If the pool already exists, show [Save] and mutate the already existing pool // If the pool already exists, show [Save] and mutate the already existing pool
if exists { if exists {
ui.set_enabled(!incorrect_input && save_diff); ui.add_enabled_ui(!incorrect_input && save_diff, |ui|{
if ui.add_sized([width, text_edit], Button::new("Save")).on_hover_text(text).clicked() { if ui.add_sized([width, text_edit], Button::new("Save")).on_hover_text(text).clicked() {
let pool = Pool { let pool = Pool {
rig: self.rig.clone(), rig: self.rig.clone(),
@ -335,9 +337,10 @@ impl Xmrig {
self.selected_port.clone_from(&self.port); self.selected_port.clone_from(&self.port);
info!("Node | S | [index: {}, name: \"{}\", ip: \"{}\", port: {}, rig: \"{}\"]", existing_index+1, self.name, self.ip, self.port, self.rig); info!("Node | S | [index: {}, name: \"{}\", ip: \"{}\", port: {}, rig: \"{}\"]", existing_index+1, self.name, self.ip, self.port, self.rig);
} }
});
// Else, add to the list // Else, add to the list
} else { } else {
ui.set_enabled(!incorrect_input && pool_vec_len < 1000); ui.add_enabled_ui(!incorrect_input && pool_vec_len < 1000, |ui|{
if ui.add_sized([width, text_edit], Button::new("Add")).on_hover_text(text).clicked() { if ui.add_sized([width, text_edit], Button::new("Add")).on_hover_text(text).clicked() {
let pool = Pool { let pool = Pool {
rig: self.rig.clone(), rig: self.rig.clone(),
@ -352,11 +355,12 @@ impl Xmrig {
self.selected_port.clone_from(&self.port); self.selected_port.clone_from(&self.port);
info!("Node | A | [index: {}, name: \"{}\", ip: \"{}\", port: {}, rig: \"{}\"]", pool_vec_len, self.name, self.ip, self.port, self.rig); info!("Node | A | [index: {}, name: \"{}\", ip: \"{}\", port: {}, rig: \"{}\"]", pool_vec_len, self.name, self.ip, self.port, self.rig);
} }
});
} }
}); });
// [Delete] // [Delete]
ui.horizontal(|ui| { ui.horizontal(|ui| {
ui.set_enabled(pool_vec_len > 1); ui.add_enabled_ui(pool_vec_len > 1, |ui|{
let text = format!("{}\n Currently selected pool: {}. {}\n Current amount of pools: {}/1000", LIST_DELETE, self.selected_index+1, self.selected_name, pool_vec_len); let text = format!("{}\n Currently selected pool: {}. {}\n Current amount of pools: {}/1000", LIST_DELETE, self.selected_index+1, self.selected_name, pool_vec_len);
if ui.add_sized([width, text_edit], Button::new("Delete")).on_hover_text(text).clicked() { if ui.add_sized([width, text_edit], Button::new("Delete")).on_hover_text(text).clicked() {
let new_name; let new_name;
@ -385,8 +389,10 @@ impl Xmrig {
info!("Node | D | [index: {}, name: \"{}\", ip: \"{}\", port: {}, rig\"{}\"]", self.selected_index, self.selected_name, self.selected_ip, self.selected_port, self.selected_rig); info!("Node | D | [index: {}, name: \"{}\", ip: \"{}\", port: {}, rig\"{}\"]", self.selected_index, self.selected_name, self.selected_ip, self.selected_port, self.selected_rig);
} }
}); });
});
ui.horizontal(|ui| { ui.horizontal(|ui| {
ui.set_enabled(!self.name.is_empty() || !self.ip.is_empty() || !self.port.is_empty()); ui.add_enabled_ui(!self.name.is_empty() || !self.ip.is_empty() || !self.port.is_empty(), |ui|{
if ui.add_sized([width, text_edit], Button::new("Clear")).on_hover_text(LIST_CLEAR).clicked() { if ui.add_sized([width, text_edit], Button::new("Clear")).on_hover_text(LIST_CLEAR).clicked() {
self.name.clear(); self.name.clear();
self.rig.clear(); self.rig.clear();
@ -397,6 +403,7 @@ impl Xmrig {
}); });
}); });
}); });
});
ui.add_space(5.0); ui.add_space(5.0);
debug!("XMRig Tab | Rendering [API] TextEdits"); debug!("XMRig Tab | Rendering [API] TextEdits");

View file

@ -109,7 +109,9 @@ impl XmrigProxy {
self.arguments.truncate(1024); self.arguments.truncate(1024);
}) })
}); });
ui.set_enabled(self.arguments.is_empty()); if !self.arguments.is_empty() {
ui.disable();
}
ui.add_space(space_h); ui.add_space(space_h);
ui.style_mut().spacing.icon_width_inner = width / 45.0; ui.style_mut().spacing.icon_width_inner = width / 45.0;
ui.style_mut().spacing.icon_width = width / 35.0; ui.style_mut().spacing.icon_width = width / 35.0;
@ -262,7 +264,7 @@ impl XmrigProxy {
let text = format!("{}\n Currently selected pool: {}. {}\n Current amount of pools: {}/1000", text, self.selected_index+1, self.selected_name, pool_vec_len); let text = format!("{}\n Currently selected pool: {}. {}\n Current amount of pools: {}/1000", text, self.selected_index+1, self.selected_name, pool_vec_len);
// If the pool already exists, show [Save] and mutate the already existing pool // If the pool already exists, show [Save] and mutate the already existing pool
if exists { if exists {
ui.set_enabled(!incorrect_input && save_diff); ui.add_enabled_ui(!incorrect_input && save_diff, |ui|{
if ui.add_sized([width, text_edit], Button::new("Save")).on_hover_text(text).clicked() { if ui.add_sized([width, text_edit], Button::new("Save")).on_hover_text(text).clicked() {
let pool = Pool { let pool = Pool {
rig: self.rig.clone(), rig: self.rig.clone(),
@ -276,9 +278,11 @@ impl XmrigProxy {
self.selected_port.clone_from(&self.p2pool_port); self.selected_port.clone_from(&self.p2pool_port);
info!("Node | S | [index: {}, name: \"{}\", ip: \"{}\", port: {}, rig: \"{}\"]", existing_index+1, self.name, self.p2pool_ip, self.p2pool_port, self.rig); info!("Node | S | [index: {}, name: \"{}\", ip: \"{}\", port: {}, rig: \"{}\"]", existing_index+1, self.name, self.p2pool_ip, self.p2pool_port, self.rig);
} }
});
// Else, add to the list // Else, add to the list
} else { } else {
ui.set_enabled(!incorrect_input && pool_vec_len < 1000); ui.add_enabled_ui(!incorrect_input && pool_vec_len < 1000, |ui|{
if ui.add_sized([width, text_edit], Button::new("Add")).on_hover_text(text).clicked() { if ui.add_sized([width, text_edit], Button::new("Add")).on_hover_text(text).clicked() {
let pool = Pool { let pool = Pool {
rig: self.rig.clone(), rig: self.rig.clone(),
@ -293,11 +297,13 @@ impl XmrigProxy {
self.selected_port.clone_from(&self.p2pool_port); self.selected_port.clone_from(&self.p2pool_port);
info!("Node | A | [index: {}, name: \"{}\", ip: \"{}\", port: {}, rig: \"{}\"]", pool_vec_len, self.name, self.p2pool_ip, self.p2pool_port, self.rig); info!("Node | A | [index: {}, name: \"{}\", ip: \"{}\", port: {}, rig: \"{}\"]", pool_vec_len, self.name, self.p2pool_ip, self.p2pool_port, self.rig);
} }
});
} }
}); });
// [Delete] // [Delete]
ui.horizontal(|ui| { ui.horizontal(|ui| {
ui.set_enabled(pool_vec_len > 1); ui.add_enabled_ui(pool_vec_len > 1, |ui|{
let text = format!("{}\n Currently selected pool: {}. {}\n Current amount of pools: {}/1000", LIST_DELETE, self.selected_index+1, self.selected_name, pool_vec_len); let text = format!("{}\n Currently selected pool: {}. {}\n Current amount of pools: {}/1000", LIST_DELETE, self.selected_index+1, self.selected_name, pool_vec_len);
if ui.add_sized([width, text_edit], Button::new("Delete")).on_hover_text(text).clicked() { if ui.add_sized([width, text_edit], Button::new("Delete")).on_hover_text(text).clicked() {
let new_name; let new_name;
@ -326,8 +332,9 @@ impl XmrigProxy {
info!("Node | D | [index: {}, name: \"{}\", ip: \"{}\", port: {}, rig\"{}\"]", self.selected_index, self.selected_name, self.selected_ip, self.selected_port, self.selected_rig); info!("Node | D | [index: {}, name: \"{}\", ip: \"{}\", port: {}, rig\"{}\"]", self.selected_index, self.selected_name, self.selected_ip, self.selected_port, self.selected_rig);
} }
}); });
});
ui.horizontal(|ui| { ui.horizontal(|ui| {
ui.set_enabled(!self.name.is_empty() || !self.p2pool_ip.is_empty() || !self.p2pool_port.is_empty()); ui.add_enabled_ui(!self.name.is_empty() || !self.p2pool_ip.is_empty() || !self.p2pool_port.is_empty(), |ui|{
if ui.add_sized([width, text_edit], Button::new("Clear")).on_hover_text(LIST_CLEAR).clicked() { if ui.add_sized([width, text_edit], Button::new("Clear")).on_hover_text(LIST_CLEAR).clicked() {
self.name.clear(); self.name.clear();
self.rig.clear(); self.rig.clear();
@ -338,6 +345,7 @@ impl XmrigProxy {
}); });
}); });
}); });
});
ui.add_space(5.0); ui.add_space(5.0);
debug!("XMRig Tab | Rendering [API] TextEdits"); debug!("XMRig Tab | Rendering [API] TextEdits");

View file

@ -281,7 +281,7 @@ impl crate::app::App {
let hide = sudo.hide; let hide = sudo.hide;
if sudo.testing { if sudo.testing {
ui.add_sized([width, height], Spinner::new().size(height)); ui.add_sized([width, height], Spinner::new().size(height));
ui.set_enabled(false); ui.disable()
} else { } else {
ui.add_sized([width, height], Label::new(&sudo.msg)); ui.add_sized([width, height], Label::new(&sudo.msg));
} }

View file

@ -512,7 +512,10 @@ impl Helper {
// 2. Selectively refresh [sysinfo] for only what we need (better performance). // 2. Selectively refresh [sysinfo] for only what we need (better performance).
sysinfo.refresh_cpu_specifics(sysinfo_cpu); sysinfo.refresh_cpu_specifics(sysinfo_cpu);
debug!("Helper | Sysinfo refresh (1/3) ... [cpu]"); debug!("Helper | Sysinfo refresh (1/3) ... [cpu]");
sysinfo.refresh_processes_specifics(sysinfo_processes); sysinfo.refresh_processes_specifics(
sysinfo::ProcessesToUpdate::All,
sysinfo_processes,
);
debug!("Helper | Sysinfo refresh (2/3) ... [processes]"); debug!("Helper | Sysinfo refresh (2/3) ... [processes]");
sysinfo.refresh_memory(); sysinfo.refresh_memory();
debug!("Helper | Sysinfo refresh (3/3) ... [memory]"); debug!("Helper | Sysinfo refresh (3/3) ... [memory]");

View file

@ -18,14 +18,14 @@ use crate::{
use super::PubXvbApi; use super::PubXvbApi;
#[derive(Copy, Clone, Debug, Default, PartialEq, Display)] #[derive(Copy, Clone, Debug, Default, PartialEq, Display)]
pub enum XvbNode { pub enum XvbNode {
#[display(fmt = "XvB North America Node")] #[display("XvB North America Node")]
NorthAmerica, NorthAmerica,
#[default] #[default]
#[display(fmt = "XvB European Node")] #[display("XvB European Node")]
Europe, Europe,
#[display(fmt = "Local P2pool")] #[display("Local P2pool")]
P2pool, P2pool,
#[display(fmt = "Xmrig Proxy")] #[display("Xmrig Proxy")]
XmrigProxy, XmrigProxy,
} }
impl XvbNode { impl XvbNode {

View file

@ -12,18 +12,18 @@ use super::PubXvbApi;
#[derive(Debug, Clone, Default, Display, Deserialize, PartialEq)] #[derive(Debug, Clone, Default, Display, Deserialize, PartialEq)]
pub enum XvbRound { pub enum XvbRound {
#[default] #[default]
#[display(fmt = "VIP")] #[display("VIP")]
#[serde(alias = "vip")] #[serde(alias = "vip")]
Vip, Vip,
#[serde(alias = "donor")] #[serde(alias = "donor")]
Donor, Donor,
#[display(fmt = "VIP Donor")] #[display("VIP Donor")]
#[serde(alias = "donor_vip")] #[serde(alias = "donor_vip")]
DonorVip, DonorVip,
#[display(fmt = "Whale Donor")] #[display("Whale Donor")]
#[serde(alias = "donor_whale")] #[serde(alias = "donor_whale")]
DonorWhale, DonorWhale,
#[display(fmt = "Mega Donor")] #[display("Mega Donor")]
#[serde(alias = "donor_mega")] #[serde(alias = "donor_mega")]
DonorMega, DonorMega,
} }

View file

@ -125,8 +125,6 @@ pub fn init_options(initial_window_size: Option<Vec2>) -> NativeOptions {
options.viewport.min_inner_size = Some(Vec2::new(APP_MIN_WIDTH, APP_MIN_HEIGHT)); options.viewport.min_inner_size = Some(Vec2::new(APP_MIN_WIDTH, APP_MIN_HEIGHT));
options.viewport.max_inner_size = Some(Vec2::new(APP_MAX_WIDTH, APP_MAX_HEIGHT)); options.viewport.max_inner_size = Some(Vec2::new(APP_MAX_WIDTH, APP_MAX_HEIGHT));
options.viewport.inner_size = initial_window_size; options.viewport.inner_size = initial_window_size;
options.follow_system_theme = false;
options.default_theme = eframe::Theme::Dark;
let icon = image::load_from_memory(BYTES_ICON) let icon = image::load_from_memory(BYTES_ICON)
.expect("Failed to read icon bytes") .expect("Failed to read icon bytes")
.to_rgba8(); .to_rgba8();

View file

@ -20,10 +20,10 @@
// Only (windows|macos|linux) + (x64|arm64) are supported. // Only (windows|macos|linux) + (x64|arm64) are supported.
#[cfg(not(target_pointer_width = "64"))] #[cfg(not(target_pointer_width = "64"))]
compile_error!("gupax is only compatible with 64-bit CPUs"); compile_error!("gupaxx is only compatible with 64-bit CPUs");
#[cfg(not(any(target_os = "windows", target_os = "macos", target_os = "linux",)))] #[cfg(not(any(target_os = "windows", target_os = "macos", target_os = "linux",)))]
compile_error!("gupax is only built for windows/macos/linux"); compile_error!("gupaxx is only built for windows/macos/linux");
use crate::app::App; use crate::app::App;
use crate::cli::Cli; use crate::cli::Cli;
@ -96,7 +96,7 @@ fn main() {
options, options,
Box::new(move |cc| { Box::new(move |cc| {
egui_extras::install_image_loaders(&cc.egui_ctx); egui_extras::install_image_loaders(&cc.egui_ctx);
Box::new(App::cc(cc, resolution, app)) Ok(Box::new(App::cc(cc, resolution, app)))
}), }),
) )
.unwrap(); .unwrap();