diff options
author | Joerg Bornemann <joerg.bornemann@nokia.com> | 2010-02-26 15:19:54 (GMT) |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@nokia.com> | 2010-02-26 15:19:54 (GMT) |
commit | ed1d9f24d035857438e5bb9ccb423310bc30310b (patch) | |
tree | ef949d57470b11331a6a2b667f2cdb5467c285cd /tools | |
parent | ab9a87eb2a5af0b74834e247f44fb4fad0dfb8cb (diff) | |
parent | 27e403d9c6185c606980bb7881e39a2c88138a13 (diff) | |
download | Qt-ed1d9f24d035857438e5bb9ccb423310bc30310b.zip Qt-ed1d9f24d035857438e5bb9ccb423310bc30310b.tar.gz Qt-ed1d9f24d035857438e5bb9ccb423310bc30310b.tar.bz2 |
Merge remote branch 'origin/master' into berlin-master
Conflicts:
configure.exe
Diffstat (limited to 'tools')
-rw-r--r-- | tools/assistant/lib/qhelp_global.cpp | 2 | ||||
-rw-r--r-- | tools/assistant/lib/qhelpdbreader.cpp | 2 | ||||
-rw-r--r-- | tools/configure/configureapp.cpp | 18 | ||||
-rw-r--r-- | tools/linguist/lupdate/lupdate.pro | 2 | ||||
-rw-r--r-- | tools/linguist/lupdate/qdeclarative.cpp (renamed from tools/linguist/lupdate/qml.cpp) | 14 | ||||
-rw-r--r-- | tools/qdoc3/codemarker.cpp | 2 | ||||
-rw-r--r-- | tools/qdoc3/cppcodemarker.cpp | 2 | ||||
-rw-r--r-- | tools/qdoc3/cppcodeparser.cpp | 2 | ||||
-rw-r--r-- | tools/qdoc3/generator.cpp | 26 | ||||
-rw-r--r-- | tools/qdoc3/generator.h | 7 | ||||
-rw-r--r-- | tools/qdoc3/htmlgenerator.cpp | 56 | ||||
-rw-r--r-- | tools/qdoc3/htmlgenerator.h | 2 | ||||
-rw-r--r-- | tools/qdoc3/node.cpp | 8 | ||||
-rw-r--r-- | tools/qdoc3/node.h | 6 | ||||
-rw-r--r-- | tools/qdoc3/test/qt_zh_CN.qdocconf | 86 | ||||
-rw-r--r-- | tools/qml/content/Browser.qml (renamed from tools/qmlviewer/content/Browser.qml) | 0 | ||||
-rw-r--r-- | tools/qml/content/images/folder.png (renamed from tools/qmlviewer/content/images/folder.png) | bin | 1841 -> 1841 bytes | |||
-rw-r--r-- | tools/qml/content/images/titlebar.png (renamed from tools/qmlviewer/content/images/titlebar.png) | bin | 1436 -> 1436 bytes | |||
-rw-r--r-- | tools/qml/content/images/titlebar.sci (renamed from tools/qmlviewer/content/images/titlebar.sci) | 0 | ||||
-rw-r--r-- | tools/qml/content/images/up.png (renamed from tools/qmlviewer/content/images/up.png) | bin | 662 -> 662 bytes | |||
-rw-r--r-- | tools/qml/deviceorientation.cpp (renamed from tools/qmlviewer/deviceorientation.cpp) | 0 | ||||
-rw-r--r-- | tools/qml/deviceorientation.h (renamed from tools/qmlviewer/deviceorientation.h) | 0 | ||||
-rw-r--r-- | tools/qml/deviceorientation_maemo.cpp (renamed from tools/qmlviewer/deviceorientation_maemo.cpp) | 0 | ||||
-rw-r--r-- | tools/qml/main.cpp (renamed from tools/qmlviewer/main.cpp) | 36 | ||||
-rw-r--r-- | tools/qml/proxysettings.cpp (renamed from tools/qmlviewer/proxysettings.cpp) | 0 | ||||
-rw-r--r-- | tools/qml/proxysettings.h (renamed from tools/qmlviewer/proxysettings.h) | 0 | ||||
-rw-r--r-- | tools/qml/proxysettings.ui (renamed from tools/qmlviewer/proxysettings.ui) | 0 | ||||
-rw-r--r-- | tools/qml/qdeclarativefolderlistmodel.cpp (renamed from tools/qmlviewer/qmlfolderlistmodel.cpp) | 86 | ||||
-rw-r--r-- | tools/qml/qdeclarativefolderlistmodel.h (renamed from tools/qmlviewer/qmlfolderlistmodel.h) | 30 | ||||
-rw-r--r-- | tools/qml/qfxtester.cpp (renamed from tools/qmlviewer/qfxtester.cpp) | 89 | ||||
-rw-r--r-- | tools/qml/qfxtester.h (renamed from tools/qmlviewer/qfxtester.h) | 42 | ||||
-rw-r--r-- | tools/qml/qml.pro (renamed from tools/qmlviewer/qmlviewer.pro) | 12 | ||||
-rw-r--r-- | tools/qml/qmlruntime.cpp (renamed from tools/qmlviewer/qmlviewer.cpp) | 171 | ||||
-rw-r--r-- | tools/qml/qmlruntime.h (renamed from tools/qmlviewer/qmlviewer.h) | 32 | ||||
-rw-r--r-- | tools/qml/qmlruntime.qrc (renamed from tools/qmlviewer/qmlviewer.qrc) | 0 | ||||
-rw-r--r-- | tools/qml/recopts.ui (renamed from tools/qmlviewer/recopts.ui) | 0 | ||||
-rw-r--r-- | tools/qtconfig/mainwindow.cpp | 6 | ||||
-rw-r--r-- | tools/qtconfig/qtconfig.pro | 5 | ||||
-rw-r--r-- | tools/tools.pro | 2 |
39 files changed, 421 insertions, 325 deletions
diff --git a/tools/assistant/lib/qhelp_global.cpp b/tools/assistant/lib/qhelp_global.cpp index d8a94d3..c2c916b 100644 --- a/tools/assistant/lib/qhelp_global.cpp +++ b/tools/assistant/lib/qhelp_global.cpp @@ -56,7 +56,7 @@ QString QHelpGlobal::uniquifyConnectionName(const QString &name, void *pointer) counter = 0; return QString::fromLatin1("%1-%2-%3"). - arg(name).arg(long(pointer)).arg(counter); + arg(name).arg(quintptr(pointer)).arg(counter); } QString QHelpGlobal::documentTitle(const QString &content) diff --git a/tools/assistant/lib/qhelpdbreader.cpp b/tools/assistant/lib/qhelpdbreader.cpp index 6dd949a..5c0f595 100644 --- a/tools/assistant/lib/qhelpdbreader.cpp +++ b/tools/assistant/lib/qhelpdbreader.cpp @@ -205,7 +205,7 @@ QByteArray QHelpDBReader::fileData(const QString &virtualFolder, "NamespaceTable d WHERE a.Id=b.FileId AND (b.Name=? OR b.Name=?) AND b.FolderId=c.Id " "AND c.Name=? AND c.NamespaceId=d.Id AND d.Name=?")); m_query->bindValue(0, filePath); - m_query->bindValue(1, QLatin1String("./") + filePath); + m_query->bindValue(1, QString(QLatin1String("./") + filePath)); m_query->bindValue(2, virtualFolder); m_query->bindValue(3, m_namespace); m_query->exec(); diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 36c7753..c0a29ca 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1070,6 +1070,12 @@ void Configure::parseCmdLine() dictionary[ "QT_INSTALL_PLUGINS" ] = configCmdLine.at(i); } + else if( configCmdLine.at(i) == "-importdir" ) { + ++i; + if(i==argCount) + break; + dictionary[ "QT_INSTALL_IMPORTS" ] = configCmdLine.at(i); + } else if( configCmdLine.at(i) == "-datadir" ) { ++i; if(i==argCount) @@ -1487,6 +1493,7 @@ void Configure::applySpecSpecifics() dictionary[ "QT_HOST_PREFIX" ] = dictionary[ "QT_INSTALL_PREFIX" ]; dictionary[ "QT_INSTALL_PREFIX" ] = ""; dictionary[ "QT_INSTALL_PLUGINS" ] = "\\resource\\qt\\plugins"; + dictionary[ "QT_INSTALL_IMPORTS" ] = "\\resource\\qt\\imports"; dictionary[ "ARM_FPU_TYPE" ] = "softvfp"; dictionary[ "SQL_SQLITE" ] = "yes"; dictionary[ "SQL_SQLITE_LIB" ] = "system"; @@ -1563,7 +1570,7 @@ bool Configure::displayHelp() desc("Usage: configure [-buildkey <key>]\n" // desc("Usage: configure [-prefix dir] [-bindir <dir>] [-libdir <dir>]\n" // "[-docdir <dir>] [-headerdir <dir>] [-plugindir <dir>]\n" -// "[-datadir <dir>] [-translationdir <dir>]\n" +// "[-importdir <dir>] [-datadir <dir>] [-translationdir <dir>]\n" // "[-examplesdir <dir>] [-demosdir <dir>][-buildkey <key>]\n" "[-release] [-debug] [-debug-and-release] [-shared] [-static]\n" "[-no-fast] [-fast] [-no-exceptions] [-exceptions]\n" @@ -1603,6 +1610,7 @@ bool Configure::displayHelp() desc( "-docdir <dir>", "Documentation will be installed to dir\n(default PREFIX/doc)"); desc( "-headerdir <dir>", "Headers will be installed to dir\n(default PREFIX/include)"); desc( "-plugindir <dir>", "Plugins will be installed to dir\n(default PREFIX/plugins)"); + desc( "-importdir <dir>", "Imports for QML will be installed to dir\n(default PREFIX/imports)"); desc( "-datadir <dir>", "Data used by Qt programs will be installed to dir\n(default PREFIX)"); desc( "-translationdir <dir>","Translations of Qt programs will be installed to dir\n(default PREFIX/translations)\n"); desc( "-examplesdir <dir>", "Examples will be installed to dir\n(default PREFIX/examples)"); @@ -2074,7 +2082,7 @@ bool Configure::checkAvailability(const QString &part) } else if (part == "WEBKIT") { available = (dictionary.value("QMAKESPEC") == "win32-msvc2005") || (dictionary.value("QMAKESPEC") == "win32-msvc2008") || (dictionary.value("QMAKESPEC") == "win32-g++"); } else if (part == "DECLARATIVE") { - available = QFile::exists(sourcePath + "/src/declarative/qml/qmlcomponent.h"); + available = QFile::exists(sourcePath + "/src/declarative/qml/qdeclarativecomponent.h"); } else if (part == "AUDIO_BACKEND") { available = true; if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) { @@ -2657,6 +2665,8 @@ void Configure::generateOutputVars() dictionary[ "QT_INSTALL_BINS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/bin" ); if( !dictionary[ "QT_INSTALL_PLUGINS" ].size() ) dictionary[ "QT_INSTALL_PLUGINS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/plugins" ); + if( !dictionary[ "QT_INSTALL_IMPORTS" ].size() ) + dictionary[ "QT_INSTALL_IMPORTS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/imports" ); if( !dictionary[ "QT_INSTALL_DATA" ].size() ) dictionary[ "QT_INSTALL_DATA" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] ); if( !dictionary[ "QT_INSTALL_TRANSLATIONS" ].size() ) @@ -3161,6 +3171,7 @@ void Configure::generateConfigfiles() << "static const char qt_configure_libraries_path_str [512 + 12] = \"qt_libspath=" << QString(dictionary["QT_INSTALL_LIBS"]).replace( "\\", "\\\\" ) << "\";" << endl << "static const char qt_configure_binaries_path_str [512 + 12] = \"qt_binspath=" << QString(dictionary["QT_INSTALL_BINS"]).replace( "\\", "\\\\" ) << "\";" << endl << "static const char qt_configure_plugins_path_str [512 + 12] = \"qt_plugpath=" << QString(dictionary["QT_INSTALL_PLUGINS"]).replace( "\\", "\\\\" ) << "\";" << endl + << "static const char qt_configure_imports_path_str [512 + 12] = \"qt_impspath=" << QString(dictionary["QT_INSTALL_IMPORTS"]).replace( "\\", "\\\\" ) << "\";" << endl << "static const char qt_configure_data_path_str [512 + 12] = \"qt_datapath=" << QString(dictionary["QT_INSTALL_DATA"]).replace( "\\", "\\\\" ) << "\";" << endl << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << QString(dictionary["QT_INSTALL_TRANSLATIONS"]).replace( "\\", "\\\\" ) << "\";" << endl << "static const char qt_configure_examples_path_str [512 + 12] = \"qt_xmplpath=" << QString(dictionary["QT_INSTALL_EXAMPLES"]).replace( "\\", "\\\\" ) << "\";" << endl @@ -3175,6 +3186,7 @@ void Configure::generateConfigfiles() << "static const char qt_configure_libraries_path_str [512 + 12] = \"qt_libspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/lib").replace( "\\", "\\\\" ) <<"\";" << endl << "static const char qt_configure_binaries_path_str [512 + 12] = \"qt_binspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/bin").replace( "\\", "\\\\" ) <<"\";" << endl << "static const char qt_configure_plugins_path_str [512 + 12] = \"qt_plugpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/plugins").replace( "\\", "\\\\" ) <<"\";" << endl + << "static const char qt_configure_imports_path_str [512 + 12] = \"qt_impspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/imports").replace( "\\", "\\\\" ) <<"\";" << endl << "static const char qt_configure_data_path_str [512 + 12] = \"qt_datapath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ]).replace( "\\", "\\\\" ) <<"\";" << endl << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/translations").replace( "\\", "\\\\" ) <<"\";" << endl << "static const char qt_configure_examples_path_str [512 + 12] = \"qt_xmplpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/example").replace( "\\", "\\\\" ) <<"\";" << endl @@ -3190,6 +3202,7 @@ void Configure::generateConfigfiles() << "#define QT_CONFIGURE_LIBRARIES_PATH qt_configure_libraries_path_str + 12;" << endl << "#define QT_CONFIGURE_BINARIES_PATH qt_configure_binaries_path_str + 12;" << endl << "#define QT_CONFIGURE_PLUGINS_PATH qt_configure_plugins_path_str + 12;" << endl + << "#define QT_CONFIGURE_IMPORTS_PATH qt_configure_imports_path_str + 12;" << endl << "#define QT_CONFIGURE_DATA_PATH qt_configure_data_path_str + 12;" << endl << "#define QT_CONFIGURE_TRANSLATIONS_PATH qt_configure_translations_path_str + 12;" << endl << "#define QT_CONFIGURE_EXAMPLES_PATH qt_configure_examples_path_str + 12;" << endl @@ -3336,6 +3349,7 @@ void Configure::displayConfig() cout << "Headers installed to........" << dictionary[ "QT_INSTALL_HEADERS" ] << endl; cout << "Libraries installed to......" << dictionary[ "QT_INSTALL_LIBS" ] << endl; cout << "Plugins installed to........" << dictionary[ "QT_INSTALL_PLUGINS" ] << endl; + cout << "Imports installed to........" << dictionary[ "QT_INSTALL_IMPORTS" ] << endl; cout << "Binaries installed to......." << dictionary[ "QT_INSTALL_BINS" ] << endl; cout << "Docs installed to..........." << dictionary[ "QT_INSTALL_DOCS" ] << endl; cout << "Data installed to..........." << dictionary[ "QT_INSTALL_DATA" ] << endl; diff --git a/tools/linguist/lupdate/lupdate.pro b/tools/linguist/lupdate/lupdate.pro index 283d69f..1f88931 100644 --- a/tools/linguist/lupdate/lupdate.pro +++ b/tools/linguist/lupdate/lupdate.pro @@ -26,7 +26,7 @@ SOURCES += \ cpp.cpp \ java.cpp \ qscript.cpp \ - qml.cpp \ + qdeclarative.cpp \ ui.cpp HEADERS += \ diff --git a/tools/linguist/lupdate/qml.cpp b/tools/linguist/lupdate/qdeclarative.cpp index cb35f47..a734e99 100644 --- a/tools/linguist/lupdate/qml.cpp +++ b/tools/linguist/lupdate/qdeclarative.cpp @@ -47,12 +47,12 @@ #include <QtCore/QFile> #include <QtCore/QString> -#include "parser/qmljsengine_p.h" -#include "parser/qmljsparser_p.h" -#include "parser/qmljslexer_p.h" -#include "parser/qmljsnodepool_p.h" -#include "parser/qmljsastvisitor_p.h" -#include "parser/qmljsast_p.h" +#include "parser/qdeclarativejsengine_p.h" +#include "parser/qdeclarativejsparser_p.h" +#include "parser/qdeclarativejslexer_p.h" +#include "parser/qdeclarativejsnodepool_p.h" +#include "parser/qdeclarativejsastvisitor_p.h" +#include "parser/qdeclarativejsast_p.h" #include <QCoreApplication> #include <QFile> @@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE -using namespace QmlJS; +using namespace QDeclarativeJS; class FindTrCalls: protected AST::Visitor { diff --git a/tools/qdoc3/codemarker.cpp b/tools/qdoc3/codemarker.cpp index ee93080..15f2c2d 100644 --- a/tools/qdoc3/codemarker.cpp +++ b/tools/qdoc3/codemarker.cpp @@ -177,7 +177,7 @@ const Node *CodeMarker::nodeForString(const QString& string) QString CodeMarker::stringForNode(const Node *node) { if (sizeof(const Node *) == sizeof(ulong)) { - return QString::number(reinterpret_cast<ulong>(node)); + return QString::number(reinterpret_cast<quintptr>(node)); } else { return QString::number(reinterpret_cast<qulonglong>(node)); diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index 657cfbb..3ff6ebe 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -145,7 +145,7 @@ QString CppCodeMarker::plainFullName(const Node *node, const Node *relative) } else { QString fullName; - for (;;) { + while (node) { fullName.prepend(plainName(node)); if (node->parent() == relative || node->parent()->name().isEmpty()) break; diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index d9e9c3b..021d64a 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -1034,7 +1034,7 @@ void CppCodeParser::processOtherMetaCommand(const Doc& doc, else if (command == COMMAND_QMLINHERITS) { setLink(node, Node::InheritsLink, arg); if (node->subType() == Node::QmlClass) { - QmlClassNode::addInheritedBy(arg,node); + QmlClassNode::addInheritedBy(arg,node->name()); } } else if (command == COMMAND_QMLDEFAULT) { diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index a7ab453..6a8899a 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -1186,32 +1186,6 @@ void Generator::appendSortedNames(Text& text, } } -void Generator::appendSortedNames(Text& text, - const Node* base, - const NodeList& subs, - CodeMarker *marker) -{ - NodeList::ConstIterator r; - QMap<QString,Text> classMap; - int index = 0; - - r = subs.begin(); - while (r != subs.end()) { - Text className; - appendFullName(className, (*r), base, marker); - classMap[className.toString().toLower()] = className; - ++r; - } - - QStringList classNames = classMap.keys(); - classNames.sort(); - - foreach (const QString &className, classNames) { - text << classMap[className]; - text << separator(index++, classNames.count()); - } -} - int Generator::skipAtoms(const Atom *atom, Atom::Type type) const { int skipAhead = 0; diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h index 50ffb0a..44f56e2 100644 --- a/tools/qdoc3/generator.h +++ b/tools/qdoc3/generator.h @@ -169,13 +169,6 @@ class Generator const QList<RelatedClass> &classes, CodeMarker *marker); - protected: - void appendSortedNames(Text& text, - const Node* base, - const NodeList& subs, - CodeMarker *marker); - - private: QString amp; QString lt; QString gt; diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 0477ebb..e767460 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -73,7 +73,6 @@ QString HtmlGenerator::sinceTitles[] = " New Typedefs", " New Properties", " New Variables", - " New QML Elements", " New Qml Properties", " New Qml Signals", " New Qml Methods", @@ -688,8 +687,6 @@ int HtmlGenerator::generateAtom(const Atom *atom, nsmap = newSinceMaps.find(atom->string()); NewClassMaps::const_iterator ncmap; ncmap = newClassMaps.find(atom->string()); - NewClassMaps::const_iterator nqcmap; - nqcmap = newQmlClassMaps.find(atom->string()); if ((nsmap != newSinceMaps.constEnd()) && !nsmap.value().isEmpty()) { QList<Section> sections; QList<Section>::ConstIterator s; @@ -700,10 +697,6 @@ int HtmlGenerator::generateAtom(const Atom *atom, while (n != nsmap.value().constEnd()) { const Node* node = n.value(); switch (node->type()) { - case Node::Fake: - if (node->subType() == Node::QmlClass) - sections[QmlClass].appendMember((Node*)node); - break; case Node::Namespace: sections[Namespace].appendMember((Node*)node); break; @@ -789,8 +782,6 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << "<h3>" << protectEnc((*s).name) << "</h3>\n"; if (idx == Class) generateCompactList(0, marker, ncmap.value(), QString("Q")); - else if (idx == QmlClass) - generateCompactList(0, marker, nqcmap.value(), QString("Q")); else if (idx == MemberFunction) { ParentMaps parentmaps; ParentMaps::iterator pmap; @@ -2341,11 +2332,7 @@ void HtmlGenerator::generateCompactList(const Node *relative, out() << "<a 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("::"); + QStringList pieces = fullName(it.value(), relative, marker).split("::"); out() << protectEnc(pieces.last()); out() << "</a>"; if (pieces.size() > 1) { @@ -3736,9 +3723,6 @@ void HtmlGenerator::findAllSince(const InnerNode *node) NewClassMaps::iterator ncmap = newClassMaps.find(sinceVersion); if (ncmap == newClassMaps.end()) ncmap = newClassMaps.insert(sinceVersion,NodeMap()); - NewClassMaps::iterator nqcmap = newQmlClassMaps.find(sinceVersion); - if (nqcmap == newQmlClassMaps.end()) - nqcmap = newQmlClassMaps.insert(sinceVersion,NodeMap()); if ((*child)->type() == Node::Function) { FunctionNode *func = static_cast<FunctionNode *>(*child); @@ -3758,15 +3742,6 @@ void HtmlGenerator::findAllSince(const InnerNode *node) nsmap.value().insert(className,(*child)); ncmap.value().insert(className,(*child)); } - else if ((*child)->subType() == Node::QmlClass) { - QString className = (*child)->name(); - if ((*child)->parent() && - (*child)->parent()->type() == Node::Namespace && - !(*child)->parent()->name().isEmpty()) - className = (*child)->parent()->name()+"::"+className; - nsmap.value().insert(className,(*child)); - nqcmap.value().insert(className,(*child)); - } } else { QString name = (*child)->name(); @@ -4341,15 +4316,40 @@ void HtmlGenerator::generateQmlInheritedBy(const QmlClassNode* cn, CodeMarker* marker) { if (cn) { - NodeList subs; + QStringList subs; QmlClassNode::subclasses(cn->name(),subs); if (!subs.isEmpty()) { + subs.sort(); Text text; text << Atom::ParaLeft << "Inherited by "; - appendSortedNames(text,cn,subs,marker); + for (int i = 0; i < subs.size(); ++i) { + text << subs.at(i); + text << separator(i, subs.size()); + } text << Atom::ParaRight; generateText(text, cn, marker); } +#if 0 + if (cn->links().contains(Node::InheritsLink)) { + QPair<QString,QString> linkPair; + linkPair = cn->links()[Node::InheritsLink]; + QStringList strList(linkPair.first); + const Node* n = myTree->findNode(strList,Node::Fake); + if (n && n->subType() == Node::QmlClass) { + const QmlClassNode* qcn = static_cast<const QmlClassNode*>(n); + out() << "<p style=\"text-align: center\">"; + Text text; + text << "[Inherits "; + text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn)); + text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK); + text << Atom(Atom::String, linkPair.second); + text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK); + text << "]"; + generateText(text, cn, marker); + out() << "</p>"; + } + } +#endif } } diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index 8fe0331..551bead 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -90,7 +90,6 @@ class HtmlGenerator : public PageGenerator Typedef, Property, Variable, - QmlClass, QmlProperty, QmlSignal, QmlMethod, @@ -327,7 +326,6 @@ class HtmlGenerator : public PageGenerator NewSinceMaps newSinceMaps; static QString sinceTitles[]; NewClassMaps newClassMaps; - NewClassMaps newQmlClassMaps; static int id; }; diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index 5357597..4ddcfb1 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -1257,7 +1257,7 @@ bool TargetNode::isInnerNode() const #ifdef QDOC_QML bool QmlClassNode::qmlOnly = false; -QMultiMap<QString,Node*> QmlClassNode::inheritedBy; +QMultiMap<QString,QString> QmlClassNode::inheritedBy; /*! Constructs a Qml class node (i.e. a Fake node with the @@ -1294,15 +1294,15 @@ QString QmlClassNode::fileBase() const Record the fact that QML class \a base is inherited by QML class \a sub. */ -void QmlClassNode::addInheritedBy(const QString& base, Node* sub) +void QmlClassNode::addInheritedBy(const QString& base, const QString& sub) { inheritedBy.insert(base,sub); } /*! - Loads the list \a subs with the nodes of all the subclasses of \a base. + Loads the list \a subs with the names of all the subclasses of \a base. */ -void QmlClassNode::subclasses(const QString& base, NodeList& subs) +void QmlClassNode::subclasses(const QString& base, QStringList& subs) { subs.clear(); if (inheritedBy.contains(base)) diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index 3798e4e..de26025 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -383,12 +383,12 @@ class QmlClassNode : public FakeNode const ClassNode* classNode() const { return cnode; } virtual QString fileBase() const; - static void addInheritedBy(const QString& base, Node* sub); - static void subclasses(const QString& base, NodeList& subs); + static void addInheritedBy(const QString& base, const QString& sub); + static void subclasses(const QString& base, QStringList& subs); public: static bool qmlOnly; - static QMultiMap<QString,Node*> inheritedBy; + static QMultiMap<QString,QString> inheritedBy; private: const ClassNode* cnode; diff --git a/tools/qdoc3/test/qt_zh_CN.qdocconf b/tools/qdoc3/test/qt_zh_CN.qdocconf new file mode 100644 index 0000000..8c7e64a --- /dev/null +++ b/tools/qdoc3/test/qt_zh_CN.qdocconf @@ -0,0 +1,86 @@ +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.7 + +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.470 +qhp.Qt.virtualFolder = qdoc +qhp.Qt.title = 教程 +qhp.Qt.indexTitle = 教程 +qhp.Qt.selectors = fake:example + +qhp.Qt.filterAttributes = qt 4.7.0 qtrefdoc zh_CN +qhp.Qt.customFilters.Qt.name = Qt 4.7.0 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.0 + +# Files not referenced in any qdoc file (last four are needed by qtdemo) +# See also extraimages.HTML +qhp.Qt.extraFiles = classic.css \ + images/qt-logo.png \ + images/taskmenuextension-example.png \ + images/coloreditorfactoryimage.png \ + images/dynamiclayouts-example.png \ + images/stylesheet-coffee-plastique.png + +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/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 +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/qmlviewer/content/Browser.qml b/tools/qml/content/Browser.qml index 35120bc..35120bc 100644 --- a/tools/qmlviewer/content/Browser.qml +++ b/tools/qml/content/Browser.qml diff --git a/tools/qmlviewer/content/images/folder.png b/tools/qml/content/images/folder.png Binary files differindex e53e2ad..e53e2ad 100644 --- a/tools/qmlviewer/content/images/folder.png +++ b/tools/qml/content/images/folder.png diff --git a/tools/qmlviewer/content/images/titlebar.png b/tools/qml/content/images/titlebar.png Binary files differindex 51c9008..51c9008 100644 --- a/tools/qmlviewer/content/images/titlebar.png +++ b/tools/qml/content/images/titlebar.png diff --git a/tools/qmlviewer/content/images/titlebar.sci b/tools/qml/content/images/titlebar.sci index 0418d94..0418d94 100644 --- a/tools/qmlviewer/content/images/titlebar.sci +++ b/tools/qml/content/images/titlebar.sci diff --git a/tools/qmlviewer/content/images/up.png b/tools/qml/content/images/up.png Binary files differindex b05f802..b05f802 100644 --- a/tools/qmlviewer/content/images/up.png +++ b/tools/qml/content/images/up.png diff --git a/tools/qmlviewer/deviceorientation.cpp b/tools/qml/deviceorientation.cpp index e7c70d5..e7c70d5 100644 --- a/tools/qmlviewer/deviceorientation.cpp +++ b/tools/qml/deviceorientation.cpp diff --git a/tools/qmlviewer/deviceorientation.h b/tools/qml/deviceorientation.h index c8125cd..c8125cd 100644 --- a/tools/qmlviewer/deviceorientation.h +++ b/tools/qml/deviceorientation.h diff --git a/tools/qmlviewer/deviceorientation_maemo.cpp b/tools/qml/deviceorientation_maemo.cpp index fa2c6e5..fa2c6e5 100644 --- a/tools/qmlviewer/deviceorientation_maemo.cpp +++ b/tools/qml/deviceorientation_maemo.cpp diff --git a/tools/qmlviewer/main.cpp b/tools/qml/main.cpp index 57c445f..9ef02ac 100644 --- a/tools/qmlviewer/main.cpp +++ b/tools/qml/main.cpp @@ -39,13 +39,15 @@ ** ****************************************************************************/ -#include "qml.h" -#include "qmlviewer.h" +#include "qdeclarative.h" +#include "qmlruntime.h" #include <QWidget> #include <QDir> #include <QApplication> #include <QTranslator> #include <QDebug> +#include "qfxtester.h" +#include "qdeclarativefolderlistmodel.h" QT_USE_NAMESPACE @@ -59,7 +61,7 @@ void myMessageOutput(QtMsgType type, const char *msg) { static int fd = -1; if (fd == -1) - fd = ::open("E:\\qmlviewer.log", O_WRONLY | O_CREAT); + fd = ::open("E:\\qml.log", O_WRONLY | O_CREAT); ::write(fd, msg, strlen(msg)); ::write(fd, "\n", 1); @@ -74,7 +76,7 @@ void myMessageOutput(QtMsgType type, const char *msg) void usage() { - qWarning("Usage: qmlviewer [options] <filename>"); + qWarning("Usage: qml [options] <filename>"); qWarning(" "); qWarning(" options:"); qWarning(" -v, -version ............................. display version"); @@ -110,7 +112,7 @@ void usage() void scriptOptsUsage() { - qWarning("Usage: qmlviewer -scriptopts <option>[,<option>...] ..."); + qWarning("Usage: qml -scriptopts <option>[,<option>...] ..."); qWarning(" options:"); qWarning(" record ................................... record a new script"); qWarning(" play ..................................... playback an existing script"); @@ -150,6 +152,10 @@ int main(int argc, char ** argv) app.setOrganizationName("Nokia"); app.setOrganizationDomain("nokia.com"); + QDeclarativeViewer::registerTypes(); + QDeclarativeTester::registerTypes(); + QDeclarativeFolderListModel::registerTypes(); + bool frameless = false; bool resizeview = false; QString fileName; @@ -265,30 +271,30 @@ int main(int argc, char ** argv) if (stayOnTop) wflags |= Qt::WindowStaysOnTopHint; - QmlViewer viewer(0, wflags); + QDeclarativeViewer viewer(0, wflags); if (!scriptopts.isEmpty()) { QStringList options = scriptopts.split(QLatin1Char(','), QString::SkipEmptyParts); - QmlViewer::ScriptOptions scriptOptions = 0; + QDeclarativeViewer::ScriptOptions scriptOptions = 0; for (int i = 0; i < options.count(); ++i) { const QString &option = options.at(i); if (option == QLatin1String("help")) { scriptOptsUsage(); } else if (option == QLatin1String("play")) { - scriptOptions |= QmlViewer::Play; + scriptOptions |= QDeclarativeViewer::Play; } else if (option == QLatin1String("record")) { - scriptOptions |= QmlViewer::Record; + scriptOptions |= QDeclarativeViewer::Record; } else if (option == QLatin1String("testimages")) { - scriptOptions |= QmlViewer::TestImages; + scriptOptions |= QDeclarativeViewer::TestImages; } else if (option == QLatin1String("testerror")) { - scriptOptions |= QmlViewer::TestErrorProperty; + scriptOptions |= QDeclarativeViewer::TestErrorProperty; } else if (option == QLatin1String("exitoncomplete")) { - scriptOptions |= QmlViewer::ExitOnComplete; + scriptOptions |= QDeclarativeViewer::ExitOnComplete; } else if (option == QLatin1String("exitonfailure")) { - scriptOptions |= QmlViewer::ExitOnFailure; + scriptOptions |= QDeclarativeViewer::ExitOnFailure; } else if (option == QLatin1String("saveonexit")) { - scriptOptions |= QmlViewer::SaveOnExit; + scriptOptions |= QDeclarativeViewer::SaveOnExit; } else { scriptOptsUsage(); } @@ -297,7 +303,7 @@ int main(int argc, char ** argv) if (script.isEmpty()) usage(); - if (!(scriptOptions & QmlViewer::Record) && !(scriptOptions & QmlViewer::Play)) + if (!(scriptOptions & QDeclarativeViewer::Record) && !(scriptOptions & QDeclarativeViewer::Play)) scriptOptsUsage(); viewer.setScriptOptions(scriptOptions); viewer.setScript(script); diff --git a/tools/qmlviewer/proxysettings.cpp b/tools/qml/proxysettings.cpp index 3255e42..3255e42 100644 --- a/tools/qmlviewer/proxysettings.cpp +++ b/tools/qml/proxysettings.cpp diff --git a/tools/qmlviewer/proxysettings.h b/tools/qml/proxysettings.h index 325929a..325929a 100644 --- a/tools/qmlviewer/proxysettings.h +++ b/tools/qml/proxysettings.h diff --git a/tools/qmlviewer/proxysettings.ui b/tools/qml/proxysettings.ui index 84e39fe..84e39fe 100644 --- a/tools/qmlviewer/proxysettings.ui +++ b/tools/qml/proxysettings.ui diff --git a/tools/qmlviewer/qmlfolderlistmodel.cpp b/tools/qml/qdeclarativefolderlistmodel.cpp index 698df54..58bf59b 100644 --- a/tools/qmlviewer/qmlfolderlistmodel.cpp +++ b/tools/qml/qdeclarativefolderlistmodel.cpp @@ -39,37 +39,37 @@ ** ****************************************************************************/ -#include "qmlfolderlistmodel.h" +#include "qdeclarativefolderlistmodel.h" #include <QDirModel> #include <QDebug> -#include <qmlcontext.h> +#include <qdeclarativecontext.h> QT_BEGIN_NAMESPACE -class QmlFolderListModelPrivate +class QDeclarativeFolderListModelPrivate { public: - QmlFolderListModelPrivate() - : sortField(QmlFolderListModel::Name), sortReversed(false), count(0) { + QDeclarativeFolderListModelPrivate() + : sortField(QDeclarativeFolderListModel::Name), sortReversed(false), count(0) { nameFilters << QLatin1String("*"); } void updateSorting() { QDir::SortFlags flags = 0; switch(sortField) { - case QmlFolderListModel::Unsorted: + case QDeclarativeFolderListModel::Unsorted: flags |= QDir::Unsorted; break; - case QmlFolderListModel::Name: + case QDeclarativeFolderListModel::Name: flags |= QDir::Name; break; - case QmlFolderListModel::Time: + case QDeclarativeFolderListModel::Time: flags |= QDir::Time; break; - case QmlFolderListModel::Size: + case QDeclarativeFolderListModel::Size: flags |= QDir::Size; break; - case QmlFolderListModel::Type: + case QDeclarativeFolderListModel::Type: flags |= QDir::Type; break; } @@ -84,7 +84,7 @@ public: QUrl folder; QStringList nameFilters; QModelIndex folderIndex; - QmlFolderListModel::SortField sortField; + QDeclarativeFolderListModel::SortField sortField; bool sortReversed; int count; }; @@ -111,10 +111,10 @@ public: via the \l isFolder() method. */ -QmlFolderListModel::QmlFolderListModel(QObject *parent) +QDeclarativeFolderListModel::QDeclarativeFolderListModel(QObject *parent) : QListModelInterface(parent) { - d = new QmlFolderListModelPrivate; + d = new QDeclarativeFolderListModelPrivate; d->model.setFilter(QDir::AllDirs | QDir::Files | QDir::Drives | QDir::NoDotAndDotDot); connect(&d->model, SIGNAL(rowsInserted(const QModelIndex&,int,int)) , this, SLOT(inserted(const QModelIndex&,int,int))); @@ -126,12 +126,12 @@ QmlFolderListModel::QmlFolderListModel(QObject *parent) connect(&d->model, SIGNAL(layoutChanged()), this, SLOT(refresh())); } -QmlFolderListModel::~QmlFolderListModel() +QDeclarativeFolderListModel::~QDeclarativeFolderListModel() { delete d; } -QHash<int,QVariant> QmlFolderListModel::data(int index, const QList<int> &roles) const +QHash<int,QVariant> QDeclarativeFolderListModel::data(int index, const QList<int> &roles) const { Q_UNUSED(roles); QHash<int,QVariant> folderData; @@ -144,7 +144,7 @@ QHash<int,QVariant> QmlFolderListModel::data(int index, const QList<int> &roles) return folderData; } -QVariant QmlFolderListModel::data(int index, int role) const +QVariant QDeclarativeFolderListModel::data(int index, int role) const { QVariant rv; QModelIndex modelIndex = d->model.index(index, 0, d->folderIndex); @@ -158,12 +158,12 @@ QVariant QmlFolderListModel::data(int index, int role) const return rv; } -int QmlFolderListModel::count() const +int QDeclarativeFolderListModel::count() const { return d->count; } -QList<int> QmlFolderListModel::roles() const +QList<int> QDeclarativeFolderListModel::roles() const { QList<int> r; r << QDirModel::FileNameRole; @@ -171,7 +171,7 @@ QList<int> QmlFolderListModel::roles() const return r; } -QString QmlFolderListModel::toString(int role) const +QString QDeclarativeFolderListModel::toString(int role) const { switch (role) { case QDirModel::FileNameRole: @@ -190,12 +190,12 @@ QString QmlFolderListModel::toString(int role) const It is a URL, but must be a file: or qrc: URL (or relative to such a URL). */ -QUrl QmlFolderListModel::folder() const +QUrl QDeclarativeFolderListModel::folder() const { return d->folder; } -void QmlFolderListModel::setFolder(const QUrl &folder) +void QDeclarativeFolderListModel::setFolder(const QUrl &folder) { if (folder == d->folder) return; @@ -207,7 +207,7 @@ void QmlFolderListModel::setFolder(const QUrl &folder) } } -QUrl QmlFolderListModel::parentFolder() const +QUrl QDeclarativeFolderListModel::parentFolder() const { QUrl r; QString localFile = d->folder.toLocalFile(); @@ -245,18 +245,18 @@ QUrl QmlFolderListModel::parentFolder() const } \endcode */ -QStringList QmlFolderListModel::nameFilters() const +QStringList QDeclarativeFolderListModel::nameFilters() const { return d->nameFilters; } -void QmlFolderListModel::setNameFilters(const QStringList &filters) +void QDeclarativeFolderListModel::setNameFilters(const QStringList &filters) { d->nameFilters = filters; d->model.setNameFilters(d->nameFilters); } -void QmlFolderListModel::componentComplete() +void QDeclarativeFolderListModel::componentComplete() { if (!d->folder.isValid() || !QDir().exists(d->folder.toLocalFile())) setFolder(QUrl(QLatin1String("file://")+QDir::currentPath())); @@ -265,12 +265,12 @@ void QmlFolderListModel::componentComplete() QMetaObject::invokeMethod(this, "refresh", Qt::QueuedConnection); } -QmlFolderListModel::SortField QmlFolderListModel::sortField() const +QDeclarativeFolderListModel::SortField QDeclarativeFolderListModel::sortField() const { return d->sortField; } -void QmlFolderListModel::setSortField(SortField field) +void QDeclarativeFolderListModel::setSortField(SortField field) { if (field != d->sortField) { d->sortField = field; @@ -278,12 +278,12 @@ void QmlFolderListModel::setSortField(SortField field) } } -bool QmlFolderListModel::sortReversed() const +bool QDeclarativeFolderListModel::sortReversed() const { return d->sortReversed; } -void QmlFolderListModel::setSortReversed(bool rev) +void QDeclarativeFolderListModel::setSortReversed(bool rev) { if (rev != d->sortReversed) { d->sortReversed = rev; @@ -297,7 +297,7 @@ void QmlFolderListModel::setSortReversed(bool rev) Returns true if the entry \a index is a folder; otherwise returns false. */ -bool QmlFolderListModel::isFolder(int index) const +bool QDeclarativeFolderListModel::isFolder(int index) const { if (index != -1) { QModelIndex idx = d->model.index(index, 0, d->folderIndex); @@ -307,7 +307,7 @@ bool QmlFolderListModel::isFolder(int index) const return false; } -void QmlFolderListModel::refresh() +void QDeclarativeFolderListModel::refresh() { d->folderIndex = QModelIndex(); if (d->count) { @@ -322,7 +322,7 @@ void QmlFolderListModel::refresh() } } -void QmlFolderListModel::inserted(const QModelIndex &index, int start, int end) +void QDeclarativeFolderListModel::inserted(const QModelIndex &index, int start, int end) { if (index == d->folderIndex) { d->count = d->model.rowCount(d->folderIndex); @@ -330,7 +330,7 @@ void QmlFolderListModel::inserted(const QModelIndex &index, int start, int end) } } -void QmlFolderListModel::removed(const QModelIndex &index, int start, int end) +void QDeclarativeFolderListModel::removed(const QModelIndex &index, int start, int end) { if (index == d->folderIndex) { d->count = d->model.rowCount(d->folderIndex); @@ -338,7 +338,7 @@ void QmlFolderListModel::removed(const QModelIndex &index, int start, int end) } } -void QmlFolderListModel::dataChanged(const QModelIndex &start, const QModelIndex &end) +void QDeclarativeFolderListModel::dataChanged(const QModelIndex &start, const QModelIndex &end) { qDebug() << "data changed"; if (start.parent() == d->folderIndex) @@ -352,12 +352,12 @@ void QmlFolderListModel::dataChanged(const QModelIndex &start, const QModelIndex Note that the nameFilters are ignored for directories. */ -bool QmlFolderListModel::showDirs() const +bool QDeclarativeFolderListModel::showDirs() const { return d->model.filter() & QDir::AllDirs; } -void QmlFolderListModel::setShowDirs(bool on) +void QDeclarativeFolderListModel::setShowDirs(bool on) { if (!(d->model.filter() & QDir::AllDirs) == !on) return; @@ -374,12 +374,12 @@ void QmlFolderListModel::setShowDirs(bool on) The default is false. */ -bool QmlFolderListModel::showDotAndDotDot() const +bool QDeclarativeFolderListModel::showDotAndDotDot() const { return !(d->model.filter() & QDir::NoDotAndDotDot); } -void QmlFolderListModel::setShowDotAndDotDot(bool on) +void QDeclarativeFolderListModel::setShowDotAndDotDot(bool on) { if (!(d->model.filter() & QDir::NoDotAndDotDot) == on) return; @@ -396,12 +396,12 @@ void QmlFolderListModel::setShowDotAndDotDot(bool on) The default is false. */ -bool QmlFolderListModel::showOnlyReadable() const +bool QDeclarativeFolderListModel::showOnlyReadable() const { return d->model.filter() & QDir::Readable; } -void QmlFolderListModel::setShowOnlyReadable(bool on) +void QDeclarativeFolderListModel::setShowOnlyReadable(bool on) { if (!(d->model.filter() & QDir::Readable) == !on) return; @@ -411,8 +411,10 @@ void QmlFolderListModel::setShowOnlyReadable(bool on) d->model.setFilter(d->model.filter() & ~QDir::Readable); } - -QML_DEFINE_TYPE(Qt,4,6,FolderListModel,QmlFolderListModel) +void QDeclarativeFolderListModel::registerTypes() +{ + QML_REGISTER_TYPE(Qt,4,6,FolderListModel,QDeclarativeFolderListModel); +} QT_END_NAMESPACE diff --git a/tools/qmlviewer/qmlfolderlistmodel.h b/tools/qml/qdeclarativefolderlistmodel.h index c180e97..57b7fe5 100644 --- a/tools/qmlviewer/qmlfolderlistmodel.h +++ b/tools/qml/qdeclarativefolderlistmodel.h @@ -39,22 +39,24 @@ ** ****************************************************************************/ -#ifndef QMLFOLDERLISTMODEL_H -#define QMLFOLDERLISTMODEL_H +#ifndef QDECLARATIVEFOLDERLISTMODEL_H +#define QDECLARATIVEFOLDERLISTMODEL_H -#include <qml.h> +#include <qdeclarative.h> +#include <QStringList> +#include <QUrl> #include "../../src/declarative/3rdparty/qlistmodelinterface_p.h" QT_BEGIN_NAMESPACE -class QmlContext; +class QDeclarativeContext; class QModelIndex; -class QmlFolderListModelPrivate; -class QmlFolderListModel : public QListModelInterface, public QmlParserStatus +class QDeclarativeFolderListModelPrivate; +class QDeclarativeFolderListModel : public QListModelInterface, public QDeclarativeParserStatus { Q_OBJECT - Q_INTERFACES(QmlParserStatus) + Q_INTERFACES(QDeclarativeParserStatus) Q_PROPERTY(QUrl folder READ folder WRITE setFolder NOTIFY folderChanged) Q_PROPERTY(QUrl parentFolder READ parentFolder NOTIFY folderChanged) @@ -66,8 +68,10 @@ class QmlFolderListModel : public QListModelInterface, public QmlParserStatus Q_PROPERTY(bool showOnlyReadable READ showOnlyReadable WRITE setShowOnlyReadable) public: - QmlFolderListModel(QObject *parent = 0); - ~QmlFolderListModel(); + QDeclarativeFolderListModel(QObject *parent = 0); + ~QDeclarativeFolderListModel(); + + static void registerTypes(); virtual QHash<int,QVariant> data(int index, const QList<int> &roles = (QList<int>())) const; virtual QVariant data(int index, int role) const; @@ -112,12 +116,12 @@ private Q_SLOTS: void dataChanged(const QModelIndex &start, const QModelIndex &end); private: - Q_DISABLE_COPY(QmlFolderListModel) - QmlFolderListModelPrivate *d; + Q_DISABLE_COPY(QDeclarativeFolderListModel) + QDeclarativeFolderListModelPrivate *d; }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QmlFolderListModel) +QML_DECLARE_TYPE(QDeclarativeFolderListModel) -#endif // QMLFOLDERLISTMODEL_H +#endif // QDECLARATIVEFOLDERLISTMODEL_H diff --git a/tools/qmlviewer/qfxtester.cpp b/tools/qml/qfxtester.cpp index c3c0124..638a3c9 100644 --- a/tools/qmlviewer/qfxtester.cpp +++ b/tools/qml/qfxtester.cpp @@ -42,62 +42,58 @@ #include <qfxtester.h> #include <QDebug> #include <QApplication> -#include <qmlview.h> +#include <qdeclarativeview.h> #include <QFile> -#include <QmlComponent> +#include <QDeclarativeComponent> #include <QDir> #include <QCryptographicHash> #include <private/qabstractanimation_p.h> -#include <private/qmlgraphicsitem_p.h> +#include <private/qdeclarativeitem_p.h> QT_BEGIN_NAMESPACE -QML_DEFINE_TYPE(Qt.VisualTest, 4,6, VisualTest, QmlGraphicsVisualTest); -QML_DEFINE_TYPE(Qt.VisualTest, 4,6, Frame, QmlGraphicsVisualTestFrame); -QML_DEFINE_TYPE(Qt.VisualTest, 4,6, Mouse, QmlGraphicsVisualTestMouse); -QML_DEFINE_TYPE(Qt.VisualTest, 4,6, Key, QmlGraphicsVisualTestKey); -QmlGraphicsTester::QmlGraphicsTester(const QString &script, QmlViewer::ScriptOptions opts, - QmlView *parent) +QDeclarativeTester::QDeclarativeTester(const QString &script, QDeclarativeViewer::ScriptOptions opts, + QDeclarativeView *parent) : QAbstractAnimation(parent), m_script(script), m_view(parent), filterEvents(true), options(opts), testscript(0), hasCompleted(false), hasFailed(false) { parent->viewport()->installEventFilter(this); parent->installEventFilter(this); QUnifiedTimer::instance()->setConsistentTiming(true); - if (options & QmlViewer::Play) + if (options & QDeclarativeViewer::Play) this->run(); start(); } -QmlGraphicsTester::~QmlGraphicsTester() +QDeclarativeTester::~QDeclarativeTester() { if (!hasFailed && - options & QmlViewer::Record && - options & QmlViewer::SaveOnExit) + options & QDeclarativeViewer::Record && + options & QDeclarativeViewer::SaveOnExit) save(); } -int QmlGraphicsTester::duration() const +int QDeclarativeTester::duration() const { return -1; } -void QmlGraphicsTester::addMouseEvent(Destination dest, QMouseEvent *me) +void QDeclarativeTester::addMouseEvent(Destination dest, QMouseEvent *me) { MouseEvent e(me); e.destination = dest; m_mouseEvents << e; } -void QmlGraphicsTester::addKeyEvent(Destination dest, QKeyEvent *ke) +void QDeclarativeTester::addKeyEvent(Destination dest, QKeyEvent *ke) { KeyEvent e(ke); e.destination = dest; m_keyEvents << e; } -bool QmlGraphicsTester::eventFilter(QObject *o, QEvent *e) +bool QDeclarativeTester::eventFilter(QObject *o, QEvent *e) { if (!filterEvents) return false; @@ -128,53 +124,53 @@ bool QmlGraphicsTester::eventFilter(QObject *o, QEvent *e) return false; } -void QmlGraphicsTester::executefailure() +void QDeclarativeTester::executefailure() { hasFailed = true; - if (options & QmlViewer::ExitOnFailure) + if (options & QDeclarativeViewer::ExitOnFailure) exit(-1); } -void QmlGraphicsTester::imagefailure() +void QDeclarativeTester::imagefailure() { hasFailed = true; - if (options & QmlViewer::ExitOnFailure) + if (options & QDeclarativeViewer::ExitOnFailure) exit(-1); } -void QmlGraphicsTester::complete() +void QDeclarativeTester::complete() { - if ((options & QmlViewer::TestErrorProperty) && !hasFailed) { + if ((options & QDeclarativeViewer::TestErrorProperty) && !hasFailed) { QString e = m_view->rootObject()->property("error").toString(); if (!e.isEmpty()) { qWarning() << "Test failed:" << e; hasFailed = true; } } - if (options & QmlViewer::ExitOnComplete) + if (options & QDeclarativeViewer::ExitOnComplete) QApplication::exit(hasFailed?-1:0); if (hasCompleted) return; hasCompleted = true; - if (options & QmlViewer::Play) + if (options & QDeclarativeViewer::Play) qWarning("Script playback complete"); } -void QmlGraphicsTester::run() +void QDeclarativeTester::run() { - QmlComponent c(m_view->engine(), m_script + QLatin1String(".qml")); + QDeclarativeComponent c(m_view->engine(), m_script + QLatin1String(".qml")); - testscript = qobject_cast<QmlGraphicsVisualTest *>(c.create()); + testscript = qobject_cast<QDeclarativeVisualTest *>(c.create()); if (testscript) testscript->setParent(this); else { executefailure(); exit(-1); } testscriptidx = 0; } -void QmlGraphicsTester::save() +void QDeclarativeTester::save() { QString filename = m_script + QLatin1String(".qml"); QFileInfo filenameInfo(filename); @@ -241,13 +237,13 @@ void QmlGraphicsTester::save() file.close(); } -void QmlGraphicsTester::updateCurrentTime(int msec) +void QDeclarativeTester::updateCurrentTime(int msec) { - QmlGraphicsItemPrivate::setConsistentTime(msec); + QDeclarativeItemPrivate::setConsistentTime(msec); QImage img(m_view->width(), m_view->height(), QImage::Format_RGB32); - if (options & QmlViewer::TestImages) { + if (options & QDeclarativeViewer::TestImages) { img.fill(qRgb(255,255,255)); QPainter p(&img); m_view->render(&p); @@ -255,7 +251,7 @@ void QmlGraphicsTester::updateCurrentTime(int msec) FrameEvent fe; fe.msec = msec; - if (msec == 0 || !(options & QmlViewer::TestImages)) { + if (msec == 0 || !(options & QDeclarativeViewer::TestImages)) { // Skip first frame, skip if not doing images } else if (0 == (m_savedFrameEvents.count() % 60)) { fe.image = img; @@ -301,22 +297,21 @@ void QmlGraphicsTester::updateCurrentTime(int msec) m_keyEvents.clear(); // Advance test script - static int imgCount = 0; while (testscript && testscript->count() > testscriptidx) { QObject *event = testscript->event(testscriptidx); - if (QmlGraphicsVisualTestFrame *frame = qobject_cast<QmlGraphicsVisualTestFrame *>(event)) { + if (QDeclarativeVisualTestFrame *frame = qobject_cast<QDeclarativeVisualTestFrame *>(event)) { if (frame->msec() < msec) { - if (options & QmlViewer::TestImages && !(options & QmlViewer::Record)) { - qWarning() << "QmlGraphicsTester: Extra frame. Seen:" + if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record)) { + qWarning() << "QDeclarativeTester: Extra frame. Seen:" << msec << "Expected:" << frame->msec(); imagefailure(); } } else if (frame->msec() == msec) { if (!frame->hash().isEmpty() && frame->hash().toUtf8() != fe.hash.toHex()) { - if (options & QmlViewer::TestImages && !(options & QmlViewer::Record)) { - qWarning() << "QmlGraphicsTester: Mismatched frame hash. Seen:" + if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record)) { + qWarning() << "QDeclarativeTester: Mismatched frame hash. Seen:" << fe.hash.toHex() << "Expected:" << frame->hash().toUtf8(); imagefailure(); @@ -326,17 +321,17 @@ void QmlGraphicsTester::updateCurrentTime(int msec) break; } - if (options & QmlViewer::TestImages && !(options & QmlViewer::Record) && !frame->image().isEmpty()) { + if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record) && !frame->image().isEmpty()) { QImage goodImage(frame->image().toLocalFile()); if (goodImage != img) { QString reject(frame->image().toLocalFile() + ".reject.png"); - qWarning() << "QmlGraphicsTester: Image mismatch. Reject saved to:" + qWarning() << "QDeclarativeTester: Image mismatch. Reject saved to:" << reject; img.save(reject); imagefailure(); } } - } else if (QmlGraphicsVisualTestMouse *mouse = qobject_cast<QmlGraphicsVisualTestMouse *>(event)) { + } else if (QDeclarativeVisualTestMouse *mouse = qobject_cast<QDeclarativeVisualTestMouse *>(event)) { QPoint pos(mouse->x(), mouse->y()); QPoint globalPos = m_view->mapToGlobal(QPoint(0, 0)) + pos; QMouseEvent event((QEvent::Type)mouse->type(), pos, globalPos, (Qt::MouseButton)mouse->button(), (Qt::MouseButtons)mouse->buttons(), (Qt::KeyboardModifiers)mouse->modifiers()); @@ -351,7 +346,7 @@ void QmlGraphicsTester::updateCurrentTime(int msec) me.destination = ViewPort; } m_savedMouseEvents.append(me); - } else if (QmlGraphicsVisualTestKey *key = qobject_cast<QmlGraphicsVisualTestKey *>(event)) { + } else if (QDeclarativeVisualTestKey *key = qobject_cast<QDeclarativeVisualTestKey *>(event)) { QKeyEvent event((QEvent::Type)key->type(), key->key(), (Qt::KeyboardModifiers)key->modifiers(), QString::fromUtf8(QByteArray::fromHex(key->text().toUtf8())), key->autorep(), key->count()); @@ -375,4 +370,12 @@ void QmlGraphicsTester::updateCurrentTime(int msec) complete(); } +void QDeclarativeTester::registerTypes() +{ + QML_REGISTER_TYPE(Qt.VisualTest, 4,6, VisualTest, QDeclarativeVisualTest); + QML_REGISTER_TYPE(Qt.VisualTest, 4,6, Frame, QDeclarativeVisualTestFrame); + QML_REGISTER_TYPE(Qt.VisualTest, 4,6, Mouse, QDeclarativeVisualTestMouse); + QML_REGISTER_TYPE(Qt.VisualTest, 4,6, Key, QDeclarativeVisualTestKey); +} + QT_END_NAMESPACE diff --git a/tools/qmlviewer/qfxtester.h b/tools/qml/qfxtester.h index 4b8ff9f..1a9f077 100644 --- a/tools/qmlviewer/qfxtester.h +++ b/tools/qml/qfxtester.h @@ -45,17 +45,19 @@ #include <QEvent> #include <QMouseEvent> #include <QKeyEvent> -#include <qmlviewer.h> +#include <QImage> +#include <QUrl> +#include <qmlruntime.h> QT_BEGIN_NAMESPACE -class QmlGraphicsVisualTest : public QObject +class QDeclarativeVisualTest : public QObject { Q_OBJECT Q_PROPERTY(QList<QObject *>* events READ events CONSTANT) Q_CLASSINFO("DefaultProperty", "events") public: - QmlGraphicsVisualTest() {} + QDeclarativeVisualTest() {} QList<QObject *> *events() { return &m_events; } @@ -68,18 +70,18 @@ private: QT_END_NAMESPACE -QML_DECLARE_TYPE(QmlGraphicsVisualTest) +QML_DECLARE_TYPE(QDeclarativeVisualTest) QT_BEGIN_NAMESPACE -class QmlGraphicsVisualTestFrame : public QObject +class QDeclarativeVisualTestFrame : public QObject { Q_OBJECT Q_PROPERTY(int msec READ msec WRITE setMsec) Q_PROPERTY(QString hash READ hash WRITE setHash) Q_PROPERTY(QUrl image READ image WRITE setImage) public: - QmlGraphicsVisualTestFrame() : m_msec(-1) {} + QDeclarativeVisualTestFrame() : m_msec(-1) {} int msec() const { return m_msec; } void setMsec(int m) { m_msec = m; } @@ -98,11 +100,11 @@ private: QT_END_NAMESPACE -QML_DECLARE_TYPE(QmlGraphicsVisualTestFrame) +QML_DECLARE_TYPE(QDeclarativeVisualTestFrame) QT_BEGIN_NAMESPACE -class QmlGraphicsVisualTestMouse : public QObject +class QDeclarativeVisualTestMouse : public QObject { Q_OBJECT Q_PROPERTY(int type READ type WRITE setType) @@ -113,7 +115,7 @@ class QmlGraphicsVisualTestMouse : public QObject Q_PROPERTY(int modifiers READ modifiers WRITE setModifiers) Q_PROPERTY(bool sendToViewport READ sendToViewport WRITE setSendToViewport) public: - QmlGraphicsVisualTestMouse() : m_type(0), m_button(0), m_buttons(0), m_x(0), m_y(0), m_modifiers(0), m_viewport(false) {} + QDeclarativeVisualTestMouse() : m_type(0), m_button(0), m_buttons(0), m_x(0), m_y(0), m_modifiers(0), m_viewport(false) {} int type() const { return m_type; } void setType(int t) { m_type = t; } @@ -147,11 +149,11 @@ private: QT_END_NAMESPACE -QML_DECLARE_TYPE(QmlGraphicsVisualTestMouse) +QML_DECLARE_TYPE(QDeclarativeVisualTestMouse) QT_BEGIN_NAMESPACE -class QmlGraphicsVisualTestKey : public QObject +class QDeclarativeVisualTestKey : public QObject { Q_OBJECT Q_PROPERTY(int type READ type WRITE setType) @@ -162,7 +164,7 @@ class QmlGraphicsVisualTestKey : public QObject Q_PROPERTY(int count READ count WRITE setCount) Q_PROPERTY(bool sendToViewport READ sendToViewport WRITE setSendToViewport) public: - QmlGraphicsVisualTestKey() : m_type(0), m_key(0), m_modifiers(0), m_autorep(false), m_count(0), m_viewport(false) {} + QDeclarativeVisualTestKey() : m_type(0), m_key(0), m_modifiers(0), m_autorep(false), m_count(0), m_viewport(false) {} int type() const { return m_type; } void setType(int t) { m_type = t; } @@ -196,15 +198,17 @@ private: QT_END_NAMESPACE -QML_DECLARE_TYPE(QmlGraphicsVisualTestKey) +QML_DECLARE_TYPE(QDeclarativeVisualTestKey) QT_BEGIN_NAMESPACE -class QmlGraphicsTester : public QAbstractAnimation +class QDeclarativeTester : public QAbstractAnimation { public: - QmlGraphicsTester(const QString &script, QmlViewer::ScriptOptions options, QmlView *parent); - ~QmlGraphicsTester(); + QDeclarativeTester(const QString &script, QDeclarativeViewer::ScriptOptions options, QDeclarativeView *parent); + ~QDeclarativeTester(); + + static void registerTypes(); virtual int duration() const; @@ -225,7 +229,7 @@ private: enum Destination { View, ViewPort }; void addKeyEvent(Destination, QKeyEvent *); void addMouseEvent(Destination, QMouseEvent *); - QmlView *m_view; + QDeclarativeView *m_view; struct MouseEvent { MouseEvent(QMouseEvent *e) @@ -268,9 +272,9 @@ private: QList<FrameEvent> m_savedFrameEvents; bool filterEvents; - QmlViewer::ScriptOptions options; + QDeclarativeViewer::ScriptOptions options; int testscriptidx; - QmlGraphicsVisualTest *testscript; + QDeclarativeVisualTest *testscript; bool hasCompleted; bool hasFailed; diff --git a/tools/qmlviewer/qmlviewer.pro b/tools/qml/qml.pro index aba3cf5..9c9c398 100644 --- a/tools/qmlviewer/qmlviewer.pro +++ b/tools/qml/qml.pro @@ -13,17 +13,17 @@ contains(QT_CONFIG, opengl) { } # Input -HEADERS += qmlviewer.h \ +HEADERS += qmlruntime.h \ proxysettings.h \ qfxtester.h \ deviceorientation.h \ - qmlfolderlistmodel.h + qdeclarativefolderlistmodel.h SOURCES += main.cpp \ - qmlviewer.cpp \ + qmlruntime.cpp \ proxysettings.cpp \ qfxtester.cpp \ - qmlfolderlistmodel.cpp -RESOURCES = qmlviewer.qrc + qdeclarativefolderlistmodel.cpp +RESOURCES = qmlruntime.qrc maemo5 { SOURCES += deviceorientation_maemo.cpp } else { @@ -54,5 +54,5 @@ symbian { TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 HEADERS += $$QT_SOURCE_TREE/examples/network/qftp/sym_iap_util.h LIBS += -lesock -lconnmon -linsock - TARGET.CAPABILITY = NetworkServices + TARGET.CAPABILITY = "All -TCB" } diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qml/qmlruntime.cpp index 626e4c4..7da3f5a 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qml/qmlruntime.cpp @@ -39,18 +39,18 @@ ** ****************************************************************************/ -#include <qmlview.h> +#include <qdeclarativeview.h> #ifdef hz #undef hz #endif #include "ui_recopts.h" -#include "qmlviewer.h" -#include <qmlcontext.h> -#include <qmlengine.h> -#include <qmlnetworkaccessmanagerfactory.h> -#include "qml.h" +#include "qmlruntime.h" +#include <qdeclarativecontext.h> +#include <qdeclarativeengine.h> +#include <qdeclarativenetworkaccessmanagerfactory.h> +#include "qdeclarative.h" #include <private/qperformancelog_p_p.h> #include <private/qabstractanimation_p.h> #include <QAbstractAnimation> @@ -58,7 +58,7 @@ #if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 3)) #include <private/qzipreader_p.h> -#define QMLVIEWER_ZIP_SUPPORT +#define QDECLARATIVEVIEWER_ZIP_SUPPORT #endif #include <QSettings> @@ -69,7 +69,7 @@ #include <QNetworkDiskCache> #include <QNetworkAccessManager> #include <QSignalMapper> -#include <QmlComponent> +#include <QDeclarativeComponent> #include <QWidget> #include <QApplication> #include <QDir> @@ -139,8 +139,6 @@ QT_END_NAMESPACE QML_DECLARE_TYPE(Screen) -QML_DEFINE_TYPE(QmlViewer, 1, 0, Screen, Screen) - QT_BEGIN_NAMESPACE class SizedMenuBar : public QMenuBar @@ -350,7 +348,7 @@ private: mutable QMutex mutex; }; -class NetworkAccessManagerFactory : public QmlNetworkAccessManagerFactory +class NetworkAccessManagerFactory : public QDeclarativeNetworkAccessManagerFactory { public: NetworkAccessManagerFactory() : cookieJar(0), cacheSize(0) {} @@ -427,7 +425,7 @@ public: }; -QString QmlViewer::getVideoFileName() +QString QDeclarativeViewer::getVideoFileName() { QString title = convertAvailable || ffmpegAvailable ? tr("Save Video File") : tr("Save PNG Frames"); QStringList types; @@ -439,7 +437,7 @@ QString QmlViewer::getVideoFileName() } -QmlViewer::QmlViewer(QWidget *parent, Qt::WindowFlags flags) +QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags) #if defined(Q_OS_SYMBIAN) : QMainWindow(parent, flags) #else @@ -475,14 +473,14 @@ QmlViewer::QmlViewer(QWidget *parent, Qt::WindowFlags flags) recdlg->warning->hide(); } - canvas = new QmlView(this); + canvas = new QDeclarativeView(this); canvas->setAttribute(Qt::WA_OpaquePaintEvent); canvas->setAttribute(Qt::WA_NoSystemBackground); - canvas->setResizeMode((!skin || !scaleSkin) ? QmlView::SizeRootObjectToView : QmlView::SizeViewToRootObject); + canvas->setResizeMode((!skin || !scaleSkin) ? QDeclarativeView::SizeRootObjectToView : QDeclarativeView::SizeViewToRootObject); canvas->setFocus(); QObject::connect(canvas, SIGNAL(sceneResized(QSize)), this, SLOT(sceneResized(QSize))); - QObject::connect(canvas, SIGNAL(statusChanged(QmlView::Status)), this, SLOT(statusChanged())); + QObject::connect(canvas, SIGNAL(statusChanged(QDeclarativeView::Status)), this, SLOT(statusChanged())); QObject::connect(canvas->engine(), SIGNAL(quit()), QCoreApplication::instance (), SLOT(quit())); if (!(flags & Qt::FramelessWindowHint)) { @@ -514,13 +512,13 @@ QmlViewer::QmlViewer(QWidget *parent, Qt::WindowFlags flags) recordTimer.setRepeating(true); } -QmlViewer::~QmlViewer() +QDeclarativeViewer::~QDeclarativeViewer() { canvas->engine()->setNetworkAccessManagerFactory(0); delete namFactory; } -QMenuBar *QmlViewer::menuBar() const +QMenuBar *QDeclarativeViewer::menuBar() const { #if !defined(Q_OS_SYMBIAN) if (!mb) @@ -532,7 +530,7 @@ QMenuBar *QmlViewer::menuBar() const return mb; } -void QmlViewer::createMenu(QMenuBar *menu, QMenu *flatmenu) +void QDeclarativeViewer::createMenu(QMenuBar *menu, QMenu *flatmenu) { QObject *parent = flatmenu ? (QObject*)flatmenu : (QObject*)menu; @@ -686,7 +684,7 @@ void QmlViewer::createMenu(QMenuBar *menu, QMenu *flatmenu) } } -void QmlViewer::showProxySettings() +void QDeclarativeViewer::showProxySettings() { ProxySettings settingsDlg (this); @@ -695,29 +693,29 @@ void QmlViewer::showProxySettings() settingsDlg.exec(); } -void QmlViewer::proxySettingsChanged() +void QDeclarativeViewer::proxySettingsChanged() { reload (); } -void QmlViewer::setPortrait() +void QDeclarativeViewer::setPortrait() { DeviceOrientation::instance()->setOrientation(DeviceOrientation::Portrait); portraitOrientation->setChecked(true); } -void QmlViewer::setLandscape() +void QDeclarativeViewer::setLandscape() { DeviceOrientation::instance()->setOrientation(DeviceOrientation::Landscape); landscapeOrientation->setChecked(true); } -void QmlViewer::toggleOrientation() +void QDeclarativeViewer::toggleOrientation() { DeviceOrientation::instance()->setOrientation(DeviceOrientation::instance()->orientation()==DeviceOrientation::Portrait?DeviceOrientation::Landscape:DeviceOrientation::Portrait); } -void QmlViewer::toggleFullScreen() +void QDeclarativeViewer::toggleFullScreen() { if (isFullScreen()) showMaximized(); @@ -725,25 +723,25 @@ void QmlViewer::toggleFullScreen() showFullScreen(); } -void QmlViewer::setScaleSkin() +void QDeclarativeViewer::setScaleSkin() { if (scaleSkin) return; scaleSkin = true; - canvas->setResizeMode((!skin || !scaleSkin) ? QmlView::SizeRootObjectToView : QmlView::SizeViewToRootObject); + canvas->setResizeMode((!skin || !scaleSkin) ? QDeclarativeView::SizeRootObjectToView : QDeclarativeView::SizeViewToRootObject); if (skin) { canvas->setFixedSize(canvas->sizeHint()); skin->setScreenSize(canvas->sizeHint()); } } -void QmlViewer::setScaleView() +void QDeclarativeViewer::setScaleView() { if (!scaleSkin) return; scaleSkin = false; if (skin) { - canvas->setResizeMode((!skin || !scaleSkin) ? QmlView::SizeRootObjectToView : QmlView::SizeViewToRootObject); + canvas->setResizeMode((!skin || !scaleSkin) ? QDeclarativeView::SizeRootObjectToView : QDeclarativeView::SizeViewToRootObject); canvas->setMinimumSize(QSize(0,0)); canvas->setMaximumSize(QSize(16777215,16777215)); canvas->resize(skin->standardScreenSize()); @@ -752,7 +750,7 @@ void QmlViewer::setScaleView() } -void QmlViewer::takeSnapShot() +void QDeclarativeViewer::takeSnapShot() { static int snapshotcount = 1; QString snapFileName = QString(QLatin1String("snapshot%1.png")).arg(snapshotcount); @@ -761,14 +759,14 @@ void QmlViewer::takeSnapShot() ++snapshotcount; } -void QmlViewer::pickRecordingFile() +void QDeclarativeViewer::pickRecordingFile() { QString fileName = getVideoFileName(); if (!fileName.isEmpty()) recdlg->file->setText(fileName); } -void QmlViewer::chooseRecordingOptions() +void QDeclarativeViewer::chooseRecordingOptions() { // File recdlg->file->setText(record_file); @@ -827,7 +825,7 @@ void QmlViewer::chooseRecordingOptions() } } -void QmlViewer::toggleRecordingWithSelection() +void QDeclarativeViewer::toggleRecordingWithSelection() { if (!recordTimer.isRunning()) { if (record_file.isEmpty()) { @@ -842,7 +840,7 @@ void QmlViewer::toggleRecordingWithSelection() toggleRecording(); } -void QmlViewer::toggleRecording() +void QDeclarativeViewer::toggleRecording() { if (record_file.isEmpty()) { toggleRecordingWithSelection(); @@ -853,24 +851,24 @@ void QmlViewer::toggleRecording() setRecording(recording); } -void QmlViewer::setSlowMode(bool enable) +void QDeclarativeViewer::setSlowMode(bool enable) { QUnifiedTimer::instance()->setSlowModeEnabled(enable); } -void QmlViewer::addLibraryPath(const QString& lib) +void QDeclarativeViewer::addLibraryPath(const QString& lib) { canvas->engine()->addImportPath(lib); } -void QmlViewer::reload() +void QDeclarativeViewer::reload() { openQml(currentFileOrUrl); } -void QmlViewer::open(const QString& doc) +void QDeclarativeViewer::open(const QString& doc) { -#ifdef QMLVIEWER_ZIP_SUPPORT +#ifdef QDECLARATIVEVIEWER_ZIP_SUPPORT if (doc.endsWith(".wgt",Qt::CaseInsensitive) || doc.endsWith(".wgz",Qt::CaseInsensitive) || doc.endsWith(".zip",Qt::CaseInsensitive)) @@ -880,10 +878,10 @@ void QmlViewer::open(const QString& doc) openQml(doc); } -void QmlViewer::openWgt(const QString& doc) +void QDeclarativeViewer::openWgt(const QString& doc) { -#ifdef QMLVIEWER_ZIP_SUPPORT - // XXX This functionality could be migrated to QmlView once refined +#ifdef QDECLARATIVEVIEWER_ZIP_SUPPORT + // XXX This functionality could be migrated to QDeclarativeView once refined QUrl url(doc); if (url.isRelative()) @@ -896,7 +894,7 @@ void QmlViewer::openWgt(const QString& doc) #endif } -#ifdef QMLVIEWER_ZIP_SUPPORT +#ifdef QDECLARATIVEVIEWER_ZIP_SUPPORT static void removeRecursive(const QString& dirname) { QDir dir(dirname); @@ -910,9 +908,9 @@ static void removeRecursive(const QString& dirname) } #endif -void QmlViewer::unpackWgt() +void QDeclarativeViewer::unpackWgt() { -#ifdef QMLVIEWER_ZIP_SUPPORT +#ifdef QDECLARATIVEVIEWER_ZIP_SUPPORT QByteArray all = wgtreply->readAll(); QBuffer buf(&all); buf.open(QIODevice::ReadOnly); @@ -923,7 +921,7 @@ void QmlViewer::unpackWgt() qDebug() << "zip:" << info.filePath; } */ - wgtdir = QDir::tempPath()+QDir::separator()+QLatin1String("qmlviewer-wgt"); + wgtdir = QDir::tempPath()+QDir::separator()+QLatin1String("qml-wgt"); removeRecursive(wgtdir); QDir().mkpath(wgtdir); zip.extractAll(wgtdir); @@ -969,7 +967,7 @@ void QmlViewer::unpackWgt() #endif } -void QmlViewer::openFile() +void QDeclarativeViewer::openFile() { QString cur = canvas->source().toLocalFile(); if (useQmlFileBrowser) { @@ -983,21 +981,21 @@ void QmlViewer::openFile() } } -void QmlViewer::statusChanged() +void QDeclarativeViewer::statusChanged() { - if (canvas->status() == QmlView::Error && tester) + if (canvas->status() == QDeclarativeView::Error && tester) tester->executefailure(); - if (canvas->status() == QmlView::Ready) + if (canvas->status() == QDeclarativeView::Ready) resize(sizeHint()); } -void QmlViewer::launch(const QString& file_or_url) +void QDeclarativeViewer::launch(const QString& file_or_url) { QMetaObject::invokeMethod(this, "openQml", Qt::QueuedConnection, Q_ARG(QString, file_or_url)); } -void QmlViewer::openQml(const QString& file_or_url) +void QDeclarativeViewer::openQml(const QString& file_or_url) { currentFileOrUrl = file_or_url; @@ -1010,11 +1008,11 @@ void QmlViewer::openQml(const QString& file_or_url) setWindowTitle(tr("%1 - Qt Declarative UI Viewer").arg(file_or_url)); if (!m_script.isEmpty()) - tester = new QmlGraphicsTester(m_script, m_scriptOptions, canvas); + tester = new QDeclarativeTester(m_script, m_scriptOptions, canvas); delete canvas->rootObject(); canvas->engine()->clearComponentCache(); - QmlContext *ctxt = canvas->rootContext(); + QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("qmlViewer", this); #ifdef Q_OS_SYMBIAN ctxt->setContextProperty("qmlViewerFolder", "E:\\"); // Documents on your S60 phone @@ -1027,7 +1025,7 @@ void QmlViewer::openQml(const QString& file_or_url) QFileInfo fi(fileName); if (fi.exists()) { if (fi.suffix().toLower() != QLatin1String("qml")) { - qWarning() << "qmlviewer cannot open non-QML file" << fileName; + qWarning() << "qml cannot open non-QML file" << fileName; return; } @@ -1038,13 +1036,13 @@ void QmlViewer::openQml(const QString& file_or_url) QFile f(dir.filePath(qml)); f.open(QIODevice::ReadOnly); QByteArray data = f.readAll(); - QmlComponent comp(canvas->engine()); + QDeclarativeComponent comp(canvas->engine()); comp.setData(data, QUrl()); QObject *dummyData = comp.create(); if(comp.isError()) { - QList<QmlError> errors = comp.errors(); - foreach (const QmlError &error, errors) { + QList<QDeclarativeError> errors = comp.errors(); + foreach (const QDeclarativeError &error, errors) { qWarning() << error; } if (tester) tester->executefailure(); @@ -1058,16 +1056,16 @@ void QmlViewer::openQml(const QString& file_or_url) } } } else { - qWarning() << "qmlviewer cannot find file:" << fileName; + qWarning() << "qml cannot find file:" << fileName; return; } } - canvas->setSource(url); - QTime t; t.start(); - canvas->execute(); + + canvas->setSource(url); + qWarning() << "Wall startup time:" << t.elapsed(); if (!skin) { @@ -1090,14 +1088,14 @@ void QmlViewer::openQml(const QString& file_or_url) #endif } -void QmlViewer::startNetwork() +void QDeclarativeViewer::startNetwork() { #if defined(SYMBIAN_NETWORK_INIT) qt_SetDefaultIap(); #endif } -QStringList QmlViewer::builtinSkins() const +QStringList QDeclarativeViewer::builtinSkins() const { QDir dir(":/skins/","*.skin"); const QFileInfoList l = dir.entryInfoList(); @@ -1108,7 +1106,7 @@ QStringList QmlViewer::builtinSkins() const return r; } -void QmlViewer::setSkin(const QString& skinDirOrName) +void QDeclarativeViewer::setSkin(const QString& skinDirOrName) { QString skinDirectory = skinDirOrName; @@ -1130,7 +1128,7 @@ void QmlViewer::setSkin(const QString& skinDirOrName) skin->deleteLater(); } - canvas->setResizeMode((!skin || !scaleSkin) ? QmlView::SizeRootObjectToView : QmlView::SizeViewToRootObject); + canvas->setResizeMode((!skin || !scaleSkin) ? QDeclarativeView::SizeRootObjectToView : QDeclarativeView::SizeViewToRootObject); DeviceSkinParameters parameters; if (!skinDirectory.isEmpty() && parameters.read(skinDirectory,DeviceSkinParameters::ReadAll,&err)) { @@ -1170,7 +1168,7 @@ void QmlViewer::setSkin(const QString& skinDirOrName) canvas->show(); } -void QmlViewer::setAutoRecord(int from, int to) +void QDeclarativeViewer::setAutoRecord(int from, int to) { if (from==0) from=1; // ensure resized record_autotime = to-from; @@ -1178,22 +1176,22 @@ void QmlViewer::setAutoRecord(int from, int to) autoStartTimer.setRunning(true); } -void QmlViewer::setRecordArgs(const QStringList& a) +void QDeclarativeViewer::setRecordArgs(const QStringList& a) { record_args = a; } -void QmlViewer::setRecordFile(const QString& f) +void QDeclarativeViewer::setRecordFile(const QString& f) { record_file = f; } -void QmlViewer::setRecordRate(int fps) +void QDeclarativeViewer::setRecordRate(int fps) { record_rate = fps; } -void QmlViewer::sceneResized(QSize size) +void QDeclarativeViewer::sceneResized(QSize size) { if (size.width() > 0 && size.height() > 0) { if (skin && scaleSkin) @@ -1201,7 +1199,7 @@ void QmlViewer::sceneResized(QSize size) } } -void QmlViewer::keyPressEvent(QKeyEvent *event) +void QDeclarativeViewer::keyPressEvent(QKeyEvent *event) { if (event->key() == Qt::Key_0 && devicemode) exit(0); @@ -1242,7 +1240,7 @@ void QmlViewer::keyPressEvent(QKeyEvent *event) QWidget::keyPressEvent(event); } -void QmlViewer::senseImageMagick() +void QDeclarativeViewer::senseImageMagick() { QProcess proc; proc.start("convert", QStringList() << "-h"); @@ -1251,7 +1249,7 @@ void QmlViewer::senseImageMagick() convertAvailable = help.contains("ImageMagick"); } -void QmlViewer::senseFfmpeg() +void QDeclarativeViewer::senseFfmpeg() { QProcess proc; proc.start("ffmpeg", QStringList() << "-h"); @@ -1273,7 +1271,7 @@ void QmlViewer::senseFfmpeg() connect(recdlg->ffmpegHelp,SIGNAL(clicked()), ffmpegHelpWindow, SLOT(show())); } -void QmlViewer::setRecording(bool on) +void QDeclarativeViewer::setRecording(bool on) { if (on == recordTimer.isRunning()) return; @@ -1398,24 +1396,24 @@ void QmlViewer::setRecording(bool on) qDebug() << "Recording: " << (recordTimer.isRunning()?"ON":"OFF"); } -void QmlViewer::ffmpegFinished(int code) +void QDeclarativeViewer::ffmpegFinished(int code) { qDebug() << "ffmpeg returned" << code << frame_stream->readAllStandardError(); } -void QmlViewer::autoStartRecording() +void QDeclarativeViewer::autoStartRecording() { setRecording(true); autoStopTimer.setInterval(record_autotime); autoStopTimer.setRunning(true); } -void QmlViewer::autoStopRecording() +void QDeclarativeViewer::autoStopRecording() { setRecording(false); } -void QmlViewer::recordFrame() +void QDeclarativeViewer::recordFrame() { canvas->QWidget::render(&frame); if (frame_stream) { @@ -1431,17 +1429,17 @@ void QmlViewer::recordFrame() } } -void QmlViewer::setDeviceKeys(bool on) +void QDeclarativeViewer::setDeviceKeys(bool on) { devicemode = on; } -void QmlViewer::setNetworkCacheSize(int size) +void QDeclarativeViewer::setNetworkCacheSize(int size) { namFactory->setCacheSize(size); } -void QmlViewer::setUseGL(bool useGL) +void QDeclarativeViewer::setUseGL(bool useGL) { #ifdef GL_SUPPORTED if (useGL) { @@ -1455,11 +1453,16 @@ void QmlViewer::setUseGL(bool useGL) #endif } -void QmlViewer::setUseNativeFileBrowser(bool use) +void QDeclarativeViewer::setUseNativeFileBrowser(bool use) { useQmlFileBrowser = !use; } +void QDeclarativeViewer::registerTypes() +{ + QML_REGISTER_TYPE(QDeclarativeViewer, 1, 0, Screen, Screen); +} + QT_END_NAMESPACE -#include "qmlviewer.moc" +#include "qmlruntime.moc" diff --git a/tools/qmlviewer/qmlviewer.h b/tools/qml/qmlruntime.h index c7f87ed..01777bd 100644 --- a/tools/qmlviewer/qmlviewer.h +++ b/tools/qml/qmlruntime.h @@ -39,28 +39,28 @@ ** ****************************************************************************/ -#ifndef QMLVIEWER_H -#define QMLVIEWER_H +#ifndef QDECLARATIVEVIEWER_H +#define QDECLARATIVEVIEWER_H #include <QMainWindow> #include <QMenuBar> -#include <private/qmltimer_p.h> +#include <private/qdeclarativetimer_p.h> #include <QTime> #include <QList> QT_BEGIN_NAMESPACE -class QmlView; +class QDeclarativeView; class PreviewDeviceSkin; -class QmlGraphicsTestEngine; +class QDeclarativeTestEngine; class QProcess; class RecordingDialog; -class QmlGraphicsTester; +class QDeclarativeTester; class QNetworkReply; class QNetworkCookieJar; class NetworkAccessManagerFactory; -class QmlViewer +class QDeclarativeViewer #if defined(Q_OS_SYMBIAN) : public QMainWindow #else @@ -69,8 +69,10 @@ class QmlViewer { Q_OBJECT public: - QmlViewer(QWidget *parent=0, Qt::WindowFlags flags=0); - ~QmlViewer(); + QDeclarativeViewer(QWidget *parent=0, Qt::WindowFlags flags=0); + ~QDeclarativeViewer(); + + static void registerTypes(); enum ScriptOption { Play = 0x00000001, @@ -144,15 +146,15 @@ private: PreviewDeviceSkin *skin; QSize skinscreensize; - QmlView *canvas; + QDeclarativeView *canvas; QString currentFileOrUrl; - QmlTimer recordTimer; + QDeclarativeTimer recordTimer; QString frame_fmt; QImage frame; QList<QImage*> frames; QProcess* frame_stream; - QmlTimer autoStartTimer; - QmlTimer autoStopTimer; + QDeclarativeTimer autoStartTimer; + QDeclarativeTimer autoStopTimer; QString record_dither; QString record_file; QSize record_outsize; @@ -177,7 +179,7 @@ private: QString m_script; ScriptOptions m_scriptOptions; - QmlGraphicsTester *tester; + QDeclarativeTester *tester; QNetworkReply *wgtreply; QString wgtdir; @@ -186,7 +188,7 @@ private: bool useQmlFileBrowser; }; -Q_DECLARE_OPERATORS_FOR_FLAGS(QmlViewer::ScriptOptions) +Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativeViewer::ScriptOptions) QT_END_NAMESPACE diff --git a/tools/qmlviewer/qmlviewer.qrc b/tools/qml/qmlruntime.qrc index 3a9e608..3a9e608 100644 --- a/tools/qmlviewer/qmlviewer.qrc +++ b/tools/qml/qmlruntime.qrc diff --git a/tools/qmlviewer/recopts.ui b/tools/qml/recopts.ui index ce2da30..ce2da30 100644 --- a/tools/qmlviewer/recopts.ui +++ b/tools/qml/recopts.ui diff --git a/tools/qtconfig/mainwindow.cpp b/tools/qtconfig/mainwindow.cpp index 604b1f4..0de4b43 100644 --- a/tools/qtconfig/mainwindow.cpp +++ b/tools/qtconfig/mainwindow.cpp @@ -68,6 +68,8 @@ #ifndef QT_NO_GSTREAMER #include <gst/gst.h> +#endif +#ifdef HAVE_PHONON #include <phonon/phononnamespace.h> #endif @@ -387,8 +389,10 @@ MainWindow::MainWindow() audiosinkCombo->addItem(tr("aRts"), QLatin1String("artssink")); audiosinkCombo->setItemData(audiosinkCombo->findText(tr("aRts")), tr("Experimental aRts support for GStreamer."), Qt::ToolTipRole); -#ifndef QT_NO_GSTREAMER +#ifdef HAVE_PHONON phononVersionLabel->setText(QLatin1String(Phonon::phononVersion())); +#endif +#ifndef QT_NO_GSTREAMER if (gst_init_check(0, 0, 0)) { gchar *versionString = gst_version_string(); gstversionLabel->setText(QLatin1String(versionString)); diff --git a/tools/qtconfig/qtconfig.pro b/tools/qtconfig/qtconfig.pro index 8ab3f03..d1fd320 100644 --- a/tools/qtconfig/qtconfig.pro +++ b/tools/qtconfig/qtconfig.pro @@ -9,7 +9,10 @@ QT += qt3support contains(QT_CONFIG, gstreamer):LIBS += $$QT_LIBS_GSTREAMER -lgstinterfaces-0.10 -lgstvideo-0.10 -lgstbase-0.10 contains(QT_CONFIG, gstreamer):QMAKE_CXXFLAGS += $$QT_CFLAGS_GSTREAMER -contains(QT_CONFIG, gstreamer):QT += phonon +contains(QT_CONFIG, phonon) { + QT += phonon + DEFINES += HAVE_PHONON +} SOURCES += colorbutton.cpp main.cpp previewframe.cpp previewwidget.cpp mainwindow.cpp paletteeditoradvanced.cpp \ mainwindowbase.cpp paletteeditoradvancedbase.cpp previewwidgetbase.cpp HEADERS += colorbutton.h previewframe.h previewwidget.h mainwindow.h paletteeditoradvanced.h \ diff --git a/tools/tools.pro b/tools/tools.pro index d5569b6..3ed07b1 100644 --- a/tools/tools.pro +++ b/tools/tools.pro @@ -26,7 +26,7 @@ mac { embedded:SUBDIRS += kmap2qmap -contains(QT_CONFIG, declarative):SUBDIRS += qmlviewer +contains(QT_CONFIG, declarative):SUBDIRS += qml contains(QT_CONFIG, dbus):SUBDIRS += qdbus !wince*:contains(QT_CONFIG, xmlpatterns): SUBDIRS += xmlpatterns xmlpatternsvalidator embedded: SUBDIRS += makeqpf |