From f94fc89587560dced31a5a65f74aa4aefc4a9659 Mon Sep 17 00:00:00 2001 From: ruevs Date: Thu, 13 Jan 2022 19:48:46 +0200 Subject: [PATCH] UI: Add a link to the GitHub commit in the Help menu The "Go to GitHub commit" item in the Help menu opens the URL https://github.com/solvespace/solvespace/commits/5efc148 and allows the user to see the date of the commit that SolveSpace was built from. Closes #1172 --- src/config.h.in | 1 + src/graphicswin.cpp | 1 + src/solvespace.cpp | 4 ++++ src/ui.h | 1 + 4 files changed, 7 insertions(+) diff --git a/src/config.h.in b/src/config.h.in index 5a125f4e..187b9cbc 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -2,6 +2,7 @@ #define SOLVESPACE_CONFIG_H #define PACKAGE_VERSION "@PROJECT_VERSION@~@solvespace_GIT_HASH@" +#define GIT_HASH_URL "https://github.com/solvespace/solvespace/commit/@solvespace_GIT_HASH@" /* Non-OS X *nix only */ #define UNIX_DATADIR "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_DATAROOTDIR@/solvespace" diff --git a/src/graphicswin.cpp b/src/graphicswin.cpp index cac542ae..c7c74d98 100644 --- a/src/graphicswin.cpp +++ b/src/graphicswin.cpp @@ -183,6 +183,7 @@ const MenuEntry Menu[] = { { 0, N_("&Help"), Command::NONE, 0, KN, mHelp }, { 1, N_("&Language"), Command::LOCALE, 0, KN, mHelp }, { 1, N_("&Website / Manual"), Command::WEBSITE, 0, KN, mHelp }, +{ 1, N_("&Go to GitHub commit"), Command::GITHUB, 0, KN, mHelp }, #ifndef __APPLE__ { 1, N_("&About"), Command::ABOUT, 0, KN, mHelp }, #endif diff --git a/src/solvespace.cpp b/src/solvespace.cpp index 132ad85a..a8d1a151 100644 --- a/src/solvespace.cpp +++ b/src/solvespace.cpp @@ -1056,6 +1056,10 @@ void SolveSpaceUI::MenuHelp(Command id) { PACKAGE_VERSION, 2022); break; + case Command::GITHUB: + Platform::OpenInBrowser(GIT_HASH_URL); + break; + default: ssassert(false, "Unexpected menu ID"); } } diff --git a/src/ui.h b/src/ui.h index 21b00cd4..0d121b64 100644 --- a/src/ui.h +++ b/src/ui.h @@ -172,6 +172,7 @@ enum class Command : uint32_t { // Help LOCALE, WEBSITE, + GITHUB, ABOUT, };