mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2025-01-08 15:09:24 +00:00
fix: impl Display for XvbMode
This commit is contained in:
parent
ce9e378633
commit
b8cd36eeb2
2 changed files with 28 additions and 18 deletions
|
@ -152,25 +152,21 @@ impl crate::disk::state::Xvb {
|
||||||
ui.vertical_centered(|ui| {
|
ui.vertical_centered(|ui| {
|
||||||
ui.horizontal(|ui| {
|
ui.horizontal(|ui| {
|
||||||
|
|
||||||
|
|
||||||
let selected_text = match self.mode {
|
|
||||||
XvbMode::Auto => "Auto".to_string(),
|
|
||||||
XvbMode::Hero => "Hero".to_string(),
|
|
||||||
XvbMode::ManualXvb => "Manual Xvb".to_string(),
|
|
||||||
XvbMode::ManualP2pool => "Manual P2pool".to_string(),
|
|
||||||
XvbMode::ManualDonationLevel => "Manual Donation Level".to_string()
|
|
||||||
};
|
|
||||||
|
|
||||||
egui::ComboBox::from_label("")
|
egui::ComboBox::from_label("")
|
||||||
.selected_text(selected_text)
|
.selected_text(self.mode.to_string())
|
||||||
.show_ui(ui, |ui| {
|
.show_ui(ui, |ui| {
|
||||||
ui.selectable_value(&mut self.mode, XvbMode::Auto, "Auto");
|
ui.selectable_value(&mut self.mode, XvbMode::Auto,
|
||||||
ui.selectable_value(&mut self.mode, XvbMode::Hero, "Hero");
|
XvbMode::Auto.to_string());
|
||||||
ui.selectable_value(&mut self.mode, XvbMode::ManualXvb, "Manual Xvb")
|
ui.selectable_value(&mut self.mode, XvbMode::Hero,
|
||||||
|
XvbMode::Hero.to_string());
|
||||||
|
ui.selectable_value(&mut self.mode, XvbMode::ManualXvb,
|
||||||
|
XvbMode::ManualXvb.to_string())
|
||||||
.on_hover_text(XVB_MODE_MANUAL_XVB_HELP);
|
.on_hover_text(XVB_MODE_MANUAL_XVB_HELP);
|
||||||
ui.selectable_value(&mut self.mode, XvbMode::ManualP2pool, "Manual P2pool")
|
ui.selectable_value(&mut self.mode, XvbMode::ManualP2pool,
|
||||||
|
XvbMode::ManualP2pool.to_string())
|
||||||
.on_hover_text(XVB_MODE_MANUAL_P2POOL_HELP);
|
.on_hover_text(XVB_MODE_MANUAL_P2POOL_HELP);
|
||||||
ui.selectable_value(&mut self.mode, XvbMode::ManualDonationLevel, "Manual Donation Level")
|
ui.selectable_value(&mut self.mode, XvbMode::ManualDonationLevel,
|
||||||
|
XvbMode::ManualDonationLevel.to_string())
|
||||||
.on_hover_text(XVB_MODE_MANUAL_DONATION_LEVEL_HELP);
|
.on_hover_text(XVB_MODE_MANUAL_DONATION_LEVEL_HELP);
|
||||||
});
|
});
|
||||||
if self.mode == XvbMode::ManualXvb || self.mode == XvbMode::ManualP2pool {
|
if self.mode == XvbMode::ManualXvb || self.mode == XvbMode::ManualP2pool {
|
||||||
|
|
|
@ -265,6 +265,20 @@ pub enum XvbMode {
|
||||||
ManualDonationLevel,
|
ManualDonationLevel,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Display for XvbMode {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
let text = match self {
|
||||||
|
Self::Auto => "Auto",
|
||||||
|
Self::Hero => "Hero",
|
||||||
|
Self::ManualXvb => "Manual Xvb",
|
||||||
|
Self::ManualP2pool => "Manual P2pool",
|
||||||
|
Self::ManualDonationLevel => "Manual Donation Level"
|
||||||
|
};
|
||||||
|
|
||||||
|
write!(f, "{}", text)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Eq, PartialEq, Debug, Deserialize, Serialize, Default)]
|
#[derive(Clone, Eq, PartialEq, Debug, Deserialize, Serialize, Default)]
|
||||||
pub enum ManualDonationLevel {
|
pub enum ManualDonationLevel {
|
||||||
#[default]
|
#[default]
|
||||||
|
@ -405,11 +419,11 @@ impl Default for Xvb {
|
||||||
simple: true,
|
simple: true,
|
||||||
token: "".to_string(),
|
token: "".to_string(),
|
||||||
simple_hero_mode: false,
|
simple_hero_mode: false,
|
||||||
mode: XvbMode::Auto,
|
mode: XvbMode::default(),
|
||||||
manual_amount_raw: 0.0,
|
manual_amount_raw: 0.0,
|
||||||
manual_slider_amount: 0.0,
|
manual_slider_amount: 0.0,
|
||||||
manual_donation_level: ManualDonationLevel::Donor,
|
manual_donation_level: ManualDonationLevel::default(),
|
||||||
manual_donation_metric: ManualDonationMetric::Hash,
|
manual_donation_metric: ManualDonationMetric::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue