From bd5fea1fb70ec961f646de9dc139b621bf5af27a Mon Sep 17 00:00:00 2001 From: Pablo Curiel Date: Wed, 17 Apr 2024 21:32:18 +0200 Subject: [PATCH] [ci skip] DumpOptionsFrame: use SelectListItem::updateValues method --- include/dump_options_frame.hpp | 16 ++++++++++------ libs/borealis | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/include/dump_options_frame.hpp b/include/dump_options_frame.hpp index c988b06..44d3ab4 100644 --- a/include/dump_options_frame.hpp +++ b/include/dump_options_frame.hpp @@ -74,17 +74,17 @@ namespace nxdt::views { if (!this->output_storage_item) return; - std::vector *storages = this->output_storage_item->getValues(); - storages->clear(); + std::vector storages{}; size_t elem_count = (ConfigOutputStorage_Count + ums_devices->size()); u32 selected = this->output_storage_item->getSelectedValue(); + /* Fill storages vector. */ for(size_t i = 0; i < elem_count; i++) { if (i == 1) { - storages->push_back("dump_options/output_storage/value_01"_i18n); + storages.push_back("dump_options/output_storage/value_01"_i18n); continue; } @@ -102,12 +102,16 @@ namespace nxdt::views { std::string ums_extra_info = (cur_ums_device->product_name[0] ? (std::string(cur_ums_device->product_name) + ", ") : ""); ums_extra_info += fmt::format("LUN {}, FS #{}, {}", cur_ums_device->lun, cur_ums_device->fs_idx, LIBUSBHSFS_FS_TYPE_STR(cur_ums_device->fs_type)); - storages->push_back(brls::i18n::getStr("dump_options/output_storage/value_02", static_cast(strlen(cur_ums_device->name + 3) - 1), cur_ums_device->name + 3, free_sz_str, total_sz_str, ums_extra_info)); + storages.push_back(brls::i18n::getStr("dump_options/output_storage/value_02", static_cast(strlen(cur_ums_device->name + 3) - 1), cur_ums_device->name + 3, free_sz_str, total_sz_str, ums_extra_info)); } else { - storages->push_back(brls::i18n::getStr("dump_options/output_storage/value_00", free_sz_str, total_sz_str)); + storages.push_back(brls::i18n::getStr("dump_options/output_storage/value_00", free_sz_str, total_sz_str)); } } + /* Update SelectListItem values. */ + /* If the dropdown menu currently is being displayed, it'll be reloaded. */ + this->output_storage_item->updateValues(storages); + if (selected > ConfigOutputStorage_UsbHost) { /* Set the SD card as the current output storage. */ @@ -117,7 +121,7 @@ namespace nxdt::views /* This will take care of both updating the JSON configuration and saniziting the filename provided by the user. */ this->output_storage_item->getValueSelectedEvent()->fire(ConfigOutputStorage_SdCard); } else { - /* Set the current output storage once more. This will make sure the device string gets updated. */ + /* Set the current output storage once more. This will make sure the selected device string gets updated. */ this->output_storage_item->setSelectedValue(selected); } } diff --git a/libs/borealis b/libs/borealis index 7383102..ed6f2ef 160000 --- a/libs/borealis +++ b/libs/borealis @@ -1 +1 @@ -Subproject commit 73831023b18d2c60df532bafbf61b1c18c2ab4f0 +Subproject commit ed6f2ef76a136b0f77ce599e8401dbdf6bd6d11a