qdoc: better copying of .css files

This fix searches for the css files specified in the
stylesheets variable. It searches for them in the
directory specified as the templatedir. It copies
them into the style subdirectory of the outputdir.

Task-number: QTBUG-27878
Change-Id: Ic9ff43ab6f939cb50f1b41a9cc58f3f8686ebaf5
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
This commit is contained in:
Martin Smith 2012-11-08 15:22:10 +01:00
parent ec1cd70a71
commit 2cf7aceb4e

View File

@ -1546,55 +1546,49 @@ void Generator::initialize(const Config &config)
}
// Documentation template handling
QString templateDir = config.getString((*g)->format() + Config::dot + CONFIG_TEMPLATEDIR);
QStringList searchDirs;
if (!templateDir.isEmpty()) {
searchDirs.append(templateDir);
}
if (!Config::installDir.isEmpty()) {
searchDirs.append(Config::installDir);
QString templateDir = config.getString((*g)->format() + Config::dot + CONFIG_TEMPLATEDIR);
if (templateDir.isEmpty())
templateDir = ".";
searchDirs.append(templateDir);
QStringList noExts;
QStringList scripts = config.getCleanPathList((*g)->format()+Config::dot+CONFIG_SCRIPTS);
e = scripts.constBegin();
while (e != scripts.constEnd()) {
QString userFriendlyFilePath;
QString filePath = Config::findFile(config.lastLocation(),
scriptFiles,
searchDirs,
*e,
noExts,
userFriendlyFilePath);
if (!filePath.isEmpty())
Config::copyFile(config.lastLocation(),
filePath,
userFriendlyFilePath,
(*g)->outputDir() +
"/scripts");
++e;
}
if (!searchDirs.isEmpty()) {
QStringList noExts;
QStringList scripts = config.getCleanPathList((*g)->format()+Config::dot+CONFIG_SCRIPTS);
e = scripts.constBegin();
while (e != scripts.constEnd()) {
QString userFriendlyFilePath;
QString filePath = Config::findFile(config.lastLocation(),
scriptFiles,
searchDirs,
*e,
noExts,
userFriendlyFilePath);
if (!filePath.isEmpty())
Config::copyFile(config.lastLocation(),
filePath,
userFriendlyFilePath,
(*g)->outputDir() +
"/scripts");
++e;
}
QStringList styles = config.getCleanPathList((*g)->format()+Config::dot+CONFIG_STYLESHEETS);
e = styles.constBegin();
while (e != styles.constEnd()) {
QString userFriendlyFilePath;
QString filePath = Config::findFile(config.lastLocation(),
styleFiles,
searchDirs,
*e,
noExts,
userFriendlyFilePath);
if (!filePath.isEmpty())
Config::copyFile(config.lastLocation(),
filePath,
userFriendlyFilePath,
(*g)->outputDir() +
"/style");
++e;
}
QStringList styles = config.getCleanPathList((*g)->format()+Config::dot+CONFIG_STYLESHEETS);
e = styles.constBegin();
while (e != styles.constEnd()) {
QString userFriendlyFilePath;
QString filePath = Config::findFile(config.lastLocation(),
styleFiles,
searchDirs,
*e,
noExts,
userFriendlyFilePath);
if (!filePath.isEmpty())
Config::copyFile(config.lastLocation(),
filePath,
userFriendlyFilePath,
(*g)->outputDir() +
"/style");
++e;
}
}
++g;