uint PropertySheetIconValue::mask() const { uint flags = 0; QMapIterator<ModeStateKey, PropertySheetPixmapValue> itPath(m_paths); while (itPath.hasNext()) flags |= stateMap()->flag(itPath.next().key()); return flags; }
tree_node_<FILE_ITEM>* CFileTree::findNodeFromRootWithPath(char *path) { // No topNode - bail out. if (topNode.node == NULL){ return NULL; } std::string sPath(path); std::string nPath(topNode->path); // topNode path and requested path are the same? Use the node. if (sPath == nPath) { return topNode.node; } // printf("Did not find node for path : %s\n", path); // If the topNode path is part of the requested path this is a subpath. // Use the node. if (sPath.find(nPath) != std::string::npos) { // printf("Found %s is part of %s \n", sPath.c_str(), topNode->path); std::string splittedString = sPath.substr(strlen(topNode->path) + 1); return findNodeWithPathFromNode(splittedString, topNode.node); } else { // If the current topNode isn't related to the requested path // iterate over all _top_ level elements in the tree to look for // a matching item and register it as current top node. // printf("NOT found %s is NOT part of %s \n", sPath.c_str(), topNode->path); tree<FILE_ITEM>::sibling_iterator it; for (it = filesTree.begin(); it != filesTree.end(); it++) { std::string itPath(it.node->data.path); // Current item path matches the requested path - use the item as topNode. if (sPath == itPath) { // printf("Found parent node %s \n", it.node->data.path); topNode = it; return it.node; } else if (sPath.find(itPath) != std::string::npos) { // If the item path is part of the requested path this is a subpath. // Use the the item as topNode and continue analyzing. // printf("Found root node %s \n", it.node->data.path); topNode = it; std::string splittedString = sPath.substr(itPath.length() + 1); return findNodeWithPathFromNode(splittedString, it.node); } } } // Nothing found return NULL. return NULL; }
QIcon DesignerIconCache::icon(const PropertySheetIconValue &value) const { QMap<PropertySheetIconValue, QIcon>::const_iterator it = m_cache.constFind(value); if (it != m_cache.constEnd()) return it.value(); QIcon icon; QMap<QPair<QIcon::Mode, QIcon::State>, PropertySheetPixmapValue> paths = value.paths(); QMapIterator<QPair<QIcon::Mode, QIcon::State>, PropertySheetPixmapValue> itPath(paths); while (itPath.hasNext()) { QPair<QIcon::Mode, QIcon::State> pair = itPath.next().key(); icon.addFile(itPath.value().path(), QSize(), pair.first, pair.second); } m_cache.insert(value, icon); return icon; }