MCPcopy Create free account
hub / github.com/XorTroll/Goldleaf / LoadApplication

Method LoadApplication

Goldleaf/source/ui/ui_ApplicationContentsLayout.cpp:301–336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

299 }
300
301 void ApplicationContentsLayout::LoadApplication(const u32 app_i) {
302 this->cnts_menu->ClearItems();
303 this->app_idx = app_i;
304
305 auto app_itm = pu::ui::elm::MenuItem::New(cfg::Strings.GetString(501));
306 app_itm->SetColor(g_Settings.GetColorScheme().text);
307 app_itm->AddOnKey(std::bind(&ApplicationContentsLayout::DisplayApplicationInfo, this));
308 this->cnts_menu->AddItem(app_itm);
309
310 const auto &app = cnt::GetApplications().at(app_i);
311 u32 cnt_i = 0;
312 for(const auto &cnt_status: app.meta_status_list) {
313 std::string name;
314 if(cnt_status.meta_type == NcmContentMetaType_AddOnContent) {
315 const auto aoc_id = cnt::GetAddOnContentId(cnt_status.application_id);
316 name = cfg::Strings.GetString(263) + " " + std::to_string(aoc_id);
317 }
318 else if(cnt_status.meta_type == NcmContentMetaType_Patch) {
319 name = cfg::Strings.GetString(262);
320 }
321 else if(cnt_status.meta_type == NcmContentMetaType_Application) {
322 name = cfg::Strings.GetString(261);
323 }
324 else {
325 name = cfg::Strings.GetString(502);
326 }
327
328 auto itm = pu::ui::elm::MenuItem::New(name);
329 itm->SetColor(g_Settings.GetColorScheme().text);
330 itm->AddOnKey(std::bind(&ApplicationContentsLayout::DisplayContentInfo, this, cnt_i));
331 this->cnts_menu->AddItem(itm);
332 cnt_i++;
333 }
334
335 g_MainApplication->LoadMenuData(true, app.cache.display_name, GetApplicationIcon(app.record.id), app.cache.display_author + ", v" + app.misc_data.display_version);
336 }
337
338}

Callers 2

DisplayContentInfoMethod · 0.95
apps_DefaultKeyMethod · 0.80

Calls 3

GetAddOnContentIdFunction · 0.85
GetApplicationIconFunction · 0.85
LoadMenuDataMethod · 0.80

Tested by

no test coverage detected