From f425f2fbed0f85c62fdc70accff95c2e83503612 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 28 Feb 2021 20:27:51 +0100 Subject: [PATCH] Add version informationm to splash screen (#1913). --- src/wx/wx_util.cc | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc index 77980a013..bc9b29c4f 100644 --- a/src/wx/wx_util.cc +++ b/src/wx/wx_util.cc @@ -18,19 +18,22 @@ */ + /** @file src/wx/wx_util.cc * @brief Some utility functions and classes. */ -#include "wx_util.h" + #include "file_picker_ctrl.h" -#include "static_text.h" #include "password_entry.h" +#include "static_text.h" +#include "wx_util.h" #include "lib/config.h" -#include "lib/job_manager.h" -#include "lib/util.h" #include "lib/cross.h" #include "lib/job.h" +#include "lib/job_manager.h" +#include "lib/util.h" +#include "lib/version.h" #include "lib/warnings.h" #include DCPOMATIC_DISABLE_WARNINGS @@ -42,6 +45,7 @@ DCPOMATIC_DISABLE_WARNINGS DCPOMATIC_ENABLE_WARNINGS #include + using std::string; using std::vector; using std::pair; @@ -50,6 +54,7 @@ using boost::optional; using dcp::locale_convert; using namespace dcpomatic; + wxStaticText * #ifdef __WXOSX__ create_label (wxWindow* p, wxString t, bool left) @@ -484,6 +489,11 @@ maybe_show_splash () try { wxBitmap bitmap; if (bitmap.LoadFile(bitmap_path("splash"), wxBITMAP_TYPE_PNG)) { + wxMemoryDC dc(bitmap); + auto const version = wxString::Format("%s (%s)", dcpomatic_version, dcpomatic_git_commit); + auto screen_size = dc.GetSize(); + auto text_size = dc.GetTextExtent(version); + dc.DrawText(version, (screen_size.GetWidth() - text_size.GetWidth()) / 2, 236); #ifdef DCPOMATIC_WINDOWS /* Having wxSTAY_ON_TOP means error dialogues hide behind the splash screen on Windows, no matter what I try */ splash = new wxSplashScreen (bitmap, wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_NO_TIMEOUT, 0, 0, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE | wxFRAME_NO_TASKBAR); -- 2.30.2