diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/linguist/lupdate/main.cpp | 2 | ||||
-rw-r--r-- | tools/linguist/shared/qm.cpp | 9 | ||||
-rw-r--r-- | tools/linguist/shared/translatormessage.cpp | 8 | ||||
-rw-r--r-- | tools/qdoc3/cppcodemarker.cpp | 38 | ||||
-rw-r--r-- | tools/qdoc3/cppcodeparser.cpp | 20 | ||||
-rw-r--r-- | tools/qdoc3/node.cpp | 12 | ||||
-rw-r--r-- | tools/qdoc3/node.h | 16 | ||||
-rw-r--r-- | tools/qdoc3/test/qt-build-docs.qdocconf | 2 |
8 files changed, 86 insertions, 21 deletions
diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index 6b554e0..bdaec4f 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -160,6 +160,8 @@ static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFil tor.setCodecName(codecForTr); if (!targetLanguage.isEmpty()) tor.setLanguageCode(targetLanguage); + else + tor.setLanguageCode(Translator::guessLanguageCodeFromFileName(fileName)); if (!sourceLanguage.isEmpty()) tor.setSourceLanguageCode(sourceLanguage); } diff --git a/tools/linguist/shared/qm.cpp b/tools/linguist/shared/qm.cpp index fefe91c..317a07e 100644 --- a/tools/linguist/shared/qm.cpp +++ b/tools/linguist/shared/qm.cpp @@ -440,9 +440,10 @@ void Releaser::insert(const TranslatorMessage &message, bool forceComment) void Releaser::insertIdBased(const TranslatorMessage &message) { QStringList tlns = message.translations(); - for (int i = 0; i < tlns.size(); ++i) - if (tlns.at(i).isEmpty()) - tlns[i] = message.sourceText(); + if (message.type() == TranslatorMessage::Unfinished) + for (int i = 0; i < tlns.size(); ++i) + if (tlns.at(i).isEmpty()) + tlns[i] = message.sourceText(); ByteTranslatorMessage bmsg("", originalBytes(message.id(), false), "", tlns); m_messages.insert(bmsg, 0); } @@ -713,7 +714,7 @@ static bool saveQM(const Translator &translator, QIODevice &dev, ConversionData continue; } if (typ == TranslatorMessage::Unfinished) { - if (msg.translation().isEmpty()) { + if (!cd.m_idBased && msg.translation().isEmpty()) { ++untranslated; continue; } else { diff --git a/tools/linguist/shared/translatormessage.cpp b/tools/linguist/shared/translatormessage.cpp index 417f6b1..db6f333 100644 --- a/tools/linguist/shared/translatormessage.cpp +++ b/tools/linguist/shared/translatormessage.cpp @@ -151,6 +151,7 @@ bool TranslatorMessage::operator==(const TranslatorMessage& m) const return (m_context == m.m_context) && m_sourcetext == m.m_sourcetext && m_extra[msgIdPlural] == m.m_extra[msgIdPlural] + && m_id == m.m_id && (m_sourcetext.isEmpty() || m_comment == m.m_comment); } @@ -161,7 +162,9 @@ bool TranslatorMessage::operator<(const TranslatorMessage& m) const return m_context < m.m_context; if (m_sourcetext != m.m_sourcetext) return m_sourcetext < m.m_sourcetext; - return m_comment < m.m_comment; + if (m_comment != m.m_comment) + return m_comment < m.m_comment; + return m_id < m.m_id; } int qHash(const TranslatorMessage &msg) @@ -170,7 +173,8 @@ int qHash(const TranslatorMessage &msg) qHash(msg.context()) ^ qHash(msg.sourceText()) ^ qHash(msg.extra(QLatin1String("po-msgid_plural"))) ^ - qHash(msg.comment()); + qHash(msg.comment()) ^ + qHash(msg.id()); } bool TranslatorMessage::hasExtra(const QString &key) const diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index 36293f8..a32f92b 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -1120,10 +1120,18 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, "QML Signals", "signal", "signals"); + FastSection qmlattachedsignals(qmlClassNode, + "QML Attached Signals", + "signal", + "signals"); FastSection qmlmethods(qmlClassNode, "QML Methods", "method", "methods"); + FastSection qmlattachedmethods(qmlClassNode, + "QML Attached Methods", + "method", + "methods"); NodeList::ConstIterator c = qmlClassNode->childNodes().begin(); while (c != qmlClassNode->childNodes().end()) { @@ -1142,23 +1150,35 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, } } else if ((*c)->type() == Node::QmlSignal) { - insert(qmlsignals,*c,style,Okay); + const QmlSignalNode* sn = static_cast<const QmlSignalNode*>(*c); + if (sn->isAttached()) + insert(qmlattachedsignals,*c,style,Okay); + else + insert(qmlsignals,*c,style,Okay); } else if ((*c)->type() == Node::QmlMethod) { - insert(qmlmethods,*c,style,Okay); + const QmlMethodNode* mn = static_cast<const QmlMethodNode*>(*c); + if (mn->isAttached()) + insert(qmlattachedmethods,*c,style,Okay); + else + insert(qmlmethods,*c,style,Okay); } ++c; } append(sections,qmlproperties); append(sections,qmlattachedproperties); append(sections,qmlsignals); + append(sections,qmlattachedsignals); append(sections,qmlmethods); + append(sections,qmlattachedmethods); } else if (style == Detailed) { FastSection qmlproperties(qmlClassNode,"QML Property Documentation"); FastSection qmlattachedproperties(qmlClassNode,"QML Attached Property Documentation"); FastSection qmlsignals(qmlClassNode,"QML Signal Documentation"); + FastSection qmlattachedsignals(qmlClassNode,"QML Attached Signal Documentation"); FastSection qmlmethods(qmlClassNode,"QML Method Documentation"); + FastSection qmlattachedmethods(qmlClassNode,"QML Attached Method Documentation"); NodeList::ConstIterator c = qmlClassNode->childNodes().begin(); while (c != qmlClassNode->childNodes().end()) { if ((*c)->subType() == Node::QmlPropertyGroup) { @@ -1169,17 +1189,27 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, insert(qmlproperties,*c,style,Okay); } else if ((*c)->type() == Node::QmlSignal) { - insert(qmlsignals,*c,style,Okay); + const QmlSignalNode* sn = static_cast<const QmlSignalNode*>(*c); + if (sn->isAttached()) + insert(qmlattachedsignals,*c,style,Okay); + else + insert(qmlsignals,*c,style,Okay); } else if ((*c)->type() == Node::QmlMethod) { - insert(qmlmethods,*c,style,Okay); + const QmlMethodNode* mn = static_cast<const QmlMethodNode*>(*c); + if (mn->isAttached()) + insert(qmlattachedmethods,*c,style,Okay); + else + insert(qmlmethods,*c,style,Okay); } ++c; } append(sections,qmlproperties); append(sections,qmlattachedproperties); append(sections,qmlsignals); + append(sections,qmlattachedsignals); append(sections,qmlmethods); + append(sections,qmlattachedmethods); } } diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index ad43b2b..84ec3f4 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -91,7 +91,9 @@ QT_BEGIN_NAMESPACE #define COMMAND_QMLATTACHEDPROPERTY Doc::alias("qmlattachedproperty") #define COMMAND_QMLINHERITS Doc::alias("inherits") #define COMMAND_QMLSIGNAL Doc::alias("qmlsignal") +#define COMMAND_QMLATTACHEDSIGNAL Doc::alias("qmlattachedsignal") #define COMMAND_QMLMETHOD Doc::alias("qmlmethod") +#define COMMAND_QMLATTACHEDMETHOD Doc::alias("qmlattachedmethod") #define COMMAND_QMLDEFAULT Doc::alias("default") #endif @@ -485,7 +487,9 @@ QSet<QString> CppCodeParser::topicCommands() << COMMAND_QMLPROPERTY << COMMAND_QMLATTACHEDPROPERTY << COMMAND_QMLSIGNAL - << COMMAND_QMLMETHOD; + << COMMAND_QMLATTACHEDSIGNAL + << COMMAND_QMLMETHOD + << COMMAND_QMLATTACHEDMETHOD; #else << COMMAND_VARIABLE; #endif @@ -678,7 +682,9 @@ Node *CppCodeParser::processTopicCommand(const Doc& doc, return new QmlClassNode(tre->root(), names[0], classNode); } else if ((command == COMMAND_QMLSIGNAL) || - (command == COMMAND_QMLMETHOD)) { + (command == COMMAND_QMLMETHOD) || + (command == COMMAND_QMLATTACHEDSIGNAL) || + (command == COMMAND_QMLATTACHEDMETHOD)) { QString element; QString name; QmlClassNode* qmlClass = 0; @@ -687,9 +693,15 @@ Node *CppCodeParser::processTopicCommand(const Doc& doc, if (n && n->subType() == Node::QmlClass) { qmlClass = static_cast<QmlClassNode*>(n); if (command == COMMAND_QMLSIGNAL) - return new QmlSignalNode(qmlClass,name); + return new QmlSignalNode(qmlClass,name,false); + else if (command == COMMAND_QMLATTACHEDSIGNAL) + return new QmlSignalNode(qmlClass,name,true); + else if (command == COMMAND_QMLMETHOD) + return new QmlMethodNode(qmlClass,name,false); + else if (command == COMMAND_QMLATTACHEDMETHOD) + return new QmlMethodNode(qmlClass,name,true); else - return new QmlMethodNode(qmlClass,name); + return 0; // never get here. } } } diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index 49f2cc9..61855bc 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -1210,8 +1210,10 @@ bool QmlPropertyNode::fromTrool(Trool troolean, bool defaultValue) /*! Constructor for the QML signal node. */ -QmlSignalNode::QmlSignalNode(QmlClassNode *parent, const QString& name) - : LeafNode(QmlSignal, parent, name) +QmlSignalNode::QmlSignalNode(QmlClassNode *parent, + const QString& name, + bool attached) + : LeafNode(QmlSignal, parent, name), att(attached) { // nothing. } @@ -1219,8 +1221,10 @@ QmlSignalNode::QmlSignalNode(QmlClassNode *parent, const QString& name) /*! Constructor for the QML method node. */ -QmlMethodNode::QmlMethodNode(QmlClassNode *parent, const QString& name) - : LeafNode(QmlMethod, parent, name) +QmlMethodNode::QmlMethodNode(QmlClassNode *parent, + const QString& name, + bool attached) + : LeafNode(QmlMethod, parent, name), att(attached) { // nothing. } diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index fed4ea1..20ccb95 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -420,19 +420,31 @@ class QmlPropertyNode : public LeafNode class QmlSignalNode : public LeafNode { public: - QmlSignalNode(QmlClassNode* parent, const QString& name); + QmlSignalNode(QmlClassNode* parent, + const QString& name, + bool attached); virtual ~QmlSignalNode() { } const QString& element() const { return parent()->name(); } + bool isAttached() const { return att; } + + private: + bool att; }; class QmlMethodNode : public LeafNode { public: - QmlMethodNode(QmlClassNode* parent, const QString& name); + QmlMethodNode(QmlClassNode* parent, + const QString& name, + bool attached); virtual ~QmlMethodNode() { } const QString& element() const { return parent()->name(); } + bool isAttached() const { return att; } + + private: + bool att; }; #endif diff --git a/tools/qdoc3/test/qt-build-docs.qdocconf b/tools/qdoc3/test/qt-build-docs.qdocconf index 8da7442..d1733e5 100644 --- a/tools/qdoc3/test/qt-build-docs.qdocconf +++ b/tools/qdoc3/test/qt-build-docs.qdocconf @@ -8,7 +8,7 @@ project = Qt description = Qt Reference Documentation url = http://qt.nokia.com/doc/4.6 -edition.Desktop.modules = QtCore QtDBus QtGui QtNetwork QtOpenGL QtScript QtSql QtSvg \ +edition.Desktop.modules = QtCore QtDBus QtGui QtNetwork QtOpenGL QtScript QtScriptTools QtSql QtSvg \ QtWebKit QtXml QtXmlPatterns Qt3Support QtHelp \ QtDesigner QtAssistant QAxContainer Phonon \ QAxServer QtUiTools QtTest QtDBus |