From aa05de986575f83bfdfac2a1dcacedcde9cace5e Mon Sep 17 00:00:00 2001 From: Philip Kristoffersen Date: Fri, 15 Apr 2022 13:54:01 +0200 Subject: [PATCH] Make UI default, and remove CLI version (#83) --- .github/workflows/main.yml | 2 +- .github/workflows/release_on_v_tag.yml | 57 +++++--------------------- Cargo.toml | 13 ++---- Readme.md | 25 +++++++++-- src/main.rs | 25 +---------- src/settings.rs | 14 ------- src/ui/uiapp.rs | 4 +- 7 files changed, 40 insertions(+), 100 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e9d510d..309a8f5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,7 +20,7 @@ jobs: - name: dependencies run: | sudo apt-get update - sudo apt-get install -y libx11-dev libxext-dev libxft-dev libxinerama-dev libxcursor-dev libxrender-dev libxfixes-dev libpango1.0-dev libpng-dev libgl1-mesa-dev libglu1-mesa-dev + sudo apt-get install -y libclang-dev libgtk-3-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev - name: Test run: | cargo test diff --git a/.github/workflows/release_on_v_tag.yml b/.github/workflows/release_on_v_tag.yml index 85cc9da..859a714 100644 --- a/.github/workflows/release_on_v_tag.yml +++ b/.github/workflows/release_on_v_tag.yml @@ -3,7 +3,7 @@ name: Create Release Builds on: push: tags: - - "v*" # matches v1.0.1, v1.2, v2, etc + - "v.*.*.*" # matches v.1.0.1 etc jobs: once: @@ -35,73 +35,38 @@ jobs: asset_name: linux_BoilR args: --best --lzma strip: true - ui: false - - os: ubuntu-latest - file: target/release/boilr - asset_name: linux_ui_BoilR - args: --best --lzma - strip: true - ui: true - os: windows-latest file: target/release/boilr.exe asset_name: windows_BoilR.exe args: -9 strip: false - ui: false - - os: windows-latest - file: target/release/boilr.exe - asset_name: windows_ui_BoilR.exe - args: -9 - strip: false - ui: true - os: macos-latest file: target/release/boilr asset_name: macos_x86_64_BoilR args: -9 strip: false - ui: false - os: macos-latest file: target/aarch64-apple-darwin/release/boilr asset_name: macos_darwin_BoilR args: -9 strip: false - ui: false - target: aarch64-apple-darwin - - os: macos-latest - file: target/release/boilr - asset_name: macos_x86_64_ui_BoilR - args: -9 - strip: false - ui: true - - os: macos-latest - file: target/aarch64-apple-darwin/release/boilr - asset_name: macos_darwin_ui_BoilR - args: -9 - strip: false - ui: true target: aarch64-apple-darwin steps: - uses: actions/checkout@v1 - - name: Rust Cache - id: rust_cache - uses: Swatinem/rust-cache@v1.3.0 - name: Install dependencies - if: ${{ matrix.os == 'ubuntu-latest' && matrix.ui}} + if: ${{ matrix.os == 'ubuntu-latest'}} run: | sudo apt-get update - sudo apt-get install -y libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev - - name: Build Release Version UI - if: ${{ matrix.target != 'aarch64-apple-darwin' && matrix.ui == true}} - run: cargo build --release --features ui - - name: Build Release Version CLI - if: ${{ matrix.target != 'aarch64-apple-darwin' && matrix.ui == false}} - run: cargo build --release - - name: Build aarch64 Release Version CLI - if: ${{matrix.target == 'aarch64-apple-darwin' && matrix.ui == false}} + sudo apt-get install -y libclang-dev libgtk-3-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev + - name: Rust Cache + id: rust_cache + uses: Swatinem/rust-cache@v1.3.0 + - name: Build Release Version + if: ${{ matrix.target != 'aarch64-apple-darwin' }} + run: cargo build --release + - name: Build aarch64 Release Version + if: ${{matrix.target == 'aarch64-apple-darwin' }} run: rustup target add aarch64-apple-darwin && cargo build --release --target aarch64-apple-darwin - - name: Build aarch64 Release Version UI - if: ${{matrix.target == 'aarch64-apple-darwin' && matrix.ui == true}} - run: rustup target add aarch64-apple-darwin && cargo build --release --target aarch64-apple-darwin --features ui - name: Compress binaries uses: svenstaro/upx-action@v2 with: diff --git a/Cargo.toml b/Cargo.toml index 77c1241..32e0c1b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,16 +20,11 @@ dashmap = { version = "^5.2.0", features = ["serde"] } is_executable = "^1.0.1" rusty-leveldb = "^0.3.6" base64 = "^0.13.0" -eframe = { version = "0.17.0", optional = true } -egui = { version = "0.17.0", optional = true } -image = { version = "0.24.1", optional = true, features = ["png"] } -toml = { version = "^0.5.8", optional = true } +eframe = { version = "0.17.0" } +egui = { version = "0.17.0" } +image = { version = "0.24.1", features = ["png"] } +toml = { version = "^0.5.8" } sysinfo = "0.23.10" -[features] -#default = ["ui"] -ui = ["eframe", "egui","toml","image"] - - [target.'cfg(windows)'.dependencies] winreg = "0.10.1" diff --git a/Readme.md b/Readme.md index 8340321..6997917 100644 --- a/Readme.md +++ b/Readme.md @@ -39,7 +39,7 @@ Optionally you can set BoilR up to automatically download artwork from [SteamGri - Download the latest release from the [releases page](https://github.com/PhilipK/BoilR/releases). - Run the executable. -- Click Synchronize. +- Click Import Games. - Restart Steam to see your new shortcuts. @@ -50,21 +50,29 @@ Optionally you can set BoilR up to automatically download artwork from [SteamGri - Click Syncrhonize -## Tips for steam deck +## Tips + +### Tips for steam deck I currently don't have a steam deck, which slows down development for it a bit. There might still be problems specific to the deck, so if you run into one please check the issues. If you have a problem that a game wont launch, try to manually set a proton version for it. -## Tips for linux +### Tips for linux If you are running linux (this includes Steam Dekc) and are running into problems check [tips for linux seciton](tips_for_linux.md) -## Configuration +### Configuration Most people will not have to configure anything, just open BoilR and click Synchronize, but it is possible to configure a lot, see the [configuration section](configuration.md) +### Run as CLI + +In previous releases there was both a CLI and UI version of BoilR, now there is only a UI version. +But you can add the commandling argument ``--no-ui`` and then the UI version will act like the old CLI version. +This saves some CO2 from not having to build 2 versions of BoilR for each platform, and it also makes development easier. + ## What is up with the name BoilR? @@ -80,10 +88,19 @@ Check out the [discussions](https://github.com/PhilipK/BoilR/discussions) and fe ## How can I help/contribute? If you are a coder, you can fork this repo and then create a pull request, they are very welcome! +To run BoilR just write: + +```shell +cargo run +``` + If you are not a developer (or you don't like to code in Rust) spread the work and create issues/discussions for anything. ## Can I donate to support BoilR? Nope, please don't, donate it to your favorite charity instead, and if you don't have one of those may I suggest something like [GiveWell](https://www.givewell.org/). + + + ## License This project is dual license MIT or Apache 2.0 , it is up to you. In short, you can do what you want with this project, but if in doubt read the license files. diff --git a/src/main.rs b/src/main.rs index d75e74a..6fe5711 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,38 +11,15 @@ mod steam; mod steamgriddb; mod sync; mod uplay; - -#[cfg(feature = "ui")] mod ui; - use std::error::Error; -#[cfg(not(feature = "ui"))] -#[tokio::main] -async fn main() -> Result<(), Box> { - - let settings = settings::Settings::new()?; - if settings.steam.stop_steam{ - crate::steam::ensure_steam_stopped(); - } - settings::Settings::write_config_if_missing(); - let usersinfo = sync::run_sync(&settings,&mut None).unwrap(); - sync::download_images(&settings,&usersinfo,&mut None).await; - if settings.steam.start_steam{ - crate::steam::ensure_steam_started(&settings.steam); - } - Ok(()) -} - -#[cfg(feature = "ui")] fn main() -> Result<(), Box> { - let mut args = std::env::args(); if args.len() > 1 && args.nth(1).unwrap_or_default() == "--no-ui" { ui::run_sync(); Ok(()) }else{ ui::run_ui() - } -} +} \ No newline at end of file diff --git a/src/settings.rs b/src/settings.rs index c7a333d..0e64dc1 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -54,20 +54,6 @@ impl Settings { result } - - pub fn write_config_if_missing() { - let config_path = std::path::Path::new("config.toml"); - if !config_path.exists() { - let worked = std::fs::write(config_path, include_str!("defaultconfig.toml")); - match worked { - Ok(_) => println!("Create configuration file at {:?}", &config_path), - Err(err) => println!( - "Could not create configuration file at {:?}, reason: {:?}", - &config_path, err - ), - } - } - } } fn sanitize_auth_key(result: &mut Result) { diff --git a/src/ui/uiapp.rs b/src/ui/uiapp.rs index a84528c..122f633 100644 --- a/src/ui/uiapp.rs +++ b/src/ui/uiapp.rs @@ -41,7 +41,7 @@ impl MyEguiApp { } } pub fn run_sync(&mut self) { - let (sender,mut reciever ) = watch::channel(SyncProgress::NotStarted); + let (sender,reciever ) = watch::channel(SyncProgress::NotStarted); let settings = self.settings.clone(); if settings.steam.stop_steam{ crate::steam::ensure_steam_stopped(); @@ -376,7 +376,7 @@ pub fn run_ui() -> Result<(), Box> { let mut native_options = eframe::NativeOptions::default(); native_options.initial_window_size = Some(egui::Vec2{ - x:500., + x:800., y:500. }); native_options.icon_data = Some(get_logo_icon());