mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2024-12-22 06:39:21 +00:00
fix: add missing vertical scrollbar
adjust width grow of sliders
This commit is contained in:
parent
a920c53d56
commit
4ebd48f3b5
6 changed files with 239 additions and 220 deletions
|
@ -1,4 +1,4 @@
|
|||
use egui::{Button, ComboBox, RichText, SelectableLabel, Ui};
|
||||
use egui::{Button, ComboBox, RichText, SelectableLabel, TextStyle, Ui};
|
||||
use log::{debug, info};
|
||||
|
||||
use crate::{
|
||||
|
@ -54,18 +54,6 @@ impl PoolNode {
|
|||
PoolNode::Pool(p) => p.rig = new_custom,
|
||||
}
|
||||
}
|
||||
// pub fn from_vec_node(vec_node: Vec<(String, Node)>) -> Vec<(String, Self)> {
|
||||
// vec_node
|
||||
// .into_iter()
|
||||
// .map(|(name, node)| (name, PoolNode::Node(node)))
|
||||
// .collect()
|
||||
// }
|
||||
// pub fn from_vec_pool(vec_node: Vec<(String, Pool)>) -> Vec<(String, Self)> {
|
||||
// vec_node
|
||||
// .into_iter()
|
||||
// .map(|(name, pool)| (name, PoolNode::Pool(pool)))
|
||||
// .collect()
|
||||
// }
|
||||
}
|
||||
/// compatible for P2Pool and Xmrig/Proxy
|
||||
/// current is (name, ip, port, zmq/rig)
|
||||
|
@ -78,8 +66,9 @@ pub fn list_poolnode(
|
|||
) {
|
||||
ui.vertical(|ui| {
|
||||
ui.spacing_mut().item_spacing.y = 0.0;
|
||||
// ui.spacing_mut().button_padding.x = ui.available_width() / 2.0;
|
||||
let width = ui.available_width();
|
||||
let width = ui
|
||||
.available_width()
|
||||
.max(ui.text_style_height(&TextStyle::Button) * 28.0);
|
||||
// [Manual node selection]
|
||||
// [Ping List]
|
||||
debug!("P2Pool Tab | Rendering [Node List]");
|
||||
|
|
|
@ -28,7 +28,7 @@ pub fn slider_state_field(
|
|||
ui.style_mut().spacing.slider_width = (ui.available_width()
|
||||
- ui.spacing().item_spacing.x * 4.0
|
||||
- ui.spacing().scroll.bar_width
|
||||
- SPACE * 2.0
|
||||
- SPACE * 1.0
|
||||
+ 2.0)
|
||||
.max(80.0);
|
||||
ui.add_sized(
|
||||
|
|
|
@ -14,9 +14,11 @@ impl P2pool {
|
|||
debug!("P2Pool Tab | Rendering [Node List] elements");
|
||||
let mut incorrect_input = false; // This will disable [Add/Delete] on bad input
|
||||
// [Monero node IP/RPC/ZMQ]
|
||||
egui::ScrollArea::horizontal()
|
||||
.id_salt("p2pool_horizontal")
|
||||
.show(ui, |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
ui.group(|ui| {
|
||||
// let width = size.x/10.0;
|
||||
ui.vertical(|ui| {
|
||||
if !self.name_field(ui) {
|
||||
incorrect_input = false;
|
||||
|
@ -40,7 +42,6 @@ impl P2pool {
|
|||
);
|
||||
});
|
||||
});
|
||||
// ui.add_space(space_h);
|
||||
|
||||
debug!("P2Pool Tab | Rendering [Main/Mini/Peers/Log] elements");
|
||||
// [Main/Mini]
|
||||
|
@ -48,12 +49,11 @@ impl P2pool {
|
|||
// let height = height / 4.0;
|
||||
ui.group(|ui| {
|
||||
ui.vertical(|ui| {
|
||||
let height = height_txt_before_button(ui, &egui::TextStyle::Button) * 1.9;
|
||||
let height =
|
||||
height_txt_before_button(ui, &egui::TextStyle::Button) * 1.9;
|
||||
ui.horizontal(|ui| {
|
||||
let width = (ui.available_width() / 4.0) - SPACE;
|
||||
let width = ((ui.available_width() / 4.0) - SPACE).max(80.0);
|
||||
if ui
|
||||
// if ui.add_sized(, )
|
||||
// .selectable_label(!self.mini, "P2Pool Main")
|
||||
.add_sized(
|
||||
[width, height],
|
||||
SelectableLabel::new(!self.mini, "P2Pool Main"),
|
||||
|
@ -64,8 +64,6 @@ impl P2pool {
|
|||
self.mini = false;
|
||||
}
|
||||
if ui
|
||||
// .selectable_label(!self.mini, "P2Pool Mini")
|
||||
// if ui
|
||||
.add_sized(
|
||||
[width, height],
|
||||
SelectableLabel::new(self.mini, "P2Pool Mini"),
|
||||
|
@ -83,7 +81,6 @@ impl P2pool {
|
|||
[(ui.available_width() / 2.0) - (SPACE * 2.0), height],
|
||||
Checkbox::new(&mut self.backup_host, "Backup host"),
|
||||
)
|
||||
// ui.checkbox(&mut self.backup_host, "Backup host")
|
||||
.on_hover_text(P2POOL_BACKUP_HOST_ADVANCED);
|
||||
});
|
||||
});
|
||||
|
@ -118,6 +115,7 @@ impl P2pool {
|
|||
})
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
fn name_field(&mut self, ui: &mut Ui) -> bool {
|
||||
StateTextEdit::new(ui)
|
||||
|
|
|
@ -100,6 +100,9 @@ impl Xmrig {
|
|||
);
|
||||
});
|
||||
if !self.simple {
|
||||
egui::ScrollArea::horizontal()
|
||||
.id_salt("xmrig_horizontal")
|
||||
.show(ui, |ui| {
|
||||
debug!("XMRig Tab | Rendering [Pool List] elements");
|
||||
let mut incorrect_input = false; // This will disable [Add/Delete] on bad input
|
||||
ui.horizontal(|ui| {
|
||||
|
@ -121,7 +124,12 @@ impl Xmrig {
|
|||
ui.vertical(|ui| {
|
||||
list_poolnode(
|
||||
ui,
|
||||
&mut (&mut self.name, &mut self.ip, &mut self.port, &mut self.rig),
|
||||
&mut (
|
||||
&mut self.name,
|
||||
&mut self.ip,
|
||||
&mut self.port,
|
||||
&mut self.rig,
|
||||
),
|
||||
&mut self.selected_pool,
|
||||
pool_vec,
|
||||
incorrect_input,
|
||||
|
@ -145,17 +153,25 @@ impl Xmrig {
|
|||
ui.horizontal(|ui| {
|
||||
let width = (ui.available_width() / 2.0) - 11.0;
|
||||
let height =
|
||||
height_txt_before_button(ui, &egui::TextStyle::Button) * 2.0;
|
||||
height_txt_before_button(ui, &egui::TextStyle::Button)
|
||||
* 2.0;
|
||||
let size = vec2(width, height);
|
||||
ui.add_sized(size, Checkbox::new(&mut self.tls, "TLS Connection"))
|
||||
ui.add_sized(
|
||||
size,
|
||||
Checkbox::new(&mut self.tls, "TLS Connection"),
|
||||
)
|
||||
.on_hover_text(XMRIG_TLS);
|
||||
ui.separator();
|
||||
ui.add_sized(size, Checkbox::new(&mut self.keepalive, "Keepalive"))
|
||||
ui.add_sized(
|
||||
size,
|
||||
Checkbox::new(&mut self.keepalive, "Keepalive"),
|
||||
)
|
||||
.on_hover_text(XMRIG_KEEPALIVE);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -89,6 +89,9 @@ impl XmrigProxy {
|
|||
// let width = ui.available_width() - 10.0;
|
||||
let mut incorrect_input = false; // This will disable [Add/Delete] on bad input
|
||||
// [Pool IP/Port]
|
||||
egui::ScrollArea::horizontal()
|
||||
.id_salt("proxy_horizontal")
|
||||
.show(ui, |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
ui.group(|ui| {
|
||||
// let width = width / 10.0;
|
||||
|
@ -110,7 +113,12 @@ impl XmrigProxy {
|
|||
ui.vertical(|ui| {
|
||||
list_poolnode(
|
||||
ui,
|
||||
&mut (&mut self.name, &mut self.ip, &mut self.port, &mut self.rig),
|
||||
&mut (
|
||||
&mut self.name,
|
||||
&mut self.ip,
|
||||
&mut self.port,
|
||||
&mut self.rig,
|
||||
),
|
||||
&mut self.selected_pool,
|
||||
pool_vec,
|
||||
incorrect_input,
|
||||
|
@ -137,17 +145,25 @@ impl XmrigProxy {
|
|||
// TLS/Keepalive
|
||||
ui.horizontal(|ui| {
|
||||
let width = (ui.available_width() / 2.0) - 11.0;
|
||||
let height = height_txt_before_button(ui, &TextStyle::Button) * 2.0;
|
||||
let height =
|
||||
height_txt_before_button(ui, &TextStyle::Button) * 2.0;
|
||||
let size = vec2(width, height);
|
||||
ui.add_sized(size, Checkbox::new(&mut self.tls, "TLS Connection"))
|
||||
ui.add_sized(
|
||||
size,
|
||||
Checkbox::new(&mut self.tls, "TLS Connection"),
|
||||
)
|
||||
.on_hover_text(XMRIG_TLS);
|
||||
ui.separator();
|
||||
ui.add_sized(size, Checkbox::new(&mut self.keepalive, "Keepalive"))
|
||||
ui.add_sized(
|
||||
size,
|
||||
Checkbox::new(&mut self.keepalive, "Keepalive"),
|
||||
)
|
||||
.on_hover_text(XMRIG_KEEPALIVE);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -248,6 +248,7 @@ impl crate::disk::state::Xvb {
|
|||
// private stats
|
||||
ui.add_space(SPACE);
|
||||
// ui.add_enabled_ui(is_alive, |ui| {
|
||||
ScrollArea::horizontal().id_salt("horizontal").show(ui, |ui| {
|
||||
ui.add_enabled_ui(is_alive, |ui| {
|
||||
let api = &api.lock().unwrap();
|
||||
let priv_stats = &api.stats_priv;
|
||||
|
@ -259,7 +260,6 @@ impl crate::disk::state::Xvb {
|
|||
let width_column = ui.text_style_height(&TextStyle::Body) * 16.0;
|
||||
let height_column = 0.0;
|
||||
ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Extend);
|
||||
ScrollArea::horizontal().id_salt("horizontal").show(ui, |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
// Failures
|
||||
stat_box(ui, XVB_FAILURE_FIELD, &priv_stats.fails.to_string(), width_column, height_column, style_height);
|
||||
|
@ -294,7 +294,6 @@ if priv_stats.win_current {
|
|||
"You are not the winner"
|
||||
}
|
||||
, width_column, height_column, style_height);
|
||||
});
|
||||
});
|
||||
ui.vertical(|ui| {
|
||||
ui.group(|ui| {
|
||||
|
@ -320,6 +319,7 @@ if priv_stats.win_current {
|
|||
.on_disabled_hover_text("Algorithm is not running.");
|
||||
// indicators
|
||||
})
|
||||
});
|
||||
// currently mining on
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue