| 53 | } |
| 54 | |
| 55 | void ExploreMenuLayout::ReloadMenu() { |
| 56 | this->mounts_menu->ClearItems(); |
| 57 | |
| 58 | this->sd_card_menu_item = pu::ui::elm::MenuItem::New(cfg::Strings.GetString(19)); |
| 59 | this->sd_card_menu_item->SetIcon(GetCommonIcon(CommonIconKind::SdCard)); |
| 60 | this->sd_card_menu_item->SetColor(g_Settings.GetColorScheme().text); |
| 61 | this->sd_card_menu_item->AddOnKey(std::bind(&ExploreMenuLayout::OnSdCardSelected, this)); |
| 62 | |
| 63 | this->usb_drive_menu_items.clear(); |
| 64 | drive::DoWithDrives([this](const std::vector<UsbHsFsDevice> &drives) { |
| 65 | for(const auto &drive: drives) { |
| 66 | auto drive_item = pu::ui::elm::MenuItem::New("USB drive: " + drive::FormatDriveName(drive)); |
| 67 | drive_item->SetIcon(GetCommonIcon(CommonIconKind::USB)); |
| 68 | drive_item->SetColor(g_Settings.GetColorScheme().text); |
| 69 | auto drive_copy = drive; |
| 70 | drive_item->AddOnKey(std::bind(&ExploreMenuLayout::OnUsbDriveSelected, this, drive_copy)); |
| 71 | drive_item->AddOnKey(std::bind(&ExploreMenuLayout::OnUsbDriveSelectedX, this, drive_copy), HidNpadButton_X); |
| 72 | this->usb_drive_menu_items.push_back(drive_item); |
| 73 | } |
| 74 | }); |
| 75 | |
| 76 | this->remote_pc_explore_menu_item = pu::ui::elm::MenuItem::New(cfg::Strings.GetString(299)); |
| 77 | this->remote_pc_explore_menu_item->SetIcon(GetCommonIcon(CommonIconKind::Pc)); |
| 78 | this->remote_pc_explore_menu_item->SetColor(g_Settings.GetColorScheme().text); |
| 79 | this->remote_pc_explore_menu_item->AddOnKey(std::bind(&ExploreMenuLayout::OnRemotePcExploreSelected, this)); |
| 80 | |
| 81 | // Mounted explorer items are created elsewhere |
| 82 | |
| 83 | this->nand_user_menu_item = pu::ui::elm::MenuItem::New(cfg::Strings.GetString(20) + " (USER)"); |
| 84 | this->nand_user_menu_item->SetIcon(GetCommonIcon(CommonIconKind::NAND)); |
| 85 | this->nand_user_menu_item->SetColor(g_Settings.GetColorScheme().text); |
| 86 | this->nand_user_menu_item->AddOnKey(std::bind(&ExploreMenuLayout::OnNandPartitionSelected, this, fs::Partition::NANDUser)); |
| 87 | |
| 88 | this->nand_system_menu_item = pu::ui::elm::MenuItem::New(cfg::Strings.GetString(20) + " (SYSTEM)"); |
| 89 | this->nand_system_menu_item->SetIcon(GetCommonIcon(CommonIconKind::NAND)); |
| 90 | this->nand_system_menu_item->SetColor(g_Settings.GetColorScheme().text); |
| 91 | this->nand_system_menu_item->AddOnKey(std::bind(&ExploreMenuLayout::OnNandPartitionSelected, this, fs::Partition::NANDSystem)); |
| 92 | |
| 93 | this->nand_prodinfof_menu_item = pu::ui::elm::MenuItem::New(cfg::Strings.GetString(20) + " (PRODINFOF)"); |
| 94 | this->nand_prodinfof_menu_item->SetIcon(GetCommonIcon(CommonIconKind::NAND)); |
| 95 | this->nand_prodinfof_menu_item->SetColor(g_Settings.GetColorScheme().text); |
| 96 | this->nand_prodinfof_menu_item->AddOnKey(std::bind(&ExploreMenuLayout::OnNandPartitionSelected, this, fs::Partition::PRODINFOF)); |
| 97 | |
| 98 | this->nand_safe_menu_item = pu::ui::elm::MenuItem::New(cfg::Strings.GetString(20) + " (SAFE)"); |
| 99 | this->nand_safe_menu_item->SetIcon(GetCommonIcon(CommonIconKind::NAND)); |
| 100 | this->nand_safe_menu_item->SetColor(g_Settings.GetColorScheme().text); |
| 101 | this->nand_safe_menu_item->AddOnKey(std::bind(&ExploreMenuLayout::OnNandPartitionSelected, this, fs::Partition::NANDSafe)); |
| 102 | |
| 103 | this->mounts_menu->AddItem(this->sd_card_menu_item); |
| 104 | for(auto &drive_item: this->usb_drive_menu_items) { |
| 105 | this->mounts_menu->AddItem(drive_item); |
| 106 | } |
| 107 | this->mounts_menu->AddItem(this->remote_pc_explore_menu_item); |
| 108 | this->mounts_menu->AddItem(this->nand_prodinfof_menu_item); |
| 109 | this->mounts_menu->AddItem(this->nand_safe_menu_item); |
| 110 | this->mounts_menu->AddItem(this->nand_user_menu_item); |
| 111 | this->mounts_menu->AddItem(this->nand_system_menu_item); |
| 112 | this->mounts_menu->SetSelectedIndex(0); |
no test coverage detected