1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2024-11-22 18:26:39 +00:00

[ci skip] UI code quality improvements

* Always use value references for periodic Borealis tasks.
* Always use nullptr instead of NULL in C++ headers and modules (except when dealing with functions with C name mangling).
* Update StatusInfoData to use a char array for the IP address instead of directly using the pointer returned by inet_ntoa().
This commit is contained in:
Pablo Curiel 2024-04-18 10:46:29 +02:00
parent bd5fea1fb7
commit 7d7f2d58a8
9 changed files with 78 additions and 78 deletions

View file

@ -103,7 +103,7 @@ namespace nxdt::tasks
char *buf = nullptr; char *buf = nullptr;
size_t buf_size = 0; size_t buf_size = 0;
/* If the process fails or if it's cancelled, httpDownloadData() will take care of freeing up the allocated memory and return NULL. */ /* If the process fails or if it's cancelled, httpDownloadData() will take care of freeing up the allocated memory and returning NULL. */
buf = httpDownloadData(&buf_size, url.c_str(), force_https, DownloadDataTask::HttpProgressCallback, this); buf = httpDownloadData(&buf_size, url.c_str(), force_https, DownloadDataTask::HttpProgressCallback, this);
return std::make_pair(buf, buf_size); return std::make_pair(buf, buf_size);

View file

