tools/qdoc3/htmlgenerator.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
  2298                     out() << "<b>"
  2298                     out() << "<b>"
  2299                           << paragraphName[currentParagraphNo[i]]
  2299                           << paragraphName[currentParagraphNo[i]]
  2300                           << "&nbsp;</b>";
  2300                           << "&nbsp;</b>";
  2301                 }
  2301                 }
  2302                 out() << "</td>\n";
  2302                 out() << "</td>\n";
  2303                     
  2303 
       
  2304                 out() << "<td>";
  2304                 if ((currentParagraphNo[i] < NumParagraphs) &&
  2305                 if ((currentParagraphNo[i] < NumParagraphs) &&
  2305                     !paragraphName[currentParagraphNo[i]].isEmpty()) {
  2306                     !paragraphName[currentParagraphNo[i]].isEmpty()) {
  2306                     NodeMap::Iterator it;
  2307                     NodeMap::Iterator it;
  2307                     it = paragraph[currentParagraphNo[i]].begin();
  2308                     it = paragraph[currentParagraphNo[i]].begin();
  2308                     for (j = 0; j < currentOffsetInParagraph[i]; j++)
  2309                     for (j = 0; j < currentOffsetInParagraph[i]; j++)
  2309                         ++it;
  2310                         ++it;
  2310 
  2311 
  2311                     out() << "<td>";
       
  2312                     // Previously, we used generateFullName() for this, but we
  2312                     // Previously, we used generateFullName() for this, but we
  2313                     // require some special formatting.
  2313                     // require some special formatting.
  2314                     out() << "<a href=\""
  2314                     out() << "<a href=\""
  2315                         << linkForNode(it.value(), relative)
  2315                         << linkForNode(it.value(), relative)
  2316                         << "\">";
  2316                         << "\">";
  2320                     if (pieces.size() > 1) {
  2320                     if (pieces.size() > 1) {
  2321                         out() << " (";
  2321                         out() << " (";
  2322                         generateFullName(it.value()->parent(), relative, marker);
  2322                         generateFullName(it.value()->parent(), relative, marker);
  2323                         out() << ")";
  2323                         out() << ")";
  2324                     }
  2324                     }
  2325                     out() << "</td>\n";
  2325                 }
  2326                  }
  2326                 out() << "</td>\n";
  2327 
  2327 
  2328                 currentOffset[i]++;
  2328                 currentOffset[i]++;
  2329                 currentOffsetInParagraph[i]++;
  2329                 currentOffsetInParagraph[i]++;
  2330             }
  2330             }
  2331         }
  2331         }
  3427 QString HtmlGenerator::fileName(const Node *node)
  3427 QString HtmlGenerator::fileName(const Node *node)
  3428 {
  3428 {
  3429     if (node->type() == Node::Fake) {
  3429     if (node->type() == Node::Fake) {
  3430         if (static_cast<const FakeNode *>(node)->subType() == Node::ExternalPage)
  3430         if (static_cast<const FakeNode *>(node)->subType() == Node::ExternalPage)
  3431             return node->name();
  3431             return node->name();
       
  3432         if (static_cast<const FakeNode *>(node)->subType() == Node::Image)
       
  3433             return node->name();
  3432     }
  3434     }
  3433     return PageGenerator::fileName(node);
  3435     return PageGenerator::fileName(node);
  3434 }
  3436 }
  3435 
  3437 
  3436 QString HtmlGenerator::refForNode(const Node *node)
  3438 QString HtmlGenerator::refForNode(const Node *node)
  3465             ref = func->name();
  3467             ref = func->name();
  3466             if (func->overloadNumber() != 1)
  3468             if (func->overloadNumber() != 1)
  3467                 ref += "-" + QString::number(func->overloadNumber());
  3469                 ref += "-" + QString::number(func->overloadNumber());
  3468         }
  3470         }
  3469         break;
  3471         break;
  3470     case Node::Property:
  3472 #ifdef QDOC_QML        
  3471 #ifdef QDOC_QML
  3473     case Node::Fake:
       
  3474         if (node->subType() != Node::QmlPropertyGroup)
       
  3475             break;
  3472     case Node::QmlProperty:
  3476     case Node::QmlProperty:
  3473 #endif        
  3477 #endif        
       
  3478     case Node::Property:
  3474         ref = node->name() + "-prop";
  3479         ref = node->name() + "-prop";
  3475         break;
  3480         break;
  3476 #ifdef QDOC_QML
  3481 #ifdef QDOC_QML
  3477     case Node::QmlSignal:
  3482     case Node::QmlSignal:
  3478         ref = node->name() + "-signal";
  3483         ref = node->name() + "-signal";
  3510         return fn;*/
  3515         return fn;*/
  3511 #if 0
  3516 #if 0
  3512     // ### reintroduce this test, without breaking .dcf files
  3517     // ### reintroduce this test, without breaking .dcf files
  3513     if (fn != outFileName())
  3518     if (fn != outFileName())
  3514 #endif
  3519 #endif
  3515         link += fn;
  3520     link += fn;
  3516 
  3521 
  3517     if (!node->isInnerNode()) {
  3522     if (!node->isInnerNode() || node->subType() == Node::QmlPropertyGroup) {
  3518         ref = refForNode(node);
  3523         ref = refForNode(node);
  3519         if (relative && fn == fileName(relative) && ref == refForNode(relative))
  3524         if (relative && fn == fileName(relative) && ref == refForNode(relative))
  3520             return QString();
  3525             return QString();
  3521 
  3526 
  3522         link += "#";
  3527         link += "#";
  3995             path.removeFirst();
  4000             path.removeFirst();
  3996         }
  4001         }
  3997 
  4002 
  3998         if (path.isEmpty()) {
  4003         if (path.isEmpty()) {
  3999             link = linkForNode(*node, relative);
  4004             link = linkForNode(*node, relative);
       
  4005             if (*node && (*node)->subType() == Node::Image)
       
  4006                 link = "images/used-in-examples/" + link;
  4000             if (targetAtom)
  4007             if (targetAtom)
  4001                 link += "#" + refForAtom(targetAtom, *node);
  4008                 link += "#" + refForAtom(targetAtom, *node);
  4002         }
  4009         }
  4003     }
  4010     }
  4004     return link;
  4011     return link;
  4075     if (!pleaseGenerateMacRef || marker == 0)
  4082     if (!pleaseGenerateMacRef || marker == 0)
  4076         return;
  4083         return;
  4077 
  4084 
  4078     QStringList macRefs = marker->macRefsForNode(node);
  4085     QStringList macRefs = marker->macRefsForNode(node);
  4079     foreach (const QString &macRef, macRefs)
  4086     foreach (const QString &macRef, macRefs)
  4080         out() << "<a name=\"" << "//apple_ref/" << macRef << "\" />\n";
  4087         out() << "<a name=\"" << "//apple_ref/" << macRef << "\"></a>\n";
  4081 }
  4088 }
  4082 
  4089 
  4083 void HtmlGenerator::beginLink(const QString &link,
  4090 void HtmlGenerator::beginLink(const QString &link,
  4084                               const Node *node,
  4091                               const Node *node,
  4085                               const Node *relative,
  4092                               const Node *relative,
  4187     out() << "<div class=\"qmlitem\">";
  4194     out() << "<div class=\"qmlitem\">";
  4188     if (node->subType() == Node::QmlPropertyGroup) {
  4195     if (node->subType() == Node::QmlPropertyGroup) {
  4189         const QmlPropGroupNode* qpgn = static_cast<const QmlPropGroupNode*>(node);
  4196         const QmlPropGroupNode* qpgn = static_cast<const QmlPropGroupNode*>(node);
  4190         NodeList::ConstIterator p = qpgn->childNodes().begin();
  4197         NodeList::ConstIterator p = qpgn->childNodes().begin();
  4191         out() << "<div class=\"qmlproto\">";
  4198         out() << "<div class=\"qmlproto\">";
  4192         out() << "<table class=\"qmlname\">";
  4199         out() << "<table width=\"100%\" class=\"qmlname\">";
  4193 
  4200 
  4194         while (p != qpgn->childNodes().end()) {
  4201         while (p != qpgn->childNodes().end()) {
  4195             if ((*p)->type() == Node::QmlProperty) {
  4202             if ((*p)->type() == Node::QmlProperty) {
  4196                 qpn = static_cast<const QmlPropertyNode*>(*p);
  4203                 qpn = static_cast<const QmlPropertyNode*>(*p);
  4197                 out() << "<tr><td>";
  4204                 out() << "<tr><td>";
  4198                 out() << "<a name=\"" + refForNode(qpn) + "\"></a>";
  4205                 out() << "<a name=\"" + refForNode(qpn) + "\"></a>";
       
  4206                 if (!qpn->isWritable())
       
  4207                     out() << "<span class=\"qmlreadonly\">read-only</span>";
  4199                 generateQmlItem(qpn, relative, marker, false);
  4208                 generateQmlItem(qpn, relative, marker, false);
  4200                 out() << "</td></tr>";
  4209                 out() << "</td></tr>";
  4201                 if (qpgn->isDefault()) {
  4210                 if (qpgn->isDefault()) {
  4202                     out() << "</table>"
  4211                     out() << "</table>"
  4203                           << "</div></div>"
  4212                           << "</div></div>"
  4212         }
  4221         }
  4213         out() << "</table>";
  4222         out() << "</table>";
  4214         out() << "</div>";
  4223         out() << "</div>";
  4215     }
  4224     }
  4216     else if (node->type() == Node::QmlSignal) {
  4225     else if (node->type() == Node::QmlSignal) {
  4217         const QmlSignalNode* qsn = static_cast<const QmlSignalNode*>(node);
  4226         const FunctionNode* qsn = static_cast<const FunctionNode*>(node);
  4218         out() << "<div class=\"qmlproto\">";
  4227         out() << "<div class=\"qmlproto\">";
  4219         out() << "<table class=\"qmlname\">";
  4228         out() << "<table class=\"qmlname\">";
  4220         out() << "<tr><td>";
  4229         out() << "<tr><td>";
  4221         out() << "<a name=\"" + refForNode(qsn) + "\"></a>";
  4230         out() << "<a name=\"" + refForNode(qsn) + "\"></a>";
  4222         generateQmlItem(qsn,relative,marker,false);
  4231         generateSynopsis(qsn,relative,marker,CodeMarker::Detailed,false);
       
  4232         //generateQmlItem(qsn,relative,marker,false);
  4223         out() << "</td></tr>";
  4233         out() << "</td></tr>";
  4224         out() << "</table>";
  4234         out() << "</table>";
  4225         out() << "</div>";
  4235         out() << "</div>";
  4226     }
  4236     }
  4227     else if (node->type() == Node::QmlMethod) {
  4237     else if (node->type() == Node::QmlMethod) {
  4228         const QmlMethodNode* qmn = static_cast<const QmlMethodNode*>(node);
  4238         const FunctionNode* qmn = static_cast<const FunctionNode*>(node);
  4229         out() << "<div class=\"qmlproto\">";
  4239         out() << "<div class=\"qmlproto\">";
  4230         out() << "<table class=\"qmlname\">";
  4240         out() << "<table class=\"qmlname\">";
  4231         out() << "<tr><td>";
  4241         out() << "<tr><td>";
  4232         out() << "<a name=\"" + refForNode(qmn) + "\"></a>";
  4242         out() << "<a name=\"" + refForNode(qmn) + "\"></a>";
  4233         generateQmlItem(qmn,relative,marker,false);
  4243         generateSynopsis(qmn,relative,marker,CodeMarker::Detailed,false);
  4234         out() << "</td></tr>";
  4244         out() << "</td></tr>";
  4235         out() << "</table>";
  4245         out() << "</table>";
  4236         out() << "</div>";
  4246         out() << "</div>";
  4237     }
  4247     }
  4238     out() << "<div class=\"qmldoc\">";
  4248     out() << "<div class=\"qmldoc\">";
  4274         }
  4284         }
  4275     }
  4285     }
  4276 }
  4286 }
  4277 
  4287 
  4278 /*!
  4288 /*!
  4279   Output the "[Xxx instantiates the C++ class QFxXxx]"
  4289   Output the "[Xxx instantiates the C++ class QmlGraphicsXxx]"
  4280   line for the QML element, if there should be one.
  4290   line for the QML element, if there should be one.
  4281 
  4291 
  4282   If there is no class node, or if the class node status
  4292   If there is no class node, or if the class node status
  4283   is set to Node::Internal, do nothing. 
  4293   is set to Node::Internal, do nothing. 
  4284  */
  4294  */
  4304         out() << "</p>";
  4314         out() << "</p>";
  4305     }
  4315     }
  4306 }
  4316 }
  4307 
  4317 
  4308 /*!
  4318 /*!
  4309   Output the "[QFxXxx is instantiated by QML element Xxx]"
  4319   Output the "[QmlGraphicsXxx is instantiated by QML element Xxx]"
  4310   line for the class, if there should be one.
  4320   line for the class, if there should be one.
  4311 
  4321 
  4312   If there is no QML element, or if the class node status
  4322   If there is no QML element, or if the class node status
  4313   is set to Node::Internal, do nothing. 
  4323   is set to Node::Internal, do nothing. 
  4314  */
  4324  */