mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2024-12-22 14:49:21 +00:00
fix: Ui overlapping for small screen
This commit is contained in:
parent
4f13862136
commit
0f67fe7a08
7 changed files with 55 additions and 34 deletions
|
@ -41,6 +41,7 @@
|
|||
- [x] without hero option, to give minimum to be in most accessible round type
|
||||
- [x] sleep 10mn less time to spare then ask Xmrig to mine on XvB node
|
||||
- [x] output log to console in XvB tab
|
||||
- [x] fix some overlapping from upstream
|
||||
- [ ] edit metadata of project
|
||||
- [ ] adapt README for XvB
|
||||
- [ ] adapt doc for new code
|
||||
|
|
|
@ -16,6 +16,8 @@ impl P2pool {
|
|||
text_edit: f32,
|
||||
node_vec: &mut Vec<(String, Node)>,
|
||||
) {
|
||||
let height = size.y / 16.0;
|
||||
let space_h = size.y / 128.0;
|
||||
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]
|
||||
|
@ -228,16 +230,16 @@ impl P2pool {
|
|||
});
|
||||
});
|
||||
});
|
||||
ui.add_space(5.0);
|
||||
// ui.add_space(space_h);
|
||||
|
||||
debug!("P2Pool Tab | Rendering [Main/Mini/Peers/Log] elements");
|
||||
// [Main/Mini]
|
||||
ui.horizontal(|ui| {
|
||||
let height = size.y / 4.0;
|
||||
let height = height / 4.0;
|
||||
ui.group(|ui| {
|
||||
ui.horizontal(|ui| {
|
||||
let width = (size.x / 4.0) - SPACE;
|
||||
let height = height + 6.0;
|
||||
let height = height + space_h;
|
||||
if ui
|
||||
.add_sized(
|
||||
[width, height],
|
||||
|
@ -292,7 +294,9 @@ impl P2pool {
|
|||
debug!("P2Pool Tab | Rendering Backup host button");
|
||||
ui.group(|ui| {
|
||||
let width = size.x - SPACE;
|
||||
let height = ui.available_height() / 3.0;
|
||||
let height = ui.available_height();
|
||||
ui.style_mut().spacing.icon_width = height;
|
||||
ui.style_mut().spacing.icon_width_inner = height * 0.9;
|
||||
// [Backup host]
|
||||
ui.add_sized(
|
||||
[width, height],
|
||||
|
|
|
@ -48,7 +48,8 @@ impl P2pool {
|
|||
debug!("P2Pool Tab | Rendering [Console]");
|
||||
ui.group(|ui| {
|
||||
if self.simple {
|
||||
let height = size.y / 2.8;
|
||||
// height of console = height - address - simple(dropmenu, select_bar, buttons, warning)
|
||||
let height = (size.y * 0.38) - SPACE;
|
||||
let width = size.x - SPACE;
|
||||
egui::Frame::none().fill(DARK_GRAY).show(ui, |ui| {
|
||||
ui.style_mut().override_text_style = Some(Name("MonospaceSmall".into()));
|
||||
|
@ -66,7 +67,12 @@ impl P2pool {
|
|||
});
|
||||
//---------------------------------------------------------------------------------------------------- [Advanced] Console
|
||||
} else {
|
||||
let height = height / 2.8;
|
||||
// fix for advanced submenu overlap on bottom when small window
|
||||
let height = if size.y < 600.0 {
|
||||
size.y * 0.22 - SPACE
|
||||
} else {
|
||||
size.y * 0.36 - SPACE
|
||||
};
|
||||
let width = width - SPACE;
|
||||
egui::Frame::none().fill(DARK_GRAY).show(ui, |ui| {
|
||||
ui.style_mut().override_text_style = Some(Name("MonospaceSmall".into()));
|
||||
|
@ -155,7 +161,7 @@ impl P2pool {
|
|||
self.address.truncate(95);
|
||||
});
|
||||
|
||||
let height = ui.available_height();
|
||||
// let height = ui.available_height();
|
||||
let size = vec2(width, height);
|
||||
if self.simple {
|
||||
//---------------------------------------------------------------------------------------------------- Simple
|
||||
|
|
|
@ -21,8 +21,9 @@ use log::*;
|
|||
impl P2pool {
|
||||
pub(super) fn simple(&mut self, ui: &mut Ui, size: Vec2, ping: &Arc<Mutex<Ping>>) {
|
||||
// [Node]
|
||||
let height = size.y / 6.5;
|
||||
ui.spacing_mut().slider_width = size.x - 8.0;
|
||||
let height = size.y / 13.0;
|
||||
let space_h = size.y / 96.0;
|
||||
ui.spacing_mut().slider_width = size.x - 16.0;
|
||||
ui.spacing_mut().icon_width = size.x / 25.0;
|
||||
|
||||
// [Auto-select] if we haven't already.
|
||||
|
@ -73,7 +74,7 @@ impl P2pool {
|
|||
});
|
||||
});
|
||||
|
||||
ui.add_space(5.0);
|
||||
ui.add_space(space_h);
|
||||
|
||||
debug!("P2Pool Tab | Rendering [Select fastest ... Ping] buttons");
|
||||
ui.horizontal(|ui| {
|
||||
|
@ -142,16 +143,16 @@ impl P2pool {
|
|||
let msg = RichText::new(format!("{} ... {}%", lock!(ping).msg, prog));
|
||||
let height = height / 1.25;
|
||||
let size = vec2(size.x, height);
|
||||
ui.add_space(5.0);
|
||||
ui.add_space(space_h);
|
||||
ui.add_sized(size, Label::new(msg));
|
||||
ui.add_space(5.0);
|
||||
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(5.0);
|
||||
ui.add_space(space_h);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -167,11 +167,14 @@ fn p2pool(
|
|||
.on_hover_text(STATUS_P2POOL_SHARES);
|
||||
ui.add_sized(
|
||||
[width, height],
|
||||
Label::new((if let Some(s) = api.shares_found {
|
||||
Label::new(
|
||||
(if let Some(s) = api.shares_found {
|
||||
s.to_string()
|
||||
} else {
|
||||
UNKNOWN_DATA.to_string()
|
||||
}).to_string()),
|
||||
})
|
||||
.to_string(),
|
||||
),
|
||||
);
|
||||
ui.add_sized(
|
||||
[width, height],
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use egui::TextStyle::{self, Name};
|
||||
use egui::{vec2, Image, RichText, TextEdit, Ui, Vec2};
|
||||
use egui::{vec2, Image, RichText, TextEdit, Ui, Vec2};
|
||||
use log::debug;
|
||||
use readable::num::Float;
|
||||
|
||||
|
@ -48,7 +48,7 @@ impl crate::disk::state::Xvb {
|
|||
debug!("XvB Tab | Rendering [Console]");
|
||||
ui.group(|ui| {
|
||||
let height = size.y / 2.8;
|
||||
let width = size.x - space_h;
|
||||
let width = size.x - (space_h / 2.0);
|
||||
egui::Frame::none().fill(DARK_GRAY).show(ui, |ui| {
|
||||
ui.style_mut().override_text_style = Some(Name("MonospaceSmall".into()));
|
||||
egui::ScrollArea::vertical()
|
||||
|
@ -109,7 +109,7 @@ impl crate::disk::state::Xvb {
|
|||
ui.horizontal_wrapped(|ui|{
|
||||
ui.label(RichText::new("You don't have any payout address set in the P2pool Tab ! XvB process needs one to function properly.")
|
||||
.color(ORANGE));
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -197,12 +197,12 @@ impl crate::disk::state::Xvb {
|
|||
});
|
||||
});
|
||||
// Rules link help
|
||||
ui.horizontal_centered(|ui| {
|
||||
ui.horizontal_centered(|ui| {
|
||||
// can't have horizontal and vertical centering work together so fix by this.
|
||||
ui.add_space((width /2.0)-(ui.text_style_height( &TextStyle::Heading) * 1.5 ));
|
||||
ui.add_space((width / 2.0) - (ui.text_style_height(&TextStyle::Heading) * 1.5));
|
||||
ui.style_mut().override_text_style = Some(TextStyle::Heading);
|
||||
ui.hyperlink_to("Rules", XVB_URL_RULES)
|
||||
.on_hover_text("Click here to read the rules and understand how the raffle works.");
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
32
src/inits.rs
32
src/inits.rs
|
@ -1,22 +1,24 @@
|
|||
use std::io::Write;
|
||||
use crate::components::update::Update;
|
||||
use crate::helper::{Helper, ProcessSignal};
|
||||
use crate::utils::constants::{APP_MIN_WIDTH, APP_MIN_HEIGHT, APP_MAX_WIDTH, APP_MAX_HEIGHT, BYTES_ICON};
|
||||
use crate::utils::constants::{
|
||||
APP_MAX_HEIGHT, APP_MAX_WIDTH, APP_MIN_HEIGHT, APP_MIN_WIDTH, BYTES_ICON,
|
||||
};
|
||||
use crate::utils::regex::Regexes;
|
||||
use std::io::Write;
|
||||
//---------------------------------------------------------------------------------------------------- Init functions
|
||||
use crate::{components::node::Ping, miscs::clamp_scale};
|
||||
use crate::app::App;
|
||||
use std::sync::Arc;
|
||||
use std::time::Instant;
|
||||
use crate::{components::node::Ping, miscs::clamp_scale};
|
||||
use crate::{disk::state::*, utils::macros::lock};
|
||||
use crate::{info, warn};
|
||||
use eframe::NativeOptions;
|
||||
use egui::TextStyle::Small;
|
||||
use egui::TextStyle::{Body, Button, Heading, Monospace, Name};
|
||||
use egui::*;
|
||||
use env_logger::fmt::style::Style;
|
||||
use env_logger::{Builder, WriteStyle};
|
||||
use log::LevelFilter;
|
||||
use egui::TextStyle::{Body, Button, Monospace, Heading, Name};
|
||||
use crate::{disk::state::*, utils::macros::lock};
|
||||
use egui::TextStyle::Small;
|
||||
use crate::{info, warn};
|
||||
use egui::*;
|
||||
use std::sync::Arc;
|
||||
use std::time::Instant;
|
||||
|
||||
#[cold]
|
||||
#[inline(never)]
|
||||
|
@ -87,7 +89,7 @@ pub fn init_logger(now: Instant) {
|
|||
.format(move |buf, record| {
|
||||
let level = record.level();
|
||||
let level_style = buf.default_level_style(level);
|
||||
let dimmed = Style::new().dimmed();
|
||||
let dimmed = Style::new().dimmed();
|
||||
writeln!(
|
||||
buf,
|
||||
"{level_style}[{}]{level_style:#} [{dimmed}{:.3}{dimmed:#}] [{dimmed}{}{dimmed:#}:{dimmed}{}{dimmed:#}] {}",
|
||||
|
@ -208,9 +210,13 @@ pub fn init_auto(app: &mut App) {
|
|||
}
|
||||
// [Auto-XvB]
|
||||
if app.state.gupax.auto_xvb {
|
||||
Helper::start_xvb(&app.helper, &app.state.xvb, &app.state.p2pool, &app.state.xmrig);
|
||||
Helper::start_xvb(
|
||||
&app.helper,
|
||||
&app.state.xvb,
|
||||
&app.state.p2pool,
|
||||
&app.state.xmrig,
|
||||
);
|
||||
} else {
|
||||
info!("Skipping auto-xvb...");
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue