mirror of
https://github.com/yuzu-emu/liftinstall.git
synced 2024-11-22 11:35:43 +01:00
meta: affix an icon to the title bar
This commit is contained in:
parent
3fc8583646
commit
9a27b24f05
90
Cargo.lock
generated
90
Cargo.lock
generated
@ -17,6 +17,12 @@ version = "1.0.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "adler32"
|
||||||
|
version = "1.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aes"
|
name = "aes"
|
||||||
version = "0.7.5"
|
version = "0.7.5"
|
||||||
@ -113,7 +119,7 @@ dependencies = [
|
|||||||
"cc",
|
"cc",
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
"libc",
|
"libc",
|
||||||
"miniz_oxide",
|
"miniz_oxide 0.4.4",
|
||||||
"object",
|
"object",
|
||||||
"rustc-demangle",
|
"rustc-demangle",
|
||||||
]
|
]
|
||||||
@ -182,6 +188,12 @@ version = "3.9.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899"
|
checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bytemuck"
|
||||||
|
version = "1.9.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ee1e0e2125faccb856bf10b0a9dfa89c4c718d05ef85580dfefbdf1c422ef801"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "byteorder"
|
name = "byteorder"
|
||||||
version = "1.4.3"
|
version = "1.4.3"
|
||||||
@ -363,6 +375,12 @@ dependencies = [
|
|||||||
"objc",
|
"objc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "color_quant"
|
||||||
|
version = "1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "com"
|
name = "com"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
@ -682,6 +700,15 @@ dependencies = [
|
|||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "deflate"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c86f7e25f518f4b81808a2cf1c50996a61f5c2eb394b2393bd87f2a4780a432f"
|
||||||
|
dependencies = [
|
||||||
|
"adler32",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "deunicode"
|
name = "deunicode"
|
||||||
version = "0.4.3"
|
version = "0.4.3"
|
||||||
@ -817,7 +844,7 @@ dependencies = [
|
|||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
"crc32fast",
|
"crc32fast",
|
||||||
"libc",
|
"libc",
|
||||||
"miniz_oxide",
|
"miniz_oxide 0.4.4",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1389,6 +1416,21 @@ dependencies = [
|
|||||||
"unicode-normalization",
|
"unicode-normalization",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "image"
|
||||||
|
version = "0.24.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "db207d030ae38f1eb6f240d5a1c1c88ff422aa005d10f8c6c6fc5e75286ab30e"
|
||||||
|
dependencies = [
|
||||||
|
"bytemuck",
|
||||||
|
"byteorder",
|
||||||
|
"color_quant",
|
||||||
|
"num-iter",
|
||||||
|
"num-rational",
|
||||||
|
"num-traits",
|
||||||
|
"png",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "1.8.0"
|
version = "1.8.0"
|
||||||
@ -1550,6 +1592,7 @@ dependencies = [
|
|||||||
"fern",
|
"fern",
|
||||||
"futures",
|
"futures",
|
||||||
"hyper 0.11.27",
|
"hyper 0.11.27",
|
||||||
|
"image",
|
||||||
"jsonwebtoken",
|
"jsonwebtoken",
|
||||||
"log 0.4.16",
|
"log 0.4.16",
|
||||||
"mime_guess",
|
"mime_guess",
|
||||||
@ -1697,6 +1740,15 @@ dependencies = [
|
|||||||
"autocfg 1.1.0",
|
"autocfg 1.1.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "miniz_oxide"
|
||||||
|
version = "0.5.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d2b29bd4bc3f33391105ebee3589c19197c4271e3e5a9ec9bfe8127eeff8f082"
|
||||||
|
dependencies = [
|
||||||
|
"adler",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mio"
|
name = "mio"
|
||||||
version = "0.6.23"
|
version = "0.6.23"
|
||||||
@ -1851,6 +1903,28 @@ dependencies = [
|
|||||||
"num-traits",
|
"num-traits",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-iter"
|
||||||
|
version = "0.1.42"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b2021c8337a54d21aca0d59a92577a029af9431cb59b909b03252b9c164fad59"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg 1.1.0",
|
||||||
|
"num-integer",
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-rational"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d41702bd167c2df5520b384281bc111a4b5efcf7fbc4c9c222c815b07e0a6a6a"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg 1.1.0",
|
||||||
|
"num-integer",
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-traits"
|
name = "num-traits"
|
||||||
version = "0.2.14"
|
version = "0.2.14"
|
||||||
@ -2127,6 +2201,18 @@ version = "0.3.24"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe"
|
checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "png"
|
||||||
|
version = "0.17.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "dc38c0ad57efb786dd57b9864e5b18bae478c00c824dc55a38bbc9da95dde3ba"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"crc32fast",
|
||||||
|
"deflate",
|
||||||
|
"miniz_oxide 0.5.1",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro-crate"
|
name = "proc-macro-crate"
|
||||||
version = "0.1.5"
|
version = "0.1.5"
|
||||||
|
@ -55,6 +55,7 @@ serde = "1.0"
|
|||||||
serde_derive = "1.0"
|
serde_derive = "1.0"
|
||||||
toml = "0.5"
|
toml = "0.5"
|
||||||
which = "4.0"
|
which = "4.0"
|
||||||
|
image = { version = "0.24", default-features = false, features = ["ico"] }
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
winapi = { version = "0.3", features = ["psapi", "winbase", "winioctl", "winnt"] }
|
winapi = { version = "0.3", features = ["psapi", "winbase", "winioctl", "winnt"] }
|
||||||
|
9
build.rs
9
build.rs
@ -12,6 +12,7 @@ extern crate toml;
|
|||||||
extern crate which;
|
extern crate which;
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
|
use std::io::Write;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use std::fs::copy;
|
use std::fs::copy;
|
||||||
@ -22,6 +23,8 @@ use std::process::Command;
|
|||||||
|
|
||||||
use std::env::consts::OS;
|
use std::env::consts::OS;
|
||||||
|
|
||||||
|
use image::imageops::FilterType;
|
||||||
|
|
||||||
/// Describes the application itself.
|
/// Describes the application itself.
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
pub struct BaseAttributes {
|
pub struct BaseAttributes {
|
||||||
@ -99,6 +102,12 @@ fn main() {
|
|||||||
let yarn_binary =
|
let yarn_binary =
|
||||||
which::which("yarn").expect("Failed to find yarn - please go ahead and install it!");
|
which::which("yarn").expect("Failed to find yarn - please go ahead and install it!");
|
||||||
|
|
||||||
|
// bundle the icon
|
||||||
|
let mut f = File::create(output_dir.join("icon-data.bin")).unwrap();
|
||||||
|
let icon_file = image::open("ui/public/favicon.ico").expect("Unable to read the icon file");
|
||||||
|
let icon_data = icon_file.resize_exact(48, 48, FilterType::Triangle).to_rgba8();
|
||||||
|
f.write_all(&icon_data.into_vec()).unwrap();
|
||||||
|
|
||||||
// Build and deploy frontend files
|
// Build and deploy frontend files
|
||||||
Command::new(&yarn_binary)
|
Command::new(&yarn_binary)
|
||||||
.arg("--version")
|
.arg("--version")
|
||||||
|
@ -8,13 +8,17 @@ use wry::{
|
|||||||
dpi::LogicalSize,
|
dpi::LogicalSize,
|
||||||
event::{Event, StartCause, WindowEvent},
|
event::{Event, StartCause, WindowEvent},
|
||||||
event_loop::{ControlFlow, EventLoop},
|
event_loop::{ControlFlow, EventLoop},
|
||||||
window::WindowBuilder,
|
window::{WindowBuilder, Icon},
|
||||||
},
|
},
|
||||||
webview::{RpcResponse, WebViewBuilder},
|
webview::{RpcResponse, WebViewBuilder},
|
||||||
};
|
};
|
||||||
|
|
||||||
use log::Level;
|
use log::Level;
|
||||||
|
|
||||||
|
use crate::logging::LoggingErrors;
|
||||||
|
|
||||||
|
const ICON_DATA: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/icon-data.bin"));
|
||||||
|
|
||||||
/// Starts the main web UI. Will return when UI is closed.
|
/// Starts the main web UI. Will return when UI is closed.
|
||||||
pub fn start_ui(app_name: &str, http_address: &str, is_launcher: bool) -> Result<()> {
|
pub fn start_ui(app_name: &str, http_address: &str, is_launcher: bool) -> Result<()> {
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
@ -28,9 +32,11 @@ pub fn start_ui(app_name: &str, http_address: &str, is_launcher: bool) -> Result
|
|||||||
};
|
};
|
||||||
info!("Spawning web view instance");
|
info!("Spawning web view instance");
|
||||||
|
|
||||||
|
let window_icon = Icon::from_rgba(ICON_DATA.to_vec(), 48, 48).log_expect("Unable to construct window icon");
|
||||||
let event_loop = EventLoop::new();
|
let event_loop = EventLoop::new();
|
||||||
let window = WindowBuilder::new()
|
let window = WindowBuilder::new()
|
||||||
.with_title(format!("{} Installer", app_name))
|
.with_title(format!("{} Installer", app_name))
|
||||||
|
.with_window_icon(Some(window_icon))
|
||||||
.with_inner_size(LogicalSize::new(size.0, size.1))
|
.with_inner_size(LogicalSize::new(size.0, size.1))
|
||||||
.with_resizable(false)
|
.with_resizable(false)
|
||||||
.build(&event_loop)?;
|
.build(&event_loop)?;
|
||||||
|
Loading…
Reference in New Issue
Block a user