[FL-1470] Support archive for IRDA (#582)
Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -6,16 +6,29 @@
|
||||
#include <stdio.h>
|
||||
#include <callback-connector.h>
|
||||
|
||||
void IrdaApp::run(void) {
|
||||
int32_t IrdaApp::run(void* args) {
|
||||
IrdaAppEvent event;
|
||||
bool consumed;
|
||||
bool exit = false;
|
||||
|
||||
if(args) {
|
||||
const char* remote_name = static_cast<const char*>(args);
|
||||
bool result = remote_manager.load(std::string(remote_name), true);
|
||||
if(result) {
|
||||
current_scene = IrdaApp::Scene::Remote;
|
||||
} else {
|
||||
printf("Failed to load remote \'%s\'\r\n", remote_name);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
scenes[current_scene]->on_enter(this);
|
||||
|
||||
while(!exit) {
|
||||
view_manager.receive_event(&event);
|
||||
|
||||
if(event.type == IrdaAppEvent::Type::Exit) break;
|
||||
|
||||
consumed = scenes[current_scene]->on_event(this, &event);
|
||||
|
||||
if(!consumed) {
|
||||
@@ -26,6 +39,8 @@ void IrdaApp::run(void) {
|
||||
};
|
||||
|
||||
scenes[current_scene]->on_exit(this);
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
IrdaAppViewManager* IrdaApp::get_view_manager() {
|
||||
@@ -59,6 +74,9 @@ void IrdaApp::search_and_switch_to_previous_scene(const std::initializer_list<Sc
|
||||
|
||||
while(!scene_found) {
|
||||
previous_scene = get_previous_scene();
|
||||
|
||||
if(previous_scene == Scene::Exit) break;
|
||||
|
||||
for(Scene element : scenes_list) {
|
||||
if(previous_scene == element) {
|
||||
scene_found = true;
|
||||
@@ -67,9 +85,15 @@ void IrdaApp::search_and_switch_to_previous_scene(const std::initializer_list<Sc
|
||||
}
|
||||
}
|
||||
|
||||
scenes[current_scene]->on_exit(this);
|
||||
current_scene = previous_scene;
|
||||
scenes[current_scene]->on_enter(this);
|
||||
if(previous_scene == Scene::Exit) {
|
||||
IrdaAppEvent event;
|
||||
event.type = IrdaAppEvent::Type::Exit;
|
||||
view_manager.send_event(&event);
|
||||
} else {
|
||||
scenes[current_scene]->on_exit(this);
|
||||
current_scene = previous_scene;
|
||||
scenes[current_scene]->on_enter(this);
|
||||
}
|
||||
}
|
||||
|
||||
bool IrdaApp::switch_to_previous_scene(uint8_t count) {
|
||||
|
Reference in New Issue
Block a user