From 7d7edec08c5c2f9a8d97c5d8a5b74da90f0d46e8 Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Mon, 22 May 2023 22:13:50 +0200 Subject: [PATCH] desktop: Add much more info to About dialog --- Cargo.lock | 1 + desktop/Cargo.toml | 1 + desktop/build.rs | 8 ++++--- desktop/src/gui.rs | 57 ++++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 62 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e0d58aec8..4650bea93 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3719,6 +3719,7 @@ dependencies = [ "anyhow", "arboard", "bytemuck", + "chrono", "clap", "cpal", "dirs", diff --git a/desktop/Cargo.toml b/desktop/Cargo.toml index 2b4756e2b..6bd9dde2d 100644 --- a/desktop/Cargo.toml +++ b/desktop/Cargo.toml @@ -34,6 +34,7 @@ unic-langid = "0.9.1" sys-locale = "0.3.0" wgpu = { version = "0.16.0" } futures = "0.3.28" +chrono = { version = "0.4", default-features = false, features = [] } # Deliberately held back to match tracy client used by profiling crate tracing-tracy = { version = "=0.10.0", optional = true } diff --git a/desktop/build.rs b/desktop/build.rs index 34b718f60..137242c8c 100644 --- a/desktop/build.rs +++ b/desktop/build.rs @@ -5,9 +5,11 @@ use vergen::EmitBuilder; fn main() -> Result<(), Box> { // Emit version info, and "rerun-if-changed" for relevant files, including build.rs EmitBuilder::builder() - .all_build() - .all_cargo() - .all_git() + .build_timestamp() + .cargo_features() + .git_sha(false) + .git_commit_timestamp() + .git_commit_date() .emit()?; // Embed resource file w/ icon on windows diff --git a/desktop/src/gui.rs b/desktop/src/gui.rs index d73242e63..73c6af613 100644 --- a/desktop/src/gui.rs +++ b/desktop/src/gui.rs @@ -2,6 +2,7 @@ mod controller; mod movie; use crate::custom_event::RuffleEvent; +use chrono::DateTime; use egui::*; use std::time::{Duration, Instant}; use winit::event_loop::EventLoopProxy; @@ -160,9 +161,61 @@ impl RuffleGui { ui.label( RichText::new("Ruffle") .color(Color32::from_rgb(0xFF, 0xAD, 0x33)) - .size(24.0), + .size(32.0), ); - ui.label(crate::RUFFLE_VERSION); + Grid::new("about_ruffle_version_info") + .striped(true) + .show(ui, |ui| { + ui.label("Version"); + ui.label(env!("CARGO_PKG_VERSION")); + ui.end_row(); + + ui.label("Channel"); + ui.label(env!("CFG_RELEASE_CHANNEL")); + ui.end_row(); + + ui.label("Build Time"); + ui.label( + DateTime::parse_from_rfc3339(env!("VERGEN_BUILD_TIMESTAMP")) + .map(|t| t.format("%c").to_string()) + .unwrap_or_else(|_| env!("VERGEN_BUILD_TIMESTAMP").to_string()), + ); + ui.end_row(); + + ui.label("Commit ref"); + ui.hyperlink_to( + env!("VERGEN_GIT_SHA"), + format!( + "https://github.com/ruffle-rs/ruffle/commit/{}", + env!("VERGEN_GIT_SHA") + ), + ); + ui.end_row(); + + ui.label("Commit date"); + ui.label( + DateTime::parse_from_rfc3339(env!("VERGEN_GIT_COMMIT_TIMESTAMP")) + .map(|t| t.format("%c").to_string()) + .unwrap_or_else(|_| { + env!("VERGEN_GIT_COMMIT_TIMESTAMP").to_string() + }), + ); + ui.end_row(); + + ui.label("Build Features"); + ui.horizontal_wrapped(|ui| { + ui.label(env!("VERGEN_CARGO_FEATURES").replace(',', ", ")); + }); + ui.end_row(); + }); + + ui.horizontal(|ui| { + ui.hyperlink_to("Website", "https://ruffle.rs"); + ui.hyperlink_to("Github", "https://github.com/ruffle-rs/ruffle/"); + ui.hyperlink_to("Discord", "https://discord.gg/ruffle"); + ui.hyperlink_to("Sponsor", "https://opencollective.com/ruffle/"); + ui.shrink_width_to_current(); + }); }) }); }