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"]}
anyhow = "1.0.86"
benri = "0.1.12"
bytes = "1.6.1"
bytes = "1.7.1"
dirs = "5.0.1"
#--------------------------------------------------------------------------------
egui = "0.27.2"
egui_extras = { version = "0.27.2", features = ["image"] }
egui = {git="https://github.com/emilk/egui", rev="9a1e358"}
egui_extras = {git="https://github.com/emilk/egui", rev="9a1e358", features = ["image"] }
## 2023-12-28: https://github.com/hinto-janai/gupax/issues/68
##
## 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).
#--------------------------------------------------------------------------------
env_logger = "0.11.4"
env_logger = "0.11.5"
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"] }
log = "0.4.22"
num-format = { version = "0.4.4", default-features = false }
once_cell = "1.19.0"
portable-pty = "0.8.1"
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"
serde = { version = "1.0.204", features = ["rc", "derive"] }
serde_json = "1.0.120"
sysinfo = { version = "0.30.13", default-features = false }
serde = { version = "1.0.208", features = ["rc", "derive"] }
serde_json = "1.0.125"
sysinfo = { version = "0.31.2", default-features = false, features=["system"] }
# tls-api = "0.9.0"
tokio = { version = "1.39.1", features = ["rt", "time", "macros", "process", "rt-multi-thread"] }
toml = { version = "0.8.15", features = ["preserve_order"] }
tokio = { version = "1.39.3", features = ["rt", "time", "macros", "process", "rt-multi-thread"] }
toml = { version = "0.8.19", features = ["preserve_order"] }
walkdir = "2.5.0"
zeroize = "1.8.1"
strsim = "0.11.1"
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"
readable = "0.16"
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}
cfg-if = "1.0"
flexi_logger = "0.28"
# eframe = { version = "0.28.1", features = ["wgpu"] }
eframe = {git="https://github.com/emilk/egui", rev="9a1e358", features=["wgpu"]}
# Unix dependencies
[target.'cfg(unix)'.dependencies]
eframe = { version = "0.27.2", features = ["wgpu"] }
tar = "0.4.41"
flate2 = "1.0"
sudo = "0.6.0"
# macOS
[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
# 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.
lzma-sys = { version = "0.1", features = ["static"] }
[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]
# tls-api-native-tls = "0.9.0"
@ -107,11 +107,10 @@ egui = {version = "0.27.2", features=["callstack"]}
# Windows dependencies
[target.'cfg(windows)'.dependencies]
# 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
# feature angle to enable support for old cpu on Windows
wgpu = {version = "0.19.4", features=["angle"]}
zip = "2.1.5"
wgpu = {version = "22.1.0", features=["angle"]}
zip = "2.2.0"
is_elevated = "0.1.2"
# For Windows build (icon)

View file

@ -147,66 +147,67 @@ impl crate::app::App {
}
fn save_reset_ui(&mut self, ui: &mut Ui, size: Vec2, key: &KeyPressed, wants_input: bool) {
ui.group(|ui| {
ui.set_enabled(self.diff);
let width = size.x / 2.0;
let size = vec2(width, size.y);
if key.is_r() && !wants_input && self.diff
|| ui
.add_sized(size, Button::new("Reset"))
.on_hover_text("Reset changes")
.clicked()
{
let og = lock!(self.og).clone();
self.state.status = og.status;
self.state.gupax = og.gupax;
self.state.p2pool = og.p2pool;
self.state.xmrig = og.xmrig;
self.state.xmrig_proxy = og.xmrig_proxy;
self.state.xvb = og.xvb;
self.node_vec.clone_from(&self.og_node_vec);
self.pool_vec.clone_from(&self.og_pool_vec);
}
if key.is_s() && !wants_input && self.diff
|| ui
.add_sized(size, Button::new("Save"))
.on_hover_text("Save changes")
.clicked()
{
match State::save(&mut self.state, &self.state_path) {
Ok(_) => {
let mut og = lock!(self.og);
og.status = self.state.status.clone();
og.gupax = self.state.gupax.clone();
og.p2pool = self.state.p2pool.clone();
og.xmrig = self.state.xmrig.clone();
og.xmrig_proxy = self.state.xmrig_proxy.clone();
og.xvb = self.state.xvb.clone();
}
Err(e) => {
self.error_state.set(
format!("State file: {}", e),
ui.add_enabled_ui(self.diff, |ui| {
let width = size.x / 2.0;
let size = vec2(width, size.y);
if key.is_r() && !wants_input && self.diff
|| ui
.add_sized(size, Button::new("Reset"))
.on_hover_text("Reset changes")
.clicked()
{
let og = lock!(self.og).clone();
self.state.status = og.status;
self.state.gupax = og.gupax;
self.state.p2pool = og.p2pool;
self.state.xmrig = og.xmrig;
self.state.xmrig_proxy = og.xmrig_proxy;
self.state.xvb = og.xvb;
self.node_vec.clone_from(&self.og_node_vec);
self.pool_vec.clone_from(&self.og_pool_vec);
}
if key.is_s() && !wants_input && self.diff
|| ui
.add_sized(size, Button::new("Save"))
.on_hover_text("Save changes")
.clicked()
{
match State::save(&mut self.state, &self.state_path) {
Ok(_) => {
let mut og = lock!(self.og);
og.status = self.state.status.clone();
og.gupax = self.state.gupax.clone();
og.p2pool = self.state.p2pool.clone();
og.xmrig = self.state.xmrig.clone();
og.xmrig_proxy = self.state.xmrig_proxy.clone();
og.xvb = self.state.xvb.clone();
}
Err(e) => {
self.error_state.set(
format!("State file: {}", e),
ErrorFerris::Error,
ErrorButtons::Okay,
);
}
};
match Node::save(&self.node_vec, &self.node_path) {
Ok(_) => self.og_node_vec.clone_from(&self.node_vec),
Err(e) => self.error_state.set(
format!("Node list: {}", e),
ErrorFerris::Error,
ErrorButtons::Okay,
);
}
};
match Node::save(&self.node_vec, &self.node_path) {
Ok(_) => self.og_node_vec.clone_from(&self.node_vec),
Err(e) => self.error_state.set(
format!("Node list: {}", e),
ErrorFerris::Error,
ErrorButtons::Okay,
),
};
match Pool::save(&self.pool_vec, &self.pool_path) {
Ok(_) => self.og_pool_vec.clone_from(&self.pool_vec),
Err(e) => self.error_state.set(
format!("Pool list: {}", e),
ErrorFerris::Error,
ErrorButtons::Okay,
),
};
}
),
};
match Pool::save(&self.pool_vec, &self.pool_path) {
Ok(_) => self.og_pool_vec.clone_from(&self.pool_vec),
Err(e) => self.error_state.set(
format!("Pool list: {}", e),
ErrorFerris::Error,
ErrorButtons::Okay,
),
};
}
})
});
}
fn status_submenu(&mut self, ui: &mut Ui, height: f32) {
@ -378,24 +379,25 @@ impl crate::app::App {
ui_enabled = false;
text = format!("Error: {}", P2POOL_PATH_NOT_VALID);
}
ui.set_enabled(ui_enabled);
let color = if ui_enabled { GREEN } else { RED };
if (ui_enabled && key.is_up() && !wants_input)
|| ui
.add_sized(size, Button::new(RichText::new("").color(color)))
.on_hover_text("Start P2Pool")
.on_disabled_hover_text(text)
.clicked()
{
let _ = lock!(self.og).update_absolute_path();
let _ = self.state.update_absolute_path();
Helper::start_p2pool(
&self.helper,
&self.state.p2pool,
&self.state.gupax.absolute_p2pool_path,
self.gather_backup_hosts(),
);
}
ui.add_enabled_ui(ui_enabled, |ui| {
let color = if ui_enabled { GREEN } else { RED };
if (ui_enabled && key.is_up() && !wants_input)
|| ui
.add_sized(size, Button::new(RichText::new("").color(color)))
.on_hover_text("Start P2Pool")
.on_disabled_hover_text(text)
.clicked()
{
let _ = lock!(self.og).update_absolute_path();
let _ = self.state.update_absolute_path();
Helper::start_p2pool(
&self.helper,
&self.state.p2pool,
&self.state.gupax.absolute_p2pool_path,
self.gather_backup_hosts(),
);
}
});
}
});
}
@ -529,29 +531,30 @@ impl crate::app::App {
ui_enabled = false;
text = format!("Error: {}", XMRIG_PATH_NOT_VALID);
}
ui.set_enabled(ui_enabled);
let color = if ui_enabled { GREEN } else { RED };
if (ui_enabled && key.is_up() && !wants_input)
|| ui
.add_sized(size, Button::new(RichText::new("").color(color)))
.on_hover_text("Start XMRig")
.on_disabled_hover_text(text)
.clicked()
{
let _ = lock!(self.og).update_absolute_path();
let _ = self.state.update_absolute_path();
if cfg!(windows) {
Helper::start_xmrig(
&self.helper,
&self.state.xmrig,
&self.state.gupax.absolute_xmrig_path,
Arc::clone(&self.sudo),
);
} else if cfg!(unix) {
lock!(self.sudo).signal = ProcessSignal::Start;
self.error_state.ask_sudo(&self.sudo);
ui.add_enabled_ui(ui_enabled, |ui| {
let color = if ui_enabled { GREEN } else { RED };
if (ui_enabled && key.is_up() && !wants_input)
|| ui
.add_sized(size, Button::new(RichText::new("").color(color)))
.on_hover_text("Start XMRig")
.on_disabled_hover_text(text)
.clicked()
{
let _ = lock!(self.og).update_absolute_path();
let _ = self.state.update_absolute_path();
if cfg!(windows) {
Helper::start_xmrig(
&self.helper,
&self.state.xmrig,
&self.state.gupax.absolute_xmrig_path,
Arc::clone(&self.sudo),
);
} else if cfg!(unix) {
lock!(self.sudo).signal = ProcessSignal::Start;
self.error_state.ask_sudo(&self.sudo);
}
}
}
});
}
});
}
@ -637,23 +640,24 @@ impl crate::app::App {
let ui_enabled = Regexes::addr_ok(&self.state.p2pool.address)
&& self.state.xvb.token.len() == 9
&& self.state.xvb.token.parse::<u32>().is_ok();
ui.set_enabled(ui_enabled);
let color = if ui_enabled { GREEN } else { RED };
if (ui_enabled && key.is_up() && !wants_input)
|| ui
.add_sized(size, Button::new(RichText::new("").color(color)))
.on_hover_text("Start Xvb")
.on_disabled_hover_text(XVB_NOT_CONFIGURED)
.clicked()
{
Helper::start_xvb(
&self.helper,
&self.state.xvb,
&self.state.p2pool,
&self.state.xmrig,
&self.state.xmrig_proxy,
);
}
ui.add_enabled_ui(ui_enabled, |ui| {
let color = if ui_enabled { GREEN } else { RED };
if (ui_enabled && key.is_up() && !wants_input)
|| ui
.add_sized(size, Button::new(RichText::new("").color(color)))
.on_hover_text("Start Xvb")
.on_disabled_hover_text(XVB_NOT_CONFIGURED)
.clicked()
{
Helper::start_xvb(
&self.helper,
&self.state.xvb,
&self.state.p2pool,
&self.state.xmrig,
&self.state.xmrig_proxy,
);
}
});
}
});
}
@ -726,24 +730,25 @@ impl crate::app::App {
ui_enabled = false;
text = format!("Error: {}", XMRIG_PROXY_PATH_NOT_VALID);
}
ui.set_enabled(ui_enabled);
let color = if ui_enabled { GREEN } else { RED };
if (ui_enabled && key.is_up() && !wants_input)
|| ui
.add_sized(size, Button::new(RichText::new("").color(color)))
.on_hover_text("Start XMRig-Proxy")
.on_disabled_hover_text(text)
.clicked()
{
let _ = lock!(self.og).update_absolute_path();
let _ = self.state.update_absolute_path();
Helper::start_xp(
&self.helper,
&self.state.xmrig_proxy,
&self.state.xmrig,
&self.state.gupax.absolute_xp_path,
);
}
ui.add_enabled_ui(ui_enabled, |ui| {
let color = if ui_enabled { GREEN } else { RED };
if (ui_enabled && key.is_up() && !wants_input)
|| ui
.add_sized(size, Button::new(RichText::new("").color(color)))
.on_hover_text("Start XMRig-Proxy")
.on_disabled_hover_text(text)
.clicked()
{
let _ = lock!(self.og).update_absolute_path();
let _ = self.state.update_absolute_path();
Helper::start_xp(
&self.helper,
&self.state.xmrig_proxy,
&self.state.xmrig,
&self.state.gupax.absolute_xp_path,
);
}
});
}
});
}

