void ts::scene::Loading_sequence::async_load(const action::Stage* stage) { loaded_scene_ = Scene(); exception_ptr_ = nullptr; stage_ = stage; set_finished(false); set_loading(true); scene_loader_.set_completion_handler([this]() { load_scripts_if_ready(); }); scene_loader_.set_state_change_handler([this](Scene_loader_state new_state) { state_change(to_string(new_state)); }); audio_loader_.set_completion_handler([this]() { load_scripts_if_ready(); }); scene_loader_.async_load(stage, resource_store_->video_settings()); audio_loader_.async_load(stage, resource_store_->audio_settings()); }
ts::scene::Scene ts::scene::Loading_sequence::transfer_result() { set_loading(false); if (exception_ptr_) { std::rethrow_exception(exception_ptr_); } return std::move(loaded_scene_); }
RSFilechooser::RSFilechooser(View * view_) : view(view_), filetype(MODEL) { builder = view->getBuilder(); builder->get_widget("filechooser", chooser); if (!chooser) { cerr << "no 'filechooser' in GUI!" << endl; return; } chooser->signal_update_preview().connect_notify ( sigc::bind(sigc::mem_fun (*this, &RSFilechooser::on_filechooser_preview), chooser) ); // paths Model * model = view->get_model(); if (model) { ModelPath = model->settings.STLPath; GCodePath = model->settings.GCodePath; SettingsPath = model->settings.SettingsPath; } else cerr << "no settings default paths" << endl; // file patterns allfiles.set_name(_("All Files")); allfiles.add_pattern("*"); modelfiles.set_name(_("Models")); modelfiles.add_pattern("*.stl"); modelfiles.add_pattern("*.STL"); modelfiles.add_pattern("*.svg"); modelfiles.add_pattern("*.SVG"); modelfiles.add_pattern("*.wrl"); modelfiles.add_pattern("*.WRL"); gcodefiles.set_name(_("GCode")); gcodefiles.add_pattern("*.g"); gcodefiles.add_pattern("*.G"); gcodefiles.add_pattern("*.gcode"); gcodefiles.add_pattern("*.GCODE"); settingsfiles.set_name(_("Settings")); settingsfiles.add_pattern("*.conf"); chooser->add_filter(allfiles); chooser->add_filter(modelfiles); chooser->add_filter(gcodefiles); chooser->add_filter(settingsfiles); view->connect_button ("load_save_button", sigc::mem_fun(*this, &RSFilechooser::do_action)); chooser->signal_file_activated().connect (sigc::mem_fun(*this, &RSFilechooser::do_action)); set_loading(MODEL); }
void ts::scene::Loading_sequence::async_load(const cup::Stage_data& stage_data, action::Stage_interface* stage_interface) { set_loading(true); set_finished(false); auto stage_loader_callback = [this](const action::Stage* stage) { async_load(stage); stage_loader_ = nullptr; }; stage_loader_ = stage_interface->async_load_stage(stage_data, stage_loader_callback); }
TITANIUM_PROPERTY_SETTER(WebView, loading) { TITANIUM_ASSERT(argument.IsBoolean()); set_loading(static_cast<bool>(argument)); return true; }
static int builtin_firmware(struct udev_device *dev, int argc, char *argv[], bool test) { struct udev *udev = udev_device_get_udev(dev); static const char *searchpath[] = { FIRMWARE_PATH }; char loadpath[UTIL_PATH_SIZE]; char datapath[UTIL_PATH_SIZE]; char fwpath[UTIL_PATH_SIZE]; const char *firmware; FILE *fwfile = NULL; struct utsname kernel; struct stat statbuf; unsigned int i; int rc = EXIT_SUCCESS; firmware = udev_device_get_property_value(dev, "FIRMWARE"); if (firmware == NULL) { log_error("firmware parameter missing"); rc = EXIT_FAILURE; goto exit; } /* lookup firmware file */ uname(&kernel); for (i = 0; i < ELEMENTSOF(searchpath); i++) { strscpyl(fwpath, sizeof(fwpath), searchpath[i], kernel.release, "/", firmware, NULL); fwfile = fopen(fwpath, "re"); if (fwfile != NULL) break; strscpyl(fwpath, sizeof(fwpath), searchpath[i], firmware, NULL); fwfile = fopen(fwpath, "re"); if (fwfile != NULL) break; } strscpyl(loadpath, sizeof(loadpath), udev_device_get_syspath(dev), "/loading", NULL); if (fwfile == NULL) { log_debug("did not find firmware file '%s'", firmware); rc = EXIT_FAILURE; /* * Do not cancel the request in the initrd, the real root might have * the firmware file and the 'coldplug' run in the real root will find * this pending request and fulfill or cancel it. * */ if (!in_initrd()) set_loading(udev, loadpath, "-1"); goto exit; } if (stat(fwpath, &statbuf) < 0 || statbuf.st_size == 0) { if (!in_initrd()) set_loading(udev, loadpath, "-1"); rc = EXIT_FAILURE; goto exit; } if (!set_loading(udev, loadpath, "1")) goto exit; strscpyl(datapath, sizeof(datapath), udev_device_get_syspath(dev), "/data", NULL); if (!copy_firmware(udev, fwpath, datapath, statbuf.st_size)) { log_error("error sending firmware '%s' to device", firmware); set_loading(udev, loadpath, "-1"); rc = EXIT_FAILURE; goto exit; }; set_loading(udev, loadpath, "0"); exit: if (fwfile) fclose(fwfile); return rc; }
static int builtin_firmware(struct udev_device *dev, int argc, char *argv[], bool test) { struct udev *udev = udev_device_get_udev(dev); static const char *searchpath[] = { FIRMWARE_PATH }; char fwencpath[UTIL_PATH_SIZE]; char misspath[UTIL_PATH_SIZE]; char loadpath[UTIL_PATH_SIZE]; char datapath[UTIL_PATH_SIZE]; char fwpath[UTIL_PATH_SIZE]; const char *firmware; FILE *fwfile = NULL; struct utsname kernel; struct stat statbuf; unsigned int i; int rc = EXIT_SUCCESS; firmware = udev_device_get_property_value(dev, "FIRMWARE"); if (firmware == NULL) { log_error("firmware parameter missing\n\n"); rc = EXIT_FAILURE; goto exit; } /* lookup firmware file */ uname(&kernel); for (i = 0; i < ELEMENTSOF(searchpath); i++) { util_strscpyl(fwpath, sizeof(fwpath), searchpath[i], kernel.release, "/", firmware, NULL); fwfile = fopen(fwpath, "re"); if (fwfile != NULL) break; util_strscpyl(fwpath, sizeof(fwpath), searchpath[i], firmware, NULL); fwfile = fopen(fwpath, "re"); if (fwfile != NULL) break; } util_path_encode(firmware, fwencpath, sizeof(fwencpath)); util_strscpyl(misspath, sizeof(misspath), "/run/udev/firmware-missing/", fwencpath, NULL); util_strscpyl(loadpath, sizeof(loadpath), udev_device_get_syspath(dev), "/loading", NULL); if (fwfile == NULL) { int err; /* This link indicates the missing firmware file and the associated device */ log_debug("did not find firmware file '%s'\n", firmware); do { err = mkdir_parents(misspath, 0755); if (err != 0 && err != -ENOENT) break; err = symlink(udev_device_get_devpath(dev), misspath); if (err != 0) err = -errno; } while (err == -ENOENT); rc = EXIT_FAILURE; /* * Do not cancel the request in the initrd, the real root might have * the firmware file and the 'coldplug' run in the real root will find * this pending request and fulfill or cancel it. * */ if (!in_initrd()) set_loading(udev, loadpath, "-1"); goto exit; } if (stat(fwpath, &statbuf) < 0 || statbuf.st_size == 0) { if (!in_initrd()) set_loading(udev, loadpath, "-1"); rc = EXIT_FAILURE; goto exit; } if (unlink(misspath) == 0) util_delete_path(udev, misspath); if (!set_loading(udev, loadpath, "1")) goto exit; util_strscpyl(datapath, sizeof(datapath), udev_device_get_syspath(dev), "/data", NULL); if (!copy_firmware(udev, fwpath, datapath, statbuf.st_size)) { log_error("error sending firmware '%s' to device\n", firmware); set_loading(udev, loadpath, "-1"); rc = EXIT_FAILURE; goto exit; }; set_loading(udev, loadpath, "0"); exit: if (fwfile) fclose(fwfile); return rc; }