--- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "patient-monitor-simulation" -version = "0.6.11" +version = "0.6.12" edition = "2021" license = "MIT" description = "Synthetic patient-monitor simulation for teaching (not for clinical use)" --- /dev/null +++ b/FLATPAK-ICON.md @@ -0,0 +1,42 @@ +# SimPaM application icon / Flatpak integration + +The original CCCA SVG has been placed on a **square transparent canvas** without changing or stretching its artwork. The icon is shipped as `data/icons/hicolor/scalable/apps/at.criticalcare.SimPaM.svg`. + +The Rust build script embeds it as a GLib resource, allowing the GTK application to display the icon even when launched with `cargo run`. The Flatpak desktop icon must **also** be installed to `/app/share/icons`; GTK resources alone are not visible to the host's launcher. + +## Integrate the existing Flatpak manifest + +In the existing manifest `at.criticalcare.SimPaM.yml`, keep its current `app-id: at.criticalcare.SimPaM`, `command: patient-monitor-simulation`, GNOME 51 SDK/runtime and PulseAudio permission. Add **one command** to the same module's `build-commands` list, after the executable's installation: + +```yaml + - sh scripts/install-flatpak-assets.sh +``` + +This installs the desktop entry, AppStream metadata, and scalable icon. The manifest's local directory source must include `data/` and `scripts/`; the existing `type: dir` with `path: .` ordinarily does. + +**Do not install or bundle `pw-play` or `paplay`**. The native PulseAudio backend remains unchanged. + +No new Rust dependencies were added. The icon embedding build script uses `glib-compile-resources`, which is provided by GLib development tools (Fedora: `glib2-devel`). In a GNOME SDK it is normally already available. + +## Rebuild and check + +From the directory containing `at.criticalcare.SimPaM.yml`, with the Cargo lockfile updated to the current package version: + +```sh +cargo check +flatpak-builder --force-clean --repo=flatpak-repo build-flatpak at.criticalcare.SimPaM.yml +flatpak build-bundle flatpak-repo "SimPaM-0.6.12-x86_64.flatpak" at.criticalcare.SimPaM --arch=x86_64 --runtime-repo=https://dl.flathub.org/repo/flathub.flatpakrepo +``` + +Since no Rust dependencies changed, you do not need to regenerate `cargo-sources.json` solely for the icon. If that file or the lockfile is out of sync from previous changes, regenerate them as usual. + +## Files + +- `data/icons/hicolor/scalable/apps/at.criticalcare.SimPaM.svg` — square scalable icon +- `data/at.criticalcare.SimPaM.desktop` — launcher entry +- `data/at.criticalcare.SimPaM.metainfo.xml` — AppStream application metadata +- `data/simpam.gresource.xml` — resource path for GTK windows +- `build.rs` — creates the embedded GLib resource +- `scripts/install-flatpak-assets.sh` — installs launcher, metadata and icon in Flatpak + +The source artwork was supplied by Critical Care Club Austria; its reuse and distribution rights are separate from the Rust source-code license. --- a/README.de.md +++ b/README.de.md @@ -1,4 +1,4 @@ -# SimPaM — Patientenmonitor-Simulation v0.6.11 +# SimPaM — Patientenmonitor-Simulation v0.6.12 Der in Rust/GTK4 entwickelte **SimPaM** simuliert einen Patientenmonitor für die Lehre unter Fedora Linux. Die Anwendung besitzt ein **Admin-Fenster** @@ -687,6 +687,18 @@ `flatpak-cargo-generator` neu erzeugt werden. Das vorhandene Flatpak-Manifest wird gesondert gepflegt und ist nicht Teil dieser Quellcodeänderung. +### Programmsymbol und Desktop-Integration (v0.6.12) + +Das bereitgestellte CCCA-Logo dient als Programmsymbol von SimPaM. Es wird für +die Monitor- und Admin-Fenster, den Linux-Anwendungsstarter und den Flatpak-Export +verwendet. Das skalierbare SVG liegt auf einer quadratischen Zeichenfläche unter +`data/icons/hicolor/scalable/apps/`. Über `build.rs` wird es auch bei direktem +Start mit Cargo als GTK-Ressource bereitgestellt. + +Die einmalige Ergänzung des vorhandenen Flatpak-Manifests sowie die +Paketierungsbefehle sind in [FLATPAK-ICON.md](FLATPAK-ICON.md) dokumentiert. +Es sind keine neuen Rust-Crates oder Flatpak-Berechtigungen erforderlich. + ## Changelog ### Änderungen seit v0.2.2 @@ -883,3 +895,11 @@ selektive zweiminütige Alarmpause bleiben erhalten. Der Testton ist auch bei deaktivierten akustischen Alarmen verfügbar. In Flatpak werden die PulseAudio-Socket-Berechtigung und `libpulse-simple` benötigt. + +### v0.6.12 – Programmsymbol und Desktop-Metadaten + +Das bereitgestellte CCCA-SVG wurde als quadratisches, skalierbares Programmsymbol +integriert. GTK bindet es für den lokalen Cargo-Start ein. Für Flatpak wurden +Desktop-Datei und AppStream-Metadaten unter `at.criticalcare.SimPaM` ergänzt. +Ein Installationsskript und Paketierungshinweise wurden hinzugefügt; die +Simulation und die Audioausgabe bleiben unverändert. --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# SimPaM — Patient Monitor Simulation v0.6.11 +# SimPaM — Patient Monitor Simulation v0.6.12 A Rust/GTK4 patient-monitor simulator with two main windows for teaching on Fedora Linux. @@ -695,6 +695,17 @@ contains application sources; an existing Flatpak manifest is maintained separately and was not modified by this update. +### Application icon and desktop integration (v0.6.12) + +The CCCA logo is used as SimPaM's application icon. It appears on the monitor +and Admin windows, the Linux desktop launcher, and Flatpak exports. The source +image is stored as a square, scalable SVG in `data/icons/hicolor/scalable/apps/`. +A GTK resource compiled by `build.rs` supplies the icon for direct Cargo runs. + +See [FLATPAK-ICON.md](FLATPAK-ICON.md) for the one-line addition needed in your +existing Flatpak manifest and for packaging commands. No new Cargo crates or +new Flatpak permissions are required. + ## Changelog ### Changes since v0.2.2 @@ -887,3 +898,11 @@ controls, alarm priorities and selective alarm-pause logic are retained. A manual test tone remains available with audible alarms switched off. Flatpak requires the PulseAudio socket and `libpulse-simple` in its SDK/runtime. + +### v0.6.12 — Application icon and desktop metadata + +Added the supplied CCCA SVG as a square, scalable application icon. GTK embeds +it for local Cargo launches, and Flatpak assets include a matching desktop +entry and AppStream metadata under `at.criticalcare.SimPaM`. Added a small +Flatpak asset installer and packaging instructions; the physiological +simulation and audio backend are unchanged. --- /dev/null +++ b/build.rs @@ -0,0 +1,20 @@ +//! Embed the desktop icon for `cargo run` as well as Flatpak builds. +//! `glib-compile-resources` is provided by the GLib development tools. +use std::{env, path::PathBuf, process::Command}; + +fn main() { + println!("cargo:rerun-if-changed=data/simpam.gresource.xml"); + println!("cargo:rerun-if-changed=data/icons/hicolor/scalable/apps/at.criticalcare.SimPaM.svg"); + + let source_root = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR") + .expect("Cargo must provide CARGO_MANIFEST_DIR")); + let target = PathBuf::from(env::var_os("OUT_DIR") + .expect("Cargo must provide OUT_DIR")).join("simpam.gresource"); + let result = Command::new("glib-compile-resources") + .arg(source_root.join("data/simpam.gresource.xml")) + .arg(format!("--sourcedir={}", source_root.join("data").display())) + .arg(format!("--target={}", target.display())) + .status() + .expect("glib-compile-resources is required (install glib2-devel on Fedora)"); + assert!(result.success(), "failed to compile SimPaM icon resources"); +} --- /dev/null +++ b/data/at.criticalcare.SimPaM.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Type=Application +Name=SimPaM +GenericName=Patient Monitor Simulator +GenericName[de]=Patientenmonitor-Simulator +Comment=Simulated patient monitor for medical teaching +Comment[de]=Patientenmonitor-Simulation für die medizinische Lehre +Exec=patient-monitor-simulation +Icon=at.criticalcare.SimPaM +Terminal=false +Categories=Education;Science; +StartupNotify=true --- /dev/null +++ b/data/at.criticalcare.SimPaM.metainfo.xml @@ -0,0 +1,21 @@ + + + at.criticalcare.SimPaM + CC0-1.0 + MIT + SimPaM + Patient monitor simulation for teaching + Patientenmonitor-Simulation für die Lehre + +

