diff --git a/src/main.rs b/src/main.rs index 7357cad..85e517c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,6 +5,10 @@ use anime_launcher_sdk::config; pub mod i18n; pub mod ui; +pub const APP_ID: &str = "moe.launcher.an-anime-game-launcher-gtk"; +pub const APP_VERSION: &str = env!("CARGO_PKG_VERSION"); +pub const APP_DEBUG: bool = cfg!(debug_assertions); + fn main() { tracing_subscriber::fmt() .with_span_events(tracing_subscriber::fmt::format::FmtSpan::FULL) diff --git a/src/ui/about.rs b/src/ui/about.rs index ae227b4..e313f36 100644 --- a/src/ui/about.rs +++ b/src/ui/about.rs @@ -1,9 +1,12 @@ use relm4::prelude::*; use gtk::prelude::*; -use adw::prelude::*; -use crate::i18n::tr; +use anime_launcher_sdk::anime_game_core::{VERSION as CORE_VERSION, curl_sys}; + +lazy_static::lazy_static! { + static ref CURL_INFO: curl_sys::Version = curl_sys::Version::get(); +} pub struct AboutDialog { visible: bool @@ -29,6 +32,43 @@ impl SimpleComponent for AboutDialog { set_website: "https://github.com/an-anime-team/an-anime-game-launcher-gtk", set_issue_url: "https://github.com/an-anime-team/an-anime-game-launcher-gtk/issues", + set_license_type: gtk::License::Gpl30, + + set_version: &{ + // Debug build & build's version doesn't contain any suffix (-dev, -beta, etc) + if crate::APP_DEBUG && !crate::APP_VERSION.contains('-') { + format!("{}-dev", crate::APP_VERSION) + } + + else { + crate::APP_VERSION.to_string() + } + }, + + set_developers: &[ + "Nikita Podvirnyy https://github.com/krypt0nn" + ], + + add_credit_section: (Some("Logo"), &[ + "@nightany https://pinterest.com/pin/356206651788051017" + ]), + + add_credit_section: (Some("An Anime Team"), &[ + "@Marie https://github.com/Mar0xy", + "@lane https://github.com/laurinneff" + ]), + + set_debug_info: &[ + format!("Anime Game core library version: {CORE_VERSION}"), + format!("Curl version: {}", CURL_INFO.version()), + format!("SSL version: {}", CURL_INFO.ssl_version().unwrap_or("?")), + String::new(), + format!("GTK version: {}.{}.{}", gtk::major_version(), gtk::minor_version(), gtk::micro_version()), + format!("Libadwaita version: {}.{}.{}", adw::major_version(), adw::minor_version(), adw::micro_version()), + format!("Pango version: {}", gtk::pango::version_string()), + format!("Cairo version: {}", gtk::cairo::version_string()), + ].join("\n"), + set_modal: true, set_hide_on_close: true, diff --git a/src/ui/main.rs b/src/ui/main.rs index 9123cf8..2dbdac2 100644 --- a/src/ui/main.rs +++ b/src/ui/main.rs @@ -127,6 +127,10 @@ impl SimpleComponent for App { ) -> ComponentParts { let widgets = view_output!(); + if crate::APP_DEBUG { + widgets.main_window.add_css_class("devel"); + } + let about_dialog_broker: MessageBroker = MessageBroker::new(); let model = App {