// return pixmap for zoom 100% QPixmap * get_pixmap(const char * path) { QPixmap * px = DiagramPixmap.find(path); if (px == 0) { QString abspath; if (!QDir::isRelativePath(path)) abspath = path; else if ((UmlWindow::images_root_dir().isEmpty() || !QFile::exists(abspath = QDir::cleanDirPath(UmlWindow::images_root_dir() + '/' + path))) && !QFile::exists(abspath = path)) abspath = BrowserView::get_dir().absFilePath(path); px = new QPixmap(abspath); DiagramPixmap.insert(path, px); if (px->isNull()) { msg_critical(TR("Error"), QString(path) + TR("\ndoesn't exist or is not a know image format")); return 0; } DiagramScaledPixmap.insert(path, new Q3PtrDict<QPixmap>()); } return (px->isNull()) ? 0 : px; }
// this is useful, memorize it and its diagrams and classes body file void BrowserNode::memo(Q3Dict<void> & useful) { useful.insert(filename, (void *) 1); QStringList::Iterator its; for (its = diagrams.begin(); its != diagrams.end(); ++its) useful.insert(*its, (void *) 1); for (its = classes.begin(); its != classes.end(); ++its) useful.insert(*its, (void *) 1); }
bool UmlClass::isAppliedStereotype(Token & tk, WrapperStr & prof_st, Q3ValueList<WrapperStr> & base_v) { static Q3Dict<WrapperStr> stereotypes; static Q3Dict<Q3ValueList<WrapperStr> > bases; WrapperStr s = tk.what(); WrapperStr * st = stereotypes[s]; if (st != 0) { prof_st = *st; base_v = *bases[s]; return TRUE; } base_v.clear(); if (tk.xmiType().isEmpty() && (getFct(tk) == 0)) { int index = s.find(':'); if ((index != -1) && ((index != 3) || ((s.left(3) != "uml") && (s.left(3) != "xmi")))) { UmlClass * cl = findStereotype(s, FALSE); if (cl != 0) { const Q3PtrVector<UmlItem> ch = cl->children(); unsigned n = ch.size(); for (unsigned i = 0; i != n; i += 1) { UmlItem * x = ch[i]; if ((x->kind() == aRelation) && (((UmlRelation *) x)->relationKind() == aDirectionalAssociation) && (((UmlRelation *) x)->roleType()->stereotype() == "metaclass")) base_v.append("base_" + ((UmlRelation *) x)->roleType()->name().lower()); } if (base_v.isEmpty()) base_v.append("base_element"); prof_st = cl->parent()->parent()->name() + ":" + cl->name(); stereotypes.insert(s, new WrapperStr(prof_st)); bases.insert(s, new Q3ValueList<WrapperStr>(base_v)); return TRUE; } } } return FALSE; }
void Package::own(UmlArtifact * art) { QDir hd(h_path); QDir sd(src_path); Roundtriped.insert(hd.absFilePath(art->name() + "." + CppSettings::headerExtension()), art); Roundtriped.insert(sd.absFilePath(art->name() + "." + CppSettings::sourceExtension()), art); }
bool CppRefType::add(const WrapperStr & t, Q3PtrList<CppRefType> & l, bool incl) { if (t.isEmpty()) return FALSE; static Q3Dict<char> cpp_builtin_types; if (cpp_builtin_types.count() == 0) { cpp_builtin_types.insert("unsigned", " "); cpp_builtin_types.insert("signed", " "); cpp_builtin_types.insert("char", " "); cpp_builtin_types.insert("short", " "); cpp_builtin_types.insert("int", " "); cpp_builtin_types.insert("long", " "); cpp_builtin_types.insert("float", " "); cpp_builtin_types.insert("double", " "); cpp_builtin_types.insert("bool", " "); cpp_builtin_types.insert("void", " "); } if (cpp_builtin_types[t] != 0) return TRUE; CppRefType * ref; Weight w = (incl) ? Medium : Low; for (ref = l.first(); ref; ref = l.next()) { if (ref->type.toString() == t) { if (w > ref->weight) ref->included = incl; return TRUE; } } l.append(new CppRefType(t, incl, w)); return TRUE; }
/** * CustomLoginFlagEditor::fillTable() * * Fills the table with the flags and values for the user. */ void CustomLoginFlagEditor::fillTable() { ADB db; long loginType; Q3Dict<QString> flagDict; // Get the login type. db.query("select LoginType from Logins where LoginID = '%s'", myLoginID); if (!db.rowCount) return; db.getrow(); loginType = atoi(db.curRow["LoginType"]); // Get the available login flags for this login type db.query("select Tag, Value from LoginTypeFlags where LoginTypeID = %ld", loginType); if (!db.rowCount) return; // Load the dictionary while(db.getrow()) { flagDict.insert(db.curRow["Tag"], new QString(db.curRow["Value"])); } // Get whatever data is in the LoginFlagValues that is custom for this user. db.query("select * from LoginFlagValues where LoginID = '%s'", myLoginID); if (db.rowCount) while (db.getrow()) { flagDict.replace(db.curRow["LoginFlag"], new QString(db.curRow["FlagValue"])); } // Now put the stuff from our flagDict into the grid Q3DictIterator<QString> it(flagDict); for( ; it.current(); ++it ) { flagTable->insertRows(flagTable->numRows(), 1); flagTable->setText(flagTable->numRows()-1, 0, it.currentKey()); flagTable->setText(flagTable->numRows()-1, 1, it.current()->ascii()); } // Set column 0(1) to be read only flagTable->setColumnReadOnly(0, true); flagTable->adjustColumn(1); }
// synchronize all in todir, current packages are 'nodes' void BrowserNode::synchronize(QDir & todir, Q3Dict<BrowserNode> & nodes) { static Q3Dict<void> useful(9973); // all useful files static bool made_useful = TRUE; // set at the first call // compare nodes with young packages Q3DictIterator<BrowserNode> ity(Youngs); for (; ity.current(); ++ity) { BrowserNode * from = ity.current(); BrowserNode * curr_bn = nodes.find(ity.currentKey()); if ((curr_bn == 0) || (curr_bn->state == Old)) { // don't exist or must be updated if (made_useful) useful.insert(ity.currentKey(), (void *) 1); QDir & fromdir = from->view->get_dir(); // copy package file copy(fromdir, todir, from->filename); // copy diagrams files QStringList::Iterator its; QStringList & diags = from->diagrams; if (made_useful) { for (its = diags.begin(); its != diags.end(); ++its) { copy_if_needed(fromdir, todir, *its); useful.insert(*its, (void *) 1); } } else for (its = diags.begin(); its != diags.end(); ++its) copy_if_needed(fromdir, todir, *its); // copy class body files QStringList & cls = from->classes; if (made_useful) { for (its = cls.begin(); its != cls.end(); ++its) { copy_if_needed(fromdir, todir, *its); useful.insert(*its, (void *) 1); } } else for (its = cls.begin(); its != cls.end(); ++its) copy_if_needed(fromdir, todir, *its); if (from->parent() == 0) { // project, special files copy_if_needed(fromdir, todir, "cpp_includes"); copy_if_needed(fromdir, todir, "idl_includes"); copy_if_needed(fromdir, todir, "java_imports"); copy_if_needed(fromdir, todir, "generation_settings"); copy_if_needed(fromdir, todir, "import"); copy_if_needed(fromdir, todir, "include"); copy_if_needed(fromdir, todir, "stereotypes"); copy_if_needed(fromdir, todir, "tools"); } } else if (made_useful) // young, memorize packages, diagrams and classes body file from->memo(useful); } if (made_useful) { // memorize up to date packages, diagrams and classes body file Q3DictIterator<BrowserNode> itn(nodes); for (; itn.current(); ++itn) if (itn.current()->state == UpToDate) itn.current()->memo(useful); made_useful = FALSE; } // remove files associated to deleted elements purge(todir, useful); }
PlotLine * SYMBOL::getSYMBOL () { QString s; Config config; config.getData(Config::IndexPath, s); DBIndex index; index.open(s); PlotLine *line = new PlotLine(); DbPlugin db; if (db.open(symbol, &index)) { db.close(); index.close(); return line; } QDateTime date; data->getDate(0, date); QString ts; config.getData(Config::BarLength, ts); db.setBarLength((BarData::BarLength) ts.toInt()); config.getData(Config::Bars, ts); db.setBarRange(ts.toInt()); BarData *recordList = new BarData(symbol); QDateTime dt = QDateTime::currentDateTime(); db.getHistory(recordList, dt); Q3Dict<Setting> dict; dict.setAutoDelete(TRUE); int loop; ts = "Close"; QString ts2; for (loop = 0; loop < (int) recordList->count(); loop++) { Setting *r = new Setting; ts2 = QString::number(recordList->getClose(loop)); r->setData(ts, ts2); recordList->getDate(loop, dt); QString s = dt.toString("yyyyMMddhhmmss"); dict.insert(s, r); } double val = 0; for (loop = 0; loop < (int) data->count(); loop++) { data->getDate(loop, dt); QString s = dt.toString("yyyyMMddhhmmss"); Setting *r2 = dict[s]; if (r2) { val = r2->getDouble(ts); line->append(val); } } delete recordList; db.close(); index.close(); line->setScaleFlag(TRUE); return line; }