/*! If the \a node has a URL, return the URL as the file name. Otherwise, construct the file name from the fileBase() and the fileExtension(), and return the constructed name. */ QString PageGenerator::fileName(const Node* node) const { if (!node->url().isEmpty()) return node->url(); QString name = fileBase(node); name += QLatin1Char('.'); name += fileExtension(node); return name; }
/*! Composes a string to be used as an href attribute in DITA XML. It is composed of the file name and the UUID separated by a '#'. If this node is a class node, the file name is taken from this node; if this node is a function node, the file name is taken from the parent node of this node. */ QString Node::ditaXmlHref() { QString href; if ((type() == Function) || (type() == Property) || (type() == Variable)) { href = parent()->fileBase(); } else { href = fileBase(); } if (!href.endsWith(".xml")) href += ".xml"; return href + "#" + guid(); }
QString QucsDoc::fileBase (void) { return fileBase (DocName); }
QString AudioPluginOSCGUI::getGUIFilePath(QString identifier) { QString type, soName, label; PluginIdentifier::parseIdentifier(identifier, type, soName, label); RG_DEBUG << "AudioPluginOSCGUI::getGUIFilePath(" << identifier << ")"; QFileInfo soInfo(soName); if (soInfo.isRelative()) { //!!! RG_DEBUG << "AudioPluginOSCGUI::AudioPluginOSCGUI: Unable to deal with relative .so path \"" << soName << "\" in identifier \"" << identifier << "\" yet"; throw Exception("Can't deal with relative .soname"); } QDir dir(soInfo.dir()); QString fileBase(soInfo.completeBaseName()); if (!dir.cd(fileBase)) { RG_DEBUG << "AudioPluginOSCGUI::AudioPluginOSCGUI: No GUI subdir for plugin .so " << soName; throw Exception("No GUI subdir available"); } QFileInfoList list = dir.entryInfoList(); // in order of preference: const char *suffixes[] = { "_rg", "_kde", "_qt", "_gtk2", "_gtk", "_x11", "_gui" }; int nsuffixes = int(sizeof(suffixes) / sizeof(suffixes[0])); for (int k = 0; k <= nsuffixes; ++k) { for (int fuzzy = 0; fuzzy <= 1; ++fuzzy) { QFileInfoList::iterator info; for (info = list.begin(); info != list.end(); ++info) { //### JAS Check for errors RG_DEBUG << "Looking at " << info->fileName() << " in path " << info->filePath() << " for suffix " << (k == nsuffixes ? "(none)" : suffixes[k]) << ", fuzzy " << fuzzy << endl; if (!(info->isFile() || info->isSymLink()) || !info->isExecutable()) { RG_DEBUG << "(not executable)"; continue; } if (fuzzy) { if (info->fileName().left(fileBase.length()) != fileBase) continue; RG_DEBUG << "(is file base)"; } else { if (info->fileName().left(label.length()) != label) continue; RG_DEBUG << "(is label)"; } if (k == nsuffixes || info->fileName().toLower().endsWith(suffixes[k])) { RG_DEBUG << "(ends with suffix " << (k == nsuffixes ? "(none)" : suffixes[k]) << " or out of suffixes)"; return info->filePath(); } RG_DEBUG << "(doesn't end with suffix " << (k == nsuffixes ? "(none)" : suffixes[k]) << ")"; } } } return QString(); }