RendererPtr create_renderer(cube::system::window::RendererContext& context) { for (auto const& description: descriptions()) { if (description->name() == context.name()) return description->create(context); } throw Exception{"Cannot find any renderer with that name"}; }
void GettingStartedWelcomePageWidget::updateExamples(const QString &examplePath, const QString &demosPath, const QString &sourcePath) { QString demoXml = demosPath + "/qtdemo/xml/examples.xml"; if (!QFile::exists(demoXml)) { demoXml = sourcePath + "/demos/qtdemo/xml/examples.xml"; if (!QFile::exists(demoXml)) return; } QMenuHash cppSubMenuHash; QMenuHash qmlSubMenuHash; const QString dropDownLabel = tr("Choose an Example..."); QMenu *cppMenu = new QMenu(ui->cppExamplesButton); ui->cppExamplesButton->setMenu(cppMenu); QMenu *qmlMenu = new QMenu(ui->qmlExamplesButton); // let Creator's files take precedence QString localQmlExamplesXml = Core::ICore::instance()->resourcePath()+QLatin1String("/examplebrowser/qmlexamples.xml"); QFile localDescriptions(localQmlExamplesXml); if (localDescriptions.open(QFile::ReadOnly)) { parseXmlFile(&localDescriptions, cppSubMenuHash, qmlSubMenuHash, examplePath, sourcePath); } QFile descriptions(demoXml); if (!descriptions.open(QFile::ReadOnly)) return; ui->cppExamplesButton->setEnabled(true); ui->cppExamplesButton->setText(dropDownLabel); parseXmlFile(&descriptions, cppSubMenuHash, qmlSubMenuHash, examplePath, sourcePath); QList<QMenu*> cppSubMenus = cppSubMenuHash.values(); qSort(cppSubMenus.begin(), cppSubMenus.end(), menuEntryCompare); QList<QMenu*> qmlSubMenus = qmlSubMenuHash.values(); qSort(qmlSubMenus.begin(), qmlSubMenus.end(), menuEntryCompare); foreach (QMenu *menu, cppSubMenus) cppMenu->addMenu(menu); foreach (QMenu *menu, qmlSubMenus) qmlMenu->addMenu(menu); if (!qmlMenu->isEmpty()) { ui->qmlExamplesButton->setMenu(qmlMenu); ui->qmlExamplesButton->setEnabled(true); ui->qmlExamplesButton->setText(dropDownLabel); } }
std::string mitk::InputDeviceDescriptor::GetDescription() const { std::vector<berry::IConfigurationElement::Pointer> descriptions(this->m_InputDeviceExtensionPoint->GetChildren(mitk::CoreExtConstants::INPUTDEVICE_XMLATTRIBUTE_DESCRIPTION)); if(!descriptions.empty()) { return descriptions[0]->GetValue(); } return ""; }
ChangeTextDescriptor::ChangeTextDescriptor(berry::IConfigurationElement::Pointer changeTextExtensionPoint) : m_ChangeTextExtensionPoint(changeTextExtensionPoint) { this->m_Id = this->m_ChangeTextExtensionPoint->GetAttribute(ExtensionPointDefinitionConstants::CHANGETEXT_XMLATTRIBUTE_ID); this->m_Name = this->m_ChangeTextExtensionPoint->GetAttribute(ExtensionPointDefinitionConstants::CHANGETEXT_XMLATTRIBUTE_NAME); // Check if the "id" and "name" attributes are available if (this->m_Id.isNull() || this->m_Name.isNull()) { throw ctkRuntimeException("Invalid changetext configuration element (missing id or name) from: " + m_ChangeTextExtensionPoint->GetContributor()->GetName()); } // Get the optional "description" child element QList<berry::IConfigurationElement::Pointer> descriptions( this->m_ChangeTextExtensionPoint->GetChildren(ExtensionPointDefinitionConstants::CHANGETEXT_CHILD_DESCRIPTION)); if(!descriptions.isEmpty()) { this->m_Description = descriptions[0]->GetValue(); } }
/** * For help regarding arguments of the command line follow "display help" in the 'h'-case, * or run programm with -h or --help via command line. * @param argc #arguments in argv * @param argv arguments given via command line * @return */ int main(int argc, char** argv) { print_disclaimer(); try { int dimx, dimy; std::vector<int> tilecount; std::string method; std::string input_path; std::vector<std::string> input_file; std::string output; std::string unwrapper; std::vector<std::string> usettings; std::string merger; std::vector<std::string> msettings; /* For multiple imports via 1 command line call see http://www.boost.org/doc/libs/1_57_0/doc/html/program_options/tutorial.html "option details" positional options... and change input to input-path<std::string> & input-file vector<std::string> and embrace cla->execute (at the end of this main) with a * for(input-file iterator if_it) cla->execute(bla, bla, input-path + (*if_it), bla, bla); */ boost::program_options::options_description descriptions("Allowed options: \nMultiple options eg. msettings via multiple calls: \n\"-n [setting 1] -n [setting 2]\" (without \" and \"[]\")"); descriptions.add_options() ("help,h", "See this message") ("method,p", boost::program_options::value<std::string>(&method)->default_value("merge"), "\"merge\", \"merge-t\" (time-measurement), \"psnr\" (quality-measure)") ("path,i", boost::program_options::value<std::string>(&input_path), "Input directory (eg. C:\\Directory)") ("file,f", boost::program_options::value<std::vector<std::string> > (&input_file), "Input file(s) (eg. a.raw b.raw)[possible w/o -f ]") ("output,o", boost::program_options::value<std::string>(&output), "Output path (eg. C:\\Output\\)") ("width,x", boost::program_options::value<int>(&dimx)->default_value(2560), "Width (pixel) of the image") ("height,y", boost::program_options::value<int>(&dimy)->default_value(1920), "Height (pixel) of the image") ("tilecount,t", boost::program_options::value<std::vector<int> >(&tilecount), "Number of blocks the image is tesselated (-t 40)") ("unwrapper,u", boost::program_options::value<std::string>(&unwrapper), "Unwrapper name: \"strand\" o. \"mlsqu\"") ("usettings,v", boost::program_options::value<std::vector<std::string> > (&usettings), "Setting(s) for unwrapper (multi-option | \"help\")") ("merger,m", boost::program_options::value<std::string>(&merger), "Merger name: \"simple\", \"strand\", \"srncp\", \"simann\"") ("msettings,n", boost::program_options::value<std::vector<std::string> > (&msettings), "Setting(s) for the merger (multi-option | \"help\")"); boost::program_options::positional_options_description pos_optional; pos_optional.add("file", -1); boost::program_options::variables_map vm; boost::program_options::store(boost::program_options::command_line_parser(argc, argv).options(descriptions).positional(pos_optional).run(), vm); boost::program_options::notify(vm); DEBUG_PRINTLN(""); if (vm.count("help") == 1) { DEBUG_PRINTLN(descriptions); return 1; } if (vm.count("method") == 1) { DEBUG_PRINTLN("-p: " << method); } else { DEBUG_PRINTLN("-p not given. Nothing to do. Aborting program..."); return 0; } if (vm.count("path") == 0) { DEBUG_PRINTLN("-i not given. No input-path. Using .\\ to process. (May not be implemented yet.."); // return 0; } if (vm.count("file") == 0) { DEBUG_PRINTLN("-f not given. No file to process. Aborting programm"); // return 0; } else { DEBUG_PRINTLN("-f given with " << input_file.size() << " argument(s)."); } if (vm.count("tilecount") == 1) { if (tilecount.size() == 2) { DEBUG_PRINTLN("-t: " << tilecount.at(0) << " " << tilecount.at(1)); } else if(tilecount.size() == 1) { DEBUG_PRINTLN("-t: " << tilecount.at(0)); } else { DEBUG_PRINTLN("-t option called with too many arguments: "<<tilecount.size() << ". 1 or 2 supported"); } } if (vm.count("width") == 1) { DEBUG_PRINTLN("-x: " << dimx); } if (vm.count("height") == 1) { DEBUG_PRINTLN("-y: " << dimy); } //output, width, height not neccessary if (vm.count("unwrapper") == 1) { DEBUG_PRINTLN("-u: " << unwrapper); if (vm.count("usettings") == 1) { DEBUG_PRINTLN("-v given with " << usettings.size() << " argument(s)"); } } if (vm.count("merger") == 1) { DEBUG_PRINTLN("-m: " << merger); if (vm.count("msettings") == 1) { DEBUG_PRINTLN("-n given with " << msettings.size() << " argument(s)"); } } DEBUG_PRINTLN(""); /* This is where the whole programm will start */ command_line * cla = new command_line(); cla->execute(method, unwrapper, usettings, merger, msettings, input_path, input_file, output, dimx, dimy, tilecount); delete cla; /* End */ } catch (std::exception& e) { DEBUG_PRINTLN("Error: " << e.what()); } catch (...) { DEBUG_PRINTLN("Exception of unknown type"); } return 0; }
string getDBStructure() { return "----------------------------------------------------------------------\n\ --\n\ -- MOPSLinux package system\n\ -- Database creation script\n\ -- $Id: dbstruct.cpp,v 1.3 2007/11/02 20:19:45 i27249 Exp $\n\ --\n\ ----------------------------------------------------------------------\n\ \n\ create table packages (\n\ package_id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE,\n\ package_name TEXT NOT NULL,\n\ package_version TEXT NOT NULL,\n\ package_arch TEXT NOT NULL,\n\ package_build TEXT NULL,\n\ package_compressed_size TEXT NOT NULL,\n\ package_installed_size TEXT NOT NULL,\n\ package_short_description TEXT NULL,\n\ package_description TEXT NULL, \n\ package_changelog TEXT NULL,\n\ package_packager TEXT NULL,\n\ package_packager_email TEXT NULL,\n\ package_installed INTEGER NOT NULL,\n\ package_configexist INTEGER NOT NULL,\n\ package_action INTEGER NOT NULL,\n\ package_md5 TEXT NOT NULL,\n\ package_filename TEXT NOT NULL,\n\ package_betarelease TEXT NOT NULL,\n\ package_installed_by_dependency INTEGER NOT NULL DEFAULT '0',\n\ package_type INTEGER NOT NULL DEFAULT '0'\n\ );\n\ create index ppname on packages (package_id, package_name, package_version, package_action, package_installed, package_md5);\n\ \n\ create table files (\n\ file_id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE,\n\ file_name TEXT NOT NULL,\n\ file_type INTEGER NOT NULL,\n\ packages_package_id INTEGER NOT NULL\n\ );\n\ create index pname on files (file_name, packages_package_id);\n\ \n\ create table conflicts (\n\ conflict_id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE,\n\ conflict_file_name TEXT NOT NULL,\n\ backup_file TEXT NOT NULL,\n\ conflicted_package_id INTEGER NOT NULL\n\ );\n\ \n\ create table locations (\n\ location_id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE,\n\ packages_package_id INTEGER NOT NULL,\n\ server_url TEXT NOT NULL,\n\ location_path TEXT NOT NULL\n\ );\n\ create index locpid on locations(packages_package_id, location_path, server_url);\n\ create table tags (\n\ tags_id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE,\n\ tags_name TEXT NOT NULL\n\ );\n\ create index ptag on tags (tags_id, tags_name);\n\ \n\ create table tags_links (\n\ tags_link_id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE,\n\ packages_package_id INTEGER NOT NULL,\n\ tags_tag_id INTEGER NOT NULL\n\ );\n\ create index ptaglink on tags_links (packages_package_id, tags_tag_id);\n\ \n\ create table dependencies (\n\ dependency_id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE,\n\ packages_package_id INTEGER NOT NULL,\n\ dependency_condition INTEGER NOT NULL DEFAULT '1',\n\ dependency_type INTEGER NOT NULL DEFAULT '1',\n\ dependency_package_name TEXT NOT NULL,\n\ dependency_package_version TEXT NULL,\n\ dependency_build_only INTEGER NOT NULL DEFAULT '0' \ );\n\ \n\ create index pdeps on dependencies (packages_package_id, dependency_id, dependency_package_name, dependency_package_version, dependency_condition);\n\ \n\ -- INTERNATIONAL SUPPORT\n\ \n\ --create table descriptions (\n\ -- description_id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE,\n\ -- packages_package_id INTEGER NOT NULL,\n\ -- description_language TEXT NOT NULL,\n\ -- description_text TEXT NOT NULL,\n\ -- short_description_text TEXT NOT NULL\n\ --);\n\ \n\ --create table changelogs (\n\ -- changelog_id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE,\n\ -- packages_package_id INTEGER NOT NULL,\n\ -- changelog_language TEXT NOT NULL,\n\ -- changelog_text TEXT NOT NULL\n\ --);\n\ \n\ -- RATING SYSTEM - SUPPORT FOR FUTURE\n\ --create table ratings (\n\ -- rating_id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE,\n\ -- rating_value INTEGER NOT NULL,\n\ -- packages_package_name TEXT NOT NULL\n\ --);\n\ "; }
int main(int argc, char* argv[]) { unsigned int frequency = 0, adapter = 0; boost::filesystem::path directory; bool dvbv5 = false; { boost::program_options::options_description descriptions("Allowed options"); descriptions.add_options() ("help", "produce this help message") ("directory", boost::program_options::value<std::string>(), "Directory to download DSMCC to") ("frequency", boost::program_options::value<unsigned int>(), "Frequency of channel") ("adapter", boost::program_options::value<unsigned int>(), "Adapter number") ("dvbv5", boost::program_options::value<bool>(), "If should use DVBv5 for frontend (default: use dvbv3)") ; boost::program_options::variables_map vm; boost::program_options::store(boost::program_options::parse_command_line(argc, argv, descriptions), vm); boost::program_options::notify(vm); if(vm.count("help") > 0) { std::cout << descriptions << std::endl; return 1; } if(!vm.count("frequency")) { std::cout << "You must specify the frequency (e.g. 599142857)" << std::endl; return 1; } if(!vm.count("directory")) { std::cout << "You must specify a directory to download the DSMCC to" << std::endl; return 1; } directory = vm["directory"].as<std::string>(); if(!boost::filesystem::exists(directory)) { std::cout << "Path " << directory << " doesn't exist" << std::endl; return 1; } frequency = vm["frequency"].as<unsigned int>(); if(vm.count("adapter")) { adapter = vm["adapter"].as<unsigned int>(); } if(vm.count("dvbv5") && vm["dvbv5"].as<bool>()) dvbv5 = true; } std::cout << "Opening /dev/dvb/adapter" << adapter << "/frontend0" << std::endl; std::string adapter_devname; { std::stringstream s; s << "/dev/dvb/adapter" << adapter; adapter_devname = s.str(); } int frontend_fd = 0; { const std::string frontend_devname = adapter_devname + "/frontend0"; frontend_fd = open(frontend_devname.c_str(), O_RDWR); if(frontend_fd < 0) { std::cout << "Couldn't open frontend device " << frontend_devname << " for reading and writing" << std::endl; return -1; } } try { dfd::frontend frontend (frontend_fd); if(dvbv5) frontend.tune_dvb5(frequency); else frontend.tune_dvb3(frequency); dfd::programs programs; dfd::carousels carousels; dfd::filters filters(adapter_devname + "/demux0"); { dfd::filters::table_filter pat(0); filters.add_table_filter(pat, boost::bind(&dfd::parsers::pat, _1, _2, _3, boost::ref(filters) , boost::ref(programs), boost::ref(carousels)) , DMX_IMMEDIATE_START|DMX_ONESHOT|DMX_CHECK_CRC); } filters.run(); std::cout << "Finished. Carousels: " << carousels.carousels_.size() << std::endl; unsigned int files = 0, directories = 0; for(std::map<unsigned int, dfd::carousel>::const_iterator first = carousels.carousels_.begin() , last = carousels.carousels_.end() ; first != last;++first) { files += first->second.file_objects.size(); directories += first->second.directory_objects.size(); } std::cout << "Files: " << files << " directories: " << directories << std::endl; directories = 0; for(std::map<unsigned int, dfd::carousel>::const_iterator first = carousels.carousels_.begin() , last = carousels.carousels_.end() ;first != last;++first) { std::stringstream s; s << "directory" << directories; boost::filesystem::path child_directory = directory / s.str(); boost::filesystem::create_directory(child_directory); dfd::directory_object const& gateway = first->second.gateway; save_directory(child_directory, gateway, carousels); } } catch(std::exception const& e) { std::cout << "Exception caught " << e.what() << std::endl; } }
void ConfigUserMenuSet() { if (session()->usernum != nSecondUserRecLoaded) { if (!LoadMenuSetup(session()->usernum)) { LoadMenuSetup(1); } } nSecondUserRecLoaded = session()->usernum; bout.cls(); bout.litebar("Configure Menus"); printfile(MENUWEL_NOEXT); bool bDone = false; while (!bDone && !hangup) { bout.nl(); bout << "|#11|#9) Menuset :|#2 " << pSecondUserRec->szMenuSet << wwiv::endl; bout << "|#12|#9) Use hot keys :|#2 " << (pSecondUserRec->cHotKeys == HOTKEYS_ON ? "Yes" : "No ") << wwiv::endl; bout.nl(); bout << "|#9(|#2Q|#9=|#1Quit|#9) : "; char chKey = onek("Q12?"); switch (chKey) { case 'Q': bDone = true; break; case '1': { ListMenuDirs(); bout.nl(2); bout << "|#9Enter the menu set to use : "; string menuSetName; inputl(&menuSetName, 8); if (ValidateMenuSet(menuSetName.c_str())) { wwiv::menus::MenuDescriptions descriptions(GetMenuDirectory()); bout.nl(); bout << "|#9Menu Set : |#2" << menuSetName.c_str() << " : |#1" << descriptions.description(menuSetName) << wwiv::endl; bout << "|#5Use this menu set? "; if (noyes()) { strcpy(pSecondUserRec->szMenuSet, menuSetName.c_str()); break; } } bout.nl(); bout << "|#6That menu set does not exists, resetting to the default menu set" << wwiv::endl; pausescr(); if (pSecondUserRec->szMenuSet[0] == '\0') { strcpy(pSecondUserRec->szMenuSet, "wwiv"); } } break; case '2': pSecondUserRec->cHotKeys = !pSecondUserRec->cHotKeys; break; case '3': pSecondUserRec->cMenuType = !pSecondUserRec->cMenuType; break; case '?': printfile(MENUWEL_NOEXT); continue; // bypass the below cls() } bout.cls(); } // If menu is invalid, it picks the first one it finds if (!ValidateMenuSet(pSecondUserRec->szMenuSet)) { if (session()->num_languages > 1 && session()->user()->GetLanguage() != 0) { bout << "|#6No menus for " << languages[session()->user()->GetLanguage()].name << " language."; input_language(); } } WriteMenuSetup(session()->usernum); MenuSysopLog(StringPrintf("Menu in use : %s - %s - %s", pSecondUserRec->szMenuSet, pSecondUserRec->cHotKeys == HOTKEYS_ON ? "Hot" : "Off", pSecondUserRec->cMenuType == MENUTYPE_REGULAR ? "REG" : "PD")); bout.nl(2); }