View file

@ -45,34 +45,43 @@ impl Gupax {
// If [Gupax] is being built for a Linux distro,
// disable built-in updating completely.
#[cfg(feature = "distro")]
ui.set_enabled(false);
ui.disable(true);
#[cfg(feature = "distro")]
ui.add_sized([width, button], Button::new("Updates are disabled"))
.on_disabled_hover_text(DISTRO_NO_UPDATE);
#[cfg(not(feature = "distro"))]
ui.set_enabled(!updating && *lock!(restart) == Restart::No);
#[cfg(not(feature = "distro"))]
if ui
.add_sized([width, button], Button::new("Check for updates"))
.on_hover_text(GUPAX_UPDATE)
.clicked()
{
Update::spawn_thread(og, self, state_path, update, error_state, restart);
}
ui.add_enabled_ui(!updating && *lock!(restart) == Restart::No, |ui| {
#[cfg(not(feature = "distro"))]
if ui
.add_sized([width, button], Button::new("Check for updates"))
.on_hover_text(GUPAX_UPDATE)
.clicked()
{
Update::spawn_thread(
og,
self,
state_path,
update,
error_state,
restart,
);
}
});
});
ui.vertical(|ui| {
ui.set_enabled(updating);
let prog = *lock2!(update, prog);
let msg = format!("{}\n{}{}", *lock2!(update, msg), prog, "%");
ui.add_sized([width, height * 1.4], Label::new(RichText::new(msg)));
let height = height / 2.0;
let size = vec2(width, height);
if updating {
ui.add_sized(size, Spinner::new().size(height));
} else {
ui.add_sized(size, Label::new("..."));
}
ui.add_sized(size, ProgressBar::new(lock2!(update, prog).round() / 100.0));
ui.add_enabled_ui(updating, |ui| {
let prog = *lock2!(update, prog);
let msg = format!("{}\n{}{}", *lock2!(update, msg), prog, "%");
ui.add_sized([width, height * 1.4], Label::new(RichText::new(msg)));
let height = height / 2.0;
let size = vec2(width, height);
if updating {
ui.add_sized(size, Spinner::new().size(height));
} else {
ui.add_sized(size, Label::new("..."));
}
ui.add_sized(size, ProgressBar::new(lock2!(update, prog).round() / 100.0));
});
});
});
@ -165,15 +174,16 @@ impl Gupax {
.on_hover_text(P2POOL_PATH_OK);
}
ui.spacing_mut().text_edit_width = ui.available_width() - SPACE;
ui.set_enabled(!lock!(file_window).thread);
if ui.button("Open").on_hover_text(GUPAX_SELECT).clicked() {
Self::spawn_file_window_thread(file_window, FileType::P2pool);
}
ui.add_sized(
[ui.available_width(), height],
TextEdit::singleline(&mut self.p2pool_path),
)
.on_hover_text(GUPAX_PATH_P2POOL);
ui.add_enabled_ui(!lock!(file_window).thread, |ui| {
if ui.button("Open").on_hover_text(GUPAX_SELECT).clicked() {
Self::spawn_file_window_thread(file_window, FileType::P2pool);
}
ui.add_sized(
[ui.available_width(), height],
TextEdit::singleline(&mut self.p2pool_path),
)
.on_hover_text(GUPAX_PATH_P2POOL);
});
});
ui.horizontal(|ui| {
if self.xmrig_path.is_empty() {
@ -202,15 +212,16 @@ impl Gupax {
.on_hover_text(XMRIG_PATH_OK);
}
ui.spacing_mut().text_edit_width = ui.available_width() - SPACE;
ui.set_enabled(!lock!(file_window).thread);
if ui.button("Open").on_hover_text(GUPAX_SELECT).clicked() {
Self::spawn_file_window_thread(file_window, FileType::Xmrig);
}
ui.add_sized(
[ui.available_width(), height],
TextEdit::singleline(&mut self.xmrig_path),
)
.on_hover_text(GUPAX_PATH_XMRIG);
ui.add_enabled_ui(!lock!(file_window).thread, |ui| {
if ui.button("Open").on_hover_text(GUPAX_SELECT).clicked() {
Self::spawn_file_window_thread(file_window, FileType::Xmrig);
}
ui.add_sized(
[ui.available_width(), height],
TextEdit::singleline(&mut self.xmrig_path),
)
.on_hover_text(GUPAX_PATH_XMRIG);
});
});
ui.horizontal(|ui| {
if self.xmrig_proxy_path.is_empty() {
@ -241,15 +252,16 @@ impl Gupax {
.on_hover_text(XMRIG_PROXY_PATH_OK);
}
ui.spacing_mut().text_edit_width = ui.available_width() - SPACE;
ui.set_enabled(!lock!(file_window).thread);
if ui.button("Open").on_hover_text(GUPAX_SELECT).clicked() {
Self::spawn_file_window_thread(file_window, FileType::XmrigProxy);
}
ui.add_sized(
[ui.available_width(), height],
TextEdit::singleline(&mut self.xmrig_proxy_path),
)
.on_hover_text(GUPAX_PATH_XMRIG_PROXY);
ui.add_enabled_ui(!lock!(file_window).thread, |ui| {
if ui.button("Open").on_hover_text(GUPAX_SELECT).clicked() {
Self::spawn_file_window_thread(file_window, FileType::XmrigProxy);
}
ui.add_sized(
[ui.available_width(), height],
TextEdit::singleline(&mut self.xmrig_proxy_path),
)
.on_hover_text(GUPAX_PATH_XMRIG_PROXY);
});
});
});
let mut guard = lock!(file_window);
@ -365,40 +377,42 @@ impl Gupax {
let height = height / 3.5;
let size = vec2(width, height);
ui.horizontal(|ui| {
ui.set_enabled(self.ratio != Ratio::Height);
ui.add_sized(
size,
Label::new(format!(
" Width [{}-{}]:",
APP_MIN_WIDTH as u16, APP_MAX_WIDTH as u16
)),
);
ui.add_sized(
size,
Slider::new(
&mut self.selected_width,
APP_MIN_WIDTH as u16..=APP_MAX_WIDTH as u16,
),
)
.on_hover_text(GUPAX_WIDTH);
ui.add_enabled_ui(self.ratio != Ratio::Height, |ui| {
ui.add_sized(
size,
Label::new(format!(
" Width [{}-{}]:",
APP_MIN_WIDTH as u16, APP_MAX_WIDTH as u16
)),
);
ui.add_sized(
size,
Slider::new(
&mut self.selected_width,
APP_MIN_WIDTH as u16..=APP_MAX_WIDTH as u16,
),
)
.on_hover_text(GUPAX_WIDTH);
});
});
ui.horizontal(|ui| {
ui.set_enabled(self.ratio != Ratio::Width);
ui.add_sized(
size,
Label::new(format!(
"Height [{}-{}]:",
APP_MIN_HEIGHT as u16, APP_MAX_HEIGHT as u16
)),
);
ui.add_sized(
size,
Slider::new(
&mut self.selected_height,
APP_MIN_HEIGHT as u16..=APP_MAX_HEIGHT as u16,
),
)
.on_hover_text(GUPAX_HEIGHT);
ui.add_enabled_ui(self.ratio != Ratio::Width, |ui| {
ui.add_sized(
size,
Label::new(format!(
"Height [{}-{}]:",
APP_MIN_HEIGHT as u16, APP_MAX_HEIGHT as u16
)),
);
ui.add_sized(
size,
Slider::new(
&mut self.selected_height,
APP_MIN_HEIGHT as u16..=APP_MAX_HEIGHT as u16,
),
)
.on_hover_text(GUPAX_HEIGHT);
});
});
ui.horizontal(|ui| {
ui.add_sized(

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);
// If the node already exists, show [Save] and mutate the already existing node
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() {
let node = Node {
ip: self.ip.clone(),
@ -168,9 +168,10 @@ impl P2pool {
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);
}
});
// Else, add to the list
} 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() {
let node = Node {
ip: self.ip.clone(),
@ -185,11 +186,12 @@ impl P2pool {
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);
}
});
}
});
// [Delete]
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);
if ui.add_sized([width, text_edit], Button::new("Delete")).on_hover_text(text).clicked() {
let new_name;
@ -217,15 +219,18 @@ impl P2pool {
self.zmq = new_node.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.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() {
self.name.clear();
self.ip.clear();
self.rpc.clear();
self.zmq.clear();
}
});
});
});
});

