From 11a48263d58c1c9f3ae3c2a3c62886853577de26 Mon Sep 17 00:00:00 2001 From: Jonathan Armstrong Date: Wed, 29 Aug 2018 09:00:31 -0500 Subject: [PATCH] Adds ability for a Brand to define the string for boinc help in the help menu through the skin. --- clientgui/AdvancedFrame.cpp | 4 ++-- clientgui/SkinManager.cpp | 17 +++++++++++++++++ clientgui/SkinManager.h | 2 ++ clientgui/sg_BoincSimpleFrame.cpp | 6 +++--- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/clientgui/AdvancedFrame.cpp b/clientgui/AdvancedFrame.cpp index d2c49f8cb5..26d2a28c02 100644 --- a/clientgui/AdvancedFrame.cpp +++ b/clientgui/AdvancedFrame.cpp @@ -661,11 +661,11 @@ bool CAdvancedFrame::CreateMenu() { strMenuName.Printf( _("&%s help"), - pSkinAdvanced->GetApplicationName().c_str() + pSkinAdvanced->GetApplicationHelpName().c_str() ); strMenuDescription.Printf( _("Show information about the %s"), - pSkinAdvanced->GetApplicationName().c_str() + pSkinAdvanced->GetApplicationHelpName().c_str() ); menuHelp->Append( ID_HELPBOINCMANAGER, diff --git a/clientgui/SkinManager.cpp b/clientgui/SkinManager.cpp index 4fca4577e5..9d166b1394 100644 --- a/clientgui/SkinManager.cpp +++ b/clientgui/SkinManager.cpp @@ -476,6 +476,7 @@ void CSkinAdvanced::Clear() { m_bIsBranded = false; m_strApplicationName = wxEmptyString; m_strApplicationShortName = wxEmptyString; + m_strApplicationHelpName = wxEmptyString; m_iconApplicationIcon.Clear(); m_iconApplicationDisconnectedIcon.Clear(); m_iconApplicationSnoozeIcon.Clear(); @@ -502,6 +503,9 @@ int CSkinAdvanced::Parse(MIOFILE& in) { } else if (parse_str(buf, "", strBuffer)) { m_strApplicationShortName = wxString(strBuffer.c_str(), wxConvUTF8); continue; + } else if (parse_str(buf, "", strBuffer)) { + m_strApplicationHelpName = wxString(strBuffer.c_str(), wxConvUTF8); + continue; } else if (match_tag(buf, "")) { m_iconApplicationIcon.Parse(in); continue; @@ -575,6 +579,14 @@ wxString CSkinAdvanced::GetApplicationShortName() { } +wxString CSkinAdvanced::GetApplicationHelpName() { + if (m_strApplicationHelpName.IsEmpty()) { + return m_strApplicationName; + } + return m_strApplicationHelpName; +} + + wxIconBundle* CSkinAdvanced::GetApplicationIcon() { return m_iconApplicationIcon.GetIcon(); } @@ -640,6 +652,11 @@ bool CSkinAdvanced::InitializeDelayedValidation() { m_strApplicationShortName = wxT("BOINC"); wxASSERT(!m_strApplicationShortName.IsEmpty()); } + if (m_strApplicationHelpName.IsEmpty()) { + if (show_error_msgs) { + fprintf(stderr, "Skin Manager: Application help name was not defined. Using application name.\n"); + } + } #ifdef _WIN32 m_iconApplicationIcon.SetDefaults(wxT("application"), wxT("boinc")); m_iconApplicationDisconnectedIcon.SetDefaults(wxT("application disconnected"), wxT("boincdisconnect")); diff --git a/clientgui/SkinManager.h b/clientgui/SkinManager.h index 5ad6b9fb5a..1901eb058c 100644 --- a/clientgui/SkinManager.h +++ b/clientgui/SkinManager.h @@ -190,6 +190,7 @@ public: wxString GetApplicationName(); wxString GetApplicationShortName(); + wxString GetApplicationHelpName(); wxIconBundle* GetApplicationIcon(); wxIconBundle* GetApplicationDisconnectedIcon(); wxIconBundle* GetApplicationSnoozeIcon(); @@ -205,6 +206,7 @@ private: bool m_bIsBranded; wxString m_strApplicationName; wxString m_strApplicationShortName; + wxString m_strApplicationHelpName; CSkinIcon m_iconApplicationIcon; CSkinIcon m_iconApplicationIcon32; CSkinIcon m_iconApplicationDisconnectedIcon; diff --git a/clientgui/sg_BoincSimpleFrame.cpp b/clientgui/sg_BoincSimpleFrame.cpp index 7624782a9d..c83441306a 100644 --- a/clientgui/sg_BoincSimpleFrame.cpp +++ b/clientgui/sg_BoincSimpleFrame.cpp @@ -232,12 +232,12 @@ CSimpleFrame::CSimpleFrame(wxString title, wxIconBundle* icons, wxPoint position ); strMenuName.Printf( - _("&%s"), - pSkinAdvanced->GetApplicationName().c_str() + _("&%s help"), + pSkinAdvanced->GetApplicationHelpName().c_str() ); strMenuDescription.Printf( _("Show information about the %s"), - pSkinAdvanced->GetApplicationName().c_str() + pSkinAdvanced->GetApplicationHelpName().c_str() ); menuHelp->Append( ID_HELPBOINCMANAGER,