]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Application/UiApp/FrontPageCustomizedUi.c
MdeModulePkg/UiApp: Show test key warning info in FrontPage.
[mirror_edk2.git] / MdeModulePkg / Application / UiApp / FrontPageCustomizedUi.c
CommitLineData
c9802c45
ED
1/** @file\r
2\r
3 This library class defines a set of interfaces to customize Ui module\r
4\r
5Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
6This program and the accompanying materials are licensed and made available under\r
7the terms and conditions of the BSD License that accompanies this distribution.\r
8The full text of the license may be found at\r
9http://opensource.org/licenses/bsd-license.php.\r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15#include <Uefi.h>\r
16#include <Protocol/HiiConfigAccess.h>\r
17#include <Library/BaseLib.h>\r
18#include <Library/MemoryAllocationLib.h>\r
15b52294 19#include "FrontPage.h"\r
c9802c45
ED
20#include "FrontPageCustomizedUiSupport.h"\r
21\r
15b52294
JY
22extern FRONT_PAGE_CALLBACK_DATA gFrontPagePrivate;\r
23\r
c9802c45
ED
24/**\r
25 Customize menus in the page.\r
26\r
27 @param[in] HiiHandle The HII Handle of the form to update.\r
28 @param[in] StartOpCodeHandle The context used to insert opcode.\r
29 @param[in] CustomizePageType The page type need to be customized.\r
30\r
31**/\r
32VOID\r
33UiCustomizeFrontPage (\r
34 IN EFI_HII_HANDLE HiiHandle,\r
35 IN VOID *StartOpCodeHandle\r
36 )\r
37{\r
38 //\r
39 // Create "Select Language" menu with Oneof opcode.\r
40 //\r
41 UiCreateLanguageMenu (HiiHandle, StartOpCodeHandle);\r
42\r
43 //\r
44 // Create empty line.\r
45 //\r
46 UiCreateEmptyLine(HiiHandle, StartOpCodeHandle);\r
47\r
48 //\r
49 // Find third party drivers which need to be shown in the front page.\r
50 //\r
51 UiListThirdPartyDrivers (HiiHandle, &gEfiIfrFrontPageGuid, NULL, StartOpCodeHandle);\r
52\r
53 //\r
54 // Create empty line.\r
55 //\r
56 UiCreateEmptyLine(HiiHandle, StartOpCodeHandle);\r
57\r
58 //\r
59 // Create "Continue" menu.\r
60 //\r
61 UiCreateContinueMenu(HiiHandle, StartOpCodeHandle);\r
62\r
63 //\r
64 // Create reset menu.\r
65 //\r
66 UiCreateResetMenu(HiiHandle, StartOpCodeHandle);\r
67}\r
68\r
69/**\r
70 This function processes the results of changes in configuration.\r
71\r
72\r
73 @param HiiHandle Points to the hii handle for this formset.\r
74 @param Action Specifies the type of action taken by the browser.\r
75 @param QuestionId A unique value which is sent to the original exporting driver\r
76 so that it can identify the type of data to expect.\r
77 @param Type The type of value for the question.\r
78 @param Value A pointer to the data being sent to the original exporting driver.\r
79 @param ActionRequest On return, points to the action requested by the callback function.\r
80\r
81 @retval EFI_SUCCESS The callback successfully handled the action.\r
82 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.\r
83 @retval EFI_DEVICE_ERROR The variable could not be saved.\r
84 @retval EFI_UNSUPPORTED The specified Action is not supported by the callback.\r
85\r
86**/\r
87EFI_STATUS\r
88UiFrontPageCallbackHandler (\r
89 IN EFI_HII_HANDLE HiiHandle,\r
90 IN EFI_BROWSER_ACTION Action,\r
91 IN EFI_QUESTION_ID QuestionId,\r
92 IN UINT8 Type,\r
93 IN EFI_IFR_TYPE_VALUE *Value,\r
94 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest\r
95 )\r
96{\r
97 EFI_STATUS Status;\r
98\r
99 if (UiSupportLibCallbackHandler (HiiHandle, Action, QuestionId, Type, Value, ActionRequest, &Status)) {\r
100 return Status;\r
101 }\r
102\r
103 return EFI_UNSUPPORTED;\r
104}\r
105\r
106/**\r
107 Update the banner string in the front page.\r
108\r
109 Current layout for the banner string like below:\r
110 PS: Totally only 5 lines of banner supported.\r
111\r
112 Line 1: Left BannerStr RightBannerStr\r
113 Line 2: Left BannerStr RightBannerStr\r
114 Line 3: Left BannerStr RightBannerStr\r
115 Line 4: Left BannerStr RightBannerStr\r
116 Line 5: Left BannerStr RightBannerStr\r
117 <EmptyLine>\r
118 First menu in front page.\r
119 ...\r
120\r
121 @param LineIndex The line index of the banner need to check.\r
122 @param LeftOrRight The left or right banner need to check.\r
123 @param BannerStr Banner string need to update.\r
124 Input the current string and user can update\r
125 it and return the new string.\r
126\r
127**/\r
128VOID\r
129UiCustomizeFrontPageBanner (\r
130 IN UINTN LineIndex,\r
131 IN BOOLEAN LeftOrRight,\r
132 IN OUT EFI_STRING *BannerStr\r
133 )\r
134{\r
15b52294
JY
135 if ((LineIndex == 5) && LeftOrRight) {\r
136 // Update STR_CUSTOMIZE_BANNER_LINE5_LEFT\r
137 if (PcdGetBool(PcdTestKeyUsed)) {\r
138 if (BannerStr != NULL) {\r
139 FreePool(*BannerStr);\r
140 }\r
141 *BannerStr = HiiGetString(gFrontPagePrivate.HiiHandle, STRING_TOKEN(STR_TEST_KEY_USED), NULL);\r
142 }\r
143 }\r
144 return;\r
c9802c45 145}\r