View file

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

View file

@ -138,21 +138,22 @@ impl P2pool {
ui.vertical(|ui| {
let height = height / 2.0;
let pinging = lock!(ping).pinging;
ui.set_enabled(pinging);
let prog = lock!(ping).prog.round();
let msg = RichText::new(format!("{} ... {}%", lock!(ping).msg, prog));
let height = height / 1.25;
let size = vec2(size.x, height);
ui.add_space(space_h);
ui.add_sized(size, Label::new(msg));
ui.add_space(space_h);
if pinging {
ui.add_sized(size, Spinner::new().size(height));
} else {
ui.add_sized(size, Label::new("..."));
}
ui.add_sized(size, ProgressBar::new(prog.round() / 100.0));
ui.add_space(space_h);
ui.add_enabled_ui(pinging, |ui| {
let prog = lock!(ping).prog.round();
let msg = RichText::new(format!("{} ... {}%", lock!(ping).msg, prog));
let height = height / 1.25;
let size = vec2(size.x, height);
ui.add_space(space_h);
ui.add_sized(size, Label::new(msg));
ui.add_space(space_h);
if pinging {
ui.add_sized(size, Spinner::new().size(height));
} else {
ui.add_sized(size, Label::new("..."));
}
ui.add_sized(size, ProgressBar::new(prog.round() / 100.0));
ui.add_space(space_h);
});
});
});

View file

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

View file

