irda-app-scene-remote-list.cpp 869 B

123456789101112131415161718192021222324252627282930
  1. #include "../irda-app.hpp"
  2. #include "irda/irda-app-event.hpp"
  3. void IrdaAppSceneRemoteList::on_enter(IrdaApp* app) {
  4. IrdaAppFileParser file_parser;
  5. bool success = false;
  6. auto remote_manager = app->get_remote_manager();
  7. auto last_selected_remote = remote_manager->get_remote_name();
  8. auto selected_file = file_parser.file_select(
  9. last_selected_remote.size() ? last_selected_remote.c_str() : nullptr);
  10. if(!selected_file.empty()) {
  11. if(remote_manager->load(selected_file)) {
  12. app->switch_to_next_scene(IrdaApp::Scene::Remote);
  13. success = true;
  14. }
  15. }
  16. if(!success) {
  17. app->switch_to_previous_scene();
  18. }
  19. }
  20. bool IrdaAppSceneRemoteList::on_event(IrdaApp* app, IrdaAppEvent* event) {
  21. bool consumed = false;
  22. return consumed;
  23. }
  24. void IrdaAppSceneRemoteList::on_exit(IrdaApp* app) {
  25. }