bool FakePlayer::init(const QStringList opt) { handleOption(opt); interval = optionValue["interval"].toInt(); frameNumber = optionValue["start"].toInt(); qDebug() << "Interval : " << interval << " -- Start : " << frameNumber; return true; }
void Menu::keyEvent(Key key, KeyMod mod, bool pressed) { if (key == KEY_ESCAPE) { menu_manager_->changeCurrentMenu(parent_menu_); return; } if (pressed) { std::vector < MenuText * >options_vec; for (std::map < Key, MenuText >::iterator it = options_.begin(); it != options_.end(); it++) options_vec.push_back(&it->second); if (options_vec.size()) { unsigned int curOpt = 0; for (unsigned int i = 0; i < options_vec.size(); i++) if (!options_vec[i]->dark_) { curOpt = i; break; } if (key == VK_UP || key == KEY_UP) { options_vec[curOpt]->dark_ = true; if (curOpt == 0) curOpt = options_vec.size() - 1; else curOpt--; options_vec[curOpt]->dark_ = false; show(false); } if (key == VK_DOWN || key == KEY_DOWN) { if (!options_vec[curOpt]->dark_) { options_vec[curOpt]->dark_ = true; curOpt++; if (curOpt >= options_vec.size()) curOpt = 0; } options_vec[curOpt]->dark_ = false; show(false); } if (key == VK_FB || key == KEY_RETURN || key == KEY_KP_ENTER) { for (std::map < Key, MenuText >::iterator it = options_.begin(); it != options_.end(); it++) if (&it->second == options_vec[curOpt]) key = it->first; } } } if (options_.find(key) == options_.end()) { handleUnknownKey(key, mod, pressed); return; } handleOption(key); if (options_[key].to_) menu_manager_->changeCurrentMenu(options_[key].to_); }
bool VLCAudioPlayer::init(QStringList opt) { handleOption(opt); const char * const vlc_args[] = { "-I", "dummy", "-A", optionValue["ao"].toString().toStdString().c_str(), /* Don't use any interface */ "--ignore-config", "--no-video"}; /* Don't use VLC's config */ libvlc_event_manager_t *em; libvlc_exception_init(&vlc_ex); inst = libvlc_new(sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args, &vlc_ex); mediaPlayer = libvlc_media_player_new(inst, &vlc_ex); em = libvlc_media_player_event_manager(mediaPlayer, &vlc_ex); return true; }
bool Options::parseCommandLine() { for (int i = 1; i < argc; i++) { if (argv[i][0] == '-') { if (!handleOption(i)) return false; } else { inFiles.push_back(argv[i]); } } return true; }
static void handleOptions(int argc, char **argv) { int i = 1; if (argc == 1 ) {printHelp(); exit(0);} while (i < argc) { if (*argv[i] != '-') { uclFileList = listCons(String)(strCopy(argv[i]), uclFileList); i++; } else { int newi; handleOption(i, &newi, argv); i = newi; } } }
CStartupOptionMokeup(int argc, char *argv[], bool unixStyle) :m_options(m_config) { m_config.add(new Poco::Util::SystemConfiguration, Poco::Util::Application::PRIO_SYSTEM, false, false); m_config.add(new Poco::Util::MapConfiguration, Poco::Util::Application::PRIO_APPLICATION, true, false); Poco::Util::OptionSet os; m_options.defineOptions(os); Poco::Util::OptionProcessor processor(os); processor.setUnixStyle(unixStyle); for (auto i = 0; i < argc; ++i) { std::string name; std::string value; if (processor.process(argv[i], name, value)) { if (!name.empty()) // "--" option to end options processing or deferred argument { handleOption(os, name, value); } } } processor.checkRequired(); }
/* * Load an option from a block of text. The text must start with the * configurable/option name and be followed by its associated value. * That value may be processed in any of several ways. See "tOptionLoadMode" * in autoopts.h. */ LOCAL void loadOptionLine( tOptions* pOpts, tOptState* pOS, char* pzLine, tDirection direction, tOptionLoadMode load_mode ) { while (isspace( (int)*pzLine )) pzLine++; { char* pzArg = assembleArgValue( pzLine, load_mode ); if (! SUCCESSFUL( longOptionFind( pOpts, pzLine, pOS ))) return; if (pOS->flags & OPTST_NO_INIT) return; pOS->pzOptArg = pzArg; } switch (pOS->flags & (OPTST_IMM|OPTST_DISABLE_IMM)) { case 0: /* * The selected option has no immediate action. * THEREFORE, if the direction is PRESETTING * THEN we skip this option. */ if (PRESETTING(direction)) return; break; case OPTST_IMM: if (PRESETTING(direction)) { /* * We are in the presetting direction with an option we handle * immediately for enablement, but normally for disablement. * Therefore, skip if disabled. */ if ((pOS->flags & OPTST_DISABLED) == 0) return; } else { /* * We are in the processing direction with an option we handle * immediately for enablement, but normally for disablement. * Therefore, skip if NOT disabled. */ if ((pOS->flags & OPTST_DISABLED) != 0) return; } break; case OPTST_DISABLE_IMM: if (PRESETTING(direction)) { /* * We are in the presetting direction with an option we handle * immediately for disablement, but normally for disablement. * Therefore, skip if NOT disabled. */ if ((pOS->flags & OPTST_DISABLED) != 0) return; } else { /* * We are in the processing direction with an option we handle * immediately for disablement, but normally for disablement. * Therefore, skip if disabled. */ if ((pOS->flags & OPTST_DISABLED) == 0) return; } break; case OPTST_IMM|OPTST_DISABLE_IMM: /* * The selected option is always for immediate action. * THEREFORE, if the direction is PROCESSING * THEN we skip this option. */ if (PROCESSING(direction)) return; break; } /* * Fix up the args. */ if (OPTST_GET_ARGTYPE(pOS->pOD->fOptState) == OPARG_TYPE_NONE) { if (*pOS->pzOptArg != NUL) return; pOS->pzOptArg = NULL; } else if (pOS->pOD->fOptState & OPTST_ARG_OPTIONAL) { if (*pOS->pzOptArg == NUL) pOS->pzOptArg = NULL; else { AGDUPSTR( pOS->pzOptArg, pOS->pzOptArg, "option argument" ); pOS->flags |= OPTST_ALLOC_ARG; } } else { if (*pOS->pzOptArg == NUL) pOS->pzOptArg = zNil; else { AGDUPSTR( pOS->pzOptArg, pOS->pzOptArg, "option argument" ); pOS->flags |= OPTST_ALLOC_ARG; } } { tOptionLoadMode sv = option_load_mode; option_load_mode = load_mode; handleOption( pOpts, pOS ); option_load_mode = sv; } }