@ -156,274 +156,306 @@ impl Status {
self.manual_hash = true;
}
ui.separator();
ui.set_enabled(self.manual_hash);
if ui
.add_sized(
[button, text],
SelectableLabel::new(self.hash_metric == Hash::Hash, "Hash"),
)
.on_hover_text(STATUS_SUBMENU_HASH)
.clicked()
{
self.hash_metric = Hash::Hash;
}
ui.separator();
if ui
.add_sized(
[button, text],
SelectableLabel::new(self.hash_metric == Hash::Kilo, "Kilo"),
)
.on_hover_text(STATUS_SUBMENU_KILO)
.clicked()
{
self.hash_metric = Hash::Kilo;
}
ui.separator();
if ui
.add_sized(
[button, text],
SelectableLabel::new(self.hash_metric == Hash::Mega, "Mega"),
)
.on_hover_text(STATUS_SUBMENU_MEGA)
.clicked()
{
self.hash_metric = Hash::Mega;
}
ui.separator();
if ui
.add_sized(
[button, text],
SelectableLabel::new(self.hash_metric == Hash::Giga, "Giga"),
)
.on_hover_text(STATUS_SUBMENU_GIGA)
.clicked()
{
self.hash_metric = Hash::Giga;
}
ui.separator();
ui.spacing_mut().slider_width = button * 11.5;
ui.add_sized(
[button * 14.0, text],
Slider::new(&mut self.hashrate, 1.0..=1_000.0),
);
ui.add_enabled_ui(self.manual_hash, |ui| {
if ui
.add_sized(
[button, text],
SelectableLabel::new(self.hash_metric == Hash::Hash, "Hash"),
)
.on_hover_text(STATUS_SUBMENU_HASH)
.clicked()
{
self.hash_metric = Hash::Hash;
}
ui.separator();
if ui
.add_sized(
[button, text],
SelectableLabel::new(self.hash_metric == Hash::Kilo, "Kilo"),
)
.on_hover_text(STATUS_SUBMENU_KILO)
.clicked()
{
self.hash_metric = Hash::Kilo;
}
ui.separator();
if ui
.add_sized(
[button, text],
SelectableLabel::new(self.hash_metric == Hash::Mega, "Mega"),
)
.on_hover_text(STATUS_SUBMENU_MEGA)
.clicked()
{
self.hash_metric = Hash::Mega;
}
ui.separator();
if ui
.add_sized(
[button, text],
SelectableLabel::new(self.hash_metric == Hash::Giga, "Giga"),
)
.on_hover_text(STATUS_SUBMENU_GIGA)
.clicked()
{
self.hash_metric = Hash::Giga;
}
ui.separator();
ui.spacing_mut().slider_width = button * 11.5;
ui.add_sized(
[button * 14.0, text],
Slider::new(&mut self.hashrate, 1.0..=1_000.0),
);
});
})
});
// Actual stats
ui.set_enabled(p2pool_alive);
let text = height / 25.0;
let width = (width / 3.0) - (SPACE * 1.666);
let min_height = ui.available_height() / 1.3;
let api = lock!(p2pool_api);
ui.horizontal(|ui| {
ui.group(|ui| {
ui.vertical(|ui| {
ui.set_min_height(min_height);
ui.add_sized(
[width, text],
Label::new(RichText::new("Monero Difficulty").underline().color(BONE)),
)
.on_hover_text(STATUS_SUBMENU_MONERO_DIFFICULTY);
ui.add_sized([width, text], Label::new(api.monero_difficulty.as_str()));
ui.add_sized(
[width, text],
Label::new(RichText::new("Monero Hashrate").underline().color(BONE)),
)
.on_hover_text(STATUS_SUBMENU_MONERO_HASHRATE);
ui.add_sized([width, text], Label::new(api.monero_hashrate.as_str()));
ui.add_sized(
[width, text],
Label::new(RichText::new("P2Pool Difficulty").underline().color(BONE)),
)
.on_hover_text(STATUS_SUBMENU_P2POOL_DIFFICULTY);
ui.add_sized([width, text], Label::new(api.p2pool_difficulty.as_str()));
ui.add_sized(
[width, text],
Label::new(RichText::new("P2Pool Hashrate").underline().color(BONE)),
)
.on_hover_text(STATUS_SUBMENU_P2POOL_HASHRATE);
ui.add_sized([width, text], Label::new(api.p2pool_hashrate.as_str()));
})
});
ui.group(|ui| {
ui.vertical(|ui| {
ui.set_min_height(min_height);
if self.manual_hash {
let hashrate =
Hash::convert_to_hash(self.hashrate, self.hash_metric) as u64;
let p2pool_share_mean = PubP2poolApi::calculate_share_or_block_time(
hashrate,
api.p2pool_difficulty_u64,
);
let solo_block_mean = PubP2poolApi::calculate_share_or_block_time(
hashrate,
api.monero_difficulty_u64,
);
ui.add_sized(
[width, text],
Label::new(
RichText::new("Manually Inputted Hashrate")
.underline()
.color(BONE),
),
);
ui.add_sized(
[width, text],
Label::new(format!("{} H/s", Unsigned::from(hashrate))),
);
ui.add_sized(
[width, text],
Label::new(RichText::new("P2Pool Block Mean").underline().color(BONE)),
)
.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(
RichText::new("Your P2Pool Share Mean")
.underline()
.color(BONE),
),
)
.on_hover_text(STATUS_SUBMENU_P2POOL_SHARE_MEAN);
ui.add_sized([width, text], Label::new(p2pool_share_mean.to_string()));
ui.add_sized(
[width, text],
Label::new(
RichText::new("Your Solo Block Mean")
.underline()
.color(BONE),
),
)
.on_hover_text(STATUS_SUBMENU_SOLO_BLOCK_MEAN);
ui.add_sized([width, text], Label::new(solo_block_mean.to_string()));
} else {
ui.add_sized(
[width, text],
Label::new(
RichText::new("Your P2Pool Hashrate")
.underline()
.color(BONE),
),
)
.on_hover_text(STATUS_SUBMENU_YOUR_P2POOL_HASHRATE);
ui.add_sized(
[width, text],
Label::new(format!("{} H/s", api.hashrate_1h)),
);
ui.add_sized(
[width, text],
Label::new(RichText::new("P2Pool Block Mean").underline().color(BONE)),
)
.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(
RichText::new("Your P2Pool Share Mean")
.underline()
.color(BONE),
),
)
.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(
RichText::new("Your Solo Block Mean")
.underline()
.color(BONE),
),
)
.on_hover_text(STATUS_SUBMENU_SOLO_BLOCK_MEAN);
ui.add_sized([width, text], Label::new(api.solo_block_mean.to_string()));
}
})
});
ui.group(|ui| {
ui.vertical(|ui| {
ui.set_min_height(min_height);
if self.manual_hash {
let hashrate =
Hash::convert_to_hash(self.hashrate, self.hash_metric) as u64;
let user_p2pool_percent =
PubP2poolApi::calculate_dominance(hashrate, api.p2pool_hashrate_u64);
let user_monero_percent =
PubP2poolApi::calculate_dominance(hashrate, api.monero_hashrate_u64);
ui.add_sized(
[width, text],
Label::new(RichText::new("P2Pool Miners").underline().color(BONE)),
)
.on_hover_text(STATUS_SUBMENU_P2POOL_MINERS);
ui.add_sized([width, text], Label::new(api.miners.as_str()));
ui.add_sized(
[width, text],
Label::new(RichText::new("P2Pool Dominance").underline().color(BONE)),
)
.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(
RichText::new("Your P2Pool Dominance")
.underline()
.color(BONE),
),
)
.on_hover_text(STATUS_SUBMENU_YOUR_P2POOL_DOMINANCE);
ui.add_sized([width, text], Label::new(user_p2pool_percent.as_str()));
ui.add_sized(
[width, text],
Label::new(
RichText::new("Your Monero Dominance")
.underline()
.color(BONE),
),
)
.on_hover_text(STATUS_SUBMENU_YOUR_MONERO_DOMINANCE);
ui.add_sized([width, text], Label::new(user_monero_percent.as_str()));
} else {
ui.add_sized(
[width, text],
Label::new(RichText::new("P2Pool Miners").underline().color(BONE)),
)
.on_hover_text(STATUS_SUBMENU_P2POOL_MINERS);
ui.add_sized([width, text], Label::new(api.miners.as_str()));
ui.add_sized(
[width, text],
Label::new(RichText::new("P2Pool Dominance").underline().color(BONE)),
)
.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(
RichText::new("Your P2Pool Dominance")
.underline()
.color(BONE),
),
)
.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(
RichText::new("Your Monero Dominance")
.underline()
.color(BONE),
),
)
.on_hover_text(STATUS_SUBMENU_YOUR_MONERO_DOMINANCE);
ui.add_sized([width, text], Label::new(api.user_monero_percent.as_str()));
}
})
ui.add_enabled_ui(p2pool_alive, |ui| {
let text = height / 25.0;
let width = (width / 3.0) - (SPACE * 1.666);
let min_height = ui.available_height() / 1.3;
let api = lock!(p2pool_api);
ui.horizontal(|ui| {
ui.group(|ui| {
ui.vertical(|ui| {
ui.set_min_height(min_height);
ui.add_sized(
[width, text],
Label::new(RichText::new("Monero Difficulty").underline().color(BONE)),
)
.on_hover_text(STATUS_SUBMENU_MONERO_DIFFICULTY);
ui.add_sized([width, text], Label::new(api.monero_difficulty.as_str()));
ui.add_sized(
[width, text],
Label::new(RichText::new("Monero Hashrate").underline().color(BONE)),
)
.on_hover_text(STATUS_SUBMENU_MONERO_HASHRATE);
ui.add_sized([width, text], Label::new(api.monero_hashrate.as_str()));
ui.add_sized(
[width, text],
Label::new(RichText::new("P2Pool Difficulty").underline().color(BONE)),
)
.on_hover_text(STATUS_SUBMENU_P2POOL_DIFFICULTY);
ui.add_sized([width, text], Label::new(api.p2pool_difficulty.as_str()));
ui.add_sized(
[width, text],
Label::new(RichText::new("P2Pool Hashrate").underline().color(BONE)),
)
.on_hover_text(STATUS_SUBMENU_P2POOL_HASHRATE);
ui.add_sized([width, text], Label::new(api.p2pool_hashrate.as_str()));
})
});
ui.group(|ui| {
ui.vertical(|ui| {
ui.set_min_height(min_height);
if self.manual_hash {
let hashrate =
Hash::convert_to_hash(self.hashrate, self.hash_metric) as u64;
let p2pool_share_mean = PubP2poolApi::calculate_share_or_block_time(
hashrate,
api.p2pool_difficulty_u64,
);
let solo_block_mean = PubP2poolApi::calculate_share_or_block_time(
hashrate,
api.monero_difficulty_u64,
);
ui.add_sized(
[width, text],
Label::new(
RichText::new("Manually Inputted Hashrate")
.underline()
.color(BONE),
),
);
ui.add_sized(
[width, text],
Label::new(format!("{} H/s", Unsigned::from(hashrate))),
);
ui.add_sized(
[width, text],
Label::new(
RichText::new("P2Pool Block Mean").underline().color(BONE),
),
)
.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(
RichText::new("Your P2Pool Share Mean")
.underline()
.color(BONE),
),
)
.on_hover_text(STATUS_SUBMENU_P2POOL_SHARE_MEAN);
ui.add_sized([width, text], Label::new(p2pool_share_mean.to_string()));
ui.add_sized(
[width, text],
Label::new(
RichText::new("Your Solo Block Mean")
.underline()
.color(BONE),
),
)
.on_hover_text(STATUS_SUBMENU_SOLO_BLOCK_MEAN);
ui.add_sized([width, text], Label::new(solo_block_mean.to_string()));
} else {
ui.add_sized(
[width, text],
Label::new(
RichText::new("Your P2Pool Hashrate")
.underline()
.color(BONE),
),
)
.on_hover_text(STATUS_SUBMENU_YOUR_P2POOL_HASHRATE);
ui.add_sized(
[width, text],
Label::new(format!("{} H/s", api.hashrate_1h)),
);
ui.add_sized(
[width, text],
Label::new(
RichText::new("P2Pool Block Mean").underline().color(BONE),
),
)
.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(
RichText::new("Your P2Pool Share Mean")
.underline()
.color(BONE),
),
)
.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(
RichText::new("Your Solo Block Mean")
.underline()
.color(BONE),
),
)
.on_hover_text(STATUS_SUBMENU_SOLO_BLOCK_MEAN);
ui.add_sized(
[width, text],
Label::new(api.solo_block_mean.to_string()),
);
}
})
});
ui.group(|ui| {
ui.vertical(|ui| {
ui.set_min_height(min_height);
if self.manual_hash {
let hashrate =
Hash::convert_to_hash(self.hashrate, self.hash_metric) as u64;
let user_p2pool_percent = PubP2poolApi::calculate_dominance(
hashrate,
api.p2pool_hashrate_u64,
);
let user_monero_percent = PubP2poolApi::calculate_dominance(
hashrate,
api.monero_hashrate_u64,
);
ui.add_sized(
[width, text],
Label::new(RichText::new("P2Pool Miners").underline().color(BONE)),
)
.on_hover_text(STATUS_SUBMENU_P2POOL_MINERS);
ui.add_sized([width, text], Label::new(api.miners.as_str()));
ui.add_sized(
[width, text],
Label::new(
RichText::new("P2Pool Dominance").underline().color(BONE),
),
)
.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(
RichText::new("Your P2Pool Dominance")
.underline()
.color(BONE),
),
)
.on_hover_text(STATUS_SUBMENU_YOUR_P2POOL_DOMINANCE);
ui.add_sized([width, text], Label::new(user_p2pool_percent.as_str()));
ui.add_sized(
[width, text],
Label::new(
RichText::new("Your Monero Dominance")
.underline()
.color(BONE),
),
)
.on_hover_text(STATUS_SUBMENU_YOUR_MONERO_DOMINANCE);
ui.add_sized([width, text], Label::new(user_monero_percent.as_str()));
} else {
ui.add_sized(
[width, text],
Label::new(RichText::new("P2Pool Miners").underline().color(BONE)),
)
.on_hover_text(STATUS_SUBMENU_P2POOL_MINERS);
ui.add_sized([width, text], Label::new(api.miners.as_str()));
ui.add_sized(
[width, text],
Label::new(
RichText::new("P2Pool Dominance").underline().color(BONE),
),
)
.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(
RichText::new("Your P2Pool Dominance")
.underline()
.color(BONE),
),
)
.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(
RichText::new("Your Monero Dominance")
.underline()
.color(BONE),
),
)
.on_hover_text(STATUS_SUBMENU_YOUR_MONERO_DOMINANCE);
ui.add_sized(
[width, text],
Label::new(api.user_monero_percent.as_str()),
);
}
})
});
});
// Tick bar
ui.add_sized(
[ui.available_width(), text],
Label::new(api.calculate_tick_bar()),
)
.on_hover_text(STATUS_SUBMENU_PROGRESS_BAR);
drop(api);
});
// Tick bar
ui.add_sized(
[ui.available_width(), text],
Label::new(api.calculate_tick_bar()),
)
.on_hover_text(STATUS_SUBMENU_PROGRESS_BAR);
drop(api);
}
}

