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

Method UpdateElements

Goldleaf/source/ui/ui_TicketsLayout.cpp:66–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64 }
65
66 void TicketsLayout::UpdateElements() {
67 g_Settings.ApplyToMenu(this->tiks_menu);
68 this->tiks_menu->ClearItems();
69 this->no_unused_tiks_text->SetVisible(true);
70 this->tiks_menu->SetVisible(false);
71
72 g_MainApplication->LoadMenuHead(cfg::Strings.GetString(248));
73
74 auto has_any = false;
75 for(const auto &tik: cnt::GetTickets()) {
76 auto tik_name = util::FormatApplicationId(esGetRightsIdApplicationId(&tik.rights_id));
77
78 const auto used_title = tik.IsUsed();
79 const auto is_used = used_title.has_value();
80 if(is_used) {
81 tik_name = used_title->get().cache.display_name;
82 }
83
84 const auto tik_opts = "(" + FormatTicketType(tik.type) + ", " + (is_used ? cfg::Strings.GetString(450) : cfg::Strings.GetString(451)) + ")";
85
86 auto itm = pu::ui::elm::MenuItem::New(tik_name + " " + tik_opts);
87 itm->SetColor(g_Settings.GetColorScheme().text);
88 itm->SetIcon(GetCommonIcon(CommonIconKind::Ticket));
89 itm->AddOnKey(std::bind(&TicketsLayout::tickets_DefaultKey, this, tik));
90 this->tiks_menu->AddItem(itm);
91 has_any = true;
92 }
93
94 if(has_any) {
95 this->tiks_menu->SetSelectedIndex(0);
96 this->no_unused_tiks_text->SetVisible(false);
97 this->tiks_menu->SetVisible(true);
98 }
99 }
100
101 void TicketsLayout::Reload() {
102 g_MainApplication->LoadCommonIconMenuData(true, cfg::Strings.GetString(4), CommonIconKind::Ticket, cfg::Strings.GetString(279));

Callers 2

ReloadMethod · 0.95
tickets_DefaultKeyMethod · 0.95

Calls 6

FormatTicketTypeFunction · 0.85
GetCommonIconFunction · 0.85
ApplyToMenuMethod · 0.80
LoadMenuHeadMethod · 0.80
IsUsedMethod · 0.80
FormatApplicationIdFunction · 0.50

Tested by

no test coverage detected