summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDavid Boddie <dboddie@trolltech.com>2010-06-18 11:34:11 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2010-06-18 11:34:11 (GMT)
commit678d6044cb82b59e2a3747a24f5d70a58f5cf127 (patch)
tree811af412e92ce107222f57e80816faab3963655b /tools
parent68073bbcde2d1b12d36f0c58aab1fc20f02ab967 (diff)
parent81b03ee252a22c9b053c376302428e5430523900 (diff)
downloadQt-678d6044cb82b59e2a3747a24f5d70a58f5cf127.zip
Qt-678d6044cb82b59e2a3747a24f5d70a58f5cf127.tar.gz
Qt-678d6044cb82b59e2a3747a24f5d70a58f5cf127.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/dboddies-oslo-staging-1-qdoc into 4.7
Diffstat (limited to 'tools')
-rw-r--r--tools/qdoc3/ditaxmlgenerator.cpp227
-rw-r--r--tools/qdoc3/ditaxmlgenerator.h22
-rw-r--r--tools/qdoc3/node.cpp14
-rw-r--r--tools/qdoc3/node.h7
-rw-r--r--tools/qml/deviceorientation_maemo.cpp123
-rw-r--r--tools/qml/main.cpp7
-rw-r--r--tools/qml/qml.pri1
7 files changed, 313 insertions, 88 deletions
diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp
index 197bc13..5f10885 100644
--- a/tools/qdoc3/ditaxmlgenerator.cpp
+++ b/tools/qdoc3/ditaxmlgenerator.cpp
@@ -501,19 +501,18 @@ QString DitaXmlGenerator::format()
}
/*!
- Create a new GUID, write it to the XML stream
- as an "id" attribute, and return it.
+ Calls lookupGuid() to get a GUID for \a text, then writes
+ it to the XML stream as an "id" attribute, and returns it.
*/
QString DitaXmlGenerator::writeGuidAttribute(QString text)
{
- QString guid = QUuid::createUuid().toString();
- name2guidMap.insert(text,guid);
+ QString guid = lookupGuid(text);
writer.writeAttribute("id",guid);
return guid;
}
/*!
- Looks up \a text in the GUID map. It it finds \a text,
+ Looks up \a text in the GUID map. If it finds \a text,
it returns the associated GUID. Otherwise it inserts
\a text into the map with a new GUID, and it returns
the new GUID.
@@ -1436,6 +1435,12 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark
writer.writeStartElement(CXXCLASSACCESSSPECIFIER);
writer.writeAttribute("value",inner->accessString());
writer.writeEndElement(); // <cxxClassAccessSpecifier>
+ if (cn->isAbstract()) {
+ writer.writeStartElement(CXXCLASSABSTRACT);
+ writer.writeAttribute("name","abstract");
+ writer.writeAttribute("value","abstract");
+ writer.writeEndElement(); // </cxxClassAbstract>
+ }
writeDerivations(cn, marker);
writeLocation(cn, marker);
writer.writeEndElement(); // <cxxClassDefinition>
@@ -1452,6 +1457,26 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark
writer.writeEndElement(); // </apiDesc>
writer.writeEndElement(); // </cxxClassDetail>
+
+ sections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay);
+ s = sections.begin();
+ while (s != sections.end()) {
+ if ((*s).name == "Member Function Documentation") {
+ writeFunctions((*s),cn,marker);
+ }
+ else if ((*s).name == "Member Type Documentation") {
+ writeNestedClasses((*s),cn,marker);
+ writeEnumerations((*s),cn,marker);
+ writeTypedefs((*s),cn,marker);
+ }
+ else if ((*s).name == "Member Variable Documentation") {
+ writeDataMembers((*s),cn,marker);
+ }
+ else if ((*s).name == "Property Documentation") {
+ writeProperties((*s),cn,marker);
+ }
+ ++s;
+ }
writer.writeEndElement(); // </cxxClass>
}
@@ -4475,6 +4500,31 @@ void DitaXmlGenerator::generatePageIndex(const QString& fileName, CodeMarker* ma
#endif
+/*!
+ Return the full qualification of the node \a n, but without
+ the name of \a n itself. e.g. A::B::C
+ */
+QString DitaXmlGenerator::fullQualification(const Node* n)
+{
+ QString fq;
+ InnerNode* in = n->parent();
+ while (in) {
+ if ((in->type() == Node::Class) ||
+ (in->type() == Node::Namespace)) {
+ if (in->name().isEmpty())
+ break;
+ if (fq.isEmpty())
+ fq = in->name();
+ else
+ fq = in->name() + "::" + fq;
+ }
+ else
+ break;
+ in = in->parent();
+ }
+ return fq;
+}
+
void DitaXmlGenerator::writeDerivations(const ClassNode* cn, CodeMarker* marker)
{
QList<RelatedClass>::ConstIterator r;
@@ -4502,19 +4552,168 @@ void DitaXmlGenerator::writeDerivations(const ClassNode* cn, CodeMarker* marker)
}
}
-void DitaXmlGenerator::writeLocation(const ClassNode* cn, CodeMarker* marker)
+void DitaXmlGenerator::writeLocation(const Node* n, CodeMarker* marker)
{
- writer.writeStartElement(CXXCLASSAPIITEMLOCATION);
- writer.writeStartElement(CXXCLASSDECLARATIONFILE);
+ QString s1, s2, s3;
+ if (n->type() == Node::Class) {
+ s1 = CXXCLASSAPIITEMLOCATION;
+ s2 = CXXCLASSDECLARATIONFILE;
+ s3 = CXXCLASSDECLARATIONFILELINE;
+ }
+ else if (n->type() == Node::Function) {
+ s1 = CXXFUNCTIONAPIITEMLOCATION;
+ s2 = CXXFUNCTIONDECLARATIONFILE;
+ s3 = CXXFUNCTIONDECLARATIONFILELINE;
+ }
+ writer.writeStartElement(s1);
+ writer.writeStartElement(s2);
writer.writeAttribute("name","filePath");
- writer.writeAttribute("value",cn->location().filePath());
- writer.writeEndElement(); // </cxxClassDeclarationFile>
- writer.writeStartElement(CXXCLASSDECLARATIONFILELINE);
+ writer.writeAttribute("value",n->location().filePath());
+ writer.writeEndElement(); // </cxx<s2>DeclarationFile>
+ writer.writeStartElement(s3);
writer.writeAttribute("name","lineNumber");
QString lineNr;
- writer.writeAttribute("value",lineNr.setNum(cn->location().lineNo()));
- writer.writeEndElement(); // </cxxClassDeclarationFileLine>
- writer.writeEndElement(); // </cxxClassApiItemLocation>
+ writer.writeAttribute("value",lineNr.setNum(n->location().lineNo()));
+ writer.writeEndElement(); // </cxx<s3>DeclarationFileLine>
+ writer.writeEndElement(); // </cxx<s1>ApiItemLocation>
+}
+
+void DitaXmlGenerator::writeFunctions(const Section& s,
+ const ClassNode* cn,
+ CodeMarker* marker)
+{
+ NodeList::ConstIterator m = s.members.begin();
+ while (m != s.members.end()) {
+ if ((*m)->type() == Node::Function) {
+ const FunctionNode* fn = reinterpret_cast<const FunctionNode*>(*m);
+ QString name = fn->name();
+ writer.writeStartElement(CXXFUNCTION);
+ writeGuidAttribute(name);
+ writer.writeStartElement(APINAME);
+ writer.writeCharacters(name);
+ writer.writeEndElement(); // </apiName>
+ generateBrief(fn,marker);
+ writer.writeStartElement(CXXFUNCTIONDETAIL);
+ writer.writeStartElement(CXXFUNCTIONDEFINITION);
+ writer.writeStartElement(CXXFUNCTIONACCESSSPECIFIER);
+ writer.writeAttribute("value",fn->accessString());
+ writer.writeEndElement(); // <cxxFunctionAccessSpecifier>
+
+ if (fn->isStatic()) {
+ writer.writeStartElement(CXXFUNCTIONSTORAGECLASSSPECIFIERSTATIC);
+ writer.writeAttribute("name","static");
+ writer.writeAttribute("value","static");
+ writer.writeEndElement(); // <cxxFunctionStorageClassSpecifierStatic>
+ }
+
+ if (fn->isConst()) {
+ writer.writeStartElement(CXXFUNCTIONCONST);
+ writer.writeAttribute("name","const");
+ writer.writeAttribute("value","const");
+ writer.writeEndElement(); // <cxxFunctionConst>
+ }
+
+ if (fn->virtualness() != FunctionNode::NonVirtual) {
+ writer.writeStartElement(CXXFUNCTIONVIRTUAL);
+ writer.writeAttribute("name","virtual");
+ writer.writeAttribute("value","virtual");
+ writer.writeEndElement(); // <cxxFunctionVirtual>
+ if (fn->virtualness() == FunctionNode::PureVirtual) {
+ writer.writeStartElement(CXXFUNCTIONPUREVIRTUAL);
+ writer.writeAttribute("name","pure virtual");
+ writer.writeAttribute("value","pure virtual");
+ writer.writeEndElement(); // <cxxFunctionPureVirtual>
+ }
+ }
+
+ if (fn->name() == cn->name()) {
+ writer.writeStartElement(CXXFUNCTIONCONSTRUCTOR);
+ writer.writeAttribute("name","constructor");
+ writer.writeAttribute("value","constructor");
+ writer.writeEndElement(); // <cxxFunctionConstructor>
+ }
+ else if (fn->name()[0] == QChar('~')) {
+ writer.writeStartElement(CXXFUNCTIONDESTRUCTOR);
+ writer.writeAttribute("name","destructor");
+ writer.writeAttribute("value","destructor");
+ writer.writeEndElement(); // <cxxFunctionDestructor>
+ }
+ else {
+ writer.writeStartElement(CXXFUNCTIONDECLAREDTYPE);
+ writer.writeCharacters(fn->returnType());
+ writer.writeEndElement(); // <cxxFunctionDeclaredType>
+ }
+ QString fq = fullQualification(fn);
+ if (!fq.isEmpty()) {
+ writer.writeStartElement(CXXFUNCTIONSCOPEDNAME);
+ writer.writeCharacters(fq);
+ writer.writeEndElement(); // <cxxFunctionScopedName>
+ }
+ writer.writeStartElement(CXXFUNCTIONPROTOTYPE);
+ writer.writeCharacters(fn->signature(true));
+ writer.writeEndElement(); // <cxxFunctionPrototype>
+
+ QString fnl = fn->signature(false);
+ int idx = fnl.indexOf(' ');
+ if (idx < 0)
+ idx = 0;
+ else
+ ++idx;
+ fnl = fn->parent()->name() + "::" + fnl.mid(idx);
+ writer.writeStartElement(CXXFUNCTIONNAMELOOKUP);
+ writer.writeCharacters(fnl);
+ writer.writeEndElement(); // <cxxFunctionNameLookup>
+
+ writeLocation(fn, marker);
+ writer.writeEndElement(); // <cxxFunctionDefinition>
+ writer.writeStartElement(APIDESC);
+
+ if (!fn->doc().isEmpty()) {
+ generateBody(fn, marker);
+ // generateAlsoList(inner, marker);
+ }
+
+ writer.writeEndElement(); // </apiDesc>
+ writer.writeEndElement(); // </cxxFunctionDetail>
+ writer.writeEndElement(); // </cxxFunction>
+
+ if (fn->metaness() == FunctionNode::Ctor ||
+ fn->metaness() == FunctionNode::Dtor ||
+ fn->overloadNumber() != 1) {
+ }
+ }
+ ++m;
+ }
+}
+
+void DitaXmlGenerator::writeNestedClasses(const Section& s,
+ const ClassNode* cn,
+ CodeMarker* marker)
+{
+}
+
+void DitaXmlGenerator::writeEnumerations(const Section& s,
+ const ClassNode* cn,
+ CodeMarker* marker)
+{
+}
+
+void DitaXmlGenerator::writeTypedefs(const Section& s,
+ const ClassNode* cn,
+ CodeMarker* marker)
+{
+}
+
+void DitaXmlGenerator::writeDataMembers(const Section& s,
+ const ClassNode* cn,
+ CodeMarker* marker)
+{
+}
+
+void DitaXmlGenerator::writeProperties(const Section& s,
+ const ClassNode* cn,
+ CodeMarker* marker)
+{
}
QT_END_NAMESPACE
diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h
index 070329b..71304b3 100644
--- a/tools/qdoc3/ditaxmlgenerator.h
+++ b/tools/qdoc3/ditaxmlgenerator.h
@@ -110,8 +110,28 @@ class DitaXmlGenerator : public PageGenerator
virtual QString linkForNode(const Node *node, const Node *relative);
virtual QString refForAtom(Atom *atom, const Node *node);
+ QString fullQualification(const Node* n);
+
void writeDerivations(const ClassNode* cn, CodeMarker* marker);
- void writeLocation(const ClassNode* cn, CodeMarker* marker);
+ void writeLocation(const Node* n, CodeMarker* marker);
+ void writeFunctions(const Section& s,
+ const ClassNode* cn,
+ CodeMarker* marker);
+ void writeNestedClasses(const Section& s,
+ const ClassNode* cn,
+ CodeMarker* marker);
+ void writeEnumerations(const Section& s,
+ const ClassNode* cn,
+ CodeMarker* marker);
+ void writeTypedefs(const Section& s,
+ const ClassNode* cn,
+ CodeMarker* marker);
+ void writeDataMembers(const Section& s,
+ const ClassNode* cn,
+ CodeMarker* marker);
+ void writeProperties(const Section& s,
+ const ClassNode* cn,
+ CodeMarker* marker);
private:
enum SubTitleSize { SmallSubTitle, LargeSubTitle };
diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp
index 6a87639..c7a073c 100644
--- a/tools/qdoc3/node.cpp
+++ b/tools/qdoc3/node.cpp
@@ -789,6 +789,7 @@ ClassNode::ClassNode(InnerNode *parent, const QString& name)
: InnerNode(Class, parent, name)
{
hidden = false;
+ abstract = false;
setPageType(ApiPage);
}
@@ -1086,6 +1087,19 @@ FunctionNode::FunctionNode(Type type, InnerNode *parent, const QString& name, bo
}
/*!
+ Sets the \a virtualness of this function. If the \a virtualness
+ is PureVirtual, and if the parent() is a ClassNode, set the parent's
+ \e abstract flag to true.
+ */
+void FunctionNode::setVirtualness(Virtualness virtualness)
+{
+ vir = virtualness;
+ if ((virtualness == PureVirtual) && parent() &&
+ (parent()->type() == Node::Class))
+ parent()->setAbstract(true);
+}
+
+/*!
*/
void FunctionNode::setOverload(bool overlode)
{
diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h
index 90295ee..af7596b 100644
--- a/tools/qdoc3/node.h
+++ b/tools/qdoc3/node.h
@@ -261,6 +261,8 @@ class InnerNode : public Node
QStringList secondaryKeys();
const QStringList& pageKeywords() const { return pageKeywds; }
virtual void addPageKeywords(const QString& t) { pageKeywds << t; }
+ virtual bool isAbstract() const { return false; }
+ virtual void setAbstract(bool ) { }
protected:
InnerNode(Type type, InnerNode *parent, const QString& name);
@@ -341,11 +343,14 @@ class ClassNode : public InnerNode
void setServiceName(const QString& value) { sname = value; }
QString qmlElement() const { return qmlelement; }
void setQmlElement(const QString& value) { qmlelement = value; }
+ virtual bool isAbstract() const { return abstract; }
+ virtual void setAbstract(bool b) { abstract = b; }
private:
QList<RelatedClass> bas;
QList<RelatedClass> der;
bool hidden;
+ bool abstract;
QString sname;
QString qmlelement;
};
@@ -582,7 +587,7 @@ class FunctionNode : public LeafNode
void setReturnType(const QString& returnType) { rt = returnType; }
void setParentPath(const QStringList& parentPath) { pp = parentPath; }
void setMetaness(Metaness metaness) { met = metaness; }
- void setVirtualness(Virtualness virtualness) { vir = virtualness; }
+ void setVirtualness(Virtualness virtualness);
void setConst(bool conste) { con = conste; }
void setStatic(bool statique) { sta = statique; }
void setOverload(bool overlode);
diff --git a/tools/qml/deviceorientation_maemo.cpp b/tools/qml/deviceorientation_maemo.cpp
index 7948e2a..443edc8 100644
--- a/tools/qml/deviceorientation_maemo.cpp
+++ b/tools/qml/deviceorientation_maemo.cpp
@@ -40,100 +40,87 @@
****************************************************************************/
#include "deviceorientation.h"
-#include <stdio.h>
-#include <stdlib.h>
+#include <QtDBus>
+
+#include <mce/mode-names.h>
+#include <mce/dbus-names.h>
class MaemoOrientation : public DeviceOrientation
{
Q_OBJECT
public:
MaemoOrientation()
- : DeviceOrientation(),m_current(Portrait), m_lastSeen(Portrait), m_lastSeenCount(0)
+ : o(UnknownOrientation)
{
- m_current = get();
- if (m_current == UnknownOrientation)
- m_current = Portrait;
+ // enable the orientation sensor
+ QDBusConnection::systemBus().call(
+ QDBusMessage::createMethodCall(MCE_SERVICE, MCE_REQUEST_PATH,
+ MCE_REQUEST_IF, MCE_ACCELEROMETER_ENABLE_REQ));
+
+ // query the initial orientation
+ QDBusMessage reply = QDBusConnection::systemBus().call(
+ QDBusMessage::createMethodCall(MCE_SERVICE, MCE_REQUEST_PATH,
+ MCE_REQUEST_IF, MCE_DEVICE_ORIENTATION_GET));
+ if (reply.type() == QDBusMessage::ErrorMessage) {
+ qWarning("Unable to retrieve device orientation: %s", qPrintable(reply.errorMessage()));
+ } else {
+ o = toOrientation(reply.arguments().value(0).toString());
+ }
- startTimer(100);
+ // connect to the orientation change signal
+ QDBusConnection::systemBus().connect(QString(), MCE_SIGNAL_PATH, MCE_SIGNAL_IF,
+ MCE_DEVICE_ORIENTATION_SIG,
+ this,
+ SLOT(deviceOrientationChanged(QString)));
}
- Orientation orientation() const {
- return m_current;
+ ~MaemoOrientation()
+ {
+ // disable the orientation sensor
+ QDBusConnection::systemBus().call(
+ QDBusMessage::createMethodCall(MCE_SERVICE, MCE_REQUEST_PATH,
+ MCE_REQUEST_IF, MCE_ACCELEROMETER_DISABLE_REQ));
}
- void setOrientation(Orientation) { }
-
-protected:
- virtual void timerEvent(QTimerEvent *)
+ inline Orientation orientation() const
{
- Orientation c = get();
-
- if (c == m_lastSeen) {
- m_lastSeenCount++;
- } else {
- m_lastSeenCount = 0;
- m_lastSeen = c;
- }
-
- if (m_lastSeen != UnknownOrientation && m_lastSeen != m_current && m_lastSeenCount > 4) {
- m_current = m_lastSeen;
- emit orientationChanged();
- printf("%d\n", m_current);
- }
+ return o;
}
-signals:
- void changed();
-
-private:
- Orientation m_current;
- Orientation m_lastSeen;
- int m_lastSeenCount;
-
- Orientation get()
+ void setOrientation(Orientation o)
{
- Orientation o = UnknownOrientation;
-
- int ax, ay, az;
-
- read(&ax, &ay, &az);
+ }
- if (abs(az) > 850) {
- o = UnknownOrientation;
- } else if (ax < -750) {
- o = Portrait;
- } else if (ax > 750) {
- o = PortraitInverted;
- } else if (ay < -750) {
- o = Landscape;
- } else if (ay > 750) {
- o = LandscapeInverted;
- }
+private Q_SLOTS:
+ void deviceOrientationChanged(const QString &newOrientation)
+ {
+ o = toOrientation(newOrientation);
- return o;
+ emit orientationChanged();
+// printf("%d\n", o);
}
- int read(int *ax,int *ay,int *az)
+private:
+ static Orientation toOrientation(const QString &nativeOrientation)
{
- static const char *accel_filename = "/sys/class/i2c-adapter/i2c-3/3-001d/coord";
-
- FILE *fd;
- int rs;
- fd = fopen(accel_filename, "r");
- if(fd==NULL){ printf("liqaccel, cannot open for reading\n"); return -1;}
- rs=fscanf((FILE*) fd,"%i %i %i",ax,ay,az);
- fclose(fd);
- if(rs != 3){ printf("liqaccel, cannot read information\n"); return -2;}
- return 0;
+ if (nativeOrientation == MCE_ORIENTATION_LANDSCAPE)
+ return Landscape;
+ else if (nativeOrientation == MCE_ORIENTATION_LANDSCAPE_INVERTED)
+ return LandscapeInverted;
+ else if (nativeOrientation == MCE_ORIENTATION_PORTRAIT)
+ return Portrait;
+ else if (nativeOrientation == MCE_ORIENTATION_PORTRAIT_INVERTED)
+ return PortraitInverted;
+ return UnknownOrientation;
}
-};
+private:
+ Orientation o;
+};
DeviceOrientation* DeviceOrientation::instance()
{
- static MaemoOrientation *o = 0;
- if (!o)
- o = new MaemoOrientation;
+ static MaemoOrientation *o = new MaemoOrientation;
return o;
}
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp
index 0cce1cc..a75023b 100644
--- a/tools/qml/main.cpp
+++ b/tools/qml/main.cpp
@@ -347,8 +347,9 @@ int main(int argc, char ** argv)
wflags |= Qt::WindowStaysOnTopHint;
QDeclarativeViewer *viewer = new QDeclarativeViewer(0, wflags);
+ viewer->setAttribute(Qt::WA_DeleteOnClose, true);
if (!scriptopts.isEmpty()) {
- QStringList options =
+ QStringList options =
scriptopts.split(QLatin1Char(','), QString::SkipEmptyParts);
QDeclarativeViewer::ScriptOptions scriptOptions = 0;
@@ -451,7 +452,5 @@ int main(int argc, char ** argv)
viewer->setUseGL(useGL);
viewer->raise();
- int rv = app.exec();
- delete viewer;
- exit(rv);
+ return app.exec();
}
diff --git a/tools/qml/qml.pri b/tools/qml/qml.pri
index cff65be..58d8cc1 100644
--- a/tools/qml/qml.pri
+++ b/tools/qml/qml.pri
@@ -18,6 +18,7 @@ SOURCES += $$PWD/qmlruntime.cpp \
RESOURCES = $$PWD/qmlruntime.qrc
maemo5 {
+ QT += dbus
SOURCES += $$PWD/deviceorientation_maemo.cpp
} else {
SOURCES += $$PWD/deviceorientation.cpp