View file

@ -142,135 +142,136 @@ fn p2pool(
ui.set_min_height(min_size.y * 34.0);
ui.set_min_size(min_size);
debug!("Status Tab | Rendering [P2Pool]");
ui.set_enabled(p2pool_alive);
ui.add_sized(
size,
Label::new(
RichText::new("[P2Pool]")
.color(LIGHT_GRAY)
.text_style(TextStyle::Name("MonospaceLarge".into())),
),
)
.on_hover_text("P2Pool is online")
.on_disabled_hover_text("P2Pool is offline");
ui.style_mut().override_text_style = Some(Name("MonospaceSmall".into()));
let size = [size.x, size.y / 1.4];
let api = lock!(p2pool_api);
ui.add_sized(
size,
Label::new(RichText::new("Uptime").underline().color(BONE)),
)
.on_hover_text(STATUS_P2POOL_UPTIME);
ui.add_sized(size, Label::new(format!("{}", api.uptime)));
ui.add_sized(
size,
Label::new(RichText::new("Current Shares").underline().color(BONE)),
)
.on_hover_text(STATUS_P2POOL_CURRENT_SHARES);
ui.add_sized(size, Label::new(api.sidechain_shares.to_string()));
ui.add_sized(
size,
Label::new(RichText::new("Shares Found").underline().color(BONE)),
)
.on_hover_text(STATUS_P2POOL_SHARES);
ui.add_sized(
size,
Label::new(
(if let Some(s) = api.shares_found {
s.to_string()
} else {
UNKNOWN_DATA.to_string()
})
.to_string(),
),
);
ui.add_sized(
size,
Label::new(RichText::new("Payouts").underline().color(BONE)),
)
.on_hover_text(STATUS_P2POOL_PAYOUTS);
ui.add_sized(size, Label::new(format!("Total: {}", api.payouts)));
ui.add_sized(
size,
Label::new(format!(
"[{:.7}/hour]\n[{:.7}/day]\n[{:.7}/month]",
api.payouts_hour, api.payouts_day, api.payouts_month
)),
);
ui.add_sized(
size,
Label::new(RichText::new("XMR Mined").underline().color(BONE)),
)
.on_hover_text(STATUS_P2POOL_XMR);
ui.add_sized(size, Label::new(format!("Total: {:.13} XMR", api.xmr)));
ui.add_sized(
size,
Label::new(format!(
"[{:.7}/hour]\n[{:.7}/day]\n[{:.7}/month]",
api.xmr_hour, api.xmr_day, api.xmr_month
)),
);
ui.add_sized(
size,
Label::new(
RichText::new("Hashrate (15m/1h/24h)")
.underline()
.color(BONE),
),
)
.on_hover_text(STATUS_P2POOL_HASHRATE);
ui.add_sized(
size,
Label::new(format!(
"[{} H/s] [{} H/s] [{} H/s]",
api.hashrate_15m, api.hashrate_1h, api.hashrate_24h
)),
);
ui.add_sized(
size,
Label::new(RichText::new("Miners Connected").underline().color(BONE)),
)
.on_hover_text(STATUS_P2POOL_CONNECTIONS);
ui.add_sized(size, Label::new(format!("{}", api.connections)));
ui.add_sized(
size,
Label::new(RichText::new("Effort").underline().color(BONE)),
)
.on_hover_text(STATUS_P2POOL_EFFORT);
ui.add_sized(
size,
Label::new(format!(
"[Average: {}] [Current: {}]",
api.average_effort, api.current_effort
)),
);
let img = lock!(p2pool_img);
ui.add_sized(
size,
Label::new(RichText::new("Monero Node").underline().color(BONE)),
)
.on_hover_text(STATUS_P2POOL_MONERO_NODE);
ui.add_sized(
size,
Label::new(format!(
"[IP: {}]\n[RPC: {}] [ZMQ: {}]",
&img.host, &img.rpc, &img.zmq
)),
);
ui.add_sized(
size,
Label::new(RichText::new("Sidechain").underline().color(BONE)),
)
.on_hover_text(STATUS_P2POOL_POOL);
ui.add_sized(size, Label::new(&img.mini));
ui.add_sized(
size,
Label::new(RichText::new("Address").underline().color(BONE)),
)
.on_hover_text(STATUS_P2POOL_ADDRESS);
ui.add_sized(size, Label::new(&img.address));
drop(img);
drop(api);
ui.add_enabled_ui(p2pool_alive, |ui| {
ui.add_sized(
size,
Label::new(
RichText::new("[P2Pool]")
.color(LIGHT_GRAY)
.text_style(TextStyle::Name("MonospaceLarge".into())),
),
)
.on_hover_text("P2Pool is online")
.on_disabled_hover_text("P2Pool is offline");
ui.style_mut().override_text_style = Some(Name("MonospaceSmall".into()));
let size = [size.x, size.y / 1.4];
let api = lock!(p2pool_api);
ui.add_sized(
size,
Label::new(RichText::new("Uptime").underline().color(BONE)),
)
.on_hover_text(STATUS_P2POOL_UPTIME);
ui.add_sized(size, Label::new(format!("{}", api.uptime)));
ui.add_sized(
size,
Label::new(RichText::new("Current Shares").underline().color(BONE)),
)
.on_hover_text(STATUS_P2POOL_CURRENT_SHARES);
ui.add_sized(size, Label::new(api.sidechain_shares.to_string()));
ui.add_sized(
size,
Label::new(RichText::new("Shares Found").underline().color(BONE)),
)
.on_hover_text(STATUS_P2POOL_SHARES);
ui.add_sized(
size,
Label::new(
(if let Some(s) = api.shares_found {
s.to_string()
} else {
UNKNOWN_DATA.to_string()
})
.to_string(),
),
);
ui.add_sized(
size,
Label::new(RichText::new("Payouts").underline().color(BONE)),
)
.on_hover_text(STATUS_P2POOL_PAYOUTS);
ui.add_sized(size, Label::new(format!("Total: {}", api.payouts)));
ui.add_sized(
size,
Label::new(format!(
"[{:.7}/hour]\n[{:.7}/day]\n[{:.7}/month]",
api.payouts_hour, api.payouts_day, api.payouts_month
)),
);
ui.add_sized(
size,
Label::new(RichText::new("XMR Mined").underline().color(BONE)),
)
.on_hover_text(STATUS_P2POOL_XMR);
ui.add_sized(size, Label::new(format!("Total: {:.13} XMR", api.xmr)));
ui.add_sized(
size,
Label::new(format!(
"[{:.7}/hour]\n[{:.7}/day]\n[{:.7}/month]",
api.xmr_hour, api.xmr_day, api.xmr_month
)),
);
ui.add_sized(
size,
Label::new(
RichText::new("Hashrate (15m/1h/24h)")
.underline()
.color(BONE),
),
)
.on_hover_text(STATUS_P2POOL_HASHRATE);
ui.add_sized(
size,
Label::new(format!(
"[{} H/s] [{} H/s] [{} H/s]",
api.hashrate_15m, api.hashrate_1h, api.hashrate_24h
)),
);
ui.add_sized(
size,
Label::new(RichText::new("Miners Connected").underline().color(BONE)),
)
.on_hover_text(STATUS_P2POOL_CONNECTIONS);
ui.add_sized(size, Label::new(format!("{}", api.connections)));
ui.add_sized(
size,
Label::new(RichText::new("Effort").underline().color(BONE)),
)
.on_hover_text(STATUS_P2POOL_EFFORT);
ui.add_sized(
size,
Label::new(format!(
"[Average: {}] [Current: {}]",
api.average_effort, api.current_effort
)),
);
let img = lock!(p2pool_img);
ui.add_sized(
size,
Label::new(RichText::new("Monero Node").underline().color(BONE)),
)
.on_hover_text(STATUS_P2POOL_MONERO_NODE);
ui.add_sized(
size,
Label::new(format!(
"[IP: {}]\n[RPC: {}] [ZMQ: {}]",
&img.host, &img.rpc, &img.zmq
)),
);
ui.add_sized(
size,
Label::new(RichText::new("Sidechain").underline().color(BONE)),
)
.on_hover_text(STATUS_P2POOL_POOL);
ui.add_sized(size, Label::new(&img.mini));
ui.add_sized(
size,
Label::new(RichText::new("Address").underline().color(BONE)),
)
.on_hover_text(STATUS_P2POOL_ADDRESS);
ui.add_sized(size, Label::new(&img.address));
drop(img);
drop(api);
});
})
})
});
@ -287,59 +288,60 @@ fn xmrig_proxy(
ui.vertical(|ui| {
ui.set_min_height(min_size.y * 34.0);
debug!("Status Tab | Rendering [XMRig-Proxy]");
ui.set_enabled(xmrig_proxy_alive);
ui.set_min_size(min_size);
ui.add_sized(
size,
Label::new(
RichText::new("[XMRig-Proxy]")
.color(LIGHT_GRAY)
.text_style(TextStyle::Name("MonospaceLarge".into())),
),
)
.on_hover_text("XMRig-Proxy is online")
.on_disabled_hover_text("XMRig-Proxy is offline");
let api = lock!(xmrig_proxy_api);
ui.add_sized(
size,
Label::new(RichText::new("Uptime").underline().color(BONE)),
)
.on_hover_text(STATUS_XMRIG_PROXY_UPTIME);
ui.add_sized(size, Label::new(UptimeFull::from(api.uptime).as_str()));
ui.add_sized(
size,
Label::new(
RichText::new("Hashrate\n(1m/10m/1h/12h/24h)")
.underline()
.color(BONE),
),
)
.on_hover_text(STATUS_XMRIG_PROXY_HASHRATE);
ui.add_sized(
size,
Label::new(format!(
"[{} H/s] [{} H/s]\n[{} H/s] [{} H/s] [{} H/s]",
api.hashrate_1m,
api.hashrate_10m,
api.hashrate_1h,
api.hashrate_12h,
api.hashrate_24h
)),
);
ui.add_sized(
size,
Label::new(format!(
"[Accepted: {}]\n[Rejected: {}]",
api.accepted, api.rejected
)),
);
ui.add_sized(
size,
Label::new(RichText::new("Pool").underline().color(BONE)),
)
.on_hover_text(STATUS_XMRIG_PROXY_POOL);
ui.add_sized(size, Label::new(api.node.to_string()));
drop(api);
ui.add_enabled_ui(xmrig_proxy_alive, |ui| {
ui.set_min_size(min_size);
ui.add_sized(
size,
Label::new(
RichText::new("[XMRig-Proxy]")
.color(LIGHT_GRAY)
.text_style(TextStyle::Name("MonospaceLarge".into())),
),
)
.on_hover_text("XMRig-Proxy is online")
.on_disabled_hover_text("XMRig-Proxy is offline");
let api = lock!(xmrig_proxy_api);
ui.add_sized(
size,
Label::new(RichText::new("Uptime").underline().color(BONE)),
)
.on_hover_text(STATUS_XMRIG_PROXY_UPTIME);
ui.add_sized(size, Label::new(UptimeFull::from(api.uptime).as_str()));
ui.add_sized(
size,
Label::new(
RichText::new("Hashrate\n(1m/10m/1h/12h/24h)")
.underline()
.color(BONE),
),
)
.on_hover_text(STATUS_XMRIG_PROXY_HASHRATE);
ui.add_sized(
size,
Label::new(format!(
"[{} H/s] [{} H/s]\n[{} H/s] [{} H/s] [{} H/s]",
api.hashrate_1m,
api.hashrate_10m,
api.hashrate_1h,
api.hashrate_12h,
api.hashrate_24h
)),
);
ui.add_sized(
size,
Label::new(format!(
"[Accepted: {}]\n[Rejected: {}]",
api.accepted, api.rejected
)),
);
ui.add_sized(
size,
Label::new(RichText::new("Pool").underline().color(BONE)),
)
.on_hover_text(STATUS_XMRIG_PROXY_POOL);
ui.add_sized(size, Label::new(api.node.to_string()));
drop(api);
});
})
});
}
@ -359,70 +361,71 @@ fn xmrig(
ui.set_min_height(min_size.y * 34.0);
ui.spacing_mut().item_spacing = Vec2::new(2.0, 2.0);
debug!("Status Tab | Rendering [XMRig]");
ui.set_enabled(xmrig_alive);
// ui.set_min_size(min_size);
ui.add_sized(
size,
Label::new(
RichText::new("[XMRig]")
.color(LIGHT_GRAY)
.text_style(TextStyle::Name("MonospaceLarge".into())),
),
)
.on_hover_text("XMRig is online")
.on_disabled_hover_text("XMRig is offline");
let api = lock!(xmrig_api);
ui.add_sized(
size,
Label::new(RichText::new("Uptime").underline().color(BONE)),
)
.on_hover_text(STATUS_XMRIG_UPTIME);
ui.add_sized(size, Label::new(UptimeFull::from(api.uptime).as_str()));
ui.add_sized(size, Label::new(api.resources.to_string()));
ui.add_sized(
size,
Label::new(
RichText::new("Hashrate\n(10s/1m/15m)")
.underline()
.color(BONE),
),
)
.on_hover_text(STATUS_XMRIG_HASHRATE);
ui.add_sized(size, Label::new(api.hashrate.to_string()));
ui.add_sized(
size,
Label::new(RichText::new("Difficulty").underline().color(BONE)),
)
.on_hover_text(STATUS_XMRIG_DIFFICULTY);
ui.add_sized(size, Label::new(api.diff.to_string()));
ui.add_sized(
size,
Label::new(RichText::new("Shares").underline().color(BONE)),
)
.on_hover_text(STATUS_XMRIG_SHARES);
ui.add_sized(
size,
Label::new(format!(
"[Accepted: {}]\n[Rejected: {}]",
api.accepted, api.rejected
)),
);
ui.add_sized(
size,
Label::new(RichText::new("Pool").underline().color(BONE)),
)
.on_hover_text(STATUS_XMRIG_POOL);
ui.add_sized(size, Label::new(api.node.to_string()));
ui.add_sized(
size,
Label::new(RichText::new("Threads").underline().color(BONE)),
)
.on_hover_text(STATUS_XMRIG_THREADS);
ui.add_sized(
size,
Label::new(format!("{}/{}", &lock!(xmrig_img).threads, max_threads)),
);
drop(api);
ui.add_enabled_ui(xmrig_alive, |ui| {
// ui.set_min_size(min_size);
ui.add_sized(
size,
Label::new(
RichText::new("[XMRig]")
.color(LIGHT_GRAY)
.text_style(TextStyle::Name("MonospaceLarge".into())),
),
)
.on_hover_text("XMRig is online")
.on_disabled_hover_text("XMRig is offline");
let api = lock!(xmrig_api);
ui.add_sized(
size,
Label::new(RichText::new("Uptime").underline().color(BONE)),
)
.on_hover_text(STATUS_XMRIG_UPTIME);
ui.add_sized(size, Label::new(UptimeFull::from(api.uptime).as_str()));
ui.add_sized(size, Label::new(api.resources.to_string()));
ui.add_sized(
size,
Label::new(
RichText::new("Hashrate\n(10s/1m/15m)")
.underline()
.color(BONE),
),
)
.on_hover_text(STATUS_XMRIG_HASHRATE);
ui.add_sized(size, Label::new(api.hashrate.to_string()));
ui.add_sized(
size,
Label::new(RichText::new("Difficulty").underline().color(BONE)),
)
.on_hover_text(STATUS_XMRIG_DIFFICULTY);
ui.add_sized(size, Label::new(api.diff.to_string()));
ui.add_sized(
size,
Label::new(RichText::new("Shares").underline().color(BONE)),
)
.on_hover_text(STATUS_XMRIG_SHARES);
ui.add_sized(
size,
Label::new(format!(
"[Accepted: {}]\n[Rejected: {}]",
api.accepted, api.rejected
)),
);
ui.add_sized(
size,
Label::new(RichText::new("Pool").underline().color(BONE)),
)
.on_hover_text(STATUS_XMRIG_POOL);
ui.add_sized(size, Label::new(api.node.to_string()));
ui.add_sized(
size,
Label::new(RichText::new("Threads").underline().color(BONE)),
)
.on_hover_text(STATUS_XMRIG_THREADS);
ui.add_sized(
size,
Label::new(format!("{}/{}", &lock!(xmrig_img).threads, max_threads)),
);
drop(api);
});
})
// })
});
@ -437,113 +440,115 @@ 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.vertical(|ui| {
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.set_min_size(min_size);
ui.add_sized(
size,
Label::new(
RichText::new("[XvB Raffle]")
.color(LIGHT_GRAY)
.text_style(TextStyle::Name("MonospaceLarge".into())),
),
)
.on_hover_text("XvB API stats")
.on_disabled_hover_text("No data received from XvB API");
// [Round Type]
ui.add_sized(
size,
Label::new(RichText::new("Round Type").underline().color(BONE)),
)
.on_hover_text(STATUS_XVB_ROUND_TYPE);
ui.add_sized(size, Label::new(api.round_type.to_string()));
// [Time Remaining]
ui.add_sized(
size,
Label::new(
RichText::new("Round Time Remaining")
.underline()
.color(BONE),
),
)
.on_hover_text(STATUS_XVB_TIME_REMAIN);
ui.add_sized(size, Label::new(format!("{} minutes", api.time_remain)));
// Donated Hashrate
ui.add_sized(
size,
Label::new(RichText::new("Bonus Hashrate").underline().color(BONE)),
)
.on_hover_text(STATUS_XVB_DONATED_HR);
ui.add_sized(
size,
Label::new(format!(
"{}kH/s\n+\n{}kH/s\ndonated by\n{} donors\n with\n{} miners",
api.bonus_hr, api.donate_hr, api.donate_miners, api.donate_workers
)),
);
// Players
ui.add_sized(
size,
Label::new(RichText::new("Players").underline().color(BONE)),
)
.on_hover_text(STATUS_XVB_PLAYERS);
ui.add_sized(
size,
Label::new(format!(
"[Registered: {}]\n[Playing: {}]",
api.players, api.players_round
)),
);
// Winner
ui.add_sized(
size,
Label::new(RichText::new("Winner").underline().color(BONE)),
)
.on_hover_text(STATUS_XVB_WINNER);
ui.add_sized(size, Label::new(&api.winner));
// Share effort
ui.add_sized(
size,
Label::new(RichText::new("Share Effort").underline().color(BONE)),
)
.on_hover_text(STATUS_XVB_SHARE);
ui.add_sized(size, Label::new(api.share_effort.to_string()));
// Block reward
ui.add_sized(
size,
Label::new(RichText::new("Block Reward").underline().color(BONE)),
)
.on_hover_text(STATUS_XVB_BLOCK_REWARD);
ui.add_sized(size, Label::new(api.block_reward.to_string()));
// reward yearly
ui.add_sized(
size,
Label::new(
RichText::new("Est. Reward (Yearly)")
.underline()
.color(BONE),
),
)
.on_hover_text(STATUS_XVB_YEARLY);
if api.reward_yearly.is_empty() {
ui.add_sized(size, Label::new("No information".to_string()));
} else {
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.add_sized(
size,
Label::new(
RichText::new("[XvB Raffle]")
.color(LIGHT_GRAY)
.text_style(TextStyle::Name("MonospaceLarge".into())),
),
)
.on_hover_text("XvB API stats")
.on_disabled_hover_text("No data received from XvB API");
// [Round Type]
ui.add_sized(
size,
Label::new(RichText::new("Round Type").underline().color(BONE)),
)
.on_hover_text(STATUS_XVB_ROUND_TYPE);
ui.add_sized(size, Label::new(api.round_type.to_string()));
// [Time Remaining]
ui.add_sized(
size,
Label::new(
RichText::new("Round Time Remaining")
.underline()
.color(BONE),
),
)
.on_hover_text(STATUS_XVB_TIME_REMAIN);
ui.add_sized(size, Label::new(format!("{} minutes", api.time_remain)));
// Donated Hashrate
ui.add_sized(
size,
Label::new(RichText::new("Bonus Hashrate").underline().color(BONE)),
)
.on_hover_text(STATUS_XVB_DONATED_HR);
ui.add_sized(
size,
Label::new(format!(
"{}: {} XMR\n{}: {} XMR\n{}: {} XMR\n{}: {} XMR\n{}: {} XMR",
XvbRound::Vip,
api.reward_yearly[0],
XvbRound::Donor,
api.reward_yearly[1],
XvbRound::DonorVip,
api.reward_yearly[2],
XvbRound::DonorWhale,
api.reward_yearly[3],
XvbRound::DonorMega,
api.reward_yearly[4]
"{}kH/s\n+\n{}kH/s\ndonated by\n{} donors\n with\n{} miners",
api.bonus_hr, api.donate_hr, api.donate_miners, api.donate_workers
)),
);
}
// Players
ui.add_sized(
size,
Label::new(RichText::new("Players").underline().color(BONE)),
)
.on_hover_text(STATUS_XVB_PLAYERS);
ui.add_sized(
size,
Label::new(format!(
"[Registered: {}]\n[Playing: {}]",
api.players, api.players_round
)),
);
// Winner
ui.add_sized(
size,
Label::new(RichText::new("Winner").underline().color(BONE)),
)
.on_hover_text(STATUS_XVB_WINNER);
ui.add_sized(size, Label::new(&api.winner));
// Share effort
ui.add_sized(
size,
Label::new(RichText::new("Share Effort").underline().color(BONE)),
)
.on_hover_text(STATUS_XVB_SHARE);
ui.add_sized(size, Label::new(api.share_effort.to_string()));
// Block reward
ui.add_sized(
size,
Label::new(RichText::new("Block Reward").underline().color(BONE)),
)
.on_hover_text(STATUS_XVB_BLOCK_REWARD);
ui.add_sized(size, Label::new(api.block_reward.to_string()));
// reward yearly
ui.add_sized(
size,
Label::new(
RichText::new("Est. Reward (Yearly)")
.underline()
.color(BONE),
),
)
.on_hover_text(STATUS_XVB_YEARLY);
if api.reward_yearly.is_empty() {
ui.add_sized(size, Label::new("No information".to_string()));
} else {
ui.add_sized(
size,
Label::new(format!(
"{}: {} XMR\n{}: {} XMR\n{}: {} XMR\n{}: {} XMR\n{}: {} XMR",
XvbRound::Vip,
api.reward_yearly[0],
XvbRound::Donor,
api.reward_yearly[1],
XvbRound::DonorVip,
api.reward_yearly[2],
XvbRound::DonorWhale,
api.reward_yearly[3],
XvbRound::DonorMega,
api.reward_yearly[4]
)),
);
}
});
})
// by round
});

