mirror of
https://github.com/DarkMatterCore/nxdumptool.git
synced 2024-11-26 12:12:02 +00:00
Fix building issues.
An unordered map is now being used to hold ListItem + TitleApplicationMetadata pairs.
This commit is contained in:
parent
cfe293af7c
commit
b5507b38a6
4 changed files with 23 additions and 13 deletions
|
@ -128,7 +128,7 @@ namespace nxdt::tasks
|
|||
~TitleTask(void);
|
||||
|
||||
/* Intentionally left here to let system titles views retrieve metadata. */
|
||||
TitleApplicationMetadataVector* GetApplicationMetadata(bool is_system);
|
||||
const TitleApplicationMetadataVector* GetApplicationMetadata(bool is_system);
|
||||
|
||||
ALWAYS_INLINE TitleEvent::Subscription RegisterListener(TitleEvent::Callback cb)
|
||||
{
|
||||
|
|
|
@ -33,10 +33,10 @@ namespace nxdt::views
|
|||
{
|
||||
private:
|
||||
nxdt::tasks::TitleTask *title_task = nullptr;
|
||||
nxdt::tasks::VoidEvent::Subscription title_task_sub;
|
||||
nxdt::tasks::TitleApplicationMetadataVector *user_app_metadata = nullptr;
|
||||
nxdt::tasks::TitleEvent::Subscription title_task_sub;
|
||||
std::unordered_map<brls::ListItem*, TitleApplicationMetadata*> list_item_metadata;
|
||||
|
||||
void PopulateList(void);
|
||||
void PopulateList(const nxdt::tasks::TitleApplicationMetadataVector* user_app_metadata);
|
||||
|
||||
public:
|
||||
UserTitlesTab(nxdt::tasks::TitleTask *title_task);
|
||||
|
|
|
@ -142,7 +142,7 @@ namespace nxdt::tasks
|
|||
}
|
||||
}
|
||||
|
||||
TitleApplicationMetadataVector* TitleTask::GetApplicationMetadata(bool is_system)
|
||||
const TitleApplicationMetadataVector* TitleTask::GetApplicationMetadata(bool is_system)
|
||||
{
|
||||
return (is_system ? &(this->system_metadata) : &(this->user_metadata));
|
||||
}
|
||||
|
|
|
@ -29,12 +29,12 @@ namespace nxdt::views
|
|||
UserTitlesTab::UserTitlesTab(nxdt::tasks::TitleTask *title_task) : LayeredErrorFrame("user_titles_tab/no_titles_available"_i18n), title_task(title_task)
|
||||
{
|
||||
/* Populate list. */
|
||||
this->PopulateList();
|
||||
this->PopulateList(this->title_task->GetApplicationMetadata(false));
|
||||
|
||||
/* Subscribe to title event. */
|
||||
this->title_task_sub = this->title_task->RegisterListener([this](void) {
|
||||
this->title_task_sub = this->title_task->RegisterListener([this](const nxdt::tasks::TitleApplicationMetadataVector* user_app_metadata) {
|
||||
/* Update list. */
|
||||
this->PopulateList();
|
||||
this->PopulateList(user_app_metadata);
|
||||
brls::Application::notify("user_titles_tab/notification"_i18n);
|
||||
});
|
||||
}
|
||||
|
@ -43,14 +43,17 @@ namespace nxdt::views
|
|||
{
|
||||
/* Unregister task listener. */
|
||||
this->title_task->UnregisterListener(this->title_task_sub);
|
||||
|
||||
/* Clear user application metadata map. */
|
||||
this->list_item_metadata.clear();
|
||||
}
|
||||
|
||||
void UserTitlesTab::PopulateList(void)
|
||||
void UserTitlesTab::PopulateList(const nxdt::tasks::TitleApplicationMetadataVector* user_app_metadata)
|
||||
{
|
||||
bool refocus = false;
|
||||
if (!user_app_metadata) return;
|
||||
|
||||
this->user_app_metadata = this->title_task->GetApplicationMetadata(false);
|
||||
size_t user_app_metadata_count = this->user_app_metadata->size();
|
||||
bool refocus = false;
|
||||
size_t user_app_metadata_count = user_app_metadata->size();
|
||||
|
||||
if (user_app_metadata_count)
|
||||
{
|
||||
|
@ -75,15 +78,22 @@ namespace nxdt::views
|
|||
this->list->clear();
|
||||
this->list->invalidate(true);
|
||||
|
||||
/* Clear our private user application map. */
|
||||
this->list_item_metadata.clear();
|
||||
|
||||
/* Immediately return if we have no user application metadata. */
|
||||
if (!user_app_metadata_count) return;
|
||||
|
||||
/* Populate list. */
|
||||
for(TitleApplicationMetadata *cur_app_metadata : *(this->user_app_metadata))
|
||||
for(TitleApplicationMetadata *cur_app_metadata : *user_app_metadata)
|
||||
{
|
||||
/* Add list item for this application metadata to our list. */
|
||||
brls::ListItem *list_item = new brls::ListItem(std::string(cur_app_metadata->lang_entry.name), "", std::string(cur_app_metadata->lang_entry.author));
|
||||
list_item->setThumbnail(cur_app_metadata->icon, cur_app_metadata->icon_size);
|
||||
this->list->addView(list_item);
|
||||
|
||||
/* Update our private user application metadata map. */
|
||||
this->list_item_metadata.insert(std::make_pair(list_item, cur_app_metadata));
|
||||
}
|
||||
|
||||
/* Switch to the list. */
|
||||
|
|
Loading…
Reference in a new issue