diff options
-rw-r--r-- | src/qdoc/generator.cpp | 34 | ||||
-rw-r--r-- | src/qdoc/generator.h | 1 | ||||
-rw-r--r-- | src/qdoc/htmlgenerator.cpp | 24 | ||||
-rw-r--r-- | tests/auto/qdoc/generatedoutput/expected_output/qml-qdoc-test-doctest.html | 4 | ||||
-rw-r--r-- | tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html | 2 |
5 files changed, 27 insertions, 38 deletions
diff --git a/src/qdoc/generator.cpp b/src/qdoc/generator.cpp index fe2b56b7a..a65b47333 100644 --- a/src/qdoc/generator.cpp +++ b/src/qdoc/generator.cpp @@ -1337,28 +1337,32 @@ void Generator::generateReimplementsClause(const FunctionNode *fn, CodeMarker *m } } +QString Generator::formatSince(const Node *node) +{ + QStringList since = node->since().split(QLatin1Char(' ')); + + // If there is only one argument, assume it is the Qt version number. + if (since.count() == 1) + return "Qt " + since[0]; + + // Otherwise, use the original <project> <version> string. + return node->since(); +} + void Generator::generateSince(const Node *node, CodeMarker *marker) { if (!node->since().isEmpty()) { Text text; text << Atom::ParaLeft << "This " - << typeString(node); + << typeString(node) + << " was introduced "; if (node->isEnumType()) - text << " was introduced or modified in "; - else - text << " was introduced in "; - - QStringList since = node->since().split(QLatin1Char(' ')); - if (since.count() == 1) { - // If there is only one argument, assume it is the Qt version number. - text << " Qt " << since[0]; - } else { - // Otherwise, reconstruct the <project> <version> string. - text << " " << since.join(' '); - } - - text << "." << Atom::ParaRight; + text << "or modified "; + text << "in " + << formatSince(node) + << "." + << Atom::ParaRight; generateText(text, node, marker); } } diff --git a/src/qdoc/generator.h b/src/qdoc/generator.h index 2ed902ec6..10fd5131a 100644 --- a/src/qdoc/generator.h +++ b/src/qdoc/generator.h @@ -157,6 +157,7 @@ protected: void generateRequiredLinks(const Node *node, CodeMarker *marker); void generateLinkToExample(const ExampleNode *en, CodeMarker *marker, const QString &exampleUrl); virtual void generateFileList(const ExampleNode *en, CodeMarker *marker, bool images); + static QString formatSince(const Node *node); void generateSince(const Node *node, CodeMarker *marker); void generateStatus(const Node *node, CodeMarker *marker); void generatePrivateSignalNote(const Node *node, CodeMarker *marker); diff --git a/src/qdoc/htmlgenerator.cpp b/src/qdoc/htmlgenerator.cpp index a336467ba..afd39e0e2 100644 --- a/src/qdoc/htmlgenerator.cpp +++ b/src/qdoc/htmlgenerator.cpp @@ -2172,16 +2172,8 @@ void HtmlGenerator::generateRequisites(Aggregate *aggregate, CodeMarker *marker) //add the since and project into the map if (!aggregate->since().isEmpty()) { text.clear(); - QStringList since = aggregate->since().split(QLatin1Char(' ')); - if (since.count() == 1) { - // If there is only one argument, assume it is the Qt version number. - text << " Qt " << since[0]; - } - else { - //Otherwise, reconstruct the <project> <version> string. - text << " " << since.join(' '); - } - text << Atom::ParaRight; + text << formatSince(aggregate) + << Atom::ParaRight; requisites.insert(sinceText, text); } @@ -2304,16 +2296,8 @@ void HtmlGenerator::generateQmlRequisites(QmlTypeNode *qcn, CodeMarker *marker) //add the since and project into the map if (!qcn->since().isEmpty()) { text.clear(); - QStringList since = qcn->since().split(QLatin1Char(' ')); - if (since.count() == 1) { - // If there is only one argument, assume it is the Qt version number. - text << " Qt " << since[0]; - } - else { - //Otherwise, reconstruct the <project> <version> string. - text << " " << since.join(' '); - } - text << Atom::ParaRight; + text << formatSince(qcn) + << Atom::ParaRight; requisites.insert(sinceText, text); } diff --git a/tests/auto/qdoc/generatedoutput/expected_output/qml-qdoc-test-doctest.html b/tests/auto/qdoc/generatedoutput/expected_output/qml-qdoc-test-doctest.html index 8ad2b4d5e..626531c04 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/qml-qdoc-test-doctest.html +++ b/tests/auto/qdoc/generatedoutput/expected_output/qml-qdoc-test-doctest.html @@ -24,7 +24,7 @@ <p>Represents a doc test case. <a href="#details">More...</a></p> <!-- @@@DocTest --> <div class="table"><table class="alignedsummary"> -<tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> import QDoc.Test 1.1</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign"> QDoc.Test 0.9</td></tr></table></div><ul> +<tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> import QDoc.Test 1.1</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign"> QDoc.Test 0.9</td></tr></table></div><ul> <li><a href="qml-qdoc-test-doctest-members.html">List of all members, including inherited members</a></li> </ul> <a name="properties"></a> @@ -80,7 +80,7 @@ <a name="fail-method"></a><span class="name">fail</span>(<i>message</i> = "oops")</p></td></tr> </table></div> </div><div class="qmldoc"><p>Fails the current test case, with the optional <i>message</i>.</p> -<p>This method was introduced in QDoc.Test 1.0.</p> +<p>This method was introduced in QDoc.Test 1.0.</p> </div></div><!-- @@@fail --> <br/> </body> diff --git a/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html index 32fb9efa0..f172a10e7 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html +++ b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html @@ -73,7 +73,7 @@ <!-- $$$QDOCTEST_MACRO2[overload1]$$$QDOCTEST_MACRO2 --> <h3 class="fn" id="QDOCTEST_MACRO2"><a name="QDOCTEST_MACRO2"></a><span class="name">QDOCTEST_MACRO2</span>(<i>x</i>)</h3> <p>A macro with argument <i>x</i>.</p> -<p>This function was introduced in Test 1.1.</p> +<p>This function was introduced in Test 1.1.</p> <!-- @@@QDOCTEST_MACRO2 --> </div> </body> |