View file

@ -119,7 +119,8 @@ impl Xmrig {
self.arguments.truncate(1024);
})
});
ui.set_enabled(self.arguments.is_empty());
ui.add_enabled_ui(self.arguments.is_empty(), |ui|{
//---------------------------------------------------------------------------------------------------- Address
debug!("XMRig Tab | Rendering [Address]");
ui.group(|ui| {
@ -149,6 +150,7 @@ impl Xmrig {
.on_hover_text(XMRIG_ADDRESS);
self.address.truncate(95);
});
});
}
//---------------------------------------------------------------------------------------------------- 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);
// If the pool already exists, show [Save] and mutate the already existing pool
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() {
let pool = Pool {
rig: self.rig.clone(),
@ -335,9 +337,10 @@ impl Xmrig {
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);
}
});
// Else, add to the list
} 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() {
let pool = Pool {
rig: self.rig.clone(),
@ -352,12 +355,13 @@ impl Xmrig {
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);
}
});
}
});
// [Delete]
ui.horizontal(|ui| {
ui.set_enabled(pool_vec_len > 1);
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);
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);
if ui.add_sized([width, text_edit], Button::new("Delete")).on_hover_text(text).clicked() {
let new_name;
let new_pool;
@ -383,16 +387,19 @@ impl Xmrig {
self.ip = new_pool.ip;
self.port = new_pool.port;
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.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() {
self.name.clear();
self.rig.clear();
self.ip.clear();
self.port.clear();
}
});
});
});
});

