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

Move notifications to tasks.cpp.

This commit is contained in:
Pablo Curiel 2021-06-25 16:26:20 -04:00
parent c50840ec7c
commit e32782f322
6 changed files with 19 additions and 11 deletions

View file

@ -1,6 +1,4 @@
{ {
"notification": "Gamecard status change detected!",
"error_frame": { "error_frame": {
"not_inserted": "No gamecard inserted.", "not_inserted": "No gamecard inserted.",
"processing": "Processing gamecard, please wait...", "processing": "Processing gamecard, please wait...",

View file

@ -0,0 +1,6 @@
{
"notifications": {
"gamecard": "Gamecard status change detected!",
"user_titles": "User titles updated!"
}
}

View file

@ -1,4 +1,3 @@
{ {
"no_titles_available": "No titles available.", "no_titles_available": "No titles available."
"user_titles_notification": "User titles list updated!"
} }

View file

@ -83,8 +83,6 @@ namespace nxdt::views
/* Subscribe to gamecard status event. */ /* Subscribe to gamecard status event. */
this->gc_status_task_sub = this->gc_status_task->RegisterListener([this](GameCardStatus gc_status) { this->gc_status_task_sub = this->gc_status_task->RegisterListener([this](GameCardStatus gc_status) {
brls::Application::notify("gamecard_tab/notification"_i18n);
if (gc_status < GameCardStatus_InsertedAndInfoLoaded) this->SwitchLayerView(true); if (gc_status < GameCardStatus_InsertedAndInfoLoaded) this->SwitchLayerView(true);
switch(gc_status) switch(gc_status)

View file

@ -25,6 +25,8 @@
#define NXDT_TASK_INTERVAL 250 /* 250 ms. */ #define NXDT_TASK_INTERVAL 250 /* 250 ms. */
using namespace brls::i18n::literals; /* For _i18n. */
namespace nxdt::tasks namespace nxdt::tasks
{ {
/* Status info task. */ /* Status info task. */
@ -97,9 +99,14 @@ namespace nxdt::tasks
this->cur_gc_status = (GameCardStatus)gamecardGetStatus(); this->cur_gc_status = (GameCardStatus)gamecardGetStatus();
if (this->cur_gc_status != this->prev_gc_status) if (this->cur_gc_status != this->prev_gc_status)
{ {
this->gc_status_event.fire(this->cur_gc_status);
this->prev_gc_status = this->cur_gc_status;
brls::Logger::debug("Gamecard status change triggered: {}.", this->cur_gc_status); brls::Logger::debug("Gamecard status change triggered: {}.", this->cur_gc_status);
brls::Application::notify("tasks/notifications/gamecard"_i18n);
/* Update previous gamecard status. */
this->prev_gc_status = this->cur_gc_status;
/* Fire task event. */
this->gc_status_event.fire(this->cur_gc_status);
} }
} }
@ -133,12 +140,14 @@ namespace nxdt::tasks
if (titleIsGameCardInfoUpdated()) if (titleIsGameCardInfoUpdated())
{ {
brls::Logger::debug("Title info updated.");
brls::Application::notify("tasks/notifications/user_titles"_i18n);
/* Update user metadata vector. */ /* Update user metadata vector. */
this->PopulateApplicationMetadataVector(false); this->PopulateApplicationMetadataVector(false);
/* Fire task event. */ /* Fire task event. */
this->title_event.fire(&(this->user_metadata)); this->title_event.fire(&(this->user_metadata));
brls::Logger::debug("Title info updated.");
} }
} }

View file

@ -90,8 +90,6 @@ namespace nxdt::views
this->title_task_sub = this->title_task->RegisterListener([this](const nxdt::tasks::TitleApplicationMetadataVector* app_metadata) { this->title_task_sub = this->title_task->RegisterListener([this](const nxdt::tasks::TitleApplicationMetadataVector* app_metadata) {
/* Update list. */ /* Update list. */
this->PopulateList(app_metadata); this->PopulateList(app_metadata);
brls::Application::notify("titles_tab/user_titles_notification"_i18n);
}); });
} }
} }