SimPaM displays synthetic ECG, pulse oximetry, invasive arterial pressure, capnography and non-invasive blood pressure for educational simulations.

+

Instructors can change physiology, trigger clinical scenarios, and use interactive alarms and patient-monitor controls. SimPaM is not a medical device and must not be used for clinical decisions.

+
+ at.criticalcare.SimPaM.desktop + + Education + Science + + + + +
--- /dev/null +++ b/data/icons/hicolor/scalable/apps/at.criticalcare.SimPaM.svg @@ -0,0 +1,220 @@ + + + +image/svg+xml + + + + + + + + + + + + + + + + + --- /dev/null +++ b/data/simpam.gresource.xml @@ -0,0 +1,6 @@ + + + + icons/hicolor/scalable/apps/at.criticalcare.SimPaM.svg + + --- /dev/null +++ b/scripts/install-flatpak-assets.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# Run from the Cargo project root during the Flatpak module's build commands. +# Deliberately separate from the executable installation. +set -eu +prefix="${1:-/app}" +id='at.criticalcare.SimPaM' +install -Dm644 "data/${id}.desktop" "${prefix}/share/applications/${id}.desktop" +install -Dm644 "data/${id}.metainfo.xml" "${prefix}/share/metainfo/${id}.metainfo.xml" +install -Dm644 "data/icons/hicolor/scalable/apps/${id}.svg" "${prefix}/share/icons/hicolor/scalable/apps/${id}.svg" --- a/src/main.rs +++ b/src/main.rs @@ -10,4 +10,7 @@ use gtk::prelude::*; fn main() -> gtk::glib::ExitCode { + // GTK finds the icon for Cargo launches without a system-wide install. + gtk::gio::resources_register_include!("simpam.gresource") + .expect("failed to register SimPaM icon resources"); let application = gtk::Application::builder() @@ -15,4 +18,7 @@ .build(); - application.connect_activate(ui::create_windows); + application.connect_activate(|app| { + gtk::Window::set_default_icon_name("at.criticalcare.SimPaM"); + ui::create_windows(app); + }); application.run() }