UI: added more info to the about dialog

This commit is contained in:
Observer KRypt0n_ 2023-01-19 13:45:03 +02:00
parent e3d36f1f3a
commit a00df927f6
No known key found for this signature in database
GPG key ID: 844DA47BA25FE1E2
3 changed files with 50 additions and 2 deletions

View file

@ -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)

View file

@ -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,

View file

@ -127,6 +127,10 @@ impl SimpleComponent for App {
) -> ComponentParts<Self> {
let widgets = view_output!();
if crate::APP_DEBUG {
widgets.main_window.add_css_class("devel");
}
let about_dialog_broker: MessageBroker<AboutDialog> = MessageBroker::new();
let model = App {