mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2024-11-16 15:27:46 +00:00
fix: clean up ui and align widgets
This commit is contained in:
parent
23a7a7f341
commit
41999f098f
1 changed files with 39 additions and 18 deletions
|
@ -116,25 +116,46 @@ impl crate::disk::state::Xvb {
|
|||
ui.style_mut().spacing.icon_width = width / 35.0;
|
||||
ui.style_mut().spacing.icon_spacing = space_h;
|
||||
|
||||
egui::ComboBox::from_label("")
|
||||
.selected_text(format!("{:?}", self.mode))
|
||||
.show_ui(ui, |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
ui.selectable_value(&mut self.mode, XvbMode::Auto, "Automatic");
|
||||
ui.selectable_value(&mut self.mode, XvbMode::Hero, "Hero Mode");
|
||||
ui.selectable_value(&mut self.mode, XvbMode::ManuallyDonate, "Manually Donate");
|
||||
ui.selectable_value(&mut self.mode, XvbMode::ManuallyKeep, "Manually Keep");
|
||||
})
|
||||
});
|
||||
if self.mode == XvbMode::ManuallyDonate || self.mode == XvbMode::ManuallyKeep {
|
||||
ui.horizontal(|ui| {
|
||||
ui.add(
|
||||
TextEdit::singleline(&mut self.amount)
|
||||
.vertical_align(egui::Align::Center)
|
||||
).on_hover_text(XVB_MANUAL_HASHRATE_HELP)
|
||||
});
|
||||
}
|
||||
|
||||
ui.group(|ui| {
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.horizontal(|ui| {
|
||||
|
||||
egui::ComboBox::from_label("")
|
||||
.selected_text(format!("{:?}", self.mode))
|
||||
.show_ui(ui, |ui| {
|
||||
ui.selectable_value(&mut self.mode, XvbMode::Auto, "Automatic");
|
||||
ui.selectable_value(&mut self.mode, XvbMode::Hero, "Hero Mode");
|
||||
ui.selectable_value(&mut self.mode, XvbMode::ManuallyDonate, "Manually Donate");
|
||||
ui.selectable_value(&mut self.mode, XvbMode::ManuallyKeep, "Manually Keep");
|
||||
});
|
||||
if self.mode == XvbMode::ManuallyDonate || self.mode == XvbMode::ManuallyKeep {
|
||||
let (text, color) = if self.amount.is_empty() {
|
||||
(
|
||||
format!(""),
|
||||
LIGHT_GRAY,
|
||||
)
|
||||
} else if self.amount.parse::<u32>().is_ok() {
|
||||
(format!("✔"), GREEN)
|
||||
} else {
|
||||
(
|
||||
format!("Invalid hashrate ❌"),
|
||||
RED,
|
||||
)
|
||||
};
|
||||
|
||||
ui.add_space(space_h);
|
||||
|
||||
ui.colored_label(color, text);
|
||||
ui.add(
|
||||
TextEdit::singleline(&mut self.amount)
|
||||
.vertical_align(egui::Align::Center)
|
||||
).on_hover_text(XVB_MANUAL_HASHRATE_HELP);
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue