From 00f86a1bb669319fa494265cd488d7e51bcaaceb Mon Sep 17 00:00:00 2001 From: Benjamin Klum Date: Tue, 17 Dec 2024 16:40:24 +0100 Subject: [PATCH] #1362 Add "About" entry to help menu of plug-in --- CONTRIBUTING.adoc | 2 +- third-party-licenses.html => about.html | 0 main/src/infrastructure/plugin/backbone_shell.rs | 6 ++++++ main/src/infrastructure/ui/header_panel.rs | 8 ++++++++ 4 files changed, 15 insertions(+), 1 deletion(-) rename third-party-licenses.html => about.html (100%) diff --git a/CONTRIBUTING.adoc b/CONTRIBUTING.adoc index dc72c4f4f..8c2989899 100644 --- a/CONTRIBUTING.adoc +++ b/CONTRIBUTING.adoc @@ -519,7 +519,7 @@ Generate the report: [source] ---- -cargo about generate --fail --workspace --all-features --threshold 0.93 about.hbs > third-party-licenses.html +cargo about generate --fail --workspace --all-features --threshold 0.93 about.hbs > about.html ---- == Release diff --git a/third-party-licenses.html b/about.html similarity index 100% rename from third-party-licenses.html rename to about.html diff --git a/main/src/infrastructure/plugin/backbone_shell.rs b/main/src/infrastructure/plugin/backbone_shell.rs index 8635c0b5c..f6926ef0d 100644 --- a/main/src/infrastructure/plugin/backbone_shell.rs +++ b/main/src/infrastructure/plugin/backbone_shell.rs @@ -1174,6 +1174,12 @@ impl BackboneShell { BackboneShell::helgoboss_resource_dir_path().join("ReaLearn") } + pub fn helgobox_data_dir_path() -> Utf8PathBuf { + Reaper::get() + .resource_path() + .join("Data/helgoboss/helgobox") + } + pub fn realearn_data_dir_path() -> Utf8PathBuf { Reaper::get() .resource_path() diff --git a/main/src/infrastructure/ui/header_panel.rs b/main/src/infrastructure/ui/header_panel.rs index 48a5f94f8..9f1b4c2ae 100644 --- a/main/src/infrastructure/ui/header_panel.rs +++ b/main/src/infrastructure/ui/header_panel.rs @@ -957,6 +957,7 @@ impl HeaderPanel { ), item("Contact developer", HelpMenuAction::ContactDeveloper), item("Donate", HelpMenuAction::Donate), + item("About", HelpMenuAction::OpenAboutPage), ]; anonymous_menu(entries) }; @@ -973,6 +974,7 @@ impl HeaderPanel { HelpMenuAction::OpenRealearnForum => self.open_realearn_forum(), HelpMenuAction::ContactDeveloper => self.contact_developer(), HelpMenuAction::OpenRealearnWebsite => self.open_realearn_website(), + HelpMenuAction::OpenAboutPage => self.open_about_page(), HelpMenuAction::Donate => self.donate(), }; Ok(()) @@ -2619,6 +2621,11 @@ impl HeaderPanel { open_in_browser("https://www.helgoboss.org/projects/realearn/"); } + fn open_about_page(&self) { + let about_html = BackboneShell::helgobox_data_dir_path().join("doc/about.html"); + open_in_browser(about_html.as_str()); + } + fn register_listeners(self: SharedView) { let shared_session = self.session(); let session = shared_session.borrow(); @@ -3204,6 +3211,7 @@ enum HelpMenuAction { OpenRealearnControllerList, OpenRealearnForum, OpenRealearnWebsite, + OpenAboutPage, ContactDeveloper, Donate, }