const String WebMediaConstraintsPrivate::toString() const { StringBuilder builder; if (!isEmpty()) { builder.append('{'); builder.append(basic().toString()); if (!advanced().isEmpty()) { if (builder.length() > 1) builder.appendLiteral(", "); builder.appendLiteral("advanced: ["); bool first = true; for (const auto& constraintSet : advanced()) { if (!first) builder.appendLiteral(", "); builder.append('{'); builder.append(constraintSet.toString()); builder.append('}'); first = false; } builder.append(']'); } builder.append('}'); } return builder.toString(); }
void endRegion(IRGS& env) { auto const curSk = curSrcKey(env); if (!instrAllowsFallThru(curSk.op())) return; // nothing to do here auto const nextSk = curSk.advanced(curUnit(env)); endRegion(env, nextSk); }
// Provides the next character that has been received. // char static next_received_char() { char ch = received.byte[ received.oldest]; __disable_irq(); received.oldest = advanced( received.oldest); __enable_irq(); return ch; }
// Invoked when a character has been received. // void USART1_IRQHandler() { u8 advanced_cursor = advanced( received.cursor); // If the cursor would refer to the same slot as "oldest" once advanced then // the queue is full and the event is discarded if ( advanced_cursor != received.oldest) { // Reading DR acknowledges the interrupt received.byte[ received.cursor] = USART1->DR; received.cursor = advanced_cursor; } }
Interface::Interface(QWidget *parent, EXP_Class *_exp, Viewer *_viewer/*, Video *_video */) : QWidget(parent) { exp = _exp; viewer = _viewer; //video = _video; frameRate = 12; flag_activate_loadGeno_buttons = true; flag_activate_play_buttons = false; flag_activate_step_buttons = false; flag_activate_pause_buttons = false; flag_activate_next_buttons = false; flag_activate_quit_buttons = true; flag_activate_rec_buttons = true; flag_activate_stop_rec_buttons = false; // flag_activate_loadGeno_buttons = false; // flag_activate_reset_eval_loop_botton = true; // flag_activate_play_buttons = false; // flag_activate_step_buttons = false; // flag_activate_pause_buttons = false; // flag_activate_next_buttons = false; // flag_activate_quit_buttons = true; exp->setDelay( 50 ); createButtons(); connect(exp, SIGNAL(advanced()), viewer, SLOT(update())); mainLayout = new QVBoxLayout; viewer->setMinimumHeight(300); mainLayout->addWidget(viewer, 1); mainLayout->addLayout(buttonsLayout, 0); setLayout(mainLayout); updateButtons(); setWindowTitle(tr("Elio Tuci Sim-Artificial-World ")); resize(800, 800); //resize the main widget move( 400, 100);//position the main widget }
void OnMenuPrint(WindowInfo *win, bool waitForCompletion) { // we remember some printer settings per process static ScopedMem<DEVMODE> defaultDevMode; static PrintScaleAdv defaultScaleAdv = PrintScaleShrink; static bool defaultAsImage = false; bool printSelection = false; Vec<PRINTPAGERANGE> ranges; PRINTER_INFO_2 printerInfo = { 0 }; if (!HasPermission(Perm_PrinterAccess)) return; DisplayModel *dm = win->dm; assert(dm); if (!dm) return; if (!dm->engine || !dm->engine->AllowsPrinting()) return; if (win->IsChm()) { win->dm->AsChmEngine()->PrintCurrentPage(); return; } if (win->printThread) { int res = MessageBox(win->hwndFrame, _TR("Printing is still in progress. Abort and start over?"), _TR("Printing in progress."), MB_ICONEXCLAMATION | MB_YESNO | (IsUIRightToLeft() ? MB_RTLREADING : 0)); if (res == IDNO) return; } AbortPrinting(win); PRINTDLGEX pd; ZeroMemory(&pd, sizeof(PRINTDLGEX)); pd.lStructSize = sizeof(PRINTDLGEX); pd.hwndOwner = win->hwndFrame; pd.Flags = PD_USEDEVMODECOPIESANDCOLLATE | PD_COLLATE; if (!win->selectionOnPage) pd.Flags |= PD_NOSELECTION; pd.nCopies = 1; /* by default print all pages */ pd.nPageRanges = 1; pd.nMaxPageRanges = MAXPAGERANGES; PRINTPAGERANGE *ppr = AllocArray<PRINTPAGERANGE>(MAXPAGERANGES); pd.lpPageRanges = ppr; ppr->nFromPage = 1; ppr->nToPage = dm->PageCount(); pd.nMinPage = 1; pd.nMaxPage = dm->PageCount(); pd.nStartPage = START_PAGE_GENERAL; Print_Advanced_Data advanced(PrintRangeAll, defaultScaleAdv, defaultAsImage); ScopedMem<DLGTEMPLATE> dlgTemplate; // needed for RTL languages HPROPSHEETPAGE hPsp = CreatePrintAdvancedPropSheet(&advanced, dlgTemplate); pd.lphPropertyPages = &hPsp; pd.nPropertyPages = 1; // restore remembered settings if (defaultDevMode) pd.hDevMode = GlobalMemDup(defaultDevMode.Get(), defaultDevMode.Get()->dmSize + defaultDevMode.Get()->dmDriverExtra); if (PrintDlgEx(&pd) != S_OK) { if (CommDlgExtendedError() != 0) { /* if PrintDlg was cancelled then CommDlgExtendedError is zero, otherwise it returns the error code, which we could look at here if we wanted. for now just warn the user that printing has stopped becasue of an error */ MessageBox(win->hwndFrame, _TR("Couldn't initialize printer"), _TR("Printing problem."), MB_ICONEXCLAMATION | MB_OK | (IsUIRightToLeft() ? MB_RTLREADING : 0)); } goto Exit; } if (pd.dwResultAction == PD_RESULT_PRINT || pd.dwResultAction == PD_RESULT_APPLY) { // remember settings for this process LPDEVMODE devMode = (LPDEVMODE)GlobalLock(pd.hDevMode); if (devMode) { defaultDevMode.Set((LPDEVMODE)memdup(devMode, devMode->dmSize + devMode->dmDriverExtra)); GlobalUnlock(pd.hDevMode); } defaultScaleAdv = advanced.scale; defaultAsImage = advanced.asImage; } if (pd.dwResultAction != PD_RESULT_PRINT) goto Exit; if (pd.Flags & PD_CURRENTPAGE) { PRINTPAGERANGE pr = { dm->CurrentPageNo(), dm->CurrentPageNo() }; ranges.Append(pr); } else if (win->selectionOnPage && (pd.Flags & PD_SELECTION)) { printSelection = true; } else if (!(pd.Flags & PD_PAGENUMS)) { PRINTPAGERANGE pr = { 1, dm->PageCount() }; ranges.Append(pr); } else { assert(pd.nPageRanges > 0); for (DWORD i = 0; i < pd.nPageRanges; i++) ranges.Append(pd.lpPageRanges[i]); } LPDEVNAMES devNames = (LPDEVNAMES)GlobalLock(pd.hDevNames); LPDEVMODE devMode = (LPDEVMODE)GlobalLock(pd.hDevMode); if (devNames) { printerInfo.pDriverName = (LPWSTR)devNames + devNames->wDriverOffset; printerInfo.pPrinterName = (LPWSTR)devNames + devNames->wDeviceOffset; printerInfo.pPortName = (LPWSTR)devNames + devNames->wOutputOffset; } PrintData *data = new PrintData(dm->engine, &printerInfo, devMode, ranges, advanced, dm->Rotation(), printSelection ? win->selectionOnPage : NULL); if (devNames) GlobalUnlock(pd.hDevNames); if (devMode) GlobalUnlock(pd.hDevMode); if (!waitForCompletion) PrintToDeviceOnThread(win, data); else { PrintToDevice(*data); delete data; } Exit: free(ppr); GlobalFree(pd.hDevNames); GlobalFree(pd.hDevMode); }
Config::Config(int argc, const char **argv) { Command_line_parser parser; parser.add_command("makedb", "Build DIAMOND database from a FASTA file") .add_command("blastp", "Align amino acid query sequences against a protein reference database") .add_command("blastx", "Align DNA query sequences against a protein reference database") .add_command("view", "View DIAMOND alignment archive (DAA) formatted file") .add_command("help", "Produce help message") .add_command("version", "Display version information") .add_command("getseq", "") .add_command("benchmark", "") .add_command("random-seqs", "") .add_command("compare", ""); Options_group general ("General options"); general.add() ("threads", 'p', "number of CPU threads", threads_) ("db", 'd', "database file", database) ("out", 'o', "output file", output_file) ("outfmt", 'f', "output format (tab/sam/xml/daa)", output_format) ("verbose", 'v', "verbose console output", verbose) ("log", 0, "enable debug log", debug_log) ("quiet", 0, "disable console output", quiet); Options_group makedb("Makedb options"); makedb.add() ("in", 0, "input reference file in FASTA format", input_ref_file) #ifdef EXTRA ("dbtype", po::value<string>(&program_options::db_type), "database type (nucl/prot)") #endif ; Options_group aligner("Aligner options"); aligner.add() ("query",'q', "input query file", query_file) ("max-target-seqs",'k', "maximum number of target sequences to report alignments for", max_alignments, uint64_t(25)) ("top", 0, "report alignments within this percentage range of top alignment score (overrides --max-target-seqs)", toppercent, 100.0) ("compress", 0, "compression for output files (0=none, 1=gzip)", compression) ("evalue",'e', "maximum e-value to report alignments", max_evalue, 0.001) ("min-score", 0, "minimum bit score to report alignments (overrides e-value setting)", min_bit_score) ("id", 0, "minimum identity% to report an alignment", min_id) ("query-cover", 0, "minimum query cover% to report an alignment", query_cover) ("sensitive", 0, "enable sensitive mode (default: fast)", mode_sensitive) ("more-sensitive", 0, "enable more sensitive mode (default: fast)", mode_more_sensitive) ("block-size", 'b', "sequence block size in billions of letters (default=2.0)", chunk_size, 2.0) ("index-chunks",'c', "number of chunks for index processing", lowmem, 4u) ("tmpdir",'t', "directory for temporary files", tmpdir) ("gapopen", 0, "gap open penalty (default=11 for protein)", gap_open, -1) ("gapextend", 0, "gap extension penalty (default=1 for protein)", gap_extend, -1) #ifdef EXTRA ("reward", po::value<int>(&program_options::reward)->default_value(2), "match reward score (blastn only)") ("penalty", po::value<int>(&program_options::penalty)->default_value(-3), "mismatch penalty score (blastn only)") #endif ("matrix", 0, "score matrix for protein alignment", matrix, string("blosum62")) ("seg", 0, "enable SEG masking of queries (yes/no)", seg) ("salltitles", 0, "print full subject titles in output files", salltitles); Options_group advanced("Advanced options"); advanced.add() ("run-len", 'l', "mask runs between stop codons shorter than this length", run_len) ("freq-sd", 0, "number of standard deviations for ignoring frequent seeds", freq_sd, 0.0) ("id2", 0, "minimum number of identities for stage 1 hit", min_identities) ("window", 'w', "window size for local hit search", window) ("xdrop", 'x', "xdrop for ungapped alignment", xdrop, 20) ("gapped-xdrop", 'X', "xdrop for gapped alignment in bits", gapped_xdrop, 20) ("ungapped-score", 0, "minimum raw alignment score to continue local extension", min_ungapped_raw_score) ("hit-band", 0, "band for hit verification", hit_band) ("hit-score", 0, "minimum score to keep a tentative alignment", min_hit_score) ("band", 0, "band for dynamic programming computation", padding) ("shapes", 's', "number of seed shapes (0 = all available)", shapes) ("index-mode", 0, "index mode (0=4x12, 1=16x9)", index_mode) ("fetch-size", 0, "trace point fetch size", fetch_size, 4096u) ("rank-factor", 0, "include subjects within this range of max-target-seqs", rank_factor, 2.0) ("rank-ratio", 0, "include subjects within this ratio of last hit", rank_ratio, 0.35) ("single-domain", 0, "Discard secondary domains within one target sequence", single_domain) ("dbsize", 0, "effective database size (in letters)", db_size) ("no-auto-append", 0, "disable auto appending of DAA and DMND file extensions", no_auto_append) ("target-fetch-size", 0, "", target_fetch_size, 4u); Options_group view_options("View options"); view_options.add() ("daa", 'a', "DIAMOND alignment archive (DAA) file", daa_file) ("forwardonly", 0, "only show alignments of forward strand", forwardonly); Options_group hidden_options(""); hidden_options.add() ("extend-all", 0, "extend all seed hits", extend_all) ("local-align", 0, "Local alignment algorithm", local_align_mode, 0u) ("slow-search", 0, "", slow_search) ("seq", 0, "", seq_no) ("ht", 0, "", ht_mode) ("old-freq", 0, "", old_freq) ("qp", 0, "", query_parallel) ("match1", 0, "", match_file1) ("match2", 0, "", match_file2) ("max-hits", 'C', "maximum number of hits to consider for one seed", hit_cap) ("seed-freq", 0, "maximum seed frequency", max_seed_freq, -15.0); parser.add(general).add(makedb).add(aligner).add(advanced).add(view_options).add(hidden_options); parser.store(argc, argv, command); switch (command) { case Config::makedb: if (input_ref_file == "") throw std::runtime_error("Missing parameter: input file (--in)"); if (database == "") throw std::runtime_error("Missing parameter: database file (--db/-d)"); if (chunk_size != 2.0) throw std::runtime_error("Invalid option: --block-size/-b. Block size is set for the alignment commands."); break; case Config::blastp: case Config::blastx: if (query_file == "") throw std::runtime_error("Missing parameter: query file (--query/-q)"); if (database == "") throw std::runtime_error("Missing parameter: database file (--db/-d)"); if (daa_file.length() > 0) { if (output_file.length() > 0) throw std::runtime_error("Options --daa and --out cannot be used together."); if (output_format.length() > 0 && output_format != "daa") throw std::runtime_error("Invalid parameter: --daa/-a. Output file is specified with the --out/-o parameter."); output_file = daa_file; } if (daa_file.length() > 0 || output_format == "daa") { if (compression != 0) throw std::runtime_error("Compression is not supported for DAA format."); if (!no_auto_append) auto_append_extension(output_file, ".daa"); } break; case Config::view: if (daa_file == "") throw std::runtime_error("Missing parameter: DAA file (--daa/-a)"); default: ; } if (hit_cap != 0) throw std::runtime_error("Deprecated parameter: --max-hits/-C."); if (debug_log) verbosity = 3; else if (quiet) verbosity = 0; else if (verbose) verbosity = 2; else if (((command == Config::view || command == blastx || command == blastp) && output_file == "") || command == Config::version) verbosity = 0; else verbosity = 1; switch (verbosity) { case 0: message_stream = Message_stream(false); break; case 3: log_stream = Message_stream(); case 2: verbose_stream = Message_stream(); default: ; } if (!no_auto_append) { auto_append_extension(database, ".dmnd"); if (command == Config::view) auto_append_extension(daa_file, ".daa"); if (compression == 1) auto_append_extension(output_file, ".gz"); } message_stream << Const::program_name << " v" << Const::version_string << "." << (unsigned)Const::build_version << " | by Benjamin Buchfink <*****@*****.**>" << endl; message_stream << "Check http://github.com/bbuchfink/diamond for updates." << endl << endl; #ifndef NDEBUG verbose_stream << "Assertions enabled." << endl; #endif set_option(threads_, tthread::thread::hardware_concurrency()); switch (command) { case Config::makedb: case Config::blastp: case Config::blastx: case Config::view: message_stream << "#CPU threads: " << threads_ << endl; default: ; } if (command == Config::blastp || command == Config::blastx || command == Config::benchmark) { if (tmpdir == "") tmpdir = extract_dir(output_file); if (gap_open == -1) gap_open = 11; if (gap_extend == -1) gap_extend = 1; score_matrix = Score_matrix(to_upper_case(matrix), gap_open, gap_extend, reward, penalty); message_stream << "Scoring parameters: " << score_matrix << endl; if (seg == "" && command == blastx) seg = "yes"; verbose_stream << "SEG masking = " << (seg == "yes") << endl; have_ssse3 = check_SSSE3(); if (have_ssse3) verbose_stream << "SSSE3 enabled." << endl; verbose_stream << "Reduction: " << Reduction::reduction << endl; if (mode_more_sensitive) { set_option(index_mode, 1u); set_option(freq_sd, 200.0); } else if (mode_sensitive) { set_option(index_mode, 1u); set_option(freq_sd, 10.0); } else { set_option(index_mode, 0u); set_option(freq_sd, 50.0); } verbose_stream << "Seed frequency SD: " << freq_sd << endl; ::shapes = shape_config(index_mode, shapes); verbose_stream << "Shape configuration: " << ::shapes << endl; message_stream << "#Target sequences to report alignments for: "; if (max_alignments == 0) { max_alignments = std::numeric_limits<uint64_t>::max(); message_stream << "unlimited" << endl; } else message_stream << max_alignments << endl; } if (command == blastx) input_value_traits = nucleotide_traits; if (command == help) parser.print_help(); /*log_stream << "sizeof(hit)=" << sizeof(hit) << " sizeof(packed_uint40_t)=" << sizeof(packed_uint40_t) << " sizeof(sorted_list::entry)=" << sizeof(sorted_list::entry) << endl;*/ }
void OnMenuPrint(WindowInfo *win, bool waitForCompletion) { // we remember some printer settings per process static ScopedMem<DEVMODE> defaultDevMode; static PrintScaleAdv defaultScaleAdv = PrintScaleShrink; static bool defaultAsImage = false; static bool hasDefaults = false; if (!hasDefaults) { hasDefaults = true; defaultAsImage = gGlobalPrefs->printerDefaults.printAsImage; if (str::EqI(gGlobalPrefs->printerDefaults.printScale, "fit")) defaultScaleAdv = PrintScaleFit; else if (str::EqI(gGlobalPrefs->printerDefaults.printScale, "none")) defaultScaleAdv = PrintScaleNone; } bool printSelection = false; Vec<PRINTPAGERANGE> ranges; PRINTER_INFO_2 printerInfo = { 0 }; if (!HasPermission(Perm_PrinterAccess)) return; if (win->AsChm()) { // the Print dialog allows access to the file system, so fall back // to printing the entire document without dialog if that isn't desired bool showUI = HasPermission(Perm_DiskAccess); win->AsChm()->PrintCurrentPage(showUI); return; } if (win->AsEbook()) { // TODO: use EbookEngine for printing? return; } CrashIf(!win->AsFixed()); if (!win->AsFixed()) return; DisplayModel *dm = win->AsFixed(); #ifndef DISABLE_DOCUMENT_RESTRICTIONS if (!dm->engine()->AllowsPrinting()) return; #endif if (win->printThread) { int res = MessageBox(win->hwndFrame, _TR("Printing is still in progress. Abort and start over?"), _TR("Printing in progress."), MB_ICONEXCLAMATION | MB_YESNO | MbRtlReadingMaybe()); if (res == IDNO) return; } AbortPrinting(win); // the Print dialog allows access to the file system, so fall back // to printing the entire document without dialog if that isn't desired if (!HasPermission(Perm_DiskAccess)) { PrintFile(dm->engine()); return; } PRINTDLGEX pd; ZeroMemory(&pd, sizeof(PRINTDLGEX)); pd.lStructSize = sizeof(PRINTDLGEX); pd.hwndOwner = win->hwndFrame; pd.Flags = PD_USEDEVMODECOPIESANDCOLLATE | PD_COLLATE; if (!win->selectionOnPage) pd.Flags |= PD_NOSELECTION; pd.nCopies = 1; /* by default print all pages */ pd.nPageRanges = 1; pd.nMaxPageRanges = MAXPAGERANGES; PRINTPAGERANGE *ppr = AllocArray<PRINTPAGERANGE>(MAXPAGERANGES); pd.lpPageRanges = ppr; ppr->nFromPage = 1; ppr->nToPage = dm->PageCount(); pd.nMinPage = 1; pd.nMaxPage = dm->PageCount(); pd.nStartPage = START_PAGE_GENERAL; Print_Advanced_Data advanced(PrintRangeAll, defaultScaleAdv, defaultAsImage); ScopedMem<DLGTEMPLATE> dlgTemplate; // needed for RTL languages HPROPSHEETPAGE hPsp = CreatePrintAdvancedPropSheet(&advanced, dlgTemplate); pd.lphPropertyPages = &hPsp; pd.nPropertyPages = 1; // restore remembered settings if (defaultDevMode) { DEVMODE *p = defaultDevMode.Get(); pd.hDevMode = GlobalMemDup(p, p->dmSize + p->dmDriverExtra); } if (PrintDlgEx(&pd) != S_OK) { if (CommDlgExtendedError() != 0) { /* if PrintDlg was cancelled then CommDlgExtendedError is zero, otherwise it returns the error code, which we could look at here if we wanted. for now just warn the user that printing has stopped becasue of an error */ MessageBoxWarning(win->hwndFrame, _TR("Couldn't initialize printer"), _TR("Printing problem.")); } goto Exit; } if (pd.dwResultAction == PD_RESULT_PRINT || pd.dwResultAction == PD_RESULT_APPLY) { // remember settings for this process LPDEVMODE devMode = (LPDEVMODE)GlobalLock(pd.hDevMode); if (devMode) { defaultDevMode.Set((LPDEVMODE)memdup(devMode, devMode->dmSize + devMode->dmDriverExtra)); GlobalUnlock(pd.hDevMode); } defaultScaleAdv = advanced.scale; defaultAsImage = advanced.asImage; } if (pd.dwResultAction != PD_RESULT_PRINT) goto Exit; if (pd.Flags & PD_CURRENTPAGE) { PRINTPAGERANGE pr = { dm->CurrentPageNo(), dm->CurrentPageNo() }; ranges.Append(pr); } else if (win->selectionOnPage && (pd.Flags & PD_SELECTION)) { printSelection = true; } else if (!(pd.Flags & PD_PAGENUMS)) { PRINTPAGERANGE pr = { 1, dm->PageCount() }; ranges.Append(pr); } else { assert(pd.nPageRanges > 0); for (DWORD i = 0; i < pd.nPageRanges; i++) ranges.Append(pd.lpPageRanges[i]); } LPDEVNAMES devNames = (LPDEVNAMES)GlobalLock(pd.hDevNames); LPDEVMODE devMode = (LPDEVMODE)GlobalLock(pd.hDevMode); if (devNames) { printerInfo.pDriverName = (LPWSTR)devNames + devNames->wDriverOffset; printerInfo.pPrinterName = (LPWSTR)devNames + devNames->wDeviceOffset; printerInfo.pPortName = (LPWSTR)devNames + devNames->wOutputOffset; } PrintData *data = new PrintData(dm->engine(), &printerInfo, devMode, ranges, advanced, dm->GetRotation(), printSelection ? win->selectionOnPage : NULL); if (devNames) GlobalUnlock(pd.hDevNames); if (devMode) GlobalUnlock(pd.hDevMode); // if a file is missing and the engine can't thus be cloned, // we print using the original engine on the main thread // so that the document can't be closed and the original engine // unexpectedly deleted // TODO: instead prevent closing the document so that printing // can still happen on a separate thread and be interruptible bool failedEngineClone = dm->engine() && !data->engine; if (failedEngineClone) data->engine = dm->engine(); if (!waitForCompletion && !failedEngineClone) PrintToDeviceOnThread(win, data); else { PrintToDevice(*data); if (failedEngineClone) data->engine = NULL; delete data; } Exit: free(ppr); GlobalFree(pd.hDevNames); GlobalFree(pd.hDevMode); }
//---------------------------------------------------------------------- int idaapi h8_get_frame_retsize(func_t *) { return advanced() ? 4 : 2; }
bool Config::init(int argc, char **argv) { namespace bpo = boost::program_options; bpo::options_description generic("Basic options"); generic.add_options() ("help,h", "produce help message") ("config", bpo::value<std::string>(), "configuration file") ; bpo::options_description advanced("Advanced options"); advanced.add_options() ("bind-addr", bpo::value<std::string>(), "ip:port to bind") ("db-file", bpo::value<std::string>(), "database file") ("access-log-file", bpo::value<std::string>(), "access log file") ("detector", bpo::value<std::string>()->default_value(std::string("SURF")), "image features detector type") ("extractor", bpo::value<std::string>()->default_value(std::string("SURF")), "image features extractor type") ("matcher", bpo::value<std::string>()->default_value(std::string("FlannBased")), "image features matcher type") ("resize", bpo::value<bool>()->zero_tokens()->default_value(false), "resize image before processing") ; bpo::options_description cmdline_options; cmdline_options.add(generic).add(advanced); bpo::options_description config_file_options; config_file_options.add(advanced); try { bpo::store(bpo::parse_command_line(argc, argv, cmdline_options), vm); bpo::notify(vm); } catch (std::exception &e) { THROW_EXC("Parser failed: %s", e.what()); } if (vm.count("help")) { std::cout << cmdline_options << std::endl; return false; } if (!vm.count("config")) { std::cerr << "Config file is not specified. Run " << argv[0] << " --help for options." << std::endl; return false; } std::string filename = vm["config"].as<std::string>(); std::ifstream file(filename.c_str(), std::ios::in|std::ios::binary); if (file.fail()) { THROW_EXC("Can't open file: %s", filename.c_str()); } try { bpo::store(bpo::parse_config_file(file, config_file_options), vm); bpo::notify(vm); } catch (std::exception &e) { THROW_EXC("Parser failed: %s", e.what()); } check_if_param_specified("bind-addr"); check_if_param_specified("db-file"); check_if_param_specified("access-log-file"); return true; }
KviDefaultScriptDialog::KviDefaultScriptDialog() : QDialog() { setObjectName("restore_default_script"); setWindowTitle(__tr2qs("Restore Default - KVIrc")); setWindowModality(Qt::WindowModal); setModal(true); QGridLayout * pLayout = new QGridLayout(this); QLabel * pLabel = new QLabel(this); pLabel->setText(__tr2qs("You are about to restore the default script.\nAny script changes you have made will be erased if\nrestore \"All\" or \"Clear custom scripts\" are selected.\n\nDo you wish to proceed?\n")); pLayout->addWidget(pLabel, 0, 0, 1, 4); // Construct the advanced widget m_pAdvanced = new QGroupBox(__tr2qs("Select the Items to Restore"), this); m_pAdvanced->hide(); QGridLayout * pAdvLayout = new QGridLayout(m_pAdvanced); pAdvLayout->setContentsMargins(0, 10, 0, 0); pLayout->addWidget(m_pAdvanced, 1, 0, 1, 4); m_pAll = new QCheckBox(__tr2qs("All"), m_pAdvanced); m_pAll->setChecked(true); pAdvLayout->addWidget(m_pAll, 0, 0); connect(m_pAll, SIGNAL(clicked(bool)), this, SLOT(toggleAll(bool))); m_pData = new QCheckBox(__tr2qs("Clear custom scripts"), m_pAdvanced); m_pData->setChecked(false); m_pData->setEnabled(true); pAdvLayout->addWidget(m_pData, 0, 1); pLabel = new QLabel(m_pAdvanced); pAdvLayout->addWidget(pLabel, 1, 1, 1, 2); m_pAction = new QCheckBox(__tr2qs("Actions"), m_pAdvanced); m_pAction->setChecked(true); m_pAction->setEnabled(false); pAdvLayout->addWidget(m_pAction, 2, 0); m_pAddon = new QCheckBox(__tr2qs("Addons"), m_pAdvanced); m_pAddon->setChecked(true); m_pAddon->setEnabled(false); pAdvLayout->addWidget(m_pAddon, 2, 1); m_pAlias = new QCheckBox(__tr2qs("Aliases"), m_pAdvanced); m_pAlias->setChecked(true); m_pAlias->setEnabled(false); pAdvLayout->addWidget(m_pAlias, 3, 0); m_pClass = new QCheckBox(__tr2qs("Classes"), m_pAdvanced); m_pClass->setChecked(true); m_pClass->setEnabled(false); pAdvLayout->addWidget(m_pClass, 3, 1); m_pEvent = new QCheckBox(__tr2qs("Events"), m_pAdvanced); m_pEvent->setChecked(true); m_pEvent->setEnabled(false); pAdvLayout->addWidget(m_pEvent, 4, 0); m_pPopup = new QCheckBox(__tr2qs("Popups"), m_pAdvanced); m_pPopup->setChecked(true); m_pPopup->setEnabled(false); pAdvLayout->addWidget(m_pPopup, 4, 1); m_pRaw = new QCheckBox(__tr2qs("RAW events"), m_pAdvanced); m_pRaw->setChecked(true); m_pRaw->setEnabled(false); pAdvLayout->addWidget(m_pRaw, 5, 0); m_pToolbar = new QCheckBox(__tr2qs("Toolbars"), m_pAdvanced); m_pToolbar->setChecked(true); m_pToolbar->setEnabled(false); pAdvLayout->addWidget(m_pToolbar, 5, 1); m_pAdvanced->setLayout(pAdvLayout); QPixmap * pImage = g_pIconManager->getSmallIcon(150); m_pAdvancedButton = new QPushButton(*pImage, __tr2qs("Advanced..."), this); connect(m_pAdvancedButton, SIGNAL(clicked()), this, SLOT(advanced())); pLayout->addWidget(m_pAdvancedButton, 2, 0, 1, 1); pImage = g_pIconManager->getSmallIcon(44); QPushButton * pCancel = new QPushButton(*pImage, __tr2qs("Cancel"), this); pCancel->setDefault(true); connect(pCancel, SIGNAL(clicked()), this, SLOT(reject())); pLayout->addWidget(pCancel, 2, 2, 1, 1); pImage = g_pIconManager->getSmallIcon(43); QPushButton * pAccept = new QPushButton(*pImage, __tr2qs("Restore"), this); connect(pAccept, SIGNAL(clicked()), this, SLOT(accept())); pLayout->addWidget(pAccept, 2, 3, 1, 1); }