Rename ErrorLayerView -> LayeredErrorFrame.

This commit is contained in:
Pablo Curiel 2021-06-20 13:27:10 -04:00
parent 7af87f50f3
commit 2ca9878c85
3 changed files with 17 additions and 17 deletions

View file

@ -25,15 +25,15 @@
#define __GAMECARD_TAB_HPP__ #define __GAMECARD_TAB_HPP__
#include "tasks.hpp" #include "tasks.hpp"
#include "error_layer_view.hpp" #include "layered_error_frame.hpp"
#include "focusable_item.hpp" #include "focusable_item.hpp"
namespace nxdt::views namespace nxdt::views
{ {
/* Instantiate the template for our class. */ /* Instantiate the template for our class. */
typedef ErrorLayerView<nxdt::tasks::GameCardTask, nxdt::tasks::GameCardStatusEvent> GameCardErrorLayerView; typedef LayeredErrorFrame<nxdt::tasks::GameCardTask, nxdt::tasks::GameCardStatusEvent> GameCardLayeredErrorFrame;
class GameCardTab: public GameCardErrorLayerView class GameCardTab: public GameCardLayeredErrorFrame
{ {
typedef bool (*GameCardSizeFunc)(u64 *size); typedef bool (*GameCardSizeFunc)(u64 *size);

View file

@ -1,5 +1,5 @@
/* /*
* error_layer_view.hpp * layered_error_frame.hpp
* *
* Copyright (c) 2020-2021, DarkMatterCore <pabloacurielz@gmail.com>. * Copyright (c) 2020-2021, DarkMatterCore <pabloacurielz@gmail.com>.
* *
@ -21,8 +21,8 @@
#pragma once #pragma once
#ifndef __ERROR_LAYER_VIEW_HPP__ #ifndef __LAYERED_ERROR_FRAME_HPP__
#define __ERROR_LAYER_VIEW_HPP__ #define __LAYERED_ERROR_FRAME_HPP__
#include "error_frame.hpp" #include "error_frame.hpp"
@ -30,7 +30,7 @@ namespace nxdt::views
{ {
/* Extended class to switch between ErrorFrame and List views whenever an event is triggered. */ /* Extended class to switch between ErrorFrame and List views whenever an event is triggered. */
template<typename TaskType, typename EventType> template<typename TaskType, typename EventType>
class ErrorLayerView: public brls::LayerView class LayeredErrorFrame: public brls::LayerView
{ {
private: private:
TaskType *task = nullptr; TaskType *task = nullptr;
@ -50,12 +50,12 @@ namespace nxdt::views
void RegisterListener(typename EventType::Callback cb); void RegisterListener(typename EventType::Callback cb);
public: public:
ErrorLayerView(TaskType *task); LayeredErrorFrame(TaskType *task);
~ErrorLayerView(void); ~LayeredErrorFrame(void);
}; };
template<typename TaskType, typename EventType> template<typename TaskType, typename EventType>
ErrorLayerView<TaskType, EventType>::ErrorLayerView(TaskType *task) : brls::LayerView(), task(task) LayeredErrorFrame<TaskType, EventType>::LayeredErrorFrame(TaskType *task) : brls::LayerView(), task(task)
{ {
/* Error frame. */ /* Error frame. */
this->error_frame = new ErrorFrame(); this->error_frame = new ErrorFrame();
@ -69,7 +69,7 @@ namespace nxdt::views
} }
template<typename TaskType, typename EventType> template<typename TaskType, typename EventType>
ErrorLayerView<TaskType, EventType>::~ErrorLayerView(void) LayeredErrorFrame<TaskType, EventType>::~LayeredErrorFrame(void)
{ {
/* Unregister task listeners. */ /* Unregister task listeners. */
for(typename EventType::Subscription task_sub : this->task_subs) this->task->UnregisterListener(task_sub); for(typename EventType::Subscription task_sub : this->task_subs) this->task->UnregisterListener(task_sub);
@ -82,7 +82,7 @@ namespace nxdt::views
} }
template<typename TaskType, typename EventType> template<typename TaskType, typename EventType>
void ErrorLayerView<TaskType, EventType>::SwitchLayerView(bool use_error_frame) void LayeredErrorFrame<TaskType, EventType>::SwitchLayerView(bool use_error_frame)
{ {
if ((use_error_frame && this->layer_view_index == 0) || (!use_error_frame && this->layer_view_index == 1)) return; if ((use_error_frame && this->layer_view_index == 0) || (!use_error_frame && this->layer_view_index == 1)) return;
@ -106,24 +106,24 @@ namespace nxdt::views
} }
template<typename TaskType, typename EventType> template<typename TaskType, typename EventType>
void ErrorLayerView<TaskType, EventType>::SetErrorFrameMessage(std::string msg) void LayeredErrorFrame<TaskType, EventType>::SetErrorFrameMessage(std::string msg)
{ {
this->error_frame->SetMessage(msg); this->error_frame->SetMessage(msg);
} }
template<typename TaskType, typename EventType> template<typename TaskType, typename EventType>
void ErrorLayerView<TaskType, EventType>::AddListView(brls::View* view) void LayeredErrorFrame<TaskType, EventType>::AddListView(brls::View* view)
{ {
this->list->addView(view); this->list->addView(view);
this->list_views.push_back(view); this->list_views.push_back(view);
} }
template<typename TaskType, typename EventType> template<typename TaskType, typename EventType>
void ErrorLayerView<TaskType, EventType>::RegisterListener(typename EventType::Callback cb) void LayeredErrorFrame<TaskType, EventType>::RegisterListener(typename EventType::Callback cb)
{ {
typename EventType::Subscription task_sub = this->task->RegisterListener(cb); typename EventType::Subscription task_sub = this->task->RegisterListener(cb);
this->task_subs.push_back(task_sub); this->task_subs.push_back(task_sub);
} }
} }
#endif /* __ERROR_LAYER_VIEW_HPP__ */ #endif /* __LAYERED_ERROR_FRAME_HPP__ */

View file

@ -41,7 +41,7 @@ namespace nxdt::views
[GameCardCompatibilityType_Terra] = "Terra" [GameCardCompatibilityType_Terra] = "Terra"
}; };
GameCardTab::GameCardTab(nxdt::tasks::GameCardTask *gc_status_task) : GameCardErrorLayerView(gc_status_task) GameCardTab::GameCardTab(nxdt::tasks::GameCardTask *gc_status_task) : GameCardLayeredErrorFrame(gc_status_task)
{ {
/* Error frame. */ /* Error frame. */
this->SetErrorFrameMessage("gamecard_tab/error_frame/not_inserted"_i18n); this->SetErrorFrameMessage("gamecard_tab/error_frame/not_inserted"_i18n);