const QIcon& getIcon(const QString & name) { QString plainName(name); if (plainName.endsWith(".svg", Qt::CaseInsensitive)) plainName.chop(4); const QMap<QString, QIcon>::const_iterator i = iconCache.find(plainName); if (i != iconCache.end()) return *i; const QString iconDir = util::directory::getIconDir().canonicalPath(); QString iconFileName = iconDir + "/" + plainName + ".svg"; if (QFile(iconFileName).exists()) return *iconCache.insert(plainName, QIcon(iconFileName)); iconFileName = iconDir + "/" + plainName + ".png"; if (QFile(iconFileName).exists()) return *iconCache.insert(plainName, QIcon(iconFileName)); if (plainName != "default") { qWarning() << "Cannot find icon file" << iconFileName << ", using default icon."; return getIcon("default"); } qWarning() << "Cannot find default icon" << iconFileName << ", using null icon."; return nullIcon; }
//________________________________________________________ void GFHistManager::Print(const char* filename, Bool_t add) { // print all layers of histograms to ps-file 'filename' // if 'add == true' puts '(' or ')' only if 'filename' ends with it, // e.g. if i is loop variable // GFHistManager *man = ...; // TString name("XXX.ps"); // if(i == 0) man->Print(name + '('); // else if(i == last) man->Print(name + ')'); // else man->Print(name, kTRUE); const Bool_t rootIsBatch = gROOT->IsBatch(); if(fBatch){ gROOT->SetBatch(); for(Int_t i = 0; i < fDepth; ++i){ this->DrawReally(i); } } gROOT->SetBatch(rootIsBatch); TObjArray cans; TIter canArrayIter(fCanArrays); while(TObjArray* canArray = static_cast<TObjArray*>(canArrayIter.Next())){ cans.AddAll(canArray); } const Int_t nCans = cans.GetEntriesFast(); if(nCans == 1) { cans.At(0)->Print(filename); return; } TString plainName(filename); const Bool_t starting = plainName.EndsWith("("); if(starting) { const Ssiz_t ind = plainName.Last('('); plainName.Remove(ind); // plainName.ReplaceAll("(", ""); } const Bool_t ending = plainName.EndsWith(")"); if(ending) { const Ssiz_t ind = plainName.Last(')'); plainName.Remove(ind); // plainName.ReplaceAll(")", ""); } for(Int_t i = 0; i < nCans; ++i){ if(i == 0 && !ending && (!add || starting)) { cans.At(i)->Print(plainName + "("); } else if(i == nCans - 1 && !starting && (!add || ending)) { cans.At(i)->Print(plainName + ")"); } else { cans.At(i)->Print(plainName); } } }
QString QsCodeMarker::plainFullName( const Node *node, const Node * /* relative */ ) { QString fullName; for ( ;; ) { fullName.prepend( plainName(node) ); if ( node->parent()->name().isEmpty() ) break; node = node->parent(); fullName.prepend("."); } return fullName; }
QString CppCodeMarker::plainFullName(const Node *node, const Node *relative) { if (node->name().isEmpty()) { return "global"; } else { QString fullName; for (;;) { fullName.prepend(plainName(node)); if (node->parent() == relative || node->parent()->name().isEmpty()) break; fullName.prepend("::"); node = node->parent(); } return fullName; } }