QDoc: remove the experimental basedir variable

It was introduced in the early days of the docs'
modularization and appears not to be used anywhere
anymore.

Change-Id: I5b0c60d92828624af2129153fce96ad01aec861c
Reviewed-by: Martin Smith <martin.smith@digia.com>
This commit is contained in:
Pierre Rossi 2012-09-25 14:35:12 +02:00 committed by The Qt Project
parent e47faabe23
commit a152157998
10 changed files with 1 additions and 147 deletions

View File

@ -363,55 +363,6 @@ void CodeParser::setLink(Node* node, Node::LinkType linkType, const QString& arg
node->setLink(linkType, link, desc);
}
/*!
If the \e {basedir} variable is not set in the qdocconf
file, do nothing.
Otherwise, search for the basedir string string in the
\a filePath. It must be found, or else a warning message
is output. Extract the subdirectory name that follows the
basedir name and create a subdirectory using that name
in the output director.
*/
void CodeParser::createOutputSubdirectory(const Location& location,
const QString& filePath)
{
QString bd = Generator::baseDir();
if (!bd.isEmpty()) {
int baseIdx = filePath.indexOf(bd);
if (baseIdx == -1)
location.warning(tr("File path: '%1' does not contain bundle base dir: '%2'")
.arg(filePath).arg(bd));
else {
int subDirIdx = filePath.indexOf(QLatin1Char('/'),baseIdx);
if (subDirIdx == -1)
location.warning(tr("File path: '%1' has no sub dir after bundle base dir: '%2'")
.arg(filePath).arg(bd));
else {
++subDirIdx;
int fileNameIdx = filePath.indexOf(QLatin1Char('/'),subDirIdx);
if (fileNameIdx == -1)
location.warning(tr("File path: '%1' has no file name after sub dir: '%2/'")
.arg(filePath).arg(filePath.mid(subDirIdx)));
else {
currentSubDir_ = filePath.mid(subDirIdx,fileNameIdx-subDirIdx);
if (currentSubDir_.isEmpty())
location.warning(tr("File path: '%1' has no sub dir after bundle base dir: '%2'")
.arg(filePath).arg(bd));
else {
QString subDirPath = Generator::outputDir() + QLatin1Char('/') + currentSubDir_;
QDir dirInfo;
if (!dirInfo.exists(subDirPath)) {
if (!dirInfo.mkpath(subDirPath))
location.fatal(tr("Cannot create output sub-directory '%1'").arg(currentSubDir_));
}
}
}
}
}
}
}
/*!
Returns true if the file being parsed is a .h file.
*/

View File

@ -73,8 +73,6 @@ public:
bool isParsingQdoc() const;
const QString& currentFile() const { return currentFile_; }
void createOutputSubdirectory(const Location& location, const QString& filePath);
static void initialize(const Config& config);
static void terminate();
static CodeParser *parserForLanguage(const QString& language);

View File

@ -166,7 +166,6 @@ void CppCodeParser::parseHeaderFile(const Location& location, const QString& fil
currentFile_.clear();
return;
}
createOutputSubdirectory(location, filePath);
reset();
Location fileLocation(filePath);
@ -199,7 +198,6 @@ void CppCodeParser::parseSourceFile(const Location& location, const QString& fil
currentFile_.clear();
return;
}
createOutputSubdirectory(location, filePath);
reset();
Location fileLocation(filePath);

View File

