void KMyMoneyBriefSchedule::slotNextClicked() { if (m_index < (m_scheduleList.count() - 1)) { m_index++; loadSchedule(); } }
void KMyMoneyBriefSchedule::slotPrevClicked() { if (m_index >= 1) { --m_index; loadSchedule(); } }
void BWSPrefPageWidget::btnLoad_clicked() { QString lf = KFileDialog::getOpenFileName("/home", "*",this,i18n("Choose a file")); if(lf.isEmpty()) return; btnReset_clicked(); loadSchedule(lf); }
void KMyMoneyBriefSchedule::setSchedules(QList<MyMoneySchedule> list, const QDate& date) { m_scheduleList = list; m_date = date; m_index = 0; if (list.count() >= 1) { loadSchedule(); } }
Controller::Controller() throw(int) { cout<<"Creation du cerveau de Zebulon..."<<endl; loadSchedule(); window = new ZebulonWindow(&schedule); connectMainWindow(); connectWindowAdministrator(); connectWindowEditTimeSlot(); window->reloadAll(); window->show(); }
bool RtdDenverEngine::sourceRequestEvent(const QString& sourceName) { if (m_pendingRoutes.contains(sourceName)) return true; if (m_routes.isEmpty() && !loadRouteList()) { // we need our route mapping before we can do anything else: // request a load of the route list and queue up this source if (m_pendingRoutes.isEmpty()) { KJob *fetchJob = fetchRouteList(); if (fetchJob) { m_jobData.insert(fetchJob, JobData()); } } m_pendingRoutes.insert(sourceName); setData(sourceName, Plasma::DataEngine::Data()); return true; } if (!schedulesValid()) { // we haven't loaded anything in the last day: do a network load to recheck // our schedule validity checkValidity(sourceName); setData(sourceName, Plasma::DataEngine::Data()); return true; } // now handle the actual sources if (sourceName == QLatin1String("ValidAsOf")) { // "ValidAsOf": returns the date as of which our bus schedules are valid setData(sourceName, m_validAsOf); return true; } else if (sourceName == QLatin1String("Routes")) { // "Routes": returns the list of route names setData(sourceName, routeList()); return true; } else if (sourceName.startsWith("DirectionOf ")) { // "DirectionOf routeName": returns the direction code for the // direction(s) of the route @p routeName, i.e. "N", "S", "E", "W", "Loop", "CW", // or "CCW"; a two-direction route joins its directions with a hyphen, e.g. // "N-S", "E-W", or "CW-CCW" QString routeName = sourceName.mid(12); if (!m_routes.contains(routeName)) return false; QString directions = m_routes[routeName].directions; // we already know which way this route runs if (!directions.isEmpty()) { setData(sourceName, directions); return true; } // load a schedule for this route with an unspecified direction: that will // tell us the directions for this route return setupScheduleFetch(sourceName, routeName + "-?", Weekday); } else if (sourceName.startsWith("ScheduleOf ")) { // "ScheduleOf routeName-directionCode": returns a map of <stop name, timetable> // for all the stops of the route @p routeName going in the direction @p // directionCode. The timetable is a sorted list of QPair<QTime, QString> // where the time is the arrival time of the bus or train, and the QString // is the subroute of that bus or train (e.g. B, BF, or BX). Note that the list // is sorted by arrival time, so stops storted with A.M. times after stops with // P.M. times are actually arriving on the next day. bool textForm = sourceName.endsWith(QLatin1String(" TEXT")); QString fullRouteName = sourceName.mid(11, sourceName.length() - (textForm ? 11+5 : 11)); // try to load the schedule from cache Plasma::DataEngine::Data stops = loadSchedule(fullRouteName, dayType(Today)); // no cached data: go to the network if (stops.isEmpty()) return setupScheduleFetch(sourceName, fullRouteName, dayType(Today)); // convert to a textual representation if requested if (textForm) { for (Plasma::DataEngine::Data::iterator it = stops.begin(); it != stops.end(); it++) { QStringList stringified; QList<TimeRoutePair> trp = it.value().value< QList<TimeRoutePair> >(); foreach (const TimeRoutePair& tp, trp) stringified << tp.second + QLatin1String(" - ") + tp.first.toString("H:mm' 'AP"); *it = QVariant(stringified); } } setData(sourceName, stops); return true; }
void BWSPrefPageWidget::loadDefault() { //read schedule from HD QString fn = KGlobal::dirs()->saveLocation("data","ktorrent") + "bwschedule"; loadSchedule(fn, false); }
int main(int argc, char *argv[]) { init_sli(); __set_profiling(root); if (argc < 5) errx(1, "not enough arguments"); argv++; argc--; const char *binary = argv[0]; const char *typesdb = argv[1]; const char *callgraph = argv[2]; const char *staticdb = argv[3]; argv += 4; argc -= 4; bool assert_mode = false; bool double_free_mode = false; bool indirect_call_mode = false; if (!strcmp(argv[argc - 1], "assertions")) { assert_mode = true; argc--; } else if (!strcmp(argv[argc - 1], "doublefree")) { double_free_mode = true; argc--; } else if (!strcmp(argv[argc - 1], "icall")) { indirect_call_mode = true; argc--; } if (argc > 2) errx(1, "Too many arguments"); VexPtr<Oracle> oracle; { MachineState *ms = MachineState::readELFExec(binary); Thread *thr = ms->findThread(ThreadId(1)); oracle = new Oracle(ms, thr, typesdb); } oracle->loadCallGraph(oracle, callgraph, staticdb, ALLOW_GC); DumpFix df(oracle); LibVEX_gc(ALLOW_GC); int start_percentage; int end_percentage; start_percentage = 0; end_percentage = 100; AllowableOptimisations opt = AllowableOptimisations::defaultOptimisations .enableassumePrivateStack() .setAddressSpace(oracle->ms->addressSpace); if (assert_mode || double_free_mode) opt = opt.enableallPointersGood(); if (double_free_mode) opt = opt.enablefreeMightRace(); if (argc == 1 || argc == 2) { DynAnalysisRip vr; const char *succ; if (parseDynAnalysisRip(&vr, argv[0], &succ)) { int only_store_cfg = -1; int expected_nr_store_cfgs = -1; argc--; argv++; if (argc == 1) { if (sscanf(argv[0], "%d/%d", &only_store_cfg, &expected_nr_store_cfgs) != 2 || only_store_cfg < 0 || expected_nr_store_cfgs <= 0 || only_store_cfg >= expected_nr_store_cfgs) { errx(1, "expected final argument to be <store_cfg>/<nr_store_cfgs>, not %s", argv[0]); } } consider_rip(vr, 1, oracle, df, opt, only_store_cfg, expected_nr_store_cfgs, ALLOW_GC); df.finish(); return 0; } if (argc != 1 || sscanf(argv[0], "%d...%d", &start_percentage, &end_percentage) != 2) errx(1, "expect argument to be either a VexRip or s...d where s and d are start and end percentages, not %s", argv[0]); } std::vector<DynAnalysisRip> schedule; VexPtr<TypesDb::all_instrs_iterator> instrIterator; unsigned long total_instructions; bool use_schedule = false; /* Shut compiler up */ total_instructions = -1; if (getenv("SOS22_MINIMAL_DIRECT_INSTR_SCHEDULE")) { loadSchedule(getenv("SOS22_MINIMAL_DIRECT_INSTR_SCHEDULE"), schedule); use_schedule = true; } else if (assert_mode) { oracle->findAssertions(schedule); use_schedule = true; } else if (double_free_mode) { oracle->findFrees(schedule); use_schedule = true; } else if (indirect_call_mode) { oracle->findIndirectCalls(schedule); use_schedule = true; } else { instrIterator = oracle->type_db->enumerateAllInstructions(); total_instructions = oracle->type_db->nrDistinctInstructions(); } if (use_schedule) total_instructions = schedule.size(); printf("%ld instructions to protect\n", total_instructions); /* There are a couple of important properties here: -- 0...100 must precisely cover the entire range -- a...b and b...c must, between them, cover precisely the same range as a...c i.e. no duplicates or gaps. */ unsigned long start_instr = (total_instructions * start_percentage) / 100; unsigned long end_instr = end_percentage == 100 ? total_instructions - 1: (total_instructions * end_percentage) / 100 - 1; unsigned long instructions_to_process = end_instr - start_instr; printf("Processing instructions %ld to %ld\n", start_instr, end_instr); unsigned long cntr = 0; InstructionConsumer ic(start_instr, instructions_to_process, total_instructions, opt); if (use_schedule) { initialise_profiling(); start_profiling(); for (unsigned long idx = start_instr; idx <= end_instr; idx++) { ic(oracle, df, schedule[idx], cntr); cntr++; } stop_profiling(); dump_profiling_data(); } else { /* Skip the ones we've been told to skip. */ for (unsigned long a = 0; a < start_instr; a++) instrIterator->advance(); while (cntr < instructions_to_process) { assert(!instrIterator->finished()); DynAnalysisRip dar; instrIterator->fetch(&dar); instrIterator->advance(); ic(oracle, df, dar, cntr); cntr++; } } df.finish(); return 0; }
Settings::Settings(QString root_path, QObject *parent): QSettings(Path::join(root_path, SETTINGS_FILE), QSettings::IniFormat, parent), root_path(root_path) { loadSources(); loadSchedule(); }