mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2025-01-02 20:19:36 +00:00
feat: make scrollbar appears when needed.
Some checks are pending
Lockbud / lockbud (push) Waiting to run
Rust / clippy (ubuntu-latest) (push) Waiting to run
Rust / check (macos-latest) (push) Waiting to run
Rust / check (ubuntu-latest) (push) Waiting to run
Rust / doc (push) Waiting to run
Rust / fmt (push) Waiting to run
Rust / test (push) Waiting to run
Rust / clippy (macos-latest) (push) Waiting to run
Typo / typo (push) Waiting to run
Some checks are pending
Lockbud / lockbud (push) Waiting to run
Rust / clippy (ubuntu-latest) (push) Waiting to run
Rust / check (macos-latest) (push) Waiting to run
Rust / check (ubuntu-latest) (push) Waiting to run
Rust / doc (push) Waiting to run
Rust / fmt (push) Waiting to run
Rust / test (push) Waiting to run
Rust / clippy (macos-latest) (push) Waiting to run
Typo / typo (push) Waiting to run
This commit is contained in:
parent
07e3b49338
commit
52db04a3a3
3 changed files with 9 additions and 15 deletions
|
@ -321,20 +321,16 @@ impl Gupax {
|
||||||
/// widget: AutoStart variant and selectable label (true) or checkbox (false)
|
/// widget: AutoStart variant and selectable label (true) or checkbox (false)
|
||||||
pub fn horizontal_flex_auto_start(&mut self, ui: &mut Ui, auto_starts: &[AutoStart]) {
|
pub fn horizontal_flex_auto_start(&mut self, ui: &mut Ui, auto_starts: &[AutoStart]) {
|
||||||
let text_style = TextStyle::Button;
|
let text_style = TextStyle::Button;
|
||||||
// let height = ui.style().text_styles.get(&text_style).unwrap().size;
|
|
||||||
ui.style_mut().override_text_style = Some(text_style);
|
ui.style_mut().override_text_style = Some(text_style);
|
||||||
// width = (width - / number of tab) - (space between widget * 2.0 + space of separator / 2.0)
|
|
||||||
// ui.style_mut().spacing.item_spacing.x = 4.0;
|
|
||||||
let spacing = 2.0;
|
let spacing = 2.0;
|
||||||
// ui.with_layout(egui::Layout::left_to_right(egui::Align::Center), |ui| {
|
|
||||||
// ui.horizontal(|ui| {
|
|
||||||
ScrollArea::horizontal().show(ui, |ui| {
|
ScrollArea::horizontal().show(ui, |ui| {
|
||||||
ui.with_layout(egui::Layout::left_to_right(egui::Align::Min), |ui| {
|
ui.with_layout(egui::Layout::left_to_right(egui::Align::Min), |ui| {
|
||||||
let width = (((ui.available_width()) / auto_starts.len() as f32)
|
let width = (((ui.available_width()) / auto_starts.len() as f32)
|
||||||
- ((ui.style().spacing.item_spacing.x * 2.0) + (spacing / 2.0)))
|
- ((ui.style().spacing.item_spacing.x * 2.0) + spacing))
|
||||||
.max(0.0);
|
.max(0.0);
|
||||||
// TODO: calculate minimum width needed, if ui.available width is less, show items on two lines, then on 3 etc..
|
// TODO: calculate minimum width needed, if ui.available width is less, show items on two lines, then on 3 etc..
|
||||||
// checkbox padding + item spacing + text + separator
|
// checkbox padding + item spacing + text + separator
|
||||||
|
|
||||||
let size = [width, 0.0];
|
let size = [width, 0.0];
|
||||||
let len = auto_starts.iter().len();
|
let len = auto_starts.iter().len();
|
||||||
for (count, auto) in auto_starts.iter().enumerate() {
|
for (count, auto) in auto_starts.iter().enumerate() {
|
||||||
|
|
|
@ -43,9 +43,6 @@ impl crate::disk::state::Xvb {
|
||||||
gui_api_xp: &Arc<Mutex<PubXmrigProxyApi>>,
|
gui_api_xp: &Arc<Mutex<PubXmrigProxyApi>>,
|
||||||
is_alive: bool,
|
is_alive: bool,
|
||||||
) {
|
) {
|
||||||
// let text_edit = ui.available_height() / 25.0;
|
|
||||||
// let website_height = ui.available_height() / 10.0;
|
|
||||||
|
|
||||||
// logo and website link
|
// logo and website link
|
||||||
let logo = Some(Image::from_bytes("bytes:/xvb.png", BYTES_XVB));
|
let logo = Some(Image::from_bytes("bytes:/xvb.png", BYTES_XVB));
|
||||||
header_tab(
|
header_tab(
|
||||||
|
@ -95,6 +92,7 @@ impl crate::disk::state::Xvb {
|
||||||
});
|
});
|
||||||
ui.add_space(SPACE);
|
ui.add_space(SPACE);
|
||||||
// --------------------------- XVB Advanced -----------------------------------------
|
// --------------------------- XVB Advanced -----------------------------------------
|
||||||
|
ScrollArea::horizontal().id_salt("horizontal").show(ui, |ui| {
|
||||||
if !self.simple {
|
if !self.simple {
|
||||||
|
|
||||||
ui.group(|ui| {
|
ui.group(|ui| {
|
||||||
|
@ -174,7 +172,7 @@ impl crate::disk::state::Xvb {
|
||||||
self.manual_donation_metric = ManualDonationMetric::Mega;
|
self.manual_donation_metric = ManualDonationMetric::Mega;
|
||||||
self.manual_slider_amount = self.manual_amount_raw / 1_000_000.0;
|
self.manual_slider_amount = self.manual_amount_raw / 1_000_000.0;
|
||||||
};
|
};
|
||||||
ui.spacing_mut().slider_width = ui.text_style_height(&TextStyle::Button) * 15.3;
|
ui.spacing_mut().slider_width = ui.text_style_height(&TextStyle::Button) * 18.0;
|
||||||
ui.add_sized(
|
ui.add_sized(
|
||||||
[ui.available_width(), text_height],
|
[ui.available_width(), text_height],
|
||||||
egui::Slider::new(&mut self.manual_slider_amount, 0.0..=(hashrate_xmrig as f64))
|
egui::Slider::new(&mut self.manual_slider_amount, 0.0..=(hashrate_xmrig as f64))
|
||||||
|
@ -186,6 +184,7 @@ impl crate::disk::state::Xvb {
|
||||||
ui.add_space(SPACE);
|
ui.add_space(SPACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ui.spacing_mut().item_spacing.x = ui.text_style_height(&TextStyle::Button);
|
||||||
if self.mode == XvbMode::ManualDonationLevel {
|
if self.mode == XvbMode::ManualDonationLevel {
|
||||||
ui.add_space(SPACE);
|
ui.add_space(SPACE);
|
||||||
ui.horizontal(|ui| {
|
ui.horizontal(|ui| {
|
||||||
|
@ -249,7 +248,6 @@ impl crate::disk::state::Xvb {
|
||||||
// private stats
|
// private stats
|
||||||
ui.add_space(SPACE);
|
ui.add_space(SPACE);
|
||||||
// ui.add_enabled_ui(is_alive, |ui| {
|
// ui.add_enabled_ui(is_alive, |ui| {
|
||||||
ScrollArea::horizontal().id_salt("horizontal").show(ui, |ui| {
|
|
||||||
ui.add_enabled_ui(is_alive, |ui| {
|
ui.add_enabled_ui(is_alive, |ui| {
|
||||||
let api = &api.lock().unwrap();
|
let api = &api.lock().unwrap();
|
||||||
let priv_stats = &api.stats_priv;
|
let priv_stats = &api.stats_priv;
|
||||||
|
|
|
@ -40,10 +40,10 @@ pub fn init_text_styles(ctx: &egui::Context, pixels_per_point: f32) {
|
||||||
style.spacing.icon_spacing = 16.0;
|
style.spacing.icon_spacing = 16.0;
|
||||||
style.spacing.button_padding = [8.0, 8.0].into();
|
style.spacing.button_padding = [8.0, 8.0].into();
|
||||||
style.spacing.item_spacing = [8.0, 8.0].into();
|
style.spacing.item_spacing = [8.0, 8.0].into();
|
||||||
// style.spacing.scroll = egui::style::ScrollStyle {
|
style.spacing.scroll = egui::style::ScrollStyle {
|
||||||
// bar_width: 8.0,
|
bar_width: 12.0,
|
||||||
// ..egui::style::ScrollStyle::solid()
|
..egui::style::ScrollStyle::solid()
|
||||||
// };
|
};
|
||||||
});
|
});
|
||||||
// Make sure scale f32 is a regular number.
|
// Make sure scale f32 is a regular number.
|
||||||
let pixels_per_point = clamp_scale(pixels_per_point);
|
let pixels_per_point = clamp_scale(pixels_per_point);
|
||||||
|
|
Loading…
Reference in a new issue