Merge pull request #2671 from armstrdj/add_custom_help_menu_string_for_brand

Adds ability for a Brand to define the string for boinc help in the h…
This commit is contained in:
Vitalii Koshura 2018-09-08 03:40:20 +03:00 committed by GitHub
commit 352b93b393
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 5 deletions

View File

@ -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,

View File

@ -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, "<application_short_name>", strBuffer)) {
m_strApplicationShortName = wxString(strBuffer.c_str(), wxConvUTF8);
continue;
} else if (parse_str(buf, "<application_help_name>", strBuffer)) {
m_strApplicationHelpName = wxString(strBuffer.c_str(), wxConvUTF8);
continue;
} else if (match_tag(buf, "<application_icon>")) {
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"));

View File

@ -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;

View File

@ -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,