Setup UI within feature UI

The feature is not enabled yet.
It will be enabled by default later when ui is ready.
This commit is contained in:
Philip Kristoffersen
2021-09-27 22:29:05 +02:00
parent dc90642e13
commit aeb1251b77
6 changed files with 125 additions and 6 deletions
Generated
+7
View File
@@ -194,6 +194,12 @@ dependencies = [
"synstructure",
]
[[package]]
name = "fl2rust"
version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82cf52a69f51e16cffda2993f68b33a0fafd0d664163f87fa80e5e4fec2fc232"
[[package]]
name = "fltk"
version = "1.2.3"
@@ -1084,6 +1090,7 @@ version = "0.2.0"
dependencies = [
"config",
"failure",
"fl2rust",
"fltk",
"reqwest",
"serde 1.0.130",
+7
View File
@@ -16,3 +16,10 @@ config = "0.11.0"
failure = "0.1.8"
#https://fltk-rs.github.io/fltk-rs/
fltk = { version = "^1.2", features = ["fltk-bundled"] }
[build-dependencies]
fl2rust = "0.4"
[features]
ui=[]
+9
View File
@@ -0,0 +1,9 @@
use std::path::PathBuf;
use std::env;
fn main() {
println!("cargo:rerun-if-changed=gui/mainview.fl");
let g = fl2rust::Generator::default();
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
g.in_out("gui/mainview.fl", out_path.join("mainview.rs").to_str().unwrap()).expect("Failed to generate rust from fl file!");
}
+91
View File
@@ -0,0 +1,91 @@
# data file for the Fltk User Interface Designer (fluid)
version 1.0305
header_name {.h}
code_name {.cxx}
class UserInterface {open
} {
Function {make_window()} {open
} {
Fl_Window win {
label {Main View} open
xywh {768 846 660 730} type Double visible
} {
Fl_Group {} {
label {Steam Shortcut Sync} open selected
xywh {25 65 635 650} labelsize 26 labelcolor 35 align 5
} {}
Fl_Group {} {
label Steam open
xywh {40 126 575 39} align 5
} {
Fl_Input steam_location_input {
label {Steam Location}
xywh {40 126 445 26} align 5
}
Fl_Button browse_steam_location_button {
label Browse
xywh {485 126 120 26}
}
}
Fl_Group {} {
label {Steamgrid DB} open
xywh {40 220 600 83} align 5
} {
Fl_Check_Button enable_steamgrid_db_checkbox {
label {Download Images}
tooltip {Download coverart for games from www.steamgriddb.com} xywh {40 230 155 26} down_box DOWN_BOX
}
Fl_Input steamgrid_db_auth_key_input {
label {Authentication Key}
xywh {40 275 445 26} align 5
}
}
Fl_Group {} {
label {Epic Games Store} open
xywh {40 350 575 108} align 5
} {
Fl_Check_Button enable_egs_checkbox {
label Synchronize
xywh {40 360 560 26} down_box DOWN_BOX
}
Fl_Input epic_location_input {
label {Epic Location}
xywh {40 405 445 26} align 5
}
Fl_Button browse_egs_location_button {
label Browse
xywh {485 405 120 26}
}
}
Fl_Group {} {
label Legendary open
xywh {40 480 580 104} align 5
} {
Fl_Check_Button enable_legendary_checkbox {
label Enable
xywh {40 490 570 26} down_box DOWN_BOX
}
Fl_Input legendary_executable_input {
label {Legendary Executable}
xywh {40 535 445 26} align 5
}
Fl_Button browse_legendary_executable_button {
label Browse
xywh {485 535 120 26}
}
}
Fl_Group action_buttons {open
xywh {37 652 495 50}
} {
Fl_Button save_settings_button {
label {Save Settings}
xywh {40 660 120 40}
}
Fl_Button synchronize_button {
label {Synchronize Games}
xywh {170 660 160 40}
}
}
}
}
}
+7 -6
View File
@@ -7,7 +7,7 @@ mod settings;
mod steam;
mod steamgriddb;
use fltk::{app, prelude::*, window::Window};
mod mainview;
use crate::{
egs::EpicPlatform,
@@ -21,12 +21,13 @@ use steam_shortcuts_util::{shortcut::ShortcutOwned, shortcuts_to_bytes, Shortcut
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let app = app::App::default();
let mut wind = Window::new(100, 100, 400, 300, "Hello from rust");
wind.end();
wind.show();
app.run().unwrap();
#[cfg(feature = "ui")]
{
let app = app::App::default().with_scheme(app::Scheme::Gtk);
let mut ui = mainview::UserInterface::make_window();
app.run().unwrap();
}
let settings = Settings::new()?;
+4
View File
@@ -0,0 +1,4 @@
#![allow(unused_variables)]
#![allow(unused_mut)]
#![allow(unused_imports)]
include!(concat!(env!("OUT_DIR"), "/mainview.rs"));