@ -1274,8 +1274,6 @@ int DitaXmlGenerator::generateAtom(const Atom *atom,
if (fileName.isEmpty()) {
relative->location().warning(tr("Missing image: %1").arg(protectEnc(atom->string())));
QString images = "images";
if (!baseDir().isEmpty())
images.prepend("../");
if (!atom->string().isEmpty() && atom->string()[0] != '/')
images.append(QLatin1Char('/'));
fileName = images + atom->string();
@ -3925,22 +3923,6 @@ QString DitaXmlGenerator::getLink(const Atom* atom, const Node* relative, const
link += QLatin1Char('#') + (*node)->guid();
}
}
/*
If the output is going to subdirectories, then if the
two nodes will be output to different directories, then
the link must go up to the parent directory and then
back down into the other subdirectory.
*/
if (!baseDir().isEmpty()) {
if (link.startsWith("images/")) {
link.prepend(QString("../"));
}
else if (*node && relative && (*node != relative)) {
if ((*node)->outputSubdirectory() != relative->outputSubdirectory()) {
link.prepend(QString("../" + (*node)->outputSubdirectory() + QLatin1Char('/')));
}
}
}
}
if (!link.isEmpty() && link[0] == '#') {
link.prepend(outFileName());

View File

@ -7198,7 +7198,6 @@
\li \l {22-qdoc-configuration-generalvariables.html#alias-variable} {alias}
\li \l {23-qdoc-configuration-cppvariables.html#Cpp.ignoredirectives-variable} {Cpp.ignoredirectives}
\li \l {23-qdoc-configuration-cppvariables.html#Cpp.ignoretokens-variable} {Cpp.ignoretokens}
\li \l {22-qdoc-configuration-generalvariables.html#basedir-variable} {basedir} \span {class="newStuff"} {(experimental)}
\li \l {22-qdoc-configuration-generalvariables.html#defines-variable} {defines}
\li \l {22-qdoc-configuration-generalvariables.html#edition-variable} {edition}
\li \l {22-qdoc-configuration-generalvariables.html#exampledirs-variable} {exampledirs}
@ -7371,40 +7370,6 @@
to adjust the appearance of certain types of HTML elements, this
level of indentation is not always required.
\target basedir-variable
\section1 basedir
The \c basedir variable tells QDoc two things. First, the fact that
it is set it tells QDoc to the put the output files in subdirectories
of the output directory. Second, the value of basedir is the name of
the bundle directory for your project. .e.g. if you are working with
the Qt5 bundle, you will have checked out the bundle into some root
subdirectory (the base directory), and that root directory might
very well be \e {qt5}
Then in your qdocconf file, you would assign to the basedir variable:
\code
basedir = qt5
\endcode
Now, QDoc knows to scan the file path of each source file it parses,
looking for \e qt5. For example, this file would be:
\code
~/depot/qt5/qtdoc/tools/qdoc/doc/qdoc-manual.qdoc
\endcode
QDoc scans the path for the basedir \e{qt5} and the next subdirectory
\e{qtdoc} becomes one of the subdirectories in the output directory.
The HTML output file created from this file will be stored in the
\e{qtdoc} subdirectory.
\note This is an experimental command. It is currently used only by
the Qt documentation group. If you use it, be advised that you might
find some broken links in your HTML output due to remaining problems
with cross-subdirectory linking.
\target defines-variable
\section1 defines

View File

@ -58,7 +58,6 @@
QT_BEGIN_NAMESPACE
QString Generator::baseDir_;
Generator* Generator::currentGenerator_;
QStringList Generator::exampleDirs;
QStringList Generator::exampleImgExts;
@ -1453,11 +1452,7 @@ void Generator::initialize(const Config &config)
outputFormats = config.getOutputFormats();
if (!outputFormats.isEmpty()) {
outDir_ = config.getOutputDir();
baseDir_ = config.getString(CONFIG_BASEDIR);
if (!baseDir_.isEmpty())
config.location().warning(tr("\"basedir\" specified in config file. "
"All output will be in module directories "
"of the output directory"));
if (outDir_.isEmpty())
config.lastLocation().fatal(tr("No output directory specified in "
"configuration file or on the command line"));

View File

@ -79,7 +79,6 @@ public:
QString fullDocumentLocation(const Node *node, bool subdir = false);
static const QString& baseDir() { return baseDir_; }
static Generator *currentGenerator() { return currentGenerator_; }
static Generator *generatorForFormat(const QString& format);
static void initialize(const Config& config);
@ -170,7 +169,6 @@ protected:
QStack<QTextStream*> outStreamStack;
private:
static QString baseDir_;
static Generator* currentGenerator_;
static QStringList exampleDirs;
static QStringList exampleImgExts;

View File

@ -222,19 +222,6 @@ void HtmlGenerator::initializeGenerator(const Config &config)
manifestDir = "qthelp://" + config.getString(prefix + "namespace");
manifestDir += QLatin1Char('/') + config.getString(prefix + "virtualFolder") + QLatin1Char('/');
/*
If the output files will be in subdirectores in the output
directory, change the references to files in the style and
scripts subdirectories that appear in the headerscipts and
headerstyles string so that they link to the correct files,
whic means prepending "../" to each
*/
if (!baseDir().isEmpty()) {
headerScripts = headerScripts.replace("style/","../style/");
headerScripts = headerScripts.replace("scripts/","../scripts/");
headerStyles = headerStyles.replace("style/","../style/");
headerStyles = headerStyles.replace("scripts/","../scripts/");
}
}
/*!
@ -746,8 +733,6 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
}
else {
QString prefix;
if (!baseDir().isEmpty())
prefix = "../";
out() << "<img src=\"" << protectEnc(prefix + fileName) << '"';
if (!text.isEmpty())
out() << " alt=\"" << protectEnc(text) << '"';
@ -3624,22 +3609,6 @@ QString HtmlGenerator::getLink(const Atom *atom, const Node *relative, const Nod
if (targetAtom)
link += QLatin1Char('#') + refForAtom(targetAtom, *node);
}
/*
If the output is going to subdirectories, then if the
two nodes will be output to different directories, then
the link must go up to the parent directory and then
back down into the other subdirectory.
*/
if (!baseDir().isEmpty()) {
if (link.startsWith("images/")) {
link.prepend(QString("../"));
}
else if (*node && relative && (*node != relative)) {
if ((*node)->outputSubdirectory() != relative->outputSubdirectory()) {
link.prepend(QString("../" + (*node)->outputSubdirectory() + QLatin1Char('/')));
}
}
}
}
return link;
}

View File

@ -93,7 +93,6 @@ void PureDocParser::parseSourceFile(const Location& location, const QString& fil
currentFile_.clear();
return;
}
createOutputSubdirectory(location, filePath);
reset();
Location fileLocation(filePath);

View File

@ -153,7 +153,6 @@ void QmlCodeParser::parseSourceFile(const Location& location, const QString& fil
currentFile_.clear();
return;
}
createOutputSubdirectory(location, filePath);
QString document = in.readAll();
in.close();