Add Lutris settings to UI

This commit is contained in:
Philip Kristoffersen
2022-03-14 20:50:06 +01:00
parent 7f93ba6acd
commit 1f9d18c43a
2 changed files with 29 additions and 5 deletions
+13 -3
View File
@@ -8,7 +8,7 @@ class UserInterface {open
} {
Fl_Window win {
label {BoilR} open
xywh {1 1 500 475} type Double visible
xywh {1 1 500 525} type Double visible
} {
# ----- Steam -----
@@ -96,16 +96,26 @@ class UserInterface {open
xywh {25 375 155 25} down_box DOWN_BOX
}
# ----- Lutris -----
Fl_Check_Button enable_lutris_checkbox {
label Lutris
xywh {25 425 155 25} down_box DOWN_BOX
}
Fl_Input lutris_executable_input {
label {Lutris Executable}
xywh {175 425 300 25} align 5
}
# ----- Buttons -----
Fl_Button save_settings_button {
label {Save Settings}
xywh {25 425 125 25}
xywh {25 475 125 25}
}
Fl_Button synchronize_button {
label {Synchronize Games}
xywh {175 425 300 25}
xywh {175 475 300 25}
}
}
}
+16 -2
View File
@@ -1,9 +1,8 @@
use crate::sync::run_sync;
use crate::ui::UserInterface;
use crate::{egs::get_default_location, settings::Settings};
use fltk::enums::Color;
use fltk::{app, prelude::*};
use fltk_theme::{ColorTheme, WidgetTheme, color_themes, ThemeType};
use fltk_theme::{WidgetTheme, ThemeType};
use futures::executor::block_on;
use std::error::Error;
use std::{cell::RefCell, rc::Rc};
@@ -90,6 +89,10 @@ fn update_settings_with_ui_values(settings: &mut Settings, ui: &UserInterface) {
// Uplay
settings.uplay.enabled = ui.enable_uplay_checkbox.value();
// Lutris
settings.lutris.enabled = ui.enable_lutris_checkbox.value();
settings.lutris.executable = empty_or_whitespace(ui.lutris_executable_input.value());
}
fn save_settings_to_file(settings: &Settings) {
@@ -195,4 +198,15 @@ fn update_ui_with_settings(ui: &mut UserInterface, settings: &Settings) {
}
ui.enable_uplay_checkbox.set_value(settings.uplay.enabled);
ui.enable_lutris_checkbox.set_value(settings.lutris.enabled);
ui.lutris_executable_input.set_value(
settings
.lutris
.executable
.clone()
.unwrap_or(String::from("lutris"))
.as_str(),
);
}