@ -70,13 +70,13 @@ namespace nxdt::views
return output; return output;
} }
void UpdateStorages(const nxdt::tasks::UmsDeviceVector* ums_devices) void UpdateStorages(const nxdt::tasks::UmsDeviceVector& ums_devices)
{ {
if (!this->output_storage_item) return; if (!this->output_storage_item) return;
std::vector<std::string> storages{}; std::vector<std::string> storages{};
size_t elem_count = (ConfigOutputStorage_Count + ums_devices->size()); size_t elem_count = (ConfigOutputStorage_Count + ums_devices.size());
u32 selected = this->output_storage_item->getSelectedValue(); u32 selected = this->output_storage_item->getSelectedValue();
/* Fill storages vector. */ /* Fill storages vector. */
@ -91,7 +91,7 @@ namespace nxdt::views
u64 total_sz = 0, free_sz = 0; u64 total_sz = 0, free_sz = 0;
char total_sz_str[64] = {0}, free_sz_str[64] = {0}; char total_sz_str[64] = {0}, free_sz_str[64] = {0};
const UsbHsFsDevice *cur_ums_device = (i >= ConfigOutputStorage_Count ? (ums_devices->data() + (i - ConfigOutputStorage_Count)) : nullptr); const UsbHsFsDevice *cur_ums_device = (i >= ConfigOutputStorage_Count ? &(ums_devices.at(i - ConfigOutputStorage_Count)) : nullptr);
sprintf(total_sz_str, "%s/", cur_ums_device ? cur_ums_device->name : DEVOPTAB_SDMC_DEVICE); sprintf(total_sz_str, "%s/", cur_ums_device ? cur_ums_device->name : DEVOPTAB_SDMC_DEVICE);
utilsGetFileSystemStatsByPath(total_sz_str, &total_sz, &free_sz); utilsGetFileSystemStatsByPath(total_sz_str, &total_sz, &free_sz);
@ -175,7 +175,7 @@ namespace nxdt::views
/* Subscribe to SelectListItem's value selected event. */ /* Subscribe to SelectListItem's value selected event. */
this->output_storage_item->getValueSelectedEvent()->subscribe([this](int selected) { this->output_storage_item->getValueSelectedEvent()->subscribe([this](int selected) {
/* Make sure the current value isn't out of bounds. */ /* Make sure the current value isn't out of bounds. */
if (selected < ConfigOutputStorage_SdCard || selected >= static_cast<int>(this->root_view->GetUmsDevices()->size() + ConfigOutputStorage_Count)) return; if (selected < ConfigOutputStorage_SdCard || selected >= static_cast<int>(this->root_view->GetUmsDevices().size() + ConfigOutputStorage_Count)) return;
/* Update configuration. */ /* Update configuration. */
if (selected == ConfigOutputStorage_SdCard || selected == ConfigOutputStorage_UsbHost) configSetInteger("output_storage", selected); if (selected == ConfigOutputStorage_SdCard || selected == ConfigOutputStorage_UsbHost) configSetInteger("output_storage", selected);
@ -195,7 +195,7 @@ namespace nxdt::views
/* Subscribe to the UMS device event. */ /* Subscribe to the UMS device event. */
this->ums_task_sub = this->root_view->RegisterUmsTaskListener([this](const nxdt::tasks::UmsDeviceVector* ums_devices) { this->ums_task_sub = this->root_view->RegisterUmsTaskListener([this](const nxdt::tasks::UmsDeviceVector& ums_devices) {
/* Update output storages vector. */ /* Update output storages vector. */
this->UpdateStorages(ums_devices); this->UpdateStorages(ums_devices);
}); });

View file

@ -46,7 +46,7 @@ namespace nxdt::views
{ {
private: private:
nxdt::tasks::DownloadDataTask json_task; nxdt::tasks::DownloadDataTask json_task;
char *json_buf = NULL; char *json_buf = nullptr;
size_t json_buf_size = 0; size_t json_buf_size = 0;
UtilsGitHubReleaseJsonData json_data = {0}; UtilsGitHubReleaseJsonData json_data = {0};

View file

@ -72,19 +72,19 @@ namespace nxdt::views
return this->status_info_task->IsInternetConnectionAvailable(); return this->status_info_task->IsInternetConnectionAvailable();
} }
ALWAYS_INLINE const nxdt::tasks::TitleApplicationMetadataVector* GetApplicationMetadata(bool is_system) ALWAYS_INLINE const nxdt::tasks::TitleApplicationMetadataVector& GetApplicationMetadata(bool is_system)
{ {
return this->title_task->GetApplicationMetadata(is_system); return this->title_task->GetApplicationMetadata(is_system);
} }
ALWAYS_INLINE const nxdt::tasks::UmsDeviceVector* GetUmsDevices(void) ALWAYS_INLINE const nxdt::tasks::UmsDeviceVector& GetUmsDevices(void)
{ {
return this->ums_task->GetUmsDevices(); return this->ums_task->GetUmsDevices();
} }
EVENT_SUBSCRIPTION(StatusInfoTask, StatusInfoEvent, status_info_task); EVENT_SUBSCRIPTION(StatusInfoTask, StatusInfoEvent, status_info_task);
EVENT_SUBSCRIPTION(GameCardTask, GameCardStatusEvent, gc_status_task); EVENT_SUBSCRIPTION(GameCardTask, GameCardStatusEvent, gc_status_task);
EVENT_SUBSCRIPTION(TitleTask, TitleEvent, title_task); EVENT_SUBSCRIPTION(TitleTask, UserTitleEvent, title_task);
EVENT_SUBSCRIPTION(UmsTask, UmsEvent, ums_task); EVENT_SUBSCRIPTION(UmsTask, UmsEvent, ums_task);
EVENT_SUBSCRIPTION(UsbHostTask, UsbHostEvent, usb_host_task); EVENT_SUBSCRIPTION(UsbHostTask, UsbHostEvent, usb_host_task);
}; };

View file

@ -44,8 +44,9 @@ namespace nxdt::tasks
struct tm timeinfo; struct tm timeinfo;
u32 charge_percentage; u32 charge_percentage;
PsmChargerType charger_type; PsmChargerType charger_type;
bool connected;
NifmInternetConnectionType connection_type; NifmInternetConnectionType connection_type;
char *ip_addr; char ip_addr[16];
} StatusInfoData; } StatusInfoData;
/* Used to hold pointers to application metadata entries. */ /* Used to hold pointers to application metadata entries. */
@ -55,19 +56,19 @@ namespace nxdt::tasks
typedef std::vector<UsbHsFsDevice> UmsDeviceVector; typedef std::vector<UsbHsFsDevice> UmsDeviceVector;
/* Custom event types. */ /* Custom event types. */
typedef brls::Event<const StatusInfoData*> StatusInfoEvent; typedef brls::Event<const StatusInfoData&> StatusInfoEvent;
typedef brls::Event<GameCardStatus> GameCardStatusEvent; typedef brls::Event<const GameCardStatus&> GameCardStatusEvent;
typedef brls::Event<const TitleApplicationMetadataVector*> TitleEvent; typedef brls::Event<const TitleApplicationMetadataVector&> UserTitleEvent;
typedef brls::Event<const UmsDeviceVector*> UmsEvent; typedef brls::Event<const UmsDeviceVector&> UmsEvent;
typedef brls::Event<UsbHostSpeed> UsbHostEvent; typedef brls::Event<const UsbHostSpeed&> UsbHostEvent;
/* Status info task. */ /* Status info task. */
/* Its event returns a pointer to a StatusInfoData struct. */ /* Its event returns a reference to a StatusInfoData struct. */
class StatusInfoTask: public brls::RepeatingTask class StatusInfoTask: public brls::RepeatingTask
{ {
private: private:
StatusInfoEvent status_info_event; StatusInfoEvent status_info_event;
StatusInfoData status_info_data = {0}; StatusInfoData status_info_data{};
protected: protected:
void run(retro_time_t current_time) override; void run(retro_time_t current_time) override;
@ -102,14 +103,14 @@ namespace nxdt::tasks
}; };
/* Title task. */ /* Title task. */
/* Its event returns a pointer to a TitleApplicationMetadataVector with metadata for user titles (system titles don't change at runtime). */ /* Its event returns a reference to a TitleApplicationMetadataVector with metadata for user titles (system titles don't change at runtime). */
class TitleTask: public brls::RepeatingTask class TitleTask: public brls::RepeatingTask
{ {
private: private:
TitleEvent title_event; UserTitleEvent user_title_event;
TitleApplicationMetadataVector system_metadata; TitleApplicationMetadataVector system_metadata{};
TitleApplicationMetadataVector user_metadata; TitleApplicationMetadataVector user_metadata{};
void PopulateApplicationMetadataVector(bool is_system); void PopulateApplicationMetadataVector(bool is_system);
@ -120,19 +121,19 @@ namespace nxdt::tasks
TitleTask(void); TitleTask(void);
~TitleTask(void); ~TitleTask(void);
/* Intentionally left here to let views retrieve title metadata. */ /* Intentionally left here to let views retrieve title metadata on-demand. */
const TitleApplicationMetadataVector* GetApplicationMetadata(bool is_system); const TitleApplicationMetadataVector& GetApplicationMetadata(bool is_system);
EVENT_SUBSCRIPTION(TitleEvent, title_event); EVENT_SUBSCRIPTION(UserTitleEvent, user_title_event);
}; };
/* USB Mass Storage task. */ /* USB Mass Storage task. */
/* Its event returns a pointer to a UmsDeviceVector. */ /* Its event returns a reference to a UmsDeviceVector. */
class UmsTask: public brls::RepeatingTask class UmsTask: public brls::RepeatingTask
{ {
private: private:
UmsEvent ums_event; UmsEvent ums_event;
UmsDeviceVector ums_devices; UmsDeviceVector ums_devices{};
void PopulateUmsDeviceVector(void); void PopulateUmsDeviceVector(void);
@ -143,8 +144,8 @@ namespace nxdt::tasks
UmsTask(void); UmsTask(void);
~UmsTask(void); ~UmsTask(void);
/* Intentionally left here to let views retrieve UMS device info. */ /* Intentionally left here to let views retrieve UMS device info on-demand. */
const UmsDeviceVector* GetUmsDevices(void); const UmsDeviceVector& GetUmsDevices(void);
EVENT_SUBSCRIPTION(UmsEvent, ums_event); EVENT_SUBSCRIPTION(UmsEvent, ums_event);
}; };

View file

@ -36,8 +36,8 @@ namespace nxdt::views
const TitleApplicationMetadata *app_metadata = nullptr; const TitleApplicationMetadata *app_metadata = nullptr;
bool is_system = false; bool is_system = false;
TitleUserApplicationData user_app_data = {0}; TitleUserApplicationData user_app_data{};
TitleInfo *system_title_info = NULL; TitleInfo *system_title_info = nullptr;
public: public:
TitlesTabPopup(const TitleApplicationMetadata *app_metadata, bool is_system); TitlesTabPopup(const TitleApplicationMetadata *app_metadata, bool is_system);
@ -50,7 +50,7 @@ namespace nxdt::views
private: private:
const TitleApplicationMetadata *app_metadata = nullptr; const TitleApplicationMetadata *app_metadata = nullptr;
bool is_system = false; bool is_system = false;
bool click_anim; bool click_anim = true;
public: public:
TitlesTabItem(const TitleApplicationMetadata *app_metadata, bool is_system, bool click_anim = true); TitlesTabItem(const TitleApplicationMetadata *app_metadata, bool is_system, bool click_anim = true);
@ -73,10 +73,10 @@ namespace nxdt::views
private: private:
RootView *root_view = nullptr; RootView *root_view = nullptr;
nxdt::tasks::TitleEvent::Subscription title_task_sub; nxdt::tasks::UserTitleEvent::Subscription title_task_sub;
bool is_system = false; bool is_system = false;
void PopulateList(const nxdt::tasks::TitleApplicationMetadataVector* app_metadata); void PopulateList(const nxdt::tasks::TitleApplicationMetadataVector& app_metadata);
public: public:
TitlesTab(RootView *root_view, bool is_system); TitlesTab(RootView *root_view, bool is_system);

View file

@ -128,15 +128,16 @@ namespace nxdt::views
this->addTab("root_view/tabs/about"_i18n, new AboutTab()); this->addTab("root_view/tabs/about"_i18n, new AboutTab());
/* Subscribe to status info event. */ /* Subscribe to status info event. */
this->status_info_task_sub = this->status_info_task->RegisterListener([this](const nxdt::tasks::StatusInfoData *status_info_data) { this->status_info_task_sub = this->status_info_task->RegisterListener([this](const nxdt::tasks::StatusInfoData& status_info_data) {
u32 charge_percentage = status_info_data->charge_percentage; u32 charge_percentage = status_info_data.charge_percentage;
PsmChargerType charger_type = status_info_data->charger_type; PsmChargerType charger_type = status_info_data.charger_type;
NifmInternetConnectionType connection_type = status_info_data->connection_type; bool connected = status_info_data.connected;
char *ip_addr = status_info_data->ip_addr; NifmInternetConnectionType connection_type = status_info_data.connection_type;
const char *ip_addr = status_info_data.ip_addr;
/* Update time label. */ /* Update time label. */
this->time_lbl->setText(this->GetFormattedDateString(status_info_data->timeinfo)); this->time_lbl->setText(this->GetFormattedDateString(status_info_data.timeinfo));
/* Update battery labels. */ /* Update battery labels. */
this->battery_icon->setText(charger_type != PsmChargerType_Unconnected ? "\uE1A3" : (charge_percentage >= 100 ? "\uE1A4" : (charge_percentage >= 83 ? "\uEBD2" : \ this->battery_icon->setText(charger_type != PsmChargerType_Unconnected ? "\uE1A3" : (charge_percentage >= 100 ? "\uE1A4" : (charge_percentage >= 83 ? "\uEBD2" : \
@ -150,12 +151,12 @@ namespace nxdt::views
this->battery_percentage->setText(fmt::format("{}%", charge_percentage)); this->battery_percentage->setText(fmt::format("{}%", charge_percentage));
/* Update network labels. */ /* Update network labels. */
this->connection_icon->setText(!connection_type ? "\uE195" : (connection_type == NifmInternetConnectionType_WiFi ? "\uE63E" : "\uE8BE")); this->connection_icon->setText(connected ? (connection_type == NifmInternetConnectionType_WiFi ? "\uE63E" : "\uE8BE") : "\uE195");
this->connection_status_lbl->setText(ip_addr ? std::string(ip_addr) : "root_view/not_connected"_i18n); this->connection_status_lbl->setText(connected ? std::string(ip_addr) : "root_view/not_connected"_i18n);
}); });
/* Subscribe to UMS event. */ /* Subscribe to UMS event. */
this->ums_task_sub = this->ums_task->RegisterListener([this](const nxdt::tasks::UmsDeviceVector* ums_devices) { this->ums_task_sub = this->ums_task->RegisterListener([this](const nxdt::tasks::UmsDeviceVector& ums_devices) {
/* Update UMS counter label. */ /* Update UMS counter label. */
this->ums_counter_lbl->setText(i18n::getStr("root_view/ums_counter"_i18n, usbHsFsGetPhysicalDeviceCount())); this->ums_counter_lbl->setText(i18n::getStr("root_view/ums_counter"_i18n, usbHsFsGetPhysicalDeviceCount()));
}); });

View file

@ -43,7 +43,7 @@ namespace nxdt::tasks
bool StatusInfoTask::IsInternetConnectionAvailable(void) bool StatusInfoTask::IsInternetConnectionAvailable(void)
{ {
return (this->status_info_data.ip_addr != NULL); return this->status_info_data.connected;
} }
void StatusInfoTask::run(retro_time_t current_time) void StatusInfoTask::run(retro_time_t current_time)
@ -53,7 +53,7 @@ namespace nxdt::tasks
StatusInfoData *status_info_data = &(this->status_info_data); StatusInfoData *status_info_data = &(this->status_info_data);
/* Get current time. */ /* Get current time. */
time_t unix_time = time(NULL); time_t unix_time = time(nullptr);
localtime_r(&unix_time, &(status_info_data->timeinfo)); localtime_r(&unix_time, &(status_info_data->timeinfo));
/* Get battery stats. */ /* Get battery stats. */
@ -62,26 +62,24 @@ namespace nxdt::tasks
/* Get network connection status. */ /* Get network connection status. */
u32 signal_strength = 0; u32 signal_strength = 0;
NifmInternetConnectionStatus connection_status = static_cast<NifmInternetConnectionStatus>(0); NifmInternetConnectionStatus connection_status{};
char *ip_addr = nullptr;
status_info_data->connected = false;
Result rc = nifmGetInternetConnectionStatus(&(status_info_data->connection_type), &signal_strength, &connection_status); Result rc = nifmGetInternetConnectionStatus(&(status_info_data->connection_type), &signal_strength, &connection_status);
if (R_SUCCEEDED(rc)) if (R_SUCCEEDED(rc) && status_info_data->connection_type && connection_status == NifmInternetConnectionStatus_Connected)
{
if (status_info_data->connection_type && connection_status == NifmInternetConnectionStatus_Connected)
{ {
status_info_data->connected = true;
struct in_addr addr = { .s_addr = INADDR_NONE }; struct in_addr addr = { .s_addr = INADDR_NONE };
nifmGetCurrentIpAddress(&(addr.s_addr)); nifmGetCurrentIpAddress(&(addr.s_addr));
status_info_data->ip_addr = (addr.s_addr != INADDR_NONE ? inet_ntoa(addr) : NULL);
} else { if (addr.s_addr != INADDR_NONE && (ip_addr = inet_ntoa(addr))) snprintf(status_info_data->ip_addr, MAX_ELEMENTS(status_info_data->ip_addr), "%s", ip_addr);
status_info_data->ip_addr = NULL;
}
} else {
status_info_data->connection_type = static_cast<NifmInternetConnectionType>(0);
status_info_data->ip_addr = NULL;
} }
/* Fire task event. */ /* Fire task event. */
this->status_info_event.fire(status_info_data); this->status_info_event.fire(this->status_info_data);
} }
/* Gamecard task. */ /* Gamecard task. */
@ -171,30 +169,30 @@ namespace nxdt::tasks
this->PopulateApplicationMetadataVector(false); this->PopulateApplicationMetadataVector(false);
/* Fire task event. */ /* Fire task event. */
this->title_event.fire(&(this->user_metadata)); this->user_title_event.fire(this->user_metadata);
} }
} }
const TitleApplicationMetadataVector* TitleTask::GetApplicationMetadata(bool is_system) const TitleApplicationMetadataVector& TitleTask::GetApplicationMetadata(bool is_system)
{ {
return (is_system ? &(this->system_metadata) : &(this->user_metadata)); return (is_system ? this->system_metadata : this->user_metadata);
} }
void TitleTask::PopulateApplicationMetadataVector(bool is_system) void TitleTask::PopulateApplicationMetadataVector(bool is_system)
{ {
TitleApplicationMetadata **app_metadata = NULL; TitleApplicationMetadata **app_metadata = nullptr;
u32 app_metadata_count = 0; u32 app_metadata_count = 0;
/* Get pointer to output vector. */ /* Get pointer to output vector. */
TitleApplicationMetadataVector *vector = (is_system ? &(this->system_metadata) : &(this->user_metadata)); TitleApplicationMetadataVector& vector = (is_system ? this->system_metadata : this->user_metadata);
vector->clear(); vector.clear();
/* Get application metadata entries. */ /* Get application metadata entries. */
app_metadata = titleGetApplicationMetadataEntries(is_system, &app_metadata_count); app_metadata = titleGetApplicationMetadataEntries(is_system, &app_metadata_count);
if (app_metadata) if (app_metadata)
{ {
/* Fill output vector. */ /* Fill output vector. */
for(u32 i = 0; i < app_metadata_count; i++) vector->push_back(app_metadata[i]); for(u32 i = 0; i < app_metadata_count; i++) vector.push_back(app_metadata[i]);
/* Free application metadata array. */ /* Free application metadata array. */
free(app_metadata); free(app_metadata);
@ -232,18 +230,18 @@ namespace nxdt::tasks
this->PopulateUmsDeviceVector(); this->PopulateUmsDeviceVector();
/* Fire task event. */ /* Fire task event. */
this->ums_event.fire(&(this->ums_devices)); this->ums_event.fire(this->ums_devices);
} }
} }
const UmsDeviceVector* UmsTask::GetUmsDevices(void) const UmsDeviceVector& UmsTask::GetUmsDevices(void)
{ {
return &(this->ums_devices); return this->ums_devices;
} }
void UmsTask::PopulateUmsDeviceVector(void) void UmsTask::PopulateUmsDeviceVector(void)
{ {
UsbHsFsDevice *ums_devices = NULL; UsbHsFsDevice *ums_devices = nullptr;
u32 ums_device_count = 0; u32 ums_device_count = 0;
/* Clear UMS device vector. */ /* Clear UMS device vector. */

View file

@ -41,7 +41,7 @@ namespace nxdt::views
this->system_title_info = titleGetInfoFromStorageByTitleId(NcmStorageId_BuiltInSystem, title_id); this->system_title_info = titleGetInfoFromStorageByTitleId(NcmStorageId_BuiltInSystem, title_id);
} }
/* Make sure we got title information. */ /* Make sure we got title information. This should never get triggered. */
if ((!this->is_system && !user_ret) || (this->is_system && !this->system_title_info)) throw fmt::format("Failed to retrieve title information for {:016X}.", title_id); if ((!this->is_system && !user_ret) || (this->is_system && !this->system_title_info)) throw fmt::format("Failed to retrieve title information for {:016X}.", title_id);
/* Add tabs. */ /* Add tabs. */
@ -89,7 +89,7 @@ namespace nxdt::views
/* Subscribe to the title event if this is the user titles tab. */ /* Subscribe to the title event if this is the user titles tab. */
if (!this->is_system) if (!this->is_system)
{ {
this->title_task_sub = this->root_view->RegisterTitleTaskListener([this](const nxdt::tasks::TitleApplicationMetadataVector* app_metadata) { this->title_task_sub = this->root_view->RegisterTitleTaskListener([this](const nxdt::tasks::TitleApplicationMetadataVector& app_metadata) {
/* Update list. */ /* Update list. */
this->PopulateList(app_metadata); this->PopulateList(app_metadata);
}); });
@ -102,10 +102,10 @@ namespace nxdt::views
if (!this->is_system) this->root_view->UnregisterTitleTaskListener(this->title_task_sub); if (!this->is_system) this->root_view->UnregisterTitleTaskListener(this->title_task_sub);
} }
void TitlesTab::PopulateList(const nxdt::tasks::TitleApplicationMetadataVector* app_metadata) void TitlesTab::PopulateList(const nxdt::tasks::TitleApplicationMetadataVector& app_metadata)
{ {
/* Populate variables. */ /* Populate variables. */
size_t app_metadata_count = (app_metadata ? app_metadata->size() : 0); size_t app_metadata_count = app_metadata.size();
bool update_focused_view = this->IsListItemFocused(); bool update_focused_view = this->IsListItemFocused();
int focus_stack_index = this->GetFocusStackViewIndex(); int focus_stack_index = this->GetFocusStackViewIndex();
@ -120,13 +120,13 @@ namespace nxdt::views
if (!app_metadata_count) return; if (!app_metadata_count) return;
/* Populate list. */ /* Populate list. */
for(const TitleApplicationMetadata *cur_app_metadata : *app_metadata) for(const TitleApplicationMetadata *cur_app_metadata : app_metadata)
{ {
/* Create list item. */ /* Create list item. */
TitlesTabItem *title = new TitlesTabItem(cur_app_metadata, this->is_system); TitlesTabItem *item = new TitlesTabItem(cur_app_metadata, this->is_system);
/* Register click event. */ /* Register click event. */
title->getClickEvent()->subscribe([](brls::View *view) { item->getClickEvent()->subscribe([](brls::View *view) {
TitlesTabItem *item = static_cast<TitlesTabItem*>(view); TitlesTabItem *item = static_cast<TitlesTabItem*>(view);
const TitleApplicationMetadata *app_metadata = item->GetApplicationMetadata(); const TitleApplicationMetadata *app_metadata = item->GetApplicationMetadata();
bool is_system = item->IsSystemTitle(); bool is_system = item->IsSystemTitle();
@ -157,7 +157,7 @@ namespace nxdt::views
}); });
/* Add list item to our view. */ /* Add list item to our view. */
this->list->addView(title); this->list->addView(item);
} }
/* Update focus stack, if needed. */ /* Update focus stack, if needed. */