Skip to content

Commit

Permalink
Setup UI within feature UI
Browse files Browse the repository at this point in the history
The feature is not enabled yet.
It will be enabled by default later when ui is ready.
  • Loading branch information
PhilipK committed Sep 27, 2021
1 parent dc90642 commit aeb1251
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 6 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 9 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 91 additions & 0 deletions gui/mainview.fl
Original file line number Diff line number Diff line change
@@ -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}
}
}
}
}
}
13 changes: 7 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mod settings;
mod steam;
mod steamgriddb;
use fltk::{app, prelude::*, window::Window};

mod mainview;

use crate::{
egs::EpicPlatform,
Expand All @@ -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()?;

Expand Down
4 changes: 4 additions & 0 deletions src/mainview.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#![allow(unused_variables)]
#![allow(unused_mut)]
#![allow(unused_imports)]
include!(concat!(env!("OUT_DIR"), "/mainview.rs"));

0 comments on commit aeb1251

Please sign in to comment.