qdoc: Improve navigation bar for example files

For example file pages, added a link to the parent example page
into the navigation bar.

Also,
    - Removed protectEnc() calls for strings added as Text atoms,
      this is done automatically when generating the navigation
      bar output, and doing it twice results in malformed output.

    - Removed the subtitle from being appended to example file
      title. The subtitle contains the full path of the file and
      it's already displayed on the page body, so removing it
      from the html title + navigation bar makes for a cleaner
      look without losing any information.

Task-number: QTBUG-33022
Change-Id: I3ca942470453379e22f1a4aaec1d9b866d85bb5c
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
This commit is contained in:
Topi Reinio 2014-03-04 12:55:59 +01:00 committed by The Qt Project
parent cfb4581fee
commit d87ddcf56f

View File

@ -1439,11 +1439,7 @@ void HtmlGenerator::generateDocNode(DocNode* dn, CodeMarker* marker)
QString fullTitle = dn->fullTitle();
QString htmlTitle = fullTitle;
if (dn->subType() == Node::File && !dn->subTitle().isEmpty()) {
subTitleSize = SmallSubTitle;
htmlTitle += " (" + dn->subTitle() + QLatin1Char(')');
}
else if (dn->subType() == Node::QmlBasicType) {
if (dn->subType() == Node::QmlBasicType) {
fullTitle = "QML Basic Type: " + fullTitle;
htmlTitle = fullTitle;
@ -1668,10 +1664,11 @@ void HtmlGenerator::generateNavigationBar(const QString &title,
if (!cn->name().isEmpty())
navigationbar << Atom(Atom::ListItemLeft)
<< Atom(Atom::String, protectEnc(cn->name()))
<< Atom(Atom::String, cn->name())
<< Atom(Atom::ListItemRight);
}
else if (node->type() == Node::Document) {
const DocNode *dn = static_cast<const DocNode *>(node);
if (node->subType() == Node::QmlClass || node->subType() == Node::QmlBasicType) {
if (!qmltypespage.isEmpty())
navigationbar << Atom(Atom::ListItemLeft)
@ -1680,16 +1677,19 @@ void HtmlGenerator::generateNavigationBar(const QString &title,
<< Atom(Atom::String, QLatin1String("QML Types"))
<< Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK)
<< Atom(Atom::ListItemRight);
}
else if (dn && dn->isExampleFile()) {
navigationbar << Atom(Atom::ListItemLeft)
<< Atom(Atom::Link, dn->parent()->name())
<< Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
<< Atom(Atom::String, dn->parent()->title())
<< Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK)
<< Atom(Atom::ListItemRight);
navigationbar << Atom(Atom::ListItemLeft)
<< Atom(Atom::String, protectEnc(title))
<< Atom(Atom::ListItemRight);
}
else {
navigationbar << Atom(Atom::ListItemLeft)
<< Atom(Atom::String, protectEnc(title))
navigationbar << Atom(Atom::ListItemLeft)
<< Atom(Atom::String, title)
<< Atom(Atom::ListItemRight);
}
}
generateText(navigationbar, node, marker);