diff options
Diffstat (limited to 'tools')
36 files changed, 943 insertions, 432 deletions
diff --git a/tools/assistant/tools/assistant/helpviewer.cpp b/tools/assistant/tools/assistant/helpviewer.cpp index 0c51a02..6499139 100644 --- a/tools/assistant/tools/assistant/helpviewer.cpp +++ b/tools/assistant/tools/assistant/helpviewer.cpp @@ -52,13 +52,15 @@ QT_BEGIN_NAMESPACE -QString AbstractHelpViewer::AboutBlank = +const QLatin1String AbstractHelpViewer::DocPath("qthelp://com.trolltech."); + +const QString AbstractHelpViewer::AboutBlank = QCoreApplication::translate("HelpViewer", "<title>about:blank</title>"); -QString AbstractHelpViewer::LocalHelpFile = QLatin1String("qthelp://" +const QString AbstractHelpViewer::LocalHelpFile = QLatin1String("qthelp://" "com.trolltech.com.assistantinternal-1.0.0/assistant/assistant.html"); -QString AbstractHelpViewer::PageNotFoundMessage = +const QString AbstractHelpViewer::PageNotFoundMessage = QCoreApplication::translate("HelpViewer", "<title>Error 404...</title><div " "align=\"center\"><br><br><h1>The page could not be found</h1><br><h3>'%1'" "</h3></div>"); @@ -128,11 +130,12 @@ bool AbstractHelpViewer::canOpenPage(const QString &url) return !mimeFromUrl(url).isEmpty(); } -QString AbstractHelpViewer::mimeFromUrl(const QString &url) +QString AbstractHelpViewer::mimeFromUrl(const QUrl &url) { TRACE_OBJ - const int index = url.lastIndexOf(QLatin1Char('.')); - const QByteArray &ext = url.mid(index).toUtf8().toLower(); + const QString &path = url.path(); + const int index = path.lastIndexOf(QLatin1Char('.')); + const QByteArray &ext = path.mid(index).toUtf8().toLower(); const ExtensionMap *e = extensionMap; while (e->extension) { diff --git a/tools/assistant/tools/assistant/helpviewer.h b/tools/assistant/tools/assistant/helpviewer.h index 6f1f48d..def9418 100644 --- a/tools/assistant/tools/assistant/helpviewer.h +++ b/tools/assistant/tools/assistant/helpviewer.h @@ -67,13 +67,14 @@ public: virtual bool handleForwardBackwardMouseButtons(QMouseEvent *e) = 0; - static QString AboutBlank; - static QString LocalHelpFile; - static QString PageNotFoundMessage; + static const QLatin1String DocPath; + static const QString AboutBlank; + static const QString LocalHelpFile; + static const QString PageNotFoundMessage; static bool isLocalUrl(const QUrl &url); static bool canOpenPage(const QString &url); - static QString mimeFromUrl(const QString &url); + static QString mimeFromUrl(const QUrl &url); static bool launchWithExternalApp(const QUrl &url); }; diff --git a/tools/assistant/tools/assistant/helpviewer_qwv.cpp b/tools/assistant/tools/assistant/helpviewer_qwv.cpp index db1cd58..adaa45b 100644 --- a/tools/assistant/tools/assistant/helpviewer_qwv.cpp +++ b/tools/assistant/tools/assistant/helpviewer_qwv.cpp @@ -129,13 +129,28 @@ QNetworkReply *HelpNetworkAccessManager::createRequest(Operation /*op*/, const QNetworkRequest &request, QIODevice* /*outgoingData*/) { TRACE_OBJ - const QUrl &url = request.url(); - const QString &mimeType = AbstractHelpViewer::mimeFromUrl(url.toString()); - + QString url = request.url().toString(); HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance(); + + // TODO: For some reason the url to load is already wrong (passed from webkit) + // though the css file and the references inside should work that way. One + // possible problem might be that the css is loaded at the same level as the + // html, thus a path inside the css like (../images/foo.png) might cd out of + // the virtual folder + if (!helpEngine.findFile(url).isValid()) { + if (url.startsWith(AbstractHelpViewer::DocPath)) { + QUrl newUrl = request.url(); + if (!newUrl.path().startsWith(QLatin1String("/qdoc/"))) { + newUrl.setPath(QLatin1String("qdoc") + newUrl.path()); + url = newUrl.toString(); + } + } + } + + const QString &mimeType = AbstractHelpViewer::mimeFromUrl(url); const QByteArray &data = helpEngine.findFile(url).isValid() ? helpEngine.fileData(url) - : AbstractHelpViewer::PageNotFoundMessage.arg(url.toString()).toUtf8(); + : AbstractHelpViewer::PageNotFoundMessage.arg(url).toUtf8(); return new HelpNetworkReply(request, data, mimeType.isEmpty() ? QLatin1String("application/octet-stream") : mimeType); } diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 687f8a1..f4bd92e 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -247,8 +247,9 @@ Configure::Configure( int& argc, char** argv ) dictionary[ "PHONON" ] = "auto"; dictionary[ "PHONON_BACKEND" ] = "yes"; dictionary[ "MULTIMEDIA" ] = "yes"; + dictionary[ "MEDIASERVICES" ] = "yes"; dictionary[ "AUDIO_BACKEND" ] = "auto"; - dictionary[ "MEDIASERVICE"] = "auto"; + dictionary[ "MEDIA_BACKEND"] = "auto"; dictionary[ "WMSDK" ] = "auto"; dictionary[ "DIRECTSHOW" ] = "no"; dictionary[ "WEBKIT" ] = "auto"; @@ -905,14 +906,18 @@ void Configure::parseCmdLine() dictionary[ "MULTIMEDIA" ] = "no"; } else if( configCmdLine.at(i) == "-multimedia" ) { dictionary[ "MULTIMEDIA" ] = "yes"; + } else if( configCmdLine.at(i) == "-no-mediaservices" ) { + dictionary[ "MEDIASERVICES" ] = "no"; + } else if( configCmdLine.at(i) == "-mediaservices" ) { + dictionary[ "MEDIASERVICES" ] = "yes"; } else if( configCmdLine.at(i) == "-audio-backend" ) { dictionary[ "AUDIO_BACKEND" ] = "yes"; } else if( configCmdLine.at(i) == "-no-audio-backend" ) { dictionary[ "AUDIO_BACKEND" ] = "no"; - } else if( configCmdLine.at(i) == "-mediaservice") { - dictionary[ "MEDIASERVICE" ] = "yes"; - } else if (configCmdLine.at(i) == "-no-mediaservice") { - dictionary[ "MEDIASERVICE" ] = "no"; + } else if( configCmdLine.at(i) == "-media-backend") { + dictionary[ "MEDIA_BACKEND" ] = "yes"; + } else if (configCmdLine.at(i) == "-no-media-backend") { + dictionary[ "MEDIA_BACKEND" ] = "no"; } else if( configCmdLine.at(i) == "-no-phonon" ) { dictionary[ "PHONON" ] = "no"; } else if( configCmdLine.at(i) == "-phonon" ) { @@ -1181,7 +1186,8 @@ void Configure::parseCmdLine() dictionary[ "QMAKESPEC" ].endsWith( "-msvc2002" ) || dictionary[ "QMAKESPEC" ].endsWith( "-msvc2003" ) || dictionary[ "QMAKESPEC" ].endsWith( "-msvc2005" ) || - dictionary[ "QMAKESPEC" ].endsWith( "-msvc2008" )) { + dictionary[ "QMAKESPEC" ].endsWith( "-msvc2008" ) || + dictionary[ "QMAKESPEC" ].endsWith( "-msvc2010" )) { if ( dictionary[ "MAKE" ].isEmpty() ) dictionary[ "MAKE" ] = "nmake"; dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32"; } else if ( dictionary[ "QMAKESPEC" ] == QString( "win32-g++" ) ) { @@ -1597,7 +1603,7 @@ bool Configure::displayHelp() "[-qtnamespace <namespace>] [-qtlibinfix <infix>] [-no-phonon]\n" "[-phonon] [-no-phonon-backend] [-phonon-backend]\n" "[-no-multimedia] [-multimedia] [-no-audio-backend] [-audio-backend]\n" - "[-no-mediaservice] [-mediaservice]\n" + "[-no-mediaservices] [-mediaservices] [-no-media-backend] [-media-backend]\n" "[-no-script] [-script] [-no-scripttools] [-scripttools]\n" "[-no-webkit] [-webkit] [-graphicssystem raster|opengl|openvg]\n\n", 0, 7); @@ -1782,8 +1788,10 @@ bool Configure::displayHelp() desc("MULTIMEDIA", "yes","-multimedia", "Compile in multimedia module"); desc("AUDIO_BACKEND", "no","-no-audio-backend", "Do not compile in the platform audio backend into QtMultimedia"); desc("AUDIO_BACKEND", "yes","-audio-backend", "Compile in the platform audio backend into QtMultimedia"); - desc("MEDIASERVICE", "no","-no-mediaservice", "Do not compile in the platform-specific QtMultimedia media service."); - desc("MEDIASERVICE", "yes","-mediaservice", "Compile in the platform-specific QtMultimedia media service."); + desc("MEDIASERVICES", "no", "-no-mediaservices","Do not compile the QtMediaServices module"); + desc("MEDIASERVICES", "yes","-mediaservices", "Compile in QtMediaServices module"); + desc("MEDIA_BACKEND", "no","-no-media-backend", "Do not compile in the platform-specific QtMediaServices media service."); + desc("MEDIA_BACKEND", "yes","-media-backend", "Compile in the platform-specific QtMediaServices media service."); desc("WEBKIT", "no", "-no-webkit", "Do not compile in the WebKit module"); desc("WEBKIT", "yes", "-webkit", "Compile in the WebKit module (WebKit is built if a decent C++ compiler is used.)"); desc("SCRIPT", "no", "-no-script", "Do not build the QtScript module."); @@ -2065,7 +2073,7 @@ bool Configure::checkAvailability(const QString &part) && dictionary.value("QMAKESPEC") != "win32-msvc.net" // Leave for now, since we can't be sure if they are using 2002 or 2003 with this spec && dictionary.value("QMAKESPEC") != "win32-msvc2002" && dictionary.value("EXCEPTIONS") == "yes"; - } else if (part == "PHONON" || part == "MEDIASERVICE") { + } else if (part == "PHONON" || part == "MEDIA_BACKEND") { available = findFile("vmr9.h") && findFile("dshow.h") && findFile("dmo.h") && findFile("dmodshow.h") && (findFile("strmiids.lib") || findFile("libstrmiids.a")) && (findFile("dmoguids.lib") || findFile("libdmoguids.a")) @@ -2088,7 +2096,7 @@ bool Configure::checkAvailability(const QString &part) } else if (part == "MULTIMEDIA" || part == "SCRIPT" || part == "SCRIPTTOOLS" || part == "DECLARATIVE") { available = true; } else if (part == "WEBKIT") { - available = (dictionary.value("QMAKESPEC") == "win32-msvc2005") || (dictionary.value("QMAKESPEC") == "win32-msvc2008") || (dictionary.value("QMAKESPEC") == "win32-g++"); + available = (dictionary.value("QMAKESPEC") == "win32-msvc2005") || (dictionary.value("QMAKESPEC") == "win32-msvc2008") || (dictionary.value("QMAKESPEC") == "win32-msvc2010") || (dictionary.value("QMAKESPEC") == "win32-g++"); } else if (part == "AUDIO_BACKEND") { available = true; if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) { @@ -2225,8 +2233,8 @@ void Configure::autoDetection() dictionary["DECLARATIVE"] = dictionary["SCRIPT"] == "yes" ? "yes" : "no"; if (dictionary["AUDIO_BACKEND"] == "auto") dictionary["AUDIO_BACKEND"] = checkAvailability("AUDIO_BACKEND") ? "yes" : "no"; - if (dictionary["MEDIASERVICE"] == "auto") - dictionary["MEDIASERVICE"] = checkAvailability("MEDIASERVICE") ? "yes" : "no"; + if (dictionary["MEDIA_BACKEND"] == "auto") + dictionary["MEDIA_BACKEND"] = checkAvailability("MEDIA_BACKEND") ? "yes" : "no"; if (dictionary["WMSDK"] == "auto") dictionary["WMSDK"] = checkAvailability("WMSDK") ? "yes" : "no"; @@ -2627,10 +2635,13 @@ void Configure::generateOutputVars() qtConfig += "multimedia"; if (dictionary["AUDIO_BACKEND"] == "yes") qtConfig += "audio-backend"; - if (dictionary["MEDIASERVICE"] == "yes") { - qtConfig += "mediaservice"; - if (dictionary["WMSDK"] == "yes") - qtConfig += "wmsdk"; + if (dictionary["MEDIASERVICES"] == "yes") { + qtConfig += "mediaservices"; + if (dictionary["MEDIA_BACKEND"] == "yes") { + qtConfig += "media-backend"; + if (dictionary["WMSDK"] == "yes") + qtConfig += "wmsdk"; + } } } @@ -3033,6 +3044,7 @@ void Configure::generateConfigfiles() if(dictionary["DECLARATIVE"] == "no") qconfigList += "QT_NO_DECLARATIVE"; if(dictionary["PHONON"] == "no") qconfigList += "QT_NO_PHONON"; if(dictionary["MULTIMEDIA"] == "no") qconfigList += "QT_NO_MULTIMEDIA"; + if(dictionary["MEDIASERVICES"] == "no") qconfigList += "QT_NO_MEDIASERVICES"; if(dictionary["XMLPATTERNS"] == "no") qconfigList += "QT_NO_XMLPATTERNS"; if(dictionary["SCRIPT"] == "no") qconfigList += "QT_NO_SCRIPT"; if(dictionary["SCRIPTTOOLS"] == "no") qconfigList += "QT_NO_SCRIPTTOOLS"; @@ -3335,6 +3347,7 @@ void Configure::displayConfig() cout << "QtXmlPatterns support......." << dictionary[ "XMLPATTERNS" ] << endl; cout << "Phonon support.............." << dictionary[ "PHONON" ] << endl; cout << "QtMultimedia support........" << dictionary[ "MULTIMEDIA" ] << endl; + cout << "QtMediaServices support....." << dictionary[ "MEDIASERVICES" ] << endl; cout << "WebKit support.............." << dictionary[ "WEBKIT" ] << endl; cout << "Declarative support........." << dictionary[ "DECLARATIVE" ] << endl; cout << "QtScript support............" << dictionary[ "SCRIPT" ] << endl; diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp index 60b8dcc..943a8a2 100644 --- a/tools/configure/environment.cpp +++ b/tools/configure/environment.cpp @@ -80,6 +80,7 @@ struct CompilerInfo{ {CC_NET2003, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2003 (7.1)", "Software\\Microsoft\\VisualStudio\\7.1\\Setup\\VC\\ProductDir", "cl.exe"}, // link.exe, lib.exe {CC_NET2005, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2005 (8.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\8.0", "cl.exe"}, // link.exe, lib.exe {CC_NET2008, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2008 (9.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\9.0", "cl.exe"}, // link.exe, lib.exe + {CC_NET2010, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2010 (10.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\10.0", "cl.exe"}, // link.exe, lib.exe {CC_UNKNOWN, "Unknown", 0, 0}, }; @@ -105,6 +106,9 @@ QString Environment::detectQMakeSpec() { QString spec; switch (detectCompiler()) { + case CC_NET2010: + spec = "win32-msvc2010"; + break; case CC_NET2008: spec = "win32-msvc2008"; break; diff --git a/tools/configure/environment.h b/tools/configure/environment.h index b1cbe3a..16af8df 100644 --- a/tools/configure/environment.h +++ b/tools/configure/environment.h @@ -56,7 +56,8 @@ enum Compiler { CC_NET2002 = 0x70, CC_NET2003 = 0x71, CC_NET2005 = 0x80, - CC_NET2008 = 0x90 + CC_NET2008 = 0x90, + CC_NET2010 = 0x91 }; struct CompilerInfo; diff --git a/tools/designer/src/components/propertyeditor/propertyeditor.cpp b/tools/designer/src/components/propertyeditor/propertyeditor.cpp index 86d7bdf..a8ca8ad 100644 --- a/tools/designer/src/components/propertyeditor/propertyeditor.cpp +++ b/tools/designer/src/components/propertyeditor/propertyeditor.cpp @@ -135,7 +135,7 @@ QSize ElidingLabel::sizeHint() const return size; } -void ElidingLabel::paintEvent(QPaintEvent *e) { +void ElidingLabel::paintEvent(QPaintEvent *) { QPainter painter(this); painter.setPen(QColor(0, 0, 0, 60)); painter.setBrush(QColor(255, 255, 255, 40)); diff --git a/tools/designer/src/lib/shared/filterwidget.cpp b/tools/designer/src/lib/shared/filterwidget.cpp index f485346..07af901 100644 --- a/tools/designer/src/lib/shared/filterwidget.cpp +++ b/tools/designer/src/lib/shared/filterwidget.cpp @@ -80,8 +80,11 @@ void IconButton::paintEvent(QPaintEvent *) QPainter painter(this); // Note isDown should really use the active state but in most styles // this has no proper feedback - QPixmap iconpixmap = icon().pixmap(ICONBUTTON_SIZE, ICONBUTTON_SIZE, isDown() ? - QIcon::Selected : QIcon::Normal); + QIcon::Mode state = QIcon::Disabled; + if (isEnabled()) + state = isDown() ? QIcon::Selected : QIcon::Normal; + QPixmap iconpixmap = icon().pixmap(QSize(ICONBUTTON_SIZE, ICONBUTTON_SIZE), + state, QIcon::Off); QRect pixmapRect = QRect(0, 0, iconpixmap.width(), iconpixmap.height()); pixmapRect.moveCenter(rect().center()); painter.setOpacity(m_fader); @@ -204,9 +207,12 @@ QString FilterWidget::text() const return m_editor->text(); } -void FilterWidget::checkButton(const QString &) +void FilterWidget::checkButton(const QString &text) { - m_button->animateShow(!m_editor->text().isEmpty()); + static QString oldtext; + if (oldtext.isEmpty() || text.isEmpty()) + m_button->animateShow(!m_editor->text().isEmpty()); + oldtext = text; } void FilterWidget::reset() diff --git a/tools/pixeltool/qpixeltool.cpp b/tools/pixeltool/qpixeltool.cpp index c684688..f64dfba 100644 --- a/tools/pixeltool/qpixeltool.cpp +++ b/tools/pixeltool/qpixeltool.cpp @@ -356,7 +356,7 @@ void QPixelTool::contextMenuEvent(QContextMenuEvent *e) freeze.setCheckable(true); freeze.setChecked(tmpFreeze); freeze.setShortcut(QKeySequence(Qt::Key_Space)); - QAction autoUpdate(QLatin1String("Continous update"), &menu); + QAction autoUpdate(QLatin1String("Continuous update"), &menu); autoUpdate.setCheckable(true); autoUpdate.setChecked(m_autoUpdate); autoUpdate.setShortcut(QKeySequence(Qt::Key_A)); diff --git a/tools/qdoc3/config.h b/tools/qdoc3/config.h index 980d1fb..c29becc 100644 --- a/tools/qdoc3/config.h +++ b/tools/qdoc3/config.h @@ -142,6 +142,7 @@ class Config #define CONFIG_MACRO "macro" #define CONFIG_NATURALLANGUAGE "naturallanguage" #define CONFIG_OBSOLETELINKS "obsoletelinks" +#define CONFIG_ONLINE "online" #define CONFIG_OUTPUTDIR "outputdir" #define CONFIG_OUTPUTENCODING "outputencoding" #define CONFIG_OUTPUTLANGUAGE "outputlanguage" diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index 6884781..13678af 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -492,7 +492,7 @@ const FunctionNode *CppCodeParser::findFunctionNode(const QString& synopsis, candidates << overload; } - + /* There are several functions with the correct parameter count, but only one has the correct @@ -545,7 +545,7 @@ QSet<QString> CppCodeParser::topicCommands() } /*! - Process the topic \a command in context \a doc with argument \a arg. + Process the topic \a command in context \a doc with argument \a arg. */ Node *CppCodeParser::processTopicCommand(const Doc& doc, const QString& command, @@ -731,7 +731,7 @@ Node *CppCodeParser::processTopicCommand(const Doc& doc, return new QmlClassNode(tre->root(), names[0], classNode); } else if (command == COMMAND_QMLBASICTYPE) { -#if 0 +#if 0 QStringList parts = arg.split(" "); qDebug() << command << parts; if (parts.size() > 1) { @@ -741,7 +741,7 @@ Node *CppCodeParser::processTopicCommand(const Doc& doc, return new QmlBasicTypeNode(pageNode, parts[0]); } } -#endif +#endif return new QmlBasicTypeNode(tre->root(), arg); } else if ((command == COMMAND_QMLSIGNAL) || @@ -912,13 +912,13 @@ QSet<QString> CppCodeParser::otherMetaCommands() << COMMAND_NEXTPAGE << COMMAND_PREVIOUSPAGE << COMMAND_INDEXPAGE -#ifdef QDOC_QML +#ifdef QDOC_QML << COMMAND_STARTPAGE << COMMAND_QMLINHERITS << COMMAND_QMLDEFAULT; -#else +#else << COMMAND_STARTPAGE; -#endif +#endif } /*! @@ -2119,7 +2119,7 @@ bool CppCodeParser::matchDocsAndStuff() } ++a; } -#endif +#endif } NodeList::Iterator n = nodes.begin(); @@ -2268,18 +2268,15 @@ void CppCodeParser::instantiateIteratorMacro(const QString &container, void CppCodeParser::createExampleFileNodes(FakeNode *fake) { QString examplePath = fake->name(); - - // we can assume that this file always exists - QString proFileName = examplePath + "/" + - examplePath.split("/").last() + ".pro"; - + QString proFileName = examplePath + "/" + examplePath.split("/").last() + ".pro"; QString userFriendlyFilePath; + QString fullPath = Config::findFile(fake->doc().location(), exampleFiles, exampleDirs, proFileName, userFriendlyFilePath); - + if (fullPath.isEmpty()) { QString tmp = proFileName; proFileName = examplePath + "/" + "qbuild.pro"; @@ -2290,9 +2287,18 @@ void CppCodeParser::createExampleFileNodes(FakeNode *fake) proFileName, userFriendlyFilePath); if (fullPath.isEmpty()) { - fake->doc().location().warning( - tr("Cannot find file '%1' or '%2'").arg(tmp).arg(proFileName)); - return; + proFileName = examplePath + "/" + examplePath.split("/").last() + ".qmlproject"; + userFriendlyFilePath.clear(); + fullPath = Config::findFile(fake->doc().location(), + exampleFiles, + exampleDirs, + proFileName, + userFriendlyFilePath); + if (fullPath.isEmpty()) { + fake->doc().location().warning( + tr("Cannot find file '%1' or '%2'").arg(tmp).arg(proFileName)); + return; + } } } @@ -2315,14 +2321,14 @@ void CppCodeParser::createExampleFileNodes(FakeNode *fake) i.remove(); } else if (fileName.contains("/qrc_") || fileName.contains("/moc_") - || fileName.contains("/ui_")) + || fileName.contains("/ui_")) i.remove(); } if (!mainCpp.isEmpty()) exampleFiles.append(mainCpp); // add any qmake Qt resource files and qmake project files - exampleFiles += Config::getFilesHere(fullPath, "*.qrc *.pro"); + exampleFiles += Config::getFilesHere(fullPath, "*.qrc *.pro qmldir"); } foreach (const QString &exampleFile, exampleFiles) diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index ad4cdde..5716626 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -3036,7 +3036,7 @@ QString Doc::canonicalTitle(const QString &title) QString result; result.reserve(title.size()); - bool slurping = false; + bool dashAppended = false; bool begun = false; int lastAlnum = 0; for (int i = 0; i != title.size(); ++i) { @@ -3047,18 +3047,21 @@ QString Doc::canonicalTitle(const QString &title) if (alnum) { result += QLatin1Char(c); begun = true; - slurping = false; + dashAppended = false; lastAlnum = result.size(); } - else if (!slurping) { + else if (!dashAppended) { if (begun) result += QLatin1Char('-'); - slurping = true; + dashAppended = true; } +#if 0 + // This was screwing things up. else { result += title[i]; lastAlnum = result.size(); } +#endif } result.truncate(lastAlnum); return result; diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index a5dc7b7..6b7d350 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -204,10 +204,18 @@ static void addLink(const QString &linkTarget, HtmlGenerator::HtmlGenerator() - : helpProjectWriter(0), inLink(false), inContents(false), - inSectionHeading(false), inTableHeader(false), numTableRows(0), - threeColumnEnumValueTable(true), funcLeftParen("\\S(\\()"), - myTree(0), slow(false), obsoleteLinks(false) + : helpProjectWriter(0), + inLink(false), + inContents(false), + inSectionHeading(false), + inTableHeader(false), + numTableRows(0), + threeColumnEnumValueTable(true), + offlineDocs(true), + funcLeftParen("\\S(\\()"), + myTree(0), + slow(false), + obsoleteLinks(false) { } @@ -262,7 +270,7 @@ void HtmlGenerator::initializeGenerator(const Config &config) HTMLGENERATOR_GENERATEMACREFS); project = config.getString(CONFIG_PROJECT); - + offlineDocs = !config.getBool(CONFIG_ONLINE); projectDescription = config.getString(CONFIG_DESCRIPTION); if (projectDescription.isEmpty() && !project.isEmpty()) projectDescription = project + " Reference Documentation"; @@ -406,9 +414,7 @@ void HtmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) generateIndex(fileBase, projectUrl, projectDescription); generatePageIndex(outputDir() + "/" + fileBase + ".pageindex", marker); - //qDebug() << "start helpProjectWriter->generate(myTree)"; helpProjectWriter->generate(myTree); - //qDebug() << "end helpProjectWriter->generate(myTree)"; } void HtmlGenerator::startText(const Node * /* relative */, @@ -506,14 +512,14 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << formattingRightMap()[ATOM_FORMATTING_TELETYPE]; break; case Atom::Code: - out() << "<pre>" + out() << "<pre class=\"highlightedCode\">" << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()), marker,relative)) << "</pre>\n"; break; #ifdef QDOC_QML case Atom::Qml: - out() << "<pre>" + out() << "<pre class=\"highlightedCode\">" << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()), marker,relative)) << "</pre>\n"; @@ -521,7 +527,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, #endif case Atom::CodeNew: out() << "<p>you can rewrite it as</p>\n" - << "<pre>" + << "<pre class=\"highlightedCode\">" << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()), marker,relative)) << "</pre>\n"; @@ -530,9 +536,9 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << "<p>For example, if you have code like</p>\n"; // fallthrough case Atom::CodeBad: - out() << "<pre><font color=\"#404040\">" + out() << "<pre class=\"highlightedCode\">" << trimmedTrailing(protectEnc(plainCode(indent(codeIndent,atom->string())))) - << "</font></pre>\n"; + << "</pre>\n"; break; case Atom::FootnoteLeft: // ### For now @@ -841,7 +847,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, if (atom->next() != 0) text = atom->next()->string(); if (atom->type() == Atom::Image) - out() << "<p align=\"center\">"; + out() << "<p class=\"centerAlign\">"; if (fileName.isEmpty()) { out() << "<font color=\"red\">[Missing image " << protectEnc(atom->string()) << "]</font>"; @@ -860,7 +866,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, case Atom::ImageText: break; case Atom::LegaleseLeft: - out() << "<div style=\"padding: 0.5em; background: #e0e0e0; color: black\">"; + out() << "<div class=\"LegaleseLeft\">"; break; case Atom::LegaleseRight: out() << "</div>"; @@ -902,13 +908,13 @@ int HtmlGenerator::generateAtom(const Atom *atom, else if (atom->string() == ATOM_LIST_VALUE) { threeColumnEnumValueTable = isThreeColumnEnumValueTable(atom); if (threeColumnEnumValueTable) { - out() << "<p><table class=\"valuelist\">" + out() << "<table class=\"valuelist\">" << "<tr><th>Constant</th>" << "<th>Value</th>" << "<th>Description</th></tr>\n"; } else { - out() << "<p><table class=\"valuelist\">" + out() << "<table class=\"valuelist\">" << "<tr><th>Constant</th><th>Value</th></tr>\n"; } } @@ -943,10 +949,10 @@ int HtmlGenerator::generateAtom(const Atom *atom, else { // (atom->string() == ATOM_LIST_VALUE) // ### Trenton - out() << "<tr><td valign=\"top\"><tt>" + out() << "<tr><td class=\"topAlign\"><tt>" << protectEnc(plainCode(marker->markedUpEnumValue(atom->next()->string(), relative))) - << "</tt></td><td align=\"center\" valign=\"top\">"; + << "</tt></td><td class=\"centerAlign topAlign\">"; QString itemValue; if (relative->type() == Node::Enum) { @@ -972,7 +978,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, } else if (atom->string() == ATOM_LIST_VALUE) { if (threeColumnEnumValueTable) { - out() << "</td><td valign=\"top\">"; + out() << "</td><td class=\"topAlign\">"; if (matchAhead(atom, Atom::ListItemRight)) out() << " "; } @@ -1002,7 +1008,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << "</dl>\n"; } else if (atom->string() == ATOM_LIST_VALUE) { - out() << "</table></p>\n"; + out() << "</table>\n"; } else { out() << "</ol>\n"; @@ -1083,29 +1089,28 @@ int HtmlGenerator::generateAtom(const Atom *atom, } if (!atom->string().isEmpty()) { if (atom->string().contains("%")) - out() << "<p><table class=\"generic\" width=\"" << atom->string() << "\" " - << "align=\"center\">\n"; + out() << "<table class=\"generic centerAlign\" width=\"" << atom->string() << "\">\n "; else { - out() << "<p><table class=\"generic\" align=\"center\">\n"; + out() << "<table class=\"generic centerAlign\">\n"; } } else { - out() << "<p><table class=\"generic\" align=\"center\">\n"; + out() << "<table class=\"generic centerAlign\">\n"; } numTableRows = 0; break; case Atom::TableRight: - out() << "</table></p>\n"; + out() << "</table>\n"; break; case Atom::TableHeaderLeft: - out() << "<thead><tr valign=\"top\" class=\"qt-style\">"; + out() << "<thead><tr class=\"qt-style topAlign\">"; inTableHeader = true; break; case Atom::TableHeaderRight: out() << "</tr>"; if (matchAhead(atom, Atom::TableHeaderLeft)) { skipAhead = 1; - out() << "\n<tr valign=\"top\" class=\"qt-style\">"; + out() << "\n<tr class=\"qt-style topAlign\">"; } else { out() << "</thead>\n"; @@ -1114,9 +1119,9 @@ int HtmlGenerator::generateAtom(const Atom *atom, break; case Atom::TableRowLeft: if (++numTableRows % 2 == 1) - out() << "<tr valign=\"top\" class=\"odd\">"; + out() << "<tr class=\"odd topAlign\">"; else - out() << "<tr valign=\"top\" class=\"even\">"; + out() << "<tr class=\"even topAlign\">"; break; case Atom::TableRowRight: out() << "</tr>\n"; @@ -1181,11 +1186,11 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << "<a name=\"" << Doc::canonicalTitle(atom->string()) << "\"></a>"; break; case Atom::UnhandledFormat: - out() << "<font color=\"red\"><b><Missing HTML></b></font>"; + out() << "<b class=\"redFont\"><Missing HTML></b>"; break; case Atom::UnknownCommand: - out() << "<font color=\"red\"><b><code>\\" << protectEnc(atom->string()) - << "</code></b></font>"; + out() << "<b class=\"redFont\"><code>\\" << protectEnc(atom->string()) + << "</code></b>"; break; #ifdef QDOC_QML case Atom::QmlText: @@ -1737,146 +1742,17 @@ void HtmlGenerator::generateHeader(const QString& title, out() << " <script src=\"scripts/jquery.js\" type=\"text/javascript\"></script>\n"; out() << " <script src=\"scripts/functions.js\" type=\"text/javascript\"></script>\n"; out() << "</head>\n"; - -#if 0 - out() << "<!DOCTYPE html\n" - " PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"DTD/xhtml1-strict.dtd\">\n"; - out() << QString("<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"%1\" lang=\"%1\">\n").arg(naturalLanguage); - - QString shortVersion; - if ((project != "Qtopia") && (project != "Qt Extended")) { - shortVersion = project + " " + shortVersion + ": "; - if (node && !node->doc().location().isEmpty()) - out() << "<!-- " << node->doc().location().fileName() << " -->\n"; - - shortVersion = myTree->version(); - if (shortVersion.count(QChar('.')) == 2) - shortVersion.truncate(shortVersion.lastIndexOf(QChar('.'))); - if (!shortVersion.isEmpty()) { - if (project == "QSA") - shortVersion = "QSA " + shortVersion + ": "; - else - shortVersion = "Qt " + shortVersion + ": "; - } - } - - out() << "<head>\n" - " <title>" << shortVersion << protectEnc(title) << "</title>\n"; - out() << QString("<meta http-equiv=\"Content-type\" content=\"text/html; charset=%1\" />").arg(outputEncoding); - - if (!style.isEmpty()) - out() << " <style type=\"text/css\">" << style << "</style>\n"; - const QMap<QString, QString> &metaMap = node->doc().metaTagMap(); - if (!metaMap.isEmpty()) { - QMapIterator<QString, QString> i(metaMap); - while (i.hasNext()) { - i.next(); - out() << " <meta name=\"" << protectEnc(i.key()) << "\" contents=\"" - << protectEnc(i.value()) << "\" />\n"; - } - } - - navigationLinks.clear(); - - if (node && !node->links().empty()) { - QPair<QString,QString> linkPair; - QPair<QString,QString> anchorPair; - const Node *linkNode; - - if (node->links().contains(Node::PreviousLink)) { - linkPair = node->links()[Node::PreviousLink]; - linkNode = findNodeForTarget(linkPair.first, node, marker); - if (!linkNode || linkNode == node) - anchorPair = linkPair; - else - anchorPair = anchorForNode(linkNode); - - out() << " <link rel=\"prev\" href=\"" - << anchorPair.first << "\" />\n"; - - navigationLinks += "[Previous: <a href=\"" + anchorPair.first + "\">"; - if (linkPair.first == linkPair.second && !anchorPair.second.isEmpty()) - navigationLinks += protectEnc(anchorPair.second); - else - navigationLinks += protectEnc(linkPair.second); - navigationLinks += "</a>]\n"; - } - if (node->links().contains(Node::ContentsLink)) { - linkPair = node->links()[Node::ContentsLink]; - linkNode = findNodeForTarget(linkPair.first, node, marker); - if (!linkNode || linkNode == node) - anchorPair = linkPair; - else - anchorPair = anchorForNode(linkNode); - - out() << " <link rel=\"contents\" href=\"" - << anchorPair.first << "\" />\n"; - - navigationLinks += "[<a href=\"" + anchorPair.first + "\">"; - if (linkPair.first == linkPair.second && !anchorPair.second.isEmpty()) - navigationLinks += protectEnc(anchorPair.second); - else - navigationLinks += protectEnc(linkPair.second); - navigationLinks += "</a>]\n"; - } - if (node->links().contains(Node::NextLink)) { - linkPair = node->links()[Node::NextLink]; - linkNode = findNodeForTarget(linkPair.first, node, marker); - if (!linkNode || linkNode == node) - anchorPair = linkPair; - else - anchorPair = anchorForNode(linkNode); - - out() << " <link rel=\"next\" href=\"" - << anchorPair.first << "\" />\n"; - - navigationLinks += "[Next: <a href=\"" + anchorPair.first + "\">"; - if (linkPair.first == linkPair.second && !anchorPair.second.isEmpty()) - navigationLinks += protectEnc(anchorPair.second); - else - navigationLinks += protectEnc(linkPair.second); - navigationLinks += "</a>]\n"; - } - if (node->links().contains(Node::IndexLink)) { - linkPair = node->links()[Node::IndexLink]; - linkNode = findNodeForTarget(linkPair.first, node, marker); - if (!linkNode || linkNode == node) - anchorPair = linkPair; - else - anchorPair = anchorForNode(linkNode); - out() << " <link rel=\"index\" href=\"" - << anchorPair.first << "\" />\n"; - } - if (node->links().contains(Node::StartLink)) { - linkPair = node->links()[Node::StartLink]; - linkNode = findNodeForTarget(linkPair.first, node, marker); - if (!linkNode || linkNode == node) - anchorPair = linkPair; - else - anchorPair = anchorForNode(linkNode); - out() << " <link rel=\"start\" href=\"" - << anchorPair.first << "\" />\n"; - } - } - - foreach (const QString &stylesheet, stylesheets) { - out() << " <link href=\"" << stylesheet << "\" rel=\"stylesheet\" " - << "type=\"text/css\" />\n"; - } - - foreach (const QString &customHeadElement, customHeadElements) { - out() << " " << customHeadElement << "\n"; - } - - out() << "</head>\n" - #endif + if (offlineDocs) + out() << "<body class=\"offline\">\n"; + else out() << "<body class=\"\">\n"; + if (mainPage) generateMacRef(node, marker); out() << QString(postHeader).replace("\\" + COMMAND_VERSION, myTree->version()); -#if 0 +#if 0 // Removed for new docf format. MWS if (node && !node->links().empty()) out() << "<p>\n" << navigationLinks << "</p>\n"; #endif @@ -1932,7 +1808,7 @@ void HtmlGenerator::generateBrief(const Node *node, CodeMarker *marker, void HtmlGenerator::generateIncludes(const InnerNode *inner, CodeMarker *marker) { if (!inner->includes().isEmpty()) { - out() << "<pre>" + out() << "<pre clas=\"highlightedCode\">" << trimmedTrailing(highlightedCode(indent(codeIndent, marker->markedUpIncludes(inner->includes())), marker,inner)) @@ -1966,8 +1842,8 @@ void HtmlGenerator::generateTableOfContents(const Node *node, QString tdTag; if (numColumns > 1) { - tdTag = "<td width=\"" + QString::number((100 + numColumns - 1) / numColumns) + "%\">"; - out() << "<p><table class=\"toc\" width=\"100%\">\n<tr valign=\"top\">" + tdTag = "<td>"; /* width=\"" + QString::number((100 + numColumns - 1) / numColumns) + "%\">";*/ + out() << "<table class=\"toc\">\n<tr class=\"topAlign\">" << tdTag << "\n"; } @@ -2019,7 +1895,7 @@ void HtmlGenerator::generateTableOfContents(const Node *node, } if (numColumns > 1) - out() << "</td></tr></table></p>\n"; + out() << "</td></tr></table>\n"; inContents = false; inLink = false; @@ -2047,18 +1923,30 @@ void HtmlGenerator::generateTableOfContents(const Node *node, inLink = true; out() << "<div class=\"toc\">\n"; - out() << "<h3>Table of Contents</h3>\n"; + out() << "<h3>Contents</h3>\n"; sectionNumber.append("1"); - out() << "<ul class=\"level" << sectionNumber.size() << "\">\n"; + out() << "<ul>\n"; if (node->subType() == Node::Module) { if (moduleNamespaceMap.contains(node->name())) { - out() << "<li><a href=\"#" << registerRef("namespaces") << "\">Namespaces</a></li>\n"; + out() << "<li class=\"level" + << sectionNumber.size() + << "\"><a href=\"#" + << registerRef("namespaces") + << "\">Namespaces</a></li>\n"; } if (moduleClassMap.contains(node->name())) { - out() << "<li><a href=\"#" << registerRef("classes") << "\">Classes</a></li>\n"; - } - out() << "<li><a href=\"#" << registerRef("details") << "\">Detailed Description</a></li>\n"; + out() << "<li class=\"level" + << sectionNumber.size() + << "\"><a href=\"#" + << registerRef("classes") + << "\">Classes</a></li>\n"; + } + out() << "<li class=\"level" + << sectionNumber.size() + << "\"><a href=\"#" + << registerRef("details") + << "\">Detailed Description</a></li>\n"; for (int i = 0; i < toc.size(); ++i) { if (toc.at(i)->string().toInt() == 1) { detailsBase = 1; @@ -2070,14 +1958,20 @@ void HtmlGenerator::generateTableOfContents(const Node *node, QList<Section>::ConstIterator s = sections->begin(); while (s != sections->end()) { if (!s->members.isEmpty() || !s->reimpMembers.isEmpty()) { - out() << "<li><a href=\"#" + out() << "<li class=\"level" + << sectionNumber.size() + << "\"><a href=\"#" << registerRef((*s).pluralMember) << "\">" << (*s).name << "</a></li>\n"; } ++s; } - out() << "<li><a href=\"#" << registerRef("details") << "\">Detailed Description</a></li>\n"; + out() << "<li class=\"level" + << sectionNumber.size() + << "\"><a href=\"#" + << registerRef("details") + << "\">Detailed Description</a></li>\n"; for (int i = 0; i < toc.size(); ++i) { if (toc.at(i)->string().toInt() == 1) { detailsBase = 1; @@ -2092,30 +1986,31 @@ void HtmlGenerator::generateTableOfContents(const Node *node, if (sectionNumber.size() < nextLevel) { do { sectionNumber.append("1"); - out() << "<ul class=\"level" << sectionNumber.size() << "\">\n"; } while (sectionNumber.size() < nextLevel); } else { while (sectionNumber.size() > nextLevel) { - out() << "</ul>\n"; sectionNumber.removeLast(); } sectionNumber.last() = QString::number(sectionNumber.last().toInt() + 1); } int numAtoms; Text headingText = Text::sectionHeading(atom); - out() << "<li>"; + QString s = headingText.toString(); + out() << "<li class=\"level" + << sectionNumber.size() + << "\">"; out() << "<a href=\"" << "#" - << Doc::canonicalTitle(headingText.toString()) + << Doc::canonicalTitle(s) << "\">"; generateAtomList(headingText.firstAtom(), node, marker, true, numAtoms); out() << "</a></li>\n"; } while (!sectionNumber.isEmpty()) { - out() << "</ul>\n"; sectionNumber.removeLast(); } + out() << "</ul>\n"; out() << "</div>\n"; inContents = false; inLink = false; @@ -2128,7 +2023,7 @@ void HtmlGenerator::generateNavigationBar(const NavigationBar& bar, { if (bar.prev.begin() != 0 || bar.current.begin() != 0 || bar.next.begin() != 0) { - out() << "<p align=\"right\">"; + out() << "<p class=\"rightAlign\">"; if (bar.prev.begin() != 0) { #if 0 out() << "[<a href=\"" << section.previousBaseName() @@ -2304,7 +2199,7 @@ void HtmlGenerator::generateAnnotatedList(const Node *relative, CodeMarker *marker, const NodeMap &nodeMap) { - out() << "<p><table class=\"annotated\">\n"; + out() << "<table class=\"annotated\">\n"; int row = 0; foreach (const QString &name, nodeMap.keys()) { @@ -2314,9 +2209,9 @@ void HtmlGenerator::generateAnnotatedList(const Node *relative, continue; if (++row % 2 == 1) - out() << "<tr valign=\"top\" class=\"odd\">"; + out() << "<tr class=\"odd topAlign\">"; else - out() << "<tr valign=\"top\" class=\"even\">"; + out() << "<tr class=\"even topAlign\">"; out() << "<th>"; generateFullName(node, relative, marker); out() << "</th>"; @@ -2336,7 +2231,7 @@ void HtmlGenerator::generateAnnotatedList(const Node *relative, } out() << "</tr>\n"; } - out() << "</table></p>\n"; + out() << "</table>\n"; } /*! @@ -2489,7 +2384,7 @@ void HtmlGenerator::generateCompactList(const Node *relative, } firstOffset[NumColumns] = classMap.count(); - out() << "<p><table class=\"generic\">\n"; + out() << "<table class=\"generic\">\n"; for (k = 0; k < numRows; k++) { out() << "<tr>\n"; for (i = 0; i < NumColumns; i++) { @@ -2510,7 +2405,7 @@ void HtmlGenerator::generateCompactList(const Node *relative, currentParagraphNo[i] = NumParagraphs - 1; } #endif - out() << "<td align=\"right\">"; + out() << "<td class=\"rightAlign\">"; if (currentOffsetInParagraph[i] == 0) { // start a new paragraph out() << "<b>" @@ -2553,18 +2448,18 @@ void HtmlGenerator::generateCompactList(const Node *relative, } out() << "</tr>\n"; } - out() << "</table></p>\n"; + out() << "</table>\n"; } void HtmlGenerator::generateFunctionIndex(const Node *relative, CodeMarker *marker) { - out() << "<p align=\"center\"><font size=\"+1\"><b>"; + out() << "<p class=\"centerAlign functionIndex\"><b>"; for (int i = 0; i < 26; i++) { QChar ch('a' + i); out() << QString("<a href=\"#%1\">%2</a> ").arg(ch).arg(ch.toUpper()); } - out() << "</b></font></p>\n"; + out() << "</b></p>\n"; char nextLetter = 'a'; char currentLetter; @@ -2832,8 +2727,8 @@ void HtmlGenerator::generateSection(const NodeList& nl, } else { if (twoColumn) - out() << "<p><table class=\"propsummary\">\n" - << "<tr><td valign=\"top\">"; + out() << "<table class=\"propsummary\">\n" + << "<tr><td class=\"topAlign\">"; out() << "<ul>\n"; } @@ -2846,12 +2741,11 @@ void HtmlGenerator::generateSection(const NodeList& nl, } if (name_alignment) { - out() << "<tr><td class=\"memItemLeft\" " - << "align=\"right\" valign=\"top\">"; + out() << "<tr><td class=\"memItemLeft rightAlign topAlign\"> "; } else { if (twoColumn && i == (int) (nl.count() + 1) / 2) - out() << "</ul></td><td valign=\"top\"><ul>\n"; + out() << "</ul></td><td class=\"topAlign\"><ul>\n"; out() << "<li><div class=\"fn\">"; } @@ -2868,7 +2762,7 @@ void HtmlGenerator::generateSection(const NodeList& nl, else { out() << "</ul>\n"; if (twoColumn) - out() << "</td></tr>\n</table></p>\n"; + out() << "</td></tr>\n</table>\n"; } } } @@ -2894,8 +2788,8 @@ void HtmlGenerator::generateSectionList(const Section& section, } else { if (twoColumn) - out() << "<p><table class=\"propsummary\">\n" - << "<tr><td valign=\"top\">"; + out() << "<table class=\"propsummary\">\n" + << "<tr><td class=\"topAlign\">"; out() << "<ul>\n"; } @@ -2908,12 +2802,11 @@ void HtmlGenerator::generateSectionList(const Section& section, } if (name_alignment) { - out() << "<tr><td class=\"memItemLeft\" " - << "align=\"right\" valign=\"top\">"; + out() << "<tr><td class=\"memItemLeft topAlign rightAlign\"> "; } else { if (twoColumn && i == (int) (section.members.count() + 1) / 2) - out() << "</ul></td><td valign=\"top\"><ul>\n"; + out() << "</ul></td><td class=\"topAlign\"><ul>\n"; out() << "<li><div class=\"fn\">"; } @@ -2930,7 +2823,7 @@ void HtmlGenerator::generateSectionList(const Section& section, else { out() << "</ul>\n"; if (twoColumn) - out() << "</td></tr>\n</table></p>\n"; + out() << "</td></tr>\n</table>\n"; } } @@ -3027,7 +2920,7 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode, for (int i = 0, n = src.size(); i < n;) { if (src.at(i) == charLangle && src.at(i + 1).unicode() == '@') { if (nameAlignment && !done) {// && (i != 0)) Why was this here? - html += "</td><td class=\"memItemRight\" valign=\"bottom\">"; + html += "</td><td class=\"memItemRight bottomAlign\">"; done = true; } i += 2; @@ -3192,8 +3085,8 @@ void HtmlGenerator::generateSectionList(const Section& section, twoColumn = (section.members.count() >= 5); } if (twoColumn) - out() << "<p><table class=\"generic\">\n" - << "<tr><td valign=\"top\">"; + out() << "<table class=\"generic\">\n" + << "<tr><td class=\"topAlign\">"; out() << "<ul>\n"; int i = 0; @@ -3205,7 +3098,7 @@ void HtmlGenerator::generateSectionList(const Section& section, } if (twoColumn && i == (int) (section.members.count() + 1) / 2) - out() << "</ul></td><td valign=\"top\"><ul>\n"; + out() << "</ul></td><td class=\"topAlign\"><ul>\n"; out() << "<li><div class=\"fn\"></div>"; if (style == CodeMarker::Accessors) @@ -3219,7 +3112,7 @@ void HtmlGenerator::generateSectionList(const Section& section, } out() << "</ul>\n"; if (twoColumn) - out() << "</td></tr>\n</table></p>\n"; + out() << "</td></tr>\n</table>\n"; } if (style == CodeMarker::Summary && !section.inherited.isEmpty()) { @@ -4371,8 +4264,6 @@ void HtmlGenerator::endLink() inObsoleteLink = false; } -QT_END_NAMESPACE - #ifdef QDOC_QML /*! @@ -4393,15 +4284,15 @@ void HtmlGenerator::generateQmlSummary(const Section& section, twoColumn = (count >= 5); } if (twoColumn) - out() << "<p><table class=\"qmlsummary\">\n" - << "<tr><td valign=\"top\">"; + out() << "<table class=\"qmlsummary\">\n" + << "<tr><td class=\"topAlign\">"; out() << "<ul>\n"; int row = 0; m = section.members.begin(); while (m != section.members.end()) { if (twoColumn && row == (int) (count + 1) / 2) - out() << "</ul></td><td valign=\"top\"><ul>\n"; + out() << "</ul></td><td class=\"topAlign\"><ul>\n"; out() << "<li><div class=\"fn\"></div>"; generateQmlItem(*m,relative,marker,true); out() << "</li>\n"; @@ -4410,7 +4301,7 @@ void HtmlGenerator::generateQmlSummary(const Section& section, } out() << "</ul>\n"; if (twoColumn) - out() << "</td></tr>\n</table></p>\n"; + out() << "</td></tr>\n</table>\n"; } } @@ -4437,7 +4328,9 @@ void HtmlGenerator::generateDetailedQmlMember(const Node *node, out() << "<tr><td>"; out() << "<a name=\"" + refForNode(qpn) + "\"></a>"; if (!qpn->isWritable()) - out() << "<span class=\"qmlreadonly\">read-only</span>"; + out() << "<span class=\"qmlreadonly\">read-only </span>"; + if (qpgn->isDefault()) + out() << "<span class=\"qmldefault\">default </span>"; generateQmlItem(qpn, relative, marker, false); out() << "</td></tr>"; if (qpgn->isDefault()) { @@ -4502,7 +4395,7 @@ void HtmlGenerator::generateQmlInherits(const QmlClassNode* cn, const Node* n = myTree->findNode(strList,Node::Fake); if (n && n->subType() == Node::QmlClass) { const QmlClassNode* qcn = static_cast<const QmlClassNode*>(n); - out() << "<p style=\"text-align: center\">"; + out() << "<p class=\"centerAlign\">"; Text text; text << "[Inherits "; text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn)); @@ -4549,7 +4442,7 @@ void HtmlGenerator::generateQmlInstantiates(const QmlClassNode* qcn, { const ClassNode* cn = qcn->classNode(); if (cn && (cn->status() != Node::Internal)) { - out() << "<p style=\"text-align: center\">"; + out() << "<p class=\"centerAlign\">"; Text text; text << "["; text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn)); @@ -4580,7 +4473,7 @@ void HtmlGenerator::generateInstantiatedBy(const ClassNode* cn, if (cn && cn->status() != Node::Internal && !cn->qmlElement().isEmpty()) { const Node* n = myTree->root()->findNode(cn->qmlElement(),Node::Fake); if (n && n->subType() == Node::QmlClass) { - out() << "<p style=\"text-align: center\">"; + out() << "<p class=\"centerAlign\">"; Text text; text << "["; text << Atom(Atom::LinkNode,CodeMarker::stringForNode(cn)); @@ -4724,3 +4617,139 @@ void HtmlGenerator::generatePageIndex(const QString& fileName, CodeMarker* marke } #endif + +#if 0 // fossil removed for new doc format MWS 19/04/2010 + out() << "<!DOCTYPE html\n" + " PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"DTD/xhtml1-strict.dtd\">\n"; + out() << QString("<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"%1\" lang=\"%1\">\n").arg(naturalLanguage); + + QString shortVersion; + if ((project != "Qtopia") && (project != "Qt Extended")) { + shortVersion = project + " " + shortVersion + ": "; + if (node && !node->doc().location().isEmpty()) + out() << "<!-- " << node->doc().location().fileName() << " -->\n"; + + shortVersion = myTree->version(); + if (shortVersion.count(QChar('.')) == 2) + shortVersion.truncate(shortVersion.lastIndexOf(QChar('.'))); + if (!shortVersion.isEmpty()) { + if (project == "QSA") + shortVersion = "QSA " + shortVersion + ": "; + else + shortVersion = "Qt " + shortVersion + ": "; + } + } + + out() << "<head>\n" + " <title>" << shortVersion << protectEnc(title) << "</title>\n"; + out() << QString("<meta http-equiv=\"Content-type\" content=\"text/html; charset=%1\" />").arg(outputEncoding); + + if (!style.isEmpty()) + out() << " <style type=\"text/css\">" << style << "</style>\n"; + + const QMap<QString, QString> &metaMap = node->doc().metaTagMap(); + if (!metaMap.isEmpty()) { + QMapIterator<QString, QString> i(metaMap); + while (i.hasNext()) { + i.next(); + out() << " <meta name=\"" << protectEnc(i.key()) << "\" contents=\"" + << protectEnc(i.value()) << "\" />\n"; + } + } + + navigationLinks.clear(); + + if (node && !node->links().empty()) { + QPair<QString,QString> linkPair; + QPair<QString,QString> anchorPair; + const Node *linkNode; + + if (node->links().contains(Node::PreviousLink)) { + linkPair = node->links()[Node::PreviousLink]; + linkNode = findNodeForTarget(linkPair.first, node, marker); + if (!linkNode || linkNode == node) + anchorPair = linkPair; + else + anchorPair = anchorForNode(linkNode); + + out() << " <link rel=\"prev\" href=\"" + << anchorPair.first << "\" />\n"; + + navigationLinks += "[Previous: <a href=\"" + anchorPair.first + "\">"; + if (linkPair.first == linkPair.second && !anchorPair.second.isEmpty()) + navigationLinks += protectEnc(anchorPair.second); + else + navigationLinks += protectEnc(linkPair.second); + navigationLinks += "</a>]\n"; + } + if (node->links().contains(Node::ContentsLink)) { + linkPair = node->links()[Node::ContentsLink]; + linkNode = findNodeForTarget(linkPair.first, node, marker); + if (!linkNode || linkNode == node) + anchorPair = linkPair; + else + anchorPair = anchorForNode(linkNode); + + out() << " <link rel=\"contents\" href=\"" + << anchorPair.first << "\" />\n"; + + navigationLinks += "[<a href=\"" + anchorPair.first + "\">"; + if (linkPair.first == linkPair.second && !anchorPair.second.isEmpty()) + navigationLinks += protectEnc(anchorPair.second); + else + navigationLinks += protectEnc(linkPair.second); + navigationLinks += "</a>]\n"; + } + if (node->links().contains(Node::NextLink)) { + linkPair = node->links()[Node::NextLink]; + linkNode = findNodeForTarget(linkPair.first, node, marker); + if (!linkNode || linkNode == node) + anchorPair = linkPair; + else + anchorPair = anchorForNode(linkNode); + + out() << " <link rel=\"next\" href=\"" + << anchorPair.first << "\" />\n"; + + navigationLinks += "[Next: <a href=\"" + anchorPair.first + "\">"; + if (linkPair.first == linkPair.second && !anchorPair.second.isEmpty()) + navigationLinks += protectEnc(anchorPair.second); + else + navigationLinks += protectEnc(linkPair.second); + navigationLinks += "</a>]\n"; + } + if (node->links().contains(Node::IndexLink)) { + linkPair = node->links()[Node::IndexLink]; + linkNode = findNodeForTarget(linkPair.first, node, marker); + if (!linkNode || linkNode == node) + anchorPair = linkPair; + else + anchorPair = anchorForNode(linkNode); + out() << " <link rel=\"index\" href=\"" + << anchorPair.first << "\" />\n"; + } + if (node->links().contains(Node::StartLink)) { + linkPair = node->links()[Node::StartLink]; + linkNode = findNodeForTarget(linkPair.first, node, marker); + if (!linkNode || linkNode == node) + anchorPair = linkPair; + else + anchorPair = anchorForNode(linkNode); + out() << " <link rel=\"start\" href=\"" + << anchorPair.first << "\" />\n"; + } + } + + foreach (const QString &stylesheet, stylesheets) { + out() << " <link href=\"" << stylesheet << "\" rel=\"stylesheet\" " + << "type=\"text/css\" />\n"; + } + + foreach (const QString &customHeadElement, customHeadElements) { + out() << " " << customHeadElement << "\n"; + } + + out() << "</head>\n" + #endif + + QT_END_NAMESPACE diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index 559c968..2a365e9 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -297,6 +297,7 @@ class HtmlGenerator : public PageGenerator bool inTableHeader; int numTableRows; bool threeColumnEnumValueTable; + bool offlineDocs; QString link; QStringList sectionNumber; QRegExp funcLeftParen; diff --git a/tools/qdoc3/test/assistant.qdocconf b/tools/qdoc3/test/assistant.qdocconf index 5308afd..1deefce 100644 --- a/tools/qdoc3/test/assistant.qdocconf +++ b/tools/qdoc3/test/assistant.qdocconf @@ -16,7 +16,45 @@ qhp.Assistant.file = assistant.qhp qhp.Assistant.namespace = com.trolltech.assistant.470 qhp.Assistant.virtualFolder = qdoc qhp.Assistant.indexTitle = Qt Assistant Manual -qhp.Assistant.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png +qhp.Assistant.extraFiles = images/api_examples.png \ + images/api_lookup.png \ + images/api_topics.png \ + images/bg_l_blank.png \ + images/bg_ll_blank.png \ + images/bg_ll.png \ + images/bg_l.png \ + images/bg_lr.png \ + images/bg_r.png \ + images/bg_ul_blank.png \ + images/bg_ul.png \ + images/bg_ur_blank.png \ + images/bg_ur.png \ + images/box_bg.png \ + images/breadcrumb.png \ + images/bullet_dn.png \ + images/bullet_gt.png \ + images/bullet_sq.png \ + images/bullet_up.png \ + images/coloreditorfactoryimage.png \ + images/content_bg.png \ + images/dynamiclayouts-example.png \ + images/feedbackground.png \ + images/form_bg.png \ + images/horBar.png \ + images/page_bg.png \ + images/print.png \ + images/qt_guide.png \ + images/qt_icon.png \ + images/qt-logo.png \ + images/qt_ref_doc.png \ + images/qt_tools.png \ + images/sep.png \ + images/sprites-combined.png \ + images/stylesheet-coffee-plastique.png \ + images/taskmenuextension-example.png \ + scripts/functions.js \ + scripts/jquery.js \ + style/style.css qhp.Assistant.filterAttributes = qt 4.7.0 tools assistant qhp.Assistant.customFilters.Assistant.name = Qt Assistant Manual qhp.Assistant.customFilters.Assistant.filterAttributes = qt tools assistant diff --git a/tools/qdoc3/test/designer.qdocconf b/tools/qdoc3/test/designer.qdocconf index 2eb3d96..513801a 100644 --- a/tools/qdoc3/test/designer.qdocconf +++ b/tools/qdoc3/test/designer.qdocconf @@ -16,7 +16,45 @@ qhp.Designer.file = designer.qhp qhp.Designer.namespace = com.trolltech.designer.470 qhp.Designer.virtualFolder = qdoc qhp.Designer.indexTitle = Qt Designer Manual -qhp.Designer.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png +qhp.Designer.extraFiles = images/api_examples.png \ + images/api_lookup.png \ + images/api_topics.png \ + images/bg_l_blank.png \ + images/bg_ll_blank.png \ + images/bg_ll.png \ + images/bg_l.png \ + images/bg_lr.png \ + images/bg_r.png \ + images/bg_ul_blank.png \ + images/bg_ul.png \ + images/bg_ur_blank.png \ + images/bg_ur.png \ + images/box_bg.png \ + images/breadcrumb.png \ + images/bullet_dn.png \ + images/bullet_gt.png \ + images/bullet_sq.png \ + images/bullet_up.png \ + images/coloreditorfactoryimage.png \ + images/content_bg.png \ + images/dynamiclayouts-example.png \ + images/feedbackground.png \ + images/form_bg.png \ + images/horBar.png \ + images/page_bg.png \ + images/print.png \ + images/qt_guide.png \ + images/qt_icon.png \ + images/qt-logo.png \ + images/qt_ref_doc.png \ + images/qt_tools.png \ + images/sep.png \ + images/sprites-combined.png \ + images/stylesheet-coffee-plastique.png \ + images/taskmenuextension-example.png \ + scripts/functions.js \ + scripts/jquery.js \ + style/style.css qhp.Designer.filterAttributes = qt 4.7.0 tools designer qhp.Designer.customFilters.Designer.name = Qt Designer Manual qhp.Designer.customFilters.Designer.filterAttributes = qt tools designer diff --git a/tools/qdoc3/test/linguist.qdocconf b/tools/qdoc3/test/linguist.qdocconf index ac536be..a3f4f00 100644 --- a/tools/qdoc3/test/linguist.qdocconf +++ b/tools/qdoc3/test/linguist.qdocconf @@ -16,7 +16,45 @@ qhp.Linguist.file = linguist.qhp qhp.Linguist.namespace = com.trolltech.linguist.470 qhp.Linguist.virtualFolder = qdoc qhp.Linguist.indexTitle = Qt Linguist Manual -qhp.Linguist.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png +qhp.Linguist.extraFiles = images/api_examples.png \ + images/api_lookup.png \ + images/api_topics.png \ + images/bg_l_blank.png \ + images/bg_ll_blank.png \ + images/bg_ll.png \ + images/bg_l.png \ + images/bg_lr.png \ + images/bg_r.png \ + images/bg_ul_blank.png \ + images/bg_ul.png \ + images/bg_ur_blank.png \ + images/bg_ur.png \ + images/box_bg.png \ + images/breadcrumb.png \ + images/bullet_dn.png \ + images/bullet_gt.png \ + images/bullet_sq.png \ + images/bullet_up.png \ + images/coloreditorfactoryimage.png \ + images/content_bg.png \ + images/dynamiclayouts-example.png \ + images/feedbackground.png \ + images/form_bg.png \ + images/horBar.png \ + images/page_bg.png \ + images/print.png \ + images/qt_guide.png \ + images/qt_icon.png \ + images/qt-logo.png \ + images/qt_ref_doc.png \ + images/qt_tools.png \ + images/sep.png \ + images/sprites-combined.png \ + images/stylesheet-coffee-plastique.png \ + images/taskmenuextension-example.png \ + scripts/functions.js \ + scripts/jquery.js \ + style/style.css qhp.Linguist.filterAttributes = qt 4.7.0 tools linguist qhp.Linguist.customFilters.Linguist.name = Qt Linguist Manual qhp.Linguist.customFilters.Linguist.filterAttributes = qt tools linguist diff --git a/tools/qdoc3/test/qdeclarative.qdocconf b/tools/qdoc3/test/qdeclarative.qdocconf index 03514c1..80050e3 100644 --- a/tools/qdoc3/test/qdeclarative.qdocconf +++ b/tools/qdoc3/test/qdeclarative.qdocconf @@ -27,8 +27,45 @@ qhp.Qml.indexTitle = Qml Reference # Files not referenced in any qdoc file # See also extraimages.HTML -qhp.Qml.extraFiles = classic.css \ - images/qt-logo.png +qhp.Qml.extraFiles = images/api_examples.png \ + images/api_lookup.png \ + images/api_topics.png \ + images/bg_l_blank.png \ + images/bg_ll_blank.png \ + images/bg_ll.png \ + images/bg_l.png \ + images/bg_lr.png \ + images/bg_r.png \ + images/bg_ul_blank.png \ + images/bg_ul.png \ + images/bg_ur_blank.png \ + images/bg_ur.png \ + images/box_bg.png \ + images/breadcrumb.png \ + images/bullet_dn.png \ + images/bullet_gt.png \ + images/bullet_sq.png \ + images/bullet_up.png \ + images/coloreditorfactoryimage.png \ + images/content_bg.png \ + images/dynamiclayouts-example.png \ + images/feedbackground.png \ + images/form_bg.png \ + images/horBar.png \ + images/page_bg.png \ + images/print.png \ + images/qt_guide.png \ + images/qt_icon.png \ + images/qt-logo.png \ + images/qt_ref_doc.png \ + images/qt_tools.png \ + images/sep.png \ + images/sprites-combined.png \ + images/stylesheet-coffee-plastique.png \ + images/taskmenuextension-example.png \ + scripts/functions.js \ + scripts/jquery.js \ + style/style.css qhp.Qml.filterAttributes = qt 4.6.0 qtrefdoc qhp.Qml.customFilters.Qt.name = Qt 4.6.0 @@ -63,19 +100,3 @@ imagedirs = $QT_SOURCE_TREE/doc/src/images \ outputdir = $QT_BUILD_TREE/doc-build/html-qml tagfile = $QT_BUILD_TREE/doc-build/html-qml/qt.tags base = file:$QT_BUILD_TREE/doc/html-qml - -HTML.stylesheets = classic.css - -HTML.postheader = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n" \ - "<tr>\n" \ - "<td align=\"left\" valign=\"top\">" \ - "<img src=\"images/qt-logo.png\" align=\"left\" border=\"0\"/>" \ - "</td>\n" \ - "<td width=\"1\"> </td>" \ - "<td class=\"postheader\" valign=\"center\" align=\"left\">" \ - "<a href=\"qmlreference.html\">" \ - "<font color=\"#004faf\">Home</font></a> ·" \ - " <a href=\"qmlelements.html\">" \ - "<font color=\"#004faf\">Elements</font></a>" \ - "</td>\n" \ - "</tr></table>" diff --git a/tools/qdoc3/test/qmake.qdocconf b/tools/qdoc3/test/qmake.qdocconf index bd47028..f38a2a4 100644 --- a/tools/qdoc3/test/qmake.qdocconf +++ b/tools/qdoc3/test/qmake.qdocconf @@ -16,7 +16,45 @@ qhp.qmake.file = qmake.qhp qhp.qmake.namespace = com.trolltech.qmake.470 qhp.qmake.virtualFolder = qdoc qhp.qmake.indexTitle = QMake Manual -qhp.qmake.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png +qhp.qmake.extraFiles = images/api_examples.png \ + images/api_lookup.png \ + images/api_topics.png \ + images/bg_l_blank.png \ + images/bg_ll_blank.png \ + images/bg_ll.png \ + images/bg_l.png \ + images/bg_lr.png \ + images/bg_r.png \ + images/bg_ul_blank.png \ + images/bg_ul.png \ + images/bg_ur_blank.png \ + images/bg_ur.png \ + images/box_bg.png \ + images/breadcrumb.png \ + images/bullet_dn.png \ + images/bullet_gt.png \ + images/bullet_sq.png \ + images/bullet_up.png \ + images/coloreditorfactoryimage.png \ + images/content_bg.png \ + images/dynamiclayouts-example.png \ + images/feedbackground.png \ + images/form_bg.png \ + images/horBar.png \ + images/page_bg.png \ + images/print.png \ + images/qt_guide.png \ + images/qt_icon.png \ + images/qt-logo.png \ + images/qt_ref_doc.png \ + images/qt_tools.png \ + images/sep.png \ + images/sprites-combined.png \ + images/stylesheet-coffee-plastique.png \ + images/taskmenuextension-example.png \ + scripts/functions.js \ + scripts/jquery.js \ + style/style.css qhp.qmake.filterAttributes = qt 4.7.0 tools qmake qhp.qmake.customFilters.qmake.name = qmake Manual qhp.qmake.customFilters.qmake.filterAttributes = qt tools qmake diff --git a/tools/qdoc3/test/qt-build-docs.qdocconf b/tools/qdoc3/test/qt-build-docs.qdocconf index dbff4e2..0694748 100644 --- a/tools/qdoc3/test/qt-build-docs.qdocconf +++ b/tools/qdoc3/test/qt-build-docs.qdocconf @@ -22,14 +22,12 @@ qhp.Qt.indexTitle = Qt Reference Documentation # Files not referenced in any qdoc file (last four are needed by qtdemo) # See also extraimages.HTML qhp.Qt.extraFiles = index.html \ - style/style.css \ - scripts/functions.js \ - scripts/jquery.js \ images/api_examples.png \ images/api_lookup.png \ images/api_topics.png \ - images/bg_ll.png \ images/bg_l_blank.png \ + images/bg_ll_blank.png \ + images/bg_ll.png \ images/bg_l.png \ images/bg_lr.png \ images/bg_r.png \ @@ -37,24 +35,33 @@ qhp.Qt.extraFiles = index.html \ images/bg_ul.png \ images/bg_ur_blank.png \ images/bg_ur.png \ + images/box_bg.png \ images/breadcrumb.png \ images/bullet_dn.png \ images/bullet_gt.png \ + images/bullet_sq.png \ + images/bullet_up.png \ + images/coloreditorfactoryimage.png \ + images/content_bg.png \ + images/dynamiclayouts-example.png \ images/feedbackground.png \ images/form_bg.png \ images/horBar.png \ images/page_bg.png \ images/print.png \ images/qt_guide.png \ + images/qt_icon.png \ images/qt-logo.png \ images/qt_ref_doc.png \ images/qt_tools.png \ images/sep.png \ images/sprites-combined.png \ + images/stylesheet-coffee-plastique.png \ images/taskmenuextension-example.png \ - images/coloreditorfactoryimage.png \ - images/dynamiclayouts-example.png \ - images/stylesheet-coffee-plastique.png + scripts/functions.js \ + scripts/jquery.js \ + style/style.css + qhp.Qt.filterAttributes = qt 4.7.0 qtrefdoc diff --git a/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf b/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf index 461c069..5a3d726 100644 --- a/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf +++ b/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf @@ -30,14 +30,12 @@ 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 = index.html \ - style/style.css \ - scripts/functions.js \ - scripts/jquery.js \ images/api_examples.png \ images/api_lookup.png \ images/api_topics.png \ - images/bg_ll.png \ images/bg_l_blank.png \ + images/bg_ll_blank.png \ + images/bg_ll.png \ images/bg_l.png \ images/bg_lr.png \ images/bg_r.png \ @@ -45,24 +43,32 @@ qhp.Qt.extraFiles = index.html \ images/bg_ul.png \ images/bg_ur_blank.png \ images/bg_ur.png \ + images/box_bg.png \ images/breadcrumb.png \ images/bullet_dn.png \ images/bullet_gt.png \ + images/bullet_sq.png \ + images/bullet_up.png \ + images/coloreditorfactoryimage.png \ + images/content_bg.png \ + images/dynamiclayouts-example.png \ images/feedbackground.png \ images/form_bg.png \ images/horBar.png \ images/page_bg.png \ images/print.png \ images/qt_guide.png \ + images/qt_icon.png \ images/qt-logo.png \ images/qt_ref_doc.png \ images/qt_tools.png \ images/sep.png \ images/sprites-combined.png \ + images/stylesheet-coffee-plastique.png \ images/taskmenuextension-example.png \ - images/coloreditorfactoryimage.png \ - images/dynamiclayouts-example.png \ - images/stylesheet-coffee-plastique.png + scripts/functions.js \ + scripts/jquery.js \ + style/style.css language = Cpp diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index 67a25f3..8253c45 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -2,7 +2,7 @@ HTML.stylesheets = style/style.css HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \ " <div id=\"nav-logo\">\n" \ " <a href=\"index.html\">Home</a></div>\n" \ - " <a href=\"#\" class=\"qtref\"><span>Qt Reference Documentation</span></a>\n" \ + " <a href=\"index.html\" class=\"qtref\"><span>Qt Reference Documentation</span></a>\n" \ " <div id=\"nav-topright\">\n" \ " <ul>\n" \ " <li class=\"nav-topright-home\"><a href=\"http://qt.nokia.com/\">Qt HOME</a></li>\n" \ @@ -16,8 +16,8 @@ HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \ " </div>\n" \ " <div id=\"shortCut\">\n" \ " <ul>\n" \ - " <li class=\"shortCut-topleft-inactive\"><span><a href=\"index.html\">VERSION 4.7</a></span></li>\n" \ - " <li class=\"shortCut-topleft-active\"><a href=\"http://qt.nokia.com/doc/\">ALL QT VERSIONS" \ + " <li class=\"shortCut-topleft-inactive\"><span><a href=\"index.html\">Qt 4.7</a></span></li>\n" \ + " <li class=\"shortCut-topleft-active\"><a href=\"http://qt.nokia.com/doc/\">ALL Qt VERSIONS" \ " </a></li>\n" \ " </ul>\n" \ " </div>\n" \ @@ -73,9 +73,9 @@ HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \ " <ul>\n" \ " <li><a href=\"examples.html\">All examples</a></li>\n" \ " <li><a href=\"tutorials.html\">All tutorials</a></li>\n" \ - " <li><a href=\"#\">Qt Quick examples</a></li>\n" \ - " <li><a href=\"#\">Desktop examples</a></li>\n" \ - " <li><a href=\"#\">Device examples</a></li>\n" \ + " <li><a href=\"examples.html\">Qt Quick examples</a></li>\n" \ + " <li><a href=\"examples.html\">Desktop examples</a></li>\n" \ + " <li><a href=\"examples.html\">Device examples</a></li>\n" \ " </ul>\n" \ " </div>\n" \ " <div class=\"live\">\n" \ @@ -96,7 +96,7 @@ HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \ " <li id=\"medA\" class=\"t_button active\">A</li>\n" \ " <li id=\"bigA\" class=\"t_button\">A</li>\n" \ " <li id=\"print\" class=\"t_button\"><a href=\"javascript:this.print();\">\n" \ - " <img src=\"images/sep.png\" /><img id=\"printIcon\" src=\"images/print.png\" alt=\"Print this page\" /></a></li>\n" \ + " <img src=\"images/sep.png\" alt=\"\" /><img id=\"printIcon\" src=\"images/print.png\" alt=\"Print this page\" /></a></li>\n" \ " </ul>\n" \ " </div>\n" \ " </div>\n" \ @@ -110,21 +110,20 @@ HTML.footer = " </div>\n" \ " <div class=\"ft\">\n" \ " <span></span>\n" \ " </div>\n" \ - " </div>\n" \ " <div class=\"footer\">\n" \ " <p>\n" \ " <acronym title=\"Copyright\">©</acronym> 2008-2010 Nokia Corporation and/or its\n" \ - " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation>\n" \ + " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ " in Finland and/or other countries worldwide.</p>\n" \ " <p>\n" \ " All other trademarks are property of their respective owners. <a title=\"Privacy Policy\"\n" \ " href=\"http://qt.nokia.com/about/privacy-policy\">Privacy Policy</a></p>\n" \ " </div>\n" \ " <div id=\"feedbackBox\">\n" \ - " <form action=\"#\">\n" \ " <div id=\"feedcloseX\">\n" \ " <a href=\"#\" onclick=\"\$(\'#feedbackBox\').hide();\$(\'#blurpage\').hide()\">X</a>\n" \ " </div>\n" \ + " <form action=\"#\">\n" \ " <textarea id=\"feedbox\" rows=\"5\" cols=\"40\">Please submit you feedback...</textarea>\n" \ " <input id=\"feedsubmit\" type=\"submit\" onclick=\"\$(\'#feedbackBox\').hide();\$(\'#blurpage\').hide()\"\n" \ " name=\"feedback\" />\n" \ @@ -132,7 +131,6 @@ HTML.footer = " </div>\n" \ " </div>\n" \ " <div id=\"blurpage\">\n" \ " </div>\n" \ - " <script src=\"scripts/functions.js\" type=\"text/javascript\"></script>\n" \ "<script type=\"text/javascript\">\n" \ " var _gaq = _gaq || [];\n" \ " _gaq.push([\'_setAccount\', \'UA-4457116-5\']);\n" \ diff --git a/tools/qdoc3/test/qt.qdocconf b/tools/qdoc3/test/qt.qdocconf index cc3e436..69ab4e1 100644 --- a/tools/qdoc3/test/qt.qdocconf +++ b/tools/qdoc3/test/qt.qdocconf @@ -9,6 +9,7 @@ versionsym = version = %VERSION% description = Qt Reference Documentation url = http://qt.nokia.com/doc/4.7 +online = true sourceencoding = UTF-8 outputencoding = UTF-8 @@ -25,14 +26,12 @@ qhp.Qt.indexRoot = # Files not referenced in any qdoc file (last four are needed by qtdemo) # See also extraimages.HTML qhp.Qt.extraFiles = index.html \ - style/style.css \ - scripts/functions.js \ - scripts/jquery.js \ images/api_examples.png \ images/api_lookup.png \ images/api_topics.png \ - images/bg_ll.png \ images/bg_l_blank.png \ + images/bg_ll_blank.png \ + images/bg_ll.png \ images/bg_l.png \ images/bg_lr.png \ images/bg_r.png \ @@ -40,24 +39,32 @@ qhp.Qt.extraFiles = index.html \ images/bg_ul.png \ images/bg_ur_blank.png \ images/bg_ur.png \ + images/box_bg.png \ images/breadcrumb.png \ images/bullet_dn.png \ images/bullet_gt.png \ + images/bullet_sq.png \ + images/bullet_up.png \ + images/coloreditorfactoryimage.png \ + images/content_bg.png \ + images/dynamiclayouts-example.png \ images/feedbackground.png \ images/form_bg.png \ images/horBar.png \ images/page_bg.png \ images/print.png \ images/qt_guide.png \ + images/qt_icon.png \ images/qt-logo.png \ images/qt_ref_doc.png \ images/qt_tools.png \ images/sep.png \ images/sprites-combined.png \ + images/stylesheet-coffee-plastique.png \ images/taskmenuextension-example.png \ - images/coloreditorfactoryimage.png \ - images/dynamiclayouts-example.png \ - images/stylesheet-coffee-plastique.png + scripts/functions.js \ + scripts/jquery.js \ + style/style.css qhp.Qt.filterAttributes = qt 4.7.0 qtrefdoc qhp.Qt.customFilters.Qt.name = Qt 4.7.0 diff --git a/tools/qdoc3/test/qt_zh_CN.qdocconf b/tools/qdoc3/test/qt_zh_CN.qdocconf index c5d2c88..a5a65d8 100644 --- a/tools/qdoc3/test/qt_zh_CN.qdocconf +++ b/tools/qdoc3/test/qt_zh_CN.qdocconf @@ -32,14 +32,12 @@ 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 = index.html \ - style/style.css \ - scripts/functions.js \ - scripts/jquery.js \ images/api_examples.png \ images/api_lookup.png \ images/api_topics.png \ - images/bg_ll.png \ images/bg_l_blank.png \ + images/bg_ll_blank.png \ + images/bg_ll.png \ images/bg_l.png \ images/bg_lr.png \ images/bg_r.png \ @@ -47,24 +45,32 @@ qhp.Qt.extraFiles = index.html \ images/bg_ul.png \ images/bg_ur_blank.png \ images/bg_ur.png \ + images/box_bg.png \ images/breadcrumb.png \ images/bullet_dn.png \ images/bullet_gt.png \ + images/bullet_sq.png \ + images/bullet_up.png \ + images/coloreditorfactoryimage.png \ + images/content_bg.png \ + images/dynamiclayouts-example.png \ images/feedbackground.png \ images/form_bg.png \ images/horBar.png \ images/page_bg.png \ images/print.png \ images/qt_guide.png \ + images/qt_icon.png \ images/qt-logo.png \ images/qt_ref_doc.png \ images/qt_tools.png \ images/sep.png \ images/sprites-combined.png \ + images/stylesheet-coffee-plastique.png \ images/taskmenuextension-example.png \ - images/coloreditorfactoryimage.png \ - images/dynamiclayouts-example.png \ - images/stylesheet-coffee-plastique.png + scripts/functions.js \ + scripts/jquery.js \ + style/style.css language = Cpp diff --git a/tools/qml/content/Browser.qml b/tools/qml/content/Browser.qml index 8882d5a..0912f58 100644 --- a/tools/qml/content/Browser.qml +++ b/tools/qml/content/Browser.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { id: root diff --git a/tools/qml/loggerwidget.cpp b/tools/qml/loggerwidget.cpp new file mode 100644 index 0000000..015d1b0 --- /dev/null +++ b/tools/qml/loggerwidget.cpp @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "loggerwidget.h" +#include <qglobal.h> +#include <QDebug> + +QT_BEGIN_NAMESPACE + +LoggerWidget::LoggerWidget(QWidget *parent) : + QPlainTextEdit(parent), + m_keepClosed(false) +{ + setAttribute(Qt::WA_QuitOnClose, false); + setWindowTitle(tr("Qt Declarative UI Viewer - Logger")); +} + +void LoggerWidget::append(const QString &msg) +{ + appendPlainText(msg); + + if (!m_keepClosed && !isVisible()) + setVisible(true); +} + +void LoggerWidget::closeEvent(QCloseEvent *event) +{ + m_keepClosed = true; + QWidget::closeEvent(event); +} + +QT_END_NAMESPACE diff --git a/tools/qml/loggerwidget.h b/tools/qml/loggerwidget.h new file mode 100644 index 0000000..5c4a701 --- /dev/null +++ b/tools/qml/loggerwidget.h @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef LOGGERWIDGET_H +#define LOGGERWIDGET_H + +#include <QPlainTextEdit> + +QT_BEGIN_NAMESPACE + +class LoggerWidget : public QPlainTextEdit { +Q_OBJECT +public: + LoggerWidget(QWidget *parent=0); +public slots: + void append(const QString &msg); +protected: + void closeEvent(QCloseEvent *event); +private: + bool m_keepClosed; +}; + +QT_END_NAMESPACE + +#endif // LOGGERWIDGET_H diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 45c2b85..cba5650 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -42,16 +42,20 @@ #include "qdeclarative.h" #include "qmlruntime.h" #include "qdeclarativeengine.h" +#include "loggerwidget.h" #include <QWidget> #include <QDir> #include <QApplication> #include <QTranslator> #include <QDebug> +#include <QMessageBox> #include "qdeclarativetester.h" #include "qdeclarativefolderlistmodel.h" QT_USE_NAMESPACE +QtMsgHandler systemMsgOutput; + #if defined (Q_OS_SYMBIAN) #include <unistd.h> #include <sys/types.h> @@ -73,6 +77,36 @@ void myMessageOutput(QtMsgType type, const char *msg) abort(); } } + +#else // !defined (Q_OS_SYMBIAN) + +QWeakPointer<LoggerWidget> logger; + +QString warnings; +void showWarnings() +{ + if (!warnings.isEmpty()) { + QMessageBox::warning(0, QApplication::tr("Qt Declarative UI Runtime"), warnings); + } +} + +void myMessageOutput(QtMsgType type, const char *msg) +{ + if (!logger.isNull()) { + QString strMsg = QString::fromAscii(msg); + QMetaObject::invokeMethod(logger.data(), "append", Q_ARG(QString, strMsg)); + } else { + warnings += msg; + warnings += QLatin1Char('\n'); + } + if (systemMsgOutput) { // Windows + systemMsgOutput(type, msg); + } else { // Unix + fprintf(stderr, "%s\n",msg); + fflush(stderr); + } +} + #endif void usage() @@ -88,7 +122,10 @@ void usage() qWarning(" -skin <qvfbskindir> ...................... run with a skin window frame"); qWarning(" \"list\" for a list of built-ins"); qWarning(" -resizeview .............................. resize the view, not the skin"); + qWarning(" -sizeviewtorootobject .................... the view resizes to the changes in the content"); + qWarning(" -sizerootobjecttoview .................... the content resizes to the changes in the view"); qWarning(" -qmlbrowser .............................. use a QML-based file browser"); + qWarning(" -nolog ................................... do not show log window"); qWarning(" -recordfile <output> ..................... set video recording file"); qWarning(" - ImageMagick 'convert' for GIF)"); qWarning(" - png file for raw frames"); @@ -135,6 +172,14 @@ int main(int argc, char ** argv) { #if defined (Q_OS_SYMBIAN) qInstallMsgHandler(myMessageOutput); +#else + systemMsgOutput = qInstallMsgHandler(myMessageOutput); +#endif + +#if defined (Q_OS_WIN) + // Debugging output is not visible by default on Windows - + // therefore show modal dialog with errors instad. + atexit(showWarnings); #endif #if defined (Q_WS_X11) @@ -184,6 +229,8 @@ int main(int argc, char ** argv) bool stayOnTop = false; bool maximized = false; bool useNativeFileBrowser = true; + bool showLogWidget = true; + bool sizeToView = true; #if defined(Q_OS_SYMBIAN) maximized = true; @@ -234,8 +281,8 @@ int main(int argc, char ** argv) if (lastArg) usage(); app.setStartDragDistance(QString(argv[++i]).toInt()); } else if (arg == QLatin1String("-v") || arg == QLatin1String("-version")) { - fprintf(stderr, "Qt Declarative UI Viewer version %s\n", QT_VERSION_STR); - return 0; + qWarning("Qt Declarative UI Viewer version %s", QT_VERSION_STR); + exit(0); } else if (arg == "-translation") { if (lastArg) usage(); translationFile = argv[++i]; @@ -243,14 +290,16 @@ int main(int argc, char ** argv) useGL = true; } else if (arg == "-qmlbrowser") { useNativeFileBrowser = false; + } else if (arg == "-nolog") { + showLogWidget = false; } else if (arg == "-I" || arg == "-L") { if (arg == "-L") - fprintf(stderr, "-L option provided for compatibility only, use -I instead\n"); + qWarning("-L option provided for compatibility only, use -I instead"); if (lastArg) { QDeclarativeEngine tmpEngine; QString paths = tmpEngine.importPathList().join(QLatin1String(":")); - fprintf(stderr, "Current search path: %s\n", paths.toLocal8Bit().constData()); - return 0; + qWarning("Current search path: %s", paths.toLocal8Bit().constData()); + exit(0); } imports << QString(argv[++i]); } else if (arg == "-P") { @@ -270,6 +319,10 @@ int main(int argc, char ** argv) if (lastArg) usage(); script = QString(argv[++i]); runScript = true; + } else if (arg == "-sizeviewtorootobject") { + sizeToView = false; + } else if (arg == "-sizerootobjecttoview") { + sizeToView = true; } else if (arg[0] != '-') { fileName = arg; } else if (1 || arg == "-help") { @@ -287,7 +340,14 @@ int main(int argc, char ** argv) if (stayOnTop) wflags |= Qt::WindowStaysOnTopHint; - QDeclarativeViewer viewer(0, wflags); +#if !defined(Q_OS_SYMBIAN) + LoggerWidget loggerWidget(0); + if (showLogWidget) { + logger = &loggerWidget; + } +#endif + + QDeclarativeViewer *viewer = new QDeclarativeViewer(0, wflags); if (!scriptopts.isEmpty()) { QStringList options = scriptopts.split(QLatin1Char(','), QString::SkipEmptyParts); @@ -323,44 +383,45 @@ int main(int argc, char ** argv) if (!(scriptOptions & QDeclarativeViewer::Record) && !(scriptOptions & QDeclarativeViewer::Play)) scriptOptsUsage(); - viewer.setScriptOptions(scriptOptions); - viewer.setScript(script); + viewer->setScriptOptions(scriptOptions); + viewer->setScript(script); } else if (!script.isEmpty()) { usage(); } - viewer.addLibraryPath(QCoreApplication::applicationDirPath()); + viewer->addLibraryPath(QCoreApplication::applicationDirPath()); foreach (QString lib, imports) - viewer.addLibraryPath(lib); + viewer->addLibraryPath(lib); foreach (QString plugin, plugins) - viewer.addPluginPath(plugin); + viewer->addPluginPath(plugin); - viewer.setNetworkCacheSize(cache); - viewer.setRecordFile(recordfile); + viewer->setNetworkCacheSize(cache); + viewer->setRecordFile(recordfile); + viewer->setSizeToView(sizeToView); if (resizeview) - viewer.setScaleView(); + viewer->setScaleView(); if (fps>0) - viewer.setRecordRate(fps); + viewer->setRecordRate(fps); if (autorecord_to) - viewer.setAutoRecord(autorecord_from,autorecord_to); + viewer->setAutoRecord(autorecord_from,autorecord_to); if (!skin.isEmpty()) { if (skin == "list") { - foreach (QString s, viewer.builtinSkins()) + foreach (QString s, viewer->builtinSkins()) qWarning() << qPrintable(s); exit(0); } else { - viewer.setSkin(skin); + viewer->setSkin(skin); } } if (devkeys) - viewer.setDeviceKeys(true); - viewer.setRecordDither(dither); + viewer->setDeviceKeys(true); + viewer->setRecordDither(dither); if (recordargs.count()) - viewer.setRecordArgs(recordargs); + viewer->setRecordArgs(recordargs); - viewer.setUseNativeFileBrowser(useNativeFileBrowser); + viewer->setUseNativeFileBrowser(useNativeFileBrowser); if (fullScreen && maximized) qWarning() << "Both -fullscreen and -maximized specified. Using -fullscreen."; @@ -379,17 +440,19 @@ int main(int argc, char ** argv) } if (!fileName.isEmpty()) { - viewer.open(fileName); - fullScreen ? viewer.showFullScreen() : maximized ? viewer.showMaximized() : viewer.show(); + viewer->open(fileName); + fullScreen ? viewer->showFullScreen() : maximized ? viewer->showMaximized() : viewer->show(); } else { if (!useNativeFileBrowser) - viewer.openFile(); - fullScreen ? viewer.showFullScreen() : maximized ? viewer.showMaximized() : viewer.show(); + viewer->openFile(); + fullScreen ? viewer->showFullScreen() : maximized ? viewer->showMaximized() : viewer->show(); if (useNativeFileBrowser) - viewer.openFile(); + viewer->openFile(); } - viewer.setUseGL(useGL); - viewer.raise(); + viewer->setUseGL(useGL); + viewer->raise(); - return app.exec(); + int rv = app.exec(); + delete viewer; + exit(rv); } diff --git a/tools/qml/qdeclarativefolderlistmodel.cpp b/tools/qml/qdeclarativefolderlistmodel.cpp index d36033d..5a9d88b 100644 --- a/tools/qml/qdeclarativefolderlistmodel.cpp +++ b/tools/qml/qdeclarativefolderlistmodel.cpp @@ -413,7 +413,7 @@ void QDeclarativeFolderListModel::setShowOnlyReadable(bool on) void QDeclarativeFolderListModel::registerTypes() { - qmlRegisterType<QDeclarativeFolderListModel>("Qt",4,6,"FolderListModel"); + qmlRegisterType<QDeclarativeFolderListModel>("Qt",4,7,"FolderListModel"); } QT_END_NAMESPACE diff --git a/tools/qml/qdeclarativetester.cpp b/tools/qml/qdeclarativetester.cpp index 11fa22f..9864df6 100644 --- a/tools/qml/qdeclarativetester.cpp +++ b/tools/qml/qdeclarativetester.cpp @@ -181,7 +181,7 @@ void QDeclarativeTester::save() file.open(QIODevice::WriteOnly); QTextStream ts(&file); - ts << "import Qt.VisualTest 4.6\n\n"; + ts << "import Qt.VisualTest 4.7\n\n"; ts << "VisualTest {\n"; int imgCount = 0; @@ -251,7 +251,8 @@ void QDeclarativeTester::updateCurrentTime(int msec) m_view->render(&p); } - bool snapshot = msec == 16 && options & QDeclarativeViewer::Snapshot; + bool snapshot = msec == 16 && (options & QDeclarativeViewer::Snapshot + || (testscript && testscript->count() == 2)); FrameEvent fe; fe.msec = msec; @@ -397,10 +398,10 @@ void QDeclarativeTester::updateCurrentTime(int msec) void QDeclarativeTester::registerTypes() { - qmlRegisterType<QDeclarativeVisualTest>("Qt.VisualTest", 4,6, "VisualTest"); - qmlRegisterType<QDeclarativeVisualTestFrame>("Qt.VisualTest", 4,6, "Frame"); - qmlRegisterType<QDeclarativeVisualTestMouse>("Qt.VisualTest", 4,6, "Mouse"); - qmlRegisterType<QDeclarativeVisualTestKey>("Qt.VisualTest", 4,6, "Key"); + qmlRegisterType<QDeclarativeVisualTest>("Qt.VisualTest", 4,7, "VisualTest"); + qmlRegisterType<QDeclarativeVisualTestFrame>("Qt.VisualTest", 4,7, "Frame"); + qmlRegisterType<QDeclarativeVisualTestMouse>("Qt.VisualTest", 4,7, "Mouse"); + qmlRegisterType<QDeclarativeVisualTestKey>("Qt.VisualTest", 4,7, "Key"); } QT_END_NAMESPACE diff --git a/tools/qml/qml.pri b/tools/qml/qml.pri index c48e919..d343c76 100644 --- a/tools/qml/qml.pri +++ b/tools/qml/qml.pri @@ -10,11 +10,13 @@ HEADERS += $$PWD/qmlruntime.h \ $$PWD/proxysettings.h \ $$PWD/qdeclarativetester.h \ $$PWD/deviceorientation.h \ - $$PWD/qdeclarativefolderlistmodel.h + $$PWD/qdeclarativefolderlistmodel.h \ + $$PWD/loggerwidget.h SOURCES += $$PWD/qmlruntime.cpp \ $$PWD/proxysettings.cpp \ $$PWD/qdeclarativetester.cpp \ - $$PWD/qdeclarativefolderlistmodel.cpp + $$PWD/qdeclarativefolderlistmodel.cpp \ + $$PWD/loggerwidget.cpp RESOURCES = $$PWD/qmlruntime.qrc maemo5 { @@ -26,4 +28,3 @@ FORMS = $$PWD/recopts.ui \ $$PWD/proxysettings.ui include(../shared/deviceskin/deviceskin.pri) - diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro index 869907f..7a101d0 100644 --- a/tools/qml/qml.pro +++ b/tools/qml/qml.pro @@ -26,7 +26,7 @@ QT += scripttools \ } } symbian { -# TARGET.UID3 = + TARGET.UID3 = 0x20021317 include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) INCLUDEPATH += $$QT_SOURCE_TREE/examples/network/qftp/ TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index 53409c1..87a4d21 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -496,7 +496,7 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags) canvas = new QDeclarativeView(this); canvas->setAttribute(Qt::WA_OpaquePaintEvent); canvas->setAttribute(Qt::WA_NoSystemBackground); - canvas->setResizeMode((!skin || !scaleSkin) ? QDeclarativeView::SizeRootObjectToView : QDeclarativeView::SizeViewToRootObject); + canvas->setFocus(); QObject::connect(canvas, SIGNAL(sceneResized(QSize)), this, SLOT(sceneResized(QSize))); @@ -519,7 +519,6 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags) #else setCentralWidget(canvas); #endif - namFactory = new NetworkAccessManagerFactory; canvas->engine()->setNetworkAccessManagerFactory(namFactory); @@ -753,10 +752,11 @@ void QDeclarativeViewer::setScaleSkin() if (scaleSkin) return; scaleSkin = true; - canvas->setResizeMode((!skin || !scaleSkin) ? QDeclarativeView::SizeRootObjectToView : QDeclarativeView::SizeViewToRootObject); if (skin) { - canvas->setFixedSize(canvas->sizeHint()); - skin->setScreenSize(canvas->sizeHint()); + canvas->resize(initialSize); + canvas->setFixedSize(initialSize); + canvas->setResizeMode(QDeclarativeView::SizeViewToRootObject); + updateSizeHints(); } } @@ -766,11 +766,8 @@ void QDeclarativeViewer::setScaleView() return; scaleSkin = false; if (skin) { - canvas->setResizeMode((!skin || !scaleSkin) ? QDeclarativeView::SizeRootObjectToView : QDeclarativeView::SizeViewToRootObject); - canvas->setMinimumSize(QSize(0,0)); - canvas->setMaximumSize(QSize(16777215,16777215)); - canvas->resize(skin->standardScreenSize()); - skin->setScreenSize(skin->standardScreenSize()); + canvas->setResizeMode(QDeclarativeView::SizeRootObjectToView); + updateSizeHints(); } } @@ -916,19 +913,12 @@ void QDeclarativeViewer::statusChanged() tester->executefailure(); if (canvas->status() == QDeclarativeView::Ready) { - if (!skin) { - canvas->updateGeometry(); - if (mb) - mb->updateGeometry(); - if (!isFullScreen() && !isMaximized()) - resize(sizeHint()); - } else { - if (scaleSkin) - canvas->resize(canvas->sizeHint()); - else { - canvas->setFixedSize(skin->standardScreenSize()); - canvas->resize(skin->standardScreenSize()); - } + initialSize = canvas->sizeHint(); + if (canvas->resizeMode() == QDeclarativeView::SizeRootObjectToView) { + QSize newWindowSize = initialSize; + newWindowSize.setHeight(newWindowSize.height()+menuBar()->height()); + updateSizeHints(); + resize(newWindowSize); } } } @@ -1011,8 +1001,6 @@ bool QDeclarativeViewer::open(const QString& file_or_url) canvas->setSource(url); - qWarning() << "Wall startup time:" << t.elapsed(); - return true; } @@ -1056,41 +1044,43 @@ void QDeclarativeViewer::setSkin(const QString& skinDirOrName) skin->deleteLater(); } - canvas->setResizeMode((!skin || !scaleSkin) ? QDeclarativeView::SizeRootObjectToView : QDeclarativeView::SizeViewToRootObject); - DeviceSkinParameters parameters; if (!skinDirectory.isEmpty() && parameters.read(skinDirectory,DeviceSkinParameters::ReadAll,&err)) { layout()->setEnabled(false); - //setMenuBar(0); if (mb) mb->hide(); if (!err.isEmpty()) qWarning() << err; skin = new PreviewDeviceSkin(parameters,this); - canvas->resize(canvas->sizeHint()); if (scaleSkin) skin->setPreviewAndScale(canvas); else skin->setPreview(canvas); createMenu(0,skin->menu); + if (scaleSkin) { + canvas->setResizeMode(QDeclarativeView::SizeViewToRootObject); + } + updateSizeHints(); skin->show(); - } else { + } else if (skin) { skin = 0; clearMask(); menuBar()->clear(); - canvas->setParent(this, Qt::SubWindow); createMenu(menuBar(),0); - mb->show(); - setMinimumSize(QSize(0,0)); - setMaximumSize(QSize(16777215,16777215)); - canvas->setMinimumSize(QSize(0,0)); - canvas->setMaximumSize(QSize(16777215,16777215)); - QRect g = geometry(); - g.setSize(sizeHint()); + canvas->setParent(this, Qt::SubWindow); setParent(0,windowFlags()); // recreate - canvas->move(0,menuBar()->sizeHint().height()); - setGeometry(g); + mb->show(); + canvas->setResizeMode(QDeclarativeView::SizeRootObjectToView); + updateSizeHints(); + layout()->setEnabled(true); + if (!scaleSkin) { + canvas->resize(initialSize); + canvas->setFixedSize(initialSize); + } + QSize newWindowSize = canvas->size(); + newWindowSize.setHeight(newWindowSize.height()+menuBar()->height()); + resize(newWindowSize); show(); } canvas->show(); @@ -1122,9 +1112,10 @@ void QDeclarativeViewer::setRecordRate(int fps) void QDeclarativeViewer::sceneResized(QSize size) { if (size.width() > 0 && size.height() > 0) { - if (skin && scaleSkin) - skin->setScreenSize(size); - } + if (canvas->resizeMode() == QDeclarativeView::SizeViewToRootObject) { + updateSizeHints(); + } + } } void QDeclarativeViewer::keyPressEvent(QKeyEvent *event) @@ -1397,13 +1388,49 @@ void QDeclarativeViewer::setUseNativeFileBrowser(bool use) useQmlFileBrowser = !use; } +void QDeclarativeViewer::setSizeToView(bool sizeToView) +{ + QDeclarativeView::ResizeMode resizeMode = sizeToView ? QDeclarativeView::SizeRootObjectToView : QDeclarativeView::SizeViewToRootObject; + if (resizeMode != canvas->resizeMode()) { + canvas->setResizeMode(resizeMode); + updateSizeHints(); + } +} + +void QDeclarativeViewer::updateSizeHints() +{ + if (canvas->resizeMode() == QDeclarativeView::SizeViewToRootObject) { + QSize newWindowSize = canvas->sizeHint(); + if (!skin) { + newWindowSize.setHeight(newWindowSize.height()+menuBar()->height()); + } + if (!isFullScreen() && !isMaximized()) { + resize(newWindowSize); + setFixedSize(newWindowSize); + if (skin && scaleSkin) { + skin->setScreenSize(newWindowSize); + } + } + } else { // QDeclarativeView::SizeRootObjectToView + canvas->setMinimumSize(QSize(0,0)); + canvas->setMaximumSize(QSize(16777215,16777215)); + setMinimumSize(QSize(0,0)); + setMaximumSize(QSize(16777215,16777215)); + if (skin && !scaleSkin) { + canvas->setFixedSize(skin->standardScreenSize()); + skin->setScreenSize(skin->standardScreenSize()); + } + } + updateGeometry(); +} + void QDeclarativeViewer::registerTypes() { static bool registered = false; if (!registered) { // registering only for exposing the DeviceOrientation::Orientation enum - qmlRegisterUncreatableType<DeviceOrientation>("Qt",4,6,"Orientation"); + qmlRegisterUncreatableType<DeviceOrientation>("Qt",4,6,"Orientation",""); registered = true; } } diff --git a/tools/qml/qmlruntime.h b/tools/qml/qmlruntime.h index 2089dda..a00a703 100644 --- a/tools/qml/qmlruntime.h +++ b/tools/qml/qmlruntime.h @@ -100,7 +100,8 @@ public: void addPluginPath(const QString& plugin); void setUseGL(bool use); void setUseNativeFileBrowser(bool); - + void updateSizeHints(); + void setSizeToView(bool sizeToView); QStringList builtinSkins() const; QMenuBar *menuBar() const; @@ -149,6 +150,7 @@ private: PreviewDeviceSkin *skin; QSize skinscreensize; QDeclarativeView *canvas; + QSize initialSize; QString currentFileOrUrl; QDeclarativeTimer recordTimer; QString frame_fmt; diff --git a/tools/qtconfig/mainwindow.cpp b/tools/qtconfig/mainwindow.cpp index 0de4b43..9675f99 100644 --- a/tools/qtconfig/mainwindow.cpp +++ b/tools/qtconfig/mainwindow.cpp @@ -432,7 +432,7 @@ MainWindow::MainWindow() #endif #ifndef QT_NO_OPENGL videomodeCombo->addItem(tr("OpenGL"), QLatin1String("OpenGL")); - videomodeCombo->setItemData(videomodeCombo->findText(tr("OpenGL")), tr("Use OpenGL if avaiable"), Qt::ToolTipRole); + videomodeCombo->setItemData(videomodeCombo->findText(tr("OpenGL")), tr("Use OpenGL if available"), Qt::ToolTipRole); #endif videomodeCombo->addItem(tr("Software"), QLatin1String("Software")); videomodeCombo->setItemData(videomodeCombo->findText(tr("Software")), tr("Use simple software rendering"), Qt::ToolTipRole); diff --git a/tools/qtestlib/wince/cetest/main.cpp b/tools/qtestlib/wince/cetest/main.cpp index 9fe5f02..4272a83 100644 --- a/tools/qtestlib/wince/cetest/main.cpp +++ b/tools/qtestlib/wince/cetest/main.cpp @@ -285,10 +285,14 @@ int main(int argc, char **argv) } // Check wether the project is still in debug/release mode after reading // If .pro specifies to be one mode only, we need to accept this - if (project.isActiveConfig("debug")) + if (project.isActiveConfig("debug") && !project.isActiveConfig("release")) { TestConfiguration::testDebug = true; - else + debugOutput("ActiveConfig: debug only in .pro.", 1); + } + if (!project.isActiveConfig("debug") && project.isActiveConfig("release")) { TestConfiguration::testDebug = false; + debugOutput("ActiveConfig: release only in .pro.", 1); + } // determine what is the real mkspec to use if the default mkspec is being used if (Option::mkfile::qmakespec.endsWith("/default")) |