View file

@ -109,7 +109,9 @@ impl XmrigProxy {
self.arguments.truncate(1024);
})
});
ui.set_enabled(self.arguments.is_empty());
if !self.arguments.is_empty() {
ui.disable();
}
ui.add_space(space_h);
ui.style_mut().spacing.icon_width_inner = width / 45.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);
// If the pool already exists, show [Save] and mutate the already existing pool
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() {
let pool = Pool {
rig: self.rig.clone(),
@ -276,9 +278,11 @@ impl XmrigProxy {
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);
}
});
// Else, add to the list
} 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() {
let pool = Pool {
rig: self.rig.clone(),
@ -293,11 +297,13 @@ impl XmrigProxy {
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);
}
});
}
});
// [Delete]
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);
if ui.add_sized([width, text_edit], Button::new("Delete")).on_hover_text(text).clicked() {
let new_name;
@ -325,15 +331,17 @@ impl XmrigProxy {
self.p2pool_port = new_pool.port;
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.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() {
self.name.clear();
self.rig.clear();
self.p2pool_ip.clear();
self.p2pool_port.clear();
}
});
});
});
});

View file

@ -281,7 +281,7 @@ impl crate::app::App {
let hide = sudo.hide;
if sudo.testing {
ui.add_sized([width, height], Spinner::new().size(height));
ui.set_enabled(false);
ui.disable()
} else {
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).
sysinfo.refresh_cpu_specifics(sysinfo_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]");
sysinfo.refresh_memory();
debug!("Helper | Sysinfo refresh (3/3) ... [memory]");

View file

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

View file

@ -12,18 +12,18 @@ use super::PubXvbApi;
#[derive(Debug, Clone, Default, Display, Deserialize, PartialEq)]
pub enum XvbRound {
#[default]
#[display(fmt = "VIP")]
#[display("VIP")]
#[serde(alias = "vip")]
Vip,
#[serde(alias = "donor")]
Donor,
#[display(fmt = "VIP Donor")]
#[display("VIP Donor")]
#[serde(alias = "donor_vip")]
DonorVip,
#[display(fmt = "Whale Donor")]
#[display("Whale Donor")]
#[serde(alias = "donor_whale")]
DonorWhale,
#[display(fmt = "Mega Donor")]
#[display("Mega Donor")]
#[serde(alias = "donor_mega")]
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.max_inner_size = Some(Vec2::new(APP_MAX_WIDTH, APP_MAX_HEIGHT));
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)
.expect("Failed to read icon bytes")
.to_rgba8();

View file

@ -20,10 +20,10 @@
// Only (windows|macos|linux) + (x64|arm64) are supported.
#[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",)))]
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::cli::Cli;
@ -96,7 +96,7 @@ fn main() {
options,
Box::new(move |cc| {
egui_extras::install_image_loaders(&cc.egui_ctx);
Box::new(App::cc(cc, resolution, app))
Ok(Box::new(App::cc(cc, resolution, app)))
}),
)
.unwrap();