BaseQtVersion: Deduplicate documentation related methods

Use docsPath() over documentationPath() since that fits better into
the naming scheme of the rest and already returns a FilePath.

Change hasDocumentation() to hasDocs() accordingly.

Change-Id: I619d7c68e612c4e25a830e4dce128d9a1e84c2e2
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Tobias Hunger
2019-09-30 15:54:11 +02:00
parent 67934ccaaa
commit a542f5075f
4 changed files with 7 additions and 14 deletions

View File

@@ -1240,17 +1240,12 @@ void BaseQtVersion::applyProperties(QMakeGlobals *qmakeGlobals) const
qmakeGlobals->setProperties(d->versionInfo()); qmakeGlobals->setProperties(d->versionInfo());
} }
bool BaseQtVersion::hasDocumentation() const bool BaseQtVersion::hasDocs() const
{ {
d->updateVersionInfo(); d->updateVersionInfo();
return d->m_hasDocumentation; return d->m_hasDocumentation;
} }
QString BaseQtVersion::documentationPath() const
{
return qmakeProperty("QT_INSTALL_DOCS");
}
bool BaseQtVersion::hasDemos() const bool BaseQtVersion::hasDemos() const
{ {
d->updateVersionInfo(); d->updateVersionInfo();

View File

@@ -146,11 +146,9 @@ public:
QStringList qtSoPaths() const; QStringList qtSoPaths() const;
bool hasExamples() const; bool hasExamples() const;
bool hasDocumentation() const; bool hasDocs() const;
bool hasDemos() const; bool hasDemos() const;
QString documentationPath() const;
QString frameworkInstallPath() const; QString frameworkInstallPath() const;
// former local functions // former local functions

View File

@@ -141,7 +141,7 @@ void ExampleSetModel::recreateModel(const QList<BaseQtVersion *> &qtVersions)
foreach (BaseQtVersion *version, qtVersions) { foreach (BaseQtVersion *version, qtVersions) {
// sanitize away qt versions that have already been added through extra sets // sanitize away qt versions that have already been added through extra sets
if (extraManifestDirs.contains(version->documentationPath())) { if (extraManifestDirs.contains(version->docsPath().toString())) {
if (debugExamples()) { if (debugExamples()) {
qWarning() << "Not showing Qt version because manifest path is already added through InstalledExamples settings:" qWarning() << "Not showing Qt version because manifest path is already added through InstalledExamples settings:"
<< version->displayName(); << version->displayName();
@@ -172,7 +172,7 @@ int ExampleSetModel::indexForQtVersion(BaseQtVersion *qtVersion) const
} }
// check for extra set // check for extra set
const QString &documentationPath = qtVersion->documentationPath(); const QString &documentationPath = qtVersion->docsPath().toString();
for (int i = 0; i < rowCount(); ++i) { for (int i = 0; i < rowCount(); ++i) {
if (getType(i) == ExtraExampleSetType if (getType(i) == ExtraExampleSetType
&& m_extraExampleSets.at(getExtraExampleSetIndex(i)).manifestPath == documentationPath) && m_extraExampleSets.at(getExtraExampleSetIndex(i)).manifestPath == documentationPath)
@@ -577,7 +577,7 @@ QStringList ExampleSetModel::exampleSources(QString *examplesInstallPath, QStrin
int qtId = getQtId(m_selectedExampleSetIndex); int qtId = getQtId(m_selectedExampleSetIndex);
foreach (BaseQtVersion *version, QtVersionManager::versions()) { foreach (BaseQtVersion *version, QtVersionManager::versions()) {
if (version->uniqueId() == qtId) { if (version->uniqueId() == qtId) {
manifestScanPath = version->documentationPath(); manifestScanPath = version->docsPath().toString();
examplesPath = version->examplesPath().toString(); examplesPath = version->examplesPath().toString();
demosPath = version->demosPath().toString(); demosPath = version->demosPath().toString();
break; break;

View File

@@ -469,8 +469,8 @@ static void updateDocumentation()
{ {
QStringList files; QStringList files;
foreach (BaseQtVersion *v, m_versions) { foreach (BaseQtVersion *v, m_versions) {
const QStringList docPaths = QStringList({v->documentationPath() + QChar('/'), const QStringList docPaths = QStringList(
v->documentationPath() + "/qch/"}); {v->docsPath().toString() + QChar('/'), v->docsPath().toString() + "/qch/"});
foreach (const QString &docPath, docPaths) { foreach (const QString &docPath, docPaths) {
const QDir versionHelpDir(docPath); const QDir versionHelpDir(docPath);
foreach (const QString &helpFile, foreach (const QString &helpFile,