From 15394b8a8a8efa27e7deef43dc9ba6067bb743a1 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 16 Mar 2011 18:03:23 +0100 Subject: Doc: Squashed commit of Roland Wolf's threading tutorial. --- doc/src/getting-started/tutorials.qdoc | 2 +- doc/src/howtos/scalabilityintro.qdoc | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/src/getting-started/tutorials.qdoc b/doc/src/getting-started/tutorials.qdoc index 9fc6699..bf86e08 100644 --- a/doc/src/getting-started/tutorials.qdoc +++ b/doc/src/getting-started/tutorials.qdoc @@ -61,7 +61,7 @@ \o{2,1} \l{A Quick Start to Qt Designer}{\bold{Qt Designer}} \o{2,1} \l{Qt Linguist Manual: Programmers#Tutorials}{\bold {Qt Linguist}} \row - \o \image designer-examples.png + \o \image designer-examples.png QtDesigner \o A quick guide through \QD showing the basic steps to create a form with this interactive tool. diff --git a/doc/src/howtos/scalabilityintro.qdoc b/doc/src/howtos/scalabilityintro.qdoc index 5b4e58b..b1d9c19 100644 --- a/doc/src/howtos/scalabilityintro.qdoc +++ b/doc/src/howtos/scalabilityintro.qdoc @@ -198,11 +198,11 @@ \list \o \l{Item::anchors.top}{anchors} within an Item \o \l{Row} / \l{Column} / \l{Grid} - \o simple javascript expressions such as width: Math.round(parent.width / 3.0). + \o simple JavaScript expressions such as width: Math.round(parent.width / 3.0). \endlist These basic building blocks, along with the powerful evaluation - capabilities of javascript expressions within every QML binding, + capabilities of JavaScript expressions within every QML binding, are designed to allow the majority of the layout structure definition to be defined in a Device Profile independent way. @@ -214,14 +214,14 @@ container. By combining the features of the layout managers with simple - javascript expressions, a richer variety of designs can be + JavaScript expressions, a richer variety of designs can be expressed, without having to resort to additional layout measurement parameters or measurement values. Here are some things not to do with layouts: \list - \o Don't define complex javascript functions that are regularly + \o Don't define complex JavaScript functions that are regularly evaluated. This will cause poor performance, particularly during animated transitions. \o Don't define all of your layouts using x, y, width and @@ -275,7 +275,7 @@ by the top level orientation change), in the case of anchor layouts, AnchorAnimation elements can be used to control the transitions. In some cases, you can also use a NumberAnimation on - e.g. the width of an item. Remember to avoid complex javascript + e.g. the width of an item. Remember to avoid complex JavaScript calculations during each frame of animation. Using simple anchor definitions and anchor animations can help with this in the majority of cases. -- cgit v0.12 From 1e4f865df3bdfb15a0d4839274aa58ae23e9c325 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 25 Mar 2011 13:51:59 +0100 Subject: Removed some links and prettified others. --- tools/qdoc3/htmlgenerator.cpp | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index d1d1561..a4300b8 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -1605,7 +1605,10 @@ void HtmlGenerator::generateBreadCrumbs(const QString &title, const ClassNode *cn = static_cast(node); QString name = node->moduleName(); breadcrumbs << Atom(Atom::ListItemLeft) - << Atom(Atom::AutoLink, QLatin1String("Modules")) + << Atom(Atom::Link, QLatin1String("All Modules")) + << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) + << Atom(Atom::String, QLatin1String("Modules")) + << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) << Atom(Atom::ListItemRight); if (!name.isEmpty()) breadcrumbs << Atom(Atom::ListItemLeft) @@ -1620,7 +1623,10 @@ void HtmlGenerator::generateBreadCrumbs(const QString &title, const FakeNode* fn = static_cast(node); if (node->subType() == Node::Module) { breadcrumbs << Atom(Atom::ListItemLeft) - << Atom(Atom::AutoLink, QLatin1String("Modules")) + << Atom(Atom::Link, QLatin1String("All Modules")) + << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) + << Atom(Atom::String, QLatin1String("Modules")) + << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) << Atom(Atom::ListItemRight); QString name = node->name(); if (!name.isEmpty()) @@ -1630,9 +1636,7 @@ void HtmlGenerator::generateBreadCrumbs(const QString &title, } else if (node->subType() == Node::Group) { if (fn->name() == QString("modules")) - breadcrumbs << Atom(Atom::ListItemLeft) - << Atom(Atom::AutoLink, QLatin1String("Modules")) - << Atom(Atom::ListItemRight); + breadcrumbs << Atom(Atom::String, QLatin1String("Modules")); else breadcrumbs << Atom(Atom::ListItemLeft) << Atom(Atom::String, protectEnc(title)) @@ -1641,7 +1645,10 @@ void HtmlGenerator::generateBreadCrumbs(const QString &title, else if (node->subType() == Node::Page) { if (fn->name() == QString("qdeclarativeexamples.html")) { breadcrumbs << Atom(Atom::ListItemLeft) - << Atom(Atom::AutoLink, QLatin1String("Examples")) + << Atom(Atom::Link, QLatin1String("Qt Examples")) + << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) + << Atom(Atom::String, QLatin1String("Examples")) + << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) << Atom(Atom::ListItemRight); breadcrumbs << Atom(Atom::ListItemLeft) << Atom(Atom::AutoLink, QLatin1String("QML Examples & Demos")) @@ -1649,16 +1656,17 @@ void HtmlGenerator::generateBreadCrumbs(const QString &title, } else if (fn->name().startsWith("examples-")) { breadcrumbs << Atom(Atom::ListItemLeft) - << Atom(Atom::AutoLink, QLatin1String("Examples")) + << Atom(Atom::Link, QLatin1String("Qt Examples")) + << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) + << Atom(Atom::String, QLatin1String("Examples")) + << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) << Atom(Atom::ListItemRight); breadcrumbs << Atom(Atom::ListItemLeft) << Atom(Atom::String, protectEnc(title)) << Atom(Atom::ListItemRight); } else if (fn->name() == QString("namespaces.html")) - breadcrumbs << Atom(Atom::ListItemLeft) - << Atom(Atom::AutoLink, QLatin1String("Namespaces")) - << Atom(Atom::ListItemRight); + breadcrumbs << Atom(Atom::String, QLatin1String("Namespaces")); else breadcrumbs << Atom(Atom::ListItemLeft) << Atom(Atom::String, protectEnc(title)) @@ -1674,7 +1682,10 @@ void HtmlGenerator::generateBreadCrumbs(const QString &title, } else if (node->subType() == Node::Example) { breadcrumbs << Atom(Atom::ListItemLeft) - << Atom(Atom::AutoLink, QLatin1String("Examples")) + << Atom(Atom::Link, QLatin1String("Qt Examples")) + << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) + << Atom(Atom::String, QLatin1String("Examples")) + << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) << Atom(Atom::ListItemRight); QStringList sl = fn->name().split('/'); if (sl.contains("declarative")) @@ -1692,7 +1703,10 @@ void HtmlGenerator::generateBreadCrumbs(const QString &title, } else if (node->type() == Node::Namespace) { breadcrumbs << Atom(Atom::ListItemLeft) - << Atom(Atom::AutoLink, QLatin1String("Namespaces")) + << Atom(Atom::Link, QLatin1String("All Namespaces")) + << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) + << Atom(Atom::String, QLatin1String("Namespaces")) + << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) << Atom(Atom::ListItemRight); breadcrumbs << Atom(Atom::ListItemLeft) << Atom(Atom::String, protectEnc(title)) -- cgit v0.12 From dd1234457f3cecc7f9bab569ba492aa24e4a242c Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 25 Mar 2011 13:55:46 +0100 Subject: Doc: Removed duplicate documentation. --- src/opengl/qpixmapdata_poolgl.cpp | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/opengl/qpixmapdata_poolgl.cpp b/src/opengl/qpixmapdata_poolgl.cpp index 64de29e..8ae90e9 100644 --- a/src/opengl/qpixmapdata_poolgl.cpp +++ b/src/opengl/qpixmapdata_poolgl.cpp @@ -63,19 +63,6 @@ QT_BEGIN_NAMESPACE Q_OPENGL_EXPORT extern QGLWidget* qt_gl_share_widget(); -/*! - \class QGLFramebufferObjectPool - \since 4.6 - - \brief The QGLFramebufferObject class provides a pool of framebuffer - objects for offscreen rendering purposes. - - When requesting an FBO of a given size and format, an FBO of the same - format and a size at least as big as the requested size will be returned. - - \internal -*/ - static inline int areaDiff(const QSize &size, const QGLFramebufferObject *fbo) { return qAbs(size.width() * size.height() - fbo->width() * fbo->height()); -- cgit v0.12 From 65cde9524c54a8bcf105fe919fa2ea2e569692ae Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 25 Mar 2011 14:03:02 +0100 Subject: Doc: Added a missing command. --- src/gui/graphicsview/qgraphicsitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index a36a276..d51fdfe 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -421,7 +421,7 @@ \omitvalue ItemStopsFocusHandling \omit Same as ItemStopsClickFocusPropagation, but also suppresses focus-out. This flag allows you to completely take over focus handling. - This flag was introduced in Qt 4.7. + This flag was introduced in Qt 4.7. \endomit */ /*! -- cgit v0.12 From d38664f2ca736560a129a8ff09b293ecb83efac2 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 25 Mar 2011 18:40:58 +0100 Subject: Doc: Fixed markup. --- src/declarative/qml/qdeclarativecomponent.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index c284307..276f790 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -643,11 +643,11 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeComponentPrivate &dd, Q The \a properties argument is specified as a map of property-value items. For example, the code below creates an object with initial \c x and \c y values of 100 and 200, respectively: - \qml + \js var component = Qt.createComponent("Button.qml"); if (component.status == Component.Ready) component.createObject(parent, {"x": 100, "y": 100}); - \endqml + \endjs Dynamically created instances can be deleted with the \c destroy() method. See \l {Dynamic Object Management in QML} for more information. -- cgit v0.12 From def7250ed1a3169a9a39a064402868e9928584f9 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 29 Mar 2011 12:54:30 +0200 Subject: Doc: Minor fix to title. --- doc/src/tutorials/threads.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/tutorials/threads.qdoc b/doc/src/tutorials/threads.qdoc index 1d807a0..2d6a540 100644 --- a/doc/src/tutorials/threads.qdoc +++ b/doc/src/tutorials/threads.qdoc @@ -33,7 +33,7 @@ \title Threading Basics \brief An introduction to threads - \section1 What Are Threads + \section1 What Are Threads? Threads are about doing things in parallel, just like processes. So how do threads differ from processes? While you are making calculations on a -- cgit v0.12 From 131f429e43a5c382ae208af39bc5f889c39dee8b Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 1 Apr 2011 13:03:52 +0200 Subject: qdoc: modified \include to take a 2nd arg, snippet id. --- tools/qdoc3/doc.cpp | 67 ++++++++++++++++++++++++++++---- tools/qdoc3/doc/qdoc-manual.qdoc | 84 ++++++++++++++++++++++++++++------------ tools/qdoc3/quoter.cpp | 3 +- tools/qdoc3/quoter.h | 2 + 4 files changed, 123 insertions(+), 33 deletions(-) diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 945b765..66acacf 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -360,7 +360,7 @@ class DocParser void checkExpiry(const QString& date); void insertBaseName(const QString &baseName); void insertTarget(const QString& target, bool keyword); - void include(const QString& fileName); + void include(const QString& fileName, const QString& identifier); void startFormat(const QString& format, int cmd); bool openCommand(int cmd); bool closeCommand(int endCmd); @@ -804,7 +804,11 @@ void DocParser::parse(const QString& source, append(Atom::ImageText, getRestOfLine()); break; case CMD_INCLUDE: - include(getArgument()); + { + QString fileName = getArgument(); + QString identifier = getRestOfLine(); + include(fileName, identifier); + } break; case CMD_INLINEIMAGE: enterPara(); @@ -1578,7 +1582,7 @@ void DocParser::insertTarget(const QString &target, bool keyword) } } -void DocParser::include(const QString& fileName) +void DocParser::include(const QString& fileName, const QString& identifier) { if (location().depth() > 16) location().fatal(tr("Too many nested '\\%1's") @@ -1592,12 +1596,12 @@ 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 qdoc include file '%1'").arg(fileName)); } else { QFile inFile(filePath); if (!inFile.open(QFile::ReadOnly)) { - location().warning(tr("Cannot open leaf file '%1'") + location().warning(tr("Cannot open qdoc include file '%1'") .arg(userFriendlyFilePath)); } else { @@ -1607,9 +1611,56 @@ void DocParser::include(const QString& fileName) QString includedStuff = inStream.readAll(); inFile.close(); - in.insert(pos, includedStuff); - len = in.length(); - openedInputs.push(pos + includedStuff.length()); + if (identifier.isEmpty()) { + in.insert(pos, includedStuff); + len = in.length(); + openedInputs.push(pos + includedStuff.length()); + } + else { + QStringList lineBuffer = includedStuff.split(QLatin1Char('\n')); + int i = 0; + int startLine = -1; + while (i < lineBuffer.size()) { + if (lineBuffer[i].startsWith("//!")) { + if (lineBuffer[i].contains(identifier)) { + startLine = i+1; + break; + } + } + ++i; + } + if (startLine < 0) { + location().warning(tr("Cannot find '%1' in '%2'") + .arg(identifier) + .arg(userFriendlyFilePath)); + return; + + } + QString result; + i = startLine; + do { + if (lineBuffer[i].startsWith("//!")) { + if (i #include +#include #include "quoter.h" @@ -65,7 +66,7 @@ static void replaceMultipleNewlines(QString &s) } // This is equivalent to line.split( QRegExp("\n(?!\n|$)") ) but much faster -static QStringList splitLines(const QString &line) +QStringList Quoter::splitLines(const QString &line) { QStringList result; int i = line.size(); diff --git a/tools/qdoc3/quoter.h b/tools/qdoc3/quoter.h index 6a59ab4..ee515b2 100644 --- a/tools/qdoc3/quoter.h +++ b/tools/qdoc3/quoter.h @@ -69,6 +69,8 @@ public: const QString& pattern ); QString quoteSnippet(const Location &docLocation, const QString &identifier); + static QStringList splitLines(const QString &line); + private: QString getLine(int unindent = 0); void failedAtEnd( const Location& docLocation, const QString& command ); -- cgit v0.12 From a01e0d1928aa17690d3e0ebadbac7b95bf0f0e84 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 5 Apr 2011 13:41:19 +0200 Subject: qdoc: Allowed multiple values for certain metadata tags. Also output mainters for classes in the HTML output, if there are maintainers listed. --- src/gui/kernel/qwidget.cpp | 5 +-- tools/qdoc3/config.cpp | 6 +-- tools/qdoc3/config.h | 4 +- tools/qdoc3/ditaxmlgenerator.cpp | 89 +++++++++++++++++++++++++++------------- tools/qdoc3/ditaxmlgenerator.h | 4 +- tools/qdoc3/doc.cpp | 7 ++-- tools/qdoc3/doc.h | 3 +- tools/qdoc3/generator.cpp | 77 ++++++++++++++++++++++++++++++++-- tools/qdoc3/generator.h | 5 ++- tools/qdoc3/htmlgenerator.cpp | 1 + 10 files changed, 153 insertions(+), 48 deletions(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index fd9deb5..ac35d42 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -598,10 +598,7 @@ void QWidget::setAutoFillBackground(bool enabled) \brief The QWidget class is the base class of all user interface objects. \ingroup basicwidgets - - \meta {technology} {User Interface} - \meta {platform} {all} - + The widget is the atom of the user interface: it receives mouse, keyboard and other events from the window system, and paints a representation of itself on the screen. Every widget is rectangular, and they are sorted in a diff --git a/tools/qdoc3/config.cpp b/tools/qdoc3/config.cpp index 267a09c..838f6ac 100644 --- a/tools/qdoc3/config.cpp +++ b/tools/qdoc3/config.cpp @@ -338,7 +338,7 @@ QSet Config::subVars(const QString& var) const { QSet result; QString varDot = var + QLatin1Char('.'); - QMap::ConstIterator v = stringValueMap.begin(); + QStringMultiMap::ConstIterator v = stringValueMap.begin(); while (v != stringValueMap.end()) { if (v.key().startsWith(varDot)) { QString subVar = v.key().mid(varDot.length()); @@ -357,10 +357,10 @@ QSet Config::subVars(const QString& var) const with the matching keys (stripped of the prefix \a var and mapped to their values. The pairs are inserted into \a t */ -void Config::subVarsAndValues(const QString& var, QStringMap& t) const +void Config::subVarsAndValues(const QString& var, QStringMultiMap& t) const { QString varDot = var + QLatin1Char('.'); - QMap::ConstIterator v = stringValueMap.begin(); + QStringMultiMap::ConstIterator v = stringValueMap.begin(); while (v != stringValueMap.end()) { if (v.key().startsWith(varDot)) { QString subVar = v.key().mid(varDot.length()); diff --git a/tools/qdoc3/config.h b/tools/qdoc3/config.h index 767acb1..8e19ed2 100644 --- a/tools/qdoc3/config.h +++ b/tools/qdoc3/config.h @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE -typedef QMap QStringMap; +typedef QMultiMap QStringMultiMap; class Config { @@ -76,7 +76,7 @@ class Config QRegExp getRegExp(const QString& var) const; QList getRegExpList(const QString& var) const; QSet subVars(const QString& var) const; - void subVarsAndValues(const QString& var, QStringMap& t) const; + void subVarsAndValues(const QString& var, QStringMultiMap& t) const; QStringList getAllFiles(const QString& filesVar, const QString& dirsVar, const QSet &excludedDirs = QSet()); diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 4b4f776..1bc4992 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -5566,24 +5566,12 @@ void DitaXmlGenerator::writeDitaMap() \note If \a t is found in the metadata map, it is erased. i.e. Once you call this function for a particular \a t, you consume \a t. - - At the moment, it doesn't chaeck to see if there is a - default value for the tag. But it will eventually. */ bool DitaXmlGenerator::writeMetadataElement(const InnerNode* inner, DitaXmlGenerator::DitaTag t, bool force) { - QString s; - QStringMap& metaTagMap = const_cast(inner->doc().metaTagMap()); - QStringMap::iterator i = metaTagMap.find(ditaTags[t]); - if (i == metaTagMap.end()) { - s = metadataDefault(t); - } - else { - s = i.value(); - metaTagMap.erase(i); - } + QString s = getMetadataElement(inner,t); if (s.isEmpty() && !force) return false; writeStartTag(t); @@ -5593,6 +5581,34 @@ bool DitaXmlGenerator::writeMetadataElement(const InnerNode* inner, return true; } + +/*! + Looks up the tag name for \a t in the map of metadata + values for the current topic in \a inner. If one or more + value sfor the tag are found, the elements are written. + Otherwise nothing is written. + + Returns true or false depending on whether it writes + at least one element using the tag \a t. + + \note If \a t is found in the metadata map, it is erased. + i.e. Once you call this function for a particular \a t, + you consume \a t. + */ +bool DitaXmlGenerator::writeMetadataElements(const InnerNode* inner, + DitaXmlGenerator::DitaTag t) +{ + QStringList s = getMetadataElements(inner,t); + if (s.isEmpty()) + return false; + for (int i=0; i(inner->doc().metaTagMap()); - QStringMap::iterator i = metaTagMap.find(ditaTags[t]); - if (i != metaTagMap.end()) { - s = i.value(); - metaTagMap.erase(i); - } - else { + QString s = Generator::getMetadataElement(inner, ditaTags[t]); + if (s.isEmpty()) s = metadataDefault(t); - } + return s; +} + +/*! + Looks up the tag name for \a t in the map of metadata + values for the current topic in \a inner. If values + for the tag are found, they are returned in a string + list. + + \note If \a t is found in the metadata map, all the + pairs having the key \a t are erased. i.e. Once you + all this function for a particular \a t, you consume + \a t. + */ +QStringList DitaXmlGenerator::getMetadataElements(const InnerNode* inner, + DitaXmlGenerator::DitaTag t) +{ + QStringList s = Generator::getMetadataElements(inner,ditaTags[t]); + if (s.isEmpty()) + s.append(metadataDefault(t)); return s; } @@ -5671,7 +5700,7 @@ DitaXmlGenerator::writeProlog(const InnerNode* inner, CodeMarker* marker) if (!inner) return; writeStartTag(DT_prolog); - writeMetadataElement(inner,DT_author); + writeMetadataElements(inner,DT_author); writeMetadataElement(inner,DT_publisher); QString s = getMetadataElement(inner,DT_copyryear); QString t = getMetadataElement(inner,DT_copyrholder); @@ -5690,11 +5719,13 @@ DitaXmlGenerator::writeProlog(const InnerNode* inner, CodeMarker* marker) xmlWriter().writeAttribute("view",s); writeEndTag(); // writeStartTag(DT_metadata); - s = getMetadataElement(inner,DT_audience); - if (!s.isEmpty()) { - writeStartTag(DT_audience); - xmlWriter().writeAttribute("type",s); - writeEndTag(); // + QStringList sl = getMetadataElements(inner,DT_audience); + if (!sl.isEmpty()) { + for (int i=0; i + } } if (!writeMetadataElement(inner,DT_category,false)) { writeStartTag(DT_category); @@ -5755,7 +5786,7 @@ DitaXmlGenerator::writeProlog(const InnerNode* inner, CodeMarker* marker) } writeEndTag(); // } - const QStringMap& metaTagMap = inner->doc().metaTagMap(); + const QStringMultiMap& metaTagMap = inner->doc().metaTagMap(); QMapIterator i(metaTagMap); while (i.hasNext()) { i.next(); diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index c7400bb..ffca234 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -319,7 +319,9 @@ class DitaXmlGenerator : public PageGenerator bool writeMetadataElement(const InnerNode* inner, DitaXmlGenerator::DitaTag t, bool force=true); + bool writeMetadataElements(const InnerNode* inner, DitaXmlGenerator::DitaTag t); QString getMetadataElement(const InnerNode* inner, DitaXmlGenerator::DitaTag t); + QStringList getMetadataElements(const InnerNode* inner, DitaXmlGenerator::DitaTag t); private: enum SubTitleSize { SmallSubTitle, LargeSubTitle }; @@ -516,7 +518,7 @@ class DitaXmlGenerator : public PageGenerator static QString ditaTags[]; QStack xmlWriterStack; QStack tagStack; - QStringMap metadataDefaults; + QStringMultiMap metadataDefaults; }; #define DITAXMLGENERATOR_ADDRESS "address" diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 66acacf..2239f43 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -63,6 +63,7 @@ Q_GLOBAL_STATIC(QSet, null_Set_QString) Q_GLOBAL_STATIC(QStringList, null_QStringList) Q_GLOBAL_STATIC(QList, null_QList_Text) Q_GLOBAL_STATIC(QStringMap, null_QStringMap) +Q_GLOBAL_STATIC(QStringMultiMap, null_QStringMultiMap) struct Macro { @@ -228,7 +229,7 @@ class DocPrivateExtra QList tableOfContentsLevels; QList keywords; QList targets; - QStringMap metaMap; + QStringMultiMap metaMap; DocPrivateExtra() : granularity(Doc::Part) { } @@ -2960,9 +2961,9 @@ const QList &Doc::targets() const return priv->extra->targets; } -const QStringMap &Doc::metaTagMap() const +const QStringMultiMap &Doc::metaTagMap() const { - return priv && priv->extra ? priv->extra->metaMap : *null_QStringMap(); + return priv && priv->extra ? priv->extra->metaMap : *null_QStringMultiMap(); } void Doc::initialize(const Config& config) diff --git a/tools/qdoc3/doc.h b/tools/qdoc3/doc.h index ea832b1..e043b3a 100644 --- a/tools/qdoc3/doc.h +++ b/tools/qdoc3/doc.h @@ -64,7 +64,6 @@ class FakeNode; typedef QMap QCommandMap; typedef QMap QStringMap; -typedef QStringMap::const_iterator QStringMapEntry; typedef QMultiMap QStringMultiMap; class Doc @@ -118,7 +117,7 @@ class Doc const QList &tableOfContentsLevels() const; const QList &keywords() const; const QList &targets() const; - const QStringMap &metaTagMap() const; + const QStringMultiMap &metaTagMap() const; static void initialize( const Config &config ); static void terminate(); diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index b4768db..f05c030 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -549,7 +549,10 @@ void Generator::generateAlsoList(const Node *node, CodeMarker *marker) if (!alsoList.isEmpty()) { Text text; - text << Atom::ParaLeft << "See also "; + text << Atom::ParaLeft + << Atom(Atom::FormattingLeft,ATOM_FORMATTING_BOLD) + << "See also " + << Atom(Atom::FormattingRight,ATOM_FORMATTING_BOLD); for (int i = 0; i < alsoList.size(); ++i) text << alsoList.at(i) << separator(i, alsoList.size()); @@ -559,6 +562,28 @@ void Generator::generateAlsoList(const Node *node, CodeMarker *marker) } } +/*! + Generate a list of maintainers in the output + */ +void Generator::generateMaintainerList(const InnerNode* node, CodeMarker* marker) +{ + QStringList sl = getMetadataElements(node,"maintainer"); + + if (!sl.isEmpty()) { + Text text; + text << Atom::ParaLeft + << Atom(Atom::FormattingLeft,ATOM_FORMATTING_BOLD) + << "Maintained by: " + << Atom(Atom::FormattingRight,ATOM_FORMATTING_BOLD); + + for (int i = 0; i < sl.size(); ++i) + text << sl.at(i) << separator(i, sl.size()); + + text << Atom::ParaRight; + generateText(text, node, marker); + } +} + void Generator::generateInherits(const ClassNode *classe, CodeMarker *marker) { QList::ConstIterator r; @@ -566,7 +591,10 @@ void Generator::generateInherits(const ClassNode *classe, CodeMarker *marker) if (!classe->baseClasses().isEmpty()) { Text text; - text << Atom::ParaLeft << "Inherits "; + text << Atom::ParaLeft + << Atom(Atom::FormattingLeft,ATOM_FORMATTING_BOLD) + << "Inherits: " + << Atom(Atom::FormattingRight,ATOM_FORMATTING_BOLD); r = classe->baseClasses().begin(); index = 0; @@ -604,7 +632,10 @@ void Generator::generateInheritedBy(const ClassNode *classe, { if (!classe->derivedClasses().isEmpty()) { Text text; - text << Atom::ParaLeft << "Inherited by "; + text << Atom::ParaLeft + << Atom(Atom::FormattingLeft,ATOM_FORMATTING_BOLD) + << "Inherited by: " + << Atom(Atom::FormattingRight,ATOM_FORMATTING_BOLD); appendSortedNames(text, classe, classe->derivedClasses(), marker); text << Atom::ParaRight; @@ -1275,4 +1306,44 @@ QString Generator::outputPrefix(const QString &nodeType) return outputPrefixes[nodeType]; } +/*! + Looks up the tag \a t in the map of metadata values for the + current topic in \a inner. If a value for the tag is found, + the value is returned. + + \note If \a t is found in the metadata map, it is erased. + i.e. Once you call this function for a particular \a t, + you consume \a t. + */ +QString Generator::getMetadataElement(const InnerNode* inner, const QString& t) +{ + QString s; + QStringMultiMap& metaTagMap = const_cast(inner->doc().metaTagMap()); + QStringMultiMap::iterator i = metaTagMap.find(t); + if (i != metaTagMap.end()) { + s = i.value(); + metaTagMap.erase(i); + } + return s; +} + +/*! + Looks up the tag \a t in the map of metadata values for the + current topic in \a inner. If values for the tag are found, + they are returned in a string list. + + \note If \a t is found in the metadata map, all the pairs + having the key \a t are erased. i.e. Once you call this + function for a particular \a t, you consume \a t. + */ +QStringList Generator::getMetadataElements(const InnerNode* inner, const QString& t) +{ + QStringList s; + QStringMultiMap& metaTagMap = const_cast(inner->doc().metaTagMap()); + s = metaTagMap.values(t); + if (!s.isEmpty()) + metaTagMap.remove(t); + return s; +} + QT_END_NAMESPACE diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h index 4482313..8fd5370 100644 --- a/tools/qdoc3/generator.h +++ b/tools/qdoc3/generator.h @@ -106,6 +106,7 @@ class Generator #endif virtual void generateBody(const Node *node, CodeMarker *marker); virtual void generateAlsoList(const Node *node, CodeMarker *marker); + virtual void generateMaintainerList(const InnerNode* node, CodeMarker* marker); virtual void generateInherits(const ClassNode *classe, CodeMarker *marker); virtual void generateInheritedBy(const ClassNode *classe, @@ -141,7 +142,6 @@ class Generator void unknownAtom(const Atom *atom); QMap &formattingLeftMap(); QMap &formattingRightMap(); - QMap editionModuleMap; QMap editionGroupMap; @@ -150,6 +150,9 @@ class Generator static void supplementAlsoList(const Node *node, QList &alsoList); static QString outputPrefix(const QString &nodeType); + QString getMetadataElement(const InnerNode* inner, const QString& t); + QStringList getMetadataElements(const InnerNode* inner, const QString& t); + private: void generateReimplementedFrom(const FunctionNode *func, CodeMarker *marker); diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index d1d1561..645453b 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -1327,6 +1327,7 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, generateBody(inner, marker); out() << "\n"; // QTBUG-9504 generateAlsoList(inner, marker); + generateMaintainerList(inner, marker); generateExtractionMark(inner, EndMark); } -- cgit v0.12 From 0dd4a8c535b51ed66b84c77872dd0309d4d2690c Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 29 Mar 2011 18:01:14 +0200 Subject: Fixed string-int concatenation issue. Task-number: QTBUG-18086 --- demos/browser/networkaccessmanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/browser/networkaccessmanager.cpp b/demos/browser/networkaccessmanager.cpp index 9e717bb..34ba432 100644 --- a/demos/browser/networkaccessmanager.cpp +++ b/demos/browser/networkaccessmanager.cpp @@ -187,7 +187,7 @@ void NetworkAccessManager::proxyAuthenticationRequired(const QNetworkProxy &prox void NetworkAccessManager::sslErrors(QNetworkReply *reply, const QList &error) { // check if SSL certificate has been trusted already - QString replyHost = reply->url().host() + ":" + reply->url().port(); + QString replyHost = reply->url().host() + QString(":%1").arg(reply->url().port()); if(! sslTrustedHostList.contains(replyHost)) { BrowserMainWindow *mainWindow = BrowserApplication::instance()->mainWindow(); -- cgit v0.12 From 2fce25b50d92687eca58f2f80fd9de8cef8864f3 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 30 Mar 2011 15:32:43 +0200 Subject: Minor feature fix led to refactoring for i18n's sake. Task-number: QTBUG-18397 --- demos/embedded/lightmaps/lightmaps.cpp | 693 +++++++++------------------------ demos/embedded/lightmaps/lightmaps.h | 88 +++++ demos/embedded/lightmaps/lightmaps.pro | 8 +- demos/embedded/lightmaps/main.cpp | 63 +++ demos/embedded/lightmaps/mapzoom.cpp | 147 +++++++ demos/embedded/lightmaps/mapzoom.h | 69 ++++ demos/embedded/lightmaps/slippymap.cpp | 213 ++++++++++ demos/embedded/lightmaps/slippymap.h | 87 +++++ 8 files changed, 859 insertions(+), 509 deletions(-) create mode 100644 demos/embedded/lightmaps/lightmaps.h create mode 100644 demos/embedded/lightmaps/main.cpp create mode 100644 demos/embedded/lightmaps/mapzoom.cpp create mode 100644 demos/embedded/lightmaps/mapzoom.h create mode 100644 demos/embedded/lightmaps/slippymap.cpp create mode 100644 demos/embedded/lightmaps/slippymap.h diff --git a/demos/embedded/lightmaps/lightmaps.cpp b/demos/embedded/lightmaps/lightmaps.cpp index dfbef06..8e64e73 100644 --- a/demos/embedded/lightmaps/lightmaps.cpp +++ b/demos/embedded/lightmaps/lightmaps.cpp @@ -45,6 +45,9 @@ #include +#include "lightmaps.h" +#include "slippymap.h" + #ifndef M_PI #define M_PI 3.14159265358979323846 #endif @@ -59,552 +62,226 @@ // Hint: see above to find why I picked this one :) #define MAX_MAGNIFIER 229 -uint qHash(const QPoint& p) +LightMaps::LightMaps(QWidget *parent) + : QWidget(parent), pressed(false), snapped(false), zoomed(false), + invert(false) { - return p.x() * 17 ^ p.y(); + m_normalMap = new SlippyMap(this); + m_largeMap = new SlippyMap(this); + connect(m_normalMap, SIGNAL(updated(QRect)), SLOT(updateMap(QRect))); + connect(m_largeMap, SIGNAL(updated(QRect)), SLOT(update())); } -// tile size in pixels -const int tdim = 256; - -QPointF tileForCoordinate(qreal lat, qreal lng, int zoom) +void LightMaps::setCenter(qreal lat, qreal lng) { - qreal zn = static_cast(1 << zoom); - qreal tx = (lng + 180.0) / 360.0; - qreal ty = (1.0 - log(tan(lat * M_PI / 180.0) + - 1.0 / cos(lat * M_PI / 180.0)) / M_PI) / 2.0; - return QPointF(tx * zn, ty * zn); + m_normalMap->latitude = lat; + m_normalMap->longitude = lng; + m_normalMap->invalidate(); + m_largeMap->latitude = lat; + m_largeMap->longitude = lng; + m_largeMap->invalidate(); } -qreal longitudeFromTile(qreal tx, int zoom) +void LightMaps::toggleNightMode() { - qreal zn = static_cast(1 << zoom); - qreal lat = tx / zn * 360.0 - 180.0; - return lat; + invert = !invert; + update(); } -qreal latitudeFromTile(qreal ty, int zoom) +void LightMaps::updateMap(const QRect &r) { - qreal zn = static_cast(1 << zoom); - qreal n = M_PI - 2 * M_PI * ty / zn; - qreal lng = 180.0 / M_PI * atan(0.5 * (exp(n) - exp(-n))); - return lng; + update(r); } -class SlippyMap: public QObject +void LightMaps::activateZoom() { - Q_OBJECT - -public: - int width; - int height; - int zoom; - qreal latitude; - qreal longitude; - - SlippyMap(QObject *parent = 0) - : QObject(parent) - , width(400) - , height(300) - , zoom(15) - , latitude(59.9138204) - , longitude(10.7387413) { - m_emptyTile = QPixmap(tdim, tdim); - m_emptyTile.fill(Qt::lightGray); - - QNetworkDiskCache *cache = new QNetworkDiskCache; - cache->setCacheDirectory(QDesktopServices::storageLocation - (QDesktopServices::CacheLocation)); - m_manager.setCache(cache); - connect(&m_manager, SIGNAL(finished(QNetworkReply*)), - this, SLOT(handleNetworkData(QNetworkReply*))); - } - - void invalidate() { - if (width <= 0 || height <= 0) - return; - - QPointF ct = tileForCoordinate(latitude, longitude, zoom); - qreal tx = ct.x(); - qreal ty = ct.y(); - - // top-left corner of the center tile - int xp = width / 2 - (tx - floor(tx)) * tdim; - int yp = height / 2 - (ty - floor(ty)) * tdim; - - // first tile vertical and horizontal - int xa = (xp + tdim - 1) / tdim; - int ya = (yp + tdim - 1) / tdim; - int xs = static_cast(tx) - xa; - int ys = static_cast(ty) - ya; - - // offset for top-left tile - m_offset = QPoint(xp - xa * tdim, yp - ya * tdim); - - // last tile vertical and horizontal - int xe = static_cast(tx) + (width - xp - 1) / tdim; - int ye = static_cast(ty) + (height - yp - 1) / tdim; - - // build a rect - m_tilesRect = QRect(xs, ys, xe - xs + 1, ye - ys + 1); - - if (m_url.isEmpty()) - download(); - - emit updated(QRect(0, 0, width, height)); - } - - void render(QPainter *p, const QRect &rect) { - for (int x = 0; x <= m_tilesRect.width(); ++x) - for (int y = 0; y <= m_tilesRect.height(); ++y) { - QPoint tp(x + m_tilesRect.left(), y + m_tilesRect.top()); - QRect box = tileRect(tp); - if (rect.intersects(box)) { - if (m_tilePixmaps.contains(tp)) - p->drawPixmap(box, m_tilePixmaps.value(tp)); - else - p->drawPixmap(box, m_emptyTile); - } - } - } - - void pan(const QPoint &delta) { - QPointF dx = QPointF(delta) / qreal(tdim); - QPointF center = tileForCoordinate(latitude, longitude, zoom) - dx; - latitude = latitudeFromTile(center.y(), zoom); - longitude = longitudeFromTile(center.x(), zoom); - invalidate(); - } - -private slots: - - void handleNetworkData(QNetworkReply *reply) { - QImage img; - QPoint tp = reply->request().attribute(QNetworkRequest::User).toPoint(); - QUrl url = reply->url(); - if (!reply->error()) - if (!img.load(reply, 0)) - img = QImage(); - reply->deleteLater(); - m_tilePixmaps[tp] = QPixmap::fromImage(img); - if (img.isNull()) - m_tilePixmaps[tp] = m_emptyTile; - emit updated(tileRect(tp)); - - // purge unused spaces - QRect bound = m_tilesRect.adjusted(-2, -2, 2, 2); - foreach(QPoint tp, m_tilePixmaps.keys()) - if (!bound.contains(tp)) - m_tilePixmaps.remove(tp); - - download(); - } - - void download() { - QPoint grab(0, 0); - for (int x = 0; x <= m_tilesRect.width(); ++x) - for (int y = 0; y <= m_tilesRect.height(); ++y) { - QPoint tp = m_tilesRect.topLeft() + QPoint(x, y); - if (!m_tilePixmaps.contains(tp)) { - grab = tp; - break; - } - } - if (grab == QPoint(0, 0)) { - m_url = QUrl(); - return; - } - - QString path = "http://tile.openstreetmap.org/%1/%2/%3.png"; - m_url = QUrl(path.arg(zoom).arg(grab.x()).arg(grab.y())); - QNetworkRequest request; - request.setUrl(m_url); - request.setRawHeader("User-Agent", "Nokia (Qt) Graphics Dojo 1.0"); - request.setAttribute(QNetworkRequest::User, QVariant(grab)); - m_manager.get(request); - } - -signals: - void updated(const QRect &rect); - -protected: - QRect tileRect(const QPoint &tp) { - QPoint t = tp - m_tilesRect.topLeft(); - int x = t.x() * tdim + m_offset.x(); - int y = t.y() * tdim + m_offset.y(); - return QRect(x, y, tdim, tdim); - } - -private: - QPoint m_offset; - QRect m_tilesRect; - QPixmap m_emptyTile; - QHash m_tilePixmaps; - QNetworkAccessManager m_manager; - QUrl m_url; -}; + zoomed = true; + tapTimer.stop(); + m_largeMap->zoom = m_normalMap->zoom + 1; + m_largeMap->width = m_normalMap->width * 2; + m_largeMap->height = m_normalMap->height * 2; + m_largeMap->latitude = m_normalMap->latitude; + m_largeMap->longitude = m_normalMap->longitude; + m_largeMap->invalidate(); + update(); +} -class LightMaps: public QWidget +void LightMaps::resizeEvent(QResizeEvent *) { - Q_OBJECT - -public: - LightMaps(QWidget *parent = 0) - : QWidget(parent) - , pressed(false) - , snapped(false) - , zoomed(false) - , invert(false) { - m_normalMap = new SlippyMap(this); - m_largeMap = new SlippyMap(this); - connect(m_normalMap, SIGNAL(updated(QRect)), SLOT(updateMap(QRect))); - connect(m_largeMap, SIGNAL(updated(QRect)), SLOT(update())); - } - - void setCenter(qreal lat, qreal lng) { - m_normalMap->latitude = lat; - m_normalMap->longitude = lng; - m_normalMap->invalidate(); - m_largeMap->invalidate(); - } - -public slots: - void toggleNightMode() { - invert = !invert; - update(); - } - -private slots: - void updateMap(const QRect &r) { - update(r); - } - -protected: - - void activateZoom() { - zoomed = true; - tapTimer.stop(); - m_largeMap->zoom = m_normalMap->zoom + 1; - m_largeMap->width = m_normalMap->width * 2; - m_largeMap->height = m_normalMap->height * 2; - m_largeMap->latitude = m_normalMap->latitude; - m_largeMap->longitude = m_normalMap->longitude; - m_largeMap->invalidate(); - update(); - } - - void resizeEvent(QResizeEvent *) { - m_normalMap->width = width(); - m_normalMap->height = height(); - m_normalMap->invalidate(); - m_largeMap->width = m_normalMap->width * 2; - m_largeMap->height = m_normalMap->height * 2; - m_largeMap->invalidate(); - } + m_normalMap->width = width(); + m_normalMap->height = height(); + m_normalMap->invalidate(); + m_largeMap->width = m_normalMap->width * 2; + m_largeMap->height = m_normalMap->height * 2; + m_largeMap->invalidate(); +} - void paintEvent(QPaintEvent *event) { - QPainter p; - p.begin(this); - m_normalMap->render(&p, event->rect()); - p.setPen(Qt::black); +void LightMaps::paintEvent(QPaintEvent *event) +{ + QPainter p; + p.begin(this); + m_normalMap->render(&p, event->rect()); + p.setPen(Qt::black); #if defined(Q_OS_SYMBIAN) - QFont font = p.font(); - font.setPixelSize(13); - p.setFont(font); + QFont font = p.font(); + font.setPixelSize(13); + p.setFont(font); #endif - p.drawText(rect(), Qt::AlignBottom | Qt::TextWordWrap, - "Map data CCBYSA 2009 OpenStreetMap.org contributors"); - p.end(); - - if (zoomed) { - int dim = qMin(width(), height()); - int magnifierSize = qMin(MAX_MAGNIFIER, dim * 2 / 3); - int radius = magnifierSize / 2; - int ring = radius - 15; - QSize box = QSize(magnifierSize, magnifierSize); - - // reupdate our mask - if (maskPixmap.size() != box) { - maskPixmap = QPixmap(box); - maskPixmap.fill(Qt::transparent); - - QRadialGradient g; - g.setCenter(radius, radius); - g.setFocalPoint(radius, radius); - g.setRadius(radius); - g.setColorAt(1.0, QColor(255, 255, 255, 0)); - g.setColorAt(0.5, QColor(128, 128, 128, 255)); - - QPainter mask(&maskPixmap); - mask.setRenderHint(QPainter::Antialiasing); - mask.setCompositionMode(QPainter::CompositionMode_Source); - mask.setBrush(g); - mask.setPen(Qt::NoPen); - mask.drawRect(maskPixmap.rect()); - mask.setBrush(QColor(Qt::transparent)); - mask.drawEllipse(g.center(), ring, ring); - mask.end(); - } - - QPoint center = dragPos - QPoint(0, radius); - center = center + QPoint(0, radius / 2); - QPoint corner = center - QPoint(radius, radius); - - QPoint xy = center * 2 - QPoint(radius, radius); + p.drawText(rect(), Qt::AlignBottom | Qt::TextWordWrap, + "Map data CCBYSA 2009 OpenStreetMap.org contributors"); + p.end(); + + if (zoomed) { + int dim = qMin(width(), height()); + int magnifierSize = qMin(MAX_MAGNIFIER, dim * 2 / 3); + int radius = magnifierSize / 2; + int ring = radius - 15; + QSize box = QSize(magnifierSize, magnifierSize); + + // reupdate our mask + if (maskPixmap.size() != box) { + maskPixmap = QPixmap(box); + maskPixmap.fill(Qt::transparent); + + QRadialGradient g; + g.setCenter(radius, radius); + g.setFocalPoint(radius, radius); + g.setRadius(radius); + g.setColorAt(1.0, QColor(255, 255, 255, 0)); + g.setColorAt(0.5, QColor(128, 128, 128, 255)); + + QPainter mask(&maskPixmap); + mask.setRenderHint(QPainter::Antialiasing); + mask.setCompositionMode(QPainter::CompositionMode_Source); + mask.setBrush(g); + mask.setPen(Qt::NoPen); + mask.drawRect(maskPixmap.rect()); + mask.setBrush(QColor(Qt::transparent)); + mask.drawEllipse(g.center(), ring, ring); + mask.end(); + } - // only set the dimension to the magnified portion - if (zoomPixmap.size() != box) { - zoomPixmap = QPixmap(box); - zoomPixmap.fill(Qt::lightGray); - } - if (true) { - QPainter p(&zoomPixmap); - p.translate(-xy); - m_largeMap->render(&p, QRect(xy, box)); - p.end(); - } + QPoint center = dragPos - QPoint(0, radius); + center = center + QPoint(0, radius / 2); + QPoint corner = center - QPoint(radius, radius); - QPainterPath clipPath; - clipPath.addEllipse(center, ring, ring); + QPoint xy = center * 2 - QPoint(radius, radius); - QPainter p(this); - p.setRenderHint(QPainter::Antialiasing); - p.setClipPath(clipPath); - p.drawPixmap(corner, zoomPixmap); - p.setClipping(false); - p.drawPixmap(corner, maskPixmap); - p.setPen(Qt::gray); - p.drawPath(clipPath); + // only set the dimension to the magnified portion + if (zoomPixmap.size() != box) { + zoomPixmap = QPixmap(box); + zoomPixmap.fill(Qt::lightGray); } - if (invert) { - QPainter p(this); - p.setCompositionMode(QPainter::CompositionMode_Difference); - p.fillRect(event->rect(), Qt::white); + if (true) { + QPainter p(&zoomPixmap); + p.translate(-xy); + m_largeMap->render(&p, QRect(xy, box)); p.end(); } - } - void timerEvent(QTimerEvent *) { - if (!zoomed) - activateZoom(); - update(); + QPainterPath clipPath; + clipPath.addEllipse(center, ring, ring); + + QPainter p(this); + p.setRenderHint(QPainter::Antialiasing); + p.setClipPath(clipPath); + p.drawPixmap(corner, zoomPixmap); + p.setClipping(false); + p.drawPixmap(corner, maskPixmap); + p.setPen(Qt::gray); + p.drawPath(clipPath); } - - void mousePressEvent(QMouseEvent *event) { - if (event->buttons() != Qt::LeftButton) - return; - pressed = snapped = true; - pressPos = dragPos = event->pos(); - tapTimer.stop(); - tapTimer.start(HOLD_TIME, this); + if (invert) { + QPainter p(this); + p.setCompositionMode(QPainter::CompositionMode_Difference); + p.fillRect(event->rect(), Qt::white); + p.end(); } +} - void mouseMoveEvent(QMouseEvent *event) { - if (!event->buttons()) - return; - if (!zoomed) { - if (!pressed || !snapped) { - QPoint delta = event->pos() - pressPos; - pressPos = event->pos(); - m_normalMap->pan(delta); - return; - } else { - const int threshold = 10; - QPoint delta = event->pos() - pressPos; - if (snapped) { - snapped &= delta.x() < threshold; - snapped &= delta.y() < threshold; - snapped &= delta.x() > -threshold; - snapped &= delta.y() > -threshold; - } - if (!snapped) - tapTimer.stop(); - } - } else { - dragPos = event->pos(); - update(); - } - } +void LightMaps::timerEvent(QTimerEvent *) +{ + if (!zoomed) + activateZoom(); + update(); +} - void mouseReleaseEvent(QMouseEvent *) { - zoomed = false; - update(); - } +void LightMaps::mousePressEvent(QMouseEvent *event) +{ + if (event->buttons() != Qt::LeftButton) + return; + pressed = snapped = true; + pressPos = dragPos = event->pos(); + tapTimer.stop(); + tapTimer.start(HOLD_TIME, this); +} - void keyPressEvent(QKeyEvent *event) { - if (!zoomed) { - if (event->key() == Qt::Key_Left) - m_normalMap->pan(QPoint(20, 0)); - if (event->key() == Qt::Key_Right) - m_normalMap->pan(QPoint(-20, 0)); - if (event->key() == Qt::Key_Up) - m_normalMap->pan(QPoint(0, 20)); - if (event->key() == Qt::Key_Down) - m_normalMap->pan(QPoint(0, -20)); - if (event->key() == Qt::Key_Z || event->key() == Qt::Key_Select) { - dragPos = QPoint(width() / 2, height() / 2); - activateZoom(); - } +void LightMaps::mouseMoveEvent(QMouseEvent *event) +{ + if (!event->buttons()) + return; + if (!zoomed) { + if (!pressed || !snapped) { + QPoint delta = event->pos() - pressPos; + pressPos = event->pos(); + m_normalMap->pan(delta); + return; } else { - if (event->key() == Qt::Key_Z || event->key() == Qt::Key_Select) { - zoomed = false; - update(); - } - QPoint delta(0, 0); - if (event->key() == Qt::Key_Left) - delta = QPoint(-15, 0); - if (event->key() == Qt::Key_Right) - delta = QPoint(15, 0); - if (event->key() == Qt::Key_Up) - delta = QPoint(0, -15); - if (event->key() == Qt::Key_Down) - delta = QPoint(0, 15); - if (delta != QPoint(0, 0)) { - dragPos += delta; - update(); + const int threshold = 10; + QPoint delta = event->pos() - pressPos; + if (snapped) { + snapped &= delta.x() < threshold; + snapped &= delta.y() < threshold; + snapped &= delta.x() > -threshold; + snapped &= delta.y() > -threshold; } + if (!snapped) + tapTimer.stop(); } + } else { + dragPos = event->pos(); + update(); } +} -private: - SlippyMap *m_normalMap; - SlippyMap *m_largeMap; - bool pressed; - bool snapped; - QPoint pressPos; - QPoint dragPos; - QBasicTimer tapTimer; - bool zoomed; - QPixmap zoomPixmap; - QPixmap maskPixmap; - bool invert; -}; - -class MapZoom : public QMainWindow +void LightMaps::mouseReleaseEvent(QMouseEvent *) { - Q_OBJECT - -private: - LightMaps *map; - QNetworkSession *networkSession; - -public: - MapZoom(): QMainWindow(0) { - map = new LightMaps(this); - setCentralWidget(map); - map->setFocus(); - - QAction *osloAction = new QAction("&Oslo", this); - QAction *berlinAction = new QAction("&Berlin", this); - QAction *jakartaAction = new QAction("&Jakarta", this); - QAction *nightModeAction = new QAction("Night Mode", this); - nightModeAction->setCheckable(true); - nightModeAction->setChecked(false); - QAction *osmAction = new QAction("About OpenStreetMap", this); - connect(osloAction, SIGNAL(triggered()), SLOT(chooseOslo())); - connect(berlinAction, SIGNAL(triggered()), SLOT(chooseBerlin())); - connect(jakartaAction, SIGNAL(triggered()), SLOT(chooseJakarta())); - connect(nightModeAction, SIGNAL(triggered()), map, SLOT(toggleNightMode())); - connect(osmAction, SIGNAL(triggered()), SLOT(aboutOsm())); - -#if defined(Q_OS_SYMBIAN) || defined(Q_OS_WINCE_WM) - menuBar()->addAction(osloAction); - menuBar()->addAction(berlinAction); - menuBar()->addAction(jakartaAction); - menuBar()->addAction(nightModeAction); - menuBar()->addAction(osmAction); -#else - QMenu *menu = menuBar()->addMenu("&Options"); - menu->addAction(osloAction); - menu->addAction(berlinAction); - menu->addAction(jakartaAction); - menu->addSeparator(); - menu->addAction(nightModeAction); - menu->addAction(osmAction); -#endif - - QNetworkConfigurationManager manager; - if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) { - // Get saved network configuration - QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); - settings.beginGroup(QLatin1String("QtNetwork")); - const QString id = - settings.value(QLatin1String("DefaultNetworkConfiguration")).toString(); - settings.endGroup(); - - // If the saved network configuration is not currently discovered use the system - // default - QNetworkConfiguration config = manager.configurationFromIdentifier(id); - if ((config.state() & QNetworkConfiguration::Discovered) != - QNetworkConfiguration::Discovered) { - config = manager.defaultConfiguration(); - } - - networkSession = new QNetworkSession(config, this); - connect(networkSession, SIGNAL(opened()), this, SLOT(sessionOpened())); + zoomed = false; + update(); +} - networkSession->open(); - } else { - networkSession = 0; +void LightMaps::keyPressEvent(QKeyEvent *event) +{ + if (!zoomed) { + if (event->key() == Qt::Key_Left) + m_normalMap->pan(QPoint(20, 0)); + if (event->key() == Qt::Key_Right) + m_normalMap->pan(QPoint(-20, 0)); + if (event->key() == Qt::Key_Up) + m_normalMap->pan(QPoint(0, 20)); + if (event->key() == Qt::Key_Down) + m_normalMap->pan(QPoint(0, -20)); + if (event->key() == Qt::Key_Z || event->key() == Qt::Key_Select) { + dragPos = QPoint(width() / 2, height() / 2); + activateZoom(); } - } - -private slots: - - void sessionOpened() { - // Save the used configuration - QNetworkConfiguration config = networkSession->configuration(); - QString id; - if (config.type() == QNetworkConfiguration::UserChoice) { - id = networkSession->sessionProperty( - QLatin1String("UserChoiceConfiguration")).toString(); - } else { - id = config.identifier(); + } else { + if (event->key() == Qt::Key_Z || event->key() == Qt::Key_Select) { + zoomed = false; + update(); + } + QPoint delta(0, 0); + if (event->key() == Qt::Key_Left) + delta = QPoint(-15, 0); + if (event->key() == Qt::Key_Right) + delta = QPoint(15, 0); + if (event->key() == Qt::Key_Up) + delta = QPoint(0, -15); + if (event->key() == Qt::Key_Down) + delta = QPoint(0, 15); + if (delta != QPoint(0, 0)) { + dragPos += delta; + update(); } - - QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); - settings.beginGroup(QLatin1String("QtNetwork")); - settings.setValue(QLatin1String("DefaultNetworkConfiguration"), id); - settings.endGroup(); - } - - void chooseOslo() { - map->setCenter(59.9138204, 10.7387413); - } - - void chooseBerlin() { - map->setCenter(52.52958999943302, 13.383053541183472); - } - - void chooseJakarta() { - map->setCenter(-6.211544, 106.845172); - } - - void aboutOsm() { - QDesktopServices::openUrl(QUrl("http://www.openstreetmap.org")); } -}; - - -#include "lightmaps.moc" - -int main(int argc, char **argv) -{ -#if defined(Q_WS_X11) - QApplication::setGraphicsSystem("raster"); -#endif - - QApplication app(argc, argv); - app.setApplicationName("LightMaps"); - - MapZoom w; - w.setWindowTitle("OpenStreetMap"); -#if defined(Q_OS_SYMBIAN) || defined(Q_OS_WINCE_WM) - w.showMaximized(); -#else - w.resize(600, 450); - w.show(); -#endif - - return app.exec(); } diff --git a/demos/embedded/lightmaps/lightmaps.h b/demos/embedded/lightmaps/lightmaps.h new file mode 100644 index 0000000..42a80c9 --- /dev/null +++ b/demos/embedded/lightmaps/lightmaps.h @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** 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 demonstration 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 LIGHTMAPS_H +#define LIGHTMAPS_H + +#include +#include + +class SlippyMap; + +class LightMaps: public QWidget +{ + Q_OBJECT + +public: + LightMaps(QWidget *parent = 0); + void setCenter(qreal lat, qreal lng); + +public slots: + void toggleNightMode(); + +protected: + void activateZoom(); + void resizeEvent(QResizeEvent *); + void paintEvent(QPaintEvent *event); + void timerEvent(QTimerEvent *); + void mousePressEvent(QMouseEvent *event); + void mouseMoveEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *); + void keyPressEvent(QKeyEvent *event); + +private slots: + void updateMap(const QRect &r); + +private: + SlippyMap *m_normalMap; + SlippyMap *m_largeMap; + bool pressed; + bool snapped; + QPoint pressPos; + QPoint dragPos; + QBasicTimer tapTimer; + bool zoomed; + QPixmap zoomPixmap; + QPixmap maskPixmap; + bool invert; +}; + +#endif \ No newline at end of file diff --git a/demos/embedded/lightmaps/lightmaps.pro b/demos/embedded/lightmaps/lightmaps.pro index 9d83721..cf1180b 100644 --- a/demos/embedded/lightmaps/lightmaps.pro +++ b/demos/embedded/lightmaps/lightmaps.pro @@ -1,5 +1,11 @@ TEMPLATE = app -SOURCES = lightmaps.cpp +HEADERS = lightmaps.h \ + mapzoom.h \ + slippymap.h +SOURCES = lightmaps.cpp \ + main.cpp \ + mapzoom.cpp \ + slippymap.cpp QT += network symbian { diff --git a/demos/embedded/lightmaps/main.cpp b/demos/embedded/lightmaps/main.cpp new file mode 100644 index 0000000..34d8d3d --- /dev/null +++ b/demos/embedded/lightmaps/main.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** 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 demonstration 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 +#include "mapzoom.h" + +int main(int argc, char **argv) +{ +#if defined(Q_WS_X11) + QApplication::setGraphicsSystem("raster"); +#endif + + QApplication app(argc, argv); + app.setApplicationName("LightMaps"); + + MapZoom w; +#if defined(Q_OS_SYMBIAN) || defined(Q_OS_WINCE_WM) + w.showMaximized(); +#else + w.resize(600, 450); + w.show(); +#endif + + return app.exec(); +} diff --git a/demos/embedded/lightmaps/mapzoom.cpp b/demos/embedded/lightmaps/mapzoom.cpp new file mode 100644 index 0000000..6cafc59 --- /dev/null +++ b/demos/embedded/lightmaps/mapzoom.cpp @@ -0,0 +1,147 @@ +/**************************************************************************** +** +** 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 demonstration 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 +#include +#include "lightmaps.h" +#include "mapzoom.h" + +MapZoom::MapZoom() + : QMainWindow(0) +{ + map = new LightMaps(this); + setCentralWidget(map); + map->setFocus(); + + QAction *osloAction = new QAction(tr("&Oslo"), this); + QAction *berlinAction = new QAction(tr("&Berlin"), this); + QAction *jakartaAction = new QAction(tr("&Jakarta"), this); + QAction *nightModeAction = new QAction(tr("Night Mode"), this); + nightModeAction->setCheckable(true); + nightModeAction->setChecked(false); + QAction *osmAction = new QAction(tr("About OpenStreetMap"), this); + connect(osloAction, SIGNAL(triggered()), SLOT(chooseOslo())); + connect(berlinAction, SIGNAL(triggered()), SLOT(chooseBerlin())); + connect(jakartaAction, SIGNAL(triggered()), SLOT(chooseJakarta())); + connect(nightModeAction, SIGNAL(triggered()), map, SLOT(toggleNightMode())); + connect(osmAction, SIGNAL(triggered()), SLOT(aboutOsm())); + +#if defined(Q_OS_SYMBIAN) || defined(Q_OS_WINCE_WM) + menuBar()->addAction(osloAction); + menuBar()->addAction(berlinAction); + menuBar()->addAction(jakartaAction); + menuBar()->addAction(nightModeAction); + menuBar()->addAction(osmAction); +#else + QMenu *menu = menuBar()->addMenu(tr("&Options")); + menu->addAction(osloAction); + menu->addAction(berlinAction); + menu->addAction(jakartaAction); + menu->addSeparator(); + menu->addAction(nightModeAction); + menu->addAction(osmAction); +#endif + + QNetworkConfigurationManager manager; + if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) { + // Get saved network configuration + QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); + settings.beginGroup(QLatin1String("QtNetwork")); + const QString id = + settings.value(QLatin1String("DefaultNetworkConfiguration")).toString(); + settings.endGroup(); + + // If the saved network configuration is not currently discovered use the system + // default + QNetworkConfiguration config = manager.configurationFromIdentifier(id); + if ((config.state() & QNetworkConfiguration::Discovered) != + QNetworkConfiguration::Discovered) { + config = manager.defaultConfiguration(); + } + + networkSession = new QNetworkSession(config, this); + connect(networkSession, SIGNAL(opened()), this, SLOT(sessionOpened())); + + networkSession->open(); + } else { + networkSession = 0; + } + + setWindowTitle(tr("Light Maps")); +} + +void MapZoom::sessionOpened() +{ + // Save the used configuration + QNetworkConfiguration config = networkSession->configuration(); + QString id; + if (config.type() == QNetworkConfiguration::UserChoice) { + id = networkSession->sessionProperty( + QLatin1String("UserChoiceConfiguration")).toString(); + } else { + id = config.identifier(); + } + + QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); + settings.beginGroup(QLatin1String("QtNetwork")); + settings.setValue(QLatin1String("DefaultNetworkConfiguration"), id); + settings.endGroup(); +} + +void MapZoom::chooseOslo() +{ + map->setCenter(59.9138204, 10.7387413); +} + +void MapZoom::chooseBerlin() +{ + map->setCenter(52.52958999943302, 13.383053541183472); +} + +void MapZoom::chooseJakarta() +{ + map->setCenter(-6.211544, 106.845172); +} + +void MapZoom::aboutOsm() +{ + QDesktopServices::openUrl(QUrl("http://www.openstreetmap.org")); +} diff --git a/demos/embedded/lightmaps/mapzoom.h b/demos/embedded/lightmaps/mapzoom.h new file mode 100644 index 0000000..0b1ea8b --- /dev/null +++ b/demos/embedded/lightmaps/mapzoom.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** 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 demonstration 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 MAPZOOM_H +#define MAPZOOM_H + +#include + +class QNetworkSession; +class LightMaps; + +class MapZoom : public QMainWindow +{ + Q_OBJECT + +public: + MapZoom(); + +private slots: + void sessionOpened(); + void chooseOslo(); + void chooseBerlin(); + void chooseJakarta(); + void aboutOsm(); + +private: + LightMaps *map; + QNetworkSession *networkSession; +}; + +#endif \ No newline at end of file diff --git a/demos/embedded/lightmaps/slippymap.cpp b/demos/embedded/lightmaps/slippymap.cpp new file mode 100644 index 0000000..2c76f74 --- /dev/null +++ b/demos/embedded/lightmaps/slippymap.cpp @@ -0,0 +1,213 @@ +/**************************************************************************** +** +** 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 demonstration 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 + +#include +#include +#include "slippymap.h" + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +uint qHash(const QPoint& p) +{ + return p.x() * 17 ^ p.y(); +} + +// tile size in pixels +const int tdim = 256; + +QPointF tileForCoordinate(qreal lat, qreal lng, int zoom) +{ + qreal zn = static_cast(1 << zoom); + qreal tx = (lng + 180.0) / 360.0; + qreal ty = (1.0 - log(tan(lat * M_PI / 180.0) + + 1.0 / cos(lat * M_PI / 180.0)) / M_PI) / 2.0; + return QPointF(tx * zn, ty * zn); +} + +qreal longitudeFromTile(qreal tx, int zoom) +{ + qreal zn = static_cast(1 << zoom); + qreal lat = tx / zn * 360.0 - 180.0; + return lat; +} + +qreal latitudeFromTile(qreal ty, int zoom) +{ + qreal zn = static_cast(1 << zoom); + qreal n = M_PI - 2 * M_PI * ty / zn; + qreal lng = 180.0 / M_PI * atan(0.5 * (exp(n) - exp(-n))); + return lng; +} + + +SlippyMap::SlippyMap(QObject *parent) + : QObject(parent), width(400), height(300), zoom(15), + latitude(59.9138204), longitude(10.7387413) +{ + m_emptyTile = QPixmap(tdim, tdim); + m_emptyTile.fill(Qt::lightGray); + + QNetworkDiskCache *cache = new QNetworkDiskCache; + cache->setCacheDirectory(QDesktopServices::storageLocation + (QDesktopServices::CacheLocation)); + m_manager.setCache(cache); + connect(&m_manager, SIGNAL(finished(QNetworkReply*)), + this, SLOT(handleNetworkData(QNetworkReply*))); +} + +void SlippyMap::invalidate() +{ + if (width <= 0 || height <= 0) + return; + + QPointF ct = tileForCoordinate(latitude, longitude, zoom); + qreal tx = ct.x(); + qreal ty = ct.y(); + + // top-left corner of the center tile + int xp = width / 2 - (tx - floor(tx)) * tdim; + int yp = height / 2 - (ty - floor(ty)) * tdim; + + // first tile vertical and horizontal + int xa = (xp + tdim - 1) / tdim; + int ya = (yp + tdim - 1) / tdim; + int xs = static_cast(tx) - xa; + int ys = static_cast(ty) - ya; + + // offset for top-left tile + m_offset = QPoint(xp - xa * tdim, yp - ya * tdim); + + // last tile vertical and horizontal + int xe = static_cast(tx) + (width - xp - 1) / tdim; + int ye = static_cast(ty) + (height - yp - 1) / tdim; + + // build a rect + m_tilesRect = QRect(xs, ys, xe - xs + 1, ye - ys + 1); + + if (m_url.isEmpty()) + download(); + + emit updated(QRect(0, 0, width, height)); +} + +void SlippyMap::render(QPainter *p, const QRect &rect) +{ + for (int x = 0; x <= m_tilesRect.width(); ++x) + for (int y = 0; y <= m_tilesRect.height(); ++y) { + QPoint tp(x + m_tilesRect.left(), y + m_tilesRect.top()); + QRect box = tileRect(tp); + if (rect.intersects(box)) { + if (m_tilePixmaps.contains(tp)) + p->drawPixmap(box, m_tilePixmaps.value(tp)); + else + p->drawPixmap(box, m_emptyTile); + } + } +} + +void SlippyMap::pan(const QPoint &delta) +{ + QPointF dx = QPointF(delta) / qreal(tdim); + QPointF center = tileForCoordinate(latitude, longitude, zoom) - dx; + latitude = latitudeFromTile(center.y(), zoom); + longitude = longitudeFromTile(center.x(), zoom); + invalidate(); +} + +void SlippyMap::handleNetworkData(QNetworkReply *reply) +{ + QImage img; + QPoint tp = reply->request().attribute(QNetworkRequest::User).toPoint(); + QUrl url = reply->url(); + if (!reply->error()) + if (!img.load(reply, 0)) + img = QImage(); + reply->deleteLater(); + m_tilePixmaps[tp] = QPixmap::fromImage(img); + if (img.isNull()) + m_tilePixmaps[tp] = m_emptyTile; + emit updated(tileRect(tp)); + + // purge unused spaces + QRect bound = m_tilesRect.adjusted(-2, -2, 2, 2); + foreach(QPoint tp, m_tilePixmaps.keys()) + if (!bound.contains(tp)) + m_tilePixmaps.remove(tp); + + download(); +} + +void SlippyMap::download() +{ + QPoint grab(0, 0); + for (int x = 0; x <= m_tilesRect.width(); ++x) + for (int y = 0; y <= m_tilesRect.height(); ++y) { + QPoint tp = m_tilesRect.topLeft() + QPoint(x, y); + if (!m_tilePixmaps.contains(tp)) { + grab = tp; + break; + } + } + if (grab == QPoint(0, 0)) { + m_url = QUrl(); + return; + } + + QString path = "http://tile.openstreetmap.org/%1/%2/%3.png"; + m_url = QUrl(path.arg(zoom).arg(grab.x()).arg(grab.y())); + QNetworkRequest request; + request.setUrl(m_url); + request.setRawHeader("User-Agent", "Nokia (Qt) Graphics Dojo 1.0"); + request.setAttribute(QNetworkRequest::User, QVariant(grab)); + m_manager.get(request); +} + +QRect SlippyMap::tileRect(const QPoint &tp) +{ + QPoint t = tp - m_tilesRect.topLeft(); + int x = t.x() * tdim + m_offset.x(); + int y = t.y() * tdim + m_offset.y(); + return QRect(x, y, tdim, tdim); +} diff --git a/demos/embedded/lightmaps/slippymap.h b/demos/embedded/lightmaps/slippymap.h new file mode 100644 index 0000000..ba43e40 --- /dev/null +++ b/demos/embedded/lightmaps/slippymap.h @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** 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 demonstration 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 SLIPPYMAP_H +#define SLIPPYMAP_H + +#include +#include +#include + +class QNetworkReply; +class QPainter; + +class SlippyMap: public QObject +{ + Q_OBJECT + +public: + SlippyMap(QObject *parent = 0); + void invalidate(); + void render(QPainter *p, const QRect &rect); + void pan(const QPoint &delta); + + int width; + int height; + int zoom; + qreal latitude; + qreal longitude; + +signals: + void updated(const QRect &rect); + +private slots: + void handleNetworkData(QNetworkReply *reply); + void download(); + +protected: + QRect tileRect(const QPoint &tp); + +private: + QPoint m_offset; + QRect m_tilesRect; + QPixmap m_emptyTile; + QHash m_tilePixmaps; + QNetworkAccessManager m_manager; + QUrl m_url; +}; + +#endif \ No newline at end of file -- cgit v0.12 From 87a28f7ab7b1b94072e75740d690192bbdcfdaa5 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 30 Mar 2011 19:10:51 +0200 Subject: Removed invalid public slots section. Task-number: QTBUG-9316 --- examples/graphicsview/diagramscene/arrow.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/examples/graphicsview/diagramscene/arrow.h b/examples/graphicsview/diagramscene/arrow.h index 070f74a..cc6ff97 100644 --- a/examples/graphicsview/diagramscene/arrow.h +++ b/examples/graphicsview/diagramscene/arrow.h @@ -74,8 +74,6 @@ public: DiagramItem *endItem() const { return myEndItem; } - -public slots: void updatePosition(); protected: -- cgit v0.12 From 7fd997903620bca50a4303776ef7aca8f0ea1f01 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 5 Apr 2011 14:09:01 +0200 Subject: Fixed the declarative headers and includes within qdoc. --- tools/qdoc3/declarativeparser/qdeclarativejsast.cpp | 4 ++-- tools/qdoc3/declarativeparser/qdeclarativejsast_p.h | 4 ++-- tools/qdoc3/declarativeparser/qdeclarativejsastfwd_p.h | 2 +- tools/qdoc3/declarativeparser/qdeclarativejsastvisitor.cpp | 2 +- tools/qdoc3/declarativeparser/qdeclarativejsastvisitor_p.h | 4 ++-- tools/qdoc3/declarativeparser/qdeclarativejsengine_p.cpp | 6 +++--- tools/qdoc3/declarativeparser/qdeclarativejsengine_p.h | 4 ++-- tools/qdoc3/declarativeparser/qdeclarativejslexer.cpp | 8 ++++---- tools/qdoc3/declarativeparser/qdeclarativejslexer_p.h | 2 +- tools/qdoc3/declarativeparser/qdeclarativejsmemorypool_p.h | 2 +- tools/qdoc3/declarativeparser/qdeclarativejsnodepool_p.h | 4 ++-- tools/qdoc3/declarativeparser/qdeclarativejsparser.cpp | 10 +++++----- tools/qdoc3/declarativeparser/qdeclarativejsparser_p.h | 8 ++++---- tools/qdoc3/jscodemarker.cpp | 10 +++++----- tools/qdoc3/qmlcodemarker.cpp | 12 ++++++------ tools/qdoc3/qmlcodemarker.h | 2 +- tools/qdoc3/qmlcodeparser.cpp | 6 +++--- tools/qdoc3/qmlcodeparser.h | 6 +++--- tools/qdoc3/qmlmarkupvisitor.cpp | 6 +++--- tools/qdoc3/qmlmarkupvisitor.h | 2 +- tools/qdoc3/qmlvisitor.cpp | 6 +++--- tools/qdoc3/qmlvisitor.h | 2 +- 22 files changed, 56 insertions(+), 56 deletions(-) diff --git a/tools/qdoc3/declarativeparser/qdeclarativejsast.cpp b/tools/qdoc3/declarativeparser/qdeclarativejsast.cpp index afb399a..e59ffd7 100644 --- a/tools/qdoc3/declarativeparser/qdeclarativejsast.cpp +++ b/tools/qdoc3/declarativeparser/qdeclarativejsast.cpp @@ -39,9 +39,9 @@ ** ****************************************************************************/ -#include "private/qdeclarativejsast_p.h" +#include "qdeclarativejsast_p.h" -#include "private/qdeclarativejsastvisitor_p.h" +#include "qdeclarativejsastvisitor_p.h" QT_QML_BEGIN_NAMESPACE diff --git a/tools/qdoc3/declarativeparser/qdeclarativejsast_p.h b/tools/qdoc3/declarativeparser/qdeclarativejsast_p.h index 956d6e7..cd41187 100644 --- a/tools/qdoc3/declarativeparser/qdeclarativejsast_p.h +++ b/tools/qdoc3/declarativeparser/qdeclarativejsast_p.h @@ -53,8 +53,8 @@ // We mean it. // -#include "private/qdeclarativejsastvisitor_p.h" -#include "private/qdeclarativejsglobal_p.h" +#include "qdeclarativejsastvisitor_p.h" +#include "qdeclarativejsglobal_p.h" #include diff --git a/tools/qdoc3/declarativeparser/qdeclarativejsastfwd_p.h b/tools/qdoc3/declarativeparser/qdeclarativejsastfwd_p.h index 8a20ab2..8344d54 100644 --- a/tools/qdoc3/declarativeparser/qdeclarativejsastfwd_p.h +++ b/tools/qdoc3/declarativeparser/qdeclarativejsastfwd_p.h @@ -42,7 +42,7 @@ #ifndef QDECLARATIVEJSAST_FWD_P_H #define QDECLARATIVEJSAST_FWD_P_H -#include "private/qdeclarativejsglobal_p.h" +#include "qdeclarativejsglobal_p.h" #include diff --git a/tools/qdoc3/declarativeparser/qdeclarativejsastvisitor.cpp b/tools/qdoc3/declarativeparser/qdeclarativejsastvisitor.cpp index 8df755a..b4eecc1 100644 --- a/tools/qdoc3/declarativeparser/qdeclarativejsastvisitor.cpp +++ b/tools/qdoc3/declarativeparser/qdeclarativejsastvisitor.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "private/qdeclarativejsastvisitor_p.h" +#include "qdeclarativejsastvisitor_p.h" QT_QML_BEGIN_NAMESPACE diff --git a/tools/qdoc3/declarativeparser/qdeclarativejsastvisitor_p.h b/tools/qdoc3/declarativeparser/qdeclarativejsastvisitor_p.h index 519b8c8..6ef7c81 100644 --- a/tools/qdoc3/declarativeparser/qdeclarativejsastvisitor_p.h +++ b/tools/qdoc3/declarativeparser/qdeclarativejsastvisitor_p.h @@ -53,8 +53,8 @@ // We mean it. // -#include "private/qdeclarativejsastfwd_p.h" -#include "private/qdeclarativejsglobal_p.h" +#include "qdeclarativejsastfwd_p.h" +#include "qdeclarativejsglobal_p.h" QT_QML_BEGIN_NAMESPACE diff --git a/tools/qdoc3/declarativeparser/qdeclarativejsengine_p.cpp b/tools/qdoc3/declarativeparser/qdeclarativejsengine_p.cpp index ec9271a..4d135c2 100644 --- a/tools/qdoc3/declarativeparser/qdeclarativejsengine_p.cpp +++ b/tools/qdoc3/declarativeparser/qdeclarativejsengine_p.cpp @@ -39,10 +39,10 @@ ** ****************************************************************************/ -#include "private/qdeclarativejsengine_p.h" +#include "qdeclarativejsengine_p.h" -#include "private/qdeclarativejsglobal_p.h" -#include "private/qdeclarativejsnodepool_p.h" +#include "qdeclarativejsglobal_p.h" +#include "qdeclarativejsnodepool_p.h" #include #include diff --git a/tools/qdoc3/declarativeparser/qdeclarativejsengine_p.h b/tools/qdoc3/declarativeparser/qdeclarativejsengine_p.h index 6c18b50..c6126ea 100644 --- a/tools/qdoc3/declarativeparser/qdeclarativejsengine_p.h +++ b/tools/qdoc3/declarativeparser/qdeclarativejsengine_p.h @@ -53,8 +53,8 @@ // We mean it. // -#include "private/qdeclarativejsglobal_p.h" -#include "private/qdeclarativejsastfwd_p.h" +#include "qdeclarativejsglobal_p.h" +#include "qdeclarativejsastfwd_p.h" #include #include diff --git a/tools/qdoc3/declarativeparser/qdeclarativejslexer.cpp b/tools/qdoc3/declarativeparser/qdeclarativejslexer.cpp index 4dfef45..f5fb791 100644 --- a/tools/qdoc3/declarativeparser/qdeclarativejslexer.cpp +++ b/tools/qdoc3/declarativeparser/qdeclarativejslexer.cpp @@ -43,11 +43,11 @@ #include #endif -#include "private/qdeclarativejslexer_p.h" +#include "qdeclarativejslexer_p.h" -#include "private/qdeclarativejsglobal_p.h" -#include "private/qdeclarativejsengine_p.h" -#include "private/qdeclarativejsgrammar_p.h" +#include "qdeclarativejsglobal_p.h" +#include "qdeclarativejsengine_p.h" +#include "qdeclarativejsgrammar_p.h" #include diff --git a/tools/qdoc3/declarativeparser/qdeclarativejslexer_p.h b/tools/qdoc3/declarativeparser/qdeclarativejslexer_p.h index e41337d..8febb54 100644 --- a/tools/qdoc3/declarativeparser/qdeclarativejslexer_p.h +++ b/tools/qdoc3/declarativeparser/qdeclarativejslexer_p.h @@ -53,7 +53,7 @@ // We mean it. // -#include "private/qdeclarativejsglobal_p.h" +#include "qdeclarativejsglobal_p.h" #include diff --git a/tools/qdoc3/declarativeparser/qdeclarativejsmemorypool_p.h b/tools/qdoc3/declarativeparser/qdeclarativejsmemorypool_p.h index 7eea975..ebf75d1 100644 --- a/tools/qdoc3/declarativeparser/qdeclarativejsmemorypool_p.h +++ b/tools/qdoc3/declarativeparser/qdeclarativejsmemorypool_p.h @@ -53,7 +53,7 @@ // We mean it. // -#include "private/qdeclarativejsglobal_p.h" +#include "qdeclarativejsglobal_p.h" #include #include diff --git a/tools/qdoc3/declarativeparser/qdeclarativejsnodepool_p.h b/tools/qdoc3/declarativeparser/qdeclarativejsnodepool_p.h index fde4897..ca3841c 100644 --- a/tools/qdoc3/declarativeparser/qdeclarativejsnodepool_p.h +++ b/tools/qdoc3/declarativeparser/qdeclarativejsnodepool_p.h @@ -53,8 +53,8 @@ // We mean it. // -#include "private/qdeclarativejsglobal_p.h" -#include "private/qdeclarativejsmemorypool_p.h" +#include "qdeclarativejsglobal_p.h" +#include "qdeclarativejsmemorypool_p.h" #include #include diff --git a/tools/qdoc3/declarativeparser/qdeclarativejsparser.cpp b/tools/qdoc3/declarativeparser/qdeclarativejsparser.cpp index 9a93fa1..118dcc6 100644 --- a/tools/qdoc3/declarativeparser/qdeclarativejsparser.cpp +++ b/tools/qdoc3/declarativeparser/qdeclarativejsparser.cpp @@ -44,14 +44,14 @@ #include -#include "private/qdeclarativejsengine_p.h" -#include "private/qdeclarativejslexer_p.h" -#include "private/qdeclarativejsast_p.h" -#include "private/qdeclarativejsnodepool_p.h" +#include "qdeclarativejsengine_p.h" +#include "qdeclarativejslexer_p.h" +#include "qdeclarativejsast_p.h" +#include "qdeclarativejsnodepool_p.h" -#include "private/qdeclarativejsparser_p.h" +#include "qdeclarativejsparser_p.h" #include // diff --git a/tools/qdoc3/declarativeparser/qdeclarativejsparser_p.h b/tools/qdoc3/declarativeparser/qdeclarativejsparser_p.h index ad46bff..5eec1a4 100644 --- a/tools/qdoc3/declarativeparser/qdeclarativejsparser_p.h +++ b/tools/qdoc3/declarativeparser/qdeclarativejsparser_p.h @@ -59,10 +59,10 @@ #ifndef QDECLARATIVEJSPARSER_P_H #define QDECLARATIVEJSPARSER_P_H -#include "private/qdeclarativejsglobal_p.h" -#include "private/qdeclarativejsgrammar_p.h" -#include "private/qdeclarativejsast_p.h" -#include "private/qdeclarativejsengine_p.h" +#include "qdeclarativejsglobal_p.h" +#include "qdeclarativejsgrammar_p.h" +#include "qdeclarativejsast_p.h" +#include "qdeclarativejsengine_p.h" #include #include diff --git a/tools/qdoc3/jscodemarker.cpp b/tools/qdoc3/jscodemarker.cpp index 5a513f7..cbf040f 100644 --- a/tools/qdoc3/jscodemarker.cpp +++ b/tools/qdoc3/jscodemarker.cpp @@ -43,11 +43,11 @@ 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 "declarativeparser/qdeclarativejsast_p.h" +#include "declarativeparser/qdeclarativejsengine_p.h" +#include "declarativeparser/qdeclarativejslexer_p.h" +#include "declarativeparser/qdeclarativejsnodepool_p.h" +#include "declarativeparser/qdeclarativejsparser_p.h" #include "atom.h" #include "node.h" diff --git a/tools/qdoc3/qmlcodemarker.cpp b/tools/qdoc3/qmlcodemarker.cpp index a7dc5a0..ccca7b5 100644 --- a/tools/qdoc3/qmlcodemarker.cpp +++ b/tools/qdoc3/qmlcodemarker.cpp @@ -43,12 +43,12 @@ 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 "declarativeparser/qdeclarativejsast_p.h" +#include "declarativeparser/qdeclarativejsastfwd_p.h" +#include "declarativeparser/qdeclarativejsengine_p.h" +#include "declarativeparser/qdeclarativejslexer_p.h" +#include "declarativeparser/qdeclarativejsnodepool_p.h" +#include "declarativeparser/qdeclarativejsparser_p.h" #include "atom.h" #include "node.h" diff --git a/tools/qdoc3/qmlcodemarker.h b/tools/qdoc3/qmlcodemarker.h index d693456..aab3455 100644 --- a/tools/qdoc3/qmlcodemarker.h +++ b/tools/qdoc3/qmlcodemarker.h @@ -46,7 +46,7 @@ #ifndef QMLCODEMARKER_H #define QMLCODEMARKER_H -#include "private/qdeclarativejsastfwd_p.h" +#include "declarativeparser/qdeclarativejsastfwd_p.h" #include "cppcodemarker.h" QT_BEGIN_NAMESPACE diff --git a/tools/qdoc3/qmlcodeparser.cpp b/tools/qdoc3/qmlcodeparser.cpp index 93a3ff9..45ca96f 100644 --- a/tools/qdoc3/qmlcodeparser.cpp +++ b/tools/qdoc3/qmlcodeparser.cpp @@ -43,9 +43,9 @@ qmlcodeparser.cpp */ -#include "private/qdeclarativejsast_p.h" -#include "private/qdeclarativejsastvisitor_p.h" -#include "private/qdeclarativejsnodepool_p.h" +#include "declarativeparser/qdeclarativejsast_p.h" +#include "declarativeparser/qdeclarativejsastvisitor_p.h" +#include "declarativeparser/qdeclarativejsnodepool_p.h" #include "qmlcodeparser.h" #include "node.h" diff --git a/tools/qdoc3/qmlcodeparser.h b/tools/qdoc3/qmlcodeparser.h index e5cc0dd..667cf5e 100644 --- a/tools/qdoc3/qmlcodeparser.h +++ b/tools/qdoc3/qmlcodeparser.h @@ -47,9 +47,9 @@ #define QMLCODEPARSER_H #include -#include "private/qdeclarativejsengine_p.h" -#include "private/qdeclarativejslexer_p.h" -#include "private/qdeclarativejsparser_p.h" +#include "declarativeparser/qdeclarativejsengine_p.h" +#include "declarativeparser/qdeclarativejslexer_p.h" +#include "declarativeparser/qdeclarativejsparser_p.h" #include "codeparser.h" #include "location.h" diff --git a/tools/qdoc3/qmlmarkupvisitor.cpp b/tools/qdoc3/qmlmarkupvisitor.cpp index 7acac48..d88694b 100644 --- a/tools/qdoc3/qmlmarkupvisitor.cpp +++ b/tools/qdoc3/qmlmarkupvisitor.cpp @@ -41,9 +41,9 @@ #include #include -#include "private/qdeclarativejsast_p.h" -#include "private/qdeclarativejsastfwd_p.h" -#include "private/qdeclarativejsengine_p.h" +#include "declarativeparser/qdeclarativejsast_p.h" +#include "declarativeparser/qdeclarativejsastfwd_p.h" +#include "declarativeparser/qdeclarativejsengine_p.h" #include "qmlmarkupvisitor.h" diff --git a/tools/qdoc3/qmlmarkupvisitor.h b/tools/qdoc3/qmlmarkupvisitor.h index 709a858..97e392f 100644 --- a/tools/qdoc3/qmlmarkupvisitor.h +++ b/tools/qdoc3/qmlmarkupvisitor.h @@ -43,7 +43,7 @@ #define QMLVISITOR_H #include -#include "private/qdeclarativejsastvisitor_p.h" +#include "declarativeparser/qdeclarativejsastvisitor_p.h" #include "node.h" #include "tree.h" diff --git a/tools/qdoc3/qmlvisitor.cpp b/tools/qdoc3/qmlvisitor.cpp index 9295624..fc65093 100644 --- a/tools/qdoc3/qmlvisitor.cpp +++ b/tools/qdoc3/qmlvisitor.cpp @@ -42,9 +42,9 @@ #include #include #include -#include "private/qdeclarativejsast_p.h" -#include "private/qdeclarativejsastfwd_p.h" -#include "private/qdeclarativejsengine_p.h" +#include "declarativeparser/qdeclarativejsast_p.h" +#include "declarativeparser/qdeclarativejsastfwd_p.h" +#include "declarativeparser/qdeclarativejsengine_p.h" #include "node.h" #include "qmlvisitor.h" diff --git a/tools/qdoc3/qmlvisitor.h b/tools/qdoc3/qmlvisitor.h index 9da2c72..4771f9e 100644 --- a/tools/qdoc3/qmlvisitor.h +++ b/tools/qdoc3/qmlvisitor.h @@ -43,7 +43,7 @@ #define QMLVISITOR_H #include -#include "private/qdeclarativejsastvisitor_p.h" +#include "declarativeparser/qdeclarativejsastvisitor_p.h" #include "node.h" #include "tree.h" -- cgit v0.12