diff options
author | Paul Olav Tvete <paul.tvete@nokia.com> | 2010-06-18 13:10:26 +0200 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@nokia.com> | 2010-06-18 13:10:26 +0200 |
commit | a3fd00796dafe52d4ff138b271564daf70d1adee (patch) | |
tree | 77ca481c06c1b2c3c7822a4cd5864702e341b680 /tools | |
parent | 793d1ed8d3a03eefdd487facdacf66ba575e1a07 (diff) | |
parent | 6aa50af000f85cc4497749fcf0860c8ed244a60e (diff) | |
download | qt4-tools-a3fd00796dafe52d4ff138b271564daf70d1adee.tar.gz |
Merge remote branch 'qt/4.7' into lighthouse
Conflicts:
configure
mkspecs/common/qws.conf
src/corelib/io/qresource.cpp
src/gui/image/qpixmapdata_p.h
src/gui/kernel/qapplication.cpp
src/gui/kernel/qapplication_p.h
src/gui/painting/qpaintengine_raster.cpp
src/gui/text/qfontdatabase.cpp
src/opengl/qgl_p.h
src/plugins/mediaservices/gstreamer/gstreamer.pro
Diffstat (limited to 'tools')
116 files changed, 8461 insertions, 2763 deletions
diff --git a/tools/activeqt/testcon/testcon.pro b/tools/activeqt/testcon/testcon.pro index dc982185a0..89f8067362 100644 --- a/tools/activeqt/testcon/testcon.pro +++ b/tools/activeqt/testcon/testcon.pro @@ -16,6 +16,6 @@ RC_FILE = testcon.rc win32-borland { QMAKE_POST_LINK = -midl $$QT_SOURCE_TREE/tools/activeqt/testcon/testcon.idl } else { - !win32-g++:QMAKE_POST_LINK = midl $$QT_SOURCE_TREE/tools/activeqt/testcon/testcon.idl && move testcon.tlb $(TARGETDIR) + !win32-g++*:QMAKE_POST_LINK = midl $$QT_SOURCE_TREE/tools/activeqt/testcon/testcon.idl && move testcon.tlb $(TARGETDIR) } diff --git a/tools/assistant/lib/fulltextsearch/fulltextsearch.pro b/tools/assistant/lib/fulltextsearch/fulltextsearch.pro index e0cd13a821..4d2fddb1a6 100644 --- a/tools/assistant/lib/fulltextsearch/fulltextsearch.pro +++ b/tools/assistant/lib/fulltextsearch/fulltextsearch.pro @@ -29,7 +29,7 @@ unix:QMAKE_PKGCONFIG_REQUIRES = QtCore CONFIG(exceptions_off) { CONFIG -= exceptions_off CONFIG += exceptions - !win32|win32-g++ { + !win32|win32-g++* { QMAKE_CFLAGS -= -fno-exceptions QMAKE_CXXFLAGS -= -fno-exceptions QMAKE_LFLAGS -= -fno-exceptions @@ -46,5 +46,5 @@ win32-msvc.net | win32-msvc2* { # the following define could be set globally in case we need it elsewhere solaris* { - DEFINES += Q_SOLARIS_VERSION=$$system(uname -r | sed -e 's/5\.//') + DEFINES += Q_SOLARIS_VERSION=$$system(uname -r | sed -e 's/5\\.//') } diff --git a/tools/assistant/lib/qhelpsearchindexreader_default_p.h b/tools/assistant/lib/qhelpsearchindexreader_default_p.h index b30fa4b582..27764dbc89 100644 --- a/tools/assistant/lib/qhelpsearchindexreader_default_p.h +++ b/tools/assistant/lib/qhelpsearchindexreader_default_p.h @@ -61,9 +61,6 @@ QT_BEGIN_NAMESPACE -struct Entry; -struct PosEntry; - namespace fulltextsearch { namespace std { diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp index 2359479505..131fb85ee5 100644 --- a/tools/assistant/tools/assistant/centralwidget.cpp +++ b/tools/assistant/tools/assistant/centralwidget.cpp @@ -565,6 +565,7 @@ void CentralWidget::connectSignals() SIGNAL(highlighted(QString))); connect(viewer, SIGNAL(sourceChanged(QUrl)), this, SLOT(setTabTitle(QUrl))); + connect(viewer, SIGNAL(printRequested()), this, SLOT(print())); } } diff --git a/tools/assistant/tools/assistant/contentwindow.cpp b/tools/assistant/tools/assistant/contentwindow.cpp index e0347c861d..8afa1df2e2 100644 --- a/tools/assistant/tools/assistant/contentwindow.cpp +++ b/tools/assistant/tools/assistant/contentwindow.cpp @@ -133,11 +133,13 @@ bool ContentWindow::eventFilter(QObject *o, QEvent *e) if (m_contentWidget && o == m_contentWidget->viewport() && e->type() == QEvent::MouseButtonRelease) { QMouseEvent *me = static_cast<QMouseEvent*>(e); - QModelIndex index = m_contentWidget->indexAt(me->pos()); - QItemSelectionModel *sm = m_contentWidget->selectionModel(); + const QModelIndex &index = m_contentWidget->indexAt(me->pos()); + if (!index.isValid()) + return QWidget::eventFilter(o, e); - Qt::MouseButtons button = me->button(); - if (index.isValid() && (sm && sm->isSelected(index))) { + const Qt::MouseButtons button = me->button(); + QItemSelectionModel *sm = m_contentWidget->selectionModel(); + if (sm->isSelected(index)) { if ((button == Qt::LeftButton && (me->modifiers() & Qt::ControlModifier)) || (button == Qt::MidButton)) { QHelpContentModel *contentModel = @@ -189,9 +191,11 @@ void ContentWindow::itemClicked(const QModelIndex &index) qobject_cast<QHelpContentModel*>(m_contentWidget->model()); if (contentModel) { - QHelpContentItem *itm = contentModel->contentItemAt(index); - if (itm) - emit linkActivated(itm->url()); + if (QHelpContentItem *itm = contentModel->contentItemAt(index)) { + const QUrl &url = itm->url(); + if (url != CentralWidget::instance()->currentSource()) + emit linkActivated(url); + } } } diff --git a/tools/assistant/tools/assistant/doc/images/assistant-assistant.png b/tools/assistant/tools/assistant/doc/images/assistant-assistant.png Binary files differindex b825de0987..1ff5cc9763 100644 --- a/tools/assistant/tools/assistant/doc/images/assistant-assistant.png +++ b/tools/assistant/tools/assistant/doc/images/assistant-assistant.png diff --git a/tools/assistant/tools/assistant/helpviewer_qwv.cpp b/tools/assistant/tools/assistant/helpviewer_qwv.cpp index adaa45b10b..dcbbf2ce96 100644 --- a/tools/assistant/tools/assistant/helpviewer_qwv.cpp +++ b/tools/assistant/tools/assistant/helpviewer_qwv.cpp @@ -172,6 +172,7 @@ private: bool closeNewTabIfNeeded; friend class HelpViewer; + QUrl m_loadingUrl; Qt::MouseButtons m_pressedButtons; Qt::KeyboardModifiers m_keyboardModifiers; }; @@ -232,6 +233,11 @@ bool HelpPage::acceptNavigationRequest(QWebFrame *, return false; } + m_loadingUrl = url; // because of async page loading, we will hit some kind + // of race condition while using a remote command, like a combination of + // SetSource; SyncContent. SetSource would be called and SyncContents shortly + // afterwards, but the page might not have finished loading and the old url + // would be returned. return true; } @@ -268,7 +274,9 @@ HelpViewer::HelpViewer(CentralWidget *parent, qreal zoom) connect(page(), SIGNAL(linkHovered(QString,QString,QString)), this, SIGNAL(highlighted(QString))); connect(this, SIGNAL(urlChanged(QUrl)), this, SIGNAL(sourceChanged(QUrl))); + connect(this, SIGNAL(loadStarted()), this, SLOT(setLoadStarted())); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(setLoadFinished(bool))); + connect(page(), SIGNAL(printRequested(QWebFrame*)), this, SIGNAL(printRequested())); setFont(viewerFont()); setTextSizeMultiplier(zoom == 0.0 ? 1.0 : zoom); @@ -332,10 +340,19 @@ bool HelpViewer::handleForwardBackwardMouseButtons(QMouseEvent *e) return false; } +QUrl HelpViewer::source() const +{ + HelpPage *currentPage = static_cast<HelpPage*> (page()); + if (currentPage && !hasLoadFinished()) { + // see HelpPage::acceptNavigationRequest(...) + return currentPage->m_loadingUrl; + } + return url(); +} + void HelpViewer::setSource(const QUrl &url) { TRACE_OBJ - loadFinished = false; load(url.toString() == QLatin1String("help") ? LocalHelpFile : url); } @@ -395,6 +412,11 @@ void HelpViewer::mousePressEvent(QMouseEvent *event) QWebView::mousePressEvent(event); } +void HelpViewer::setLoadStarted() +{ + loadFinished = false; +} + void HelpViewer::setLoadFinished(bool ok) { TRACE_OBJ diff --git a/tools/assistant/tools/assistant/helpviewer_qwv.h b/tools/assistant/tools/assistant/helpviewer_qwv.h index a2c0389e35..1897e3e40a 100644 --- a/tools/assistant/tools/assistant/helpviewer_qwv.h +++ b/tools/assistant/tools/assistant/helpviewer_qwv.h @@ -71,8 +71,8 @@ public: bool handleForwardBackwardMouseButtons(QMouseEvent *e); + QUrl source() const; void setSource(const QUrl &url); - inline QUrl source() const { return url(); } inline QString documentTitle() const { return title(); } @@ -100,6 +100,7 @@ Q_SIGNALS: void backwardAvailable(bool enabled); void highlighted(const QString &); void sourceChanged(const QUrl &); + void printRequested(); protected: virtual void wheelEvent(QWheelEvent *); @@ -108,6 +109,7 @@ protected: private Q_SLOTS: void actionChanged(); + void setLoadStarted(); void setLoadFinished(bool ok); private: diff --git a/tools/configure/configure.pro b/tools/configure/configure.pro index d926a76990..64a6d9aef8 100644 --- a/tools/configure/configure.pro +++ b/tools/configure/configure.pro @@ -8,7 +8,7 @@ DEFINES += QT_BOOTSTRAPPED win32 : LIBS += -lole32 -ladvapi32 win32-msvc.net | win32-msvc2* : QMAKE_CXXFLAGS += /EHsc -win32-g++ : LIBS += -luuid +win32-g++* : LIBS += -luuid win32-msvc* { QMAKE_CFLAGS_RELEASE -= -MD diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index bfa74455fb..2e2d8baf6b 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -195,10 +195,37 @@ Configure::Configure( int& argc, char** argv ) } } + // make patch_capabilities and createpackage scripts for Symbian that can be used from the shadow build + QFile patch_capabilities(buildPath + "/bin/patch_capabilities"); + if(patch_capabilities.open(QFile::WriteOnly)) { + QTextStream stream(&patch_capabilities); + stream << "#!/usr/bin/perl -w" << endl + << "require \"" << sourcePath + "/bin/patch_capabilities\";" << endl; + } + QFile patch_capabilities_bat(buildPath + "/bin/patch_capabilities.bat"); + if(patch_capabilities_bat.open(QFile::WriteOnly)) { + QTextStream stream(&patch_capabilities_bat); + stream << "@echo off" << endl + << "call " << fixSeparators(sourcePath) << fixSeparators("/bin/patch_capabilities.bat %*") << endl; + patch_capabilities_bat.close(); + } + QFile createpackage(buildPath + "/bin/createpackage"); + if(createpackage.open(QFile::WriteOnly)) { + QTextStream stream(&createpackage); + stream << "#!/usr/bin/perl -w" << endl + << "require \"" << sourcePath + "/bin/createpackage\";" << endl; + } + QFile createpackage_bat(buildPath + "/bin/createpackage.bat"); + if(createpackage_bat.open(QFile::WriteOnly)) { + QTextStream stream(&createpackage_bat); + stream << "@echo off" << endl + << "call " << fixSeparators(sourcePath) << fixSeparators("/bin/createpackage.bat %*") << endl; + createpackage_bat.close(); + } + // For Windows CE and shadow builds we need to copy these to the // build directory. QFile::copy(sourcePath + "/bin/setcepaths.bat" , buildPath + "/bin/setcepaths.bat"); - //copy the mkspecs buildDir.mkpath("mkspecs"); if(!Environment::cpdir(sourcePath + "/mkspecs", buildPath + "/mkspecs")){ @@ -247,9 +274,7 @@ Configure::Configure( int& argc, char** argv ) dictionary[ "PHONON" ] = "auto"; dictionary[ "PHONON_BACKEND" ] = "yes"; dictionary[ "MULTIMEDIA" ] = "yes"; - dictionary[ "MEDIASERVICES" ] = "yes"; dictionary[ "AUDIO_BACKEND" ] = "auto"; - dictionary[ "MEDIA_BACKEND"] = "auto"; dictionary[ "WMSDK" ] = "auto"; dictionary[ "DIRECTSHOW" ] = "no"; dictionary[ "WEBKIT" ] = "auto"; @@ -367,11 +392,19 @@ Configure::~Configure() } } -QString Configure::fixSeparators(QString somePath) +QString Configure::fixSeparators(const QString &somePath, bool escape) +{ + if (useUnixSeparators) + return QDir::fromNativeSeparators(somePath); + QString ret = QDir::toNativeSeparators(somePath); + return escape ? escapeSeparators(ret) : ret; +} + +QString Configure::escapeSeparators(const QString &somePath) { - return useUnixSeparators ? - QDir::fromNativeSeparators(somePath) : - QDir::toNativeSeparators(somePath); + QString out = somePath; + out.replace(QLatin1Char('\\'), QLatin1String("\\\\")); + return out; } // We could use QDir::homePath() + "/.qt-license", but @@ -906,18 +939,10 @@ 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) == "-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" ) { @@ -1010,6 +1035,8 @@ void Configure::parseCmdLine() qmakeLibs += QString("-l" + configCmdLine.at(i)); } else if (configCmdLine.at(i).startsWith("OPENSSL_LIBS=")) { opensslLibs = configCmdLine.at(i); + } else if (configCmdLine.at(i).startsWith("PSQL_LIBS=")) { + psqlLibs = configCmdLine.at(i); } else if( ( configCmdLine.at(i) == "-override-version" ) || ( configCmdLine.at(i) == "-version-override" ) ){ @@ -1135,7 +1162,8 @@ void Configure::parseCmdLine() QString system = configCmdLine.at(i); if (system == QLatin1String("raster") || system == QLatin1String("opengl") - || system == QLatin1String("openvg")) + || system == QLatin1String("openvg") + || system == QLatin1String("runtime")) dictionary["GRAPHICS_SYSTEM"] = configCmdLine.at(i); } @@ -1603,9 +1631,8 @@ 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-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); + "[-no-webkit] [-webkit] [-graphicssystem raster|opengl|openvg|runtime]\n\n", 0, 7); desc("Installation options:\n\n"); @@ -1708,9 +1735,10 @@ bool Configure::displayHelp() #endif desc( "-graphicssystem <sys>", "Specify which graphicssystem should be used.\n" "Available values for <sys>:"); - desc("GRAPHICS_SYSTEM", "raster", "", " raster - Software rasterizer", ' '); - desc("GRAPHICS_SYSTEM", "opengl", "", " opengl - Using OpenGL acceleration, experimental!", ' '); - desc("GRAPHICS_SYSTEM", "openvg", "", " openvg - Using OpenVG acceleration, experimental!", ' '); + desc("GRAPHICS_SYSTEM", "raster", "", " raster - Software rasterizer", ' '); + desc("GRAPHICS_SYSTEM", "opengl", "", " opengl - Using OpenGL acceleration, experimental!", ' '); + desc("GRAPHICS_SYSTEM", "openvg", "", " openvg - Using OpenVG acceleration, experimental!", ' '); + desc("GRAPHICS_SYSTEM", "runtime", "", " runtime - Runtime switching of graphics sytems", ' '); desc( "-help, -h, -?", "Display this information.\n"); @@ -1788,10 +1816,6 @@ 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("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."); @@ -2073,7 +2097,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 == "MEDIA_BACKEND") { + } else if (part == "PHONON") { if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) { available = true; } else { @@ -2237,8 +2261,6 @@ 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["MEDIA_BACKEND"] == "auto") - dictionary["MEDIA_BACKEND"] = checkAvailability("MEDIA_BACKEND") ? "yes" : "no"; if (dictionary["WMSDK"] == "auto") dictionary["WMSDK"] = checkAvailability("WMSDK") ? "yes" : "no"; @@ -2373,7 +2395,7 @@ void Configure::generateBuildKey() + buildSymbianKey + "\"\n" "#else\n" // Debug builds - "# if (defined(_DEBUG) || defined(DEBUG))\n" + "# if (!QT_NO_DEBUG)\n" "# if (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))\n" + build64Key.arg("debug") + "\"\n" "# else\n" @@ -2563,10 +2585,10 @@ void Configure::generateOutputVars() qtConfig += "accessibility"; if( !qmakeLibs.isEmpty() ) - qmakeVars += "LIBS += " + qmakeLibs.join( " " ); + qmakeVars += "LIBS += " + escapeSeparators(qmakeLibs.join( " " )); if( !dictionary["QT_LFLAGS_SQLITE"].isEmpty() ) - qmakeVars += "QT_LFLAGS_SQLITE += " + dictionary["QT_LFLAGS_SQLITE"]; + qmakeVars += "QT_LFLAGS_SQLITE += " + escapeSeparators(dictionary["QT_LFLAGS_SQLITE"]); if (dictionary[ "QT3SUPPORT" ] == "yes") qtConfig += "qt3support"; @@ -2639,14 +2661,6 @@ void Configure::generateOutputVars() qtConfig += "multimedia"; if (dictionary["AUDIO_BACKEND"] == "yes") qtConfig += "audio-backend"; - if (dictionary["MEDIASERVICES"] == "yes") { - qtConfig += "mediaservices"; - if (dictionary["MEDIA_BACKEND"] == "yes") { - qtConfig += "media-backend"; - if (dictionary["WMSDK"] == "yes") - qtConfig += "wmsdk"; - } - } } if (dictionary["WEBKIT"] == "yes") @@ -2719,14 +2733,14 @@ void Configure::generateOutputVars() if(dictionary.contains("XQMAKESPEC") && dictionary[ "XQMAKESPEC" ].startsWith("linux")) dictionary[ "QMAKE_RPATHDIR" ] = dictionary[ "QT_INSTALL_LIBS" ]; - qmakeVars += QString("OBJECTS_DIR = ") + fixSeparators( "tmp/obj/" + dictionary[ "QMAKE_OUTDIR" ] ); - qmakeVars += QString("MOC_DIR = ") + fixSeparators( "tmp/moc/" + dictionary[ "QMAKE_OUTDIR" ] ); - qmakeVars += QString("RCC_DIR = ") + fixSeparators("tmp/rcc/" + dictionary["QMAKE_OUTDIR"]); + qmakeVars += QString("OBJECTS_DIR = ") + fixSeparators("tmp/obj/" + dictionary[ "QMAKE_OUTDIR" ], true); + qmakeVars += QString("MOC_DIR = ") + fixSeparators("tmp/moc/" + dictionary[ "QMAKE_OUTDIR" ], true); + qmakeVars += QString("RCC_DIR = ") + fixSeparators("tmp/rcc/" + dictionary["QMAKE_OUTDIR"], true); if (!qmakeDefines.isEmpty()) qmakeVars += QString("DEFINES += ") + qmakeDefines.join( " " ); if (!qmakeIncludes.isEmpty()) - qmakeVars += QString("INCLUDEPATH += ") + qmakeIncludes.join( " " ); + qmakeVars += QString("INCLUDEPATH += ") + escapeSeparators(qmakeIncludes.join( " " )); if (!opensslLibs.isEmpty()) qmakeVars += opensslLibs; else if (dictionary[ "OPENSSL" ] == "linked") { @@ -2735,6 +2749,8 @@ void Configure::generateOutputVars() else qmakeVars += QString("OPENSSL_LIBS = -lssleay32 -llibeay32"); } + if (!psqlLibs.isEmpty()) + qmakeVars += QString("QT_LFLAGS_PSQL=") + psqlLibs.section("=", 1); if (!qmakeSql.isEmpty()) qmakeVars += QString("sql-drivers += ") + qmakeSql.join( " " ); if (!qmakeSqlPlugins.isEmpty()) @@ -2798,27 +2814,27 @@ void Configure::generateCachefile() QString targetSpec = dictionary.contains("XQMAKESPEC") ? dictionary[ "XQMAKESPEC" ] : dictionary[ "QMAKESPEC" ]; QString mkspec_path = fixSeparators(sourcePath + "/mkspecs/" + targetSpec); if(QFile::exists(mkspec_path)) - cacheStream << "QMAKESPEC = " << mkspec_path << endl; + cacheStream << "QMAKESPEC = " << escapeSeparators(mkspec_path) << endl; else - cacheStream << "QMAKESPEC = " << fixSeparators(targetSpec) << endl; - cacheStream << "ARCH = " << fixSeparators(dictionary[ "ARCHITECTURE" ]) << endl; - cacheStream << "QT_BUILD_TREE = " << fixSeparators(dictionary[ "QT_BUILD_TREE" ]) << endl; - cacheStream << "QT_SOURCE_TREE = " << fixSeparators(dictionary[ "QT_SOURCE_TREE" ]) << endl; + cacheStream << "QMAKESPEC = " << fixSeparators(targetSpec, true) << endl; + cacheStream << "ARCH = " << dictionary[ "ARCHITECTURE" ] << endl; + cacheStream << "QT_BUILD_TREE = " << fixSeparators(dictionary[ "QT_BUILD_TREE" ], true) << endl; + cacheStream << "QT_SOURCE_TREE = " << fixSeparators(dictionary[ "QT_SOURCE_TREE" ], true) << endl; if (dictionary["QT_EDITION"] != "QT_EDITION_OPENSOURCE") cacheStream << "DEFINES *= QT_EDITION=QT_EDITION_DESKTOP" << endl; //so that we can build without an install first (which would be impossible) - cacheStream << "QMAKE_MOC = $$QT_BUILD_TREE" << fixSeparators("/bin/moc.exe") << endl; - cacheStream << "QMAKE_UIC = $$QT_BUILD_TREE" << fixSeparators("/bin/uic.exe") << endl; - cacheStream << "QMAKE_UIC3 = $$QT_BUILD_TREE" << fixSeparators("/bin/uic3.exe") << endl; - cacheStream << "QMAKE_RCC = $$QT_BUILD_TREE" << fixSeparators("/bin/rcc.exe") << endl; - cacheStream << "QMAKE_DUMPCPP = $$QT_BUILD_TREE" << fixSeparators("/bin/dumpcpp.exe") << endl; - cacheStream << "QMAKE_INCDIR_QT = $$QT_BUILD_TREE" << fixSeparators("/include") << endl; - cacheStream << "QMAKE_LIBDIR_QT = $$QT_BUILD_TREE" << fixSeparators("/lib") << endl; + cacheStream << "QMAKE_MOC = $$QT_BUILD_TREE" << fixSeparators("/bin/moc.exe", true) << endl; + cacheStream << "QMAKE_UIC = $$QT_BUILD_TREE" << fixSeparators("/bin/uic.exe", true) << endl; + cacheStream << "QMAKE_UIC3 = $$QT_BUILD_TREE" << fixSeparators("/bin/uic3.exe", true) << endl; + cacheStream << "QMAKE_RCC = $$QT_BUILD_TREE" << fixSeparators("/bin/rcc.exe", true) << endl; + cacheStream << "QMAKE_DUMPCPP = $$QT_BUILD_TREE" << fixSeparators("/bin/dumpcpp.exe", true) << endl; + cacheStream << "QMAKE_INCDIR_QT = $$QT_BUILD_TREE" << fixSeparators("/include", true) << endl; + cacheStream << "QMAKE_LIBDIR_QT = $$QT_BUILD_TREE" << fixSeparators("/lib", true) << endl; if (dictionary["CETEST"] == "yes") { - cacheStream << "QT_CE_RAPI_INC = " << fixSeparators(dictionary[ "QT_CE_RAPI_INC" ]) << endl; - cacheStream << "QT_CE_RAPI_LIB = " << fixSeparators(dictionary[ "QT_CE_RAPI_LIB" ]) << endl; + cacheStream << "QT_CE_RAPI_INC = " << fixSeparators(dictionary[ "QT_CE_RAPI_INC" ], true) << endl; + cacheStream << "QT_CE_RAPI_LIB = " << fixSeparators(dictionary[ "QT_CE_RAPI_LIB" ], true) << endl; } // embedded @@ -2894,7 +2910,7 @@ void Configure::generateCachefile() << "QT_PATCH_VERSION = " << dictionary["VERSION_PATCH"] << endl; configStream << "#Qt for Windows CE c-runtime deployment" << endl - << "QT_CE_C_RUNTIME = " << fixSeparators(dictionary[ "CE_CRT" ]) << endl; + << "QT_CE_C_RUNTIME = " << fixSeparators(dictionary[ "CE_CRT" ], true) << endl; if(dictionary["CE_SIGNATURE"] != QLatin1String("no")) configStream << "DEFAULT_SIGNATURE=" << dictionary["CE_SIGNATURE"] << endl; @@ -3048,7 +3064,6 @@ 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"; @@ -3075,9 +3090,10 @@ void Configure::generateConfigfiles() if(dictionary["SQL_SQLITE2"] == "yes") qconfigList += "QT_SQL_SQLITE2"; if(dictionary["SQL_IBASE"] == "yes") qconfigList += "QT_SQL_IBASE"; - if (dictionary["GRAPHICS_SYSTEM"] == "openvg") qconfigList += "QT_GRAPHICSSYSTEM_OPENVG"; - if (dictionary["GRAPHICS_SYSTEM"] == "opengl") qconfigList += "QT_GRAPHICSSYSTEM_OPENGL"; - if (dictionary["GRAPHICS_SYSTEM"] == "raster") qconfigList += "QT_GRAPHICSSYSTEM_RASTER"; + if (dictionary["GRAPHICS_SYSTEM"] == "openvg") qconfigList += "QT_GRAPHICSSYSTEM_OPENVG"; + if (dictionary["GRAPHICS_SYSTEM"] == "opengl") qconfigList += "QT_GRAPHICSSYSTEM_OPENGL"; + if (dictionary["GRAPHICS_SYSTEM"] == "raster") qconfigList += "QT_GRAPHICSSYSTEM_RASTER"; + if (dictionary["GRAPHICS_SYSTEM"] == "runtime") qconfigList += "QT_GRAPHICSSYSTEM_RUNTIME"; if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) { // These features are not ported to Symbian (yet) @@ -3212,32 +3228,32 @@ void Configure::generateConfigfiles() << endl; if(!dictionary[ "QT_HOST_PREFIX" ].isNull()) tmpStream << "#if !defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE)" << endl; - tmpStream << "static const char qt_configure_prefix_path_str [512 + 12] = \"qt_prfxpath=" << QString(dictionary["QT_INSTALL_PREFIX"]).replace( "\\", "\\\\" ) << "\";" << endl - << "static const char qt_configure_documentation_path_str[512 + 12] = \"qt_docspath=" << QString(dictionary["QT_INSTALL_DOCS"]).replace( "\\", "\\\\" ) << "\";" << endl - << "static const char qt_configure_headers_path_str [512 + 12] = \"qt_hdrspath=" << QString(dictionary["QT_INSTALL_HEADERS"]).replace( "\\", "\\\\" ) << "\";" << endl - << "static const char qt_configure_libraries_path_str [512 + 12] = \"qt_libspath=" << QString(dictionary["QT_INSTALL_LIBS"]).replace( "\\", "\\\\" ) << "\";" << endl - << "static const char qt_configure_binaries_path_str [512 + 12] = \"qt_binspath=" << QString(dictionary["QT_INSTALL_BINS"]).replace( "\\", "\\\\" ) << "\";" << endl - << "static const char qt_configure_plugins_path_str [512 + 12] = \"qt_plugpath=" << QString(dictionary["QT_INSTALL_PLUGINS"]).replace( "\\", "\\\\" ) << "\";" << endl - << "static const char qt_configure_imports_path_str [512 + 12] = \"qt_impspath=" << QString(dictionary["QT_INSTALL_IMPORTS"]).replace( "\\", "\\\\" ) << "\";" << endl - << "static const char qt_configure_data_path_str [512 + 12] = \"qt_datapath=" << QString(dictionary["QT_INSTALL_DATA"]).replace( "\\", "\\\\" ) << "\";" << endl - << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << QString(dictionary["QT_INSTALL_TRANSLATIONS"]).replace( "\\", "\\\\" ) << "\";" << endl - << "static const char qt_configure_examples_path_str [512 + 12] = \"qt_xmplpath=" << QString(dictionary["QT_INSTALL_EXAMPLES"]).replace( "\\", "\\\\" ) << "\";" << endl - << "static const char qt_configure_demos_path_str [512 + 12] = \"qt_demopath=" << QString(dictionary["QT_INSTALL_DEMOS"]).replace( "\\", "\\\\" ) << "\";" << endl - //<< "static const char qt_configure_settings_path_str [256] = \"qt_stngpath=" << QString(dictionary["QT_INSTALL_SETTINGS"]).replace( "\\", "\\\\" ) << "\";" << endl + tmpStream << "static const char qt_configure_prefix_path_str [512 + 12] = \"qt_prfxpath=" << escapeSeparators(dictionary["QT_INSTALL_PREFIX"]) << "\";" << endl + << "static const char qt_configure_documentation_path_str[512 + 12] = \"qt_docspath=" << escapeSeparators(dictionary["QT_INSTALL_DOCS"]) << "\";" << endl + << "static const char qt_configure_headers_path_str [512 + 12] = \"qt_hdrspath=" << escapeSeparators(dictionary["QT_INSTALL_HEADERS"]) << "\";" << endl + << "static const char qt_configure_libraries_path_str [512 + 12] = \"qt_libspath=" << escapeSeparators(dictionary["QT_INSTALL_LIBS"]) << "\";" << endl + << "static const char qt_configure_binaries_path_str [512 + 12] = \"qt_binspath=" << escapeSeparators(dictionary["QT_INSTALL_BINS"]) << "\";" << endl + << "static const char qt_configure_plugins_path_str [512 + 12] = \"qt_plugpath=" << escapeSeparators(dictionary["QT_INSTALL_PLUGINS"]) << "\";" << endl + << "static const char qt_configure_imports_path_str [512 + 12] = \"qt_impspath=" << escapeSeparators(dictionary["QT_INSTALL_IMPORTS"]) << "\";" << endl + << "static const char qt_configure_data_path_str [512 + 12] = \"qt_datapath=" << escapeSeparators(dictionary["QT_INSTALL_DATA"]) << "\";" << endl + << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << escapeSeparators(dictionary["QT_INSTALL_TRANSLATIONS"]) << "\";" << endl + << "static const char qt_configure_examples_path_str [512 + 12] = \"qt_xmplpath=" << escapeSeparators(dictionary["QT_INSTALL_EXAMPLES"]) << "\";" << endl + << "static const char qt_configure_demos_path_str [512 + 12] = \"qt_demopath=" << escapeSeparators(dictionary["QT_INSTALL_DEMOS"]) << "\";" << endl + //<< "static const char qt_configure_settings_path_str [256] = \"qt_stngpath=" << escapeSeparators(dictionary["QT_INSTALL_SETTINGS"]) << "\";" << endl ; if(!dictionary[ "QT_HOST_PREFIX" ].isNull()) { tmpStream << "#else" << endl - << "static const char qt_configure_prefix_path_str [512 + 12] = \"qt_prfxpath=" << QString(dictionary[ "QT_HOST_PREFIX" ]).replace( "\\", "\\\\" ) << "\";" << endl - << "static const char qt_configure_documentation_path_str[512 + 12] = \"qt_docspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/doc").replace( "\\", "\\\\" ) <<"\";" << endl - << "static const char qt_configure_headers_path_str [512 + 12] = \"qt_hdrspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/include").replace( "\\", "\\\\" ) <<"\";" << endl - << "static const char qt_configure_libraries_path_str [512 + 12] = \"qt_libspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/lib").replace( "\\", "\\\\" ) <<"\";" << endl - << "static const char qt_configure_binaries_path_str [512 + 12] = \"qt_binspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/bin").replace( "\\", "\\\\" ) <<"\";" << endl - << "static const char qt_configure_plugins_path_str [512 + 12] = \"qt_plugpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/plugins").replace( "\\", "\\\\" ) <<"\";" << endl - << "static const char qt_configure_imports_path_str [512 + 12] = \"qt_impspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/imports").replace( "\\", "\\\\" ) <<"\";" << endl - << "static const char qt_configure_data_path_str [512 + 12] = \"qt_datapath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ]).replace( "\\", "\\\\" ) <<"\";" << endl - << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/translations").replace( "\\", "\\\\" ) <<"\";" << endl - << "static const char qt_configure_examples_path_str [512 + 12] = \"qt_xmplpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/example").replace( "\\", "\\\\" ) <<"\";" << endl - << "static const char qt_configure_demos_path_str [512 + 12] = \"qt_demopath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/demos").replace( "\\", "\\\\" ) <<"\";" << endl + << "static const char qt_configure_prefix_path_str [512 + 12] = \"qt_prfxpath=" << escapeSeparators(dictionary[ "QT_HOST_PREFIX" ]) << "\";" << endl + << "static const char qt_configure_documentation_path_str[512 + 12] = \"qt_docspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/doc", true) <<"\";" << endl + << "static const char qt_configure_headers_path_str [512 + 12] = \"qt_hdrspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/include", true) <<"\";" << endl + << "static const char qt_configure_libraries_path_str [512 + 12] = \"qt_libspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/lib", true) <<"\";" << endl + << "static const char qt_configure_binaries_path_str [512 + 12] = \"qt_binspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/bin", true) <<"\";" << endl + << "static const char qt_configure_plugins_path_str [512 + 12] = \"qt_plugpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/plugins", true) <<"\";" << endl + << "static const char qt_configure_imports_path_str [512 + 12] = \"qt_impspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/imports", true) <<"\";" << endl + << "static const char qt_configure_data_path_str [512 + 12] = \"qt_datapath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ], true) <<"\";" << endl + << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/translations", true) <<"\";" << endl + << "static const char qt_configure_examples_path_str [512 + 12] = \"qt_xmplpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/example", true) <<"\";" << endl + << "static const char qt_configure_demos_path_str [512 + 12] = \"qt_demopath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/demos", true) <<"\";" << endl << "#endif //QT_BOOTSTRAPPED" << endl; } tmpStream << "/* strlen( \"qt_lcnsxxxx\" ) == 12 */" << endl @@ -3351,7 +3367,6 @@ 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; @@ -3457,7 +3472,7 @@ void Configure::displayConfig() cout << "NOTE: When linking against OpenSSL, you can override the default" << endl; cout << "library names through OPENSSL_LIBS." << endl; cout << "For example:" << endl; - cout << " configure -openssl-linked OPENSSL_LIBS='-lssleay32 -llibeay32'" << endl; + cout << " configure -openssl-linked OPENSSL_LIBS=\"-lssleay32 -llibeay32\"" << endl; } if( dictionary[ "ZLIB_FORCED" ] == "yes" ) { QString which_zlib = "supplied"; diff --git a/tools/configure/configureapp.h b/tools/configure/configureapp.h index c441129a92..ff2ee8b571 100644 --- a/tools/configure/configureapp.h +++ b/tools/configure/configureapp.h @@ -133,6 +133,7 @@ private: QStringList qmakeIncludes; QStringList qmakeLibs; QString opensslLibs; + QString psqlLibs; QMap<QString,QString> licenseInfo; QString outputLine; @@ -147,7 +148,8 @@ private: int outputWidth; bool useUnixSeparators; - QString fixSeparators(QString somePath); + QString fixSeparators(const QString &somePath, bool escape = false); + QString escapeSeparators(const QString &somePath); bool filesDiffer(const QString &file1, const QString &file2); bool findFile(const QString &fileName); diff --git a/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp b/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp index a25bd5dc4c..55477611c2 100644 --- a/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp +++ b/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp @@ -63,6 +63,7 @@ #include <QtGui/QAction> #include <QtGui/QButtonGroup> #include <QtGui/QMenu> +#include <QtGui/QSortFilterProxyModel> #include <QtGui/QStandardItemModel> #include <QtGui/QComboBox> #include <QtGui/QApplication> @@ -712,9 +713,12 @@ SignalSlotEditorWindow::SignalSlotEditorWindow(QDesignerFormEditorInterface *cor m_remove_button(new QToolButton), m_core(core), m_model(new ConnectionModel(this)), + m_proxy_model(new QSortFilterProxyModel(this)), m_handling_selection_change(false) { - m_view->setModel(m_model); + m_proxy_model->setSourceModel(m_model); + m_view->setModel(m_proxy_model); + m_view->setSortingEnabled(true); m_view->setItemDelegate(new ConnectionDelegate(this)); m_view->setEditTriggers(QAbstractItemView::DoubleClicked | QAbstractItemView::EditKeyPressed); @@ -790,7 +794,7 @@ void SignalSlotEditorWindow::updateDialogSelection(Connection *con) if (m_handling_selection_change || m_editor == 0) return; - QModelIndex index = m_model->connectionToIndex(con); + QModelIndex index = m_proxy_model->mapFromSource(m_model->connectionToIndex(con)); if (index == m_view->currentIndex()) return; m_handling_selection_change = true; @@ -808,7 +812,7 @@ void SignalSlotEditorWindow::updateEditorSelection(const QModelIndex &index) if (m_editor == 0) return; - Connection *con = m_model->indexToConnection(index); + Connection *con = m_model->indexToConnection(m_proxy_model->mapToSource(index)); if (m_editor->selected(con)) return; m_handling_selection_change = true; diff --git a/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.h b/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.h index 9315955989..665f0b73ae 100644 --- a/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.h +++ b/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.h @@ -50,6 +50,7 @@ QT_BEGIN_NAMESPACE class QDesignerFormWindowInterface; class QDesignerFormEditorInterface; class QModelIndex; +class QSortFilterProxyModel; class QTreeView; class QToolButton; @@ -84,6 +85,7 @@ private: QToolButton *m_add_button, *m_remove_button; QDesignerFormEditorInterface *m_core; ConnectionModel *m_model; + QSortFilterProxyModel *m_proxy_model; bool m_handling_selection_change; }; diff --git a/tools/designer/src/designer/qdesigner_actions.cpp b/tools/designer/src/designer/qdesigner_actions.cpp index a593a76a98..86b6214f66 100644 --- a/tools/designer/src/designer/qdesigner_actions.cpp +++ b/tools/designer/src/designer/qdesigner_actions.cpp @@ -347,6 +347,7 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench) connect(m_editWidgetsAction, SIGNAL(triggered()), this, SLOT(editWidgetsSlot())); m_editWidgetsAction->setChecked(true); m_editWidgetsAction->setEnabled(false); + m_editWidgetsAction->setProperty(QDesignerActions::defaultToolbarPropertyName, true); m_toolActions->addAction(m_editWidgetsAction); connect(formWindowManager, SIGNAL(activeFormWindowChanged(QDesignerFormWindowInterface*)), diff --git a/tools/designer/src/lib/sdk/abstractformeditor.cpp b/tools/designer/src/lib/sdk/abstractformeditor.cpp index 5353cab17c..c301f46c1b 100644 --- a/tools/designer/src/lib/sdk/abstractformeditor.cpp +++ b/tools/designer/src/lib/sdk/abstractformeditor.cpp @@ -71,7 +71,6 @@ static void initResources() { Q_INIT_RESOURCE(shared); Q_INIT_RESOURCE(ClamshellPhone); - Q_INIT_RESOURCE(PDAPhone); Q_INIT_RESOURCE(PortableMedia); Q_INIT_RESOURCE(S60_nHD_Touchscreen); Q_INIT_RESOURCE(S60_QVGA_Candybar); @@ -79,8 +78,6 @@ static void initResources() Q_INIT_RESOURCE(SmartPhone); Q_INIT_RESOURCE(SmartPhoneWithButtons); Q_INIT_RESOURCE(TouchscreenPhone); - Q_INIT_RESOURCE(Trolltech_Keypad); - Q_INIT_RESOURCE(Trolltech_Touchscreen); } QT_BEGIN_NAMESPACE diff --git a/tools/designer/src/lib/shared/filterwidget.cpp b/tools/designer/src/lib/shared/filterwidget.cpp index 9363b7ced4..a501c02010 100644 --- a/tools/designer/src/lib/shared/filterwidget.cpp +++ b/tools/designer/src/lib/shared/filterwidget.cpp @@ -163,7 +163,7 @@ FilterWidget::FilterWidget(QWidget *parent, LayoutMode lm) : m_editor->setPlaceholderText(tr("Filter")); // Let the style determine minimum height for our widget - QSize size(ICONBUTTON_SIZE + 2, ICONBUTTON_SIZE + 2); + QSize size(ICONBUTTON_SIZE + 6, ICONBUTTON_SIZE + 2); // Note KDE does not reserve space for the highlight color if (style()->inherits("OxygenStyle")) { diff --git a/tools/designer/src/lib/shared/previewconfigurationwidget.cpp b/tools/designer/src/lib/shared/previewconfigurationwidget.cpp index e07d155de6..d116d5831d 100644 --- a/tools/designer/src/lib/shared/previewconfigurationwidget.cpp +++ b/tools/designer/src/lib/shared/previewconfigurationwidget.cpp @@ -41,7 +41,7 @@ /* It is possible to link the skins as resources into Designer by specifying: * QVFB_ROOT=$$QT_SOURCE_TREE/tools/qvfb - * RESOURCES += $$QVFB_ROOT/ClamshellPhone.qrc $$QVFB_ROOT/PDAPhone.qrc ... + * RESOURCES += $$QVFB_ROOT/ClamshellPhone.qrc $$QVFB_ROOT/TouchScreenPhone.qrc ... * in lib/shared/shared.pri. However, this exceeds a limit of Visual Studio 6. */ #include "previewconfigurationwidget_p.h" diff --git a/tools/linguist/lconvert/main.cpp b/tools/linguist/lconvert/main.cpp index 543c405f6f..094406c984 100644 --- a/tools/linguist/lconvert/main.cpp +++ b/tools/linguist/lconvert/main.cpp @@ -240,7 +240,7 @@ int main(int argc, char *argv[]) tr.setLanguageCode(Translator::guessLanguageCodeFromFileName(inFiles[0].name)); if (!tr.load(inFiles[0].name, cd, inFiles[0].format)) { - qWarning() << qPrintable(cd.error()); + std::cerr << qPrintable(cd.error()); return 2; } tr.reportDuplicates(tr.resolveDuplicates(), inFiles[0].name, verbose); @@ -248,7 +248,7 @@ int main(int argc, char *argv[]) for (int i = 1; i < inFiles.size(); ++i) { Translator tr2; if (!tr2.load(inFiles[i].name, cd, inFiles[i].format)) { - qWarning() << qPrintable(cd.error()); + std::cerr << qPrintable(cd.error()); return 2; } tr2.reportDuplicates(tr2.resolveDuplicates(), inFiles[i].name, verbose); @@ -273,11 +273,11 @@ int main(int argc, char *argv[]) tr.normalizeTranslations(cd); if (!cd.errors().isEmpty()) { - qWarning("%s", qPrintable(cd.error())); + std::cerr << qPrintable(cd.error()); cd.clearErrors(); } if (!tr.save(outFileName, cd, outFormat)) { - qWarning("%s", qPrintable(cd.error())); + std::cerr << qPrintable(cd.error()); return 3; } return 0; diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp index 266474e22a..b5cff90a77 100644 --- a/tools/linguist/lrelease/main.cpp +++ b/tools/linguist/lrelease/main.cpp @@ -55,6 +55,8 @@ #include <QtCore/QStringList> #include <QtCore/QTextStream> +#include <iostream> + QT_USE_NAMESPACE #ifdef QT_BOOTSTRAPPED @@ -106,7 +108,7 @@ static bool loadTsFile(Translator &tor, const QString &tsFileName, bool /* verbo ConversionData cd; bool ok = tor.load(tsFileName, cd, QLatin1String("auto")); if (!ok) { - qWarning("lrelease error: %s\n", qPrintable(cd.error())); + std::cerr << "lrelease error: " << qPrintable(cd.error()); } else { if (!cd.errors().isEmpty()) printOut(cd.error()); @@ -130,8 +132,8 @@ static bool releaseTranslator(Translator &tor, const QString &qmFileName, QFile file(qmFileName); if (!file.open(QIODevice::WriteOnly)) { - qWarning("lrelease error: cannot create '%s': %s\n", - qPrintable(qmFileName), qPrintable(file.errorString())); + std::cerr << "lrelease error: cannot create '" << qPrintable(qmFileName) + << "': " << qPrintable(file.errorString()) << std::endl; return false; } @@ -140,8 +142,8 @@ static bool releaseTranslator(Translator &tor, const QString &qmFileName, file.close(); if (!ok) { - qWarning("lrelease error: cannot save '%s': %s\n", - qPrintable(qmFileName), qPrintable(cd.error())); + std::cerr << "lrelease error: cannot save '" << qPrintable(qmFileName) + << "': " << qPrintable(cd.error()); } else if (!cd.errors().isEmpty()) { printOut(cd.error()); } @@ -253,19 +255,20 @@ int main(int argc, char **argv) visitor.setVerbose(cd.isVerbose()); if (!visitor.queryProFile(&pro)) { - qWarning("lrelease error: cannot read project file '%s'.", qPrintable(inputFile)); + std::cerr << "lrelease error: cannot read project file '" + << qPrintable(inputFile) << "'.\n"; continue; } if (!visitor.accept(&pro)) { - qWarning("lrelease error: cannot process project file '%s'.", qPrintable(inputFile)); + std::cerr << "lrelease error: cannot process project file '" + << qPrintable(inputFile) << "'.\n"; continue; } QStringList translations = visitor.values(QLatin1String("TRANSLATIONS")); if (translations.isEmpty()) { - qWarning("lrelease warning: Met no 'TRANSLATIONS' entry in" - " project file '%s'\n", - qPrintable(inputFile)); + std::cerr << "lrelease warning: Met no 'TRANSLATIONS' entry in project file '" + << qPrintable(inputFile) << "'\n"; } else { QDir proDir(fi.absolutePath()); foreach (const QString &trans, translations) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index db4bbcac2e..b3e7e84f80 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -51,6 +51,8 @@ #include <QtCore/QTextCodec> #include <QtCore/QTextStream> +#include <iostream> + #include <ctype.h> // for isXXX() QT_BEGIN_NAMESPACE @@ -226,6 +228,8 @@ private: int elseLine; }; + std::ostream &yyMsg(int line = 0); + uint getChar(); uint getToken(); bool getMacroArgs(); @@ -352,6 +356,12 @@ CppParser::CppParser(ParseResults *_results) inDefine = false; } + +std::ostream &CppParser::yyMsg(int line) +{ + return std::cerr << qPrintable(yyFileName) << ':' << (line ? line : yyLineNo) << ": "; +} + void CppParser::setInput(const QString &in) { yyInStr = in; @@ -613,9 +623,9 @@ uint CppParser::getToken() if (yyBracketDepth != is.bracketDepth1st || yyBraceDepth != is.braceDepth1st || yyParenDepth != is.parenDepth1st) - qWarning("%s:%d: Parenthesis/bracket/brace mismatch between " - "#if and #else branches; using #if branch\n", - qPrintable(yyFileName), is.elseLine); + yyMsg(is.elseLine) + << "Parenthesis/bracket/brace mismatch between " + "#if and #else branches; using #if branch\n"; } else { is.bracketDepth1st = yyBracketDepth; is.braceDepth1st = yyBraceDepth; @@ -636,9 +646,9 @@ uint CppParser::getToken() if (yyBracketDepth != is.bracketDepth1st || yyBraceDepth != is.braceDepth1st || yyParenDepth != is.parenDepth1st) - qWarning("%s:%d: Parenthesis/brace mismatch between " - "#if and #else branches; using #if branch\n", - qPrintable(yyFileName), is.elseLine); + yyMsg(is.elseLine) + << "Parenthesis/brace mismatch between " + "#if and #else branches; using #if branch\n"; yyBracketDepth = is.bracketDepth1st; yyBraceDepth = is.braceDepth1st; yyParenDepth = is.parenDepth1st; @@ -664,8 +674,7 @@ uint CppParser::getToken() forever { yyCh = getChar(); if (yyCh == EOF) { - qWarning("%s:%d: Unterminated C++ comment\n", - qPrintable(yyFileName), yyLineNo); + yyMsg() << "Unterminated C++ comment\n"; break; } @@ -795,8 +804,7 @@ uint CppParser::getToken() forever { yyCh = getChar(); if (yyCh == EOF) { - qWarning("%s:%d: Unterminated C++ comment\n", - qPrintable(yyFileName), yyLineNo); + yyMsg() << "Unterminated C++ comment\n"; break; } *ptr++ = yyCh; @@ -829,8 +837,7 @@ uint CppParser::getToken() yyWord.resize(ptr - (ushort *)yyWord.unicode()); if (yyCh != '"') - qWarning("%s:%d: Unterminated C++ string\n", - qPrintable(yyFileName), yyLineNo); + yyMsg() << "Unterminated C++ string\n"; else yyCh = getChar(); return Tok_String; @@ -867,8 +874,7 @@ uint CppParser::getToken() forever { if (yyCh == EOF || yyCh == '\n') { - qWarning("%s:%d: Unterminated C++ character\n", - qPrintable(yyFileName), yyLineNo); + yyMsg() << "Unterminated C++ character\n"; break; } yyCh = getChar(); @@ -887,9 +893,9 @@ uint CppParser::getToken() case '}': if (yyBraceDepth == yyMinBraceDepth) { if (!inDefine) - qWarning("%s:%d: Excess closing brace in C++ code" - " (or abuse of the C++ preprocessor)\n", - qPrintable(yyFileName), yyCurLineNo); + yyMsg(yyCurLineNo) + << "Excess closing brace in C++ code" + " (or abuse of the C++ preprocessor)\n"; // Avoid things getting messed up even more yyCh = getChar(); return Tok_Semicolon; @@ -905,9 +911,9 @@ uint CppParser::getToken() return Tok_LeftParen; case ')': if (yyParenDepth == 0) - qWarning("%s:%d: Excess closing parenthesis in C++ code" - " (or abuse of the C++ preprocessor)\n", - qPrintable(yyFileName), yyCurLineNo); + yyMsg(yyCurLineNo) + << "Excess closing parenthesis in C++ code" + " (or abuse of the C++ preprocessor)\n"; else yyParenDepth--; yyCh = getChar(); @@ -920,9 +926,9 @@ uint CppParser::getToken() return Tok_LeftBracket; case ']': if (yyBracketDepth == 0) - qWarning("%s:%d: Excess closing bracket in C++ code" - " (or abuse of the C++ preprocessor)\n", - qPrintable(yyFileName), yyCurLineNo); + yyMsg(yyCurLineNo) + << "Excess closing bracket in C++ code" + " (or abuse of the C++ preprocessor)\n"; else yyBracketDepth--; yyCh = getChar(); @@ -1290,8 +1296,7 @@ void CppParser::processInclude(const QString &file, ConversionData &cd, QString cleanFile = QDir::cleanPath(file); if (inclusions.contains(cleanFile)) { - qWarning("%s:%d: circular inclusion of %s\n", - qPrintable(yyFileName), yyLineNo, qPrintable(cleanFile)); + yyMsg() << "circular inclusion of " << qPrintable(cleanFile) << std::endl; return; } @@ -1315,9 +1320,9 @@ void CppParser::processInclude(const QString &file, ConversionData &cd, QFile f(cleanFile); if (!f.open(QIODevice::ReadOnly)) { - qWarning("%s:%d: Cannot open %s: %s\n", - qPrintable(yyFileName), yyLineNo, - qPrintable(cleanFile), qPrintable(f.errorString())); + yyMsg() + << "Cannot open " << qPrintable(cleanFile) << ": " + << qPrintable(f.errorString()) << std::endl; return; } @@ -1656,8 +1661,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) // Forward-declared class definitions can be namespaced. NamespaceList nsl; if (!fullyQualify(namespaces, quali, true, &nsl, 0)) { - qWarning("%s:%d: Ignoring definition of undeclared qualified class\n", - qPrintable(yyFileName), yyLineNo); + yyMsg() << "Ignoring definition of undeclared qualified class\n"; break; } namespaceDepths.push(namespaces.count()); @@ -1757,8 +1761,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) if (!tor) goto case_default; if (!sourcetext.isEmpty()) - qWarning("%s:%d: //%% cannot be used with tr() / QT_TR_NOOP(). Ignoring\n", - qPrintable(yyFileName), yyLineNo); + yyMsg() << "//%% cannot be used with tr() / QT_TR_NOOP(). Ignoring\n"; utf8 = (yyTok == Tok_trUtf8); line = yyLineNo; yyTok = getToken(); @@ -1779,10 +1782,9 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) QStringList unresolved; if (!fullyQualify(namespaces, pendingContext, true, &functionContext, &unresolved)) { functionContextUnresolved = unresolved.join(strColons); - qWarning("%s:%d: Qualifying with unknown namespace/class %s::%s\n", - qPrintable(yyFileName), yyLineNo, - qPrintable(stringifyNamespace(functionContext)), - qPrintable(unresolved.first())); + yyMsg() << "Qualifying with unknown namespace/class " + << qPrintable(stringifyNamespace(functionContext)) << "::" + << qPrintable(unresolved.first()) << std::endl; } pendingContext.clear(); } @@ -1790,8 +1792,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) if (functionContextUnresolved.isEmpty()) { int idx = functionContext.length(); if (idx < 2) { - qWarning("%s:%d: tr() cannot be called without context\n", - qPrintable(yyFileName), yyLineNo); + yyMsg() << "tr() cannot be called without context\n"; break; } Namespace *fctx; @@ -1800,9 +1801,8 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) context = stringifyNamespace(functionContext); fctx = findNamespace(functionContext)->classDef; if (!fctx->complained) { - qWarning("%s:%d: Class '%s' lacks Q_OBJECT macro\n", - qPrintable(yyFileName), yyLineNo, - qPrintable(context)); + yyMsg() << "Class '" << qPrintable(context) + << "' lacks Q_OBJECT macro\n"; fctx->complained = true; } goto gotctx; @@ -1830,9 +1830,8 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) int last = prefix.lastIndexOf(strColons); QString className = prefix.mid(last == -1 ? 0 : last + 2); if (!className.isEmpty() && className == functionName) { - qWarning("%s::%d: It is not recommended to call tr() from within a constructor '%s::%s' ", - qPrintable(yyFileName), yyLineNo, - className.constData(), functionName.constData()); + yyMsg() << "It is not recommended to call tr() from within a constructor '" + << qPrintable(className) << "::" << qPrintable(functionName) << "'\n"; } #endif prefix.chop(2); @@ -1847,9 +1846,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) context = fctx->trQualification; } if (!fctx->hasTrFunctions && !fctx->complained) { - qWarning("%s:%d: Class '%s' lacks Q_OBJECT macro\n", - qPrintable(yyFileName), yyLineNo, - qPrintable(context)); + yyMsg() << "Class '" << qPrintable(context) << "' lacks Q_OBJECT macro\n"; fctx->complained = true; } } else { @@ -1870,8 +1867,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) if (!tor) goto case_default; if (!sourcetext.isEmpty()) - qWarning("%s:%d: //%% cannot be used with translate() / QT_TRANSLATE_NOOP(). Ignoring\n", - qPrintable(yyFileName), yyLineNo); + yyMsg() << "//%% cannot be used with translate() / QT_TRANSLATE_NOOP(). Ignoring\n"; utf8 = (yyTok == Tok_translateUtf8); line = yyLineNo; yyTok = getToken(); @@ -1925,8 +1921,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) if (!tor) goto case_default; if (!msgid.isEmpty()) - qWarning("%s:%d: //= cannot be used with qtTrId() / QT_TRID_NOOP(). Ignoring\n", - qPrintable(yyFileName), yyLineNo); + yyMsg() << "//= cannot be used with qtTrId() / QT_TRID_NOOP(). Ignoring\n"; //utf8 = false; // Maybe use //%% or something like that line = yyLineNo; yyTok = getToken(); @@ -1993,15 +1988,13 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) if (isspace(c)) continue; if (c != '"') { - qWarning("%s:%d: Unexpected character in meta string\n", - qPrintable(yyFileName), yyLineNo); + yyMsg() << "Unexpected character in meta string\n"; break; } forever { if (p >= yyWord.length()) { whoops: - qWarning("%s:%d: Unterminated meta string\n", - qPrintable(yyFileName), yyLineNo); + yyMsg() << "Unterminated meta string\n"; break; } c = yyWord.unicode()[p++].unicode(); @@ -2054,8 +2047,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) case Tok_Arrow: yyTok = getToken(); if (yyTok == Tok_tr || yyTok == Tok_trUtf8) - qWarning("%s:%d: Cannot invoke tr() like this\n", - qPrintable(yyFileName), yyLineNo); + yyMsg() << "Cannot invoke tr() like this\n"; break; case Tok_ColonColon: if (yyBraceDepth == namespaceDepths.count() && yyParenDepth == 0 && !yyTokColonSeen) @@ -2123,17 +2115,17 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) } if (yyBraceDepth != 0) - qWarning("%s:%d: Unbalanced opening brace in C++ code" - " (or abuse of the C++ preprocessor)\n", - qPrintable(yyFileName), yyBraceLineNo); + yyMsg(yyBraceLineNo) + << "Unbalanced opening brace in C++ code" + " (or abuse of the C++ preprocessor)\n"; else if (yyParenDepth != 0) - qWarning("%s:%d: Unbalanced opening parenthesis in C++ code" - " (or abuse of the C++ preprocessor)\n", - qPrintable(yyFileName), yyParenLineNo); + yyMsg(yyParenLineNo) + << "Unbalanced opening parenthesis in C++ code" + " (or abuse of the C++ preprocessor)\n"; else if (yyBracketDepth != 0) - qWarning("%s:%d: Unbalanced opening bracket in C++ code" - " (or abuse of the C++ preprocessor)\n", - qPrintable(yyFileName), yyBracketLineNo); + yyMsg(yyBracketLineNo) + << "Unbalanced opening bracket in C++ code" + " (or abuse of the C++ preprocessor)\n"; } const ParseResults *CppParser::recordResults(bool isHeader) diff --git a/tools/linguist/lupdate/java.cpp b/tools/linguist/lupdate/java.cpp index 27988b0458..dc66e2b365 100644 --- a/tools/linguist/lupdate/java.cpp +++ b/tools/linguist/lupdate/java.cpp @@ -51,6 +51,8 @@ #include <QtCore/QString> #include <QtCore/QTextCodec> +#include <iostream> + #include <ctype.h> QT_BEGIN_NAMESPACE @@ -107,6 +109,11 @@ static QString yyPackage; static QStack<Scope*> yyScope; static QString yyDefaultContext; +std::ostream &yyMsg(int line = 0) +{ + return std::cerr << qPrintable(yyFileName) << ':' << (line ? line : yyLineNo) << ": "; +} + static QChar getChar() { if (yyInPos >= yyInStr.size()) @@ -189,10 +196,7 @@ static int getToken() while ( !metAsterSlash ) { yyCh = getChar(); if ( yyCh == EOF ) { - qFatal( "%s: Unterminated Java comment starting at" - " line %d\n", - qPrintable(yyFileName), yyLineNo ); - + yyMsg() << "Unterminated Java comment.\n"; return Tok_Comment; } @@ -228,8 +232,8 @@ static int getToken() else { int sub(yyCh.toLower().toAscii() - 87); if( sub > 15 || sub < 10) { - qFatal( "%s:%d: Invalid Unicode", - qPrintable(yyFileName), yyLineNo ); + yyMsg() << "Invalid Unicode value.\n"; + break; } unicode += sub; } @@ -251,8 +255,7 @@ static int getToken() } if ( yyCh != QLatin1Char('"') ) - qFatal( "%s:%d: Unterminated string", - qPrintable(yyFileName), yyLineNo ); + yyMsg() << "Unterminated string.\n"; yyCh = getChar(); @@ -365,9 +368,8 @@ static bool matchString( QString &s ) if (yyTok == Tok_String) s += yyString; else { - qWarning( "%s:%d: String used in translation can only contain strings" - " concatenated with other strings, not expressions or numbers.", - qPrintable(yyFileName), yyLineNo ); + yyMsg() << "String used in translation can contain only literals" + " concatenated with other literals, not expressions or numbers.\n"; return false; } yyTok = getToken(); @@ -475,8 +477,8 @@ static void parse( Translator *tor ) yyScope.push(new Scope(yyIdent, Scope::Clazz, yyLineNo)); } else { - qFatal( "%s:%d: Class must be followed by a classname", - qPrintable(yyFileName), yyLineNo ); + yyMsg() << "'class' must be followed by a class name.\n"; + break; } while (!match(Tok_LeftBrace)) { yyTok = getToken(); @@ -547,8 +549,7 @@ static void parse( Translator *tor ) case Tok_RightBrace: if ( yyScope.isEmpty() ) { - qFatal( "%s:%d: Unbalanced right brace in Java code\n", - qPrintable(yyFileName), yyLineNo ); + yyMsg() << "Excess closing brace.\n"; } else delete (yyScope.pop()); @@ -577,8 +578,7 @@ static void parse( Translator *tor ) yyPackage.append(QLatin1String(".")); break; default: - qFatal( "%s:%d: Package keyword should be followed by com.package.name;", - qPrintable(yyFileName), yyLineNo ); + yyMsg() << "'package' must be followed by package name.\n"; break; } yyTok = getToken(); @@ -591,11 +591,9 @@ static void parse( Translator *tor ) } if ( !yyScope.isEmpty() ) - qFatal( "%s:%d: Unbalanced braces in Java code\n", - qPrintable(yyFileName), yyScope.top()->line ); + yyMsg(yyScope.top()->line) << "Unbalanced opening brace.\n"; else if ( yyParenDepth != 0 ) - qFatal( "%s:%d: Unbalanced parentheses in Java code\n", - qPrintable(yyFileName), yyParenLineNo ); + yyMsg(yyParenLineNo) << "Unbalanced opening parenthesis.\n"; } diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index 6c9157a3ec..a575192005 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -57,16 +57,15 @@ static QString m_defaultExtensions; -static void printErr(const QString & out) -{ - qWarning("%s", qPrintable(out)); -} - static void printOut(const QString & out) { std::cerr << qPrintable(out); } +class LU { + Q_DECLARE_TR_FUNCTIONS(LUpdate) +}; + static void recursiveFileInfoList(const QDir &dir, const QSet<QString> &nameFilters, QDir::Filters filter, QFileInfoList *fileinfolist) @@ -150,24 +149,25 @@ static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFil cd.m_sortContexts = !(options & NoSort); if (QFile(fileName).exists()) { if (!tor.load(fileName, cd, QLatin1String("auto"))) { - printErr(cd.error()); + printOut(cd.error()); *fail = true; continue; } tor.resolveDuplicates(); cd.clearErrors(); if (setCodec && fetchedTor.codec() != tor.codec()) - qWarning("lupdate warning: Codec for tr() '%s' disagrees with " - "existing file's codec '%s'. Expect trouble.", - fetchedTor.codecName().constData(), tor.codecName().constData()); + printOut(LU::tr("lupdate warning: Codec for tr() '%1' disagrees with" + " existing file's codec '%2'. Expect trouble.\n") + .arg(QString::fromLatin1(fetchedTor.codecName()), + QString::fromLatin1(tor.codecName()))); if (!targetLanguage.isEmpty() && targetLanguage != tor.languageCode()) - qWarning("lupdate warning: Specified target language '%s' disagrees with " - "existing file's language '%s'. Ignoring.", - qPrintable(targetLanguage), qPrintable(tor.languageCode())); + printOut(LU::tr("lupdate warning: Specified target language '%1' disagrees with" + " existing file's language '%2'. Ignoring.\n") + .arg(targetLanguage, tor.languageCode())); if (!sourceLanguage.isEmpty() && sourceLanguage != tor.sourceLanguageCode()) - qWarning("lupdate warning: Specified source language '%s' disagrees with " - "existing file's language '%s'. Ignoring.", - qPrintable(sourceLanguage), qPrintable(tor.sourceLanguageCode())); + printOut(LU::tr("lupdate warning: Specified source language '%1' disagrees with" + " existing file's language '%2'. Ignoring.\n") + .arg(sourceLanguage, tor.sourceLanguageCode())); } else { if (setCodec) tor.setCodec(fetchedTor.codec()); @@ -210,11 +210,11 @@ static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFil out.normalizeTranslations(cd); if (!cd.errors().isEmpty()) { - printErr(cd.error()); + printOut(cd.error()); cd.clearErrors(); } if (!out.save(fileName, cd, QLatin1String("auto"))) { - printErr(cd.error()); + printOut(cd.error()); *fail = true; } } @@ -296,8 +296,9 @@ static void processProject( if (!tmp.isEmpty()) { codecForSource = tmp.last().toLatin1(); if (!QTextCodec::codecForName(codecForSource)) { - qWarning("lupdate warning: Codec for source '%s' is invalid. " - "Falling back to codec for tr().", codecForSource.constData()); + printOut(LU::tr("lupdate warning: Codec for source '%1' is invalid." + " Falling back to codec for tr().\n") + .arg(QString::fromLatin1(codecForSource))); codecForSource.clear(); } } @@ -452,7 +453,7 @@ int main(int argc, char **argv) } else if (arg == QLatin1String("-target-language")) { ++i; if (i == argc) { - qWarning("The option -target-language requires a parameter."); + printOut(LU::tr("The option -target-language requires a parameter.\n")); return 1; } targetLanguage = args[i]; @@ -460,7 +461,7 @@ int main(int argc, char **argv) } else if (arg == QLatin1String("-source-language")) { ++i; if (i == argc) { - qWarning("The option -source-language requires a parameter."); + printOut(LU::tr("The option -source-language requires a parameter.\n")); return 1; } sourceLanguage = args[i]; @@ -468,7 +469,7 @@ int main(int argc, char **argv) } else if (arg == QLatin1String("-disable-heuristic")) { ++i; if (i == argc) { - qWarning("The option -disable-heuristic requires a parameter."); + printOut(LU::tr("The option -disable-heuristic requires a parameter.\n")); return 1; } arg = args[i]; @@ -479,14 +480,14 @@ int main(int argc, char **argv) } else if (arg == QLatin1String("number")) { options &= ~HeuristicNumber; } else { - qWarning("Invalid heuristic name passed to -disable-heuristic."); + printOut(LU::tr("Invalid heuristic name passed to -disable-heuristic.\n")); return 1; } continue; } else if (arg == QLatin1String("-locations")) { ++i; if (i == argc) { - qWarning("The option -locations requires a parameter."); + printOut(LU::tr("The option -locations requires a parameter.\n")); return 1; } if (args[i] == QLatin1String("none")) { @@ -496,7 +497,7 @@ int main(int argc, char **argv) } else if (args[i] == QLatin1String("absolute")) { options |= AbsoluteLocations; } else { - qWarning("Invalid parameter passed to -locations."); + printOut(LU::tr("Invalid parameter passed to -locations.\n")); return 1; } continue; @@ -522,7 +523,7 @@ int main(int argc, char **argv) } else if (arg == QLatin1String("-codecfortr")) { ++i; if (i == argc) { - qWarning("The -codecfortr option should be followed by a codec name."); + printOut(LU::tr("The -codecfortr option should be followed by a codec name.\n")); return 1; } codecForTr = args[i].toLatin1(); @@ -533,7 +534,7 @@ int main(int argc, char **argv) } else if (arg == QLatin1String("-extensions")) { ++i; if (i == argc) { - qWarning("The -extensions option should be followed by an extension list."); + printOut(LU::tr("The -extensions option should be followed by an extension list.\n")); return 1; } extensions = args[i]; @@ -541,7 +542,7 @@ int main(int argc, char **argv) } else if (arg == QLatin1String("-pro")) { ++i; if (i == argc) { - qWarning("The -pro option should be followed by a filename of .pro file."); + printOut(LU::tr("The -pro option should be followed by a filename of .pro file.\n")); return 1; } proFiles += args[i]; @@ -551,7 +552,7 @@ int main(int argc, char **argv) if (arg.length() == 2) { ++i; if (i == argc) { - qWarning("The -I option should be followed by a path."); + printOut(LU::tr("The -I option should be followed by a path.\n")); return 1; } includePath += args[i]; @@ -560,7 +561,7 @@ int main(int argc, char **argv) } continue; } else if (arg.startsWith(QLatin1String("-")) && arg != QLatin1String("-")) { - qWarning("Unrecognized option '%s'", qPrintable(arg)); + printOut(LU::tr("Unrecognized option '%1'.\n").arg(arg)); return 1; } @@ -568,8 +569,8 @@ int main(int argc, char **argv) if (arg.startsWith(QLatin1String("@"))) { QFile lstFile(arg.mid(1)); if (!lstFile.open(QIODevice::ReadOnly)) { - qWarning("lupdate error: List file '%s' is not readable", - qPrintable(lstFile.fileName())); + printOut(LU::tr("lupdate error: List file '%1' is not readable.\n") + .arg(lstFile.fileName())); return 1; } while (!lstFile.atEnd()) @@ -586,16 +587,16 @@ int main(int argc, char **argv) if (!fi.exists() || fi.isWritable()) { tsFileNames.append(QFileInfo(file).absoluteFilePath()); } else { - qWarning("lupdate warning: For some reason, '%s' is not writable.\n", - qPrintable(file)); + printOut(LU::tr("lupdate warning: For some reason, '%1' is not writable.\n") + .arg(file)); } found = true; break; } } if (!found) { - qWarning("lupdate error: File '%s' has no recognized extension\n", - qPrintable(file)); + printOut(LU::tr("lupdate error: File '%1' has no recognized extension.\n") + .arg(file)); return 1; } } @@ -604,7 +605,7 @@ int main(int argc, char **argv) foreach (const QString &file, files) { QFileInfo fi(file); if (!fi.exists()) { - qWarning("lupdate error: File '%s' does not exists\n", qPrintable(file)); + printOut(LU::tr("lupdate error: File '%1' does not exist.\n").arg(file)); return 1; } if (file.endsWith(QLatin1String(".pro"), Qt::CaseInsensitive) @@ -612,7 +613,7 @@ int main(int argc, char **argv) proFiles << file; } else if (fi.isDir()) { if (options & Verbose) - printOut(QObject::tr("Scanning directory '%1'...").arg(file)); + printOut(QObject::tr("Scanning directory '%1'...\n").arg(file)); QDir dir = QDir(fi.filePath()); projectRoots.insert(dir.absolutePath() + QLatin1Char('/')); if (extensionsNameFilters.isEmpty()) { @@ -650,6 +651,7 @@ int main(int argc, char **argv) } } else { sourceFiles << QDir::cleanPath(fi.absoluteFilePath());; + projectRoots.insert(fi.absolutePath() + QLatin1Char('/')); } } numFiles++; @@ -662,16 +664,16 @@ int main(int argc, char **argv) } if (!targetLanguage.isEmpty() && tsFileNames.count() != 1) - std::cerr << "lupdate warning: -target-language usually only " - "makes sense with exactly one TS file.\n"; + printOut(LU::tr("lupdate warning: -target-language usually only" + " makes sense with exactly one TS file.\n")); if (!codecForTr.isEmpty() && tsFileNames.isEmpty()) - std::cerr << "lupdate warning: -codecfortr has no effect without -ts.\n"; + printOut(LU::tr("lupdate warning: -codecfortr has no effect without -ts.\n")); bool fail = false; if (proFiles.isEmpty()) { if (tsFileNames.isEmpty()) - std::cerr << "lupdate warning: no TS files specified. " - "Only diagnostics will be produced.\n"; + printOut(LU::tr("lupdate warning:" + " no TS files specified. Only diagnostics will be produced.\n")); Translator fetchedTor; ConversionData cd; @@ -685,7 +687,8 @@ int main(int argc, char **argv) sourceLanguage, targetLanguage, options, &fail); } else { if (!sourceFiles.isEmpty() || !includePath.isEmpty()) { - qWarning("lupdate error: Both project and source files / include paths specified.\n"); + printOut(LU::tr("lupdate error:" + " Both project and source files / include paths specified.\n")); return 1; } if (!tsFileNames.isEmpty()) { diff --git a/tools/linguist/lupdate/qscript.cpp b/tools/linguist/lupdate/qscript.cpp index 33276e67aa..188ac3695f 100644 --- a/tools/linguist/lupdate/qscript.cpp +++ b/tools/linguist/lupdate/qscript.cpp @@ -53,6 +53,8 @@ #include <QtCore/qtextcodec.h> #include <QtCore/qvariant.h> +#include <iostream> + #include <ctype.h> #include <stdlib.h> #include <stdio.h> @@ -2214,13 +2216,13 @@ case 66: { if ((name == QLatin1String("qsTranslate")) || (name == QLatin1String("QT_TRANSLATE_NOOP"))) { QVariantList args = sym(2).toList(); if (args.size() < 2) { - qWarning("%s:%d: %s() requires at least two arguments", - qPrintable(fileName), identLineNo, qPrintable(name)); + std::cerr << qPrintable(fileName) << ':' << identLineNo << ": " + << qPrintable(name) << "() requires at least two arguments.\n"; } else { if ((args.at(0).type() != QVariant::String) || (args.at(1).type() != QVariant::String)) { - qWarning("%s:%d: %s(): both arguments must be literal strings", - qPrintable(fileName), identLineNo, qPrintable(name)); + std::cerr << qPrintable(fileName) << ':' << identLineNo << ": " + << qPrintable(name) << "(): both arguments must be literal strings.\n"; } else { QString context = args.at(0).toString(); QString text = args.at(1).toString(); @@ -2234,12 +2236,12 @@ case 66: { } else if ((name == QLatin1String("qsTr")) || (name == QLatin1String("QT_TR_NOOP"))) { QVariantList args = sym(2).toList(); if (args.size() < 1) { - qWarning("%s:%d: %s() requires at least one argument", - qPrintable(fileName), identLineNo, qPrintable(name)); + std::cerr << qPrintable(fileName) << ':' << identLineNo << ": " + << qPrintable(name) << "() requires at least one argument.\n"; } else { if (args.at(0).type() != QVariant::String) { - qWarning("%s:%d: %s(): text to translate must be a literal string", - qPrintable(fileName), identLineNo, qPrintable(name)); + std::cerr << qPrintable(fileName) << ':' << identLineNo << ": " + << qPrintable(name) << "(): text to translate must be a literal string.\n"; } else { QString context = QFileInfo(fileName).baseName(); QString text = args.at(0).toString(); @@ -2377,8 +2379,8 @@ bool loadQScript(Translator &translator, const QString &filename, ConversionData lexer.setCode(code, /*lineNumber=*/1); QScriptParser parser; if (!parser.parse(&lexer, filename, &translator)) { - qWarning("%s:%d: %s", qPrintable(filename), parser.errorLineNumber(), - qPrintable(parser.errorMessage())); + std::cerr << qPrintable(filename) << ':' << parser.errorLineNumber() << ": " + << qPrintable(parser.errorMessage()) << std::endl; return false; } diff --git a/tools/linguist/lupdate/qscript.g b/tools/linguist/lupdate/qscript.g index a473500ad5..857c58ab5d 100644 --- a/tools/linguist/lupdate/qscript.g +++ b/tools/linguist/lupdate/qscript.g @@ -90,6 +90,8 @@ #include <QtCore/qtextcodec.h> #include <QtCore/qvariant.h> +#include <iostream> + #include <ctype.h> #include <stdlib.h> #include <stdio.h> @@ -106,7 +108,7 @@ static void recordMessage( fileName, lineNo, QStringList(), TranslatorMessage::Unfinished, plural); msg.setExtraComment(extracomment.simplified()); - tor->replace(msg); + tor->extend(msg); } @@ -1630,13 +1632,13 @@ case $rule_number: { if ((name == QLatin1String("qsTranslate")) || (name == QLatin1String("QT_TRANSLATE_NOOP"))) { QVariantList args = sym(2).toList(); if (args.size() < 2) { - qWarning("%s:%d: %s() requires at least two arguments", - qPrintable(fileName), identLineNo, qPrintable(name)); + std::cerr << qPrintable(fileName) << ':' << identLineNo << ": " + << qPrintable(name) << "() requires at least two arguments.\n"; } else { if ((args.at(0).type() != QVariant::String) || (args.at(1).type() != QVariant::String)) { - qWarning("%s:%d: %s(): both arguments must be literal strings", - qPrintable(fileName), identLineNo, qPrintable(name)); + std::cerr << qPrintable(fileName) << ':' << identLineNo << ": " + << qPrintable(name) << "(): both arguments must be literal strings.\n"; } else { QString context = args.at(0).toString(); QString text = args.at(1).toString(); @@ -1650,12 +1652,12 @@ case $rule_number: { } else if ((name == QLatin1String("qsTr")) || (name == QLatin1String("QT_TR_NOOP"))) { QVariantList args = sym(2).toList(); if (args.size() < 1) { - qWarning("%s:%d: %s() requires at least one argument", - qPrintable(fileName), identLineNo, qPrintable(name)); + std::cerr << qPrintable(fileName) << ':' << identLineNo << ": " + << qPrintable(name) << "() requires at least one argument.\n"; } else { if (args.at(0).type() != QVariant::String) { - qWarning("%s:%d: %s(): text to translate must be a literal string", - qPrintable(fileName), identLineNo, qPrintable(name)); + std::cerr << qPrintable(fileName) << ':' << identLineNo << ": " + << qPrintable(name) << "(): text to translate must be a literal string.\n"; } else { QString context = QFileInfo(fileName).baseName(); QString text = args.at(0).toString(); @@ -2009,8 +2011,8 @@ bool loadQScript(Translator &translator, const QString &filename, ConversionData lexer.setCode(code, /*lineNumber=*/1); QScriptParser parser; if (!parser.parse(&lexer, filename, &translator)) { - qWarning("%s:%d: %s", qPrintable(filename), parser.errorLineNumber(), - qPrintable(parser.errorMessage())); + std::cerr << qPrintable(filename) << ':' << parser.errorLineNumber() << ": " + << qPrintable(parser.errorMessage()) << std::endl; return false; } diff --git a/tools/linguist/phrasebooks/hungarian.qph b/tools/linguist/phrasebooks/hungarian.qph new file mode 100644 index 0000000000..0e1dd122a8 --- /dev/null +++ b/tools/linguist/phrasebooks/hungarian.qph @@ -0,0 +1,752 @@ +<!DOCTYPE QPH> +<QPH language="hu_HU"> +<phrase> + <source>OK</source> + <target>OK</target> +</phrase> +<phrase> + <source>Bookmarks</source> + <target>Könyvjelzők</target> +</phrase> +<phrase> + <source>Remove</source> + <target>Törlés</target> +</phrase> +<phrase> + <source>New Folder</source> + <target>Új könyvtár</target> +</phrase> +<phrase> + <source>Add</source> + <target>Hozzáadás</target> +</phrase> +<phrase> + <source>Previous</source> + <target>Előző</target> +</phrase> +<phrase> + <source>Font</source> + <target>Betűtípus</target> +</phrase> +<phrase> + <source>Help</source> + <target>Segítség</target> +</phrase> +<phrase> + <source>Done</source> + <target>Kész</target> +</phrase> +<phrase> + <source>Install</source> + <target>Telepítés</target> +</phrase> +<phrase> + <source>Cancel</source> + <target>Mégsem</target> +</phrase> +<phrase> + <source>Installation Path:</source> + <target>Telepítési útvonal:</target> +</phrase> +<phrase> + <source>Index</source> + <target>Index</target> +</phrase> +<phrase> + <source>Contents</source> + <target>Tartalom</target> +</phrase> +<phrase> + <source>Search</source> + <target>Keresés</target> +</phrase> +<phrase> + <source>Print Preview...</source> + <target>Nyomtatási kép...</target> +</phrase> +<phrase> + <source>About...</source> + <target>Névjegy...</target> +</phrase> +<phrase> + <source>Toolbars</source> + <target>Eszköztárak</target> +</phrase> +<phrase> + <source>Address:</source> + <target>Cím:</target> +</phrase> +<phrase> + <source>Open Source Edition</source> + <target>Nyíltforrású kiadás</target> +</phrase> +<phrase> + <source>Yes</source> + <target>Igen</target> +</phrase> +<phrase> + <source>No</source> + <target>Nem</target> +</phrase> +<phrase> + <source>Apply</source> + <target>Alkalmaz</target> +</phrase> +<phrase> + <source>Ignore</source> + <target>Kihagyás</target> +</phrase> +<phrase> + <source>Abort</source> + <target>Megszakítás</target> +</phrase> +<phrase> + <source>Play</source> + <target>Lejátszás</target> +</phrase> +<phrase> + <source>Pause</source> + <target>Szünet</target> +</phrase> +<phrase> + <source>File</source> + <target>Fájl</target> + <definition>menu</definition> +</phrase> +<phrase> + <source>file</source> + <target>fájl</target> +</phrase> +<phrase> + <source>directory</source> + <target>könyvtár</target> +</phrase> +<phrase> + <source>Symlink</source> + <target>Szimbolikus link</target> +</phrase> +<phrase> + <source>Delete</source> + <target>Törlés</target> +</phrase> +<phrase> + <source>Rename</source> + <target>Átnevezés</target> +</phrase> +<phrase> + <source>Back</source> + <target>Vissza</target> +</phrase> +<phrase> + <source>Forward</source> + <target>Előre</target> +</phrase> +<phrase> + <source>Finish</source> + <target>Befejezés</target> +</phrase> +<phrase> + <source>Quit</source> + <target>Kilépés</target> +</phrase> +<phrase> + <source>Exit</source> + <target>Kilépés</target> +</phrase> +<phrase> + <source>Close</source> + <target>Bezárás</target> +</phrase> +<phrase> + <source>Close All</source> + <target>Mindent bezár</target> +</phrase> +<phrase> + <source>Error</source> + <target>Hiba</target> +</phrase> +<phrase> + <source>Warning</source> + <target>Figyelmeztetés</target> +</phrase> +<phrase> + <source>Information</source> + <target>Információ</target> +</phrase> +<phrase> + <source>Question</source> + <target>Kérdés</target> +</phrase> +<phrase> + <source>document</source> + <target>dokumentum</target> +</phrase> +<phrase> + <source>author</source> + <target>szerző</target> +</phrase> +<phrase> + <source>subsidiary(-ies)</source> + <target>leányvállalata(i)</target> +</phrase> +<phrase> + <source>Help</source> + <target>Súgó</target> +</phrase> +<phrase> + <source>Undo</source> + <target>Visszavonás</target> +</phrase> +<phrase> + <source>Redo</source> + <target>Újra</target> +</phrase> +<phrase> + <source>Open</source> + <target>Megnyitás</target> +</phrase> +<phrase> + <source>Save</source> + <target>Mentés</target> +</phrase> +<phrase> + <source>Save all</source> + <target>Mindet menti</target> +</phrase> +<phrase> + <source>click</source> + <target>kattintás</target> + <definition>noun</definition> +</phrase> +<phrase> + <source>click</source> + <target>kattintson</target> + <definition>ask</definition> +</phrase> +<phrase> + <source>Recent</source> + <target>Előző</target> + <definition>Recent files/Előző fájlok</definition> +</phrase> +<phrase> + <source>Window</source> + <target>Ablak</target> +</phrase> +<phrase> + <source>Cascade</source> + <target>Lépcsőzetes</target> +</phrase> +<phrase> + <source>Tile</source> + <target>Mozaikszerű</target> +</phrase> +<phrase> + <source>Game</source> + <target>Játék</target> +</phrase> +<phrase> + <source>New Game</source> + <target>Új játék</target> +</phrase> +<phrase> + <source>Untitled</source> + <target>Névtelen</target> +</phrase> +<phrase> + <source>Unknown error</source> + <target>Ismeretlen hiba</target> +</phrase> +<phrase> + <source>New Folder</source> + <target>Új mappa</target> +</phrase> +<phrase> + <source>folder</source> + <target>mappa</target> +</phrase> +<phrase> + <source>New Directory</source> + <target>Új könyvtár</target> +</phrase> +<phrase> + <source>unknown</source> + <target>ismeretlen</target> +</phrase> +<phrase> + <source>Copy</source> + <target>Másolás</target> +</phrase> +<phrase> + <source>Cut</source> + <target>Kivágás</target> +</phrase> +<phrase> + <source>Paste</source> + <target>Beillesztés</target> +</phrase> +<phrase> + <source>Paste special</source> + <target>Speciális beillesztés</target> +</phrase> +<phrase> + <source>Insert</source> + <target>Beszúrás</target> +</phrase> +<phrase> + <source>Copy here</source> + <target>Másolás ide</target> +</phrase> +<phrase> + <source>Minimize</source> + <target>Minimalizálás</target> +</phrase> +<phrase> + <source>Zoom</source> + <target>Nagyítás</target> +</phrase> +<phrase> + <source>&Edit</source> + <target>S&zerkesztés</target> +</phrase> +<phrase> + <source>&View</source> + <target>&Nézet</target> +</phrase> +<phrase> + <source>Application</source> + <target>Alkalmazás</target> +</phrase> +<phrase> + <source>Documentation</source> + <target>Dokumentáció</target> +</phrase> +<phrase> + <source>Network</source> + <target>Hálózat</target> +</phrase> +<phrase> + <source>Current Page</source> + <target>Aktuális oldal</target> +</phrase> +<phrase> + <source>Find</source> + <target>Keresés</target> +</phrase> +<phrase> + <source>Locale</source> + <target>Nyelv</target> +</phrase> +<phrase> + <source>Cannot open '%1'.</source> + <target>'%1' nem nyitható meg.</target> +</phrase> +<phrase> + <source>Cannot find the string '%1'.</source> + <target>A szöveg nem található: '%1'.</target> +</phrase> +<phrase> + <source>A file called '%1' already exists. Please choose another name.</source> + <target>'%1' nevű fájl már létezik. Válasszon egy másik nevet.</target> +</phrase> +<phrase> + <source>The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.</source> + <target>Ez a program abban a reményben került közreadásra, hogy hasznos lesz, de minden egyéb GARANCIA NÉLKÜL, az ELADHATÓSÁGRA vagy VALAMELY CÉLRA VALÓ ALKALMAZHATÓSÁGRA való származtatott garanciát is beleértve.</target> + <definition>License text in most Qt programs</definition> +</phrase> +<phrase> + <source>Open Link</source> + <target>Link megnyitása</target> +</phrase> +<phrase> + <source>Next</source> + <target>Következő</target> +</phrase> +<phrase> + <source>Case Sensitive</source> + <target>Kis/nagybetű érzékeny</target> +</phrase> +<phrase> + <source>Whole words</source> + <target>Teljes szó</target> +</phrase> +<phrase> + <source>Open Link in New Tab</source> + <target>Link megnyitása új lapon</target> +</phrase> +<phrase> + <source>Download canceled.</source> + <target>Letöltés megszakítva.</target> +</phrase> +<phrase> + <source>The file %1 already exists. Do you want to overwrite it?</source> + <target>A(z) '%1' nevű fájl már létezik. Felülírja?</target> +</phrase> +<phrase> + <source>Qt Assistant</source> + <target>Qt Asszisztens</target> +</phrase> +<phrase> + <source>Preferences...</source> + <target>Beállítások...</target> +</phrase> +<phrase> + <source>&File</source> + <target>&Fájl</target> +</phrase> +<phrase> + <source>Browser</source> + <target>Böngésző</target> +</phrase> +<phrase> + <source>Filters</source> + <target>Szűrők</target> +</phrase> +<phrase> + <source>Delete Folder</source> + <target>Mappa törlése</target> +</phrase> +<phrase> + <source>Rename Folder</source> + <target>Mappa átnevezése</target> +</phrase> +<phrase> + <source>You need a commercial Qt license for development of proprietary (closed source) applications. Please see <a href="http://www.trolltech.com/company/model.html">www.trolltech.com/company/model.html</a> for an overview of Qt licensing.</source> + <target>Amennyiben zárt forrású alkalmazás fejlesztéséhez kívánja a Qt-t felhasználni, szüksége lesz a Qt kereskedelmi verziójára. Kérem tekintse meg az <tt>http://www.trolltech.com/company/model.html</tt> oldalt a Qt licenszelésének áttekintéséhez.</target> +</phrase> +<phrase> + <source>New Tab</source> + <target>Új fül</target> +</phrase> +<phrase> + <source>Close Tab</source> + <target>Fül bezárása</target> +</phrase> +<phrase> + <source>Close Other Tabs</source> + <target>A többi fül bezárása</target> +</phrase> +<phrase> + <source>True</source> + <target>Igaz</target> +</phrase> +<phrase> + <source>False</source> + <target>Hamis</target> +</phrase> +<phrase> + <source>Update</source> + <target>Frissítés</target> +</phrase> +<phrase> + <source>Normal</source> + <target>Normál</target> +</phrase> +<phrase> + <source>Bold</source> + <target>Félkövér</target> +</phrase> +<phrase> + <source>Italic</source> + <target>Dőlt</target> +</phrase> +<phrase> + <source>Greek</source> + <target>Görög</target> +</phrase> +<phrase> + <source>Cyrillic</source> + <target>Cirill</target> +</phrase> +<phrase> + <source>Armenian</source> + <target>Örmény</target> +</phrase> +<phrase> + <source>Hebrew</source> + <target>Héber</target> +</phrase> +<phrase> + <source>Arabic</source> + <target>Arab</target> +</phrase> +<phrase> + <source>Syriac</source> + <target>Szír</target> +</phrase> +<phrase> + <source>Permission denied</source> + <target>Hozzáférés megtagadva</target> +</phrase> +<phrase> + <source>Too many open files</source> + <target>Túl sok fájl van nyitva</target> +</phrase> +<phrase> + <source>No such file or directory</source> + <target>Nincs ilyen fájl vagy könyvtár</target> +</phrase> +<phrase> + <source>No space left on device</source> + <target>Nincs több hely az eszközön</target> +</phrase> +<phrase> + <source>Width:</source> + <target>Szélesség:</target> +</phrase> +<phrase> + <source>Height:</source> + <target>Magasság:</target> +</phrase> +<phrase> + <source>Margins</source> + <target>Margók</target> +</phrase> +<phrase> + <source>top margin</source> + <target>felső margó</target> +</phrase> +<phrase> + <source>left margin</source> + <target>bal margó</target> +</phrase> +<phrase> + <source>right margin</source> + <target>jobb margó</target> +</phrase> +<phrase> + <source>bottom margin</source> + <target>alsó margó</target> +</phrase> +<phrase> + <source>Next page</source> + <target>Következő oldal</target> +</phrase> +<phrase> + <source>Previous page</source> + <target>Előző oldal</target> +</phrase> +<phrase> + <source>First page</source> + <target>Első oldal</target> +</phrase> +<phrase> + <source>Last page</source> + <target>Utolsó oldal</target> +</phrase> +<phrase> + <source>Fit width</source> + <target>Szélesség igazítása</target> +</phrase> +<phrase> + <source>Fit page</source> + <target>Oldal igazítása</target> +</phrase> +<phrase> + <source>Zoom in</source> + <target>Nagyítás</target> +</phrase> +<phrase> + <source>Zoom out</source> + <target>Kicsinyítés</target> +</phrase> +<phrase> + <source>Portrait</source> + <target>Álló</target> +</phrase> +<phrase> + <source>Landscape</source> + <target>Fekvő</target> +</phrase> +<phrase> + <source>Print</source> + <target>Nyomtatás</target> +</phrase> +<phrase> + <source>Page setup</source> + <target>Oldalbeállítás</target> +</phrase> +<phrase> + <source>Color</source> + <target>Szín</target> +</phrase> +<phrase> + <source>Grayscale</source> + <target>Szürkeárnyalatos</target> +</phrase> +<phrase> + <source>None</source> + <target>Nincs</target> +</phrase> +<phrase> + <source>...</source> + <target>...</target> +</phrase> +<phrase> + <source>Menu</source> + <target>Menü</target> +</phrase> +<phrase> + <source>Keep</source> + <target>Meghagy</target> +</phrase> +<phrase> + <source>Pause</source> + <target>Megállít</target> +</phrase> +<phrase> + <source>Log</source> + <target>Napló</target> +</phrase> +<phrase> + <source>Mi&nimize</source> + <target>&Kis méret</target> +</phrase> +<phrase> + <source>Press</source> + <target>Nyomja meg</target> +</phrase> +<phrase> + <source>Submit</source> + <target>Küldés</target> +</phrase> +<phrase> + <source>Underline</source> + <target>Aláhúzott</target> +</phrase> +<phrase> + <source>Outline</source> + <target>Áthúzott</target> +</phrase> +<phrase> + <source>Direction</source> + <target>Irány</target> +</phrase> +<phrase> + <source>Configuration</source> + <target>Konfiguráció</target> +</phrase> +<phrase> + <source>None</source> + <target>Semmi</target> +</phrase> +<phrase> + <source>Save As...</source> + <target>Mentés másként...</target> +</phrase> +<phrase> + <source>Context</source> + <target>Környezet</target> +</phrase> +<phrase> + <source>Edit</source> + <target>Szerkesztés</target> +</phrase> +<phrase> + <source>Toolbar</source> + <target>Eszköztár</target> +</phrase> +<phrase> + <source>&Print...</source> + <target>&Nyomtatás...</target> +</phrase> +<phrase> + <source>E&xit</source> + <target>&Kilépés</target> +</phrase> +<phrase> + <source>Sidebar</source> + <target>Oldalsáv</target> +</phrase> +<phrase> + <source>Bookmark</source> + <target>Könyvjelző</target> +</phrase> +<phrase> + <source>Save As</source> + <target>Mentés másként</target> +</phrase> +<phrase> + <source>Select All</source> + <target>Összes kijelölése</target> +</phrase> +<phrase> + <source>Name</source> + <target>Név</target> +</phrase> +<phrase> + <source>Type</source> + <target>Típus</target> +</phrase> +<phrase> + <source>Date</source> + <target>Dátum</target> +</phrase> +<phrase> + <source>Name</source> + <target>Név</target> +</phrase> +<phrase> + <source>Unknown</source> + <target>Ismeretlen</target> +</phrase> +<phrase> + <source>Value</source> + <target>Érték</target> +</phrase> +<phrase> + <source>Default</source> + <target>Alapértelmezett</target> +</phrase> +<phrase> + <source>New</source> + <target>Új</target> +</phrase> +<phrase> + <source>Level</source> + <target>Szint</target> +</phrase> +<phrase> + <source>Location</source> + <target>Hely</target> +</phrase> +<phrase> + <source>Reload</source> + <target>Újratöltés</target> +</phrase> +<phrase> + <source>Pictures</source> + <target>Képek</target> +</phrase> +<phrase> + <source>Battery</source> + <target>Elem</target> +</phrase> +<phrase> + <source>No error</source> + <target>Nincs hiba</target> +</phrase> +<phrase> + <source>Whole words</source> + <target>Teljes szó</target> +</phrase> +<phrase> + <source>(Új bejegyzés)</source> + <target></target> +</phrase> +<phrase> + <source>Horizontal</source> + <target>Vízszintes</target> +</phrase> +<phrase> + <source>Enabled</source> + <target>Engedélyezve</target> +</phrase> +<phrase> + <source>Up</source> + <target>Fel</target> +</phrase> +<phrase> + <source>Down</source> + <target>Le</target> +</phrase> +</QPH> diff --git a/tools/linguist/phrasebooks/russian.qph b/tools/linguist/phrasebooks/russian.qph index ae1a9b9083..750fda0ae7 100644 --- a/tools/linguist/phrasebooks/russian.qph +++ b/tools/linguist/phrasebooks/russian.qph @@ -826,7 +826,7 @@ </phrase> <phrase> <source>slider</source> - <target>ползунок</target> + <target>регулятор</target> </phrase> <phrase> <source>spin box</source> diff --git a/tools/linguist/shared/po.cpp b/tools/linguist/shared/po.cpp index 99a8751b98..a6923328ae 100644 --- a/tools/linguist/shared/po.cpp +++ b/tools/linguist/shared/po.cpp @@ -353,6 +353,29 @@ static void slurpComment(QByteArray &msg, const QList<QByteArray> &lines, int & --l; } +static void splitContext(QByteArray *comment, QByteArray *context) +{ + char *data = comment->data(); + int len = comment->size(); + int sep = -1, j = 0; + + for (int i = 0; i < len; i++, j++) { + if (data[i] == '~' && i + 1 < len) + i++; + else if (data[i] == '|') + sep = j; + data[j] = data[i]; + } + if (sep >= 0) { + QByteArray tmp = comment->mid(sep + 1, j - sep - 1); + comment->truncate(sep); + *context = *comment; + *comment = tmp; + } else { + comment->truncate(j); + } +} + static QString makePoHeader(const QString &str) { return QLatin1String("po-header-") + str.toLower().replace(QLatin1Char('-'), QLatin1Char('_')); @@ -411,6 +434,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) lines.append(QByteArray()); int l = 0, lastCmtLine = -1; + bool qtContexts = false; PoItem item; for (; l != lines.size(); ++l) { QByteArray line = lines.at(l); @@ -437,7 +461,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) continue; int idx = hdr.indexOf(':'); if (idx < 0) { - cd.appendError(QString::fromLatin1("Unexpected PO header format '%1'\n") + cd.appendError(QString::fromLatin1("Unexpected PO header format '%1'") .arg(QString::fromLatin1(hdr))); error = true; break; @@ -449,6 +473,8 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) translator.setLanguageCode(QString::fromLatin1(hdrValue)); } else if (hdrName == "X-Source-Language") { translator.setSourceLanguageCode(QString::fromLatin1(hdrValue)); + } else if (hdrName == "X-Qt-Contexts") { + qtContexts = (hdrValue == "true"); } else if (hdrName == "Plural-Forms") { pluralForms = hdrValue; } else if (hdrName == "MIME-Version") { @@ -456,7 +482,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) } else if (hdrName == "Content-Type") { if (cd.m_codecForSource.isEmpty()) { if (!hdrValue.startsWith("text/plain; charset=")) { - cd.appendError(QString::fromLatin1("Unexpected Content-Type header '%1'\n") + cd.appendError(QString::fromLatin1("Unexpected Content-Type header '%1'") .arg(QString::fromLatin1(hdrValue))); error = true; // This will avoid a flood of conversion errors. @@ -465,7 +491,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) QByteArray cod = hdrValue.mid(20); QTextCodec *cdc = QTextCodec::codecForName(cod); if (!cdc) { - cd.appendError(QString::fromLatin1("Unsupported codec '%1'\n") + cd.appendError(QString::fromLatin1("Unsupported codec '%1'") .arg(QString::fromLatin1(cod))); error = true; // This will avoid a flood of conversion errors. @@ -477,7 +503,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) } } else if (hdrName == "Content-Transfer-Encoding") { if (hdrValue != "8bit") { - cd.appendError(QString::fromLatin1("Unexpected Content-Transfer-Encoding '%1'\n") + cd.appendError(QString::fromLatin1("Unexpected Content-Transfer-Encoding '%1'") .arg(QString::fromLatin1(hdrValue))); return false; } @@ -498,7 +524,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) // Keep in sync with savePO static const char * const dfltHdrs[] = { "MIME-Version", "Content-Type", "Content-Transfer-Encoding", - "Plural-Forms", "X-Language", "X-Source-Language" + "Plural-Forms", "X-Language", "X-Source-Language", "X-Qt-Contexts" }; uint cdh = 0; for (int cho = 0; cho < hdrOrder.length(); cho++) { @@ -596,7 +622,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) slurpComment(item.translatorComments, lines, l); break; case '.': - if (line.startsWith("#. ts-context ")) { + if (line.startsWith("#. ts-context ")) { // legacy item.context = line.mid(14); } else if (line.startsWith("#. ts-id ")) { item.id = line.mid(9); @@ -615,8 +641,10 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) codec->toUnicode(extra); } else if (line.startsWith("#| msgctxt ")) { item.oldTscomment = slurpEscapedString(lines, l, 11, "#| ", cd); + if (qtContexts) + splitContext(&item.oldTscomment, &item.context); } else { - cd.appendError(QString(QLatin1String("PO-format parse error in line %1: '%2'\n")) + cd.appendError(QString(QLatin1String("PO-format parse error in line %1: '%2'")) .arg(l + 1).arg(codec->toUnicode(lines[l]))); error = true; } @@ -633,13 +661,13 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) } else if (line.startsWith("#~ msgctxt ")) { item.tscomment = slurpEscapedString(lines, l, 11, "#~ ", cd); } else { - cd.appendError(QString(QLatin1String("PO-format parse error in line %1: '%2'\n")) + cd.appendError(QString(QLatin1String("PO-format parse error in line %1: '%2'")) .arg(l + 1).arg(codec->toUnicode(lines[l]))); error = true; } break; default: - cd.appendError(QString(QLatin1String("PO-format parse error in line %1: '%2'\n")) + cd.appendError(QString(QLatin1String("PO-format parse error in line %1: '%2'")) .arg(l + 1).arg(codec->toUnicode(lines[l]))); error = true; break; @@ -647,6 +675,8 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) lastCmtLine = l; } else if (line.startsWith("msgctxt ")) { item.tscomment = slurpEscapedString(lines, l, 8, QByteArray(), cd); + if (qtContexts) + splitContext(&item.tscomment, &item.context); } else if (line.startsWith("msgid ")) { item.msgId = slurpEscapedString(lines, l, 6, QByteArray(), cd); } else if (line.startsWith("msgid_plural ")) { @@ -655,7 +685,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) item.extra[QLatin1String("po-msgid_plural")] = codec->toUnicode(extra); item.isPlural = true; } else { - cd.appendError(QString(QLatin1String("PO-format error in line %1: '%2'\n")) + cd.appendError(QString(QLatin1String("PO-format error in line %1: '%2'")) .arg(l + 1).arg(codec->toUnicode(lines[l]))); error = true; } @@ -672,6 +702,16 @@ static void addPoHeader(Translator::ExtraData &headers, QStringList &hdrOrder, headers[makePoHeader(qName)] = value; } +static QString escapeComment(const QString &in, bool escape) +{ + QString out = in; + if (escape) { + out.replace(QLatin1Char('~'), QLatin1String("~~")); + out.replace(QLatin1Char('|'), QLatin1String("~|")); + } + return out; +} + bool savePO(const Translator &translator, QIODevice &dev, ConversionData &cd) { QString str_format = QLatin1String("-format"); @@ -680,6 +720,13 @@ bool savePO(const Translator &translator, QIODevice &dev, ConversionData &cd) QTextStream out(&dev); out.setCodec(cd.m_outputCodec.isEmpty() ? QByteArray("UTF-8") : cd.m_outputCodec); + bool qtContexts = false; + foreach (const TranslatorMessage &msg, translator.messages()) + if (!msg.context().isEmpty()) { + qtContexts = true; + break; + } + QString cmt = translator.extra(QLatin1String("po-header_comment")); if (!cmt.isEmpty()) out << cmt << '\n'; @@ -703,6 +750,8 @@ bool savePO(const Translator &translator, QIODevice &dev, ConversionData &cd) } if (!translator.sourceLanguageCode().isEmpty()) addPoHeader(headers, hdrOrder, "X-Source-Language", translator.sourceLanguageCode()); + if (qtContexts) + addPoHeader(headers, hdrOrder, "X-Qt-Contexts", QLatin1String("true")); QString hdrStr; foreach (const QString &hdr, hdrOrder) { hdrStr += hdr; @@ -721,8 +770,6 @@ bool savePO(const Translator &translator, QIODevice &dev, ConversionData &cd) if (!msg.extraComment().isEmpty()) out << poEscapedLines(QLatin1String("#."), true, msg.extraComment()); - if (!msg.context().isEmpty()) - out << QLatin1String("#. ts-context ") << msg.context() << '\n'; if (!msg.id().isEmpty()) out << QLatin1String("#. ts-id ") << msg.id() << '\n'; @@ -770,15 +817,21 @@ bool savePO(const Translator &translator, QIODevice &dev, ConversionData &cd) QString prefix = QLatin1String("#| "); if (!msg.oldComment().isEmpty()) - out << poEscapedString(prefix, QLatin1String("msgctxt"), noWrap, msg.oldComment()); + out << poEscapedString(prefix, QLatin1String("msgctxt"), noWrap, + escapeComment(msg.oldComment(), qtContexts)); if (!msg.oldSourceText().isEmpty()) out << poEscapedString(prefix, QLatin1String("msgid"), noWrap, msg.oldSourceText()); QString plural = msg.extra(QLatin1String("po-old_msgid_plural")); if (!plural.isEmpty()) out << poEscapedString(prefix, QLatin1String("msgid_plural"), noWrap, plural); prefix = QLatin1String((msg.type() == TranslatorMessage::Obsolete) ? "#~ " : ""); - if (!msg.comment().isEmpty()) - out << poEscapedString(prefix, QLatin1String("msgctxt"), noWrap, msg.comment()); + if (!msg.context().isEmpty()) + out << poEscapedString(prefix, QLatin1String("msgctxt"), noWrap, + escapeComment(msg.context(), true) + QLatin1Char('|') + + escapeComment(msg.comment(), true)); + else if (!msg.comment().isEmpty()) + out << poEscapedString(prefix, QLatin1String("msgctxt"), noWrap, + escapeComment(msg.comment(), qtContexts)); out << poEscapedString(prefix, QLatin1String("msgid"), noWrap, msg.sourceText()); if (!msg.isPlural()) { QString transl = msg.translation(); diff --git a/tools/linguist/shared/profileevaluator.cpp b/tools/linguist/shared/profileevaluator.cpp index 5e1ee1fb77..a21408c96b 100644 --- a/tools/linguist/shared/profileevaluator.cpp +++ b/tools/linguist/shared/profileevaluator.cpp @@ -2594,19 +2594,19 @@ void ProFileEvaluator::addProperties(const QHash<QString, QString> &properties) void ProFileEvaluator::logMessage(const QString &message) { if (d->m_verbose && !d->m_skipLevel) - qWarning("%s", qPrintable(message)); + fprintf(stderr, "%s\n", qPrintable(message)); } void ProFileEvaluator::fileMessage(const QString &message) { if (!d->m_skipLevel) - qWarning("%s", qPrintable(message)); + fprintf(stderr, "%s\n", qPrintable(message)); } void ProFileEvaluator::errorMessage(const QString &message) { if (!d->m_skipLevel) - qWarning("%s", qPrintable(message)); + fprintf(stderr, "%s\n", qPrintable(message)); } void ProFileEvaluator::setVerbose(bool on) diff --git a/tools/linguist/shared/qm.cpp b/tools/linguist/shared/qm.cpp index e2c4f4acef..66789432e1 100644 --- a/tools/linguist/shared/qm.cpp +++ b/tools/linguist/shared/qm.cpp @@ -773,11 +773,11 @@ static bool saveQM(const Translator &translator, QIODevice &dev, ConversionData if (saved && cd.isVerbose()) { int generatedCount = finished + unfinished; cd.appendError(QCoreApplication::translate("LRelease", - " Generated %n translation(s) (%1 finished and %2 unfinished)\n", 0, + " Generated %n translation(s) (%1 finished and %2 unfinished)", 0, QCoreApplication::CodecForTr, generatedCount).arg(finished).arg(unfinished)); if (untranslated) cd.appendError(QCoreApplication::translate("LRelease", - " Ignored %n untranslated source text(s)\n", 0, + " Ignored %n untranslated source text(s)", 0, QCoreApplication::CodecForTr, untranslated)); } return saved; diff --git a/tools/linguist/shared/translator.cpp b/tools/linguist/shared/translator.cpp index c86a9dd2c5..36af8dae90 100644 --- a/tools/linguist/shared/translator.cpp +++ b/tools/linguist/shared/translator.cpp @@ -43,6 +43,8 @@ #include "simtexth.h" +#include <iostream> + #include <stdio.h> #ifdef Q_OS_WIN // required for _setmode, to avoid _O_TEXT streams... @@ -586,22 +588,21 @@ void Translator::reportDuplicates(const Duplicates &dupes, const QString &fileName, bool verbose) { if (!dupes.byId.isEmpty() || !dupes.byContents.isEmpty()) { + std::cerr << "Warning: dropping duplicate messages in '" << qPrintable(fileName); if (!verbose) { - qWarning("Warning: dropping duplicate messages in '%s'\n(try -verbose for more info).", - qPrintable(fileName)); + std::cerr << "'\n(try -verbose for more info).\n"; } else { - qWarning("Warning: dropping duplicate messages in '%s':", qPrintable(fileName)); + std::cerr << "':\n"; foreach (int i, dupes.byId) - qWarning("\n* ID: %s", qPrintable(message(i).id())); + std::cerr << "\n* ID: " << qPrintable(message(i).id()) << std::endl; foreach (int j, dupes.byContents) { const TranslatorMessage &msg = message(j); - qWarning("\n* Context: %s\n* Source: %s", - qPrintable(msg.context()), - qPrintable(msg.sourceText())); + std::cerr << "\n* Context: " << qPrintable(msg.context()) + << "\n* Source: " << qPrintable(msg.sourceText()) << std::endl; if (!msg.comment().isEmpty()) - qWarning("* Comment: %s", qPrintable(msg.comment())); + std::cerr << "* Comment: " << qPrintable(msg.comment()) << std::endl; } - qWarning(); + std::cerr << std::endl; } } } @@ -688,7 +689,7 @@ void Translator::normalizeTranslations(ConversionData &cd) cd.appendError(QLatin1String( "Removed plural forms as the target language has less " "forms.\nIf this sounds wrong, possibly the target language is " - "not set or recognized.\n")); + "not set or recognized.")); } QString Translator::guessLanguageCodeFromFileName(const QString &filename) @@ -737,7 +738,7 @@ void Translator::setCodecName(const QByteArray &name) QTextCodec *codec = QTextCodec::codecForName(name); if (!codec) { if (!name.isEmpty()) - qWarning("No QTextCodec for %s available. Using Latin1\n", name.constData()); + std::cerr << "No QTextCodec for " << name.constData() << " available. Using Latin1.\n"; m_codec = QTextCodec::codecForName("ISO-8859-1"); } else { m_codec = codec; diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h index bb199f086e..cfb2178425 100644 --- a/tools/linguist/shared/translator.h +++ b/tools/linguist/shared/translator.h @@ -92,7 +92,7 @@ public: bool sortContexts() const { return m_sortContexts; } void appendError(const QString &error) { m_errors.append(error); } - QString error() const { return m_errors.join(QLatin1String("\n")); } + QString error() const { return m_errors.isEmpty() ? QString() : m_errors.join(QLatin1String("\n")) + QLatin1Char('\n'); } QStringList errors() const { return m_errors; } void clearErrors() { m_errors.clear(); } diff --git a/tools/porting/src/codemodel.h b/tools/porting/src/codemodel.h index cb3088f6f0..04ad178dc4 100644 --- a/tools/porting/src/codemodel.h +++ b/tools/porting/src/codemodel.h @@ -96,7 +96,7 @@ class Collection: public QMultiHash<QByteArray, CollectedType *> { public: void add(CollectedType *collectedItem) - { insert(collectedItem->name(), collectedItem); } + { this->insert(collectedItem->name(), collectedItem); } }; typedef Collection<Scope> ScopeCollection; diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp new file mode 100644 index 0000000000..5f108850e6 --- /dev/null +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -0,0 +1,4719 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +/* + ditaxmlgenerator.cpp +*/ + +#include "codemarker.h" +#include "codeparser.h" +#include "ditaxmlgenerator.h" +#include "node.h" +#include "separator.h" +#include "tree.h" +#include <ctype.h> +#include <qdebug.h> +#include <qlist.h> +#include <qiterator.h> +#include <qtextcodec.h> +#include <QUuid> + +QT_BEGIN_NAMESPACE + +#define COMMAND_VERSION Doc::alias("version") +int DitaXmlGenerator::id = 0; + +#define cxxapi_d_xref Doc::alias("cxxapi-d-xref") +#define cxxclass Doc::alias("cxxclass") +#define cxxdefine Doc::alias("cxxdefine") +#define cxxenumeration Doc::alias("cxxenumeration") +#define cxxfile Doc::alias("cxxfile") +#define cxxfunction Doc::alias("cxxfunction") +#define cxxstruct Doc::alias("cxxstruct") +#define cxxtypedef Doc::alias("cxxtypedef") +#define cxxunion Doc::alias("cxxunion") +#define cxxvariable Doc::alias("cxxvariable") + +#define CXXAPIMAP Doc::alias("cxxAPIMap") +#define CXXCLASSREF Doc::alias("cxxClassRef") +#define CXXDEFINEREF Doc::alias("cxxDefineRef") +#define CXXENUMERATIONREF Doc::alias("cxxEnumerationRef") +#define CXXFILEREF Doc::alias("cxxFileRef") +#define CXXFUNCTIONREF Doc::alias("cxxFunctionRef") +#define CXXSTRUCTREF Doc::alias("cxxStructRef") +#define CXXTYPDEFREF Doc::alias("cxxTypedefRef") +#define CXXUNIONREF Doc::alias("cxxUnionRef") +#define CXXVARIABLEREF Doc::alias("cxxVariableRef") + +#define CXXCLASS Doc::alias("cxxClass") +#define CXXCLASSABSTRACT Doc::alias("cxxClassAbstract") +#define CXXCLASSACCESSSPECIFIER Doc::alias("cxxClassAccessSpecifier") +#define CXXCLASSAPIITEMLOCATION Doc::alias("cxxClassAPIItemLocation") +#define CXXCLASSBASECLASS Doc::alias("cxxClassBaseClass") +#define CXXCLASSBASECLASSSTRUCT Doc::alias("cxxClassBaseStruct") +#define CXXCLASSBASEUNION Doc::alias("cxxClassBaseUnion") +#define CXXCLASSDECLARATIONFILE Doc::alias("cxxClassDeclarationFile") +#define CXXCLASSDECLARATIONFILELINE Doc::alias("cxxClassDeclarationFileLine") +#define CXXCLASSDEFINITION Doc::alias("cxxClassDefinition") +#define CXXCLASSDEFINITIONFILE Doc::alias("cxxClassDefinitionFile") +#define CXXCLASSDEFINITIONFILEEND Doc::alias("cxxClassDefinitionFileLineEnd") +#define CXXCLASSDEFINITIONFILESTART Doc::alias("cxxClassDefinitionFileLineStart") +#define CXXCLASSDERIVATION Doc::alias("cxxClassDerivation") +#define CXXCLASSDERIVATIONACCESSSPECIFIER Doc::alias("cxxClassDerivationAccessSpecifier") +#define CXXCLASSDERIVATIONS Doc::alias("cxxClassDerivations") +#define CXXCLASSDERIVATIONVIRTUAL Doc::alias("cxxClassDerivationVirtual") +#define CXXCLASSDETAIL Doc::alias("cxxClassDetail") +#define CXXCLASSENUMERATIONINHERITED Doc::alias("cxxClassEnumerationInherited") +#define CXXCLASSENUMERATORINHERITED Doc::alias("cxxClassEnumeratorInherited") +#define CXXCLASSFUNCTIONINHERITED Doc::alias("cxxClassFunctionInherited") +#define CXXCLASSINHERITS Doc::alias("cxxClassInherits") +#define CXXCLASSINHERITSDETAIL Doc::alias("cxxClassInheritsDetail") +#define CXXCLASSNESTED Doc::alias("cxxClassNested") +#define CXXCLASSNESTEDCLASS Doc::alias("cxxClassNestedClass") +#define CXXCLASSNESTEDDETAIL Doc::alias("cxxClassNestedDetail") +#define CXXCLASSNESTEDSTRUCT Doc::alias("cxxClassNestedStruct") +#define CXXCLASSNESTEDUNION Doc::alias("cxxClassNestedUnion") +#define CXXCLASSTEMPLATEPARAMETER Doc::alias("cxxClassTemplateParameter") +#define CXXCLASSTEMPLATEPARAMETERS Doc::alias("cxxClassTemplateParameters") +#define CXXCLASSTEMPLATEPARAMETERTYPE Doc::alias("cxxClassTemplateParameterType") +#define CXXCLASSVARIABLEINHERITED Doc::alias("cxxClassVariableInherited") + +#define CXXDEFINE Doc::alias("cxxDefine") +#define CXXDEFINEACCESSSPECIFIER Doc::alias("cxxDefineAccessSpecifier") +#define CXXDEFINEAPIITEMLOCATION Doc::alias("cxxDefineAPIItemLocation") +#define CXXDEFINEDECLARATIONFILE Doc::alias("cxxDefineDeclarationFile") +#define CXXDEFINEDECLARATIONFILELINE Doc::alias("cxxDefineDeclarationFileLine") +#define CXXDEFINEDEFINITION Doc::alias("cxxDefineDefinition") +#define CXXDEFINEDETAIL Doc::alias("cxxDefineDetail") +#define CXXDEFINENAMELOOKUP Doc::alias("cxxDefineNameLookup") +#define CXXDEFINEPARAMETER Doc::alias("cxxDefineParameter") +#define CXXDEFINEPARAMETERDECLARATIONNAME Doc::alias("cxxDefineParameterDeclarationName") +#define CXXDEFINEPARAMETERS Doc::alias("cxxDefineParameters") +#define CXXDEFINEPROTOTYPE Doc::alias("cxxDefinePrototype") +#define CXXDEFINEREIMPLEMENTED Doc::alias("cxxDefineReimplemented") + +#define CXXENUMERATION Doc::alias("cxxEnumeration") +#define CXXENUMERATIONACCESSSPECIFIER Doc::alias("cxxEnumerationAccessSpecifier") +#define CXXENUMERATIONAPIITEMLOCATION Doc::alias("cxxEnumerationAPIItemLocation") +#define CXXENUMERATIONDECLARATIONFILE Doc::alias("cxxEnumerationDeclarationFile") +#define CXXENUMERATIONDECLARATIONFILELINE Doc::alias("cxxEnumerationDeclarationFileLine") +#define CXXENUMERATIONDEFINITION Doc::alias("cxxEnumerationDefinition") +#define CXXENUMERATIONDEFINITIONFILE Doc::alias("cxxEnumerationDefinitionFile") +#define CXXENUMERATIONDEFINITIONFILELINEEND Doc::alias("cxxEnumerationDefinitionFileLineEnd") +#define CXXENUMERATIONDEFINITIONFILELINESTART Doc::alias("cxxEnumerationDefinitionFileLineStart") +#define CXXENUMERATIONDETAIL Doc::alias("cxxEnumerationDetail") +#define CXXENUMERATIONNAMELOOKUP Doc::alias("cxxEnumerationNameLookup") +#define CXXENUMERATIONPROTOTYPE Doc::alias("cxxEnumerationPrototype") +#define CXXENUMERATIONREIMPLEMENTED Doc::alias("cxxEnumerationReimplemented") +#define CXXENUMERATIONSCOPEDNAME Doc::alias("cxxEnumerationScopedName") +#define CXXENUMERATOR Doc::alias("cxxEnumerator") +#define CXXENUMERATORAPIITEMLOCATION Doc::alias("cxxEnumeratorAPIItemLocation") +#define CXXENUMERATORDECLARATIONFILE Doc::alias("cxxEnumeratorDeclarationFile") +#define CXXENUMERATORDECLARATIONFILELINE Doc::alias("cxxEnumeratorDeclarationFileLine") +#define CXXENUMERATORINITIALISER Doc::alias("cxxEnumeratorInitialiser") +#define CXXENUMERATORNAMELOOKUP Doc::alias("cxxEnumeratorNameLookup") +#define CXXENUMERATORPROTOTYPE Doc::alias("cxxEnumeratorPrototype") +#define CXXENUMERATORS Doc::alias("cxxEnumerators") +#define CXXENUMERATORSCOPEDNAME Doc::alias("cxxEnumeratorScopedName") + +#define CXXFILE_INFO_TYPES Doc::alias("cxxFile-info-types") +#define CXXFILE_TYPES_DEFAULT Doc::alias("cxxFile-types-default") +#define CXXFILE Doc::alias("cxxFile") +#define CXXFILEAPIITMELOCATION Doc::alias("cxxFileAPIItemLocation") +#define CXXFILEDECLARATIONFILE Doc::alias("cxxFileDeclarationFile") + +#define CXXFUNCTION Doc::alias("cxxFunction") +#define CXXFUNCTIONACCESSSPECIFIER Doc::alias("cxxFunctionAccessSpecifier") +#define CXXFUNCTIONAPIITEMLOCATION Doc::alias("cxxFunctionAPIItemLocation") +#define CXXFUNCTIONCONST Doc::alias("cxxFunctionConst") +#define CXXFUNCTIONCONSTRUCTOR Doc::alias("cxxFunctionConstructor") +#define CXXFUNCTIONDECLARATIONFILE Doc::alias("cxxFunctionDeclarationFile") +#define CXXFUNCTIONDECLARATIONFILELINE Doc::alias("cxxFunctionDeclarationFileLine") +#define CXXFUNCTIONDECLAREDTYPE Doc::alias("cxxFunctionDeclaredType") +#define CXXFUNCTIONDEFINITION Doc::alias("cxxFunctionDefinition") +#define CXXFUNCTIONDEFINITIONFILE Doc::alias("cxxFunctionDefinitionFile") +#define CXXFUNCTIONDEFINITIONFILELINEEND Doc::alias("cxxFunctionDefinitionFileLineEnd") +#define CXXFUNCTIONDEFINITIONFILELINESTART Doc::alias("cxxFunctionDefinitionFileLineStart") +#define CXXFUNCTIONDESTRUCTOR Doc::alias("cxxFunctionDestructor") +#define CXXFUNCTIONDETAIL Doc::alias("cxxFunctionDetail") +#define CXXFUNCTIONEXPLICIT Doc::alias("cxxFunctionExplicit") +#define CXXFUNCTIONINLINE Doc::alias("cxxFunctionInline") +#define CXXFUNCTIONNAMELOOKUP Doc::alias("cxxFunctionNameLookup") +#define CXXFUNCTIONPARAMETER Doc::alias("cxxFunctionParameter") +#define CXXFUNCTIONPARAMETERDECLARATIONNAME Doc::alias("cxxFunctionParameterDeclarationName") +#define CXXFUNCTIONPARAMETERDECLAREDTYPE Doc::alias("cxxFunctionParameterDeclaredType") +#define CXXFUNCTIONPARAMETERDEFAULTVALUE Doc::alias("cxxFunctionParameterDefaultValue") +#define CXXFUNCTIONPARAMETERDEFINITIONNAME Doc::alias("cxxFunctionParameterDefinitionName") +#define CXXFUNCTIONPARAMETERS Doc::alias("cxxFunctionParameters") +#define CXXFUNCTIONPROTOTYPE Doc::alias("cxxFunctionPrototype") +#define CXXFUNCTIONPUREVIRTUAL Doc::alias("cxxFunctionPureVirtual") +#define CXXFUNCTIONREIMPLEMENTED Doc::alias("cxxFunctionReimplemented") +#define CXXFUNCTIONRETURNTYPE Doc::alias("cxxFunctionReturnType") +#define CXXFUNCTIONSCOPEDNAME Doc::alias("cxxFunctionScopedName") +#define CXXFUNCTIONSTORAGECLASSSPECIFIEREXTERN Doc::alias("cxxFunctionStorageClassSpecifierExtern") +#define CXXFUNCTIONSTORAGECLASSSPECIFIERMUTABLE Doc::alias("cxxFunctionStorageClassSpecifierMutable") +#define CXXFUNCTIONSTORAGECLASSSPECIFIERSTATIC Doc::alias("cxxFunctionStorageClassSpecifierStatic") +#define CXXFUNCTIONTEMPLATEPARAMETER Doc::alias("cxxFunctionTemplateParameter") +#define CXXFUNCTIONTEMPLATEPARAMETERS Doc::alias("cxxFunctionTemplateParameters") +#define CXXFUNCTIONTEMPLATEPARAMETERTYPE Doc::alias("cxxFunctionTemplateParameterType") +#define CXXFUNCTIONVIRTUAL Doc::alias("cxxFunctionVirtual") +#define CXXFUNCTIONVOLATILE Doc::alias("cxxFunctionVolatile") + +#define CXXSTRUCT Doc::alias("cxxStruct") +#define CXXSTRUCTABSTRACT Doc::alias("cxxStructAbstract") +#define CXXSTRUCTACCESSSPECIFIER Doc::alias("cxxStructAccessSpecifier") +#define CXXSTRUCTAPIITEMLOCATION Doc::alias("cxxStructAPIItemLocation") +#define CXXSTRUCTBASECLASS Doc::alias("cxxStructBaseClass") +#define CXXSTRUCTBASESTRUCT Doc::alias("cxxStructBaseStruct") +#define CXXSTRUCTBASEUNION Doc::alias("cxxStructBaseUnion") +#define CXXSTRUCTDECLARATIONFILE Doc::alias("cxxStructDeclarationFile") +#define CXXSTRUCTDECLARATIONFILELINE Doc::alias("cxxStructDeclarationFileLine") +#define CXXSTRUCTDEFINITION Doc::alias("cxxStructDefinition") +#define CXXSTRUCTDEFINITIONFILE Doc::alias("cxxStructDefinitionFile") +#define CXXSTRUCTDEFINITIONFILELINEEND Doc::alias("cxxStructDefinitionFileLineEnd") +#define CXXSTRUCTDEFINITIONFILELINESTART Doc::alias("cxxStructDefinitionFileLineStart") +#define CXXSTRUCTDERIVATION Doc::alias("cxxStructDerivation") +#define CXXSTRUCTDERIVATIONACCESSSPECIFIER Doc::alias("cxxStructDerivationAccessSpecifier") +#define CXXSTRUCTDERIVATIONS Doc::alias("cxxStructDerivations") +#define CXXSTRUCTDERIVATIONVIRTUAL Doc::alias("cxxStructDerivationVirtual") +#define CXXSTRUCTDETAIL Doc::alias("cxxStructDetail") +#define CXXSTRUCTENUMERATIONINHERITED Doc::alias("cxxStructEnumerationInherited") +#define CXXSTRUCTENUMERATORINHERITED Doc::alias("cxxStructEnumeratorInherited") +#define CXXSTRUCTFUNCTIONINHERITED Doc::alias("cxxStructFunctionInherited") +#define CXXSTRUCTINHERITS Doc::alias("cxxStructInherits") +#define CXXSTRUCTINHERITSDETAIL Doc::alias("cxxStructInheritsDetail") +#define CXXSTRUCTNESTED Doc::alias("cxxStructNested") +#define CXXSTRUCTNESTEDCLASS Doc::alias("cxxStructNestedClass") +#define CXXSTRUCTNESTEDDETAIL Doc::alias("cxxStructNestedDetail") +#define CXXSTRUCTNESTEDSTRUCT Doc::alias("cxxStructNestedStruct") +#define CXXSTRUCTNESTEDUNION Doc::alias("cxxStructNestedUnion") +#define CXXSTRUCTTEMPLATEPARAMETER Doc::alias("cxxStructTemplateParameter") +#define CXXSTRUCTTEMPLATEPARAMETERS Doc::alias("cxxStructTemplateParameters") +#define CXXSTRUCTTEMPLATEPARAMETERTYPE Doc::alias("cxxStructTemplateParameterType") +#define CXXSTRUCTVARIABLEINHERITED Doc::alias("cxxStructVariableInherited") + +#define CXXTYPEDEF Doc::alias("cxxTypedef") +#define CXXTYPEDEFACCESSSPECIFIER Doc::alias("cxxTypedefAccessSpecifier") +#define CXXTYPEDEFAPIITEMLOCATION Doc::alias("cxxTypedefAPIItemLocation") +#define CXXTYPEDEFDECLARATIONFILE Doc::alias("cxxTypedefDeclarationFile") +#define CXXTYPEDEFDECLARATIONFILELINE Doc::alias("cxxTypedefDeclarationFileLine") +#define CXXTYPEDEFDECLAREDTYPE Doc::alias("cxxTypedefDeclaredType") +#define CXXTYPEDEFDEFINITION Doc::alias("cxxTypedefDefinition") +#define CXXTYPEDEFDETAIL Doc::alias("cxxTypedefDetail") +#define CXXTYPEDEFNAMELOOKUP Doc::alias("cxxTypedefNameLookup") +#define CXXTYPEDEFPROTOTYPE Doc::alias("cxxTypedefPrototype") +#define CXXTYPEDEFREIMPLEMENTED Doc::alias("cxxTypedefReimplemented") +#define CXXTYPEDEFSCOPEDNAME Doc::alias("cxxTypedefScopedName") + +#define CXXUNION Doc::alias("cxxUnion") +#define CXXUNIONABSTRACT Doc::alias("cxxUnionAbstract") +#define CXXUNIONACCESSSPECIFIER Doc::alias("cxxUnionAccessSpecifier") +#define CXXUNIONAPIITEMLOCATION Doc::alias("cxxUnionAPIItemLocation") +#define CXXUNIONDECLARATIONFILE Doc::alias("cxxUnionDeclarationFile") +#define CXXUNIONDECLARATIONFILELINE Doc::alias("cxxUnionDeclarationFileLine") +#define CXXUNIONDEFINITION Doc::alias("cxxUnionDefinition") +#define CXXUNIONDEFINITIONFILE Doc::alias("cxxUnionDefinitionFile") +#define CXXUNIONDEFINITIONFILELINEEND Doc::alias("cxxUnionDefinitionFileLineEnd") +#define CXXUNIONDEFINITIONFILELINESTART Doc::alias("cxxUnionDefinitionFileLineStart") +#define CXXUNIONDETAIL Doc::alias("cxxUnionDetail") +#define CXXUNIONNESTED Doc::alias("cxxUnionNested") +#define CXXUNIONNESTEDCLASS Doc::alias("cxxUnionNestedClass") +#define CXXUNIONNESTEDDETAIL Doc::alias("cxxUnionNestedDetail") +#define CXXUNIONNESTEDSTRUCT Doc::alias("cxxUnionNestedStruct") +#define CXXUNIONNESTEDUNION Doc::alias("cxxUnionNestedUnion") +#define CXXUNIONTEMPLATEPARAMETER Doc::alias("cxxUnionTemplateParameter") +#define CXXUNIONTEMPLATEPARAMETERS Doc::alias("cxxUnionTemplateParameters") +#define CXXUNIONTEMPLATEPARAMETERTYPE Doc::alias("cxxUnionTemplateParameterType") + +#define CXXVARIABLE Doc::alias("cxxVariable") +#define CXXVARIABLEACCESSSPECIFIER Doc::alias("cxxVariableAccessSpecifier") +#define CXXVARIABLEAPIITEMLOCATION Doc::alias("cxxVariableAPIItemLocation") +#define CXXVARIABLECONST Doc::alias("cxxVariableConst") +#define CXXVARIABLEDECLARATIONFILE Doc::alias("cxxVariableDeclarationFile") +#define CXXVARIABLEDECLARATIONFILELINE Doc::alias("cxxVariableDeclarationFileLine") +#define CXXVARIABLEDECLAREDTYPE Doc::alias("cxxVariableDeclaredType") +#define CXXVARIABLEDEFINITION Doc::alias("cxxVariableDefinition") +#define CXXVARIABLEDETAIL Doc::alias("cxxVariableDetail") +#define CXXVARIABLENAMELOOKUP Doc::alias("cxxVariableNameLookup") +#define CXXVARIABLEPROTOTYPE Doc::alias("cxxVariablePrototype") +#define CXXVARIABLEREIMPLEMENTED Doc::alias("cxxVariableReimplemented") +#define CXXVARIABLESCOPEDNAME Doc::alias("cxxVariableScopedName") +#define CXXVARIABLESTORAGECLASSSPECIFIEREXTERN Doc::alias("cxxVariableStorageClassSpecifierExtern") +#define CXXVARIABLESTORAGECLASSSPECIFIERMUTABLE Doc::alias("cxxVariableStorageClassSpecifierMutable") +#define CXXVARIABLESTORAGECLASSSPECIFIERSTATIC Doc::alias("cxxVariableStorageClassSpecifierStatic") +#define CXXVARIABLEVOLATILE Doc::alias("cxxVariableVolatile") + +#define APIREF Doc::alias("apiRef") +#define APINAME Doc::alias("apiName") +#define APIDETAIL Doc::alias("apiDetail") +#define APISYNTAX Doc::alias("apiSyntax") +#define APISYNTAXTEXT Doc::alias("apiSyntaxText") +#define APISYNTAXITEM Doc::alias("apiSyntaxItem") +#define APIDEF Doc::alias("apiDef") +#define APIQUALIFIER Doc::alias("apiQualifier") +#define APIRELATION Doc::alias("apiRelation") +#define APITYPE Doc::alias("apiType") +#define APIARRAY Doc::alias("apiArray") +#define APIDATA Doc::alias("apiData") +#define APIDEFNOTE Doc::alias("apiDefNote") +#define APIDEFITEM Doc::alias("apiDefItem") +#define APIITEMNAME Doc::alias("apiItemName") +#define APIDESC Doc::alias("apiDesc") +#define APIIMPL Doc::alias("apiImpl") + +#define APIPACKAGE Doc::alias("apiPackage") + +#define APICLASSIFIER Doc::alias("apiClassifier") +#define APICLASSIFIERDETAIL Doc::alias("apiClassifierDetail") +#define APICLASSIFIERDEF Doc::alias("apiClassifierDef") +#define APICLASSIFIERMEMBER Doc::alias("apiClassifierMember") +#define APIOTHERCLASSIFIER Doc::alias("apiOtherClassifier") +#define APIBASECLASSIFIER Doc::alias("apiBaseClassifier") + +#define APIOPERATION Doc::alias("apiOperation") +#define APIOPERATIONDETAIL Doc::alias("apiOperationDetail") +#define APIOPERATIONDEF Doc::alias("apiOperationDef") +#define APIRETURN Doc::alias("apiReturn") +#define APIPARAM Doc::alias("apiParam") +#define APIEVENT Doc::alias("apiEvent") +#define APIOPERATIONDEFITEM Doc::alias("apiOperationDefItem") +#define APIOPERATIONCLASSIFIER Doc::alias("apiOperationClassifier") +#define APICONSTRUCTORDEF Doc::alias("apiConstructorDef") + +#define APIVALUE Doc::alias("apiValue") +#define APIVALUEDETAIL Doc::alias("apiValueDetail") +#define APIVALUEDEF Doc::alias("apiValueDef") +#define APIVALUEMEMBER Doc::alias("apiValueMember") +#define APIVALUECLASSIFIER Doc::alias("apiValueClassifier") + +#define APIclassifier Doc::alias("apiclassifier") +#define APIoperation Doc::alias("apioperation") +#define APIpackage Doc::alias("apipackage") +#define APIvalue Doc::alias("apivalue") + +#define APIMAP Doc::alias("apiMap") +#define APIITEMREF Doc::alias("apiItemRef") + +#define SHORTDESC Doc::alias("shortdesc") + +QString DitaXmlGenerator::sinceTitles[] = + { + " New Namespaces", + " New Classes", + " New Member Functions", + " New Functions in Namespaces", + " New Global Functions", + " New Macros", + " New Enum Types", + " New Typedefs", + " New Properties", + " New Variables", + " New QML Elements", + " New Qml Properties", + " New Qml Signals", + " New Qml Methods", + "" + }; + +static bool showBrokenLinks = false; + +static void addLink(const QString &linkTarget, + const QStringRef &nestedStuff, + QString *res) +{ + if (!linkTarget.isEmpty()) { + *res += "<xref href=\""; + *res += linkTarget; + *res += "\">"; + *res += nestedStuff; + *res += "</xref>"; + } + else { + *res += nestedStuff; + } +} + + +DitaXmlGenerator::DitaXmlGenerator() + : inLink(false), + inContents(false), + inSectionHeading(false), + inTableHeader(false), + numTableRows(0), + threeColumnEnumValueTable(true), + offlineDocs(true), + funcLeftParen("\\S(\\()"), + myTree(0), + slow(false), + obsoleteLinks(false), + noLinks(0) +{ +} + +DitaXmlGenerator::~DitaXmlGenerator() +{ + // nothing yet. +} + +void DitaXmlGenerator::initializeGenerator(const Config &config) +{ + static const struct { + const char *key; + const char *tag; + } defaults[] = { + { ATOM_FORMATTING_BOLD, "b" }, + { ATOM_FORMATTING_INDEX, "<!--" }, + { ATOM_FORMATTING_ITALIC, "i" }, + { ATOM_FORMATTING_PARAMETER, "i" }, + { ATOM_FORMATTING_SUBSCRIPT, "sub" }, + { ATOM_FORMATTING_SUPERSCRIPT, "sup" }, + { ATOM_FORMATTING_TELETYPE, "tt", }, + { ATOM_FORMATTING_UNDERLINE, "u", }, + { 0, 0 } + }; + + Generator::initializeGenerator(config); + obsoleteLinks = config.getBool(QLatin1String(CONFIG_OBSOLETELINKS)); + setImageFileExtensions(QStringList() << "png" << "jpg" << "jpeg" << "gif"); + int i = 0; + while (defaults[i].key) { + formattingLeftMap().insert(defaults[i].key, defaults[i].tag); + i++; + } + + style = config.getString(DitaXmlGenerator::format() + + Config::dot + + DITAXMLGENERATOR_STYLE); + postHeader = config.getString(DitaXmlGenerator::format() + + Config::dot + + DITAXMLGENERATOR_POSTHEADER); + postPostHeader = config.getString(DitaXmlGenerator::format() + + Config::dot + + DITAXMLGENERATOR_POSTPOSTHEADER); + footer = config.getString(DitaXmlGenerator::format() + + Config::dot + + DITAXMLGENERATOR_FOOTER); + address = config.getString(DitaXmlGenerator::format() + + Config::dot + + DITAXMLGENERATOR_ADDRESS); + pleaseGenerateMacRef = config.getBool(DitaXmlGenerator::format() + + Config::dot + + DITAXMLGENERATOR_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"; + + projectUrl = config.getString(CONFIG_URL); + + outputEncoding = config.getString(CONFIG_OUTPUTENCODING); + if (outputEncoding.isEmpty()) + outputEncoding = QLatin1String("ISO-8859-1"); + outputCodec = QTextCodec::codecForName(outputEncoding.toLocal8Bit()); + + naturalLanguage = config.getString(CONFIG_NATURALLANGUAGE); + if (naturalLanguage.isEmpty()) + naturalLanguage = QLatin1String("en"); + + QSet<QString> editionNames = config.subVars(CONFIG_EDITION); + QSet<QString>::ConstIterator edition = editionNames.begin(); + while (edition != editionNames.end()) { + QString editionName = *edition; + QStringList editionModules = config.getStringList(CONFIG_EDITION + + Config::dot + + editionName + + Config::dot + + "modules"); + QStringList editionGroups = config.getStringList(CONFIG_EDITION + + Config::dot + + editionName + + Config::dot + + "groups"); + + if (!editionModules.isEmpty()) + editionModuleMap[editionName] = editionModules; + if (!editionGroups.isEmpty()) + editionGroupMap[editionName] = editionGroups; + + ++edition; + } + + slow = config.getBool(CONFIG_SLOW); + + stylesheets = config.getStringList(DitaXmlGenerator::format() + + Config::dot + + DITAXMLGENERATOR_STYLESHEETS); + customHeadElements = config.getStringList(DitaXmlGenerator::format() + + Config::dot + + DITAXMLGENERATOR_CUSTOMHEADELEMENTS); + codeIndent = config.getInt(CONFIG_CODEINDENT); + +} + +void DitaXmlGenerator::terminateGenerator() +{ + Generator::terminateGenerator(); +} + +QString DitaXmlGenerator::format() +{ + return "DITAXML"; +} + +/*! + Calls lookupGuid() to get a GUID for \a text, then writes + it to the XML stream as an "id" attribute, and returns it. + */ +QString DitaXmlGenerator::writeGuidAttribute(QString text) +{ + QString guid = lookupGuid(text); + writer.writeAttribute("id",guid); + return guid; +} + +/*! + Looks up \a text in the GUID map. If it finds \a text, + it returns the associated GUID. Otherwise it inserts + \a text into the map with a new GUID, and it returns + the new GUID. + */ +QString DitaXmlGenerator::lookupGuid(QString text) +{ + QMap<QString, QString>::const_iterator i = name2guidMap.find(text); + if (i != name2guidMap.end()) + return i.value(); + QString guid = QUuid::createUuid().toString(); + name2guidMap.insert(text,guid); + return guid; +} + +/*! + This is where the DITA XML files are written. + \note The file generation is done in the base class, + PageGenerator::generateTree(). + */ +void DitaXmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) +{ + myTree = tree; + nonCompatClasses.clear(); + mainClasses.clear(); + compatClasses.clear(); + obsoleteClasses.clear(); + moduleClassMap.clear(); + moduleNamespaceMap.clear(); + funcIndex.clear(); + legaleseTexts.clear(); + serviceClasses.clear(); + findAllClasses(tree->root()); + findAllFunctions(tree->root()); + findAllLegaleseTexts(tree->root()); + findAllNamespaces(tree->root()); + findAllSince(tree->root()); + + PageGenerator::generateTree(tree, marker); +} + +void DitaXmlGenerator::startText(const Node* /* relative */, + CodeMarker* /* marker */) +{ + inLink = false; + inContents = false; + inSectionHeading = false; + inTableHeader = false; + numTableRows = 0; + threeColumnEnumValueTable = true; + link.clear(); + sectionNumber.clear(); +} + +/*! + Generate html from an instance of Atom. + */ +int DitaXmlGenerator::generateAtom(const Atom *atom, + const Node *relative, + CodeMarker *marker) +{ + int skipAhead = 0; + QString hx; + static bool in_para = false; + QString guid; + + switch (atom->type()) { + case Atom::AbstractLeft: + break; + case Atom::AbstractRight: + break; + case Atom::AutoLink: + if ((noLinks > 0) && !inLink && !inContents && !inSectionHeading) { + const Node *node = 0; + QString link = getLink(atom, relative, marker, &node); + if (!link.isEmpty()) { + beginLink(link, node, relative, marker); + generateLink(atom, relative, marker); + endLink(); + } + else { + writer.writeCharacters(protectEnc(atom->string())); + } + } + else { + writer.writeCharacters(protectEnc(atom->string())); + } + break; + case Atom::BaseName: + break; + case Atom::BriefLeft: + if (relative->type() == Node::Fake) { + skipAhead = skipAtoms(atom, Atom::BriefRight); + break; + } + writer.writeStartElement(SHORTDESC); + if (relative->type() == Node::Property || + relative->type() == Node::Variable) { + QString str; + atom = atom->next(); + while (atom != 0 && atom->type() != Atom::BriefRight) { + if (atom->type() == Atom::String || + atom->type() == Atom::AutoLink) + str += atom->string(); + skipAhead++; + atom = atom->next(); + } + str[0] = str[0].toLower(); + if (str.right(1) == ".") + str.truncate(str.length() - 1); + writer.writeCharacters("This "); + if (relative->type() == Node::Property) + writer.writeCharacters("property"); + else + writer.writeCharacters("variable"); + QStringList words = str.split(" "); + if (!(words.first() == "contains" || words.first() == "specifies" + || words.first() == "describes" || words.first() == "defines" + || words.first() == "holds" || words.first() == "determines")) + writer.writeCharacters(" holds "); + else + writer.writeCharacters(" "); + writer.writeCharacters(str + "."); + } + break; + case Atom::BriefRight: + if (relative->type() != Node::Fake) { + writer.writeEndElement(); // </shortdesc> + } + break; + case Atom::C: + writer.writeStartElement(formattingLeftMap()[ATOM_FORMATTING_TELETYPE]); + if (inLink) { + writer.writeCharacters(protectEnc(plainCode(atom->string()))); + } + else { + writer.writeCharacters(highlightedCode(atom->string(), marker, relative)); + } + writer.writeEndElement(); // sse writeStartElement() above + break; + case Atom::Code: + writer.writeStartElement("pre"); + writer.writeAttribute("outputclass","highlightedCode"); + writer.writeCharacters(trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()), + marker, + relative))); + writer.writeEndElement(); // </pre> + break; +#ifdef QDOC_QML + case Atom::Qml: + writer.writeStartElement("pre"); + writer.writeAttribute("outputclass","highlightedCode"); + writer.writeCharacters(trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()), + marker, + relative))); + writer.writeEndElement(); // pre + break; +#endif + case Atom::CodeNew: + writer.writeStartElement("p"); + writer.writeCharacters("you can rewrite it as"); + writer.writeEndElement(); // </p> + writer.writeStartElement("pre"); + writer.writeAttribute("outputclass","highlightedCode"); + writer.writeCharacters(trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()), + marker, + relative))); + writer.writeEndElement(); // </pre> + break; + case Atom::CodeOld: + writer.writeStartElement("p"); + writer.writeCharacters("For example, if you have code like"); + writer.writeEndElement(); // </p> + // fallthrough + case Atom::CodeBad: + writer.writeStartElement("pre"); + writer.writeAttribute("outputclass","highlightedCode"); + writer.writeCharacters(trimmedTrailing(protectEnc(plainCode(indent(codeIndent,atom->string()))))); + writer.writeEndElement(); // </pre> + break; + case Atom::FootnoteLeft: + // ### For now + if (in_para) { + writer.writeEndElement(); // </p> + in_para = false; + } + writer.writeCharacters("<!-- "); + break; + case Atom::FootnoteRight: + // ### For now + writer.writeCharacters("-->"); + break; + case Atom::FormatElse: + case Atom::FormatEndif: + case Atom::FormatIf: + break; + case Atom::FormattingLeft: + writer.writeStartElement(formattingLeftMap()[atom->string()]); + if (atom->string() == ATOM_FORMATTING_PARAMETER) { + if (atom->next() != 0 && atom->next()->type() == Atom::String) { + QRegExp subscriptRegExp("([a-z]+)_([0-9n])"); + if (subscriptRegExp.exactMatch(atom->next()->string())) { + writer.writeCharacters(subscriptRegExp.cap(1)); + writer.writeStartElement("sub"); + writer.writeCharacters(subscriptRegExp.cap(2)); + writer.writeEndElement(); // </sub> + skipAhead = 1; + } + } + } + break; + case Atom::FormattingRight: + if (atom->string() == ATOM_FORMATTING_LINK) { + endLink(); + } + else { + writer.writeEndElement(); // ? + } + break; + case Atom::AnnotatedList: + { + QList<Node*> values = myTree->groups().values(atom->string()); + NodeMap nodeMap; + for (int i = 0; i < values.size(); ++i) { + const Node* n = values.at(i); + if ((n->status() != Node::Internal) && (n->access() != Node::Private)) { + nodeMap.insert(n->nameForLists(),n); + } + } + generateAnnotatedList(relative, marker, nodeMap); + } + break; + case Atom::GeneratedList: + if (atom->string() == "annotatedclasses") { + generateAnnotatedList(relative, marker, nonCompatClasses); + } + else if (atom->string() == "classes") { + generateCompactList(relative, marker, nonCompatClasses, true); + } + else if (atom->string().contains("classesbymodule")) { + QString arg = atom->string().trimmed(); + QString moduleName = atom->string().mid(atom->string().indexOf( + "classesbymodule") + 15).trimmed(); + if (moduleClassMap.contains(moduleName)) + generateAnnotatedList(relative, marker, moduleClassMap[moduleName]); + } + else if (atom->string().contains("classesbyedition")) { + + QString arg = atom->string().trimmed(); + QString editionName = atom->string().mid(atom->string().indexOf( + "classesbyedition") + 16).trimmed(); + + if (editionModuleMap.contains(editionName)) { + + // Add all classes in the modules listed for that edition. + NodeMap editionClasses; + foreach (const QString &moduleName, editionModuleMap[editionName]) { + if (moduleClassMap.contains(moduleName)) + editionClasses.unite(moduleClassMap[moduleName]); + } + + // Add additional groups and remove groups of classes that + // should be excluded from the edition. + + QMultiMap <QString, Node *> groups = myTree->groups(); + foreach (const QString &groupName, editionGroupMap[editionName]) { + QList<Node *> groupClasses; + if (groupName.startsWith("-")) { + groupClasses = groups.values(groupName.mid(1)); + foreach (const Node *node, groupClasses) + editionClasses.remove(node->name()); + } + else { + groupClasses = groups.values(groupName); + foreach (const Node *node, groupClasses) + editionClasses.insert(node->name(), node); + } + } + generateAnnotatedList(relative, marker, editionClasses); + } + } + else if (atom->string() == "classhierarchy") { + generateClassHierarchy(relative, marker, nonCompatClasses); + } + else if (atom->string() == "compatclasses") { + generateCompactList(relative, marker, compatClasses, false); + } + else if (atom->string() == "obsoleteclasses") { + generateCompactList(relative, marker, obsoleteClasses, false); + } + else if (atom->string() == "functionindex") { + generateFunctionIndex(relative, marker); + } + else if (atom->string() == "legalese") { + generateLegaleseList(relative, marker); + } + else if (atom->string() == "mainclasses") { + generateCompactList(relative, marker, mainClasses, true); + } + else if (atom->string() == "services") { + generateCompactList(relative, marker, serviceClasses, false); + } + else if (atom->string() == "overviews") { + generateOverviewList(relative, marker); + } + else if (atom->string() == "namespaces") { + generateAnnotatedList(relative, marker, namespaceIndex); + } + else if (atom->string() == "related") { + const FakeNode *fake = static_cast<const FakeNode *>(relative); + if (fake && !fake->groupMembers().isEmpty()) { + NodeMap groupMembersMap; + foreach (const Node *node, fake->groupMembers()) { + if (node->type() == Node::Fake) + groupMembersMap[fullName(node, relative, marker)] = node; + } + generateAnnotatedList(fake, marker, groupMembersMap); + } + } + else if (atom->string() == "relatedinline") { + const FakeNode *fake = static_cast<const FakeNode *>(relative); + if (fake && !fake->groupMembers().isEmpty()) { + // Reverse the list into the original scan order. + // Should be sorted. But on what? It may not be a + // regular class or page definition. + QList<const Node *> list; + foreach (const Node *node, fake->groupMembers()) + list.prepend(node); + foreach (const Node *node, list) + generateBody(node, marker); + } + } + break; + case Atom::SinceList: + { + NewSinceMaps::const_iterator nsmap; + nsmap = newSinceMaps.find(atom->string()); + NewClassMaps::const_iterator ncmap; + ncmap = newClassMaps.find(atom->string()); + NewClassMaps::const_iterator nqcmap; + nqcmap = newQmlClassMaps.find(atom->string()); + if ((nsmap != newSinceMaps.constEnd()) && !nsmap.value().isEmpty()) { + QList<Section> sections; + QList<Section>::ConstIterator s; + for (int i=0; i<LastSinceType; ++i) + sections.append(Section(sinceTitle(i),QString(),QString(),QString())); + + NodeMultiMap::const_iterator n = nsmap.value().constBegin(); + while (n != nsmap.value().constEnd()) { + const Node* node = n.value(); + switch (node->type()) { + case Node::Fake: + if (node->subType() == Node::QmlClass) { + sections[QmlClass].appendMember((Node*)node); + } + break; + case Node::Namespace: + sections[Namespace].appendMember((Node*)node); + break; + case Node::Class: + sections[Class].appendMember((Node*)node); + break; + case Node::Enum: + sections[Enum].appendMember((Node*)node); + break; + case Node::Typedef: + sections[Typedef].appendMember((Node*)node); + break; + case Node::Function: { + const FunctionNode* fn = static_cast<const FunctionNode*>(node); + if (fn->isMacro()) + sections[Macro].appendMember((Node*)node); + else { + Node* p = fn->parent(); + if (p) { + if (p->type() == Node::Class) + sections[MemberFunction].appendMember((Node*)node); + else if (p->type() == Node::Namespace) { + if (p->name().isEmpty()) + sections[GlobalFunction].appendMember((Node*)node); + else + sections[NamespaceFunction].appendMember((Node*)node); + } + else + sections[GlobalFunction].appendMember((Node*)node); + } + else + sections[GlobalFunction].appendMember((Node*)node); + } + break; + } + case Node::Property: + sections[Property].appendMember((Node*)node); + break; + case Node::Variable: + sections[Variable].appendMember((Node*)node); + break; + case Node::QmlProperty: + sections[QmlProperty].appendMember((Node*)node); + break; + case Node::QmlSignal: + sections[QmlSignal].appendMember((Node*)node); + break; + case Node::QmlMethod: + sections[QmlMethod].appendMember((Node*)node); + break; + default: + break; + } + ++n; + } + + /* + First generate the table of contents. + */ + writer.writeStartElement("ul"); + s = sections.constBegin(); + while (s != sections.constEnd()) { + if (!(*s).members.isEmpty()) { + + writer.writeStartElement("li"); + writer.writeStartElement("xref"); + writer.writeAttribute("href",QString("#" + Doc::canonicalTitle((*s).name))); + writer.writeCharacters((*s).name); + writer.writeEndElement(); // </xref> + writer.writeEndElement(); // </li> + } + ++s; + } + writer.writeEndElement(); // </ul> + + int idx = 0; + s = sections.constBegin(); + while (s != sections.constEnd()) { + if (!(*s).members.isEmpty()) { + writer.writeStartElement("p"); + writeGuidAttribute(Doc::canonicalTitle((*s).name)); + writer.writeAttribute("outputclass","h3"); + writer.writeCharacters(protectEnc((*s).name)); + writer.writeEndElement(); // </p> + if (idx == Class) + generateCompactList(0, marker, ncmap.value(), false, QString("Q")); + else if (idx == QmlClass) + generateCompactList(0, marker, nqcmap.value(), false, QString("Q")); + else if (idx == MemberFunction) { + ParentMaps parentmaps; + ParentMaps::iterator pmap; + NodeList::const_iterator i = s->members.constBegin(); + while (i != s->members.constEnd()) { + Node* p = (*i)->parent(); + pmap = parentmaps.find(p); + if (pmap == parentmaps.end()) + pmap = parentmaps.insert(p,NodeMultiMap()); + pmap->insert((*i)->name(),(*i)); + ++i; + } + pmap = parentmaps.begin(); + while (pmap != parentmaps.end()) { + NodeList nlist = pmap->values(); + writer.writeStartElement("p"); + writer.writeCharacters("Class "); + writer.writeStartElement("xref"); + writer.writeAttribute("href",linkForNode(pmap.key(), 0)); + QStringList pieces = fullName(pmap.key(), 0, marker).split("::"); + writer.writeCharacters(protectEnc(pieces.last())); + writer.writeEndElement(); // </xref> + writer.writeCharacters(":"); + writer.writeEndElement(); // </p> + + generateSection(nlist, 0, marker, CodeMarker::Summary); + writer.writeEmptyElement("br"); + ++pmap; + } + } + else + generateSection(s->members, 0, marker, CodeMarker::Summary); + } + ++idx; + ++s; + } + } + } + break; + case Atom::Image: + case Atom::InlineImage: + { + QString fileName = imageFileName(relative, atom->string()); + QString text; + if (atom->next() != 0) + text = atom->next()->string(); + if (atom->type() == Atom::Image) { + writer.writeStartElement("p"); + writer.writeAttribute("outputclass","centerAlign"); + } + if (fileName.isEmpty()) { + writer.writeStartElement("font"); + writer.writeAttribute("color","red"); + writer.writeCharacters("[Missing image: "); + writer.writeCharacters(protectEnc(atom->string())); + writer.writeEndElement(); // </font> + } + else { + writer.writeStartElement("img"); + writer.writeAttribute("src",protectEnc(fileName)); + if (!text.isEmpty()) + writer.writeAttribute("alt",protectEnc(text)); + writer.writeEndElement(); // </img> + } + if (atom->type() == Atom::Image) + writer.writeEndElement(); // </p> + } + break; + case Atom::ImageText: + // nothing + break; + case Atom::LegaleseLeft: + writer.writeStartElement("p"); + writer.writeAttribute("outputclass","legalese"); + break; + case Atom::LegaleseRight: + writer.writeEndElement(); // </p> + break; + case Atom::LineBreak: + writer.writeEmptyElement("br"); + break; + case Atom::Link: + { + const Node *node = 0; + QString myLink = getLink(atom, relative, marker, &node); + if (myLink.isEmpty()) { + relative->doc().location().warning(tr("Cannot link to '%1' in %2") + .arg(atom->string()) + .arg(marker->plainFullName(relative))); + } + beginLink(myLink, node, relative, marker); + skipAhead = 1; + } + break; + case Atom::LinkNode: + { + const Node *node = CodeMarker::nodeForString(atom->string()); + beginLink(linkForNode(node, relative), node, relative, marker); + skipAhead = 1; + } + break; + case Atom::ListLeft: + if (in_para) { + writer.writeEndElement(); // </p> + in_para = false; + } + if (atom->string() == ATOM_LIST_BULLET) { + writer.writeStartElement("ul"); + } + else if (atom->string() == ATOM_LIST_TAG) { + writer.writeStartElement("dl"); + } + else if (atom->string() == ATOM_LIST_VALUE) { + threeColumnEnumValueTable = isThreeColumnEnumValueTable(atom); + if (threeColumnEnumValueTable) { + writer.writeStartElement("table"); + writer.writeAttribute("outputclass","valuelist"); + writer.writeStartElement("tr"); + if (++numTableRows % 2 == 1) + writer.writeAttribute("outputclass","odd"); + else + writer.writeAttribute("outputclass","even"); + writer.writeStartElement("th"); + writer.writeCharacters("Constant"); + writer.writeEndElement(); // </th> + writer.writeStartElement("th"); + writer.writeCharacters("Value"); + writer.writeEndElement(); // </th> + writer.writeStartElement("th"); + writer.writeCharacters("Description"); + writer.writeEndElement(); // </th> + writer.writeEndElement(); // </tr> + } + else { + writer.writeStartElement("table"); + writer.writeAttribute("outputclass","valuelist"); + writer.writeStartElement("tr"); + writer.writeStartElement("th"); + writer.writeCharacters("Constant"); + writer.writeEndElement(); // </th> + writer.writeStartElement("th"); + writer.writeCharacters("Value"); + writer.writeEndElement(); // </th> + writer.writeEndElement(); // </tr> + } + } + else { + writer.writeStartElement("ol"); + if (atom->string() == ATOM_LIST_UPPERALPHA) + writer.writeAttribute("type","A"); + else if (atom->string() == ATOM_LIST_LOWERALPHA) + writer.writeAttribute("type","a"); + else if (atom->string() == ATOM_LIST_UPPERROMAN) + writer.writeAttribute("type","I"); + else if (atom->string() == ATOM_LIST_LOWERROMAN) + writer.writeAttribute("type","i"); + else // (atom->string() == ATOM_LIST_NUMERIC) + writer.writeAttribute("type","1"); + if (atom->next() != 0 && atom->next()->string().toInt() != 1) + writer.writeAttribute("start",atom->next()->string()); + } + break; + case Atom::ListItemNumber: + // nothing + break; + case Atom::ListTagLeft: + if (atom->string() == ATOM_LIST_TAG) { + writer.writeStartElement("dt"); + } + else { // (atom->string() == ATOM_LIST_VALUE) + writer.writeStartElement("tr"); + writer.writeStartElement("td"); + writer.writeAttribute("outputclass","topAlign"); + writer.writeStartElement("tt"); + writer.writeCharacters(protectEnc(plainCode(marker->markedUpEnumValue(atom->next()->string(), + relative)))); + writer.writeEndElement(); // </tt> + writer.writeEndElement(); // </td> + writer.writeStartElement("td"); + writer.writeAttribute("outputclass","topAlign"); + + QString itemValue; + if (relative->type() == Node::Enum) { + const EnumNode *enume = static_cast<const EnumNode *>(relative); + itemValue = enume->itemValue(atom->next()->string()); + } + + if (itemValue.isEmpty()) + writer.writeCharacters("?"); + else { + writer.writeStartElement("tt"); + writer.writeCharacters(protectEnc(itemValue)); + writer.writeEndElement(); // </tt> + } + skipAhead = 1; + } + break; + case Atom::ListTagRight: + if (atom->string() == ATOM_LIST_TAG) + writer.writeEndElement(); // </dt> + break; + case Atom::ListItemLeft: + if (atom->string() == ATOM_LIST_TAG) { + writer.writeStartElement("dd"); + } + else if (atom->string() == ATOM_LIST_VALUE) { + if (threeColumnEnumValueTable) { + writer.writeEndElement(); // </td> + writer.writeStartElement("td"); + writer.writeAttribute("outputclass","topAlign"); + if (matchAhead(atom, Atom::ListItemRight)) + writer.writeCharacters(" "); + } + } + else { + writer.writeStartElement("li"); + } + if (matchAhead(atom, Atom::ParaLeft)) + skipAhead = 1; + break; + case Atom::ListItemRight: + if (atom->string() == ATOM_LIST_TAG) { + writer.writeEndElement(); // </dd> + } + else if (atom->string() == ATOM_LIST_VALUE) { + writer.writeEndElement(); // </td> + writer.writeEndElement(); // </tr> + } + else { + writer.writeEndElement(); // </li> + } + break; + case Atom::ListRight: + if (atom->string() == ATOM_LIST_BULLET) { + writer.writeEndElement(); // </ul> + } + else if (atom->string() == ATOM_LIST_TAG) { + writer.writeEndElement(); // </dl> + } + else if (atom->string() == ATOM_LIST_VALUE) { + writer.writeEndElement(); // </table> + } + else { + writer.writeEndElement(); // </ol> + } + break; + case Atom::Nop: + // nothing + break; + case Atom::ParaLeft: + writer.writeStartElement("p"); + in_para = true; + break; + case Atom::ParaRight: + endLink(); + if (in_para) { + writer.writeEndElement(); // </p? + in_para = false; + } + break; + case Atom::QuotationLeft: + writer.writeStartElement("blockquote"); + break; + case Atom::QuotationRight: + writer.writeEndElement(); // </blockquote> + break; + case Atom::RawString: + writer.writeCharacters(atom->string()); + break; + case Atom::SectionLeft: + writer.writeStartElement("p"); + writeGuidAttribute(Doc::canonicalTitle(Text::sectionHeading(atom).toString())); + writer.writeAttribute("outputclass","target"); + writer.writeCharacters(protectEnc(Text::sectionHeading(atom).toString())); + writer.writeEndElement(); // </p> + break; + case Atom::SectionRight: + // nothing + break; + case Atom::SectionHeadingLeft: + writer.writeStartElement("p"); + hx = "h" + QString::number(atom->string().toInt() + hOffset(relative)); + writer.writeAttribute("outputclass",hx); + inSectionHeading = true; + break; + case Atom::SectionHeadingRight: + writer.writeEndElement(); // </p> (see case Atom::SectionHeadingLeft) + inSectionHeading = false; + break; + case Atom::SidebarLeft: + // nothing + break; + case Atom::SidebarRight: + // nothing + break; + case Atom::String: + if (inLink && !inContents && !inSectionHeading) { + generateLink(atom, relative, marker); + } + else { + writer.writeCharacters(protectEnc(atom->string())); + } + break; + case Atom::TableLeft: + if (in_para) { + writer.writeEndElement(); // </p> + in_para = false; + } + writer.writeStartElement("table"); + writer.writeAttribute("outputclass","generic"); + numTableRows = 0; + break; + case Atom::TableRight: + writer.writeEndElement(); // </table> + break; + case Atom::TableHeaderLeft: + writer.writeStartElement("thead"); + writer.writeStartElement("tr"); + writer.writeAttribute("outputclass","qt-style topAlign"); + inTableHeader = true; + break; + case Atom::TableHeaderRight: + writer.writeEndElement(); // </tr> + if (matchAhead(atom, Atom::TableHeaderLeft)) { + skipAhead = 1; + writer.writeStartElement("tr"); + writer.writeAttribute("outputclass","qt-style topAlign"); + } + else { + writer.writeEndElement(); // </thead> + inTableHeader = false; + } + break; + case Atom::TableRowLeft: + writer.writeStartElement("tr"); + if (++numTableRows % 2 == 1) + writer.writeAttribute("outputclass","odd topAlign"); + else + writer.writeAttribute("outputclass","even topAlign"); + break; + case Atom::TableRowRight: + writer.writeEndElement(); // </tr>\n"; + break; + case Atom::TableItemLeft: + { + if (inTableHeader) + writer.writeStartElement("th"); + else + writer.writeStartElement("td"); + + QStringList spans = atom->string().split(","); + if (spans.size() == 2) { +#if zzz + + if (spans.at(0) != "1") + out() << " colspan=\"" << spans.at(0) << "\""; + if (spans.at(1) != "1") + out() << " rowspan=\"" << spans.at(1) << "\""; +#endif + if (!inTableHeader) + writer.writeStartElement("p"); + } + if (matchAhead(atom, Atom::ParaLeft)) + skipAhead = 1; + } + break; + case Atom::TableItemRight: + if (inTableHeader) + writer.writeEndElement(); // </th> + else { + writer.writeEndElement(); // </p> + writer.writeEndElement(); // </td> + } + if (matchAhead(atom, Atom::ParaLeft)) + skipAhead = 1; + break; + case Atom::TableOfContents: + { + int numColumns = 1; + const Node *node = relative; + + Doc::SectioningUnit sectioningUnit = Doc::Section4; + QStringList params = atom->string().split(","); + QString columnText = params.at(0); + QStringList pieces = columnText.split(" ", QString::SkipEmptyParts); + if (pieces.size() >= 2) { + columnText = pieces.at(0); + pieces.pop_front(); + QString path = pieces.join(" ").trimmed(); + node = findNodeForTarget(path, relative, marker, atom); + } + + if (params.size() == 2) { + numColumns = qMax(columnText.toInt(), numColumns); + sectioningUnit = (Doc::SectioningUnit)params.at(1).toInt(); + } + + if (node) + generateTableOfContents(node, + marker, + sectioningUnit, + numColumns, + relative); + } + break; + case Atom::Target: + writer.writeStartElement("p"); + writeGuidAttribute(Doc::canonicalTitle(atom->string())); + writer.writeAttribute("outputclass","target"); + writer.writeCharacters(protectEnc(atom->string())); + writer.writeEndElement(); // </p> + break; + case Atom::UnhandledFormat: + writer.writeStartElement("b"); + writer.writeAttribute("outputclass","redFont"); + writer.writeCharacters("<Missing DITAXML>"); + writer.writeEndElement(); // </b> + break; + case Atom::UnknownCommand: + writer.writeStartElement("b"); + writer.writeAttribute("outputclass","redFont code"); + writer.writeCharacters(protectEnc(atom->string())); + writer.writeEndElement(); // </b> + break; +#ifdef QDOC_QML + case Atom::QmlText: + case Atom::EndQmlText: + // don't do anything with these. They are just tags. + break; +#endif + default: + // unknownAtom(atom); + break; + } + return skipAhead; +} + +/*! + Generate a reference page for a C++ class. + */ +void +DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* marker) +{ + QList<Section> sections; + QList<Section>::ConstIterator s; + + const ClassNode* cn = 0; + const NamespaceNode *namespasse = 0; + + QString title; + QString rawTitle; + QString fullTitle; + if (inner->type() == Node::Namespace) { + namespasse = static_cast<const NamespaceNode *>(inner); + rawTitle = marker->plainName(inner); + fullTitle = marker->plainFullName(inner); + title = rawTitle + " Namespace"; + } + else if (inner->type() == Node::Class) { + cn = static_cast<const ClassNode *>(inner); + rawTitle = marker->plainName(inner); + fullTitle = marker->plainFullName(inner); + title = rawTitle + " Class Reference"; + + generateHeader(inner); + + writer.writeStartElement(CXXCLASS); + writeGuidAttribute(fullTitle); + writer.writeStartElement(APINAME); + writer.writeCharacters(fullTitle); + writer.writeEndElement(); // </apiName> + + generateBrief(inner, marker); + + writer.writeStartElement(CXXCLASSDETAIL); + writer.writeStartElement(CXXCLASSDEFINITION); + writer.writeStartElement(CXXCLASSACCESSSPECIFIER); + writer.writeAttribute("value",inner->accessString()); + writer.writeEndElement(); // <cxxClassAccessSpecifier> + if (cn->isAbstract()) { + writer.writeStartElement(CXXCLASSABSTRACT); + writer.writeAttribute("name","abstract"); + writer.writeAttribute("value","abstract"); + writer.writeEndElement(); // </cxxClassAbstract> + } + writeDerivations(cn, marker); + writeLocation(cn, marker); + writer.writeEndElement(); // <cxxClassDefinition> + writer.writeStartElement(APIDESC); + + if (!inner->doc().isEmpty()) { + writer.writeStartElement("p"); + writer.writeAttribute("outputclass","h2"); + writer.writeCharacters("Detailed Description"); + writer.writeEndElement(); // </p> + generateBody(inner, marker); + // generateAlsoList(inner, marker); + } + + writer.writeEndElement(); // </apiDesc> + writer.writeEndElement(); // </cxxClassDetail> + + sections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay); + s = sections.begin(); + while (s != sections.end()) { + if ((*s).name == "Member Function Documentation") { + writeFunctions((*s),cn,marker); + } + else if ((*s).name == "Member Type Documentation") { + writeNestedClasses((*s),cn,marker); + writeEnumerations((*s),cn,marker); + writeTypedefs((*s),cn,marker); + } + else if ((*s).name == "Member Variable Documentation") { + writeDataMembers((*s),cn,marker); + } + else if ((*s).name == "Property Documentation") { + writeProperties((*s),cn,marker); + } + ++s; + } + writer.writeEndElement(); // </cxxClass> + } + +#ifdef WRITE_HTML + Text subtitleText; + if (rawTitle != fullTitle) + subtitleText << "(" << Atom(Atom::AutoLink, fullTitle) << ")" + << Atom(Atom::LineBreak); + + QString shortVersion; + shortVersion = project + " " + shortVersion + ": "; + shortVersion = myTree->version(); + if (shortVersion.count(QChar('.')) == 2) + shortVersion.truncate(shortVersion.lastIndexOf(QChar('.'))); + if (!shortVersion.isEmpty()) { + if (project == "QSA") + shortVersion = "QSA " + shortVersion + ": "; + else + shortVersion = "Qt " + shortVersion + ": "; + } + + out() << " <title>" << shortVersion << protectEnc(title) << "</title>\n"; + +#if 0 + out() << QString(postHeader).replace("\\" + COMMAND_VERSION, myTree->version()); + generateBreadCrumbs(title,node,marker); + out() << QString(postPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); +#endif + + sections = marker->sections(inner, CodeMarker::Summary, CodeMarker::Okay); + generateTableOfContents(inner,marker,§ions); + generateTitle(title, subtitleText, SmallSubTitle, inner, marker); + +#ifdef QDOC_QML + if (cn && !cn->qmlElement().isEmpty()) { + generateInstantiatedBy(cn,marker); + } +#endif + + generateBrief(inner, marker); + generateIncludes(inner, marker); + generateStatus(inner, marker); + if (cn) { + generateInherits(cn, marker); + generateInheritedBy(cn, marker); + } + generateThreadSafeness(inner, marker); + generateSince(inner, marker); + + out() << "<ul>\n"; + + QString membersLink = generateListOfAllMemberFile(inner, marker); + if (!membersLink.isEmpty()) + out() << "<li><xref href=\"" << membersLink << "\">" + << "List of all members, including inherited members</xref></li>\n"; + + QString obsoleteLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Obsolete); + if (!obsoleteLink.isEmpty()) + out() << "<li><xref href=\"" << obsoleteLink << "\">" + << "Obsolete members</xref></li>\n"; + + QString compatLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Compat); + if (!compatLink.isEmpty()) + out() << "<li><xref href=\"" << compatLink << "\">" + << "Qt 3 support members</xref></li>\n"; + + out() << "</ul>\n"; + + bool needOtherSection = false; + + /* + sections is built above for the call to generateTableOfContents(). + */ + s = sections.begin(); + while (s != sections.end()) { + if (s->members.isEmpty() && s->reimpMembers.isEmpty()) { + if (!s->inherited.isEmpty()) + needOtherSection = true; + } + else { + if (!s->members.isEmpty()) { + out() << "<hr />\n"; + out() << "<a name=\"" + << registerRef((*s).name.toLower()) + << "\"></a>\n"; + out() << "<h2>" << protectEnc((*s).name) << "</h2>\n"; + generateSection(s->members, inner, marker, CodeMarker::Summary); + } + if (!s->reimpMembers.isEmpty()) { + QString name = QString("Reimplemented ") + (*s).name; + out() << "<hr />\n"; + out() << "<a name=\"" + << registerRef(name.toLower()) + << "\"></a>\n"; + out() << "<h2>" << protectEnc(name) << "</h2>\n"; + generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); + } + + if (!s->inherited.isEmpty()) { + out() << "<ul>\n"; + generateSectionInheritedList(*s, inner, marker, true); + out() << "</ul>\n"; + } + } + ++s; + } + + if (needOtherSection) { + out() << "<h3>Additional Inherited Members</h3>\n" + "<ul>\n"; + + s = sections.begin(); + while (s != sections.end()) { + if (s->members.isEmpty() && !s->inherited.isEmpty()) + generateSectionInheritedList(*s, inner, marker); + ++s; + } + out() << "</ul>\n"; + } + + out() << "<a name=\"" << registerRef("details") << "\"></a>\n"; + + if (!inner->doc().isEmpty()) { + out() << "<hr />\n" + << "<div class=\"descr\"/>\n" // QTBUG-9504 + << "<h2>" << "Detailed Description" << "</h2>\n"; + generateBody(inner, marker); + out() << "</div>\n"; // QTBUG-9504 + generateAlsoList(inner, marker); + } + + sections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay); + s = sections.begin(); + while (s != sections.end()) { + out() << "<hr />\n"; + if (!(*s).divClass.isEmpty()) + out() << "<div class=\"" << (*s).divClass << "\"/>\n"; // QTBUG-9504 + out() << "<h2>" << protectEnc((*s).name) << "</h2>\n"; + + NodeList::ConstIterator m = (*s).members.begin(); + while (m != (*s).members.end()) { + if ((*m)->access() != Node::Private) { // ### check necessary? + if ((*m)->type() != Node::Class) + generateDetailedMember(*m, inner, marker); + else { + out() << "<h3> class "; + generateFullName(*m, inner, marker); + out() << "</h3>"; + generateBrief(*m, marker, inner); + } + + QStringList names; + names << (*m)->name(); + if ((*m)->type() == Node::Function) { + const FunctionNode *func = reinterpret_cast<const FunctionNode *>(*m); + if (func->metaness() == FunctionNode::Ctor || + func->metaness() == FunctionNode::Dtor || + func->overloadNumber() != 1) + names.clear(); + } + else if ((*m)->type() == Node::Property) { + const PropertyNode *prop = reinterpret_cast<const PropertyNode *>(*m); + if (!prop->getters().isEmpty() && + !names.contains(prop->getters().first()->name())) + names << prop->getters().first()->name(); + if (!prop->setters().isEmpty()) + names << prop->setters().first()->name(); + if (!prop->resetters().isEmpty()) + names << prop->resetters().first()->name(); + } + else if ((*m)->type() == Node::Enum) { + const EnumNode *enume = reinterpret_cast<const EnumNode*>(*m); + if (enume->flagsType()) + names << enume->flagsType()->name(); + + foreach (const QString &enumName, + enume->doc().enumItemNames().toSet() - + enume->doc().omitEnumItemNames().toSet()) + names << plainCode(marker->markedUpEnumValue(enumName, + enume)); + } + } + ++m; + } + if (!(*s).divClass.isEmpty()) + out() << "</div>\n"; // QTBUG-9504 + ++s; + } +#endif +} + +/*! + Generate the html page for a qdoc file that doesn't map + to an underlying c++ file. + */ +void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) +{ + return; // zzz + + SubTitleSize subTitleSize = LargeSubTitle; + QList<Section> sections; + QList<Section>::const_iterator s; + QString fullTitle = fake->fullTitle(); + QString htmlTitle = fullTitle; + + if (fake->subType() == Node::File && !fake->subTitle().isEmpty()) { + subTitleSize = SmallSubTitle; + htmlTitle += " (" + fake->subTitle() + ")"; + } + else if (fake->subType() == Node::QmlBasicType) { + fullTitle = "QML Basic Type: " + fullTitle; + htmlTitle = fullTitle; + } + + generateHeader(fake); + + /* + Generate the TOC for the new doc format. + Don't generate a TOC for the home page. + */ + if (fake->name() != QString("index.html")) + generateTableOfContents(fake,marker,0); + + generateTitle(fullTitle, + Text() << fake->subTitle(), + subTitleSize, + fake, + marker); + + if (fake->subType() == Node::Module) { + // Generate brief text and status for modules. + generateBrief(fake, marker); + generateStatus(fake, marker); + + if (moduleNamespaceMap.contains(fake->name())) { + out() << "<a name=\"" << registerRef("namespaces") << "\"></a>\n"; + out() << "<h2>Namespaces</h2>\n"; + generateAnnotatedList(fake, marker, moduleNamespaceMap[fake->name()]); + } + if (moduleClassMap.contains(fake->name())) { + out() << "<a name=\"" << registerRef("classes") << "\"></a>\n"; + out() << "<h2>Classes</h2>\n"; + generateAnnotatedList(fake, marker, moduleClassMap[fake->name()]); + } + } + else if (fake->subType() == Node::HeaderFile) { + // Generate brief text and status for modules. + generateBrief(fake, marker); + generateStatus(fake, marker); + + out() << "<ul>\n"; + + QString membersLink = generateListOfAllMemberFile(fake, marker); + if (!membersLink.isEmpty()) + out() << "<li><xref href=\"" << membersLink << "\">" + << "List of all members, including inherited members</xref></li>\n"; + + QString obsoleteLink = generateLowStatusMemberFile(fake, + marker, + CodeMarker::Obsolete); + if (!obsoleteLink.isEmpty()) + out() << "<li><xref href=\"" << obsoleteLink << "\">" + << "Obsolete members</xref></li>\n"; + + QString compatLink = generateLowStatusMemberFile(fake, + marker, + CodeMarker::Compat); + if (!compatLink.isEmpty()) + out() << "<li><xref href=\"" << compatLink << "\">" + << "Qt 3 support members</xref></li>\n"; + + out() << "</ul>\n"; + } +#ifdef QDOC_QML + else if (fake->subType() == Node::QmlClass) { + const QmlClassNode* qml_cn = static_cast<const QmlClassNode*>(fake); + const ClassNode* cn = qml_cn->classNode(); + generateQmlInherits(qml_cn, marker); + generateQmlInstantiates(qml_cn, marker); + generateBrief(qml_cn, marker); + generateQmlInheritedBy(qml_cn, marker); + sections = marker->qmlSections(qml_cn,CodeMarker::Summary); + s = sections.begin(); + while (s != sections.end()) { + out() << "<a name=\"" << registerRef((*s).name) << "\"></a>\n"; + out() << "<h2>" << protectEnc((*s).name) << "</h2>\n"; + generateQmlSummary(*s,fake,marker); + ++s; + } + + out() << "<a name=\"" << registerRef("details") << "\"></a>\n"; + out() << "<h2>" << "Detailed Description" << "</h2>\n"; + generateBody(fake, marker); + if (cn) + generateQmlText(cn->doc().body(), cn, marker, fake->name()); + generateAlsoList(fake, marker); + out() << "<hr />\n"; + + sections = marker->qmlSections(qml_cn,CodeMarker::Detailed); + s = sections.begin(); + while (s != sections.end()) { + out() << "<h2>" << protectEnc((*s).name) << "</h2>\n"; + NodeList::ConstIterator m = (*s).members.begin(); + while (m != (*s).members.end()) { + generateDetailedQmlMember(*m, fake, marker); + out() << "<br/>\n"; + ++m; + } + ++s; + } + return; + } +#endif + + sections = marker->sections(fake, CodeMarker::Summary, CodeMarker::Okay); + s = sections.begin(); + while (s != sections.end()) { + out() << "<a name=\"" << registerRef((*s).name) << "\"></a>\n"; + out() << "<h2>" << protectEnc((*s).name) << "</h2>\n"; + generateSectionList(*s, fake, marker, CodeMarker::Summary); + ++s; + } + + Text brief = fake->doc().briefText(); + if (fake->subType() == Node::Module && !brief.isEmpty()) { + out() << "<a name=\"" << registerRef("details") << "\"></a>\n"; + out() << "<div class=\"descr\"/>\n"; // QTBUG-9504 + out() << "<h2>" << "Detailed Description" << "</h2>\n"; + } + else + out() << "<div class=\"descr\"/>\n"; // QTBUG-9504 + + generateBody(fake, marker); + out() << "</div>\n"; // QTBUG-9504 + generateAlsoList(fake, marker); + + if (!fake->groupMembers().isEmpty()) { + NodeMap groupMembersMap; + foreach (const Node *node, fake->groupMembers()) { + if (node->type() == Node::Class || node->type() == Node::Namespace) + groupMembersMap[node->name()] = node; + } + generateAnnotatedList(fake, marker, groupMembersMap); + } + + sections = marker->sections(fake, CodeMarker::Detailed, CodeMarker::Okay); + s = sections.begin(); + while (s != sections.end()) { + out() << "<hr />\n"; + out() << "<h2>" << protectEnc((*s).name) << "</h2>\n"; + + NodeList::ConstIterator m = (*s).members.begin(); + while (m != (*s).members.end()) { + generateDetailedMember(*m, fake, marker); + ++m; + } + ++s; + } +} + +/*! + Returns "xml" for this subclass of Generator. + */ +QString DitaXmlGenerator::fileExtension(const Node * /* node */) const +{ + return "xml"; +} + +/*! + Output breadcrumb list in the html file. + */ +void DitaXmlGenerator::generateBreadCrumbs(const QString& title, + const Node *node, + CodeMarker *marker) +{ + Text breadcrumb; + if (node->type() == Node::Class) { + const ClassNode* cn = static_cast<const ClassNode*>(node); + QString name = node->moduleName(); + out() << " <li><xref href=\"modules.html\">All Modules</xref></li>"; + if (!name.isEmpty()) { + out() << " <li>"; + breadcrumb << Atom(Atom::AutoLink,name); + generateText(breadcrumb, node, marker); + out() << "</li>\n"; + } + breadcrumb.clear(); + if (!cn->name().isEmpty()) { + out() << " <li>"; + breadcrumb << Atom(Atom::AutoLink,cn->name()); + generateText(breadcrumb, 0, marker); + out() << "</li>\n"; + } + } + else if (node->type() == Node::Fake) { + const FakeNode* fn = static_cast<const FakeNode*>(node); + if (node->subType() == Node::Module) { + out() << " <li><xref href=\"modules.html\">All Modules</xref></li>"; + QString name = node->name(); + if (!name.isEmpty()) { + out() << " <li>"; + breadcrumb << Atom(Atom::AutoLink,name); + generateText(breadcrumb, 0, marker); + out() << "</li>\n"; + } + } + else if (node->subType() == Node::Group) { + if (fn->name() == QString("modules")) + out() << " <li><xref href=\"modules.html\">All Modules</xref></li>"; + else { + out() << " <li><xref href=\"" << fn->name() << "\">" << title + << "</xref></li>"; + } + } + else if (node->subType() == Node::Page) { + if (fn->name() == QString("examples.html")) { + out() << " <li><xref href=\"all-examples.html\">Examples</xref></li>"; + } + else if (fn->name().startsWith("examples-")) { + out() << " <li><xref href=\"all-examples.html\">Examples</xref></li>"; + out() << " <li><xref href=\"" << fn->name() << "\">" << title + << "</xref></li>"; + } + else if (fn->name() == QString("namespaces.html")) { + out() << " <li><xref href=\"namespaces.html\">All Namespaces</xref></li>"; + } + else { + out() << " <li><xref href=\"" << fn->name() << "\">" << title + << "</xref></li>"; + } + } + else if (node->subType() == Node::QmlClass) { + out() << " <li><xref href=\"qdeclarativeelements.html\">QML Elements</xref></li>"; + out() << " <li><xref href=\"" << fn->name() << "\">" << title + << "</xref></li>"; + } + else if (node->subType() == Node::Example) { + out() << " <li><xref href=\"all-examples.html\">Examples</xref></li>"; + QStringList sl = fn->name().split('/'); + QString name = "examples-" + sl.at(0) + ".html"; + QString t = CodeParser::titleFromName(name); + out() << " <li><xref href=\"" << name << "\">" + << t << "</xref></li>"; + out() << " <li><xref href=\"" << sl.at(0) + << "-" << sl.at(sl.size()-1) << ".html\">" + << title << "</xref></li>"; + } + } + else if (node->type() == Node::Namespace) { + const NamespaceNode* nsn = static_cast<const NamespaceNode*>(node); + out() << " <li><xref href=\"namespaces.html\">All Namespaces</xref></li>"; + out() << " <li><xref href=\"" << fileName(nsn) << "\">" << title + << "</xref></li>"; + } +} + +void DitaXmlGenerator::generateHeader(const Node* node) +{ + writer.setDevice(out().device()); + writer.setAutoFormatting(true); + writer.setAutoFormattingIndent(4); + writer.writeStartDocument(); + + if (!node) + return; + + QString docType; + QString dtd; + QString version; + if (node->type() == Node::Class) { + docType = "cxxClass"; + dtd = "dtd/cxxClass.dtd"; + version = "0.6.0"; + } + + QString doctype = "<!DOCTYPE " + docType + + " PUBLIC \"-//NOKIA//DTD DITA C++ API Class Reference Type v" + + version + "//EN\" \"" + dtd + "\">"; + writer.writeDTD(doctype); + writer.writeComment(node->doc().location().fileName()); +} + +void DitaXmlGenerator::generateTitle(const QString& title, + const Text &subTitle, + SubTitleSize subTitleSize, + const Node *relative, + CodeMarker *marker) +{ + if (!title.isEmpty()) + out() << "<h1 class=\"title\">" << protectEnc(title) << "</h1>\n"; + if (!subTitle.isEmpty()) { + out() << "<span"; + if (subTitleSize == SmallSubTitle) + out() << " class=\"small-subtitle\">"; + else + out() << " class=\"subtitle\">"; + generateText(subTitle, relative, marker); + out() << "</span>\n"; + } +} + +/*! + Outputs the brief command as a <shortdesc" element. + */ +void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker) +{ + Text brief = node->doc().briefText(); + if (!brief.isEmpty()) { + ++noLinks; + writer.writeStartElement(SHORTDESC); + generateText(brief, node, marker); + writer.writeEndElement(); // shortdesc + --noLinks; + } +} + +void DitaXmlGenerator::generateIncludes(const InnerNode *inner, CodeMarker *marker) +{ + if (!inner->includes().isEmpty()) { + out() << "<pre class=\"highlightedCode\">" + << trimmedTrailing(highlightedCode(indent(codeIndent, + marker->markedUpIncludes(inner->includes())), + marker,inner)) + << "</pre>"; + } +} + +/*! + Generates a table of contents begining at \a node. + */ +void DitaXmlGenerator::generateTableOfContents(const Node *node, + CodeMarker *marker, + Doc::SectioningUnit sectioningUnit, + int numColumns, + const Node *relative) + +{ + return; + if (!node->doc().hasTableOfContents()) + return; + QList<Atom *> toc = node->doc().tableOfContents(); + if (toc.isEmpty()) + return; + + QString nodeName = ""; + if (node != relative) + nodeName = node->name(); + + QStringList sectionNumber; + int columnSize = 0; + + QString tdTag; + if (numColumns > 1) { + tdTag = "<td>"; /* width=\"" + QString::number((100 + numColumns - 1) / numColumns) + "%\">";*/ + out() << "<table class=\"toc\">\n<tr class=\"topAlign\">" + << tdTag << "\n"; + } + + // disable nested links in table of contents + inContents = true; + inLink = true; + + for (int i = 0; i < toc.size(); ++i) { + Atom *atom = toc.at(i); + + int nextLevel = atom->string().toInt(); + if (nextLevel > (int)sectioningUnit) + continue; + + if (sectionNumber.size() < nextLevel) { + do { + out() << "<ul>"; + sectionNumber.append("1"); + } while (sectionNumber.size() < nextLevel); + } + else { + while (sectionNumber.size() > nextLevel) { + out() << "</ul>\n"; + sectionNumber.removeLast(); + } + sectionNumber.last() = QString::number(sectionNumber.last().toInt() + 1); + } + int numAtoms; + Text headingText = Text::sectionHeading(atom); + + if (sectionNumber.size() == 1 && columnSize > toc.size() / numColumns) { + out() << "</ul></td>" << tdTag << "<ul>\n"; + columnSize = 0; + } + out() << "<li>"; + out() << "<xref href=\"" + << nodeName + << "#" + << Doc::canonicalTitle(headingText.toString()) + << "\">"; + generateAtomList(headingText.firstAtom(), node, marker, true, numAtoms); + out() << "</xref></li>\n"; + + ++columnSize; + } + while (!sectionNumber.isEmpty()) { + out() << "</ul>\n"; + sectionNumber.removeLast(); + } + + if (numColumns > 1) + out() << "</td></tr></table>\n"; + + inContents = false; + inLink = false; +} + +/*! + Revised for the new doc format. + Generates a table of contents begining at \a node. + */ +void DitaXmlGenerator::generateTableOfContents(const Node *node, + CodeMarker *marker, + QList<Section>* sections) +{ + QList<Atom*> toc; + if (node->doc().hasTableOfContents()) + toc = node->doc().tableOfContents(); + if (toc.isEmpty() && !sections && (node->subType() != Node::Module)) + return; + + QStringList sectionNumber; + int detailsBase = 0; + + // disable nested links in table of contents + inContents = true; + inLink = true; + + out() << "<div class=\"toc\">\n"; + out() << "<h3>Contents</h3>\n"; + sectionNumber.append("1"); + out() << "<ul>\n"; + + if (node->subType() == Node::Module) { + if (moduleNamespaceMap.contains(node->name())) { + out() << "<li class=\"level" + << sectionNumber.size() + << "\"><xref href=\"#" + << registerRef("namespaces") + << "\">Namespaces</xref></li>\n"; + } + if (moduleClassMap.contains(node->name())) { + out() << "<li class=\"level" + << sectionNumber.size() + << "\"><xref href=\"#" + << registerRef("classes") + << "\">Classes</xref></li>\n"; + } + out() << "<li class=\"level" + << sectionNumber.size() + << "\"><xref href=\"#" + << registerRef("details") + << "\">Detailed Description</xref></li>\n"; + for (int i = 0; i < toc.size(); ++i) { + if (toc.at(i)->string().toInt() == 1) { + detailsBase = 1; + break; + } + } + } + else if (sections && (node->type() == Node::Class)) { + QList<Section>::ConstIterator s = sections->begin(); + while (s != sections->end()) { + if (!s->members.isEmpty() || !s->reimpMembers.isEmpty()) { + out() << "<li class=\"level" + << sectionNumber.size() + << "\"><xref href=\"#" + << registerRef((*s).pluralMember) + << "\">" << (*s).name + << "</xref></li>\n"; + } + ++s; + } + out() << "<li class=\"level" + << sectionNumber.size() + << "\"><xref href=\"#" + << registerRef("details") + << "\">Detailed Description</xref></li>\n"; + for (int i = 0; i < toc.size(); ++i) { + if (toc.at(i)->string().toInt() == 1) { + detailsBase = 1; + break; + } + } + } + + for (int i = 0; i < toc.size(); ++i) { + Atom *atom = toc.at(i); + int nextLevel = atom->string().toInt() + detailsBase; + if (sectionNumber.size() < nextLevel) { + do { + sectionNumber.append("1"); + } while (sectionNumber.size() < nextLevel); + } + else { + while (sectionNumber.size() > nextLevel) { + sectionNumber.removeLast(); + } + sectionNumber.last() = QString::number(sectionNumber.last().toInt() + 1); + } + int numAtoms; + Text headingText = Text::sectionHeading(atom); + QString s = headingText.toString(); + out() << "<li class=\"level" + << sectionNumber.size() + << "\">"; + out() << "<xref href=\"" + << "#" + << Doc::canonicalTitle(s) + << "\">"; + generateAtomList(headingText.firstAtom(), node, marker, true, numAtoms); + out() << "</xref></li>\n"; + } + while (!sectionNumber.isEmpty()) { + sectionNumber.removeLast(); + } + out() << "</ul>\n"; + out() << "</div>\n"; + inContents = false; + inLink = false; +} + +QString DitaXmlGenerator::generateListOfAllMemberFile(const InnerNode *inner, + CodeMarker *marker) +{ + QList<Section> sections; + QList<Section>::ConstIterator s; + + sections = marker->sections(inner, + CodeMarker::SeparateList, + CodeMarker::Okay); + if (sections.isEmpty()) + return QString(); + + QString fileName = fileBase(inner) + "-members." + fileExtension(inner); + beginSubPage(inner->location(), fileName); + QString title = "List of All Members for " + inner->name(); + generateHeader(inner); + generateTitle(title, Text(), SmallSubTitle, inner, marker); + out() << "<p>This is the complete list of members for "; + generateFullName(inner, 0, marker); + out() << ", including inherited members.</p>\n"; + + Section section = sections.first(); + generateSectionList(section, 0, marker, CodeMarker::SeparateList); + + endSubPage(); + return fileName; +} + +QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode *inner, + CodeMarker *marker, + CodeMarker::Status status) +{ + QList<Section> sections = marker->sections(inner, + CodeMarker::Summary, + status); + QMutableListIterator<Section> j(sections); + while (j.hasNext()) { + if (j.next().members.size() == 0) + j.remove(); + } + if (sections.isEmpty()) + return QString(); + + int i; + + QString title; + QString fileName; + + if (status == CodeMarker::Compat) { + title = "Qt 3 Support Members for " + inner->name(); + fileName = fileBase(inner) + "-qt3." + fileExtension(inner); + } + else { + title = "Obsolete Members for " + inner->name(); + fileName = fileBase(inner) + "-obsolete." + fileExtension(inner); + } + + beginSubPage(inner->location(), fileName); + generateHeader(inner); + generateTitle(title, Text(), SmallSubTitle, inner, marker); + + if (status == CodeMarker::Compat) { + out() << "<p><b>The following class members are part of the " + "<xref href=\"qt3support.html\">Qt 3 support layer</xref>.</b> " + "They are provided to help you port old code to Qt 4. We advise against " + "using them in new code.</p>\n"; + } + else { + out() << "<p><b>The following class members are obsolete.</b> " + << "They are provided to keep old source code working. " + << "We strongly advise against using them in new code.</p>\n"; + } + + out() << "<p><ul><li><xref href=\"" + << linkForNode(inner, 0) << "\">" + << protectEnc(inner->name()) + << " class reference</xref></li></ul></p>\n"; + + for (i = 0; i < sections.size(); ++i) { + out() << "<h2>" << protectEnc(sections.at(i).name) << "</h2>\n"; + generateSectionList(sections.at(i), inner, marker, CodeMarker::Summary); + } + + sections = marker->sections(inner, CodeMarker::Detailed, status); + for (i = 0; i < sections.size(); ++i) { + out() << "<hr />\n"; + out() << "<h2>" << protectEnc(sections.at(i).name) << "</h2>\n"; + + NodeList::ConstIterator m = sections.at(i).members.begin(); + while (m != sections.at(i).members.end()) { + if ((*m)->access() != Node::Private) + generateDetailedMember(*m, inner, marker); + ++m; + } + } + + endSubPage(); + return fileName; +} + +void DitaXmlGenerator::generateClassHierarchy(const Node *relative, + CodeMarker *marker, + const QMap<QString,const Node*> &classMap) +{ + if (classMap.isEmpty()) + return; + + NodeMap topLevel; + NodeMap::ConstIterator c = classMap.begin(); + while (c != classMap.end()) { + const ClassNode *classe = static_cast<const ClassNode *>(*c); + if (classe->baseClasses().isEmpty()) + topLevel.insert(classe->name(), classe); + ++c; + } + + QStack<NodeMap > stack; + stack.push(topLevel); + + out() << "<ul>\n"; + while (!stack.isEmpty()) { + if (stack.top().isEmpty()) { + stack.pop(); + out() << "</ul>\n"; + } + else { + const ClassNode *child = + static_cast<const ClassNode *>(*stack.top().begin()); + out() << "<li>"; + generateFullName(child, relative, marker); + out() << "</li>\n"; + stack.top().erase(stack.top().begin()); + + NodeMap newTop; + foreach (const RelatedClass &d, child->derivedClasses()) { + if (d.access != Node::Private) + newTop.insert(d.node->name(), d.node); + } + if (!newTop.isEmpty()) { + stack.push(newTop); + out() << "<ul>\n"; + } + } + } +} + +void DitaXmlGenerator::generateAnnotatedList(const Node *relative, + CodeMarker *marker, + const NodeMap &nodeMap) +{ + out() << "<table class=\"annotated\">\n"; + + int row = 0; + foreach (const QString &name, nodeMap.keys()) { + const Node *node = nodeMap[name]; + + if (node->status() == Node::Obsolete) + continue; + + if (++row % 2 == 1) + out() << "<tr class=\"odd topAlign\">"; + else + out() << "<tr class=\"even topAlign\">"; + out() << "<td><p>"; + generateFullName(node, relative, marker); + out() << "</p></td>"; + + if (!(node->type() == Node::Fake)) { + Text brief = node->doc().trimmedBriefText(name); + if (!brief.isEmpty()) { + out() << "<td><p>"; + generateText(brief, node, marker); + out() << "</p></td>"; + } + } + else { + out() << "<td><p>"; + out() << protectEnc(node->doc().briefText().toString()); + out() << "</p></td>"; + } + out() << "</tr>\n"; + } + out() << "</table>\n"; +} + +/*! + This function finds the common prefix of the names of all + the classes in \a classMap and then generates a compact + list of the class names alphabetized on the part of the + name not including the common prefix. You can tell the + function to use \a comonPrefix as the common prefix, but + normally you let it figure it out itself by looking at + the name of the first and last classes in \a classMap. + */ +void DitaXmlGenerator::generateCompactList(const Node *relative, + CodeMarker *marker, + const NodeMap &classMap, + bool includeAlphabet, + QString commonPrefix) +{ + const int NumParagraphs = 37; // '0' to '9', 'A' to 'Z', '_' + + if (classMap.isEmpty()) + return; + + /* + If commonPrefix is not empty, then the caller knows what + the common prefix is and has passed it in, so just use that + one. + */ + int commonPrefixLen = commonPrefix.length(); + if (commonPrefixLen == 0) { + QString first; + QString last; + + /* + The caller didn't pass in a common prefix, so get the common + prefix by looking at the class names of the first and last + classes in the class map. Discard any namespace names and + just use the bare class names. For Qt, the prefix is "Q". + + Note that the algorithm used here to derive the common prefix + from the first and last classes in alphabetical order (QAccel + and QXtWidget in Qt 2.1), fails if either class name does not + begin with Q. + */ + + NodeMap::const_iterator iter = classMap.begin(); + while (iter != classMap.end()) { + if (!iter.key().contains("::")) { + first = iter.key(); + break; + } + ++iter; + } + + if (first.isEmpty()) + first = classMap.begin().key(); + + iter = classMap.end(); + while (iter != classMap.begin()) { + --iter; + if (!iter.key().contains("::")) { + last = iter.key(); + break; + } + } + + if (last.isEmpty()) + last = classMap.begin().key(); + + if (classMap.size() > 1) { + while (commonPrefixLen < first.length() + 1 && + commonPrefixLen < last.length() + 1 && + first[commonPrefixLen] == last[commonPrefixLen]) + ++commonPrefixLen; + } + + commonPrefix = first.left(commonPrefixLen); + } + + /* + Divide the data into 37 paragraphs: 0, ..., 9, A, ..., Z, + underscore (_). QAccel will fall in paragraph 10 (A) and + QXtWidget in paragraph 33 (X). This is the only place where we + assume that NumParagraphs is 37. Each paragraph is a NodeMap. + */ + NodeMap paragraph[NumParagraphs+1]; + QString paragraphName[NumParagraphs+1]; + QSet<char> usedParagraphNames; + + NodeMap::ConstIterator c = classMap.begin(); + while (c != classMap.end()) { + QStringList pieces = c.key().split("::"); + QString key; + int idx = commonPrefixLen; + if (!pieces.last().startsWith(commonPrefix)) + idx = 0; + if (pieces.size() == 1) + key = pieces.last().mid(idx).toLower(); + else + key = pieces.last().toLower(); + + int paragraphNr = NumParagraphs - 1; + + if (key[0].digitValue() != -1) { + paragraphNr = key[0].digitValue(); + } + else if (key[0] >= QLatin1Char('a') && key[0] <= QLatin1Char('z')) { + paragraphNr = 10 + key[0].unicode() - 'a'; + } + + paragraphName[paragraphNr] = key[0].toUpper(); + usedParagraphNames.insert(key[0].toLower().cell()); + paragraph[paragraphNr].insert(key, c.value()); + ++c; + } + + /* + Each paragraph j has a size: paragraph[j].count(). In the + discussion, we will assume paragraphs 0 to 5 will have sizes + 3, 1, 4, 1, 5, 9. + + We now want to compute the paragraph offset. Paragraphs 0 to 6 + start at offsets 0, 3, 4, 8, 9, 14, 23. + */ + int paragraphOffset[NumParagraphs + 1]; // 37 + 1 + paragraphOffset[0] = 0; + for (int i=0; i<NumParagraphs; i++) // i = 0..36 + paragraphOffset[i+1] = paragraphOffset[i] + paragraph[i].count(); + + int curParNr = 0; + int curParOffset = 0; + + /* + Output the alphabet as a row of links. + */ + if (includeAlphabet) { + out() << "<p class=\"centerAlign functionIndex\"><b>"; + for (int i = 0; i < 26; i++) { + QChar ch('a' + i); + if (usedParagraphNames.contains(char('a' + i))) + out() << QString("<xref href=\"#%1\">%2</xref> ").arg(ch).arg(ch.toUpper()); + } + out() << "</b></p>\n"; + } + + /* + Output a <div> element to contain all the <dl> elements. + */ + out() << "<div class=\"flowListDiv\">\n"; + + for (int i=0; i<classMap.count()-1; i++) { + while ((curParNr < NumParagraphs) && + (curParOffset == paragraph[curParNr].count())) { + ++curParNr; + curParOffset = 0; + } + + /* + Starting a new paragraph means starting a new <dl>. + */ + if (curParOffset == 0) { + if (i > 0) + out() << "</dl>\n"; + if (++numTableRows % 2 == 1) + out() << "<dl class=\"flowList odd\">"; + else + out() << "<dl class=\"flowList even\">"; + out() << "<dt class=\"alphaChar\">"; + if (includeAlphabet) { + QChar c = paragraphName[curParNr][0].toLower(); + out() << QString("<a name=\"%1\"></a>").arg(c); + } + out() << "<b>" + << paragraphName[curParNr] + << "</b>"; + out() << "</dt>\n"; + } + + /* + Output a <dd> for the current offset in the current paragraph. + */ + out() << "<dd>"; + if ((curParNr < NumParagraphs) && + !paragraphName[curParNr].isEmpty()) { + NodeMap::Iterator it; + it = paragraph[curParNr].begin(); + for (int i=0; i<curParOffset; i++) + ++it; + + /* + Previously, we used generateFullName() for this, but we + require some special formatting. + */ + out() << "<xref href=\"" << linkForNode(it.value(), relative) << "\">"; + + QStringList pieces; + if (it.value()->subType() == Node::QmlClass) + pieces << it.value()->name(); + else + pieces = fullName(it.value(), relative, marker).split("::"); + out() << protectEnc(pieces.last()); + out() << "</xref>"; + if (pieces.size() > 1) { + out() << " ("; + generateFullName(it.value()->parent(), relative, marker); + out() << ")"; + } + } + out() << "</dd>\n"; + curParOffset++; + } + out() << "</dl>\n"; + out() << "</div>\n"; +} + +void DitaXmlGenerator::generateFunctionIndex(const Node *relative, + CodeMarker *marker) +{ + out() << "<p class=\"centerAlign functionIndex\"><b>"; + for (int i = 0; i < 26; i++) { + QChar ch('a' + i); + out() << QString("<xref href=\"#%1\">%2</xref> ").arg(ch).arg(ch.toUpper()); + } + out() << "</b></p>\n"; + + char nextLetter = 'a'; + char currentLetter; + +#if 1 + out() << "<ul>\n"; +#endif + QMap<QString, NodeMap >::ConstIterator f = funcIndex.begin(); + while (f != funcIndex.end()) { +#if 1 + out() << "<li>"; +#else + out() << "<p>"; +#endif + out() << protectEnc(f.key()) << ":"; + + currentLetter = f.key()[0].unicode(); + while (islower(currentLetter) && currentLetter >= nextLetter) { + out() << QString("<a name=\"%1\"></a>").arg(nextLetter); + nextLetter++; + } + + NodeMap::ConstIterator s = (*f).begin(); + while (s != (*f).end()) { + out() << " "; + generateFullName((*s)->parent(), relative, marker, *s); + ++s; + } +#if 1 + out() << "</li>"; +#else + out() << "</p>"; +#endif + out() << "\n"; + ++f; + } +#if 1 + out() << "</ul>\n"; +#endif +} + +void DitaXmlGenerator::generateLegaleseList(const Node *relative, + CodeMarker *marker) +{ + QMap<Text, const Node *>::ConstIterator it = legaleseTexts.begin(); + while (it != legaleseTexts.end()) { + Text text = it.key(); + out() << "<hr />\n"; + generateText(text, relative, marker); + out() << "<ul>\n"; + do { + out() << "<li>"; + generateFullName(it.value(), relative, marker); + out() << "</li>\n"; + ++it; + } while (it != legaleseTexts.end() && it.key() == text); + out() << "</ul>\n"; + } +} + +/*void DitaXmlGenerator::generateSynopsis(const Node *node, + const Node *relative, + CodeMarker *marker, + CodeMarker::SynopsisStyle style) +{ + QString marked = marker->markedUpSynopsis(node, relative, style); + QRegExp templateTag("(<[^@>]*>)"); + if (marked.indexOf(templateTag) != -1) { + QString contents = protectEnc(marked.mid(templateTag.pos(1), + templateTag.cap(1).length())); + marked.replace(templateTag.pos(1), templateTag.cap(1).length(), + contents); + } + marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])</@param>"), + "<i>\\1<sub>\\2</sub></i>"); + marked.replace("<@param>", "<i>"); + marked.replace("</@param>", "</i>"); + + if (style == CodeMarker::Summary) + marked.replace("@name>", "b>"); + + if (style == CodeMarker::SeparateList) { + QRegExp extraRegExp("<@extra>.*</@extra>"); + extraRegExp.setMinimal(true); + marked.replace(extraRegExp, ""); + } + else { + marked.replace("<@extra>", " <tt>"); + marked.replace("</@extra>", "</tt>"); + } + + if (style != CodeMarker::Detailed) { + marked.replace("<@type>", ""); + marked.replace("</@type>", ""); + } + out() << highlightedCode(marked, marker, relative); +}*/ + +#ifdef QDOC_QML +void DitaXmlGenerator::generateQmlItem(const Node *node, + const Node *relative, + CodeMarker *marker, + bool summary) +{ + QString marked = marker->markedUpQmlItem(node,summary); + QRegExp templateTag("(<[^@>]*>)"); + if (marked.indexOf(templateTag) != -1) { + QString contents = protectEnc(marked.mid(templateTag.pos(1), + templateTag.cap(1).length())); + marked.replace(templateTag.pos(1), templateTag.cap(1).length(), + contents); + } + marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])</@param>"), + "<i>\\1<sub>\\2</sub></i>"); + marked.replace("<@param>", "<i>"); + marked.replace("</@param>", "</i>"); + + if (summary) + marked.replace("@name>", "b>"); + + marked.replace("<@extra>", "<tt>"); + marked.replace("</@extra>", "</tt>"); + + if (summary) { + marked.replace("<@type>", ""); + marked.replace("</@type>", ""); + } + out() << highlightedCode(marked, marker, relative); +} +#endif + +void DitaXmlGenerator::generateOverviewList(const Node *relative, CodeMarker * /* marker */) +{ + QMap<const FakeNode *, QMap<QString, FakeNode *> > fakeNodeMap; + QMap<QString, const FakeNode *> groupTitlesMap; + QMap<QString, FakeNode *> uncategorizedNodeMap; + QRegExp singleDigit("\\b([0-9])\\b"); + + const NodeList children = myTree->root()->childNodes(); + foreach (Node *child, children) { + if (child->type() == Node::Fake && child != relative) { + FakeNode *fakeNode = static_cast<FakeNode *>(child); + + // Check whether the page is part of a group or is the group + // definition page. + QString group; + bool isGroupPage = false; + if (fakeNode->doc().metaCommandsUsed().contains("group")) { + group = fakeNode->doc().metaCommandArgs("group")[0]; + isGroupPage = true; + } + + // there are too many examples; they would clutter the list + if (fakeNode->subType() == Node::Example) + continue; + + // not interested either in individual (Qt Designer etc.) manual chapters + if (fakeNode->links().contains(Node::ContentsLink)) + continue; + + // Discard external nodes. + if (fakeNode->subType() == Node::ExternalPage) + continue; + + QString sortKey = fakeNode->fullTitle().toLower(); + if (sortKey.startsWith("the ")) + sortKey.remove(0, 4); + sortKey.replace(singleDigit, "0\\1"); + + if (!group.isEmpty()) { + if (isGroupPage) { + // If we encounter a group definition page, we add all + // the pages in that group to the list for that group. + foreach (Node *member, fakeNode->groupMembers()) { + if (member->type() != Node::Fake) + continue; + FakeNode *page = static_cast<FakeNode *>(member); + if (page) { + QString sortKey = page->fullTitle().toLower(); + if (sortKey.startsWith("the ")) + sortKey.remove(0, 4); + sortKey.replace(singleDigit, "0\\1"); + fakeNodeMap[const_cast<const FakeNode *>(fakeNode)].insert(sortKey, page); + groupTitlesMap[fakeNode->fullTitle()] = const_cast<const FakeNode *>(fakeNode); + } + } + } + else if (!isGroupPage) { + // If we encounter a page that belongs to a group then + // we add that page to the list for that group. + const FakeNode *groupNode = static_cast<const FakeNode *>(myTree->root()->findNode(group, Node::Fake)); + if (groupNode) + fakeNodeMap[groupNode].insert(sortKey, fakeNode); + //else + // uncategorizedNodeMap.insert(sortKey, fakeNode); + }// else + // uncategorizedNodeMap.insert(sortKey, fakeNode); + }// else + // uncategorizedNodeMap.insert(sortKey, fakeNode); + } + } + + // We now list all the pages found that belong to groups. + // If only certain pages were found for a group, but the definition page + // for that group wasn't listed, the list of pages will be intentionally + // incomplete. However, if the group definition page was listed, all the + // pages in that group are listed for completeness. + + if (!fakeNodeMap.isEmpty()) { + foreach (const QString &groupTitle, groupTitlesMap.keys()) { + const FakeNode *groupNode = groupTitlesMap[groupTitle]; + out() << QString("<h3><xref href=\"%1\">%2</xref></h3>\n").arg( + linkForNode(groupNode, relative)).arg( + protectEnc(groupNode->fullTitle())); + + if (fakeNodeMap[groupNode].count() == 0) + continue; + + out() << "<ul>\n"; + + foreach (const FakeNode *fakeNode, fakeNodeMap[groupNode]) { + QString title = fakeNode->fullTitle(); + if (title.startsWith("The ")) + title.remove(0, 4); + out() << "<li><xref href=\"" << linkForNode(fakeNode, relative) << "\">" + << protectEnc(title) << "</xref></li>\n"; + } + out() << "</ul>\n"; + } + } + + if (!uncategorizedNodeMap.isEmpty()) { + out() << QString("<h3>Miscellaneous</h3>\n"); + out() << "<ul>\n"; + foreach (const FakeNode *fakeNode, uncategorizedNodeMap) { + QString title = fakeNode->fullTitle(); + if (title.startsWith("The ")) + title.remove(0, 4); + out() << "<li><xref href=\"" << linkForNode(fakeNode, relative) << "\">" + << protectEnc(title) << "</xref></li>\n"; + } + out() << "</ul>\n"; + } +} + +void DitaXmlGenerator::generateSection(const NodeList& nl, + const Node *relative, + CodeMarker *marker, + CodeMarker::SynopsisStyle style) +{ + bool name_alignment = true; + if (!nl.isEmpty()) { + bool twoColumn = false; + if (style == CodeMarker::SeparateList) { + name_alignment = false; + twoColumn = (nl.count() >= 16); + } + else if (nl.first()->type() == Node::Property) { + twoColumn = (nl.count() >= 5); + name_alignment = false; + } + if (name_alignment) { + out() << "<table class=\"alignedsummary\">\n"; + } + else { + if (twoColumn) + out() << "<table class=\"propsummary\">\n" + << "<tr><td class=\"topAlign\">"; + out() << "<ul>\n"; + } + + int i = 0; + NodeList::ConstIterator m = nl.begin(); + while (m != nl.end()) { + if ((*m)->access() == Node::Private) { + ++m; + continue; + } + + if (name_alignment) { + out() << "<tr><td class=\"memItemLeft rightAlign topAlign\"> "; + } + else { + if (twoColumn && i == (int) (nl.count() + 1) / 2) + out() << "</ul></td><td class=\"topAlign\"><ul>\n"; + out() << "<li class=\"fn\">"; + } + + generateSynopsis(*m, relative, marker, style, name_alignment); + if (name_alignment) + out() << "</td></tr>\n"; + else + out() << "</li>\n"; + i++; + ++m; + } + if (name_alignment) + out() << "</table>\n"; + else { + out() << "</ul>\n"; + if (twoColumn) + out() << "</td></tr>\n</table>\n"; + } + } +} + +void DitaXmlGenerator::generateSectionList(const Section& section, + const Node *relative, + CodeMarker *marker, + CodeMarker::SynopsisStyle style) +{ + bool name_alignment = true; + if (!section.members.isEmpty()) { + bool twoColumn = false; + if (style == CodeMarker::SeparateList) { + name_alignment = false; + twoColumn = (section.members.count() >= 16); + } + else if (section.members.first()->type() == Node::Property) { + twoColumn = (section.members.count() >= 5); + name_alignment = false; + } + if (name_alignment) { + out() << "<table class=\"alignedsummary\">\n"; + } + else { + if (twoColumn) + out() << "<table class=\"propsummary\">\n" + << "<tr><td class=\"topAlign\">"; + out() << "<ul>\n"; + } + + int i = 0; + NodeList::ConstIterator m = section.members.begin(); + while (m != section.members.end()) { + if ((*m)->access() == Node::Private) { + ++m; + continue; + } + + if (name_alignment) { + out() << "<tr><td class=\"memItemLeft topAlign rightAlign\"> "; + } + else { + if (twoColumn && i == (int) (section.members.count() + 1) / 2) + out() << "</ul></td><td class=\"topAlign\"><ul>\n"; + out() << "<li class=\"fn\">"; + } + + generateSynopsis(*m, relative, marker, style, name_alignment); + if (name_alignment) + out() << "</td></tr>\n"; + else + out() << "</li>\n"; + i++; + ++m; + } + if (name_alignment) + out() << "</table>\n"; + else { + out() << "</ul>\n"; + if (twoColumn) + out() << "</td></tr>\n</table>\n"; + } + } + + if (style == CodeMarker::Summary && !section.inherited.isEmpty()) { + out() << "<ul>\n"; + generateSectionInheritedList(section, relative, marker, name_alignment); + out() << "</ul>\n"; + } +} + +void DitaXmlGenerator::generateSectionInheritedList(const Section& section, + const Node *relative, + CodeMarker *marker, + bool nameAlignment) +{ + QList<QPair<ClassNode *, int> >::ConstIterator p = section.inherited.begin(); + while (p != section.inherited.end()) { + if (nameAlignment) + out() << "<li class=\"fn\">"; + else + out() << "<li class=\"fn\">"; + out() << (*p).second << " "; + if ((*p).second == 1) { + out() << section.singularMember; + } + else { + out() << section.pluralMember; + } + out() << " inherited from <xref href=\"" << fileName((*p).first) + << "#" << DitaXmlGenerator::cleanRef(section.name.toLower()) << "\">" + << protectEnc(marker->plainFullName((*p).first, relative)) + << "</xref></li>\n"; + ++p; + } +} + +void DitaXmlGenerator::generateSynopsis(const Node *node, + const Node *relative, + CodeMarker *marker, + CodeMarker::SynopsisStyle style, + bool nameAlignment) +{ + QString marked = marker->markedUpSynopsis(node, relative, style); + QRegExp templateTag("(<[^@>]*>)"); + if (marked.indexOf(templateTag) != -1) { + QString contents = protectEnc(marked.mid(templateTag.pos(1), + templateTag.cap(1).length())); + marked.replace(templateTag.pos(1), templateTag.cap(1).length(), + contents); + } + marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])</@param>"), + "<i>\\1<sub>\\2</sub></i>"); + marked.replace("<@param>", "<i>"); + marked.replace("</@param>", "</i>"); + + if (style == CodeMarker::Summary) { + marked.replace("<@name>", ""); // was "<b>" + marked.replace("</@name>", ""); // was "</b>" + } + + if (style == CodeMarker::SeparateList) { + QRegExp extraRegExp("<@extra>.*</@extra>"); + extraRegExp.setMinimal(true); + marked.replace(extraRegExp, ""); + } else { + marked.replace("<@extra>", "<tt>"); + marked.replace("</@extra>", "</tt>"); + } + + if (style != CodeMarker::Detailed) { + marked.replace("<@type>", ""); + marked.replace("</@type>", ""); + } + out() << highlightedCode(marked, marker, relative, style, nameAlignment); +} + +QString DitaXmlGenerator::highlightedCode(const QString& markedCode, + CodeMarker *marker, + const Node *relative, + CodeMarker::SynopsisStyle , + bool nameAlignment) +{ + QString src = markedCode; + QString html; + QStringRef arg; + QStringRef par1; + + const QChar charLangle = '<'; + const QChar charAt = '@'; + + // replace all <@link> tags: "(<@link node=\"([^\"]+)\">).*(</@link>)" + static const QString linkTag("link"); + bool done = false; + for (int i = 0, n = src.size(); i < n;) { + if (src.at(i) == charLangle && src.at(i + 1).unicode() == '@') { + if (nameAlignment && !done) {// && (i != 0)) Why was this here? + html += "</td><td class=\"memItemRight bottomAlign\">"; + done = true; + } + i += 2; + if (parseArg(src, linkTag, &i, n, &arg, &par1)) { + html += "<b>"; + QString link = linkForNode( + CodeMarker::nodeForString(par1.toString()), relative); + addLink(link, arg, &html); + html += "</b>"; + } + else { + html += charLangle; + html += charAt; + } + } + else { + html += src.at(i++); + } + } + + + if (slow) { + // is this block ever used at all? + // replace all <@func> tags: "(<@func target=\"([^\"]*)\">)(.*)(</@func>)" + src = html; + html = QString(); + static const QString funcTag("func"); + for (int i = 0, n = src.size(); i < n;) { + if (src.at(i) == charLangle && src.at(i + 1) == charAt) { + i += 2; + if (parseArg(src, funcTag, &i, n, &arg, &par1)) { + QString link = linkForNode( + marker->resolveTarget(par1.toString(), + myTree, + relative), + relative); + addLink(link, arg, &html); + par1 = QStringRef(); + } + else { + html += charLangle; + html += charAt; + } + } + else { + html += src.at(i++); + } + } + } + + // replace all "(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)(</@\\2>)" tags + src = html; + html = QString(); + static const QString typeTags[] = { "type", "headerfile", "func" }; + for (int i = 0, n = src.size(); i < n;) { + if (src.at(i) == charLangle && src.at(i + 1) == charAt) { + i += 2; + bool handled = false; + for (int k = 0; k != 3; ++k) { + if (parseArg(src, typeTags[k], &i, n, &arg, &par1)) { + par1 = QStringRef(); + QString link = linkForNode( + marker->resolveTarget(arg.toString(), myTree, relative), + relative); + addLink(link, arg, &html); + handled = true; + break; + } + } + if (!handled) { + html += charLangle; + html += charAt; + } + } + else { + html += src.at(i++); + } + } + + // replace all + // "<@comment>" -> "<span class=\"comment\">"; + // "<@preprocessor>" -> "<span class=\"preprocessor\">"; + // "<@string>" -> "<span class=\"string\">"; + // "<@char>" -> "<span class=\"char\">"; + // "</@(?:comment|preprocessor|string|char)>" -> "</span>" + src = html; + html = QString(); + static const QString spanTags[] = { + "<@comment>", "<span class=\"comment\">", + "<@preprocessor>", "<span class=\"preprocessor\">", + "<@string>", "<span class=\"string\">", + "<@char>", "<span class=\"char\">", + "</@comment>", "</span>", + "</@preprocessor>","</span>", + "</@string>", "</span>", + "</@char>", "</span>" + // "<@char>", "<font color=blue>", + // "</@char>", "</font>", + // "<@func>", "<font color=green>", + // "</@func>", "</font>", + // "<@id>", "<i>", + // "</@id>", "</i>", + // "<@keyword>", "<b>", + // "</@keyword>", "</b>", + // "<@number>", "<font color=yellow>", + // "</@number>", "</font>", + // "<@op>", "<b>", + // "</@op>", "</b>", + // "<@param>", "<i>", + // "</@param>", "</i>", + // "<@string>", "<font color=green>", + // "</@string>", "</font>", + }; + for (int i = 0, n = src.size(); i < n;) { + if (src.at(i) == charLangle) { + bool handled = false; + for (int k = 0; k != 8; ++k) { + const QString & tag = spanTags[2 * k]; + if (tag == QStringRef(&src, i, tag.length())) { + html += spanTags[2 * k + 1]; + i += tag.length(); + handled = true; + break; + } + } + if (!handled) { + ++i; + if (src.at(i) == charAt || + (src.at(i) == QLatin1Char('/') && src.at(i + 1) == charAt)) { + // drop 'our' unknown tags (the ones still containing '@') + while (i < n && src.at(i) != QLatin1Char('>')) + ++i; + ++i; + } + else { + // retain all others + html += charLangle; + } + } + } + else { + html += src.at(i); + ++i; + } + } + + return html; +} + +void DitaXmlGenerator::generateLink(const Atom* atom, + const Node* /* relative */, + CodeMarker* marker) +{ + static QRegExp camelCase("[A-Z][A-Z][a-z]|[a-z][A-Z0-9]|_"); + + if (funcLeftParen.indexIn(atom->string()) != -1 && marker->recognizeLanguage("Cpp")) { + // hack for C++: move () outside of link + int k = funcLeftParen.pos(1); + writer.writeCharacters(protectEnc(atom->string().left(k))); + if (link.isEmpty()) { + if (showBrokenLinks) + writer.writeEndElement(); // </i> + } + else { + writer.writeEndElement(); // </xref> + } + inLink = false; + writer.writeCharacters(protectEnc(atom->string().mid(k))); + } else if (marker->recognizeLanguage("Java")) { + // hack for Java: remove () and use <tt> when appropriate + bool func = atom->string().endsWith("()"); + bool tt = (func || atom->string().contains(camelCase)); + if (tt) + writer.writeStartElement("tt"); + if (func) { + writer.writeCharacters(protectEnc(atom->string().left(atom->string().length() - 2))); + } + else { + writer.writeCharacters(protectEnc(atom->string())); + } + writer.writeEndElement(); // </tt> + } + else { + writer.writeCharacters(protectEnc(atom->string())); + } +} + +QString DitaXmlGenerator::cleanRef(const QString& ref) +{ + QString clean; + + if (ref.isEmpty()) + return clean; + + clean.reserve(ref.size() + 20); + const QChar c = ref[0]; + const uint u = c.unicode(); + + if ((u >= 'a' && u <= 'z') || + (u >= 'A' && u <= 'Z') || + (u >= '0' && u <= '9')) { + clean += c; + } else if (u == '~') { + clean += "dtor."; + } else if (u == '_') { + clean += "underscore."; + } else { + clean += "A"; + } + + for (int i = 1; i < (int) ref.length(); i++) { + const QChar c = ref[i]; + const uint u = c.unicode(); + if ((u >= 'a' && u <= 'z') || + (u >= 'A' && u <= 'Z') || + (u >= '0' && u <= '9') || u == '-' || + u == '_' || u == ':' || u == '.') { + clean += c; + } else if (c.isSpace()) { + clean += "-"; + } else if (u == '!') { + clean += "-not"; + } else if (u == '&') { + clean += "-and"; + } else if (u == '<') { + clean += "-lt"; + } else if (u == '=') { + clean += "-eq"; + } else if (u == '>') { + clean += "-gt"; + } else if (u == '#') { + clean += "#"; + } else { + clean += "-"; + clean += QString::number((int)u, 16); + } + } + return clean; +} + +QString DitaXmlGenerator::registerRef(const QString& ref) +{ + QString clean = DitaXmlGenerator::cleanRef(ref); + + for (;;) { + QString& prevRef = refMap[clean.toLower()]; + if (prevRef.isEmpty()) { + prevRef = ref; + break; + } else if (prevRef == ref) { + break; + } + clean += "x"; + } + return clean; +} + +QString DitaXmlGenerator::protectEnc(const QString &string) +{ + return protect(string, outputEncoding); +} + +QString DitaXmlGenerator::protect(const QString &string, const QString &outputEncoding) +{ +#define APPEND(x) \ + if (xml.isEmpty()) { \ + xml = string; \ + xml.truncate(i); \ + } \ + xml += (x); + + QString xml; + int n = string.length(); + + for (int i = 0; i < n; ++i) { + QChar ch = string.at(i); + + if (ch == QLatin1Char('&')) { + APPEND("&"); + } else if (ch == QLatin1Char('<')) { + APPEND("<"); + } else if (ch == QLatin1Char('>')) { + APPEND(">"); + } else if (ch == QLatin1Char('"')) { + APPEND("""); + } else if ((outputEncoding == "ISO-8859-1" && ch.unicode() > 0x007F) + || (ch == QLatin1Char('*') && i + 1 < n && string.at(i) == QLatin1Char('/')) + || (ch == QLatin1Char('.') && i > 2 && string.at(i - 2) == QLatin1Char('.'))) { + // we escape '*/' and the last dot in 'e.g.' and 'i.e.' for the Javadoc generator + APPEND("&#x"); + xml += QString::number(ch.unicode(), 16); + xml += QLatin1Char(';'); + } else { + if (!xml.isEmpty()) + xml += ch; + } + } + + if (!xml.isEmpty()) + return xml; + return string; + +#undef APPEND +} + +QString DitaXmlGenerator::fileBase(const Node *node) +{ + QString result; + + result = PageGenerator::fileBase(node); + + if (!node->isInnerNode()) { + switch (node->status()) { + case Node::Compat: + result += "-qt3"; + break; + case Node::Obsolete: + result += "-obsolete"; + break; + default: + ; + } + } + return result; +} + +#if 0 +QString DitaXmlGenerator::fileBase(const Node *node, + const SectionIterator& section) +{ + QStringList::ConstIterator s = section.sectionNumber().end(); + QStringList::ConstIterator b = section.baseNameStack().end(); + + QString suffix; + QString base = fileBase(node); + + while (s != section.sectionNumber().begin()) { + --s; + --b; + if (!(*b).isEmpty()) { + base = *b; + break; + } + suffix.prepend("-" + *s); + } + return base + suffix; +} +#endif + +QString DitaXmlGenerator::fileName(const Node *node) +{ + if (node->type() == Node::Fake) { + if (static_cast<const FakeNode *>(node)->subType() == Node::ExternalPage) + return node->name(); + if (static_cast<const FakeNode *>(node)->subType() == Node::Image) + return node->name(); + } + return PageGenerator::fileName(node); +} + +QString DitaXmlGenerator::refForNode(const Node *node) +{ + const FunctionNode *func; + const TypedefNode *typedeffe; + QString ref; + + switch (node->type()) { + case Node::Namespace: + case Node::Class: + default: + break; + case Node::Enum: + ref = node->name() + "-enum"; + break; + case Node::Typedef: + typedeffe = static_cast<const TypedefNode *>(node); + if (typedeffe->associatedEnum()) { + return refForNode(typedeffe->associatedEnum()); + } + else { + ref = node->name() + "-typedef"; + } + break; + case Node::Function: + func = static_cast<const FunctionNode *>(node); + if (func->associatedProperty()) { + return refForNode(func->associatedProperty()); + } + else { + ref = func->name(); + if (func->overloadNumber() != 1) + ref += "-" + QString::number(func->overloadNumber()); + } + break; +#ifdef QDOC_QML + case Node::Fake: + if (node->subType() != Node::QmlPropertyGroup) + break; + case Node::QmlProperty: +#endif + case Node::Property: + ref = node->name() + "-prop"; + break; +#ifdef QDOC_QML + case Node::QmlSignal: + ref = node->name() + "-signal"; + break; + case Node::QmlMethod: + ref = node->name() + "-method"; + break; +#endif + case Node::Variable: + ref = node->name() + "-var"; + break; + case Node::Target: + return protectEnc(node->name()); + } + return registerRef(ref); +} + +QString DitaXmlGenerator::linkForNode(const Node *node, const Node *relative) +{ + QString link; + QString fn; + QString ref; + + if (node == 0 || node == relative) + return QString(); + if (!node->url().isEmpty()) + return node->url(); + if (fileBase(node).isEmpty()) + return QString(); + if (node->access() == Node::Private) + return QString(); + + fn = fileName(node); + link += fn; + + if (!node->isInnerNode() || node->subType() == Node::QmlPropertyGroup) { + ref = refForNode(node); + if (relative && fn == fileName(relative) && ref == refForNode(relative)) + return QString(); + + link += "#"; + link += ref; + } + return link; +} + +QString DitaXmlGenerator::refForAtom(Atom *atom, const Node * /* node */) +{ + if (atom->type() == Atom::SectionLeft) { + return Doc::canonicalTitle(Text::sectionHeading(atom).toString()); + } + else if (atom->type() == Atom::Target) { + return Doc::canonicalTitle(atom->string()); + } + else { + return QString(); + } +} + +void DitaXmlGenerator::generateFullName(const Node *apparentNode, + const Node *relative, + CodeMarker *marker, + const Node *actualNode) +{ + if (actualNode == 0) + actualNode = apparentNode; + out() << "<xref href=\"" << linkForNode(actualNode, relative); + if (true || relative == 0 || relative->status() != actualNode->status()) { + switch (actualNode->status()) { + case Node::Obsolete: + out() << "\" class=\"obsolete"; + break; + case Node::Compat: + out() << "\" class=\"compat"; + break; + default: + ; + } + } + out() << "\">"; + out() << protectEnc(fullName(apparentNode, relative, marker)); + out() << "</xref>"; +} + +void DitaXmlGenerator::generateDetailedMember(const Node *node, + const InnerNode *relative, + CodeMarker *marker) +{ + const EnumNode *enume; + +#ifdef GENERATE_MAC_REFS + generateMacRef(node, marker); +#endif + if (node->type() == Node::Enum + && (enume = static_cast<const EnumNode *>(node))->flagsType()) { +#ifdef GENERATE_MAC_REFS + generateMacRef(enume->flagsType(), marker); +#endif + out() << "<h3 class=\"flags\">"; + out() << "<a name=\"" + refForNode(node) + "\"></a>"; + generateSynopsis(enume, relative, marker, CodeMarker::Detailed); + out() << "<br/>"; + generateSynopsis(enume->flagsType(), + relative, + marker, + CodeMarker::Detailed); + out() << "</h3>\n"; + } + else { + out() << "<h3 class=\"fn\">"; + out() << "<a name=\"" + refForNode(node) + "\"></a>"; + generateSynopsis(node, relative, marker, CodeMarker::Detailed); + out() << "</h3>\n"; + } + + generateStatus(node, marker); + generateBody(node, marker); + generateThreadSafeness(node, marker); + generateSince(node, marker); + + if (node->type() == Node::Property) { + const PropertyNode *property = static_cast<const PropertyNode *>(node); + Section section; + + section.members += property->getters(); + section.members += property->setters(); + section.members += property->resetters(); + + if (!section.members.isEmpty()) { + out() << "<p><b>Access functions:</b></p>\n"; + generateSectionList(section, node, marker, CodeMarker::Accessors); + } + + Section notifiers; + notifiers.members += property->notifiers(); + + if (!notifiers.members.isEmpty()) { + out() << "<p><b>Notifier signal:</b></p>\n"; + //out() << "<p>This signal is emitted when the property value is changed.</p>\n"; + generateSectionList(notifiers, node, marker, CodeMarker::Accessors); + } + } + else if (node->type() == Node::Enum) { + const EnumNode *enume = static_cast<const EnumNode *>(node); + if (enume->flagsType()) { + out() << "<p>The " << protectEnc(enume->flagsType()->name()) + << " type is a typedef for " + << "<xref href=\"qflags.html\">QFlags</xref><" + << protectEnc(enume->name()) + << ">. It stores an OR combination of " + << protectEnc(enume->name()) + << " values.</p>\n"; + } + } + generateAlsoList(node, marker); +} + +void DitaXmlGenerator::findAllClasses(const InnerNode *node) +{ + NodeList::const_iterator c = node->childNodes().constBegin(); + while (c != node->childNodes().constEnd()) { + if ((*c)->access() != Node::Private && (*c)->url().isEmpty()) { + if ((*c)->type() == Node::Class && !(*c)->doc().isEmpty()) { + QString className = (*c)->name(); + if ((*c)->parent() && + (*c)->parent()->type() == Node::Namespace && + !(*c)->parent()->name().isEmpty()) + className = (*c)->parent()->name()+"::"+className; + + if (!(static_cast<const ClassNode *>(*c))->hideFromMainList()) { + if ((*c)->status() == Node::Compat) { + compatClasses.insert(className, *c); + } + else if ((*c)->status() == Node::Obsolete) { + obsoleteClasses.insert(className, *c); + } + else { + nonCompatClasses.insert(className, *c); + if ((*c)->status() == Node::Main) + mainClasses.insert(className, *c); + } + } + + QString moduleName = (*c)->moduleName(); + if (moduleName == "Qt3SupportLight") { + moduleClassMap[moduleName].insert((*c)->name(), *c); + moduleName = "Qt3Support"; + } + if (!moduleName.isEmpty()) + moduleClassMap[moduleName].insert((*c)->name(), *c); + + QString serviceName = + (static_cast<const ClassNode *>(*c))->serviceName(); + if (!serviceName.isEmpty()) + serviceClasses.insert(serviceName, *c); + } + else if ((*c)->isInnerNode()) { + findAllClasses(static_cast<InnerNode *>(*c)); + } + } + ++c; + } +} + +/*! + For generating the "New Classes... in 4.6" section on the + What's New in 4.6" page. + */ +void DitaXmlGenerator::findAllSince(const InnerNode *node) +{ + NodeList::const_iterator child = node->childNodes().constBegin(); + while (child != node->childNodes().constEnd()) { + QString sinceVersion = (*child)->since(); + if (((*child)->access() != Node::Private) && !sinceVersion.isEmpty()) { + NewSinceMaps::iterator nsmap = newSinceMaps.find(sinceVersion); + if (nsmap == newSinceMaps.end()) + nsmap = newSinceMaps.insert(sinceVersion,NodeMultiMap()); + NewClassMaps::iterator ncmap = newClassMaps.find(sinceVersion); + if (ncmap == newClassMaps.end()) + ncmap = newClassMaps.insert(sinceVersion,NodeMap()); + NewClassMaps::iterator nqcmap = newQmlClassMaps.find(sinceVersion); + if (nqcmap == newQmlClassMaps.end()) + nqcmap = newQmlClassMaps.insert(sinceVersion,NodeMap()); + + if ((*child)->type() == Node::Function) { + FunctionNode *func = static_cast<FunctionNode *>(*child); + if ((func->status() > Node::Obsolete) && + (func->metaness() != FunctionNode::Ctor) && + (func->metaness() != FunctionNode::Dtor)) { + nsmap.value().insert(func->name(),(*child)); + } + } + else if ((*child)->url().isEmpty()) { + if ((*child)->type() == Node::Class && !(*child)->doc().isEmpty()) { + QString className = (*child)->name(); + if ((*child)->parent() && + (*child)->parent()->type() == Node::Namespace && + !(*child)->parent()->name().isEmpty()) + className = (*child)->parent()->name()+"::"+className; + nsmap.value().insert(className,(*child)); + ncmap.value().insert(className,(*child)); + } + else if ((*child)->subType() == Node::QmlClass) { + QString className = (*child)->name(); + if ((*child)->parent() && + (*child)->parent()->type() == Node::Namespace && + !(*child)->parent()->name().isEmpty()) + className = (*child)->parent()->name()+"::"+className; + nsmap.value().insert(className,(*child)); + nqcmap.value().insert(className,(*child)); + } + } + else { + QString name = (*child)->name(); + if ((*child)->parent() && + (*child)->parent()->type() == Node::Namespace && + !(*child)->parent()->name().isEmpty()) + name = (*child)->parent()->name()+"::"+name; + nsmap.value().insert(name,(*child)); + } + if ((*child)->isInnerNode()) { + findAllSince(static_cast<InnerNode *>(*child)); + } + } + ++child; + } +} + +#if 0 + const QRegExp versionSeparator("[\\-\\.]"); + const int minorIndex = version.indexOf(versionSeparator); + const int patchIndex = version.indexOf(versionSeparator, minorIndex+1); + version = version.left(patchIndex); +#endif + +void DitaXmlGenerator::findAllFunctions(const InnerNode *node) +{ + NodeList::ConstIterator c = node->childNodes().begin(); + while (c != node->childNodes().end()) { + if ((*c)->access() != Node::Private) { + if ((*c)->isInnerNode() && (*c)->url().isEmpty()) { + findAllFunctions(static_cast<const InnerNode *>(*c)); + } + else if ((*c)->type() == Node::Function) { + const FunctionNode *func = static_cast<const FunctionNode *>(*c); + if ((func->status() > Node::Obsolete) && + (func->metaness() != FunctionNode::Ctor) && + (func->metaness() != FunctionNode::Dtor)) { + funcIndex[(*c)->name()].insert(myTree->fullDocumentName((*c)->parent()), *c); + } + } + } + ++c; + } +} + +void DitaXmlGenerator::findAllLegaleseTexts(const InnerNode *node) +{ + NodeList::ConstIterator c = node->childNodes().begin(); + while (c != node->childNodes().end()) { + if ((*c)->access() != Node::Private) { + if (!(*c)->doc().legaleseText().isEmpty()) + legaleseTexts.insertMulti((*c)->doc().legaleseText(), *c); + if ((*c)->isInnerNode()) + findAllLegaleseTexts(static_cast<const InnerNode *>(*c)); + } + ++c; + } +} + +void DitaXmlGenerator::findAllNamespaces(const InnerNode *node) +{ + NodeList::ConstIterator c = node->childNodes().begin(); + while (c != node->childNodes().end()) { + if ((*c)->access() != Node::Private) { + if ((*c)->isInnerNode() && (*c)->url().isEmpty()) { + findAllNamespaces(static_cast<const InnerNode *>(*c)); + if ((*c)->type() == Node::Namespace) { + const NamespaceNode *nspace = static_cast<const NamespaceNode *>(*c); + // Ensure that the namespace's name is not empty (the root + // namespace has no name). + if (!nspace->name().isEmpty()) { + namespaceIndex.insert(nspace->name(), *c); + QString moduleName = (*c)->moduleName(); + if (moduleName == "Qt3SupportLight") { + moduleNamespaceMap[moduleName].insert((*c)->name(), *c); + moduleName = "Qt3Support"; + } + if (!moduleName.isEmpty()) + moduleNamespaceMap[moduleName].insert((*c)->name(), *c); + } + } + } + } + ++c; + } +} + +int DitaXmlGenerator::hOffset(const Node *node) +{ + switch (node->type()) { + case Node::Namespace: + case Node::Class: + return 2; + case Node::Fake: + return 1; +#if 0 + if (node->doc().briefText().isEmpty()) + return 1; + else + return 2; +#endif + case Node::Enum: + case Node::Typedef: + case Node::Function: + case Node::Property: + default: + return 3; + } +} + +bool DitaXmlGenerator::isThreeColumnEnumValueTable(const Atom *atom) +{ + while (atom != 0 && !(atom->type() == Atom::ListRight && atom->string() == ATOM_LIST_VALUE)) { + if (atom->type() == Atom::ListItemLeft && !matchAhead(atom, Atom::ListItemRight)) + return true; + atom = atom->next(); + } + return false; +} + +const Node *DitaXmlGenerator::findNodeForTarget(const QString &target, + const Node *relative, + CodeMarker *marker, + const Atom *atom) +{ + const Node *node = 0; + + if (target.isEmpty()) { + node = relative; + } + else if (target.endsWith(".html")) { + node = myTree->root()->findNode(target, Node::Fake); + } + else if (marker) { + node = marker->resolveTarget(target, myTree, relative); + if (!node) + node = myTree->findFakeNodeByTitle(target); + if (!node && atom) { + node = myTree->findUnambiguousTarget(target, + *const_cast<Atom**>(&atom)); + } + } + + if (!node) + relative->doc().location().warning(tr("Cannot link to '%1'").arg(target)); + + return node; +} + +const QPair<QString,QString> DitaXmlGenerator::anchorForNode(const Node *node) +{ + QPair<QString,QString> anchorPair; + + anchorPair.first = PageGenerator::fileName(node); + if (node->type() == Node::Fake) { + const FakeNode *fakeNode = static_cast<const FakeNode*>(node); + anchorPair.second = fakeNode->title(); + } + + return anchorPair; +} + +QString DitaXmlGenerator::getLink(const Atom *atom, + const Node *relative, + CodeMarker *marker, + const Node** node) +{ + QString link; + *node = 0; + inObsoleteLink = false; + + if (atom->string().contains(":") && + (atom->string().startsWith("file:") + || atom->string().startsWith("http:") + || atom->string().startsWith("https:") + || atom->string().startsWith("ftp:") + || atom->string().startsWith("mailto:"))) { + + link = atom->string(); + } + else { + QStringList path; + if (atom->string().contains('#')) { + path = atom->string().split('#'); + } + else { + path.append(atom->string()); + } + + Atom *targetAtom = 0; + + QString first = path.first().trimmed(); + if (first.isEmpty()) { + *node = relative; + } + else if (first.endsWith(".html")) { + *node = myTree->root()->findNode(first, Node::Fake); + } + else { + *node = marker->resolveTarget(first, myTree, relative); + if (!*node) { + *node = myTree->findFakeNodeByTitle(first); + } + if (!*node) { + *node = myTree->findUnambiguousTarget(first, targetAtom); + } + } + + if (*node) { + if (!(*node)->url().isEmpty()) + return (*node)->url(); + else + path.removeFirst(); + } + else { + *node = relative; + } + + if (*node) { + if ((*node)->status() == Node::Obsolete) { + if (relative) { + if (relative->parent() != *node) { + if (relative->status() != Node::Obsolete) { + bool porting = false; + if (relative->type() == Node::Fake) { + const FakeNode* fake = static_cast<const FakeNode*>(relative); + if (fake->title().startsWith("Porting")) + porting = true; + } + QString name = marker->plainFullName(relative); + if (!porting && !name.startsWith("Q3")) { + if (obsoleteLinks) { + relative->doc().location().warning(tr("Link to obsolete item '%1' in %2") + .arg(atom->string()) + .arg(name)); + } + inObsoleteLink = true; + } + } + } + } + else { + qDebug() << "Link to Obsolete entity" + << (*node)->name() << "no relative"; + } + } +#if 0 + else if ((*node)->status() == Node::Deprecated) { + qDebug() << "Link to Deprecated entity"; + } + else if ((*node)->status() == Node::Internal) { + qDebug() << "Link to Internal entity"; + } +#endif + } + + while (!path.isEmpty()) { + targetAtom = myTree->findTarget(path.first(), *node); + if (targetAtom == 0) + break; + path.removeFirst(); + } + + if (path.isEmpty()) { + link = linkForNode(*node, relative); + if (*node && (*node)->subType() == Node::Image) + link = "images/used-in-examples/" + link; + if (targetAtom) + link += "#" + refForAtom(targetAtom, *node); + } + } + return link; +} + +void DitaXmlGenerator::generateIndex(const QString &fileBase, + const QString &url, + const QString &title) +{ + myTree->generateIndex(outputDir() + "/" + fileBase + ".index", url, title); +} + +void DitaXmlGenerator::generateStatus(const Node *node, CodeMarker *marker) +{ + Text text; + + switch (node->status()) { + case Node::Obsolete: + if (node->isInnerNode()) + Generator::generateStatus(node, marker); + break; + case Node::Compat: + if (node->isInnerNode()) { + text << Atom::ParaLeft + << Atom(Atom::FormattingLeft,ATOM_FORMATTING_BOLD) + << "This " + << typeString(node) + << " is part of the Qt 3 support library." + << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) + << " It is provided to keep old source code working. " + << "We strongly advise against " + << "using it in new code. See "; + + const FakeNode *fakeNode = myTree->findFakeNodeByTitle("Porting To Qt 4"); + Atom *targetAtom = 0; + if (fakeNode && node->type() == Node::Class) { + QString oldName(node->name()); + targetAtom = myTree->findTarget(oldName.replace("3", ""), + fakeNode); + } + + if (targetAtom) { + text << Atom(Atom::Link, linkForNode(fakeNode, node) + "#" + + refForAtom(targetAtom, fakeNode)); + } + else + text << Atom(Atom::Link, "Porting to Qt 4"); + + text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) + << Atom(Atom::String, "Porting to Qt 4") + << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) + << " for more information." + << Atom::ParaRight; + } + generateText(text, node, marker); + break; + default: + Generator::generateStatus(node, marker); + } +} + +#ifdef GENERATE_MAC_REFS +/* + No longer valid. + */ +void DitaXmlGenerator::generateMacRef(const Node *node, CodeMarker *marker) +{ + if (!pleaseGenerateMacRef || marker == 0) + return; + + QStringList macRefs = marker->macRefsForNode(node); + foreach (const QString &macRef, macRefs) + out() << "<a name=\"" << "//apple_ref/" << macRef << "\"></a>\n"; +} +#endif + +void DitaXmlGenerator::beginLink(const QString &link, + const Node *node, + const Node *relative, + CodeMarker *marker) +{ + Q_UNUSED(marker) + Q_UNUSED(relative) + + this->link = link; + if (link.isEmpty()) { + if (showBrokenLinks) + writer.writeStartElement("i"); + } + else if (node == 0 || (relative != 0 && + node->status() == relative->status())) { + writer.writeStartElement("xref"); + writer.writeAttribute("href",link); + } + else { + switch (node->status()) { + case Node::Obsolete: + writer.writeStartElement("xref"); + writer.writeAttribute("href",link); + writer.writeAttribute("outputclass","obsolete"); + break; + case Node::Compat: + writer.writeStartElement("xref"); + writer.writeAttribute("href",link); + writer.writeAttribute("outputclass","compat"); + break; + default: + writer.writeStartElement("xref"); + writer.writeAttribute("href",link); + } + } + inLink = true; +} + +void DitaXmlGenerator::endLink() +{ + if (inLink) { + if (link.isEmpty()) { + if (showBrokenLinks) + writer.writeEndElement(); // i + } + else { + if (inObsoleteLink) { + writer.writeStartElement("sup"); + writer.writeCharacters("(obsolete)"); + writer.writeEndElement(); // sup + } + writer.writeEndElement(); // xref + } + } + inLink = false; + inObsoleteLink = false; +} + +#ifdef QDOC_QML + +/*! + Generates the summary for the \a section. Only used for + sections of QML element documentation. + + Currently handles only the QML property group. + */ +void DitaXmlGenerator::generateQmlSummary(const Section& section, + const Node *relative, + CodeMarker *marker) +{ + if (!section.members.isEmpty()) { + NodeList::ConstIterator m; + int count = section.members.size(); + bool twoColumn = false; + if (section.members.first()->type() == Node::QmlProperty) { + twoColumn = (count >= 5); + } + if (twoColumn) + out() << "<table class=\"qmlsummary\">\n"; + if (++numTableRows % 2 == 1) + out() << "<tr class=\"odd topAlign\">"; + else + out() << "<tr class=\"even topAlign\">"; + // << "<tr><td class=\"topAlign\">"; + out() << "<ul>\n"; + + int row = 0; + m = section.members.begin(); + while (m != section.members.end()) { + if (twoColumn && row == (int) (count + 1) / 2) + out() << "</ul></td><td class=\"topAlign\"><ul>\n"; + out() << "<li class=\"fn\">"; + generateQmlItem(*m,relative,marker,true); + out() << "</li>\n"; + row++; + ++m; + } + out() << "</ul>\n"; + if (twoColumn) + out() << "</td></tr>\n</table>\n"; + } +} + +/*! + Outputs the html detailed documentation for a section + on a QML element reference page. + */ +void DitaXmlGenerator::generateDetailedQmlMember(const Node *node, + const InnerNode *relative, + CodeMarker *marker) +{ + const QmlPropertyNode* qpn = 0; +#ifdef GENERATE_MAC_REFS + generateMacRef(node, marker); +#endif + out() << "<div class=\"qmlitem\">"; + if (node->subType() == Node::QmlPropertyGroup) { + const QmlPropGroupNode* qpgn = static_cast<const QmlPropGroupNode*>(node); + NodeList::ConstIterator p = qpgn->childNodes().begin(); + out() << "<div class=\"qmlproto\">"; + out() << "<table class=\"qmlname\">"; + + while (p != qpgn->childNodes().end()) { + if ((*p)->type() == Node::QmlProperty) { + qpn = static_cast<const QmlPropertyNode*>(*p); + + if (++numTableRows % 2 == 1) + out() << "<tr class=\"odd\">"; + else + out() << "<tr class=\"even\">"; + + out() << "<td><p>"; + //out() << "<tr><td>"; // old + out() << "<a name=\"" + refForNode(qpn) + "\"></a>"; + if (!qpn->isWritable()) + out() << "<span class=\"qmlreadonly\">read-only</span>"; + if (qpgn->isDefault()) + out() << "<span class=\"qmldefault\">default</span>"; + generateQmlItem(qpn, relative, marker, false); + out() << "</td></tr>"; + } + ++p; + } + out() << "</table>"; + out() << "</div>"; + } + else if (node->type() == Node::QmlSignal) { + const FunctionNode* qsn = static_cast<const FunctionNode*>(node); + out() << "<div class=\"qmlproto\">"; + out() << "<table class=\"qmlname\">"; + //out() << "<tr>"; + if (++numTableRows % 2 == 1) + out() << "<tr class=\"odd\">"; + else + out() << "<tr class=\"even\">"; + out() << "<td><p>"; + out() << "<a name=\"" + refForNode(qsn) + "\"></a>"; + generateSynopsis(qsn,relative,marker,CodeMarker::Detailed,false); + //generateQmlItem(qsn,relative,marker,false); + out() << "</p></td></tr>"; + out() << "</table>"; + out() << "</div>"; + } + else if (node->type() == Node::QmlMethod) { + const FunctionNode* qmn = static_cast<const FunctionNode*>(node); + out() << "<div class=\"qmlproto\">"; + out() << "<table class=\"qmlname\">"; + //out() << "<tr>"; + if (++numTableRows % 2 == 1) + out() << "<tr class=\"odd\">"; + else + out() << "<tr class=\"even\">"; + out() << "<td><p>"; + out() << "<a name=\"" + refForNode(qmn) + "\"></a>"; + generateSynopsis(qmn,relative,marker,CodeMarker::Detailed,false); + out() << "</p></td></tr>"; + out() << "</table>"; + out() << "</div>"; + } + out() << "<div class=\"qmldoc\">"; + generateStatus(node, marker); + generateBody(node, marker); + generateThreadSafeness(node, marker); + generateSince(node, marker); + generateAlsoList(node, marker); + out() << "</div>"; + out() << "</div>"; +} + +/*! + Output the "Inherits" line for the QML element, + if there should be one. + */ +void DitaXmlGenerator::generateQmlInherits(const QmlClassNode* cn, + CodeMarker* marker) +{ + if (cn && !cn->links().empty()) { + if (cn->links().contains(Node::InheritsLink)) { + QPair<QString,QString> linkPair; + linkPair = cn->links()[Node::InheritsLink]; + QStringList strList(linkPair.first); + const Node* n = myTree->findNode(strList,Node::Fake); + if (n && n->subType() == Node::QmlClass) { + const QmlClassNode* qcn = static_cast<const QmlClassNode*>(n); + out() << "<p class=\"centerAlign\">"; + Text text; + text << "[Inherits "; + text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn)); + text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK); + text << Atom(Atom::String, linkPair.second); + text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK); + text << "]"; + generateText(text, cn, marker); + out() << "</p>"; + } + } + } +} + +/*! + Output the "Inherit by" list for the QML element, + if it is inherited by any other elements. + */ +void DitaXmlGenerator::generateQmlInheritedBy(const QmlClassNode* cn, + CodeMarker* marker) +{ + if (cn) { + NodeList subs; + QmlClassNode::subclasses(cn->name(),subs); + if (!subs.isEmpty()) { + Text text; + text << Atom::ParaLeft << "Inherited by "; + appendSortedQmlNames(text,cn,subs,marker); + text << Atom::ParaRight; + generateText(text, cn, marker); + } + } +} + +/*! + Output the "[Xxx instantiates the C++ class QmlGraphicsXxx]" + line for the QML element, if there should be one. + + If there is no class node, or if the class node status + is set to Node::Internal, do nothing. + */ +void DitaXmlGenerator::generateQmlInstantiates(const QmlClassNode* qcn, + CodeMarker* marker) +{ + const ClassNode* cn = qcn->classNode(); + if (cn && (cn->status() != Node::Internal)) { + out() << "<p class=\"centerAlign\">"; + Text text; + text << "["; + text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn)); + text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK); + text << Atom(Atom::String, qcn->name()); + text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK); + text << " instantiates the C++ class "; + text << Atom(Atom::LinkNode,CodeMarker::stringForNode(cn)); + text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK); + text << Atom(Atom::String, cn->name()); + text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK); + text << "]"; + generateText(text, qcn, marker); + out() << "</p>"; + } +} + +/*! + Output the "[QmlGraphicsXxx is instantiated by QML element Xxx]" + line for the class, if there should be one. + + If there is no QML element, or if the class node status + is set to Node::Internal, do nothing. + */ +void DitaXmlGenerator::generateInstantiatedBy(const ClassNode* cn, + CodeMarker* marker) +{ + if (cn && cn->status() != Node::Internal && !cn->qmlElement().isEmpty()) { + const Node* n = myTree->root()->findNode(cn->qmlElement(),Node::Fake); + if (n && n->subType() == Node::QmlClass) { + out() << "<p class=\"centerAlign\">"; + Text text; + text << "["; + text << Atom(Atom::LinkNode,CodeMarker::stringForNode(cn)); + text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK); + text << Atom(Atom::String, cn->name()); + text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK); + text << " is instantiated by QML element "; + text << Atom(Atom::LinkNode,CodeMarker::stringForNode(n)); + text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK); + text << Atom(Atom::String, n->name()); + text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK); + text << "]"; + generateText(text, cn, marker); + out() << "</p>"; + } + } +} + +/*! + Generate the <page> element for the given \a node using the \a writer. + Return true if a <page> element was written; otherwise return false. + */ +bool DitaXmlGenerator::generatePageElement(QXmlStreamWriter& writer, + const Node* node, + CodeMarker* marker) const +{ + if (node->pageType() == Node::NoPageType) + return false; + if (node->name().isEmpty()) + return true; + if (node->access() == Node::Private) + return false; + if (!node->isInnerNode()) + return false; + + QString title; + QString rawTitle; + QString fullTitle; + const InnerNode* inner = static_cast<const InnerNode*>(node); + + writer.writeStartElement("page"); + QXmlStreamAttributes attributes; + QString t; + t.setNum(id++); + switch (node->type()) { + case Node::Fake: + { + const FakeNode* fake = static_cast<const FakeNode*>(node); + title = fake->fullTitle(); + break; + } + case Node::Class: + { + title = node->name() + " Class Reference"; + break; + } + case Node::Namespace: + { + rawTitle = marker->plainName(inner); + fullTitle = marker->plainFullName(inner); + title = rawTitle + " Namespace Reference"; + break; + } + default: + title = node->name(); + break; + } + writer.writeAttribute("id",t); + writer.writeStartElement("pageWords"); + writer.writeCharacters(title); + if (!inner->pageKeywords().isEmpty()) { + const QStringList& w = inner->pageKeywords(); + for (int i = 0; i < w.size(); ++i) { + writer.writeCharacters(" "); + writer.writeCharacters(w.at(i).toLocal8Bit().constData()); + } + } + writer.writeEndElement(); + writer.writeStartElement("pageTitle"); + writer.writeCharacters(title); + writer.writeEndElement(); + writer.writeStartElement("pageUrl"); + writer.writeCharacters(PageGenerator::fileName(node)); + writer.writeEndElement(); + writer.writeStartElement("pageType"); + switch (node->pageType()) { + case Node::ApiPage: + writer.writeCharacters("APIPage"); + break; + case Node::ArticlePage: + writer.writeCharacters("Article"); + break; + case Node::ExamplePage: + writer.writeCharacters("Example"); + break; + default: + break; + } + writer.writeEndElement(); + writer.writeEndElement(); + return true; +} + +/*! + Traverse the tree recursively and generate the <keyword> + elements. + */ +void DitaXmlGenerator::generatePageElements(QXmlStreamWriter& writer, const Node* node, CodeMarker* marker) const +{ + if (generatePageElement(writer, node, marker)) { + + if (node->isInnerNode()) { + const InnerNode *inner = static_cast<const InnerNode *>(node); + + // Recurse to write an element for this child node and all its children. + foreach (const Node *child, inner->childNodes()) + generatePageElements(writer, child, marker); + } + } +} + +/*! + Outputs the file containing the index used for searching the html docs. + */ +void DitaXmlGenerator::generatePageIndex(const QString& fileName, CodeMarker* marker) const +{ + QFile file(fileName); + if (!file.open(QFile::WriteOnly | QFile::Text)) + return ; + + QXmlStreamWriter writer(&file); + writer.setAutoFormatting(true); + writer.writeStartDocument(); + writer.writeStartElement("qtPageIndex"); + + generatePageElements(writer, myTree->root(), marker); + + writer.writeEndElement(); // qtPageIndex + writer.writeEndDocument(); + file.close(); +} + +#endif + +/*! + Return the full qualification of the node \a n, but without + the name of \a n itself. e.g. A::B::C + */ +QString DitaXmlGenerator::fullQualification(const Node* n) +{ + QString fq; + InnerNode* in = n->parent(); + while (in) { + if ((in->type() == Node::Class) || + (in->type() == Node::Namespace)) { + if (in->name().isEmpty()) + break; + if (fq.isEmpty()) + fq = in->name(); + else + fq = in->name() + "::" + fq; + } + else + break; + in = in->parent(); + } + return fq; +} + +void DitaXmlGenerator::writeDerivations(const ClassNode* cn, CodeMarker* marker) +{ + QList<RelatedClass>::ConstIterator r; + int index; + + if (!cn->baseClasses().isEmpty()) { + writer.writeStartElement(CXXCLASSDERIVATIONS); + r = cn->baseClasses().begin(); + index = 0; + while (r != cn->baseClasses().end()) { + writer.writeStartElement(CXXCLASSDERIVATION); + writer.writeStartElement(CXXCLASSDERIVATIONACCESSSPECIFIER); + writer.writeAttribute("value",(*r).accessString()); + writer.writeEndElement(); // </cxxClassDerivationAccessSpecifier> + writer.writeStartElement(CXXCLASSBASECLASS); + QString fullTitle = marker->plainFullName((*r).node); + QString guid = lookupGuid(fullTitle); + writer.writeAttribute("href",guid); + writer.writeCharacters(fullTitle); + writer.writeEndElement(); // </cxxClassBaseClass> + writer.writeEndElement(); // </cxxClassDerivation> + ++r; + } + writer.writeEndElement(); // </cxxClassDerivations> + } +} + +void DitaXmlGenerator::writeLocation(const Node* n, CodeMarker* marker) +{ + QString s1, s2, s3; + if (n->type() == Node::Class) { + s1 = CXXCLASSAPIITEMLOCATION; + s2 = CXXCLASSDECLARATIONFILE; + s3 = CXXCLASSDECLARATIONFILELINE; + } + else if (n->type() == Node::Function) { + s1 = CXXFUNCTIONAPIITEMLOCATION; + s2 = CXXFUNCTIONDECLARATIONFILE; + s3 = CXXFUNCTIONDECLARATIONFILELINE; + } + writer.writeStartElement(s1); + writer.writeStartElement(s2); + writer.writeAttribute("name","filePath"); + writer.writeAttribute("value",n->location().filePath()); + writer.writeEndElement(); // </cxx<s2>DeclarationFile> + writer.writeStartElement(s3); + writer.writeAttribute("name","lineNumber"); + QString lineNr; + writer.writeAttribute("value",lineNr.setNum(n->location().lineNo())); + writer.writeEndElement(); // </cxx<s3>DeclarationFileLine> + writer.writeEndElement(); // </cxx<s1>ApiItemLocation> +} + +void DitaXmlGenerator::writeFunctions(const Section& s, + const ClassNode* cn, + CodeMarker* marker) +{ + NodeList::ConstIterator m = s.members.begin(); + while (m != s.members.end()) { + if ((*m)->type() == Node::Function) { + const FunctionNode* fn = reinterpret_cast<const FunctionNode*>(*m); + QString name = fn->name(); + writer.writeStartElement(CXXFUNCTION); + writeGuidAttribute(name); + writer.writeStartElement(APINAME); + writer.writeCharacters(name); + writer.writeEndElement(); // </apiName> + generateBrief(fn,marker); + writer.writeStartElement(CXXFUNCTIONDETAIL); + writer.writeStartElement(CXXFUNCTIONDEFINITION); + writer.writeStartElement(CXXFUNCTIONACCESSSPECIFIER); + writer.writeAttribute("value",fn->accessString()); + writer.writeEndElement(); // <cxxFunctionAccessSpecifier> + + if (fn->isStatic()) { + writer.writeStartElement(CXXFUNCTIONSTORAGECLASSSPECIFIERSTATIC); + writer.writeAttribute("name","static"); + writer.writeAttribute("value","static"); + writer.writeEndElement(); // <cxxFunctionStorageClassSpecifierStatic> + } + + if (fn->isConst()) { + writer.writeStartElement(CXXFUNCTIONCONST); + writer.writeAttribute("name","const"); + writer.writeAttribute("value","const"); + writer.writeEndElement(); // <cxxFunctionConst> + } + + if (fn->virtualness() != FunctionNode::NonVirtual) { + writer.writeStartElement(CXXFUNCTIONVIRTUAL); + writer.writeAttribute("name","virtual"); + writer.writeAttribute("value","virtual"); + writer.writeEndElement(); // <cxxFunctionVirtual> + if (fn->virtualness() == FunctionNode::PureVirtual) { + writer.writeStartElement(CXXFUNCTIONPUREVIRTUAL); + writer.writeAttribute("name","pure virtual"); + writer.writeAttribute("value","pure virtual"); + writer.writeEndElement(); // <cxxFunctionPureVirtual> + } + } + + if (fn->name() == cn->name()) { + writer.writeStartElement(CXXFUNCTIONCONSTRUCTOR); + writer.writeAttribute("name","constructor"); + writer.writeAttribute("value","constructor"); + writer.writeEndElement(); // <cxxFunctionConstructor> + } + else if (fn->name()[0] == QChar('~')) { + writer.writeStartElement(CXXFUNCTIONDESTRUCTOR); + writer.writeAttribute("name","destructor"); + writer.writeAttribute("value","destructor"); + writer.writeEndElement(); // <cxxFunctionDestructor> + } + else { + writer.writeStartElement(CXXFUNCTIONDECLAREDTYPE); + writer.writeCharacters(fn->returnType()); + writer.writeEndElement(); // <cxxFunctionDeclaredType> + } + QString fq = fullQualification(fn); + if (!fq.isEmpty()) { + writer.writeStartElement(CXXFUNCTIONSCOPEDNAME); + writer.writeCharacters(fq); + writer.writeEndElement(); // <cxxFunctionScopedName> + } + writer.writeStartElement(CXXFUNCTIONPROTOTYPE); + writer.writeCharacters(fn->signature(true)); + writer.writeEndElement(); // <cxxFunctionPrototype> + + QString fnl = fn->signature(false); + int idx = fnl.indexOf(' '); + if (idx < 0) + idx = 0; + else + ++idx; + fnl = fn->parent()->name() + "::" + fnl.mid(idx); + writer.writeStartElement(CXXFUNCTIONNAMELOOKUP); + writer.writeCharacters(fnl); + writer.writeEndElement(); // <cxxFunctionNameLookup> + + writeLocation(fn, marker); + writer.writeEndElement(); // <cxxFunctionDefinition> + writer.writeStartElement(APIDESC); + + if (!fn->doc().isEmpty()) { + generateBody(fn, marker); + // generateAlsoList(inner, marker); + } + + writer.writeEndElement(); // </apiDesc> + writer.writeEndElement(); // </cxxFunctionDetail> + writer.writeEndElement(); // </cxxFunction> + + if (fn->metaness() == FunctionNode::Ctor || + fn->metaness() == FunctionNode::Dtor || + fn->overloadNumber() != 1) { + } + } + ++m; + } +} + +void DitaXmlGenerator::writeNestedClasses(const Section& s, + const ClassNode* cn, + CodeMarker* marker) +{ +} + +void DitaXmlGenerator::writeEnumerations(const Section& s, + const ClassNode* cn, + CodeMarker* marker) +{ +} + +void DitaXmlGenerator::writeTypedefs(const Section& s, + const ClassNode* cn, + CodeMarker* marker) +{ +} + +void DitaXmlGenerator::writeDataMembers(const Section& s, + const ClassNode* cn, + CodeMarker* marker) +{ +} + +void DitaXmlGenerator::writeProperties(const Section& s, + const ClassNode* cn, + CodeMarker* marker) +{ +} + +QT_END_NAMESPACE diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h new file mode 100644 index 0000000000..71304b396d --- /dev/null +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -0,0 +1,336 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +/* + ditaxmlgenerator.h +*/ + +#ifndef DITAXMLGENERATOR_H +#define DITAXMLGENERATOR_H + +#include <qmap.h> +#include <qregexp.h> +#include <QXmlStreamWriter> +#include "codemarker.h" +#include "config.h" +#include "pagegenerator.h" + +QT_BEGIN_NAMESPACE + +typedef QMultiMap<QString, Node*> NodeMultiMap; +typedef QMap<QString, NodeMultiMap> NewSinceMaps; +typedef QMap<Node*, NodeMultiMap> ParentMaps; +typedef QMap<QString, const Node*> NodeMap; +typedef QMap<QString, NodeMap> NewClassMaps; + +class HelpProjectWriter; + +class DitaXmlGenerator : public PageGenerator +{ + public: + enum SinceType { + Namespace, + Class, + MemberFunction, + NamespaceFunction, + GlobalFunction, + Macro, + Enum, + Typedef, + Property, + Variable, + QmlClass, + QmlProperty, + QmlSignal, + QmlMethod, + LastSinceType + }; + + public: + DitaXmlGenerator(); + ~DitaXmlGenerator(); + + virtual void initializeGenerator(const Config& config); + virtual void terminateGenerator(); + virtual QString format(); + virtual void generateTree(const Tree *tree, CodeMarker *marker); + + QString protectEnc(const QString &string); + static QString protect(const QString &string, const QString &encoding = "ISO-8859-1"); + static QString cleanRef(const QString& ref); + static QString sinceTitle(int i) { return sinceTitles[i]; } + + protected: + virtual void startText(const Node *relative, CodeMarker *marker); + virtual int generateAtom(const Atom *atom, + const Node *relative, + CodeMarker *marker); + virtual void generateClassLikeNode(const InnerNode *inner, CodeMarker *marker); + virtual void generateFakeNode(const FakeNode *fake, CodeMarker *marker); + virtual QString fileExtension(const Node *node) const; + virtual QString refForNode(const Node *node); + virtual QString linkForNode(const Node *node, const Node *relative); + virtual QString refForAtom(Atom *atom, const Node *node); + + QString fullQualification(const Node* n); + + void writeDerivations(const ClassNode* cn, CodeMarker* marker); + void writeLocation(const Node* n, CodeMarker* marker); + void writeFunctions(const Section& s, + const ClassNode* cn, + CodeMarker* marker); + void writeNestedClasses(const Section& s, + const ClassNode* cn, + CodeMarker* marker); + void writeEnumerations(const Section& s, + const ClassNode* cn, + CodeMarker* marker); + void writeTypedefs(const Section& s, + const ClassNode* cn, + CodeMarker* marker); + void writeDataMembers(const Section& s, + const ClassNode* cn, + CodeMarker* marker); + void writeProperties(const Section& s, + const ClassNode* cn, + CodeMarker* marker); + + private: + enum SubTitleSize { SmallSubTitle, LargeSubTitle }; + + const QPair<QString,QString> anchorForNode(const Node *node); + const Node *findNodeForTarget(const QString &target, + const Node *relative, + CodeMarker *marker, + const Atom *atom = 0); + void generateBreadCrumbs(const QString& title, + const Node *node, + CodeMarker *marker); + void generateHeader(const Node* node); + void generateTitle(const QString& title, + const Text &subTitle, + SubTitleSize subTitleSize, + const Node *relative, + CodeMarker *marker); + void generateBrief(const Node* node, CodeMarker* marker); + void generateIncludes(const InnerNode *inner, CodeMarker *marker); + void generateTableOfContents(const Node *node, + CodeMarker *marker, + Doc::SectioningUnit sectioningUnit, + int numColumns, + const Node *relative = 0); + void generateTableOfContents(const Node *node, + CodeMarker *marker, + QList<Section>* sections = 0); + QString generateListOfAllMemberFile(const InnerNode *inner, CodeMarker *marker); + QString generateLowStatusMemberFile(const InnerNode *inner, + CodeMarker *marker, + CodeMarker::Status status); + void generateClassHierarchy(const Node *relative, + CodeMarker *marker, + const NodeMap &classMap); + void generateAnnotatedList(const Node *relative, + CodeMarker *marker, + const NodeMap &nodeMap); + void generateCompactList(const Node *relative, + CodeMarker *marker, + const NodeMap &classMap, + bool includeAlphabet, + QString commonPrefix = QString()); + void generateFunctionIndex(const Node *relative, CodeMarker *marker); + void generateLegaleseList(const Node *relative, CodeMarker *marker); + void generateOverviewList(const Node *relative, CodeMarker *marker); + void generateSectionList(const Section& section, + const Node *relative, + CodeMarker *marker, + CodeMarker::SynopsisStyle style); +#ifdef QDOC_QML + void generateQmlSummary(const Section& section, + const Node *relative, + CodeMarker *marker); + void generateQmlItem(const Node *node, + const Node *relative, + CodeMarker *marker, + bool summary); + void generateDetailedQmlMember(const Node *node, + const InnerNode *relative, + CodeMarker *marker); + void generateQmlInherits(const QmlClassNode* cn, CodeMarker* marker); + void generateQmlInheritedBy(const QmlClassNode* cn, CodeMarker* marker); + void generateQmlInstantiates(const QmlClassNode* qcn, CodeMarker* marker); + void generateInstantiatedBy(const ClassNode* cn, CodeMarker* marker); +#endif + + void generateSection(const NodeList& nl, + const Node *relative, + CodeMarker *marker, + CodeMarker::SynopsisStyle style); + void generateSynopsis(const Node *node, + const Node *relative, + CodeMarker *marker, + CodeMarker::SynopsisStyle style, + bool nameAlignment = false); + void generateSectionInheritedList(const Section& section, + const Node *relative, + CodeMarker *marker, + bool nameAlignment = false); + QString highlightedCode(const QString& markedCode, + CodeMarker *marker, + const Node *relative, + CodeMarker::SynopsisStyle style = CodeMarker::Accessors, + bool nameAlignment = false); + + void generateFullName(const Node *apparentNode, + const Node *relative, + CodeMarker *marker, + const Node *actualNode = 0); + void generateDetailedMember(const Node *node, + const InnerNode *relative, + CodeMarker *marker); + void generateLink(const Atom *atom, + const Node *relative, + CodeMarker *marker); + void generateStatus(const Node *node, CodeMarker *marker); + + QString registerRef(const QString& ref); + QString fileBase(const Node *node); +#if 0 + QString fileBase(const Node *node, const SectionIterator& section); +#endif + QString fileName(const Node *node); + void findAllClasses(const InnerNode *node); + void findAllFunctions(const InnerNode *node); + void findAllLegaleseTexts(const InnerNode *node); + void findAllNamespaces(const InnerNode *node); + void findAllSince(const InnerNode *node); + static int hOffset(const Node *node); + static bool isThreeColumnEnumValueTable(const Atom *atom); + virtual QString getLink(const Atom *atom, + const Node *relative, + CodeMarker *marker, + const Node** node); + virtual void generateIndex(const QString &fileBase, + const QString &url, + const QString &title); +#ifdef GENERATE_MAC_REFS + void generateMacRef(const Node *node, CodeMarker *marker); +#endif + void beginLink(const QString &link, + const Node *node, + const Node *relative, + CodeMarker *marker); + void endLink(); + bool generatePageElement(QXmlStreamWriter& writer, + const Node* node, + CodeMarker* marker) const; + void generatePageElements(QXmlStreamWriter& writer, + const Node* node, + CodeMarker* marker) const; + void generatePageIndex(const QString& fileName, + CodeMarker* marker) const; + QString writeGuidAttribute(QString text); + QString lookupGuid(QString text); + + private: + QMap<QString, QString> refMap; + QMap<QString, QString> name2guidMap; + int codeIndent; + bool inLink; + bool inObsoleteLink; + bool inContents; + bool inSectionHeading; + bool inTableHeader; + int numTableRows; + bool threeColumnEnumValueTable; + bool offlineDocs; + QString link; + QStringList sectionNumber; + QRegExp funcLeftParen; + QString style; + QString postHeader; + QString postPostHeader; + QString footer; + QString address; + bool pleaseGenerateMacRef; + QString project; + QString projectDescription; + QString projectUrl; + QString navigationLinks; + QStringList stylesheets; + QStringList customHeadElements; + const Tree *myTree; + bool slow; + bool obsoleteLinks; + int noLinks; + QMap<QString, NodeMap > moduleClassMap; + QMap<QString, NodeMap > moduleNamespaceMap; + NodeMap nonCompatClasses; + NodeMap mainClasses; + NodeMap compatClasses; + NodeMap obsoleteClasses; + NodeMap namespaceIndex; + NodeMap serviceClasses; +#ifdef QDOC_QML + NodeMap qmlClasses; +#endif + QMap<QString, NodeMap > funcIndex; + QMap<Text, const Node *> legaleseTexts; + NewSinceMaps newSinceMaps; + static QString sinceTitles[]; + NewClassMaps newClassMaps; + NewClassMaps newQmlClassMaps; + static int id; + QXmlStreamWriter writer; +}; + +#define DITAXMLGENERATOR_ADDRESS "address" +#define DITAXMLGENERATOR_FOOTER "footer" +#define DITAXMLGENERATOR_GENERATEMACREFS "generatemacrefs" // ### document me +#define DITAXMLGENERATOR_POSTHEADER "postheader" +#define DITAXMLGENERATOR_POSTPOSTHEADER "postpostheader" +#define DITAXMLGENERATOR_STYLE "style" +#define DITAXMLGENERATOR_STYLESHEETS "stylesheets" +#define DITAXMLGENERATOR_CUSTOMHEADELEMENTS "customheadelements" + +QT_END_NAMESPACE + +#endif + diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 5716626f28..280f055540 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -2746,18 +2746,6 @@ Doc::SectioningUnit Doc::granularity() const } } -#if notyet // ### -Doc::SectioningUnit Doc::sectioningUnit() const -{ - if (priv == 0 || priv->extra == 0) { - return DocPrivateExtra().sectioningUnit; - } - else { - return priv->extra->sectioningUnit; - } -} -#endif - const QSet<QString> &Doc::parameterNames() const { return priv == 0 ? *null_Set_QString() : priv->params; diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index a0cd560c20..f6b8c061ee 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -434,6 +434,9 @@ void HtmlGenerator::startText(const Node * /* relative */, sectionNumber.clear(); } +/*! + Generate html from an instance of Atom. + */ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMarker *marker) @@ -516,14 +519,14 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << formattingRightMap()[ATOM_FORMATTING_TELETYPE]; break; case Atom::Code: - out() << "<pre class=\"highlightedCode\">" + out() << "<pre class=\"highlightedCode brush: cpp\">" << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()), marker,relative)) << "</pre>\n"; break; #ifdef QDOC_QML case Atom::Qml: - out() << "<pre class=\"highlightedCode\">" + out() << "<pre class=\"highlightedCode brush: cpp\">" << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()), marker,relative)) << "</pre>\n"; @@ -531,7 +534,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, #endif case Atom::CodeNew: out() << "<p>you can rewrite it as</p>\n" - << "<pre class=\"highlightedCode\">" + << "<pre class=\"highlightedCode brush: cpp\">" << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()), marker,relative)) << "</pre>\n"; @@ -540,7 +543,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << "<p>For example, if you have code like</p>\n"; // fallthrough case Atom::CodeBad: - out() << "<pre class=\"highlightedCode\">" + out() << "<pre class=\"highlightedCode brush: cpp\">" << trimmedTrailing(protectEnc(plainCode(indent(codeIndent,atom->string())))) << "</pre>\n"; break; @@ -599,7 +602,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, generateAnnotatedList(relative, marker, nonCompatClasses); } else if (atom->string() == "classes") { - generateCompactList(relative, marker, nonCompatClasses); + generateCompactList(relative, marker, nonCompatClasses, true); } else if (atom->string().contains("classesbymodule")) { QString arg = atom->string().trimmed(); @@ -647,10 +650,10 @@ int HtmlGenerator::generateAtom(const Atom *atom, generateClassHierarchy(relative, marker, nonCompatClasses); } else if (atom->string() == "compatclasses") { - generateCompactList(relative, marker, compatClasses); + generateCompactList(relative, marker, compatClasses, false); } else if (atom->string() == "obsoleteclasses") { - generateCompactList(relative, marker, obsoleteClasses); + generateCompactList(relative, marker, obsoleteClasses, false); } else if (atom->string() == "functionindex") { generateFunctionIndex(relative, marker); @@ -659,10 +662,10 @@ int HtmlGenerator::generateAtom(const Atom *atom, generateLegaleseList(relative, marker); } else if (atom->string() == "mainclasses") { - generateCompactList(relative, marker, mainClasses); + generateCompactList(relative, marker, mainClasses, true); } else if (atom->string() == "services") { - generateCompactList(relative, marker, serviceClasses); + generateCompactList(relative, marker, serviceClasses, false); } else if (atom->string() == "overviews") { generateOverviewList(relative, marker); @@ -802,9 +805,9 @@ int HtmlGenerator::generateAtom(const Atom *atom, << "\"></a>\n"; out() << "<h3>" << protectEnc((*s).name) << "</h3>\n"; if (idx == Class) - generateCompactList(0, marker, ncmap.value(), QString("Q")); + generateCompactList(0, marker, ncmap.value(), false, QString("Q")); else if (idx == QmlClass) - generateCompactList(0, marker, nqcmap.value(), QString("Q")); + generateCompactList(0, marker, nqcmap.value(), false, QString("Q")); else if (idx == MemberFunction) { ParentMaps parentmaps; ParentMaps::iterator pmap; @@ -830,7 +833,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << "</a>" << ":</p>\n"; generateSection(nlist, 0, marker, CodeMarker::Summary); - out() << "<br />"; + out() << "<br/>"; ++pmap; } } @@ -876,7 +879,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << "</div>"; break; case Atom::LineBreak: - out() << "<br />"; + out() << "<br/>"; break; case Atom::Link: { @@ -912,8 +915,14 @@ int HtmlGenerator::generateAtom(const Atom *atom, else if (atom->string() == ATOM_LIST_VALUE) { threeColumnEnumValueTable = isThreeColumnEnumValueTable(atom); if (threeColumnEnumValueTable) { - out() << "<table class=\"valuelist\">" - << "<tr><th>Constant</th>" + out() << "<table class=\"valuelist\">"; + // << "<tr>" + if (++numTableRows % 2 == 1) + out() << "<tr class=\"odd\">"; + else + out() << "<tr class=\"even\">"; + + out() << "<tr><th>Constant</th>" << "<th>Value</th>" << "<th>Description</th></tr>\n"; } @@ -926,7 +935,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << "<ol type="; if (atom->string() == ATOM_LIST_UPPERALPHA) { out() << "\"A\""; - } + } /* why type? */ else if (atom->string() == ATOM_LIST_LOWERALPHA) { out() << "\"a\""; } @@ -956,7 +965,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << "<tr><td class=\"topAlign\"><tt>" << protectEnc(plainCode(marker->markedUpEnumValue(atom->next()->string(), relative))) - << "</tt></td><td class=\"centerAlign topAlign\">"; + << "</tt></td><td class=\" topAlign\">"; QString itemValue; if (relative->type() == Node::Enum) { @@ -1093,13 +1102,13 @@ int HtmlGenerator::generateAtom(const Atom *atom, } if (!atom->string().isEmpty()) { if (atom->string().contains("%")) - out() << "<table class=\"generic centerAlign\" width=\"" << atom->string() << "\">\n "; + out() << "<table class=\"generic\">\n "; // width=\"" << atom->string() << "\">\n "; else { - out() << "<table class=\"generic centerAlign\">\n"; + out() << "<table class=\"generic\">\n"; } } else { - out() << "<table class=\"generic centerAlign\">\n"; + out() << "<table class=\"generic\">\n"; } numTableRows = 0; break; @@ -1143,7 +1152,10 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << " colspan=\"" << spans.at(0) << "\""; if (spans.at(1) != "1") out() << " rowspan=\"" << spans.at(1) << "\""; + if (inTableHeader) out() << ">"; + else + out() << "><p>"; } if (matchAhead(atom, Atom::ParaLeft)) skipAhead = 1; @@ -1153,7 +1165,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, if (inTableHeader) out() << "</th>"; else - out() << "</td>"; + out() << "</p></td>"; if (matchAhead(atom, Atom::ParaLeft)) skipAhead = 1; break; @@ -1208,6 +1220,9 @@ int HtmlGenerator::generateAtom(const Atom *atom, return skipAhead; } +/*! + Generate a reference page for a C++ class. + */ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, CodeMarker *marker) { @@ -1243,6 +1258,8 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, subtitleText << "(" << Atom(Atom::AutoLink, fullTitle) << ")" << Atom(Atom::LineBreak); +#if 0 + // No longer used because the modeule name is a breadcrumb. QString fixedModule = inner->moduleName(); if (fixedModule == "Qt3SupportLight") fixedModule = "Qt3Support"; @@ -1263,6 +1280,7 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, subtitleText << "]"; } } +#endif generateHeader(title, inner, marker); sections = marker->sections(inner, CodeMarker::Summary, CodeMarker::Okay); @@ -1454,6 +1472,10 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, appendDcfSubSection(&dcfClassesRoot, classSection); } +/*! + Generate the html page for a qdoc file that doesn't map + to an underlying c++ file. + */ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) { SubTitleSize subTitleSize = LargeSubTitle; @@ -1585,7 +1607,7 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) NodeList::ConstIterator m = (*s).members.begin(); while (m != (*s).members.end()) { generateDetailedQmlMember(*m, fake, marker); - out() << "<br />\n"; + out() << "<br/>\n"; fakeSection.keywords += qMakePair((*m)->name(), linkForNode(*m,0)); ++m; @@ -1670,6 +1692,9 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) } } +/*! + Returns "html" for this subclass of Generator. + */ QString HtmlGenerator::fileExtension(const Node * /* node */) const { return "html"; @@ -1686,77 +1711,63 @@ void HtmlGenerator::generateBreadCrumbs(const QString& title, if (node->type() == Node::Class) { const ClassNode* cn = static_cast<const ClassNode*>(node); QString name = node->moduleName(); - out() << " <li><a href=\"modules.html\">All Modules</a></li>"; + out() << " <li><a href=\"modules.html\">Modules</a></li>"; if (!name.isEmpty()) { out() << " <li>"; breadcrumb << Atom(Atom::AutoLink,name); generateText(breadcrumb, node, marker); out() << "</li>\n"; } - breadcrumb.clear(); - if (!cn->name().isEmpty()) { - out() << " <li>"; - breadcrumb << Atom(Atom::AutoLink,cn->name()); - generateText(breadcrumb, 0, marker); - out() << "</li>\n"; - } + if (!cn->name().isEmpty()) + out() << " <li>" << cn->name() << "</li>\n"; } else if (node->type() == Node::Fake) { const FakeNode* fn = static_cast<const FakeNode*>(node); if (node->subType() == Node::Module) { - out() << " <li><a href=\"modules.html\">All Modules</a></li>"; + out() << " <li><a href=\"modules.html\">Modules</a></li>"; QString name = node->name(); - if (!name.isEmpty()) { - out() << " <li>"; - breadcrumb << Atom(Atom::AutoLink,name); - generateText(breadcrumb, 0, marker); - out() << "</li>\n"; - } + if (!name.isEmpty()) + out() << " <li>" << name << "</li>\n"; } else if (node->subType() == Node::Group) { if (fn->name() == QString("modules")) - out() << " <li><a href=\"modules.html\">All Modules</a></li>"; + out() << " <li>Modules</li>"; else { - out() << " <li><a href=\"" << fn->name() << "\">" << title - << "</a></li>"; + out() << " <li>" << title << "</li>"; } } else if (node->subType() == Node::Page) { if (fn->name() == QString("examples.html")) { - out() << " <li><a href=\"examples.html\">All Examples</a></li>"; + out() << " <li>Examples</li>"; } else if (fn->name().startsWith("examples-")) { - out() << " <li><a href=\"examples.html\">All Examples</a></li>"; - out() << " <li><a href=\"" << fn->name() << "\">" << title - << "</a></li>"; + out() << " <li><a href=\"all-examples.html\">Examples</a></li>"; + out() << " <li>" << title << "</li>"; } else if (fn->name() == QString("namespaces.html")) { - out() << " <li><a href=\"namespaces.html\">All Namespaces</a></li>"; + out() << " <li>Namespaces</li>"; } else { - out() << " <li><a href=\"" << fn->name() << "\">" << title - << "</a></li>"; + out() << " <li>" << title << "</li>"; } } else if (node->subType() == Node::QmlClass) { + out() << " <li><a href=\"qdeclarativeelements.html\">QML Elements</a></li>"; + out() << " <li>" << title << "</li>"; } else if (node->subType() == Node::Example) { - out() << " <li><a href=\"examples.html\">All Examples</a></li>"; + out() << " <li><a href=\"all-examples.html\">Examples</a></li>"; QStringList sl = fn->name().split('/'); QString name = "examples-" + sl.at(0) + ".html"; QString t = CodeParser::titleFromName(name); out() << " <li><a href=\"" << name << "\">" << t << "</a></li>"; - out() << " <li><a href=\"" << sl.at(0) - << "-" << sl.at(sl.size()-1) << ".html\">" - << title << "</a></li>"; + out() << " <li>" << title << "</li>"; } } else if (node->type() == Node::Namespace) { - const NamespaceNode* nsn = static_cast<const NamespaceNode*>(node); - out() << " <li><a href=\"namespaces.html\">All Namespaces</a></li>"; - out() << " <li><a href=\"" << fileName(nsn) << "\">" << title - << "</a></li>"; + out() << " <li><a href=\"namespaces.html\">Namespaces</a></li>"; + out() << " <li>" << title << "</li>"; } } @@ -1766,7 +1777,7 @@ void HtmlGenerator::generateHeader(const QString& title, { out() << QString("<?xml version=\"1.0\" encoding=\"%1\"?>\n").arg(outputEncoding); out() << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"; - out() << "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n"; + out() << QString("<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"%1\" lang=\"%1\">\n").arg(naturalLanguage); out() << "<head>\n"; out() << " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n"; QString shortVersion; @@ -1787,28 +1798,50 @@ void HtmlGenerator::generateHeader(const QString& title, out() << " <title>" << shortVersion << protectEnc(title) << "</title>\n"; //out() << " <title>Qt Reference Documentation</title>"; - out() << " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/style.css\" />\n"; - out() << " <!--[if IE]>\n"; - out() << " <meta name=\"MSSmartTagsPreventParsing\" content=\"true\">\n"; - out() << " <meta http-equiv=\"imagetoolbar\" content=\"no\">\n"; - out() << " <![endif]-->\n"; - out() << " <!--[if lt IE 7]>\n"; - out() << " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/style_ie6.css\">\n"; - out() << " <![endif]-->\n"; - out() << " <!--[if IE 7]>\n"; - out() << " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/style_ie7.css\">\n"; - out() << " <![endif]-->\n"; - out() << " <!--[if IE 8]>\n"; - out() << " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/style_ie8.css\">\n"; - out() << " <![endif]-->\n"; - out() << " <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 (offlineDocs) - out() << "<body class=\"offline\">\n"; + { + out() << " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/OfflineStyle.css\" />"; + out() << "</head>\n"; + out() << "<body class=\"offline narrow\" >\n"; // narrow mainly for Creator + } else - out() << "<body class=\"\">\n"; + { + out() << " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/style.css\"\n />"; + out() << " <!--[if IE]>\n"; + out() << "<meta name=\"MSSmartTagsPreventParsing\" content=\"true\">\n"; + out() << "<meta http-equiv=\"imagetoolbar\" content=\"no\">\n"; + out() << "<![endif]-->\n"; + out() << "<!--[if lt IE 7]>\n"; + out() << "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/style_ie6.css\">\n"; + out() << "<![endif]-->\n"; + out() << "<!--[if IE 7]>\n"; + out() << "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/style_ie7.css\">\n"; + out() << "<![endif]-->\n"; + out() << "<!--[if IE 8]>\n"; + out() << "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/style_ie8.css\">\n"; + out() << "<![endif]-->\n"; + // jquery functions + out() << " <script src=\"scripts/jquery.js\" type=\"text/javascript\"></script>\n"; + out() << " <script src=\"scripts/functions.js\" type=\"text/javascript\"></script>\n"; + // menus and small docs js and css + out() << " <script src=\"./scripts/superfish.js\" type=\"text/javascript\"></script>\n"; + out() << " <script src=\"./scripts/narrow.js\" type=\"text/javascript\"></script>\n"; + out() << " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/superfish.css\" />"; + out() << " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/narrow.css\" />"; + + // syntax highlighter js and css + // out() << " <link type=\"text/css\" rel=\"stylesheet\" href=\"style/shCore.css\"/>\n"; + // out() << " <link type=\"text/css\" rel=\"stylesheet\" href=\"style/shThemeDefault.css\"/>\n"; + // out() << " <script type=\"text/javascript\" src=\"scripts/shCore.js\"></script>\n"; + // out() << " <script type=\"text/javascript\" src=\"scripts/shBrushCpp.js\"></script>\n"; + // out() << " <script type=\"text/javascript\">\n"; + // out() << " SyntaxHighlighter.all();\n"; + // out() << " </script>\n"; + + out() << "</head>\n"; + out() << "<body class=\"\" onload=\"CheckEmptyAndLoadList();\">\n"; + } #ifdef GENERATE_MAC_REFS if (mainPage) @@ -1831,18 +1864,16 @@ void HtmlGenerator::generateTitle(const QString& title, CodeMarker *marker) { if (!title.isEmpty()) - out() << "<h1 class=\"title\">" << protectEnc(title); + out() << "<h1 class=\"title\">" << protectEnc(title) << "</h1>\n"; if (!subTitle.isEmpty()) { - out() << "<br />"; - if (subTitleSize == SmallSubTitle) - out() << "<span class=\"small-subtitle\">"; + out() << "<span"; + if (subTitleSize == SmallSubTitle) + out() << " class=\"small-subtitle\">"; else - out() << "<span class=\"subtitle\">"; + out() << " class=\"subtitle\">"; generateText(subTitle, relative, marker); out() << "</span>\n"; } - if (!title.isEmpty()) - out() << "</h1>\n"; } void HtmlGenerator::generateFooter(const Node *node) @@ -1851,9 +1882,18 @@ void HtmlGenerator::generateFooter(const Node *node) out() << "<p>\n" << navigationLinks << "</p>\n"; out() << QString(footer).replace("\\" + COMMAND_VERSION, myTree->version()) - << QString(address).replace("\\" + COMMAND_VERSION, myTree->version()) - << "</body>\n" - "</html>\n"; + << QString(address).replace("\\" + COMMAND_VERSION, myTree->version()); + + if (offlineDocs) + { + out() << "</body>\n"; + } + else + { + out() << " <script src=\"scripts/functions.js\" type=\"text/javascript\"></script>\n"; + out() << "</body>\n"; + } + out() << "</html>\n"; } void HtmlGenerator::generateBrief(const Node *node, CodeMarker *marker, @@ -1874,7 +1914,7 @@ void HtmlGenerator::generateBrief(const Node *node, CodeMarker *marker, void HtmlGenerator::generateIncludes(const InnerNode *inner, CodeMarker *marker) { if (!inner->includes().isEmpty()) { - out() << "<pre clas=\"highlightedCode\">" + out() << "<pre class=\"highlightedCode brush: cpp\">" << trimmedTrailing(highlightedCode(indent(codeIndent, marker->markedUpIncludes(inner->includes())), marker,inner)) @@ -2098,6 +2138,8 @@ void HtmlGenerator::generateNavigationBar(const NavigationBar& bar, out() << "</a>]\n"; #endif } + if (fake->name() != QString("index.html")) + { if (bar.current.begin() != 0) { out() << "[<a href=\"" << "home" << ".html\">Home</a>]\n"; @@ -2109,6 +2151,7 @@ void HtmlGenerator::generateNavigationBar(const NavigationBar& bar, out() << "</a>]\n"; } out() << "</p>\n"; + } } } #endif @@ -2278,22 +2321,22 @@ void HtmlGenerator::generateAnnotatedList(const Node *relative, out() << "<tr class=\"odd topAlign\">"; else out() << "<tr class=\"even topAlign\">"; - out() << "<th>"; + out() << "<td><p>"; generateFullName(node, relative, marker); - out() << "</th>"; + out() << "</p></td>"; if (!(node->type() == Node::Fake)) { Text brief = node->doc().trimmedBriefText(name); if (!brief.isEmpty()) { - out() << "<td>"; + out() << "<td><p>"; generateText(brief, node, marker); - out() << "</td>"; + out() << "</p></td>"; } } else { - out() << "<td>"; + out() << "<td><p>"; out() << protectEnc(node->doc().briefText().toString()); - out() << "</td>"; + out() << "</p></td>"; } out() << "</tr>\n"; } @@ -2312,10 +2355,10 @@ void HtmlGenerator::generateAnnotatedList(const Node *relative, void HtmlGenerator::generateCompactList(const Node *relative, CodeMarker *marker, const NodeMap &classMap, + bool includeAlphabet, QString commonPrefix) { const int NumParagraphs = 37; // '0' to '9', 'A' to 'Z', '_' - const int NumColumns = 3; // number of columns in the result if (classMap.isEmpty()) return; @@ -2384,6 +2427,7 @@ void HtmlGenerator::generateCompactList(const Node *relative, */ NodeMap paragraph[NumParagraphs+1]; QString paragraphName[NumParagraphs+1]; + QSet<char> usedParagraphNames; NodeMap::ConstIterator c = classMap.begin(); while (c != classMap.end()) { @@ -2397,17 +2441,18 @@ void HtmlGenerator::generateCompactList(const Node *relative, else key = pieces.last().toLower(); - int paragraphNo = NumParagraphs - 1; + int paragraphNr = NumParagraphs - 1; if (key[0].digitValue() != -1) { - paragraphNo = key[0].digitValue(); + paragraphNr = key[0].digitValue(); } else if (key[0] >= QLatin1Char('a') && key[0] <= QLatin1Char('z')) { - paragraphNo = 10 + key[0].unicode() - 'a'; + paragraphNr = 10 + key[0].unicode() - 'a'; } - paragraphName[paragraphNo] = key[0].toUpper(); - paragraph[paragraphNo].insert(key, c.value()); + paragraphName[paragraphNr] = key[0].toUpper(); + usedParagraphNames.insert(key[0].toLower().cell()); + paragraph[paragraphNr].insert(key, c.value()); ++c; } @@ -2420,101 +2465,94 @@ void HtmlGenerator::generateCompactList(const Node *relative, start at offsets 0, 3, 4, 8, 9, 14, 23. */ int paragraphOffset[NumParagraphs + 1]; // 37 + 1 - int i, j, k; - paragraphOffset[0] = 0; - for (j = 0; j < NumParagraphs; j++) // j = 0..36 - paragraphOffset[j + 1] = paragraphOffset[j] + paragraph[j].count(); + for (int i=0; i<NumParagraphs; i++) // i = 0..36 + paragraphOffset[i+1] = paragraphOffset[i] + paragraph[i].count(); - int firstOffset[NumColumns + 1]; // 4 + 1 - int currentOffset[NumColumns]; // 4 - int currentParagraphNo[NumColumns]; // 4 - int currentOffsetInParagraph[NumColumns]; // 4 + int curParNr = 0; + int curParOffset = 0; - int numRows = (classMap.count() + NumColumns - 1) / NumColumns; - int curParagNo = 0; + /* + Output the alphabet as a row of links. + */ + if (includeAlphabet) { + out() << "<p class=\"centerAlign functionIndex\"><b>"; + for (int i = 0; i < 26; i++) { + QChar ch('a' + i); + if (usedParagraphNames.contains(char('a' + i))) + out() << QString("<a href=\"#%1\">%2</a> ").arg(ch).arg(ch.toUpper()); + } + out() << "</b></p>\n"; + } - for (i = 0; i < NumColumns; i++) { // i = 0..3 - firstOffset[i] = qMin(i * numRows, classMap.size()); - currentOffset[i] = firstOffset[i]; + /* + Output a <div> element to contain all the <dl> elements. + */ + out() << "<div class=\"flowListDiv\">\n"; - for (j = curParagNo; j < NumParagraphs; j++) { - if (paragraphOffset[j] > firstOffset[i]) - break; - if (paragraphOffset[j] <= firstOffset[i]) - curParagNo = j; - } - currentParagraphNo[i] = curParagNo; - currentOffsetInParagraph[i] = firstOffset[i] - - paragraphOffset[curParagNo]; - } - firstOffset[NumColumns] = classMap.count(); - - out() << "<table class=\"generic\">\n"; - for (k = 0; k < numRows; k++) { - out() << "<tr>\n"; - for (i = 0; i < NumColumns; i++) { - if (currentOffset[i] >= firstOffset[i + 1]) { - // this column is finished - out() << "<td>\n</td>\n"; + for (int i=0; i<classMap.count()-1; i++) { + while ((curParNr < NumParagraphs) && + (curParOffset == paragraph[curParNr].count())) { + ++curParNr; + curParOffset = 0; + } + + /* + Starting a new paragraph means starting a new <dl>. + */ + if (curParOffset == 0) { + if (i > 0) + out() << "</dl>\n"; + if (++numTableRows % 2 == 1) + out() << "<dl class=\"flowList odd\">"; + else + out() << "<dl class=\"flowList even\">"; + out() << "<dt class=\"alphaChar\">"; + if (includeAlphabet) { + QChar c = paragraphName[curParNr][0].toLower(); + out() << QString("<a name=\"%1\"></a>").arg(c); } - else { - while ((currentParagraphNo[i] < NumParagraphs) && - (currentOffsetInParagraph[i] == paragraph[currentParagraphNo[i]].count())) { - ++currentParagraphNo[i]; - currentOffsetInParagraph[i] = 0; - } -#if 0 - if (currentParagraphNo[i] >= NumParagraphs) { - qDebug() << "### Internal error ###" << __FILE__ << __LINE__ - << currentParagraphNo[i] << NumParagraphs; - currentParagraphNo[i] = NumParagraphs - 1; - } -#endif - out() << "<td class=\"rightAlign\">"; - if (currentOffsetInParagraph[i] == 0) { - // start a new paragraph - out() << "<b>" - << paragraphName[currentParagraphNo[i]] - << " </b>"; - } - out() << "</td>\n"; - - out() << "<td>"; - if ((currentParagraphNo[i] < NumParagraphs) && - !paragraphName[currentParagraphNo[i]].isEmpty()) { - NodeMap::Iterator it; - it = paragraph[currentParagraphNo[i]].begin(); - for (j = 0; j < currentOffsetInParagraph[i]; j++) - ++it; - - // Previously, we used generateFullName() for this, but we - // require some special formatting. - out() << "<a href=\"" - << linkForNode(it.value(), relative) - << "\">"; - QStringList pieces; - if (it.value()->subType() == Node::QmlClass) - pieces << it.value()->name(); - else - pieces = fullName(it.value(), relative, marker).split("::"); - out() << protectEnc(pieces.last()); - out() << "</a>"; - if (pieces.size() > 1) { - out() << " ("; - generateFullName(it.value()->parent(), relative, marker); - out() << ")"; - } - } - out() << "</td>\n"; + out() << "<b>" + << paragraphName[curParNr] + << "</b>"; + out() << "</dt>\n"; + } - currentOffset[i]++; - currentOffsetInParagraph[i]++; + /* + Output a <dd> for the current offset in the current paragraph. + */ + out() << "<dd>"; + if ((curParNr < NumParagraphs) && + !paragraphName[curParNr].isEmpty()) { + NodeMap::Iterator it; + it = paragraph[curParNr].begin(); + for (int i=0; i<curParOffset; i++) + ++it; + + /* + Previously, we used generateFullName() for this, but we + require some special formatting. + */ + out() << "<a href=\"" << linkForNode(it.value(), relative) << "\">"; + + QStringList pieces; + if (it.value()->subType() == Node::QmlClass) + pieces << it.value()->name(); + else + pieces = fullName(it.value(), relative, marker).split("::"); + out() << protectEnc(pieces.last()); + out() << "</a>"; + if (pieces.size() > 1) { + out() << " ("; + generateFullName(it.value()->parent(), relative, marker); + out() << ")"; } } - out() << "</tr>\n"; + out() << "</dd>\n"; + curParOffset++; } - out() << "</table>\n"; + out() << "</dl>\n"; + out() << "</div>\n"; } void HtmlGenerator::generateFunctionIndex(const Node *relative, @@ -2646,7 +2684,7 @@ void HtmlGenerator::generateQmlItem(const Node *node, if (summary) marked.replace("@name>", "b>"); - marked.replace("<@extra>", " <tt>"); + marked.replace("<@extra>", "<tt>"); marked.replace("</@extra>", "</tt>"); if (summary) { @@ -2812,14 +2850,14 @@ void HtmlGenerator::generateSection(const NodeList& nl, else { if (twoColumn && i == (int) (nl.count() + 1) / 2) out() << "</ul></td><td class=\"topAlign\"><ul>\n"; - out() << "<li><div class=\"fn\">"; + out() << "<li class=\"fn\">"; } generateSynopsis(*m, relative, marker, style, name_alignment); if (name_alignment) out() << "</td></tr>\n"; else - out() << "</div></li>\n"; + out() << "</li>\n"; i++; ++m; } @@ -2873,14 +2911,14 @@ void HtmlGenerator::generateSectionList(const Section& section, else { if (twoColumn && i == (int) (section.members.count() + 1) / 2) out() << "</ul></td><td class=\"topAlign\"><ul>\n"; - out() << "<li><div class=\"fn\">"; + out() << "<li class=\"fn\">"; } generateSynopsis(*m, relative, marker, style, name_alignment); if (name_alignment) out() << "</td></tr>\n"; else - out() << "</div></li>\n"; + out() << "</li>\n"; i++; ++m; } @@ -2908,9 +2946,9 @@ void HtmlGenerator::generateSectionInheritedList(const Section& section, QList<QPair<ClassNode *, int> >::ConstIterator p = section.inherited.begin(); while (p != section.inherited.end()) { if (nameAlignment) - out() << "<li><div bar=\"2\" class=\"fn\"></div>"; + out() << "<li class=\"fn\">"; else - out() << "<li><div class=\"fn\"></div>"; + out() << "<li class=\"fn\">"; out() << (*p).second << " "; if ((*p).second == 1) { out() << section.singularMember; @@ -2955,7 +2993,7 @@ void HtmlGenerator::generateSynopsis(const Node *node, extraRegExp.setMinimal(true); marked.replace(extraRegExp, ""); } else { - marked.replace("<@extra>", " <tt>"); + marked.replace("<@extra>", "<tt>"); marked.replace("</@extra>", "</tt>"); } @@ -3151,8 +3189,13 @@ void HtmlGenerator::generateSectionList(const Section& section, twoColumn = (section.members.count() >= 5); } if (twoColumn) - out() << "<table class=\"generic\">\n" - << "<tr><td class=\"topAlign\">"; + out() << "<table class=\"generic\">\n"; + if (++numTableRows % 2 == 1) + out() << "<tr class=\"odd topAlign\">"; + else + out() << "<tr class=\"even topAlign\">"; + +// << "<tr><td class=\"topAlign\">"; out() << "<ul>\n"; int i = 0; @@ -3166,7 +3209,7 @@ void HtmlGenerator::generateSectionList(const Section& section, if (twoColumn && i == (int) (section.members.count() + 1) / 2) out() << "</ul></td><td class=\"topAlign\"><ul>\n"; - out() << "<li><div class=\"fn\"></div>"; + out() << "<li class=\"fn\">"; if (style == CodeMarker::Accessors) out() << "<b>"; generateSynopsis(*m, relative, marker, style); @@ -3194,7 +3237,7 @@ void HtmlGenerator::generateSectionInheritedList(const Section& section, { QList<QPair<ClassNode *, int> >::ConstIterator p = section.inherited.begin(); while (p != section.inherited.end()) { - out() << "<li><div bar=\"2\" class=\"fn\"></div>"; + out() << "<li class=\"fn\">"; out() << (*p).second << " "; if ((*p).second == 1) { out() << section.singularMember; @@ -3234,7 +3277,7 @@ void HtmlGenerator::generateSynopsis(const Node *node, extraRegExp.setMinimal(true); marked.replace(extraRegExp, ""); } else { - marked.replace("<@extra>", " <tt>"); + marked.replace("<@extra>", "<tt>"); marked.replace("</@extra>", "</tt>"); } @@ -3764,7 +3807,7 @@ void HtmlGenerator::generateDetailedMember(const Node *node, out() << "<h3 class=\"flags\">"; out() << "<a name=\"" + refForNode(node) + "\"></a>"; generateSynopsis(enume, relative, marker, CodeMarker::Detailed); - out() << "<br />"; + out() << "<br/>"; generateSynopsis(enume->flagsType(), relative, marker, @@ -4031,10 +4074,13 @@ int HtmlGenerator::hOffset(const Node *node) case Node::Class: return 2; case Node::Fake: + return 1; +#if 0 if (node->doc().briefText().isEmpty()) return 1; else return 2; +#endif case Node::Enum: case Node::Typedef: case Node::Function: @@ -4359,8 +4405,12 @@ void HtmlGenerator::generateQmlSummary(const Section& section, twoColumn = (count >= 5); } if (twoColumn) - out() << "<table class=\"qmlsummary\">\n" - << "<tr><td class=\"topAlign\">"; + out() << "<table class=\"qmlsummary\">\n"; + if (++numTableRows % 2 == 1) + out() << "<tr class=\"odd topAlign\">"; + else + out() << "<tr class=\"even topAlign\">"; + // << "<tr><td class=\"topAlign\">"; out() << "<ul>\n"; int row = 0; @@ -4368,7 +4418,7 @@ void HtmlGenerator::generateQmlSummary(const Section& section, while (m != section.members.end()) { if (twoColumn && row == (int) (count + 1) / 2) out() << "</ul></td><td class=\"topAlign\"><ul>\n"; - out() << "<li><div class=\"fn\"></div>"; + out() << "<li class=\"fn\">"; generateQmlItem(*m,relative,marker,true); out() << "</li>\n"; row++; @@ -4402,22 +4452,21 @@ void HtmlGenerator::generateDetailedQmlMember(const Node *node, while (p != qpgn->childNodes().end()) { if ((*p)->type() == Node::QmlProperty) { qpn = static_cast<const QmlPropertyNode*>(*p); - out() << "<tr><td>"; + + if (++numTableRows % 2 == 1) + out() << "<tr class=\"odd\">"; + else + out() << "<tr class=\"even\">"; + + out() << "<td><p>"; + //out() << "<tr><td>"; // old out() << "<a name=\"" + refForNode(qpn) + "\"></a>"; 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>"; + out() << "<span class=\"qmldefault\">default</span>"; generateQmlItem(qpn, relative, marker, false); out() << "</td></tr>"; - if (qpgn->isDefault()) { - out() << "</table>" - << "</div></div>" - << "<div class=\"qmlitem\">" - << "<div class=\"qmlproto\">" - << "<table class=\"qmlname\">" - << "<tr><td>default</td></tr>"; - } } ++p; } @@ -4428,11 +4477,16 @@ void HtmlGenerator::generateDetailedQmlMember(const Node *node, const FunctionNode* qsn = static_cast<const FunctionNode*>(node); out() << "<div class=\"qmlproto\">"; out() << "<table class=\"qmlname\">"; - out() << "<tr><td>"; + //out() << "<tr>"; + if (++numTableRows % 2 == 1) + out() << "<tr class=\"odd\">"; + else + out() << "<tr class=\"even\">"; + out() << "<td><p>"; out() << "<a name=\"" + refForNode(qsn) + "\"></a>"; generateSynopsis(qsn,relative,marker,CodeMarker::Detailed,false); //generateQmlItem(qsn,relative,marker,false); - out() << "</td></tr>"; + out() << "</p></td></tr>"; out() << "</table>"; out() << "</div>"; } @@ -4440,10 +4494,15 @@ void HtmlGenerator::generateDetailedQmlMember(const Node *node, const FunctionNode* qmn = static_cast<const FunctionNode*>(node); out() << "<div class=\"qmlproto\">"; out() << "<table class=\"qmlname\">"; - out() << "<tr><td>"; + //out() << "<tr>"; + if (++numTableRows % 2 == 1) + out() << "<tr class=\"odd\">"; + else + out() << "<tr class=\"even\">"; + out() << "<td><p>"; out() << "<a name=\"" + refForNode(qmn) + "\"></a>"; generateSynopsis(qmn,relative,marker,CodeMarker::Detailed,false); - out() << "</td></tr>"; + out() << "</p></td></tr>"; out() << "</table>"; out() << "</div>"; } diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index d80cbdb5ad..e06025739c 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -173,6 +173,7 @@ class HtmlGenerator : public PageGenerator void generateCompactList(const Node *relative, CodeMarker *marker, const NodeMap &classMap, + bool includeAlphabet, QString commonPrefix = QString()); void generateFunctionIndex(const Node *relative, CodeMarker *marker); void generateLegaleseList(const Node *relative, CodeMarker *marker); diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp index fe4ad863e3..616ae2f8af 100644 --- a/tools/qdoc3/main.cpp +++ b/tools/qdoc3/main.cpp @@ -68,6 +68,7 @@ #include "qscodeparser.h" #include "sgmlgenerator.h" #include "webxmlgenerator.h" +#include "ditaxmlgenerator.h" #include "tokenizer.h" #include "tree.h" #include <qdebug.h> @@ -427,6 +428,7 @@ int main(int argc, char **argv) ManGenerator manGenerator; SgmlGenerator smglGenerator; WebXMLGenerator webxmlGenerator; + DitaXmlGenerator ditaxmlGenerator; QStringList qdocFiles; QString opt; diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index a2bd948e5b..b71a43ee34 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -154,6 +154,41 @@ void Node::setLink(LinkType linkType, const QString &link, const QString &desc) } /*! + Returns a string representing the access specifier. + */ +QString Node::accessString() const +{ + switch (acc) { + case Protected: + return "protected"; + case Private: + return "private"; + case Public: + default: + break; + } + return "public"; +} + + +/*! + Returns a string representing the access specifier. + */ +QString RelatedClass::accessString() const +{ + switch (access) { + case Node::Protected: + return "protected"; + case Node::Private: + return "private"; + case Node::Public: + default: + break; + } + return "public"; +} + +/*! */ Node::Status Node::inheritedStatus() const { @@ -624,7 +659,7 @@ void InnerNode::removeChild(Node *child) QMap<QString, Node *>::Iterator prim = primaryFunctionMap.find(child->name()); NodeList& secs = secondaryFunctionMap[child->name()]; - if (*prim == child) { + if (prim != primaryFunctionMap.end() && *prim == child) { if (secs.isEmpty()) { primaryFunctionMap.remove(child->name()); } @@ -636,12 +671,12 @@ void InnerNode::removeChild(Node *child) secs.removeAll(child); } QMap<QString, Node *>::Iterator ent = childMap.find( child->name() ); - if ( *ent == child ) + if (ent != childMap.end() && *ent == child) childMap.erase( ent ); } else { QMap<QString, Node *>::Iterator ent = childMap.find(child->name()); - if (*ent == child) + if (ent != childMap.end() && *ent == child) childMap.erase(ent); } } @@ -754,6 +789,7 @@ ClassNode::ClassNode(InnerNode *parent, const QString& name) : InnerNode(Class, parent, name) { hidden = false; + abstract = false; setPageType(ApiPage); } @@ -1043,6 +1079,19 @@ FunctionNode::FunctionNode(Type type, InnerNode *parent, const QString& name, bo } /*! + Sets the \a virtualness of this function. If the \a virtualness + is PureVirtual, and if the parent() is a ClassNode, set the parent's + \e abstract flag to true. + */ +void FunctionNode::setVirtualness(Virtualness virtualness) +{ + vir = virtualness; + if ((virtualness == PureVirtual) && parent() && + (parent()->type() == Node::Class)) + parent()->setAbstract(true); +} + +/*! */ void FunctionNode::setOverload(bool overlode) { @@ -1289,7 +1338,7 @@ QmlClassNode::QmlClassNode(InnerNode *parent, const ClassNode* cn) : FakeNode(parent, name, QmlClass), cnode(cn) { - setTitle((qmlOnly ? "" : "QML ") + name + " Element Reference"); + setTitle((qmlOnly ? "" : "QML ") + name + " Element"); } /*! diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index 215a7ae3a6..ccfd9b6232 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -175,6 +175,7 @@ class Node virtual QString nameForLists() const { return nam; } Access access() const { return acc; } + QString accessString() const; const Location& location() const { return loc; } const Doc& doc() const { return d; } Status status() const { return sta; } @@ -260,6 +261,8 @@ class InnerNode : public Node QStringList secondaryKeys(); const QStringList& pageKeywords() const { return pageKeywds; } virtual void addPageKeywords(const QString& t) { pageKeywds << t; } + virtual bool isAbstract() const { return false; } + virtual void setAbstract(bool ) { } protected: InnerNode(Type type, InnerNode *parent, const QString& name); @@ -312,6 +315,7 @@ struct RelatedClass : access(access0), node(node0), dataTypeWithTemplateArgs(dataTypeWithTemplateArgs0) { } + QString accessString() const; Node::Access access; ClassNode* node; @@ -339,11 +343,14 @@ class ClassNode : public InnerNode void setServiceName(const QString& value) { sname = value; } QString qmlElement() const { return qmlelement; } void setQmlElement(const QString& value) { qmlelement = value; } + virtual bool isAbstract() const { return abstract; } + virtual void setAbstract(bool b) { abstract = b; } private: QList<RelatedClass> bas; QList<RelatedClass> der; bool hidden; + bool abstract; QString sname; QString qmlelement; }; @@ -580,7 +587,7 @@ class FunctionNode : public LeafNode void setReturnType(const QString& returnType) { rt = returnType; } void setParentPath(const QStringList& parentPath) { pp = parentPath; } void setMetaness(Metaness metaness) { met = metaness; } - void setVirtualness(Virtualness virtualness) { vir = virtualness; } + void setVirtualness(Virtualness virtualness); void setConst(bool conste) { con = conste; } void setStatic(bool statique) { sta = statique; } void setOverload(bool overlode); diff --git a/tools/qdoc3/pagegenerator.cpp b/tools/qdoc3/pagegenerator.cpp index f0f14fedcd..cd364ef219 100644 --- a/tools/qdoc3/pagegenerator.cpp +++ b/tools/qdoc3/pagegenerator.cpp @@ -45,7 +45,7 @@ #include <qfile.h> #include <qfileinfo.h> - +#include <qdebug.h> #include "pagegenerator.h" #include "tree.h" @@ -68,6 +68,110 @@ PageGenerator::~PageGenerator() endSubPage(); } +static QRegExp linkTag("(<@link node=\"([^\"]+)\">).*(</@link>)"); +static QRegExp funcTag("(<@func target=\"([^\"]*)\">)(.*)(</@func>)"); +static QRegExp typeTag("(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)(</@\\2>)"); +static QRegExp spanTag("</@(?:comment|preprocessor|string|char)>"); +static QRegExp unknownTag("</?@[^>]*>"); + +bool PageGenerator::parseArg(const QString& src, + const QString& tag, + int* pos, + int n, + QStringRef* contents, + QStringRef* par1, + bool debug) +{ +#define SKIP_CHAR(c) \ + if (debug) \ + qDebug() << "looking for " << c << " at " << QString(src.data() + i, n - i); \ + if (i >= n || src[i] != c) { \ + if (debug) \ + qDebug() << " char '" << c << "' not found"; \ + return false; \ + } \ + ++i; + + +#define SKIP_SPACE \ + while (i < n && src[i] == ' ') \ + ++i; + + int i = *pos; + int j = i; + + // assume "<@" has been parsed outside + //SKIP_CHAR('<'); + //SKIP_CHAR('@'); + + if (tag != QStringRef(&src, i, tag.length())) { + if (0 && debug) + qDebug() << "tag " << tag << " not found at " << i; + return false; + } + + if (debug) + qDebug() << "haystack:" << src << "needle:" << tag << "i:" <<i; + + // skip tag + i += tag.length(); + + // parse stuff like: linkTag("(<@link node=\"([^\"]+)\">).*(</@link>)"); + if (par1) { + SKIP_SPACE; + // read parameter name + j = i; + while (i < n && src[i].isLetter()) + ++i; + if (src[i] == '=') { + if (debug) + qDebug() << "read parameter" << QString(src.data() + j, i - j); + SKIP_CHAR('='); + SKIP_CHAR('"'); + // skip parameter name + j = i; + while (i < n && src[i] != '"') + ++i; + *par1 = QStringRef(&src, j, i - j); + SKIP_CHAR('"'); + SKIP_SPACE; + } else { + if (debug) + qDebug() << "no optional parameter found"; + } + } + SKIP_SPACE; + SKIP_CHAR('>'); + + // find contents up to closing "</@tag> + j = i; + for (; true; ++i) { + if (i + 4 + tag.length() > n) + return false; + if (src[i] != '<') + continue; + if (src[i + 1] != '/') + continue; + if (src[i + 2] != '@') + continue; + if (tag != QStringRef(&src, i + 3, tag.length())) + continue; + if (src[i + 3 + tag.length()] != '>') + continue; + break; + } + + *contents = QStringRef(&src, j, i - j); + + i += tag.length() + 4; + + *pos = i; + if (debug) + qDebug() << " tag " << tag << " found: pos now: " << i; + return true; +#undef SKIP_CHAR +} + /*! This function is recursive. */ @@ -195,8 +299,8 @@ QTextStream &PageGenerator::out() /*! Recursive writing of html files from the root \a node. */ -void PageGenerator::generateInnerNode(const InnerNode *node, - CodeMarker *marker) +void +PageGenerator::generateInnerNode(const InnerNode* node, CodeMarker* marker) { if (!node->url().isNull()) return; diff --git a/tools/qdoc3/pagegenerator.h b/tools/qdoc3/pagegenerator.h index 7ab7e5e846..1aa24a1d1c 100644 --- a/tools/qdoc3/pagegenerator.h +++ b/tools/qdoc3/pagegenerator.h @@ -80,10 +80,17 @@ class PageGenerator : public Generator QString naturalLanguage; QString outputEncoding; - QTextCodec *outputCodec; + QTextCodec* outputCodec; + bool parseArg(const QString& src, + const QString& tag, + int* pos, + int n, + QStringRef* contents, + QStringRef* par1 = 0, + bool debug = false); private: - QStack<QTextStream *> outStreamStack; + QStack<QTextStream*> outStreamStack; }; QT_END_NAMESPACE diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index e394799380..5bedc29877 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -37,6 +37,7 @@ HEADERS += apigenerator.h \ cppcodeparser.h \ cpptoqsconverter.h \ dcfsection.h \ + ditaxmlgenerator.h \ doc.h \ editdistance.h \ generator.h \ @@ -81,6 +82,7 @@ SOURCES += apigenerator.cpp \ cppcodeparser.cpp \ cpptoqsconverter.cpp \ dcfsection.cpp \ + ditaxmlgenerator.cpp \ doc.cpp \ editdistance.cpp \ generator.cpp \ @@ -115,20 +117,7 @@ SOURCES += apigenerator.cpp \ ### Documentation for qdoc3 ### -win32:!win32-g++ { - unixstyle = false -} else :win32-g++:isEmpty(QMAKE_SH) { - unixstyle = false -} else { - unixstyle = true -} - -$$unixstyle { - QDOC = cd $$PWD/doc && $$[QT_INSTALL_BINS]/qdoc3 -} else { - QDOC = cd $$PWD/doc && $$[QT_INSTALL_BINS]/qdoc3.exe - QDOC = $$replace(QDOC, "/", "\\") -} +qtPrepareTool(QDOC, qdoc3) docs.commands = $$QDOC qdoc-manual.qdocconf diff --git a/tools/qdoc3/test/assistant.qdocconf b/tools/qdoc3/test/assistant.qdocconf index 1deefce931..4b52992cc1 100644 --- a/tools/qdoc3/test/assistant.qdocconf +++ b/tools/qdoc3/test/assistant.qdocconf @@ -16,45 +16,34 @@ 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 = images/api_examples.png \ - images/api_lookup.png \ - images/api_topics.png \ +qhp.Assistant.extraFiles = images/bg_l.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/box_bg.png \ + images/breadcrumb.png \ + images/bullet_gt.png \ images/bullet_dn.png \ - images/bullet_gt.png \ - images/bullet_sq.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/page.png \ + images/page_bg.png \ + images/sprites-combined.png \ + images/arrow-down.png \ + images/spinner.gif \ images/stylesheet-coffee-plastique.png \ images/taskmenuextension-example.png \ - scripts/functions.js \ - scripts/jquery.js \ + images/coloreditorfactoryimage.png \ + images/dynamiclayouts-example.png \ + scripts/functions.js \ + scripts/jquery.js \ + style/OfflineStyle.css \ + style/style_ie6.css \ + style/style_ie7.css \ + style/style_ie8.css \ 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 513801a4ab..b1f37dc5ed 100644 --- a/tools/qdoc3/test/designer.qdocconf +++ b/tools/qdoc3/test/designer.qdocconf @@ -16,45 +16,34 @@ 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 = 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 \ +qhp.Designer.extraFiles = images/bg_l.png \ + images/bg_l_blank.png \ + images/bg_r.png \ + images/box_bg.png \ + images/breadcrumb.png \ + images/bullet_gt.png \ + images/bullet_dn.png \ + images/bullet_sq.png \ + images/bullet_up.png \ + images/feedbackground.png \ + images/horBar.png \ + images/page.png \ + images/page_bg.png \ + images/sprites-combined.png \ + images/arrow-down.png \ + images/spinner.gif \ + images/stylesheet-coffee-plastique.png \ + images/taskmenuextension-example.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 + scripts/functions.js \ + scripts/jquery.js \ + style/OfflineStyle.css \ + style/style_ie6.css \ + style/style_ie7.css \ + style/style_ie8.css \ + 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/images/bg_l.png b/tools/qdoc3/test/images/bg_l.png Binary files differnew file mode 100644 index 0000000000..90b1da10b9 --- /dev/null +++ b/tools/qdoc3/test/images/bg_l.png diff --git a/tools/qdoc3/test/images/bg_l_blank.png b/tools/qdoc3/test/images/bg_l_blank.png Binary files differnew file mode 100644 index 0000000000..5a9673d81b --- /dev/null +++ b/tools/qdoc3/test/images/bg_l_blank.png diff --git a/tools/qdoc3/test/images/bg_r.png b/tools/qdoc3/test/images/bg_r.png Binary files differnew file mode 100644 index 0000000000..f0fb121dea --- /dev/null +++ b/tools/qdoc3/test/images/bg_r.png diff --git a/tools/qdoc3/test/images/box_bg.png b/tools/qdoc3/test/images/box_bg.png Binary files differnew file mode 100644 index 0000000000..3322f923f8 --- /dev/null +++ b/tools/qdoc3/test/images/box_bg.png diff --git a/tools/qdoc3/test/images/breadcrumb.png b/tools/qdoc3/test/images/breadcrumb.png Binary files differnew file mode 100644 index 0000000000..0ded5514d2 --- /dev/null +++ b/tools/qdoc3/test/images/breadcrumb.png diff --git a/tools/qdoc3/test/images/bullet_dn.png b/tools/qdoc3/test/images/bullet_dn.png Binary files differnew file mode 100644 index 0000000000..f7762472e2 --- /dev/null +++ b/tools/qdoc3/test/images/bullet_dn.png diff --git a/tools/qdoc3/test/images/bullet_gt.png b/tools/qdoc3/test/images/bullet_gt.png Binary files differnew file mode 100644 index 0000000000..7561b4edc4 --- /dev/null +++ b/tools/qdoc3/test/images/bullet_gt.png diff --git a/tools/qdoc3/test/images/bullet_sq.png b/tools/qdoc3/test/images/bullet_sq.png Binary files differnew file mode 100644 index 0000000000..a84845e3c7 --- /dev/null +++ b/tools/qdoc3/test/images/bullet_sq.png diff --git a/tools/qdoc3/test/images/bullet_up.png b/tools/qdoc3/test/images/bullet_up.png Binary files differnew file mode 100644 index 0000000000..285e7411b4 --- /dev/null +++ b/tools/qdoc3/test/images/bullet_up.png diff --git a/tools/qdoc3/test/images/feedbackground.png b/tools/qdoc3/test/images/feedbackground.png Binary files differnew file mode 100644 index 0000000000..3a38d995d7 --- /dev/null +++ b/tools/qdoc3/test/images/feedbackground.png diff --git a/tools/qdoc3/test/images/horBar.png b/tools/qdoc3/test/images/horBar.png Binary files differnew file mode 100644 index 0000000000..100fe91c6c --- /dev/null +++ b/tools/qdoc3/test/images/horBar.png diff --git a/tools/qdoc3/test/images/page.png b/tools/qdoc3/test/images/page.png Binary files differnew file mode 100644 index 0000000000..1db151bd31 --- /dev/null +++ b/tools/qdoc3/test/images/page.png diff --git a/tools/qdoc3/test/images/page_bg.png b/tools/qdoc3/test/images/page_bg.png Binary files differnew file mode 100644 index 0000000000..9b3bd999df --- /dev/null +++ b/tools/qdoc3/test/images/page_bg.png diff --git a/tools/qdoc3/test/images/sprites-combined.png b/tools/qdoc3/test/images/sprites-combined.png Binary files differnew file mode 100644 index 0000000000..3a48b21f6b --- /dev/null +++ b/tools/qdoc3/test/images/sprites-combined.png diff --git a/tools/qdoc3/test/linguist.qdocconf b/tools/qdoc3/test/linguist.qdocconf index a3f4f00b11..26fb55c9b6 100644 --- a/tools/qdoc3/test/linguist.qdocconf +++ b/tools/qdoc3/test/linguist.qdocconf @@ -16,45 +16,34 @@ 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 = 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 \ +qhp.Linguist.extraFiles = images/bg_l.png \ + images/bg_l_blank.png \ + images/bg_r.png \ + images/box_bg.png \ + images/breadcrumb.png \ + images/bullet_gt.png \ + images/bullet_dn.png \ + images/bullet_sq.png \ + images/bullet_up.png \ + images/feedbackground.png \ + images/horBar.png \ + images/page.png \ + images/page_bg.png \ + images/sprites-combined.png \ + images/arrow-down.png \ +s images/spinner.gif \ + images/stylesheet-coffee-plastique.png \ + images/taskmenuextension-example.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 + scripts/functions.js \ + scripts/jquery.js \ + style/OfflineStyle.css \ + style/style_ie6.css \ + style/style_ie7.css \ + style/style_ie8.css \ + 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/macros.qdocconf b/tools/qdoc3/test/macros.qdocconf index 22db23efb8..510a8b346a 100644 --- a/tools/qdoc3/test/macros.qdocconf +++ b/tools/qdoc3/test/macros.qdocconf @@ -18,6 +18,7 @@ macro.ouml.HTML = "ö" macro.QA = "\\e{Qt Assistant}" macro.QD = "\\e{Qt Designer}" macro.QL = "\\e{Qt Linguist}" +macro.QQV = "\\e{Qt QML Viewer}" macro.param = "\\e" macro.raisedaster.HTML = "<sup>*</sup>" macro.rarrow.HTML = "→" diff --git a/tools/qdoc3/test/qdeclarative.qdocconf b/tools/qdoc3/test/qdeclarative.qdocconf index 80050e3f0d..74fd802c48 100644 --- a/tools/qdoc3/test/qdeclarative.qdocconf +++ b/tools/qdoc3/test/qdeclarative.qdocconf @@ -27,45 +27,33 @@ qhp.Qml.indexTitle = Qml Reference # Files not referenced in any qdoc file # See also extraimages.HTML -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.extraFiles = images/bg_l.png \ + images/bg_l_blank.png \ + images/bg_r.png \ + images/box_bg.png \ + images/breadcrumb.png \ + images/bullet_gt.png \ + images/bullet_dn.png \ + images/bullet_sq.png \ + images/bullet_up.png \ + images/feedbackground.png \ + images/horBar.png \ + images/page.png \ + images/page_bg.png \ + images/sprites-combined.png \ + images/arrow-down.png \ + images/spinner.png \ + images/stylesheet-coffee-plastique.png \ + images/taskmenuextension-example.png \ + images/coloreditorfactoryimage.png \ + images/dynamiclayouts-example.png \ + scripts/functions.js \ + scripts/jquery.js \ + style/OfflineStyle.css \ + style/style_ie6.css \ + style/style_ie7.css \ + style/style_ie8.css \ + style/style.css qhp.Qml.filterAttributes = qt 4.6.0 qtrefdoc qhp.Qml.customFilters.Qt.name = Qt 4.6.0 diff --git a/tools/qdoc3/test/qmake.qdocconf b/tools/qdoc3/test/qmake.qdocconf index f38a2a44d3..f06912962d 100644 --- a/tools/qdoc3/test/qmake.qdocconf +++ b/tools/qdoc3/test/qmake.qdocconf @@ -16,45 +16,34 @@ qhp.qmake.file = qmake.qhp qhp.qmake.namespace = com.trolltech.qmake.470 qhp.qmake.virtualFolder = qdoc qhp.qmake.indexTitle = QMake Manual -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.extraFiles = images/bg_l.png \ + images/bg_l_blank.png \ + images/bg_r.png \ + images/box_bg.png \ + images/breadcrumb.png \ + images/bullet_gt.png \ + images/bullet_dn.png \ + images/bullet_sq.png \ + images/bullet_up.png \ + images/feedbackground.png \ + images/horBar.png \ + images/page.png \ + images/page_bg.png \ + images/sprites-combined.png \ + images/arrow-down.png \ + images/spinner.gif \ + images/stylesheet-coffee-plastique.png \ + images/taskmenuextension-example.png \ + images/coloreditorfactoryimage.png \ + images/dynamiclayouts-example.png \ + scripts/functions.js \ + scripts/jquery.js \ + style/OfflineStyle.css \ + style/style_ie6.css \ + style/style_ie7.css \ + style/style_ie8.css \ + 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-api-only_ja_JP.qdocconf b/tools/qdoc3/test/qt-api-only_ja_JP.qdocconf new file mode 100644 index 0000000000..aa3ab0177b --- /dev/null +++ b/tools/qdoc3/test/qt-api-only_ja_JP.qdocconf @@ -0,0 +1,30 @@ +include(qt-build-docs_ja_JP.qdocconf) + +# Ensures that the generated index contains a URL that can be used by the +# tools documentation (assistant.qdocconf, designer.qdocconf, linguist.qdocconf, +# qmake.qdocconf). + +url = ./ + +# Ensures that the documentation for the tools is not included in the generated +# .qhp file. + +qhp.Qt.excluded += $QT_SOURCE_TREE/doc/src/development/assistant-manual.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/simpletextviewer.qdoc \ + $QT_SOURCE_TREE/doc/src/development/designer-manual.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/calculatorbuilder.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/calculatorform.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/customwidgetplugin.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/taskmenuextension.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/containerextension.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/worldtimeclockbuilder.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/worldtimeclockplugin.qdoc \ + $QT_SOURCE_TREE/doc/src/internationalization/linguist-manual.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/hellotr.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/arrowpad.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/trollprint.qdoc \ + $QT_SOURCE_TREE/doc/src/development/qmake-manual.qdoc + +outputdir = $QT_BUILD_TREE/doc-build/html-qt_ja_JP +tagfile = $QT_BUILD_TREE/doc-build/html-qt_ja_JP/qt.tags +base = file:$QT_BUILD_TREE/doc-build/html-qt_ja_JP diff --git a/tools/qdoc3/test/qt-build-docs.qdocconf b/tools/qdoc3/test/qt-build-docs.qdocconf index 0694748aba..216ac6ae3e 100644 --- a/tools/qdoc3/test/qt-build-docs.qdocconf +++ b/tools/qdoc3/test/qt-build-docs.qdocconf @@ -22,45 +22,33 @@ 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 \ - 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 + images/bg_l.png \ + images/bg_l_blank.png \ + images/bg_r.png \ + images/box_bg.png \ + images/breadcrumb.png \ + images/bullet_gt.png \ + images/bullet_dn.png \ + images/bullet_sq.png \ + images/bullet_up.png \ + images/feedbackground.png \ + images/horBar.png \ + images/page.png \ + images/page_bg.png \ + images/sprites-combined.png \ + images/arrow-down.png \ + images/spinner.gif \ + images/stylesheet-coffee-plastique.png \ + images/taskmenuextension-example.png \ + images/coloreditorfactoryimage.png \ + images/dynamiclayouts-example.png \ + scripts/functions.js \ + scripts/jquery.js \ + style/OfflineStyle.css \ + style/style_ie6.css \ + style/style_ie7.css \ + style/style_ie8.css \ + style/style.css @@ -127,6 +115,7 @@ excludedirs = $QT_SOURCE_TREE/src/3rdparty/clucene \ $QT_SOURCE_TREE/src/3rdparty/phonon/mmf \ $QT_SOURCE_TREE/src/3rdparty/phonon/waveout \ $QT_SOURCE_TREE/doc/src/snippets \ + $QT_SOURCE_TREE/doc/src/ja_JP \ $QT_SOURCE_TREE/doc/src/zh_CN sources.fileextensions = "*.cpp *.qdoc *.mm" diff --git a/tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf b/tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf new file mode 100644 index 0000000000..e517b334c3 --- /dev/null +++ b/tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf @@ -0,0 +1,110 @@ +include(compat.qdocconf) +include(macros.qdocconf) +include(qt-cpp-ignore.qdocconf) +include(qt-html-templates_ja_JP.qdocconf) +include(qt-defines.qdocconf) + +project = Qt +description = Qt リファレンスドキュメント +url = http://qt.nokia.com/doc/ja_JP/4.7 + +sourceencoding = UTF-8 +outputencoding = UTF-8 +naturallanguage = ja + +indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index + +qhp.projects = Qt + +qhp.Qt.file = qt.qhp +qhp.Qt.namespace = com.trolltech.qt.470 +qhp.Qt.virtualFolder = qdoc +qhp.Qt.title = Qt +qhp.Qt.indexTitle = Qt +qhp.Qt.selectors = fake:example + +qhp.Qt.filterAttributes = qt 4.7.0 qtrefdoc ja_JP +qhp.Qt.customFilters.Qt.name = Qt 4.7.0 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.0 + +# Files not referenced in any qdoc file (last four are needed by qtdemo) +# See also extraimages.HTML +qhp.Qt.extraFiles = index.html \ + images/bg_l.png \ + images/bg_l_blank.png \ + images/bg_r.png \ + images/box_bg.png \ + images/breadcrumb.png \ + images/bullet_gt.png \ + images/bullet_dn.png \ + images/bullet_sq.png \ + images/bullet_up.png \ + images/feedbackground.png \ + images/horBar.png \ + images/page.png \ + images/page_bg.png \ + images/sprites-combined.png \ + images/arrow-down.png \ + images/spinner.gif \ + images/stylesheet-coffee-plastique.png \ + images/taskmenuextension-example.png \ + images/coloreditorfactoryimage.png \ + images/dynamiclayouts-example.png \ + scripts/functions.js \ + scripts/jquery.js \ + style/OfflineStyle.css \ + style/style_ie6.css \ + style/style_ie7.css \ + style/style_ie8.css \ + style/style.css + +language = Cpp + +sourcedirs = $QT_SOURCE_TREE/doc/src/ja_JP + +excludedirs = $QT_SOURCE_TREE/src/3rdparty/clucene \ + $QT_SOURCE_TREE/src/3rdparty/des \ + $QT_SOURCE_TREE/src/3rdparty/freetype \ + $QT_SOURCE_TREE/src/3rdparty/harfbuzz \ + $QT_SOURCE_TREE/src/3rdparty/kdebase \ + $QT_SOURCE_TREE/src/3rdparty/libjpeg \ + $QT_SOURCE_TREE/src/3rdparty/libmng \ + $QT_SOURCE_TREE/src/3rdparty/libpng \ + $QT_SOURCE_TREE/src/3rdparty/libtiff \ + $QT_SOURCE_TREE/src/3rdparty/md4 \ + $QT_SOURCE_TREE/src/3rdparty/md5 \ + $QT_SOURCE_TREE/src/3rdparty/patches \ + $QT_SOURCE_TREE/src/3rdparty/sha1 \ + $QT_SOURCE_TREE/src/3rdparty/sqlite \ + $QT_SOURCE_TREE/src/3rdparty/webkit/JavaScriptCore \ + $QT_SOURCE_TREE/src/3rdparty/webkit/WebCore \ + $QT_SOURCE_TREE/src/3rdparty/wintab \ + $QT_SOURCE_TREE/src/3rdparty/zlib \ + $QT_SOURCE_TREE/doc/src/snippets \ + $QT_SOURCE_TREE/doc/src/zh_CN \ + $QT_SOURCE_TREE/src/3rdparty/phonon/gstreamer \ + $QT_SOURCE_TREE/src/3rdparty/phonon/ds9 \ + $QT_SOURCE_TREE/src/3rdparty/phonon/qt7 \ + $QT_SOURCE_TREE/src/3rdparty/phonon/mmf \ + $QT_SOURCE_TREE/src/3rdparty/phonon/waveout + +sources.fileextensions = "*.cpp *.qdoc *.mm" +examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp" +examples.imageextensions = "*.png" + +exampledirs = $QT_SOURCE_TREE/doc/src \ + $QT_SOURCE_TREE/examples/ja_JP \ + $QT_SOURCE_TREE/examples \ + $QT_SOURCE_TREE/examples/tutorials \ + $QT_SOURCE_TREE \ + $QT_SOURCE_TREE/qmake/examples \ + $QT_SOURCE_TREE/src/3rdparty/webkit/WebKit/qt/docs +imagedirs = $QT_SOURCE_TREE/doc/src/ja_JP/images \ + $QT_SOURCE_TREE/doc/src/images \ + $QT_SOURCE_TREE/examples \ + $QT_SOURCE_TREE/doc/src/template/images +outputdir = $QT_BUILD_TREE/doc/html_ja_JP +tagfile = $QT_BUILD_TREE/doc/html_ja_JP/qt.tags +base = file:$QT_BUILD_TREE/doc/html_ja_JP + +HTML.generatemacrefs = "true" diff --git a/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf b/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf index 5a3d726952..909a2d4a57 100644 --- a/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf +++ b/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf @@ -30,44 +30,31 @@ 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 \ - 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_l_blank.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/box_bg.png \ images/breadcrumb.png \ - images/bullet_dn.png \ images/bullet_gt.png \ + images/bullet_dn.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.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/arrow-down.png \ + images/spinner.gif \ images/stylesheet-coffee-plastique.png \ images/taskmenuextension-example.png \ - scripts/functions.js \ - scripts/jquery.js \ + images/coloreditorfactoryimage.png \ + images/dynamiclayouts-example.png \ + scripts/functions.js \ + scripts/jquery.js \ + style/style_ie6.css \ + style/style_ie7.css \ + style/style_ie8.css \ style/style.css language = Cpp @@ -93,6 +80,7 @@ excludedirs = $QT_SOURCE_TREE/src/3rdparty/clucene \ $QT_SOURCE_TREE/src/3rdparty/wintab \ $QT_SOURCE_TREE/src/3rdparty/zlib \ $QT_SOURCE_TREE/doc/src/snippets \ + $QT_SOURCE_TREE/doc/src/ja_JP \ $QT_SOURCE_TREE/src/3rdparty/phonon/gstreamer \ $QT_SOURCE_TREE/src/3rdparty/phonon/ds9 \ $QT_SOURCE_TREE/src/3rdparty/phonon/qt7 \ diff --git a/tools/qdoc3/test/qt-defines.qdocconf b/tools/qdoc3/test/qt-defines.qdocconf index 0426f4d5d6..9e41d93001 100644 --- a/tools/qdoc3/test/qt-defines.qdocconf +++ b/tools/qdoc3/test/qt-defines.qdocconf @@ -20,50 +20,49 @@ codeindent = 1 # See also qhp.Qt.extraFiles extraimages.HTML = qt-logo \ trolltech-logo \ - api_examples.png \ - bg_ll.png \ - bg_ul_blank.png \ - bullet_gt.png \ - horBar.png \ - qt_ref_doc.png \ - api_lookup.png \ - bg_ll_blank.png \ - bg_ur.png \ - bullet_sq.png \ - bullet_dn.png \ - bullet_up.png \ - page_bg.png \ - qt_tools.png \ - api_topics.png \ - bg_lr.png \ - bg_ur_blank.png \ - content_bg.png \ - print.png \ - sep.png \ - bg_l.png \ - bg_r.png \ - box_bg.png \ - feedbackground.png \ - qt_guide.png \ - sprites-combined.png \ - bg_l_blank.png \ - bg_ul.png \ - breadcrumb.png \ - form_bg.png \ - qt_icon.png \ - taskmenuextension-example.png \ - coloreditorfactoryimage.png \ - dynamiclayouts-example.png \ - stylesheet-coffee-plastique.png + bg_l.png \ + bg_l_blank.png \ + bg_ll_blank.png \ + bg_ul_blank.png \ + header_bg.png \ + bg_r.png \ + box_bg.png \ + breadcrumb.png \ + bullet_gt.png \ + bullet_dn.png \ + bullet_sq.png \ + bullet_up.png \ + arrow_down.png \ + feedbackground.png \ + horBar.png \ + page.png \ + page_bg.png \ + sprites-combined.png \ + spinner.gif \ + stylesheet-coffee-plastique.png \ + taskmenuextension-example.png \ + coloreditorfactoryimage.png \ + dynamiclayouts-example.png \ # This stuff is used by the new doc format. scriptdirs = $QT_SOURCE_TREE/doc/src/template/scripts styledirs = $QT_SOURCE_TREE/doc/src/template/style scripts.HTML = functions.js \ + shBrushCpp.js \ + shCore.js \ + shLegacy.js \ + narrow.js \ + superfish.js \ jquery.js styles.HTML = style.css \ + shCore.css \ + shThemeDefault.css \ + narrow.css \ + superfish.css \ + superfish_skin.css \ + OfflineStyle.css \ style_ie6.css \ style_ie7.css \ style_ie8.css diff --git a/tools/qdoc3/test/qt-ditaxml.qdocconf b/tools/qdoc3/test/qt-ditaxml.qdocconf new file mode 100644 index 0000000000..66f30e30e2 --- /dev/null +++ b/tools/qdoc3/test/qt-ditaxml.qdocconf @@ -0,0 +1,11 @@ +include(qt.qdocconf) + +imagedirs = $QTDIR/doc/src/images \ + $QTDIR/examples \ + $QTDIR/doc/src/template/images + +outputdir = $QTDIR/doc/ditaxml +outputformats = DITAXML + +generateindex = true +url = . diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index 85a29c2226..60f5fb1324 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -1,8 +1,19 @@ -HTML.stylesheets = style/style.css +HTML.stylesheets = style/style.css \ + style/OfflineStyle.css \ + style/style_ie7.css \ + style/style_ie8.css \ + style/style_ie6.css + HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \ + " <div class=\"content\"> \n" \ " <div id=\"nav-logo\">\n" \ " <a href=\"index.html\">Home</a></div>\n" \ " <a href=\"index.html\" class=\"qtref\"><span>Qt Reference Documentation</span></a>\n" \ + " <div id=\"narrowsearch\"><form onsubmit=\"return false;\" action=\"\" id=\"qtdocsearch\">\n" \ + " <fieldset>\n" \ + " <input type=\"text\" value=\"\" id=\"pageType\" name=\"searchstring\">\n" \ + " </fieldset>\n" \ + " </form></div>\n" \ " <div id=\"nav-topright\">\n" \ " <ul>\n" \ " <li class=\"nav-topright-home\"><a href=\"http://qt.nokia.com/\">Qt HOME</a></li>\n" \ @@ -17,9 +28,39 @@ HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \ " <div id=\"shortCut\">\n" \ " <ul>\n" \ " <li class=\"shortCut-topleft-inactive\"><span><a href=\"index.html\">Qt 4.7</a></span></li>\n" \ - " <li class=\"shortCut-topleft-active\"><a href=\"http://qt.nokia.com/doc/\">ALL Qt VERSIONS" \ + " <li class=\"shortCut-topleft-active\"><a href=\"http://qt.nokia.com/doc/\">ALL VERSIONS" \ " </a></li>\n" \ " </ul>\n" \ + " </div>\n" \ + " <ul class=\"sf-menu sf-js-enabled sf-shadow\" id=\"narrowmenu\"> \n" \ + " <li><a href=\"#\">API Lookup</a> \n" \ + " <ul id=\"topmenuLook\"> \n" \ + " <li><a href=\"classes.html\">Class index</a></li> \n" \ + " <li><a href=\"functions.html\">Function index</a></li> \n" \ + " <li><a href=\"modules.html\">Modules</a></li> \n" \ + " <li><a href=\"namespaces.html\">Namespaces</a></li> \n" \ + " <li><a href=\"qtglobal.html\">Global stuff</a></li> \n" \ + " <li><a href=\"qdeclarativeelements.html\">QML elements</a></li> \n" \ + " </ul> \n" \ + " </li> \n" \ + " <li><a href=\"#\">Qt Topics</a> \n" \ + " <ul id=\"topmenuTopic\"> \n" \ + " <li><a href=\"qt-basic-concepts.html\">Basic Qt architecture</a></li> \n" \ + " <li><a href=\"declarativeui.html\">Device UI's & Qt Quick</a></li> \n" \ + " <li><a href=\"qt-gui-concepts.html\">Desktop UI components</a></li> \n" \ + " <li><a href=\"platform-specific.html\">Platform-specific info</a></li> \n" \ + " </ul> \n" \ + " </li> \n" \ + " <li><a href=\"#\">Examples</a> \n" \ + " <ul id=\"topmenuexample\"> \n" \ + " <li><a href=\"all-examples.html\">Examples</a></li> \n" \ + " <li><a href=\"tutorials.html\">Tutorials</a></li> \n" \ + " <li><a href=\"demos.html\">Demos</a></li> \n" \ + " <li><a href=\"qdeclarativeexamples.html\">QML Examples</a></li> \n" \ + " <li><a href=\"qdeclarativeexamples.html#Demos\">QML Demos</a></li> \n" \ + " </ul> \n" \ + " </li> \n" \ + " </ul> \n" \ " </div>\n" \ " </div>\n" \ " <div class=\"wrapper\">\n" \ @@ -31,55 +72,49 @@ HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \ " <div class=\"searchlabel\">\n" \ " Search index:</div>\n" \ " <div class=\"search\">\n" \ - " <form id=\"qtdocsearch\" action=\"#\">\n" \ + " <form id=\"qtdocsearch\" action=\"\" onsubmit=\"return false;\">\n" \ " <fieldset>\n" \ - " <input type=\"text\" name=\"searchstring\" id=\"searchstring\" value=\"\" onkeyup=\"doSearch(this.value);\" />\n" \ + " <input type=\"text\" name=\"searchstring\" id=\"pageType\" value=\"\" />\n" \ " </fieldset>\n" \ " </form>\n" \ " </div>\n" \ " <div class=\"box first bottombar\" id=\"lookup\">\n" \ - " <h2>\n" \ + " <h2 title=\"API Lookup\"><span></span>\n" \ " API Lookup</h2>\n" \ - " <div class=\"list\">\n" \ - " <ul>\n" \ - " <li><a href=\"modules.html\">All modules</a></li>\n" \ - " <li><a href=\"classes.html\">All classes</a></li>\n" \ - " <li><a href=\"functions.html\">All functions</a></li>\n" \ - " <li><a href=\"namespaces.html\">All namespaces</a></li>\n" \ - " <li><a href=\"platform-specific.html\">Platform specifics</a></li>\n" \ - " </ul>\n" \ - " </div>\n" \ - " <div class=\"live\">\n" \ + " <div id=\"list001\" class=\"list\">\n" \ + " <ul id=\"ul001\" >\n" \ + " <li class=\"defaultLink\"><a href=\"classes.html\">Class index</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"functions.html\">Function index</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"modules.html\">Modules</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"namespaces.html\">Namespaces</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qtglobal.html\">Global stuff</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qdeclarativeelements.html\">QML elements</a></li>\n" \ + " </ul> \n" \ " </div>\n" \ " </div>\n" \ " <div class=\"box bottombar\" id=\"topics\">\n" \ - " <h2>\n" \ - " API Topics</h2>\n" \ - " <div class=\"list\">\n" \ - " <ul>\n" \ - " <li><a href=\"object.html\">QObject model</a></li>\n" \ - " <li><a href=\"eventsandfilters.html\">Events, signals & slots</a></li>\n" \ - " <li><a href=\"paintsystem.html\">Graphics & Paint system</a></li>\n" \ - " <li><a href=\"declarativeui.html\">Qt Quick</a></li>\n" \ - " <li><a href=\"widgets-and-layouts.html\">Widget style & layout</a></li>\n" \ - " </ul>\n" \ - " </div>\n" \ - " <div class=\"live\">\n" \ + " <h2 title=\"Qt Topics\"><span></span>\n" \ + " Qt Topics</h2>\n" \ + " <div id=\"list002\" class=\"list\">\n" \ + " <ul id=\"ul002\" >\n" \ + " <li class=\"defaultLink\"><a href=\"qt-basic-concepts.html\">Basic Qt architecture</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"declarativeui.html\">Device UI's & Qt Quick</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qt-gui-concepts.html\">Desktop UI components</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"platform-specific.html\">Platform-specific info</a></li>\n" \ + " </ul> \n" \ " </div>\n" \ " </div>\n" \ " <div class=\"box\" id=\"examples\">\n" \ - " <h2>\n" \ - " API Examples</h2>\n" \ - " <div class=\"list\">\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=\"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" \ + " <h2 title=\"Examples\"><span></span>\n" \ + " Examples</h2>\n" \ + " <div id=\"list003\" class=\"list\">\n" \ + " <ul id=\"ul003\">\n" \ + " <li class=\"defaultLink\"><a href=\"all-examples.html\">Examples</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"tutorials.html\">Tutorials</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"demos.html\">Demos</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qdeclarativeexamples.html\">QML Examples</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qdeclarativeexamples.html#Demos\">QML Demos</a></li>\n" \ + " </ul> \n" \ " </div>\n" \ " </div>\n" \ " </div>\n" \ @@ -98,20 +133,21 @@ HTML.postpostheader = " </ul>\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\" alt=\"\" /><img id=\"printIcon\" src=\"images/print.png\" alt=\"Print this page\" /></a></li>\n" \ + " <span>Print</span></a></li>\n" \ " </ul>\n" \ " </div>\n" \ " </div>\n" \ " <div class=\"content\">\n" -HTML.footer = " </div>\n" \ - " <div class=\"feedback t_button\" onclick=\"\$(\'#feedbackBox\').show();\$(\'#blurpage\').show()\">\n" \ +HTML.footer = " <!-- /div -->\n" \ + " <div class=\"feedback t_button\">\n" \ " [+] Documentation Feedback</div>\n" \ " </div>\n" \ " </div>\n" \ " <div class=\"ft\">\n" \ " <span></span>\n" \ " </div>\n" \ + " </div> \n" \ " <div class=\"footer\">\n" \ " <p>\n" \ " <acronym title=\"Copyright\">©</acronym> 2008-2010 Nokia Corporation and/or its\n" \ @@ -122,13 +158,10 @@ HTML.footer = " </div>\n" \ " href=\"http://qt.nokia.com/about/privacy-policy\">Privacy Policy</a></p>\n" \ " </div>\n" \ " <div id=\"feedbackBox\">\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" \ + " <div id=\"feedcloseX\" class=\"feedclose t_button\">X</div>\n" \ + " <form id=\"feedform\" action=\"http://doc.qt.nokia.com/docFeedbck/feedback.php\" method=\"get\">\n" \ + " <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\">Please submit you feedback...</textarea></p>\n" \ + " <p><input id=\"feedsubmit\" class=\"feedclose\" type=\"submit\" name=\"feedback\" /></p>\n" \ " </form>\n" \ " </div>\n" \ " <div id=\"blurpage\">\n" \ diff --git a/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf b/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf new file mode 100644 index 0000000000..027548eacb --- /dev/null +++ b/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf @@ -0,0 +1,178 @@ +HTML.stylesheets = style/style.css \ + style/OfflineStyle.css \ + style/style_ie7.css \ + style/style_ie8.css \ + style/style_ie6.css + +HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \ + " <div class=\"content\"> \n" \ + " <div id=\"nav-logo\">\n" \ + " <a href=\"index.html\">Home</a></div>\n" \ + " <a href=\"index.html\" class=\"qtref\"><span>Qt Reference Documentation</span></a>\n" \ + " <div id=\"narrowsearch\"><form onsubmit=\"return false;\" action=\"\" id=\"qtdocsearch\">\n" \ + " <fieldset>\n" \ + " <input type=\"text\" value=\"\" id=\"pageType\" name=\"searchstring\">\n" \ + " </fieldset>\n" \ + " </form></div>\n" \ + " <div id=\"nav-topright\">\n" \ + " <ul>\n" \ + " <li class=\"nav-topright-home\"><a href=\"http://qt.nokia.com/\">Qt HOME</a></li>\n" \ + " <li class=\"nav-topright-dev\"><a href=\"http://qt.nokia.com/developer\">DEV</a></li>\n" \ + " <li class=\"nav-topright-labs\"><a href=\"http://labs.qt.nokia.com/blogs/\">LABS</a></li>\n" \ + " <li class=\"nav-topright-doc nav-topright-doc-active\"><a href=\"http://doc.qt.nokia.com/\">\n" \ + " DOC</a></li>\n" \ + " <li class=\"nav-topright-blog\"><a href=\"http://blog.qt.nokia.com/\">BLOG</a></li>\n" \ + " <li class=\"nav-topright-shop\"><a title=\"SHOP\" href=\"http://shop.qt.nokia.com\">SHOP</a></li>\n" \ + " </ul>\n" \ + " </div>\n" \ + " <div id=\"shortCut\">\n" \ + " <ul>\n" \ + " <li class=\"shortCut-topleft-inactive\"><span><a href=\"index.html\">Qt 4.7</a></span></li>\n" \ + " <li class=\"shortCut-topleft-active\"><a href=\"http://qt.nokia.com/doc/\">ALL VERSIONS" \ + " </a></li>\n" \ + " </ul>\n" \ + " </div>\n" \ + " <ul class=\"sf-menu sf-js-enabled sf-shadow\" id=\"narrowmenu\"> \n" \ + " <li><a href=\"#\">API Lookup</a> \n" \ + " <ul id=\"topmenuLook\"> \n" \ + " <li><a href=\"classes.html\">Class index</a></li> \n" \ + " <li><a href=\"functions.html\">Function index</a></li> \n" \ + " <li><a href=\"modules.html\">Modules</a></li> \n" \ + " <li><a href=\"namespaces.html\">Namespaces</a></li> \n" \ + " <li><a href=\"qtglobal.html\">Global stuff</a></li> \n" \ + " <li><a href=\"qdeclarativeelements.html\">QML elements</a></li> \n" \ + " </ul> \n" \ + " </li> \n" \ + " <li><a href=\"#\">Qt Topics</a> \n" \ + " <ul id=\"topmenuTopic\"> \n" \ + " <li><a href=\"qt-basic-concepts.html\">Basic Qt architecture</a></li> \n" \ + " <li><a href=\"declarativeui.html\">Device UI's & Qt Quick</a></li> \n" \ + " <li><a href=\"qt-gui-concepts.html\">Desktop UI components</a></li> \n" \ + " <li><a href=\"platform-specific.html\">Platform-specific info</a></li> \n" \ + " </ul> \n" \ + " </li> \n" \ + " <li><a href=\"#\">Examples</a> \n" \ + " <ul id=\"topmenuexample\"> \n" \ + " <li><a href=\"all-examples.html\">Examples</a></li> \n" \ + " <li><a href=\"tutorials.html\">チュートリアル</a></li> \n" \ + " <li><a href=\"demos.html\">Demos</a></li> \n" \ + " <li><a href=\"qdeclarativeexamples.html\">QML Examples</a></li> \n" \ + " <li><a href=\"qdeclarativeexamples.html#Demos\">QML Demos</a></li> \n" \ + " </ul> \n" \ + " </li> \n" \ + " </ul> \n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"wrapper\">\n" \ + " <div class=\"hd\">\n" \ + " <span></span>\n" \ + " </div>\n" \ + " <div class=\"bd group\">\n" \ + " <div class=\"sidebar\">\n" \ + " <div class=\"searchlabel\">\n" \ + " Search index:</div>\n" \ + " <div class=\"search\">\n" \ + " <form id=\"qtdocsearch\" action=\"\" onsubmit=\"return false;\">\n" \ + " <fieldset>\n" \ + " <input type=\"text\" name=\"searchstring\" id=\"pageType\" value=\"\" />\n" \ + " </fieldset>\n" \ + " </form>\n" \ + " </div>\n" \ + " <div class=\"box first bottombar\" id=\"lookup\">\n" \ + " <h2 title=\"API Lookup\"><span></span>\n" \ + " API Lookup</h2>\n" \ + " <div id=\"list001\" class=\"list\">\n" \ + " <ul id=\"ul001\" >\n" \ + " <li class=\"defaultLink\"><a href=\"classes.html\">Class index</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"functions.html\">Function index</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"modules.html\">Modules</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"namespaces.html\">Namespaces</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qtglobal.html\">Global stuff</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qdeclarativeelements.html\">QML elements</a></li>\n" \ + " </ul> \n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"box bottombar\" id=\"topics\">\n" \ + " <h2 title=\"Qt Topics\"><span></span>\n" \ + " Qt Topics</h2>\n" \ + " <div id=\"list002\" class=\"list\">\n" \ + " <ul id=\"ul002\" >\n" \ + " <li class=\"defaultLink\"><a href=\"qt-basic-concepts.html\">Basic Qt architecture</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"declarativeui.html\">Device UI's & Qt Quick</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qt-gui-concepts.html\">Desktop UI components</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"platform-specific.html\">Platform-specific info</a></li>\n" \ + " </ul> \n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"box\" id=\"examples\">\n" \ + " <h2 title=\"Examples\"><span></span>\n" \ + " Examples</h2>\n" \ + " <div id=\"list003\" class=\"list\">\n" \ + " <ul id=\"ul003\">\n" \ + " <li class=\"defaultLink\"><a href=\"all-examples.html\">Examples</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"tutorials.html\">チュートリアル</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"demos.html\">Demos</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qdeclarativeexamples.html\">QML Examples</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qdeclarativeexamples.html#Demos\">QML Demos</a></li>\n" \ + " </ul> \n" \ + " </div>\n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"wrap\">\n" \ + " <div class=\"toolbar\">\n" \ + " <div class=\"breadcrumb toolblock\">\n" \ + " <ul>\n" \ + " <li class=\"first\"><a href=\"index.html\">Home</a></li>\n" \ + " <!-- Bread crumbs goes here -->\n" + +HTML.postpostheader = " </ul>\n" \ + " </div>\n" \ + " <div class=\"toolbuttons toolblock\">\n" \ + " <ul>\n" \ + " <li id=\"smallA\" class=\"t_button\">A</li>\n" \ + " <li id=\"medA\" class=\"t_button active\">A</li>\n" \ + " <li id=\"bigA\" class=\"t_button\">A</li>\n" \ + " <li id=\"print\" class=\"t_button\"><a href=\"javascript:this.print();\">\n" \ + " <span>Print</span></a></li>\n" \ + " </ul>\n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"content\">\n" + +HTML.footer = " <!-- /div -->\n" \ + " <div class=\"feedback t_button\">\n" \ + " [+] Documentation Feedback</div>\n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"ft\">\n" \ + " <span></span>\n" \ + " </div>\n" \ + " </div> \n" \ + " <div class=\"footer\">\n" \ + " <p>\n" \ + " <acronym title=\"Copyright\">©</acronym> 2008-2010 Nokia Corporation and/or its\n" \ + " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ + " in Finland and/or other countries worldwide.</p>\n" \ + " <p>\n" \ + " All other trademarks are property of their respective owners. <a title=\"Privacy Policy\"\n" \ + " href=\"http://qt.nokia.com/about/privacy-policy\">Privacy Policy</a></p>\n" \ + " </div>\n" \ + " <div id=\"feedbackBox\">\n" \ + " <div id=\"feedcloseX\" class=\"feedclose t_button\">X</div>\n" \ + " <form id=\"feedform\" action=\"http://doc.qt.nokia.com/docFeedbck/feedback.php\" method=\"get\">\n" \ + " <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\">Please submit you feedback...</textarea></p>\n" \ + " <p><input id=\"feedsubmit\" class=\"feedclose\" type=\"submit\" name=\"feedback\" /></p>\n" \ + " </form>\n" \ + " </div>\n" \ + " <div id=\"blurpage\">\n" \ + " </div>\n" \ + "<script type=\"text/javascript\">\n" \ + " var _gaq = _gaq || [];\n" \ + " _gaq.push([\'_setAccount\', \'UA-4457116-5\']);\n" \ + " _gaq.push([\'_trackPageview\']);\n" \ + " (function() {\n" \ + " var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;\n" \ + " ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';\n" \ + " var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);\n" \ + " })();\n" \ + "</script>\n" diff --git a/tools/qdoc3/test/qt.qdocconf b/tools/qdoc3/test/qt.qdocconf index 69ab4e1030..d13277173a 100644 --- a/tools/qdoc3/test/qt.qdocconf +++ b/tools/qdoc3/test/qt.qdocconf @@ -26,45 +26,46 @@ qhp.Qt.indexRoot = # Files not referenced in any qdoc file (last four are needed by qtdemo) # See also extraimages.HTML qhp.Qt.extraFiles = index.html \ - images/api_examples.png \ - images/api_lookup.png \ - images/api_topics.png \ - images/bg_l_blank.png \ + images/bg_l.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/bg_ul_blank.png \ + images/header_bg.png \ + images/bg_r.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/breadcrumb.png \ + images/bullet_gt.png \ + images/bullet_dn.png \ + images/bullet_sq.png \ + images/bullet_up.png \ + images/arrow_down.png \ + images/feedbackground.png \ + images/horBar.png \ + images/page.png \ + images/page_bg.png \ + images/sprites-combined.png \ + images/spinner.gif \ + images/stylesheet-coffee-plastique.png \ + images/taskmenuextension-example.png \ + images/coloreditorfactoryimage.png \ + images/dynamiclayouts-example.png \ scripts/functions.js \ scripts/jquery.js \ - style/style.css + scripts/shBrushCpp.js \ + scripts/shCore.js \ + scripts/shLegacy.js \ + scripts/narrow.js \ + scripts/superfish.js \ + style/shCore.css \ + style/shThemeDefault.css \ + style/narrow.css \ + style/superfish.css \ + style/superfish_skin.css \ + style/OfflineStyle.css \ + style/style_ie6.css \ + style/style_ie7.css \ + style/style_ie8.css \ + style/style.css qhp.Qt.filterAttributes = qt 4.7.0 qtrefdoc qhp.Qt.customFilters.Qt.name = Qt 4.7.0 @@ -129,6 +130,7 @@ excludedirs = $QTDIR/src/3rdparty/clucene \ $QTDIR/src/3rdparty/phonon/mmf \ $QTDIR/src/3rdparty/phonon/waveout \ $QTDIR/doc/src/snippets \ + $QTDIR/doc/src/ja_JP \ $QTDIR/doc/src/zh_CN sources.fileextensions = "*.cpp *.qdoc *.mm" diff --git a/tools/qdoc3/test/qt_ja_JP.qdocconf b/tools/qdoc3/test/qt_ja_JP.qdocconf new file mode 100644 index 0000000000..d4141c7535 --- /dev/null +++ b/tools/qdoc3/test/qt_ja_JP.qdocconf @@ -0,0 +1,125 @@ +include(compat.qdocconf) +include(macros.qdocconf) +include(qt-cpp-ignore.qdocconf) +include(qt-html-templates_ja_JP.qdocconf) +include(qt-defines.qdocconf) + +project = Qt +versionsym = +version = %VERSION% +description = Qt リファレンスドキュメント +url = http://qt.nokia.com/doc/ja_JP/4.7 + +sourceencoding = UTF-8 +outputencoding = UTF-8 +naturallanguage = ja + +indexes = $QTDIR/doc/html/qt.index + +qhp.projects = Qt + +qhp.Qt.file = qt.qhp +qhp.Qt.namespace = com.trolltech.qt.470 +qhp.Qt.virtualFolder = qdoc +qhp.Qt.title = Qt +qhp.Qt.indexTitle = Qt +qhp.Qt.selectors = fake:example + +qhp.Qt.filterAttributes = qt 4.7.0 qtrefdoc ja_JP +qhp.Qt.customFilters.Qt.name = Qt 4.7.0 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.0 + +# Files not referenced in any qdoc file (last four are needed by qtdemo) +# See also extraimages.HTML +qhp.Qt.extraFiles = index.html \ + images/bg_l.png \ + images/bg_l_blank.png \ + images/bg_ll_blank.png \ + images/bg_ul_blank.png \ + images/header_bg.png \ + images/bg_r.png \ + images/box_bg.png \ + images/breadcrumb.png \ + images/bullet_gt.png \ + images/bullet_dn.png \ + images/bullet_sq.png \ + images/bullet_up.png \ + images/arrow_down.png \ + images/feedbackground.png \ + images/horBar.png \ + images/page.png \ + images/page_bg.png \ + images/sprites-combined.png \ + images/spinner.gif \ + images/stylesheet-coffee-plastique.png \ + images/taskmenuextension-example.png \ + images/coloreditorfactoryimage.png \ + images/dynamiclayouts-example.png \ + scripts/functions.js \ + scripts/jquery.js \ + scripts/shBrushCpp.js \ + scripts/shCore.js \ + scripts/shLegacy.js \ + scripts/narrow.js \ + scripts/superfish.js \ + style/shCore.css \ + style/shThemeDefault.css \ + style/narrow.css \ + style/superfish.css \ + style/superfish_skin.css \ + style/OfflineStyle.css \ + style/style_ie6.css \ + style/style_ie7.css \ + style/style_ie8.css \ + style/style.css + +language = Cpp + +sourcedirs = $QTDIR/doc/src/ja_JP + +excludedirs = $QTDIR/src/3rdparty/clucene \ + $QTDIR/src/3rdparty/des \ + $QTDIR/src/3rdparty/freetype \ + $QTDIR/src/3rdparty/harfbuzz \ + $QTDIR/src/3rdparty/kdebase \ + $QTDIR/src/3rdparty/libjpeg \ + $QTDIR/src/3rdparty/libmng \ + $QTDIR/src/3rdparty/libpng \ + $QTDIR/src/3rdparty/libtiff \ + $QTDIR/src/3rdparty/md4 \ + $QTDIR/src/3rdparty/md5 \ + $QTDIR/src/3rdparty/patches \ + $QTDIR/src/3rdparty/sha1 \ + $QTDIR/src/3rdparty/sqlite \ + $QTDIR/src/3rdparty/webkit/JavaScriptCore \ + $QTDIR/src/3rdparty/webkit/WebCore \ + $QTDIR/src/3rdparty/wintab \ + $QTDIR/src/3rdparty/zlib \ + $QTDIR/doc/src/snippets \ + $QTDIR/doc/src/zh_CN \ + $QTDIR/src/3rdparty/phonon/gstreamer \ + $QTDIR/src/3rdparty/phonon/ds9 \ + $QTDIR/src/3rdparty/phonon/qt7 \ + $QTDIR/src/3rdparty/phonon/mmf \ + $QTDIR/src/3rdparty/phonon/waveout + +sources.fileextensions = "*.cpp *.qdoc *.mm" +examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp" +examples.imageextensions = "*.png" + +exampledirs = $QTDIR/doc/src \ + $QTDIR/examples/ja_JP \ + $QTDIR/examples \ + $QTDIR/examples/tutorials \ + $QTDIR \ + $QTDIR/qmake/examples \ + $QTDIR/src/3rdparty/webkit/WebKit/qt/docs +imagedirs = $QTDIR/doc/src/ja_JP/images \ + $QTDIR/doc/src/images \ + $QTDIR/examples \ + $QTDIR/doc/src/template/images +outputdir = $QTDIR/doc/html_ja_JP +tagfile = $QTDIR/doc/html_ja_JP/qt.tags +base = file:$QTDIR/doc/html_ja_JP + +HTML.generatemacrefs = "true" diff --git a/tools/qdoc3/test/qt_zh_CN.qdocconf b/tools/qdoc3/test/qt_zh_CN.qdocconf index a5a65d8831..4983f9e6a6 100644 --- a/tools/qdoc3/test/qt_zh_CN.qdocconf +++ b/tools/qdoc3/test/qt_zh_CN.qdocconf @@ -32,44 +32,27 @@ 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 \ - 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_l_blank.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/box_bg.png \ images/breadcrumb.png \ - images/bullet_dn.png \ images/bullet_gt.png \ + images/bullet_dn.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.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/spinner.gif \ images/stylesheet-coffee-plastique.png \ images/taskmenuextension-example.png \ - scripts/functions.js \ - scripts/jquery.js \ + images/coloreditorfactoryimage.png \ + images/dynamiclayouts-example.png \ + scripts/functions.js \ + scripts/jquery.js \ style/style.css language = Cpp @@ -95,6 +78,7 @@ excludedirs = $QTDIR/src/3rdparty/clucene \ $QTDIR/src/3rdparty/wintab \ $QTDIR/src/3rdparty/zlib \ $QTDIR/doc/src/snippets \ + $QTDIR/doc/src/ja_JP \ $QTDIR/src/3rdparty/phonon/gstreamer \ $QTDIR/src/3rdparty/phonon/ds9 \ $QTDIR/src/3rdparty/phonon/qt7 \ diff --git a/tools/qdoc3/test/style/style.css b/tools/qdoc3/test/style/style.css index 1ed49faf02..9c290f5f50 100644 --- a/tools/qdoc3/test/style/style.css +++ b/tools/qdoc3/test/style/style.css @@ -58,6 +58,19 @@ { vertical-align: baseline; } + .heading + { + font: normal 600 16px/1.0 Arial; + padding-bottom: 15px; + } + .subtitle + { + font-size: 13px; + } + .small-subtitle + { + font-size: 13px; + } legend { color: #000000; @@ -73,7 +86,6 @@ { font-size: 100%; } - /* Page style */ html { background-color: #e5e5e5; @@ -92,6 +104,11 @@ { font-style: italic; } + a + { + color: #00732f; + text-decoration: none; + } .header, .footer, .wrapper { min-width: 600px; @@ -106,23 +123,19 @@ { padding-left: 216px; height: 15px; - background: url(../images/bg_ul.png) no-repeat 0 0; + background: url(../images/page.png) no-repeat 0 0; overflow: hidden; } .offline .wrapper .hd { - background: url(../images/bg_ul_blank.png) no-repeat 0 0; + background: url(../images/page.png) no-repeat 0 -15px; } .wrapper .hd span { height: 15px; display: block; - background: url(../images/bg_ur.png) no-repeat 100% 0; overflow: hidden; - } - .offline .wrapper .hd span - { - /* background: url(../images/bg_ur_blank.png) no-repeat 100% 0; */ + background: url(../images/page.png) no-repeat 100% -30px; } .wrapper .bd { @@ -137,18 +150,18 @@ { padding-left: 216px; height: 15px; - background: url(../images/bg_ll.png) no-repeat 0 0; + background: url(../images/page.png) no-repeat 0 -75px; overflow: hidden; } .offline .wrapper .ft { - background: url(../images/bg_ll_blank.png) no-repeat 0 0; + background: url(../images/page.png) no-repeat 0 -90px; } .wrapper .ft span { height: 15px; display: block; - background: url(../images/bg_lr.png) no-repeat 100% 0; + background: url(../images/page.png) no-repeat 100% -60px; overflow: hidden; } .header, .footer @@ -182,186 +195,9 @@ width: 302px; height: 22px; text-indent: -999em; - background: url(../images/header.png) no-repeat 0 0; - } - /* header elements */ - #nav-topright - { - height: 70px; - } - - #nav-topright ul - { - list-style-type: none; - float: right; - width: 370px; - margin-top: 11px; - } - - #nav-topright li - { - display: inline-block; - margin-right: 20px; - float: left; - } - - #nav-topright li.nav-topright-last - { - margin-right: 0; - } - - #nav-topright li a - { - background: transparent url(../images/sprites-combined.png) no-repeat; - height: 18px; - display: block; - overflow: hidden; - text-indent: -9999px; - } - - #nav-topright li.nav-topright-home a - { - width: 65px; - background-position: -2px -91px; - } - - #nav-topright li.nav-topright-home a:hover - { - background-position: -2px -117px; - } - - - #nav-topright li.nav-topright-dev a - { - width: 30px; - background-position: -76px -91px; - } - - #nav-topright li.nav-topright-dev a:hover - { - background-position: -76px -117px; - } - - - #nav-topright li.nav-topright-labs a - { - width: 40px; - background-position: -114px -91px; - } - - #nav-topright li.nav-topright-labs a:hover - { - background-position: -114px -117px; - } - - #nav-topright li.nav-topright-doc a - { - width: 32px; - background-position: -162px -91px; - } - - #nav-topright li.nav-topright-doc a:hover, #nav-topright li.nav-topright-doc-active a - { - background-position: -162px -117px; - } - - #nav-topright li.nav-topright-blog a - { - width: 40px; - background-position: -203px -91px; - } - - #nav-topright li.nav-topright-blog a:hover, #nav-topright li.nav-topright-blog-active a - { - background-position: -203px -117px; - } - - #nav-topright li.nav-topright-shop a - { - width: 40px; - background-position: -252px -91px; - } - - #nav-topright li.nav-topright-shop a:hover, #nav-topright li.nav-topright-shop-active a - { - background-position: -252px -117px; - } - - #nav-logo - { - background: transparent url( "../images/sprites-combined.png" ) no-repeat 0 -225px; - left: -3px; - position: absolute; - width: 75px; - height: 75px; - top: 13px; - } - #nav-logo a - { - width: 75px; - height: 75px; - display: block; - text-indent: -9999px; - overflow: hidden; - } - /* Clearing */ - .header:after, .footer:after, .breadcrumb:after, .wrap .content:after, .group:after - { - content: "."; - display: block; - height: 0; - clear: both; - visibility: hidden; - } - /* ^ Clearing */ - - - - .shortCut-topleft-inactive - { - padding-left: 3px; - background: transparent url( "../images/sprites-combined.png" ) no-repeat 0px -58px; - height: 20px; - width: 93px; - } - .shortCut-topleft-inactive span - { - font-variant: normal; - } - #shortCut - { - padding-top: 10px; - font-weight: bolder; - color: #b0adab; - } - #shortCut ul - { - list-style-type: none; - float: left; - width: 347px; - margin-left: 100px; - } - #shortCut li - { - display: inline-block; - margin-right: 25px; - float: left; - white-space: nowrap; - } - #shortCut li a - { - color: #b0adab; - text-decoration: none; - } - #shortCut li a:hover - { - color: #44a51c; - text-decoration: none; + background: url(../images/sprites-combined.png) no-repeat -78px -235px; } - /* end of header elements */ - - /* menu element */ .sidebar { float: left; @@ -369,32 +205,32 @@ width: 200px; font-size: 11px; } - .sidebar a - { - color: #00732f; - text-decoration: none; - } - .offline .sidebar, .offline .feedback + + .offline .sidebar, .offline .feedback, .offline .t_button { display: none; } + .sidebar .searchlabel { padding: 0 0 2px 17px; font: normal bold 11px/1.2 Verdana; } + .sidebar .search { padding: 0 15px 0 16px; } + .sidebar .search form { - width: 167px; - height: 21px; - padding: 2px 0 0 5px; - background: url(../images/form_bg.png) no-repeat 0 0; + background: url(../images/sprites-combined.png) no-repeat -6px -348px; + height:21px; + padding:2px 0 0 5px; + width:167px; } - .sidebar .search form fieldset input#searchstring + + .sidebar .search form input#pageType { width: 158px; height: 19px; @@ -403,32 +239,62 @@ outline: none; font: 13px/1.2 Verdana; } + .sidebar .box { padding: 17px 15px 5px 16px; } + .sidebar .box .first { background-image: none; } + .sidebar .box h2 { font: normal 18px/1.2 Arial; - padding: 15px 0 0 40px; + padding: 0; min-height: 32px; } + .sidebar .box h2 span + { + overflow: hidden; + display: inline-block; + } .sidebar .box#lookup h2 { - background: url(../images/api_lookup.png) no-repeat 0 0; + background-image: none; + } + .sidebar #lookup.box h2 span + { + background: url(../images/sprites-combined.png) no-repeat -6px -311px; + width: 27px; + height: 35px; + margin-right: 13px; } .sidebar .box#topics h2 { - background: url(../images/api_topics.png) no-repeat 0 0; + background-image: none; + } + .sidebar #topics.box h2 span + { + background: url(../images/sprites-combined.png) no-repeat -94px -311px; + width: 27px; + height: 32px; + margin-right: 13px; } .sidebar .box#examples h2 { - background: url(../images/api_examples.png) no-repeat 0 0; + background-image: none; + } + .sidebar #examples.box h2 span + { + background: url(../images/sprites-combined.png) no-repeat -48px -311px; + width: 30px; + height: 31px; + margin-right: 9px; } + .sidebar .box .list { display: block; @@ -443,6 +309,9 @@ { text-decoration: underline; } + .sidebar .box ul + { + } .sidebar .box ul li { padding-left: 12px; @@ -453,23 +322,20 @@ { background: url(../images/box_bg.png) repeat-x 0 bottom; } - /* content elements */ .wrap { - overflow: hidden; + margin: 0 5px 0 208px; + overflow: visible; } .offline .wrap { margin: 0 5px 0 5px; } - /* tool bar */ .wrap .toolbar { background-color: #fafafa; border-bottom: 1px solid #d1d1d1; - height: 20px; - margin-left: 3px; - margin-right: 5px; + height: 20px; position: relative; } .wrap .toolbar .toolblock @@ -487,7 +353,7 @@ { padding: 0 0 10px 21px; right: 5px; - vertical-align: top; + vertical-align: middle; overflow: hidden; } .wrap .toolbar .toolbuttons .active @@ -507,32 +373,56 @@ font-weight: bold; color: #B0ADAB; } - #smallA + + .toolbuttons #print + { + border-left: 1px solid #c5c4c4; + margin-top: 0; + padding-left: 7px; + text-indent: 0; + } + .toolbuttons #print a + { + width: 16px; + height: 16px; + } + + .toolbuttons #print a span + { + width: 16px; + height: 16px; + text-indent: -999em; + display: block; + overflow: hidden; + background: url(../images/sprites-combined.png) no-repeat -137px -311px; + } + + .toolbuttons #smallA { font-size: 10pt; } - #medA + .toolbuttons #medA { font-size: 12pt; } - #bigA + .toolbuttons #bigA { font-size: 14pt; + margin-right: 7px; } + #smallA:hover, #medA:hover, #bigA:hover { color: #00732F; } - #print + + .offline .wrap .breadcrumb { - font-size: 14pt; - line-height: 20pt; } - #printIcon + + .wrap .breadcrumb ul { - margin-left: 5px; } - /* bread crumbs */ .wrap .breadcrumb ul li { float: left; @@ -545,6 +435,10 @@ { font-weight: normal; } + .wrap .breadcrumb ul li a + { + color: #363534; + } .wrap .breadcrumb ul li.first { background-image: none; @@ -554,29 +448,29 @@ .wrap .content { padding: 30px; - position: relative; } - /* text elements */ - .heading + + .wrap .content li { - font: normal 600 16px/1.0 Arial; - padding-bottom: 15px; + padding-left: 12px; + background: url(../images/bullet_sq.png) no-repeat 0 5px; + font: normal 400 10pt/1 Verdana; + color: #44a51c; + margin-bottom: 10px; } - - .subtitle + .content li:hover { - font-size: 13px; + text-decoration: underline; } - .small-subtitle + .offline .wrap .content { - font-size: 13px; + padding-top: 15px; } - + .wrap .content h1 { font: 600 18px/1.2 Arial; - padding-bottom: 15px; } .wrap .content h2 { @@ -588,26 +482,13 @@ } .wrap .content p { - line-height:20px; - padding:10px 5px 10px 5px; + line-height: 20px; + padding: 10px 5px 10px 5px; } .wrap .content ul { padding-left: 25px; } - .wrap .content li - { - padding-left: 12px; - background: url(../images/bullet_sq.png) no-repeat 0 5px; - font: normal 400 10pt/1 Verdana; - margin-bottom: 10px; - line-height: 14px; - } - a - { - color: #00732F; - text-decoration: none; - } a:hover { color: #4c0033; @@ -618,10 +499,6 @@ color: #4c0033; text-decoration: none; } - .offline .wrap .content - { - padding-top: 15px; - } .footer { min-height: 100px; @@ -629,11 +506,15 @@ font: normal 9px/1 Verdana; text-align: center; padding-top: 40px; + background-color: #E6E7E8; + margin: 0; } .feedback { - float: right; - padding-right: 10px; + float: none; + position: absolute; + right: 15px; + bottom: 10px; font: normal 8px/1 Verdana; color: #B0ADAB; } @@ -644,37 +525,223 @@ color: #00732F; text-decoration: underline; } + .header:after, .footer:after, .breadcrumb:after, .wrap .content:after, .group:after + { + content: "."; + display: block; + height: 0; + clear: both; + visibility: hidden; + } + #nav-topright + { + height: 70px; + } + + #nav-topright ul + { + list-style-type: none; + float: right; + width: 370px; + margin-top: 11px; + } + + #nav-topright li + { + display: inline-block; + margin-right: 20px; + float: left; + } + + #nav-topright li.nav-topright-last + { + margin-right: 0; + } + + #nav-topright li a + { + background: transparent url(../images/sprites-combined.png) no-repeat; + height: 18px; + display: block; + overflow: hidden; + text-indent: -9999px; + } + + #nav-topright li.nav-topright-home a + { + width: 65px; + background-position: -2px -91px; + } + + #nav-topright li.nav-topright-home a:hover + { + background-position: -2px -117px; + } + + + #nav-topright li.nav-topright-dev a + { + width: 30px; + background-position: -76px -91px; + } + + #nav-topright li.nav-topright-dev a:hover + { + background-position: -76px -117px; + } + + + #nav-topright li.nav-topright-labs a + { + width: 40px; + background-position: -114px -91px; + } + + #nav-topright li.nav-topright-labs a:hover + { + background-position: -114px -117px; + } + + #nav-topright li.nav-topright-doc a + { + width: 32px; + background-position: -162px -91px; + } + + #nav-topright li.nav-topright-doc a:hover, #nav-topright li.nav-topright-doc-active a + { + background-position: -162px -117px; + } + + #nav-topright li.nav-topright-blog a + { + width: 40px; + background-position: -203px -91px; + } + + #nav-topright li.nav-topright-blog a:hover, #nav-topright li.nav-topright-blog-active a + { + background-position: -203px -117px; + } + + #nav-topright li.nav-topright-shop a + { + width: 40px; + background-position: -252px -91px; + } + + #nav-topright li.nav-topright-shop a:hover, #nav-topright li.nav-topright-shop-active a + { + background-position: -252px -117px; + } + + #nav-logo + { + background: transparent url(../images/sprites-combined.png ) no-repeat 0 -225px; + left: -3px; + position: absolute; + width: 75px; + height: 75px; + top: 13px; + } + #nav-logo a + { + width: 75px; + height: 75px; + display: block; + text-indent: -9999px; + overflow: hidden; + } + + + .shortCut-topleft-inactive + { + padding-left: 3px; + background: transparent url( ../images/sprites-combined.png) no-repeat 0px -58px; + height: 20px; + width: 47px; + } + .shortCut-topleft-inactive span + { + font-variant: normal; + } + #shortCut + { + padding-top: 10px; + font-weight: bolder; + color: #b0adab; + } + #shortCut ul + { + list-style-type: none; + float: left; + width: 347px; + margin-left: 100px; + } + #shortCut li + { + display: inline-block; + margin-right: 25px; + float: left; + white-space: nowrap; + } + #shortCut li a + { + color: #b0adab; + } + #shortCut li a:hover + { + color: #44a51c; + } + hr { - background-color: #e0e0e0; + background-color: #E6E6E6; + border: 1px solid #E6E6E6; height: 1px; width: 100%; text-align: left; margin: 15px 0px 15px 0px; } - + .content .alignedsummary { margin: 15px; } - /* tables */ + pre + { + border: 1px solid #DDDDDD; + margin: 0 20px 10px 10px; + padding: 20px 15px 20px 20px; + overflow-x: auto; + } table, pre { -moz-border-radius: 7px 7px 7px 7px; background-color: #F6F6F6; border: 1px solid #E6E6E6; border-collapse: separate; - font-size: 11px; - min-width: 395px; + font-size: 11px; + /*min-width: 395px;*/ margin-bottom: 25px; + display: inline-block; + } + thead + { + margin-top: 5px; + } + th + { + padding: 3px 15px 3px 15px; + } + td + { + padding: 3px 15px 3px 20px; } - thead{margin-top: 5px;} - th{ padding: 3px 15px 3px 15px;} - td{padding: 3px 15px 3px 20px;} table tr.odd { border-left: 1px solid #E6E6E6; - background-color: #F6F6F6; + background-color: #F6F6F6; color: #66666E; } table tr.even @@ -685,12 +752,13 @@ } table tr.odd:hover { - background-color: #E6E6E6; + background-color: #E6E6E6; } table tr.even:hover { background-color: #E6E6E6; } + span.comment { color: #8B0000; @@ -700,15 +768,7 @@ { color: #254117; } - pre - { - -moz-border-radius:7px 7px 7px 7px; - background-color:#F6F6F6; - border:1px solid #DDDDDD; - margin:0 20px 10px 10px; - padding:20px 15px 20px 20px; - overflow-x:auto; - } + .qmltype { text-align: center; @@ -719,13 +779,28 @@ float: right; color: #254117; } + + .qmldefault + { + float: right; + color: red; + } + + .qmldoc + { + } + + *.qmlitem p + { + } + #feedbackBox { - display:none; - -moz-border-radius:7px 7px 7px 7px; - border:1px solid #DDDDDD; - position:fixed; - top:100px; + display: none; + -moz-border-radius: 7px 7px 7px 7px; + border: 1px solid #DDDDDD; + position: fixed; + top: 100px; left: 33%; height: 190px; width: 400px; @@ -735,27 +810,27 @@ } #feedcloseX a { - display:inline; + display: inline; padding: 5px 5px 0 0; - margin-bottom:3px; + margin-bottom: 3px; color: #363534; - font-weight:600; + font-weight: 600; float: right; text-decoration: none; } + #feedbox - /* here */ { - display:inline; + display: inline; width: 370px; height: 120px; - margin:0px 25px 10px 15px; + margin: 0px 25px 10px 15px; } #feedsubmit { - display:inline; - float:right; - margin:4px 32px 0 0; + display: inline; + float: right; + margin: 4px 32px 0 0; } #blurpage { @@ -771,141 +846,172 @@ } .toc { - float: right; - -moz-border-radius:7px 7px 7px 7px; - background-color:#F6F6F6; - border:1px solid #DDDDDD; - margin:0 20px 10px 10px; - padding:20px 15px 20px 20px; + float: right; + -moz-border-radius: 7px 7px 7px 7px; + background-color: #F6F6F6; + border: 1px solid #DDDDDD; + margin: 0 20px 10px 10px; + padding: 20px 15px 20px 20px; height: auto; width: 200px; } - .toc ul + .toc h3 { - float: left; - padding: 15px; - + font: 600 12px/1.2 Arial; + } + + .wrap .content .toc ul + { + padding-left: 0px; + } + + + .wrap .content .toc .level2 + { + margin-left: 15px; } - .content .toc li { - font: normal 12px/1.2 Verdana; + font: normal 10px/1.2 Verdana; background: url(../images/bullet_dn.png) no-repeat 0 5px; } - .relpage + .relpage { -moz-border-radius: 7px 7px 7px 7px; border: 1px solid #DDDDDD; padding: 25px 25px; - clear:both; + clear: both; } .relpage ul { float: none; padding: 15px; } - .content .relpage li + .content .relpage li { font: normal 11px/1.2 Verdana; } - /* edit */ h3.fn, span.fn { background-color: #F6F6F6; border-width: 1px; border-style: solid; border-color: #E6E6E6; - font-weight: bold; - /* padding: 6px 0px 6px 10px;*/ - /* margin: 42px 0px 0px 0px;*/ + font-weight: bold; } - /* edit */ - .indexbox - { - width: 100%; - } - .content .indexboxcont li - { - font: normal 600 13px/1 Verdana; - } - /* .indexbox a - { - color: #00732f; - text-decoration: none; - }*/ - .indexbox a:hover, .indexbox a:visited:hover - { - color: #4c0033; - text-decoration: underline; - } - .indexbox a:visited + /* start index box */ + .indexbox { - color: #00732f; - text-decoration: none; + width: 100%; + display:inline-block; } .indexboxcont { display: block; + /* overflow: hidden;*/ } .indexboxbar { - background: transparent url( "../images/horBar.png" ) repeat-x left bottom; + background: transparent url(../images/horBar.png ) repeat-x left bottom; margin-bottom: 25px; + /* background-image: none; + border-bottom: 1px solid #e2e2e2;*/ } .indexboxcont .section { - display: inline-block; + display: inline-block; width: 49%; *width:42%; _width:42%; padding:0 2% 0 1%; vertical-align:top; + } .indexboxcont .indexIcon - { + { width: 11%; *width:18%; _width:18%; overflow:hidden; + } .indexboxcont .section p - { + { padding-top: 20px; padding-bottom: 20px; } - .indexboxcont .sectionlist { display: inline-block; width: 33%; - margin-right: -2px; - vertical-align: top; padding: 0; } - .tricol - { - - } .indexboxcont .sectionlist ul { - padding-left: 15px; margin-bottom: 20px; } -/* + .indexboxcont .sectionlist ul li { line-height: 12px; } -*/ + + .content .indexboxcont li + { + font: normal 600 13px/1 Verdana; + } + + .indexbox a:hover, .indexbox a:visited:hover + { + color: #4c0033; + text-decoration: underline; + } + + .indexbox a:visited + { + color: #00732f; + text-decoration: none; + } + + .indexboxcont:after + { + content: "."; + display: block; + height: 0; + clear: both; + visibility: hidden; + } + + .indexbox .indexIcon span + { + display: block; + } + + .indexbox.guide .indexIcon span + { + width: 96px; + height: 137px; + background: url(../images/sprites-combined.png) no-repeat -5px -376px; + padding: 0; + } + + .indexbox.tools .indexIcon span + { + width: 115px; + height: 137px; + background: url(../images/sprites-combined.png) no-repeat -111px -376px; + padding: 0; + } + .lastcol { display: inline-block; @@ -916,12 +1022,9 @@ .tricol .lastcol { - margin-left:-6px; + margin-left: -6px; } - - /*.toc ul*/ - - /* end page elements */ + /* end indexbox */ } /* end of screen media */ @@ -929,7 +1032,7 @@ @media print { - .header, .footer, .toolbar, .feedback, .wrapper .hd, .wrapper .bd .sidebar, .wrapper .ft + input, textarea, .header, .footer, .toolbar, .feedback, .wrapper .hd, .wrapper .bd .sidebar, .wrapper .ft { display: none; background: none; diff --git a/tools/qml/Info_mac.plist b/tools/qml/Info_mac.plist index ce4ebe339f..80ca6a3526 100644 --- a/tools/qml/Info_mac.plist +++ b/tools/qml/Info_mac.plist @@ -2,6 +2,8 @@ <!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> <plist version="0.1"> <dict> + <key>CFBundleIconFile</key> + <string>@ICON@</string> <key>CFBundleIdentifier</key> <string>com.nokia.qt.qml</string> <key>CFBundlePackageType</key> diff --git a/tools/qml/content/Browser.qml b/tools/qml/content/Browser.qml index 0912f58fdc..ff2bb47647 100644 --- a/tools/qml/content/Browser.qml +++ b/tools/qml/content/Browser.qml @@ -1,4 +1,46 @@ +/**************************************************************************** +** +** 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 QtDeclarative module 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$ +** +****************************************************************************/ + import Qt 4.7 +import Qt.labs.folderlistmodel 1.0 Rectangle { id: root @@ -87,11 +129,12 @@ Rectangle { anchors.leftMargin: 54 font.pixelSize: 32 color: (wrapper.ListView.isCurrentItem && root.keyPressed) ? palette.highlightedText : palette.windowText + elide: Text.ElideRight } MouseArea { id: mouseRegion anchors.fill: parent - onClicked: { launch() } + onClicked: { if (folders == wrapper.ListView.view.model) launch() } } states: [ State { diff --git a/tools/qml/deviceorientation.h b/tools/qml/deviceorientation.h index d209005b4d..817bfc8528 100644 --- a/tools/qml/deviceorientation.h +++ b/tools/qml/deviceorientation.h @@ -52,7 +52,14 @@ class DeviceOrientation : public QObject Q_OBJECT Q_ENUMS(Orientation) public: - enum Orientation { UnknownOrientation, Portrait, Landscape }; + enum Orientation { + UnknownOrientation, + Portrait, + Landscape, + PortraitInverted, + LandscapeInverted + }; + virtual Orientation orientation() const = 0; virtual void setOrientation(Orientation) = 0; diff --git a/tools/qml/deviceorientation_maemo.cpp b/tools/qml/deviceorientation_maemo.cpp index 9f12f3d509..443edc8071 100644 --- a/tools/qml/deviceorientation_maemo.cpp +++ b/tools/qml/deviceorientation_maemo.cpp @@ -40,96 +40,87 @@ ****************************************************************************/ #include "deviceorientation.h" -#include <stdio.h> -#include <stdlib.h> +#include <QtDBus> + +#include <mce/mode-names.h> +#include <mce/dbus-names.h> class MaemoOrientation : public DeviceOrientation { Q_OBJECT public: MaemoOrientation() - : DeviceOrientation(),m_current(Portrait), m_lastSeen(Portrait), m_lastSeenCount(0) + : o(UnknownOrientation) { - m_current = get(); - if (m_current == UnknownOrientation) - m_current = Portrait; + // enable the orientation sensor + QDBusConnection::systemBus().call( + QDBusMessage::createMethodCall(MCE_SERVICE, MCE_REQUEST_PATH, + MCE_REQUEST_IF, MCE_ACCELEROMETER_ENABLE_REQ)); + + // query the initial orientation + QDBusMessage reply = QDBusConnection::systemBus().call( + QDBusMessage::createMethodCall(MCE_SERVICE, MCE_REQUEST_PATH, + MCE_REQUEST_IF, MCE_DEVICE_ORIENTATION_GET)); + if (reply.type() == QDBusMessage::ErrorMessage) { + qWarning("Unable to retrieve device orientation: %s", qPrintable(reply.errorMessage())); + } else { + o = toOrientation(reply.arguments().value(0).toString()); + } - startTimer(100); + // connect to the orientation change signal + QDBusConnection::systemBus().connect(QString(), MCE_SIGNAL_PATH, MCE_SIGNAL_IF, + MCE_DEVICE_ORIENTATION_SIG, + this, + SLOT(deviceOrientationChanged(QString))); } - Orientation orientation() const { - return m_current; + ~MaemoOrientation() + { + // disable the orientation sensor + QDBusConnection::systemBus().call( + QDBusMessage::createMethodCall(MCE_SERVICE, MCE_REQUEST_PATH, + MCE_REQUEST_IF, MCE_ACCELEROMETER_DISABLE_REQ)); } - void setOrientation(Orientation) { } - -protected: - virtual void timerEvent(QTimerEvent *) + inline Orientation orientation() const { - Orientation c = get(); - - if (c == m_lastSeen) { - m_lastSeenCount++; - } else { - m_lastSeenCount = 0; - m_lastSeen = c; - } - - if (m_lastSeen != UnknownOrientation && m_lastSeen != m_current && m_lastSeenCount > 4) { - m_current = m_lastSeen; - emit orientationChanged(); - printf("%d\n", m_current); - } + return o; } -signals: - void changed(); - -private: - Orientation m_current; - Orientation m_lastSeen; - int m_lastSeenCount; - - Orientation get() + void setOrientation(Orientation o) { - Orientation o = UnknownOrientation; - - int ax, ay, az; - - read(&ax, &ay, &az); + } - if (abs(az) > 850) { - o = UnknownOrientation; - } else if (ax < -750) { - o = Portrait; - } else if (ay < -750) { - o = Landscape; - } +private Q_SLOTS: + void deviceOrientationChanged(const QString &newOrientation) + { + o = toOrientation(newOrientation); - return o; + emit orientationChanged(); +// printf("%d\n", o); } - int read(int *ax,int *ay,int *az) +private: + static Orientation toOrientation(const QString &nativeOrientation) { - static const char *accel_filename = "/sys/class/i2c-adapter/i2c-3/3-001d/coord"; - - FILE *fd; - int rs; - fd = fopen(accel_filename, "r"); - if(fd==NULL){ printf("liqaccel, cannot open for reading\n"); return -1;} - rs=fscanf((FILE*) fd,"%i %i %i",ax,ay,az); - fclose(fd); - if(rs != 3){ printf("liqaccel, cannot read information\n"); return -2;} - return 0; + if (nativeOrientation == MCE_ORIENTATION_LANDSCAPE) + return Landscape; + else if (nativeOrientation == MCE_ORIENTATION_LANDSCAPE_INVERTED) + return LandscapeInverted; + else if (nativeOrientation == MCE_ORIENTATION_PORTRAIT) + return Portrait; + else if (nativeOrientation == MCE_ORIENTATION_PORTRAIT_INVERTED) + return PortraitInverted; + return UnknownOrientation; } -}; +private: + Orientation o; +}; DeviceOrientation* DeviceOrientation::instance() { - static MaemoOrientation *o = 0; - if (!o) - o = new MaemoOrientation; + static MaemoOrientation *o = new MaemoOrientation; return o; } diff --git a/tools/qml/loggerwidget.cpp b/tools/qml/loggerwidget.cpp index 9eca4a6801..3ae2b5e057 100644 --- a/tools/qml/loggerwidget.cpp +++ b/tools/qml/loggerwidget.cpp @@ -42,29 +42,141 @@ #include "loggerwidget.h" #include <qglobal.h> #include <QDebug> +#include <QSettings> +#include <QActionGroup> +#include <QMenu> QT_BEGIN_NAMESPACE LoggerWidget::LoggerWidget(QWidget *parent) : QPlainTextEdit(parent), - m_keepClosed(false) + m_visibilityOrigin(SettingsOrigin) { setAttribute(Qt::WA_QuitOnClose, false); - setWindowTitle(tr("Logger")); + setWindowTitle(tr("Warnings")); + + readSettings(); + setupPreferencesMenu(); } void LoggerWidget::append(const QString &msg) { appendPlainText(msg); - if (!m_keepClosed && !isVisible()) + if (!isVisible() && (defaultVisibility() == AutoShowWarnings)) setVisible(true); } +LoggerWidget::Visibility LoggerWidget::defaultVisibility() const +{ + return m_visibility; +} + +void LoggerWidget::setDefaultVisibility(LoggerWidget::Visibility visibility) +{ + if (m_visibility == visibility) + return; + + m_visibility = visibility; + m_visibilityOrigin = CommandLineOrigin; + + m_preferencesMenu->setEnabled(m_visibilityOrigin == SettingsOrigin); +} + +QMenu *LoggerWidget::preferencesMenu() +{ + return m_preferencesMenu; +} + +QAction *LoggerWidget::showAction() +{ + return m_showWidgetAction; +} + +void LoggerWidget::readSettings() +{ + QSettings settings; + QString warningsPreferences = settings.value("warnings", "hide").toString(); + if (warningsPreferences == "show") { + m_visibility = ShowWarnings; + } else if (warningsPreferences == "hide") { + m_visibility = HideWarnings; + } else { + m_visibility = AutoShowWarnings; + } +} + +void LoggerWidget::saveSettings() +{ + if (m_visibilityOrigin != SettingsOrigin) + return; + + QString value = "autoShow"; + if (defaultVisibility() == ShowWarnings) { + value = "show"; + } else if (defaultVisibility() == HideWarnings) { + value = "hide"; + } + + QSettings settings; + settings.setValue("warnings", value); +} + +void LoggerWidget::warningsPreferenceChanged(QAction *action) +{ + Visibility newSetting = static_cast<Visibility>(action->data().toInt()); + m_visibility = newSetting; + saveSettings(); +} + +void LoggerWidget::showEvent(QShowEvent *event) +{ + QWidget::showEvent(event); + emit opened(); +} + void LoggerWidget::closeEvent(QCloseEvent *event) { - m_keepClosed = true; QWidget::closeEvent(event); + emit closed(); +} + +void LoggerWidget::setupPreferencesMenu() +{ + m_preferencesMenu = new QMenu(tr("Warnings")); + QActionGroup *warnings = new QActionGroup(m_preferencesMenu); + warnings->setExclusive(true); + + connect(warnings, SIGNAL(triggered(QAction*)), this, SLOT(warningsPreferenceChanged(QAction*))); + + QAction *showWarningsPreference = new QAction(tr("Show by default"), m_preferencesMenu); + showWarningsPreference->setCheckable(true); + showWarningsPreference->setData(LoggerWidget::ShowWarnings); + warnings->addAction(showWarningsPreference); + m_preferencesMenu->addAction(showWarningsPreference); + + QAction *hideWarningsPreference = new QAction(tr("Hide by default"), m_preferencesMenu); + hideWarningsPreference->setCheckable(true); + hideWarningsPreference->setData(LoggerWidget::HideWarnings); + warnings->addAction(hideWarningsPreference); + m_preferencesMenu->addAction(hideWarningsPreference); + + QAction *autoWarningsPreference = new QAction(tr("Show for first warning"), m_preferencesMenu); + autoWarningsPreference->setCheckable(true); + autoWarningsPreference->setData(LoggerWidget::AutoShowWarnings); + warnings->addAction(autoWarningsPreference); + m_preferencesMenu->addAction(autoWarningsPreference); + + switch (defaultVisibility()) { + case LoggerWidget::ShowWarnings: + showWarningsPreference->setChecked(true); + break; + case LoggerWidget::HideWarnings: + hideWarningsPreference->setChecked(true); + break; + default: + autoWarningsPreference->setChecked(true); + } } QT_END_NAMESPACE diff --git a/tools/qml/loggerwidget.h b/tools/qml/loggerwidget.h index 5c4a7010dc..fd20c41c21 100644 --- a/tools/qml/loggerwidget.h +++ b/tools/qml/loggerwidget.h @@ -50,14 +50,44 @@ class LoggerWidget : public QPlainTextEdit { Q_OBJECT public: LoggerWidget(QWidget *parent=0); + + enum Visibility { ShowWarnings, HideWarnings, AutoShowWarnings }; + + Visibility defaultVisibility() const; + void setDefaultVisibility(Visibility visibility); + + QMenu *preferencesMenu(); + QAction *showAction(); + public slots: void append(const QString &msg); + +private slots: + void warningsPreferenceChanged(QAction *action); + void readSettings(); + void saveSettings(); + protected: + void showEvent(QShowEvent *event); void closeEvent(QCloseEvent *event); + +signals: + void opened(); + void closed(); + private: - bool m_keepClosed; + void setupPreferencesMenu(); + + QMenu *m_preferencesMenu; + QAction *m_showWidgetAction; + + enum ConfigOrigin { CommandLineOrigin, SettingsOrigin }; + ConfigOrigin m_visibilityOrigin; + Visibility m_visibility; }; QT_END_NAMESPACE +Q_DECLARE_METATYPE(LoggerWidget::Visibility) + #endif // LOGGERWIDGET_H diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 9ccc3d2e69..a75023bdea 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -50,11 +50,10 @@ #include <QDebug> #include <QMessageBox> #include "qdeclarativetester.h" -#include "qdeclarativefolderlistmodel.h" QT_USE_NAMESPACE -QtMsgHandler systemMsgOutput; +QtMsgHandler systemMsgOutput = 0; #if defined (Q_OS_SYMBIAN) #include <unistd.h> @@ -86,7 +85,7 @@ QString warnings; void showWarnings() { if (!warnings.isEmpty()) { - QMessageBox::warning(0, QApplication::tr("Qt Declarative UI Runtime"), warnings); + QMessageBox::warning(0, QApplication::tr("Qt QML Viewer"), warnings); } } @@ -111,7 +110,7 @@ void myMessageOutput(QtMsgType type, const char *msg) void usage() { - qWarning("Usage: qml [options] <filename>"); + qWarning("Usage: qmlviewer [options] <filename>"); qWarning(" "); qWarning(" options:"); qWarning(" -v, -version ............................. display version"); @@ -119,13 +118,10 @@ void usage() qWarning(" -maximized................................ run maximized"); qWarning(" -fullscreen............................... run fullscreen"); qWarning(" -stayontop................................ keep viewer window on top"); - 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(" -warnings [show|hide]..................... show warnings in a separate log window"); qWarning(" -recordfile <output> ..................... set video recording file"); qWarning(" - ImageMagick 'convert' for GIF)"); qWarning(" - png file for raw frames"); @@ -152,7 +148,7 @@ void usage() void scriptOptsUsage() { - qWarning("Usage: qml -scriptopts <option>[,<option>...] ..."); + qWarning("Usage: qmlviewer -scriptopts <option>[,<option>...] ..."); qWarning(" options:"); qWarning(" record ................................... record a new script"); qWarning(" play ..................................... playback an existing script"); @@ -168,6 +164,8 @@ void scriptOptsUsage() exit(1); } +enum WarningsConfig { ShowWarnings, HideWarnings, DefaultWarnings }; + int main(int argc, char ** argv) { #if defined (Q_OS_SYMBIAN) @@ -182,7 +180,7 @@ int main(int argc, char ** argv) atexit(showWarnings); #endif -#if defined (Q_WS_X11) +#if defined (Q_WS_X11) || defined (Q_WS_MAC) //### default to using raster graphics backend for now bool gsSpecified = false; for (int i = 0; i < argc; ++i) { @@ -198,16 +196,14 @@ int main(int argc, char ** argv) #endif QApplication app(argc, argv); - app.setApplicationName("QtQmlRuntime"); + app.setApplicationName("QtQmlViewer"); app.setOrganizationName("Nokia"); app.setOrganizationDomain("nokia.com"); QDeclarativeViewer::registerTypes(); QDeclarativeTester::registerTypes(); - QDeclarativeFolderListModel::registerTypes(); bool frameless = false; - bool resizeview = false; QString fileName; double fps = 0; int autorecord_from = 0; @@ -217,7 +213,6 @@ int main(int argc, char ** argv) QStringList recordargs; QStringList imports; QStringList plugins; - QString skin; QString script; QString scriptopts; bool runScript = false; @@ -229,7 +224,9 @@ int main(int argc, char ** argv) bool stayOnTop = false; bool maximized = false; bool useNativeFileBrowser = true; - bool showLogWidget = true; + bool experimentalGestures = false; + + WarningsConfig warningsConfig = DefaultWarnings; bool sizeToView = true; #if defined(Q_OS_SYMBIAN) @@ -237,6 +234,10 @@ int main(int argc, char ** argv) useNativeFileBrowser = false; #endif +#if defined(Q_WS_MAC) + useGL = true; +#endif + for (int i = 1; i < argc; ++i) { bool lastArg = (i == argc - 1); QString arg = argv[i]; @@ -248,11 +249,6 @@ int main(int argc, char ** argv) fullScreen = true; } else if (arg == "-stayontop") { stayOnTop = true; - } else if (arg == "-skin") { - if (lastArg) usage(); - skin = QString(argv[++i]); - } else if (arg == "-resizeview") { - resizeview = true; } else if (arg == "-netcache") { if (lastArg) usage(); cache = QString(argv[++i]).toInt(); @@ -281,7 +277,7 @@ int main(int argc, char ** argv) if (lastArg) usage(); app.setStartDragDistance(QString(argv[++i]).toInt()); } else if (arg == QLatin1String("-v") || arg == QLatin1String("-version")) { - qWarning("Qt Qml Runtime version %s", QT_VERSION_STR); + qWarning("Qt QML Viewer version %s", QT_VERSION_STR); exit(0); } else if (arg == "-translation") { if (lastArg) usage(); @@ -290,8 +286,16 @@ int main(int argc, char ** argv) useGL = true; } else if (arg == "-qmlbrowser") { useNativeFileBrowser = false; - } else if (arg == "-nolog") { - showLogWidget = false; + } else if (arg == "-warnings") { + if (lastArg) usage(); + QString warningsStr = QString(argv[++i]); + if (warningsStr == QLatin1String("show")) { + warningsConfig = ShowWarnings; + } else if (warningsStr == QLatin1String("hide")) { + warningsConfig = HideWarnings; + } else { + usage(); + } } else if (arg == "-I" || arg == "-L") { if (arg == "-L") qWarning("-L option provided for compatibility only, use -I instead"); @@ -323,6 +327,8 @@ int main(int argc, char ** argv) sizeToView = false; } else if (arg == "-sizerootobjecttoview") { sizeToView = true; + } else if (arg == "-experimentalgestures") { + experimentalGestures = true; } else if (arg[0] != '-') { fileName = arg; } else if (1 || arg == "-help") { @@ -340,16 +346,10 @@ int main(int argc, char ** argv) if (stayOnTop) wflags |= Qt::WindowStaysOnTopHint; -#if !defined(Q_OS_SYMBIAN) - LoggerWidget loggerWidget(0); - if (showLogWidget) { - logger = &loggerWidget; - } -#endif - QDeclarativeViewer *viewer = new QDeclarativeViewer(0, wflags); + viewer->setAttribute(Qt::WA_DeleteOnClose, true); if (!scriptopts.isEmpty()) { - QStringList options = + QStringList options = scriptopts.split(QLatin1Char(','), QString::SkipEmptyParts); QDeclarativeViewer::ScriptOptions scriptOptions = 0; @@ -389,6 +389,19 @@ int main(int argc, char ** argv) usage(); } +#if !defined(Q_OS_SYMBIAN) + logger = viewer->warningsWidget(); + if (warningsConfig == ShowWarnings) { + logger.data()->setDefaultVisibility(LoggerWidget::ShowWarnings); + logger.data()->show(); + } else if (warningsConfig == HideWarnings){ + logger.data()->setDefaultVisibility(LoggerWidget::HideWarnings); + } +#endif + + if (experimentalGestures) + viewer->enableExperimentalGestures(); + foreach (QString lib, imports) viewer->addLibraryPath(lib); @@ -398,21 +411,10 @@ int main(int argc, char ** argv) viewer->setNetworkCacheSize(cache); viewer->setRecordFile(recordfile); viewer->setSizeToView(sizeToView); - if (resizeview) - viewer->setScaleView(); if (fps>0) viewer->setRecordRate(fps); if (autorecord_to) viewer->setAutoRecord(autorecord_from,autorecord_to); - if (!skin.isEmpty()) { - if (skin == "list") { - foreach (QString s, viewer->builtinSkins()) - qWarning() << qPrintable(s); - exit(0); - } else { - viewer->setSkin(skin); - } - } if (devkeys) viewer->setDeviceKeys(true); viewer->setRecordDither(dither); @@ -450,7 +452,5 @@ int main(int argc, char ** argv) viewer->setUseGL(useGL); viewer->raise(); - int rv = app.exec(); - delete viewer; - exit(rv); + return app.exec(); } diff --git a/tools/qml/qdeclarativefolderlistmodel.cpp b/tools/qml/qdeclarativefolderlistmodel.cpp deleted file mode 100644 index 5a9d88b4a0..0000000000 --- a/tools/qml/qdeclarativefolderlistmodel.cpp +++ /dev/null @@ -1,420 +0,0 @@ -/**************************************************************************** -** -** 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 examples 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 "qdeclarativefolderlistmodel.h" -#include <QDirModel> -#include <QDebug> -#include <qdeclarativecontext.h> - -QT_BEGIN_NAMESPACE - -class QDeclarativeFolderListModelPrivate -{ -public: - QDeclarativeFolderListModelPrivate() - : sortField(QDeclarativeFolderListModel::Name), sortReversed(false), count(0) { - nameFilters << QLatin1String("*"); - } - - void updateSorting() { - QDir::SortFlags flags = 0; - switch(sortField) { - case QDeclarativeFolderListModel::Unsorted: - flags |= QDir::Unsorted; - break; - case QDeclarativeFolderListModel::Name: - flags |= QDir::Name; - break; - case QDeclarativeFolderListModel::Time: - flags |= QDir::Time; - break; - case QDeclarativeFolderListModel::Size: - flags |= QDir::Size; - break; - case QDeclarativeFolderListModel::Type: - flags |= QDir::Type; - break; - } - - if (sortReversed) - flags |= QDir::Reversed; - - model.setSorting(flags); - } - - QDirModel model; - QUrl folder; - QStringList nameFilters; - QModelIndex folderIndex; - QDeclarativeFolderListModel::SortField sortField; - bool sortReversed; - int count; -}; - -/*! - \qmlclass FolderListModel - \brief The FolderListModel provides a model of the contents of a folder in a filesystem. - - FolderListModel provides access to the local filesystem. The \e folder property - specifies the folder to list. - - Qt uses "/" as a universal directory separator in the same way that "/" is - used as a path separator in URLs. If you always use "/" as a directory - separator, Qt will translate your paths to conform to the underlying - operating system. - - The roles available are: - \list - \o fileName - \o filePath - \endlist - - Additionally a file entry can be differentiated from a folder entry - via the \l isFolder() method. -*/ - -QDeclarativeFolderListModel::QDeclarativeFolderListModel(QObject *parent) - : QListModelInterface(parent) -{ - d = new QDeclarativeFolderListModelPrivate; - d->model.setFilter(QDir::AllDirs | QDir::Files | QDir::Drives | QDir::NoDotAndDotDot); - connect(&d->model, SIGNAL(rowsInserted(const QModelIndex&,int,int)) - , this, SLOT(inserted(const QModelIndex&,int,int))); - connect(&d->model, SIGNAL(rowsRemoved(const QModelIndex&,int,int)) - , this, SLOT(removed(const QModelIndex&,int,int))); - connect(&d->model, SIGNAL(dataChanged(const QModelIndex&,const QModelIndex&)) - , this, SLOT(dataChanged(const QModelIndex&,const QModelIndex&))); - connect(&d->model, SIGNAL(modelReset()), this, SLOT(refresh())); - connect(&d->model, SIGNAL(layoutChanged()), this, SLOT(refresh())); -} - -QDeclarativeFolderListModel::~QDeclarativeFolderListModel() -{ - delete d; -} - -QHash<int,QVariant> QDeclarativeFolderListModel::data(int index, const QList<int> &roles) const -{ - Q_UNUSED(roles); - QHash<int,QVariant> folderData; - QModelIndex modelIndex = d->model.index(index, 0, d->folderIndex); - if (modelIndex.isValid()) { - folderData[QDirModel::FileNameRole] = d->model.data(modelIndex, QDirModel::FileNameRole); - folderData[QDirModel::FilePathRole] = QUrl::fromLocalFile(d->model.data(modelIndex, QDirModel::FilePathRole).toString()); - } - - return folderData; -} - -QVariant QDeclarativeFolderListModel::data(int index, int role) const -{ - QVariant rv; - QModelIndex modelIndex = d->model.index(index, 0, d->folderIndex); - if (modelIndex.isValid()) { - if (role == QDirModel::FileNameRole) - rv = d->model.data(modelIndex, QDirModel::FileNameRole); - else if (role == QDirModel::FilePathRole) - rv = QUrl::fromLocalFile(d->model.data(modelIndex, QDirModel::FilePathRole).toString()); - } - - return rv; -} - -int QDeclarativeFolderListModel::count() const -{ - return d->count; -} - -QList<int> QDeclarativeFolderListModel::roles() const -{ - QList<int> r; - r << QDirModel::FileNameRole; - r << QDirModel::FilePathRole; - return r; -} - -QString QDeclarativeFolderListModel::toString(int role) const -{ - switch (role) { - case QDirModel::FileNameRole: - return QLatin1String("fileName"); - case QDirModel::FilePathRole: - return QLatin1String("filePath"); - } - - return QString(); -} - -/*! - \qmlproperty string FolderListModel::folder - - The \a folder property holds the folder the model is currently providing. - - It is a URL, but must be a file: or qrc: URL (or relative to such a URL). -*/ -QUrl QDeclarativeFolderListModel::folder() const -{ - return d->folder; -} - -void QDeclarativeFolderListModel::setFolder(const QUrl &folder) -{ - if (folder == d->folder) - return; - QModelIndex index = d->model.index(folder.toLocalFile()); - if (index.isValid() && d->model.isDir(index)) { - d->folder = folder; - QMetaObject::invokeMethod(this, "refresh", Qt::QueuedConnection); - emit folderChanged(); - } -} - -QUrl QDeclarativeFolderListModel::parentFolder() const -{ - QUrl r; - QString localFile = d->folder.toLocalFile(); - if (!localFile.isEmpty()) { - QDir dir(localFile); -#if defined(Q_OS_SYMBIAN) - if (dir.isRoot()) - dir.setPath(""); - else -#endif - dir.cdUp(); - r = d->folder; - r.setPath(dir.path()); - } else { - int pos = d->folder.path().lastIndexOf(QLatin1Char('/')); - if (pos == -1) - return QUrl(); - r = d->folder; - r.setPath(d->folder.path().left(pos)); - } - return r; -} - -/*! - \qmlproperty list<string> FolderListModel::nameFilters - - The \a nameFilters property contains a list of filename filters. - The filters may include the ? and * wildcards. - - The example below filters on PNG and JPEG files: - - \code - FolderListModel { - nameFilters: [ "*.png", "*.jpg" ] - } - \endcode -*/ -QStringList QDeclarativeFolderListModel::nameFilters() const -{ - return d->nameFilters; -} - -void QDeclarativeFolderListModel::setNameFilters(const QStringList &filters) -{ - d->nameFilters = filters; - d->model.setNameFilters(d->nameFilters); -} - -void QDeclarativeFolderListModel::componentComplete() -{ - if (!d->folder.isValid() || !QDir().exists(d->folder.toLocalFile())) - setFolder(QUrl(QLatin1String("file://")+QDir::currentPath())); - - if (!d->folderIndex.isValid()) - QMetaObject::invokeMethod(this, "refresh", Qt::QueuedConnection); -} - -QDeclarativeFolderListModel::SortField QDeclarativeFolderListModel::sortField() const -{ - return d->sortField; -} - -void QDeclarativeFolderListModel::setSortField(SortField field) -{ - if (field != d->sortField) { - d->sortField = field; - d->updateSorting(); - } -} - -bool QDeclarativeFolderListModel::sortReversed() const -{ - return d->sortReversed; -} - -void QDeclarativeFolderListModel::setSortReversed(bool rev) -{ - if (rev != d->sortReversed) { - d->sortReversed = rev; - d->updateSorting(); - } -} - -/*! - \qmlmethod bool FolderListModel::isFolder(int index) - - Returns true if the entry \a index is a folder; otherwise - returns false. -*/ -bool QDeclarativeFolderListModel::isFolder(int index) const -{ - if (index != -1) { - QModelIndex idx = d->model.index(index, 0, d->folderIndex); - if (idx.isValid()) - return d->model.isDir(idx); - } - return false; -} - -void QDeclarativeFolderListModel::refresh() -{ - d->folderIndex = QModelIndex(); - if (d->count) { - int tmpCount = d->count; - d->count = 0; - emit itemsRemoved(0, tmpCount); - } - d->folderIndex = d->model.index(d->folder.toLocalFile()); - d->count = d->model.rowCount(d->folderIndex); - if (d->count) { - emit itemsInserted(0, d->count); - } -} - -void QDeclarativeFolderListModel::inserted(const QModelIndex &index, int start, int end) -{ - if (index == d->folderIndex) { - d->count = d->model.rowCount(d->folderIndex); - emit itemsInserted(start, end - start + 1); - } -} - -void QDeclarativeFolderListModel::removed(const QModelIndex &index, int start, int end) -{ - if (index == d->folderIndex) { - d->count = d->model.rowCount(d->folderIndex); - emit itemsRemoved(start, end - start + 1); - } -} - -void QDeclarativeFolderListModel::dataChanged(const QModelIndex &start, const QModelIndex &end) -{ - qDebug() << "data changed"; - if (start.parent() == d->folderIndex) - emit itemsChanged(start.row(), end.row() - start.row() + 1, roles()); -} - -/*! - \qmlproperty bool FolderListModel::showDirs - - If true (the default), directories are included in the model. - - Note that the nameFilters are ignored for directories. -*/ -bool QDeclarativeFolderListModel::showDirs() const -{ - return d->model.filter() & QDir::AllDirs; -} - -void QDeclarativeFolderListModel::setShowDirs(bool on) -{ - if (!(d->model.filter() & QDir::AllDirs) == !on) - return; - if (on) - d->model.setFilter(d->model.filter() | QDir::AllDirs | QDir::Drives); - else - d->model.setFilter(d->model.filter() & ~(QDir::AllDirs | QDir::Drives)); -} - -/*! - \qmlproperty bool FolderListModel::showDotAndDotDot - - If true, the "." and ".." directories are included in the model. - - The default is false. -*/ -bool QDeclarativeFolderListModel::showDotAndDotDot() const -{ - return !(d->model.filter() & QDir::NoDotAndDotDot); -} - -void QDeclarativeFolderListModel::setShowDotAndDotDot(bool on) -{ - if (!(d->model.filter() & QDir::NoDotAndDotDot) == on) - return; - if (on) - d->model.setFilter(d->model.filter() & ~QDir::NoDotAndDotDot); - else - d->model.setFilter(d->model.filter() | QDir::NoDotAndDotDot); -} - -/*! - \qmlproperty bool FolderListModel::showOnlyReadable - - If true, only readable files and directories are shown. - - The default is false. -*/ -bool QDeclarativeFolderListModel::showOnlyReadable() const -{ - return d->model.filter() & QDir::Readable; -} - -void QDeclarativeFolderListModel::setShowOnlyReadable(bool on) -{ - if (!(d->model.filter() & QDir::Readable) == !on) - return; - if (on) - d->model.setFilter(d->model.filter() | QDir::Readable); - else - d->model.setFilter(d->model.filter() & ~QDir::Readable); -} - -void QDeclarativeFolderListModel::registerTypes() -{ - qmlRegisterType<QDeclarativeFolderListModel>("Qt",4,7,"FolderListModel"); -} - -QT_END_NAMESPACE - diff --git a/tools/qml/qdeclarativefolderlistmodel.h b/tools/qml/qdeclarativefolderlistmodel.h deleted file mode 100644 index 57b7fe5d62..0000000000 --- a/tools/qml/qdeclarativefolderlistmodel.h +++ /dev/null @@ -1,127 +0,0 @@ -/**************************************************************************** -** -** 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 examples 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 QDECLARATIVEFOLDERLISTMODEL_H -#define QDECLARATIVEFOLDERLISTMODEL_H - -#include <qdeclarative.h> -#include <QStringList> -#include <QUrl> -#include "../../src/declarative/3rdparty/qlistmodelinterface_p.h" - -QT_BEGIN_NAMESPACE - -class QDeclarativeContext; -class QModelIndex; - -class QDeclarativeFolderListModelPrivate; -class QDeclarativeFolderListModel : public QListModelInterface, public QDeclarativeParserStatus -{ - Q_OBJECT - Q_INTERFACES(QDeclarativeParserStatus) - - Q_PROPERTY(QUrl folder READ folder WRITE setFolder NOTIFY folderChanged) - Q_PROPERTY(QUrl parentFolder READ parentFolder NOTIFY folderChanged) - Q_PROPERTY(QStringList nameFilters READ nameFilters WRITE setNameFilters) - Q_PROPERTY(SortField sortField READ sortField WRITE setSortField) - Q_PROPERTY(bool sortReversed READ sortReversed WRITE setSortReversed) - Q_PROPERTY(bool showDirs READ showDirs WRITE setShowDirs) - Q_PROPERTY(bool showDotAndDotDot READ showDotAndDotDot WRITE setShowDotAndDotDot) - Q_PROPERTY(bool showOnlyReadable READ showOnlyReadable WRITE setShowOnlyReadable) - -public: - QDeclarativeFolderListModel(QObject *parent = 0); - ~QDeclarativeFolderListModel(); - - static void registerTypes(); - - virtual QHash<int,QVariant> data(int index, const QList<int> &roles = (QList<int>())) const; - virtual QVariant data(int index, int role) const; - virtual int count() const; - virtual QList<int> roles() const; - virtual QString toString(int role) const; - - QUrl folder() const; - void setFolder(const QUrl &folder); - - QUrl parentFolder() const; - - QStringList nameFilters() const; - void setNameFilters(const QStringList &filters); - - virtual void componentComplete(); - - Q_INVOKABLE bool isFolder(int index) const; - - enum SortField { Unsorted, Name, Time, Size, Type }; - SortField sortField() const; - void setSortField(SortField field); - Q_ENUMS(SortField) - - bool sortReversed() const; - void setSortReversed(bool rev); - - bool showDirs() const; - void setShowDirs(bool); - bool showDotAndDotDot() const; - void setShowDotAndDotDot(bool); - bool showOnlyReadable() const; - void setShowOnlyReadable(bool); - -Q_SIGNALS: - void folderChanged(); - -private Q_SLOTS: - void refresh(); - void inserted(const QModelIndex &index, int start, int end); - void removed(const QModelIndex &index, int start, int end); - void dataChanged(const QModelIndex &start, const QModelIndex &end); - -private: - Q_DISABLE_COPY(QDeclarativeFolderListModel) - QDeclarativeFolderListModelPrivate *d; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QDeclarativeFolderListModel) - -#endif // QDECLARATIVEFOLDERLISTMODEL_H diff --git a/tools/qml/qml.icns b/tools/qml/qml.icns Binary files differnew file mode 100644 index 0000000000..c76051626a --- /dev/null +++ b/tools/qml/qml.icns diff --git a/tools/qml/qml.pri b/tools/qml/qml.pri index d343c76650..58d8cc1e1b 100644 --- a/tools/qml/qml.pri +++ b/tools/qml/qml.pri @@ -10,21 +10,19 @@ HEADERS += $$PWD/qmlruntime.h \ $$PWD/proxysettings.h \ $$PWD/qdeclarativetester.h \ $$PWD/deviceorientation.h \ - $$PWD/qdeclarativefolderlistmodel.h \ $$PWD/loggerwidget.h SOURCES += $$PWD/qmlruntime.cpp \ $$PWD/proxysettings.cpp \ $$PWD/qdeclarativetester.cpp \ - $$PWD/qdeclarativefolderlistmodel.cpp \ $$PWD/loggerwidget.cpp RESOURCES = $$PWD/qmlruntime.qrc maemo5 { + QT += dbus SOURCES += $$PWD/deviceorientation_maemo.cpp } else { SOURCES += $$PWD/deviceorientation.cpp } + 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 b33d48bcc6..9cdec7757b 100644 --- a/tools/qml/qml.pro +++ b/tools/qml/qml.pro @@ -32,12 +32,13 @@ wince* { symbian { TARGET.UID3 = 0x20021317 include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) - INCLUDEPATH += $$QT_SOURCE_TREE/examples/network/qftp/ TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 - LIBS += -lesock -lcommdb -lconnmon -linsock TARGET.CAPABILITY = NetworkServices ReadUserData } mac { QMAKE_INFO_PLIST=Info_mac.plist - TARGET=Qml + TARGET=QMLViewer + ICON=qml.icns +} else { + TARGET=qmlviewer } diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index 008f16399c..676881d0ea 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -53,7 +53,6 @@ #include "qdeclarative.h" #include <private/qabstractanimation_p.h> #include <QAbstractAnimation> -#include "deviceskin.h" #include <QSettings> #include <QXmlStreamReader> @@ -66,6 +65,7 @@ #include <QDeclarativeComponent> #include <QWidget> #include <QApplication> +#include <QTranslator> #include <QDir> #include <QTextBrowser> #include <QFile> @@ -92,19 +92,6 @@ #include <qdeclarativetester.h> -#if defined (Q_OS_SYMBIAN) -#define SYMBIAN_NETWORK_INIT -#endif - -#if defined (SYMBIAN_NETWORK_INIT) -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h> -#include <QTextCodec> -#include "sym_iap_util.h" -#endif - QT_BEGIN_NAMESPACE class Runtime : public QObject @@ -167,89 +154,6 @@ private: QWidget *refWidget; }; - -class PreviewDeviceSkin : public DeviceSkin -{ - Q_OBJECT -public: - explicit PreviewDeviceSkin(const DeviceSkinParameters ¶meters, QWidget *parent); - - void setPreview(QWidget *formWidget); - void setPreviewAndScale(QWidget *formWidget); - - void setScreenSize(const QSize& size) - { - QMatrix fit; - fit = fit.scale(qreal(size.width())/m_screenSize.width(), - qreal(size.height())/m_screenSize.height()); - setTransform(fit); - QApplication::syncX(); - } - - QSize standardScreenSize() const { return m_screenSize; } - - QMenu* menu; - -private slots: - void slotSkinKeyPressEvent(int code, const QString& text, bool autorep); - void slotSkinKeyReleaseEvent(int code, const QString& text, bool autorep); - void slotPopupMenu(); - -private: - const QSize m_screenSize; -}; - - -PreviewDeviceSkin::PreviewDeviceSkin(const DeviceSkinParameters ¶meters, QWidget *parent) : - DeviceSkin(parameters, parent), - m_screenSize(parameters.screenSize()) -{ - menu = new QMenu(this); - connect(this, SIGNAL(skinKeyPressEvent(int,QString,bool)), - this, SLOT(slotSkinKeyPressEvent(int,QString,bool))); - connect(this, SIGNAL(skinKeyReleaseEvent(int,QString,bool)), - this, SLOT(slotSkinKeyReleaseEvent(int,QString,bool))); - connect(this, SIGNAL(popupMenu()), this, SLOT(slotPopupMenu())); -} - -void PreviewDeviceSkin::setPreview(QWidget *formWidget) -{ - formWidget->setFixedSize(m_screenSize); - formWidget->setParent(this, Qt::SubWindow); - formWidget->setAutoFillBackground(true); - setView(formWidget); -} - -void PreviewDeviceSkin::setPreviewAndScale(QWidget *formWidget) -{ - setScreenSize(formWidget->sizeHint()); - formWidget->setParent(this, Qt::SubWindow); - formWidget->setAutoFillBackground(true); - setView(formWidget); -} - -void PreviewDeviceSkin::slotSkinKeyPressEvent(int code, const QString& text, bool autorep) -{ - if (QWidget *focusWidget = QApplication::focusWidget()) { - QKeyEvent e(QEvent::KeyPress,code,0,text,autorep); - QApplication::sendEvent(focusWidget, &e); - } - -} - -void PreviewDeviceSkin::slotSkinKeyReleaseEvent(int code, const QString& text, bool autorep) -{ - if (QWidget *focusWidget = QApplication::focusWidget()) { - QKeyEvent e(QEvent::KeyRelease,code,0,text,autorep); - QApplication::sendEvent(focusWidget, &e); - } -} - -void PreviewDeviceSkin::slotPopupMenu() -{ - menu->exec(QCursor::pos()); -} - static struct { const char *name, *args; } ffmpegprofiles[] = { {"Maximum Quality", "-sameq"}, {"High Quality", "-qmax 2"}, @@ -377,7 +281,12 @@ public: ret << httpProxy; return ret; } +#ifdef Q_OS_WIN + // systemProxyForQuery can take insanely long on Windows (QTBUG-10106) + return QNetworkProxyFactory::proxyForQuery(query); +#else return QNetworkProxyFactory::systemProxyForQuery(query); +#endif } void setHttpProxy (QNetworkProxy proxy) { @@ -433,7 +342,7 @@ QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent) setupProxy(manager); if (cacheSize > 0) { QNetworkDiskCache *cache = new QNetworkDiskCache; - cache->setCacheDirectory(QDir::tempPath()+QLatin1String("/qml-duiviewer-network-cache")); + cache->setCacheDirectory(QDir::tempPath()+QLatin1String("/qml-viewer-network-cache")); cache->setMaximumCacheSize(cacheSize); manager->setCache(cache); } else { @@ -461,15 +370,19 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags) #else : QWidget(parent, flags) #endif - , frame_stream(0), scaleSkin(true), mb(0) - , portraitOrientation(0), landscapeOrientation(0) - , m_scriptOptions(0), tester(0), useQmlFileBrowser(true) + , loggerWindow(new LoggerWidget()) + , frame_stream(0), mb(0) + , orientation(0) + , showWarningsWindow(0) + , m_scriptOptions(0) + , tester(0) + , useQmlFileBrowser(true) + , translator(0) { QDeclarativeViewer::registerTypes(); - setWindowTitle(tr("Qt Qml Runtime")); + setWindowTitle(tr("Qt QML Viewer")); devicemode = false; - skin = 0; canvas = 0; record_autotime = 0; record_rate = 50; @@ -495,6 +408,7 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags) } canvas = new QDeclarativeView(this); + canvas->setAttribute(Qt::WA_OpaquePaintEvent); canvas->setAttribute(Qt::WA_NoSystemBackground); @@ -504,9 +418,12 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags) QObject::connect(canvas, SIGNAL(statusChanged(QDeclarativeView::Status)), this, SLOT(statusChanged())); QObject::connect(canvas->engine(), SIGNAL(quit()), QCoreApplication::instance (), SLOT(quit())); + QObject::connect(warningsWidget(), SIGNAL(opened()), this, SLOT(warningsWidgetOpened())); + QObject::connect(warningsWidget(), SIGNAL(closed()), this, SLOT(warningsWidgetClosed())); + if (!(flags & Qt::FramelessWindowHint)) { createMenu(menuBar(),0); - setPortrait(); + changeOrientation(orientation->actions().value(0)); } #if !defined(Q_OS_SYMBIAN) @@ -526,6 +443,8 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags) connect(&autoStartTimer, SIGNAL(triggered()), this, SLOT(autoStartRecording())); connect(&autoStopTimer, SIGNAL(triggered()), this, SLOT(autoStopRecording())); connect(&recordTimer, SIGNAL(triggered()), this, SLOT(recordFrame())); + connect(DeviceOrientation::instance(), SIGNAL(orientationChanged()), + this, SLOT(orientationChanged()), Qt::QueuedConnection); autoStartTimer.setRunning(false); autoStopTimer.setRunning(false); recordTimer.setRunning(false); @@ -534,10 +453,21 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags) QDeclarativeViewer::~QDeclarativeViewer() { + delete loggerWindow; canvas->engine()->setNetworkAccessManagerFactory(0); delete namFactory; } +void QDeclarativeViewer::enableExperimentalGestures() +{ + canvas->viewport()->grabGesture(Qt::TapGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent); + canvas->viewport()->grabGesture(Qt::TapAndHoldGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent); + canvas->viewport()->grabGesture(Qt::PanGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent); + canvas->viewport()->grabGesture(Qt::PinchGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent); + canvas->viewport()->grabGesture(Qt::SwipeGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent); + canvas->viewport()->setAttribute(Qt::WA_AcceptTouchEvents); +} + int QDeclarativeViewer::menuBarHeight() const { if (!(windowFlags() & Qt::FramelessWindowHint)) @@ -563,6 +493,11 @@ QDeclarativeView *QDeclarativeViewer::view() const return canvas; } +LoggerWidget *QDeclarativeViewer::warningsWidget() const +{ + return loggerWindow; +} + void QDeclarativeViewer::createMenu(QMenuBar *menu, QMenu *flatmenu) { QObject *parent = flatmenu ? (QObject*)flatmenu : (QObject*)menu; @@ -579,12 +514,6 @@ void QDeclarativeViewer::createMenu(QMenuBar *menu, QMenu *flatmenu) connect(reloadAction, SIGNAL(triggered()), this, SLOT(reload())); fileMenu->addAction(reloadAction); -#if defined(Q_OS_SYMBIAN) - QAction *networkAction = new QAction(tr("Start &Network"), parent); - connect(networkAction, SIGNAL(triggered()), this, SLOT(startNetwork())); - fileMenu->addAction(networkAction); -#endif - #if !defined(Q_OS_SYMBIAN) if (flatmenu) flatmenu->addSeparator(); @@ -614,53 +543,17 @@ void QDeclarativeViewer::createMenu(QMenuBar *menu, QMenu *flatmenu) connect(slowAction, SIGNAL(triggered(bool)), this, SLOT(setSlowMode(bool))); debugMenu->addAction(slowAction); - if (flatmenu) flatmenu->addSeparator(); + showWarningsWindow = new QAction(tr("Show Warnings"), parent); + showWarningsWindow->setCheckable((true)); + showWarningsWindow->setChecked(loggerWindow->isVisible()); + connect(showWarningsWindow, SIGNAL(triggered(bool)), this, SLOT(showWarnings(bool))); - QMenu *skinMenu = flatmenu ? flatmenu->addMenu(tr("&Skin")) : menu->addMenu(tr("&Skin")); - - QActionGroup *skinActions; - QAction *skinAction; - - skinActions = new QActionGroup(parent); - skinAction = new QAction(tr("Scale skin"), parent); - skinAction->setCheckable(true); - skinAction->setChecked(scaleSkin); - skinActions->addAction(skinAction); - skinMenu->addAction(skinAction); - connect(skinAction, SIGNAL(triggered()), this, SLOT(setScaleSkin())); - skinAction = new QAction(tr("Resize view"), parent); - skinAction->setCheckable(true); - skinAction->setChecked(!scaleSkin); - skinActions->addAction(skinAction); - skinMenu->addAction(skinAction); - connect(skinAction, SIGNAL(triggered()), this, SLOT(setScaleView())); - skinMenu->addSeparator(); - - skinActions = new QActionGroup(parent); - QSignalMapper *mapper = new QSignalMapper(parent); - skinAction = new QAction(tr("None"), parent); - skinAction->setCheckable(true); - if (currentSkin.isEmpty()) - skinAction->setChecked(true); - skinActions->addAction(skinAction); - skinMenu->addAction(skinAction); - mapper->setMapping(skinAction, ""); - connect(skinAction, SIGNAL(triggered()), mapper, SLOT(map())); - skinMenu->addSeparator(); - - foreach (QString name, builtinSkins()) { - skinAction = new QAction(name, parent); - skinActions->addAction(skinAction); - skinMenu->addAction(skinAction); - skinAction->setCheckable(true); - if (":skin/"+name+".skin" == currentSkin) - skinAction->setChecked(true); - mapper->setMapping(skinAction, name); - connect(skinAction, SIGNAL(triggered()), mapper, SLOT(map())); - } - connect(mapper, SIGNAL(mapped(QString)), this, SLOT(setSkin(QString))); +#if !defined(Q_OS_SYMBIAN) + debugMenu->addAction(showWarningsWindow); +#endif if (flatmenu) flatmenu->addSeparator(); + #endif // Q_OS_SYMBIAN QMenu *settingsMenu = flatmenu ? flatmenu : menu->addMenu(tr("S&ettings")); @@ -670,6 +563,8 @@ void QDeclarativeViewer::createMenu(QMenuBar *menu, QMenu *flatmenu) #if !defined(Q_OS_SYMBIAN) if (!flatmenu) settingsMenu->addAction(recordOptions); + + settingsMenu->addMenu(loggerWindow->preferencesMenu()); #else QAction *fullscreenAction = new QAction(tr("Full Screen"), parent); fullscreenAction->setCheckable(true); @@ -677,27 +572,29 @@ void QDeclarativeViewer::createMenu(QMenuBar *menu, QMenu *flatmenu) settingsMenu->addAction(fullscreenAction); #endif + if (flatmenu) flatmenu->addSeparator(); + QMenu *propertiesMenu = settingsMenu->addMenu(tr("Properties")); - QActionGroup *orientation = new QActionGroup(parent); - QAction *toggleOrientation = new QAction(tr("&Toggle Orientation"), parent); - toggleOrientation->setCheckable(true); - toggleOrientation->setShortcut(QKeySequence("Ctrl+T")); - settingsMenu->addAction(toggleOrientation); - connect(toggleOrientation, SIGNAL(triggered()), this, SLOT(toggleOrientation())); + orientation = new QActionGroup(parent); + + QAction *rotateOrientation = new QAction(tr("Rotate orientation"), parent); + rotateOrientation->setShortcut(QKeySequence("Ctrl+T")); + settingsMenu->addAction(rotateOrientation); + connect(rotateOrientation, SIGNAL(triggered()), this, SLOT(rotateOrientation())); orientation->setExclusive(true); - portraitOrientation = new QAction(tr("orientation: Portrait"), parent); - portraitOrientation->setCheckable(true); - connect(portraitOrientation, SIGNAL(triggered()), this, SLOT(setPortrait())); - orientation->addAction(portraitOrientation); - propertiesMenu->addAction(portraitOrientation); - - landscapeOrientation = new QAction(tr("orientation: Landscape"), parent); - landscapeOrientation->setCheckable(true); - connect(landscapeOrientation, SIGNAL(triggered()), this, SLOT(setLandscape())); - orientation->addAction(landscapeOrientation); - propertiesMenu->addAction(landscapeOrientation); + connect(orientation, SIGNAL(triggered(QAction*)), this, SLOT(changeOrientation(QAction*))); + + orientation->addAction(tr("orientation: Portrait")); + orientation->addAction(tr("orientation: Landscape")); + orientation->addAction(tr("orientation: Portrait (Inverted)")); + orientation->addAction(tr("orientation: Landscape (Inverted)")); + QList<QAction *> actions = orientation->actions(); + for (int i=0; i<actions.count(); i++) { + propertiesMenu->addAction(actions[i]); + actions[i]->setCheckable(true); + } if (flatmenu) flatmenu->addSeparator(); @@ -731,21 +628,16 @@ void QDeclarativeViewer::proxySettingsChanged() reload (); } -void QDeclarativeViewer::setPortrait() -{ - DeviceOrientation::instance()->setOrientation(DeviceOrientation::Portrait); - portraitOrientation->setChecked(true); -} - -void QDeclarativeViewer::setLandscape() +void QDeclarativeViewer::rotateOrientation() { - DeviceOrientation::instance()->setOrientation(DeviceOrientation::Landscape); - landscapeOrientation->setChecked(true); -} + QAction *current = orientation->checkedAction(); + QList<QAction *> actions = orientation->actions(); + int index = actions.indexOf(current); + if (index < 0) + return; -void QDeclarativeViewer::toggleOrientation() -{ - DeviceOrientation::instance()->setOrientation(DeviceOrientation::instance()->orientation()==DeviceOrientation::Portrait?DeviceOrientation::Landscape:DeviceOrientation::Portrait); + QAction *newOrientation = actions[(index + 1) % actions.count()]; + changeOrientation(newOrientation); } void QDeclarativeViewer::toggleFullScreen() @@ -756,30 +648,20 @@ void QDeclarativeViewer::toggleFullScreen() showFullScreen(); } -void QDeclarativeViewer::setScaleSkin() +void QDeclarativeViewer::showWarnings(bool show) { - if (scaleSkin) - return; - scaleSkin = true; - if (skin) { - canvas->resize(initialSize); - canvas->setFixedSize(initialSize); - canvas->setResizeMode(QDeclarativeView::SizeViewToRootObject); - updateSizeHints(); - } + loggerWindow->setVisible(show); } -void QDeclarativeViewer::setScaleView() +void QDeclarativeViewer::warningsWidgetOpened() { - if (!scaleSkin) - return; - scaleSkin = false; - if (skin) { - canvas->setResizeMode(QDeclarativeView::SizeRootObjectToView); - updateSizeHints(); - } + showWarningsWindow->setChecked(true); } +void QDeclarativeViewer::warningsWidgetClosed() +{ + showWarningsWindow->setChecked(false); +} void QDeclarativeViewer::takeSnapShot() { @@ -922,12 +804,12 @@ void QDeclarativeViewer::statusChanged() tester->executefailure(); if (canvas->status() == QDeclarativeView::Ready) { - initialSize = canvas->sizeHint(); + initialSize = canvas->initialSize(); if (canvas->resizeMode() == QDeclarativeView::SizeRootObjectToView) { - QSize newWindowSize = initialSize; - newWindowSize.setHeight(newWindowSize.height()+menuBarHeight()); - updateSizeHints(); - resize(newWindowSize); + if (!isFullScreen() && !isMaximized()) { + resize(QSize(initialSize.width(), initialSize.height()+menuBarHeight())); + updateSizeHints(); + } } } } @@ -937,6 +819,46 @@ void QDeclarativeViewer::launch(const QString& file_or_url) QMetaObject::invokeMethod(this, "open", Qt::QueuedConnection, Q_ARG(QString, file_or_url)); } +void QDeclarativeViewer::loadTranslationFile(const QString& directory) +{ + if (!translator) { + translator = new QTranslator(this); + QApplication::installTranslator(translator); + } + + translator->load(QLatin1String("qml_" )+QLocale::system().name(), directory + QLatin1String("/i18n")); +} + +void QDeclarativeViewer::loadDummyDataFiles(const QString& directory) +{ + QDir dir(directory+"/dummydata", "*.qml"); + QStringList list = dir.entryList(); + for (int i = 0; i < list.size(); ++i) { + QString qml = list.at(i); + QFile f(dir.filePath(qml)); + f.open(QIODevice::ReadOnly); + QByteArray data = f.readAll(); + QDeclarativeComponent comp(canvas->engine()); + comp.setData(data, QUrl()); + QObject *dummyData = comp.create(); + + if(comp.isError()) { + QList<QDeclarativeError> errors = comp.errors(); + foreach (const QDeclarativeError &error, errors) { + qWarning() << error; + } + if (tester) tester->executefailure(); + } + + if (dummyData) { + qWarning() << "Loaded dummy data:" << dir.filePath(qml); + qml.truncate(qml.length()-4); + canvas->rootContext()->setContextProperty(qml, dummyData); + dummyData->setParent(this); + } + } +} + bool QDeclarativeViewer::open(const QString& file_or_url) { currentFileOrUrl = file_or_url; @@ -947,7 +869,7 @@ bool QDeclarativeViewer::open(const QString& file_or_url) url = QUrl::fromLocalFile(fi.absoluteFilePath()); else url = QUrl(file_or_url); - setWindowTitle(tr("%1 - Qt Qml Runtime").arg(file_or_url)); + setWindowTitle(tr("%1 - Qt QML Viewer").arg(file_or_url)); if (!m_script.isEmpty()) tester = new QDeclarativeTester(m_script, m_scriptOptions, canvas); @@ -966,39 +888,16 @@ bool QDeclarativeViewer::open(const QString& file_or_url) QString fileName = url.toLocalFile(); if (!fileName.isEmpty()) { - QFileInfo fi(fileName); + fi.setFile(fileName); if (fi.exists()) { if (fi.suffix().toLower() != QLatin1String("qml")) { qWarning() << "qml cannot open non-QML file" << fileName; return false; } - QDir dir(fi.path()+"/dummydata", "*.qml"); - QStringList list = dir.entryList(); - for (int i = 0; i < list.size(); ++i) { - QString qml = list.at(i); - QFile f(dir.filePath(qml)); - f.open(QIODevice::ReadOnly); - QByteArray data = f.readAll(); - QDeclarativeComponent comp(canvas->engine()); - comp.setData(data, QUrl()); - QObject *dummyData = comp.create(); - - if(comp.isError()) { - QList<QDeclarativeError> errors = comp.errors(); - foreach (const QDeclarativeError &error, errors) { - qWarning() << error; - } - if (tester) tester->executefailure(); - } - - if (dummyData) { - qWarning() << "Loaded dummy data:" << dir.filePath(qml); - qml.truncate(qml.length()-4); - ctxt->setContextProperty(qml, dummyData); - dummyData->setParent(this); - } - } + QFileInfo fi(fileName); + loadTranslationFile(fi.path()); + loadDummyDataFiles(fi.path()); } else { qWarning() << "qml cannot find file:" << fileName; return false; @@ -1013,90 +912,6 @@ bool QDeclarativeViewer::open(const QString& file_or_url) return true; } -void QDeclarativeViewer::startNetwork() -{ -#if defined(SYMBIAN_NETWORK_INIT) - qt_SetDefaultIap(); -#endif -} - -QStringList QDeclarativeViewer::builtinSkins() const -{ - QDir dir(":/skins/","*.skin"); - const QFileInfoList l = dir.entryInfoList(); - QStringList r; - for (QFileInfoList::const_iterator it = l.begin(); it != l.end(); ++it) { - r += (*it).baseName(); - } - return r; -} - -void QDeclarativeViewer::setSkin(const QString& skinDirOrName) -{ - QString skinDirectory = skinDirOrName; - - if (!QDir(skinDirOrName).exists() && QDir(":/skins/"+skinDirOrName+".skin").exists()) - skinDirectory = ":/skins/"+skinDirOrName+".skin"; - - if (currentSkin == skinDirectory) - return; - - currentSkin = skinDirectory; - - // XXX QWidget::setMask does not handle changes well, and we may - // XXX have been signalled from an item in a menu we're replacing, - // XXX hence some rather convoluted resetting here... - - QString err; - if (skin) { - skin->hide(); - skin->deleteLater(); - } - - DeviceSkinParameters parameters; - if (!skinDirectory.isEmpty() && parameters.read(skinDirectory,DeviceSkinParameters::ReadAll,&err)) { - layout()->setEnabled(false); - if (mb) - mb->hide(); - if (!err.isEmpty()) - qWarning() << err; - skin = new PreviewDeviceSkin(parameters,this); - if (scaleSkin) - skin->setPreviewAndScale(canvas); - else - skin->setPreview(canvas); - createMenu(0,skin->menu); - if (scaleSkin) { - canvas->setResizeMode(QDeclarativeView::SizeViewToRootObject); - } - updateSizeHints(); - skin->show(); - } else if (skin) { - skin = 0; - clearMask(); - if ((windowFlags() & Qt::FramelessWindowHint)) { - menuBar()->clear(); - createMenu(menuBar(),0); - } - canvas->setParent(this, Qt::SubWindow); - setParent(0,windowFlags()); // recreate - 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()+menuBarHeight()); - resize(newWindowSize); - show(); - } - canvas->show(); -} - void QDeclarativeViewer::setAutoRecord(int from, int to) { if (from==0) from=1; // ensure resized @@ -1126,7 +941,7 @@ void QDeclarativeViewer::sceneResized(QSize size) if (canvas->resizeMode() == QDeclarativeView::SizeViewToRootObject) { updateSizeHints(); } - } + } } void QDeclarativeViewer::keyPressEvent(QKeyEvent *event) @@ -1155,12 +970,7 @@ void QDeclarativeViewer::keyPressEvent(QKeyEvent *event) } else if (event->key() == Qt::Key_F9 || (event->key() == Qt::Key_9 && devicemode)) { toggleRecording(); } else if (event->key() == Qt::Key_F10) { - if (portraitOrientation) { - if (portraitOrientation->isChecked()) - setLandscape(); - else - setPortrait(); - } + rotateOrientation(); } QWidget::keyPressEvent(event); @@ -1365,6 +1175,36 @@ void QDeclarativeViewer::recordFrame() } } +void QDeclarativeViewer::changeOrientation(QAction *action) +{ + if (!action) + return; + action->setChecked(true); + + QString o = action->text().split(QLatin1Char(':')).value(1).trimmed(); + if (o == QLatin1String("Portrait")) + DeviceOrientation::instance()->setOrientation(DeviceOrientation::Portrait); + else if (o == QLatin1String("Landscape")) + DeviceOrientation::instance()->setOrientation(DeviceOrientation::Landscape); + else if (o == QLatin1String("Portrait (Inverted)")) + DeviceOrientation::instance()->setOrientation(DeviceOrientation::PortraitInverted); + else if (o == QLatin1String("Landscape (Inverted)")) + DeviceOrientation::instance()->setOrientation(DeviceOrientation::LandscapeInverted); +} + +void QDeclarativeViewer::orientationChanged() +{ + if (canvas->resizeMode() == QDeclarativeView::SizeRootObjectToView) { + if (canvas->rootObject()) { + QSizeF rootObjectSize = canvas->rootObject()->boundingRect().size(); + QSize newSize(rootObjectSize.width(), rootObjectSize.height()+menuBarHeight()); + if (size() != newSize) { + resize(newSize); + } + } + } +} + void QDeclarativeViewer::setDeviceKeys(bool on) { devicemode = on; @@ -1387,7 +1227,8 @@ void QDeclarativeViewer::setUseGL(bool useGL) #endif QGLWidget *glWidget = new QGLWidget(format); - glWidget->setAutoFillBackground(false); + //### potentially faster, but causes junk to appear if top-level is Item, not Rectangle + //glWidget->setAutoFillBackground(false); canvas->setViewport(glWidget); } @@ -1412,26 +1253,17 @@ void QDeclarativeViewer::updateSizeHints() { if (canvas->resizeMode() == QDeclarativeView::SizeViewToRootObject) { QSize newWindowSize = canvas->sizeHint(); - if (!skin) - newWindowSize.setHeight(newWindowSize.height()+menuBarHeight()); + newWindowSize.setHeight(newWindowSize.height()+menuBarHeight()); 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() diff --git a/tools/qml/qmlruntime.h b/tools/qml/qmlruntime.h index 2a0a07dae5..27bd217f52 100644 --- a/tools/qml/qmlruntime.h +++ b/tools/qml/qmlruntime.h @@ -48,6 +48,8 @@ #include <QTime> #include <QList> +#include "loggerwidget.h" + QT_BEGIN_NAMESPACE class QDeclarativeView; @@ -59,6 +61,7 @@ class QDeclarativeTester; class QNetworkReply; class QNetworkCookieJar; class NetworkAccessManagerFactory; +class QTranslator; class QDeclarativeViewer #if defined(Q_OS_SYMBIAN) @@ -102,11 +105,13 @@ public: void setUseNativeFileBrowser(bool); void updateSizeHints(); void setSizeToView(bool sizeToView); - QStringList builtinSkins() const; QMenuBar *menuBar() const; QDeclarativeView *view() const; + LoggerWidget *warningsWidget() const; + + void enableExperimentalGestures(); public slots: void sceneResized(QSize size); @@ -117,10 +122,9 @@ public slots: void toggleRecording(); void toggleRecordingWithSelection(); void ffmpegFinished(int code); - void setSkin(const QString& skinDirectory); void showProxySettings (); void proxySettingsChanged (); - void setScaleView(); + void rotateOrientation(); void statusChanged(); void setSlowMode(bool); void launch(const QString &); @@ -128,7 +132,6 @@ public slots: protected: virtual void keyPressEvent(QKeyEvent *); virtual bool event(QEvent *); - void createMenu(QMenuBar *menu, QMenu *flatmenu); private slots: @@ -137,19 +140,19 @@ private slots: void recordFrame(); void chooseRecordingOptions(); void pickRecordingFile(); - void setScaleSkin(); - void setPortrait(); - void setLandscape(); - void toggleOrientation(); - void startNetwork(); void toggleFullScreen(); + void changeOrientation(QAction*); + void orientationChanged(); + + void showWarnings(bool show); + void warningsWidgetOpened(); + void warningsWidgetClosed(); private: QString getVideoFileName(); int menuBarHeight() const; - PreviewDeviceSkin *skin; - QSize skinscreensize; + LoggerWidget *loggerWindow; QDeclarativeView *canvas; QSize initialSize; QString currentFileOrUrl; @@ -179,8 +182,8 @@ private: bool ffmpegAvailable; bool convertAvailable; - QAction *portraitOrientation; - QAction *landscapeOrientation; + QActionGroup *orientation; + QAction *showWarningsWindow; QString m_script; ScriptOptions m_scriptOptions; @@ -188,10 +191,14 @@ private: QNetworkReply *wgtreply; QString wgtdir; - NetworkAccessManagerFactory *namFactory; bool useQmlFileBrowser; + + QTranslator *translator; + void loadTranslationFile(const QString& directory); + + void loadDummyDataFiles(const QString& directory); }; Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativeViewer::ScriptOptions) diff --git a/tools/runonphone/main.cpp b/tools/runonphone/main.cpp index 37e4548dc2..885d0294a5 100644 --- a/tools/runonphone/main.cpp +++ b/tools/runonphone/main.cpp @@ -102,6 +102,10 @@ int main(int argc, char *argv[]) else if (arg == "--sis" || arg == "-s") { CHECK_PARAMETER_EXISTS sisFile = it.next(); + if (!QFileInfo(sisFile).exists()) { + errstream << "Sis file (" << sisFile << ") doesn't exist" << endl; + return 1; + } } else if (arg == "--download" || arg == "-d") { CHECK_PARAMETER_EXISTS diff --git a/tools/runonphone/symbianutils/launcher.cpp b/tools/runonphone/symbianutils/launcher.cpp index fa509e721a..ecb067eb8a 100644 --- a/tools/runonphone/symbianutils/launcher.cpp +++ b/tools/runonphone/symbianutils/launcher.cpp @@ -365,8 +365,22 @@ void Launcher::handleResult(const TrkResult &result) QByteArray prefix = "READ BUF: "; QByteArray str = result.toString().toUtf8(); if (result.isDebugOutput) { // handle application output - logMessage("APPLICATION OUTPUT: " + result.data); - emit applicationOutputReceived(result.data); + QString msg; + if (result.multiplex == MuxTextTrace) { + if (result.data.length() > 8) { + quint64 timestamp = extractInt64(result.data) & 0x0FFFFFFFFFFFFFFFULL; + quint64 secs = timestamp / 1000000000; + quint64 ns = timestamp % 1000000000; + msg = QString("[%1.%2] %3").arg(secs).arg(ns).arg(QString(result.data.mid(8))); + logMessage("TEXT TRACE: " + msg); + } + } else { + logMessage("APPLICATION OUTPUT: " + result.data); + msg = result.data; + } + msg.replace("\r\n", "\n"); + if(!msg.endsWith('\n')) msg.append('\n'); + emit applicationOutputReceived(msg); return; } switch (result.code) { diff --git a/tools/runonphone/symbianutils/trkutils.cpp b/tools/runonphone/symbianutils/trkutils.cpp index 9b43c96359..60e391ebdf 100644 --- a/tools/runonphone/symbianutils/trkutils.cpp +++ b/tools/runonphone/symbianutils/trkutils.cpp @@ -276,14 +276,13 @@ QByteArray frameMessage(byte command, byte token, const QByteArray &data, bool s /* returns 0 if array doesn't represent a result, otherwise returns the length of the result data */ -ushort isValidTrkResult(const QByteArray &buffer, bool serialFrame) +ushort isValidTrkResult(const QByteArray &buffer, bool serialFrame, ushort& mux) { if (serialFrame) { // Serial protocol with length info if (buffer.length() < 4) return 0; - if (buffer.at(0) != 0x01 || byte(buffer.at(1)) != 0x90) - return 0; + mux = extractShort(buffer.data()); const ushort len = extractShort(buffer.data() + 2); return (buffer.size() >= len + 4) ? len : ushort(0); } @@ -292,6 +291,7 @@ ushort isValidTrkResult(const QByteArray &buffer, bool serialFrame) const int firstDelimiterPos = buffer.indexOf(delimiter); // Regular message delimited by 0x7e..0x7e if (firstDelimiterPos == 0) { + mux = MuxTrk; const int endPos = buffer.indexOf(delimiter, firstDelimiterPos + 1); return endPos != -1 ? endPos + 1 - firstDelimiterPos : 0; } @@ -304,7 +304,7 @@ bool extractResult(QByteArray *buffer, bool serialFrame, TrkResult *result, QByt result->clear(); if(rawData) rawData->clear(); - const ushort len = isValidTrkResult(*buffer, serialFrame); + const ushort len = isValidTrkResult(*buffer, serialFrame, result->multiplex); if (!len) return false; // handle receiving application output, which is not a regular command @@ -312,7 +312,6 @@ bool extractResult(QByteArray *buffer, bool serialFrame, TrkResult *result, QByt if (buffer->at(delimiterPos) != 0x7e) { result->isDebugOutput = true; result->data = buffer->mid(delimiterPos, len); - result->data.replace("\r\n", "\n"); *buffer->remove(0, delimiterPos + len); return true; } @@ -353,6 +352,19 @@ SYMBIANUTILS_EXPORT uint extractInt(const char *data) return res; } +SYMBIANUTILS_EXPORT quint64 extractInt64(const char *data) +{ + quint64 res = byte(data[0]); + res <<= 8; res += byte(data[1]); + res <<= 8; res += byte(data[2]); + res <<= 8; res += byte(data[3]); + res <<= 8; res += byte(data[4]); + res <<= 8; res += byte(data[5]); + res <<= 8; res += byte(data[6]); + res <<= 8; res += byte(data[7]); + return res; +} + SYMBIANUTILS_EXPORT QString quoteUnprintableLatin1(const QByteArray &ba) { QString res; diff --git a/tools/runonphone/symbianutils/trkutils.h b/tools/runonphone/symbianutils/trkutils.h index 553fc7d407..e57102887a 100644 --- a/tools/runonphone/symbianutils/trkutils.h +++ b/tools/runonphone/symbianutils/trkutils.h @@ -135,9 +135,16 @@ enum Command { TrkDSPositionFile = 0xd4 }; +enum SerialMultiplexor { + MuxRaw = 0, + MuxTextTrace = 0x0102, + MuxTrk = 0x0190 +}; + inline byte extractByte(const char *data) { return *data; } SYMBIANUTILS_EXPORT ushort extractShort(const char *data); SYMBIANUTILS_EXPORT uint extractInt(const char *data); +SYMBIANUTILS_EXPORT quint64 extractInt64(const char *data); SYMBIANUTILS_EXPORT QString quoteUnprintableLatin1(const QByteArray &ba); @@ -217,6 +224,7 @@ struct SYMBIANUTILS_EXPORT TrkResult int errorCode() const; QString errorString() const; + ushort multiplex; byte code; byte token; QByteArray data; diff --git a/tools/shared/deviceskin/deviceskin.pri b/tools/shared/deviceskin/deviceskin.pri index 2552c922b0..3e9935abbb 100644 --- a/tools/shared/deviceskin/deviceskin.pri +++ b/tools/shared/deviceskin/deviceskin.pri @@ -2,13 +2,10 @@ INCLUDEPATH += $$PWD HEADERS += $$PWD/deviceskin.h SOURCES += $$PWD/deviceskin.cpp RESOURCES += $$PWD/skins/ClamshellPhone.qrc \ - $$PWD/skins/PDAPhone.qrc \ $$PWD/skins/SmartPhone2.qrc \ $$PWD/skins/SmartPhone.qrc \ $$PWD/skins/SmartPhoneWithButtons.qrc \ $$PWD/skins/TouchscreenPhone.qrc \ - $$PWD/skins/Trolltech-Keypad.qrc \ - $$PWD/skins/Trolltech-Touchscreen.qrc \ $$PWD/skins/PortableMedia.qrc \ $$PWD/skins/S60-QVGA-Candybar.qrc \ $$PWD/skins/S60-nHD-Touchscreen.qrc diff --git a/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreen-pressed.png b/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreen-pressed.png Binary files differdeleted file mode 100644 index d62ef4a8d3..0000000000 --- a/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreen-pressed.png +++ /dev/null diff --git a/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreen.png b/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreen.png Binary files differdeleted file mode 100644 index cb3d1a72a4..0000000000 --- a/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreen.png +++ /dev/null diff --git a/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreenPhone.skin b/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreenPhone.skin deleted file mode 100644 index a82ef23880..0000000000 --- a/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreenPhone.skin +++ /dev/null @@ -1,29 +0,0 @@ -[SkinFile] -Up=DualScreen.png -Down=DualScreen-pressed.png -Screen=128 155 176 208 -BackScreen=18 44 98 119 -Areas=21 -HasMouseHover=false - -"Context1" 0x1100000 144 368 189 368 168 396 176 427 150 398 -"Back" 0x1000061 245 365 291 366 283 398 258 424 265 394 -"Select" 0x1010000 202 401 210 389 224 388 233 402 224 415 208 415 -"Up" 0x1000013 202 381 196 374 218 363 239 373 229 382 -"Left" 0x1000012 199 385 189 375 176 403 185 426 197 415 194 401 -"Right" 0x1000014 235 390 248 379 253 402 246 421 238 413 -"Down" 0x1000015 204 421 233 422 241 432 214 443 191 430 -"Call" 0x1100004 163 452 137 450 125 465 136 484 159 485 169 467 -"Hangup" 0x1100005 266 475 279 448 295 447 309 460 301 480 289 487 -"1" 0x31 175 514 147 504 133 518 161 532 180 534 -"2" 0x32 199 515 229 519 238 533 222 540 195 538 -"2" 0x32 260 512 286 506 299 513 284 527 264 535 248 525 -"4" 0x34 164 541 177 546 182 560 164 565 146 560 135 545 154 539 -"5" 0x35 204 546 225 546 243 560 231 574 205 573 191 558 -"6" 0x36 257 547 281 537 294 540 287 555 274 566 254 561 -"7" 0x37 145 569 176 578 177 595 156 597 138 584 -"8" 0x38 197 582 229 584 241 593 226 604 201 603 189 594 -"9" 0x39 253 577 288 564 301 578 283 593 259 597 251 586 -"*" 0x2a 145 598 181 611 182 623 163 632 144 623 138 607 -"0" 0x30 196 611 233 613 240 630 220 642 193 637 191 622 -"#" 0x23 255 610 286 600 302 615 279 625 258 629 247 616 diff --git a/tools/shared/deviceskin/skins/DualScreenPhone.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/DualScreenPhone.skin/defaultbuttons.conf deleted file mode 100644 index 1103350557..0000000000 --- a/tools/shared/deviceskin/skins/DualScreenPhone.skin/defaultbuttons.conf +++ /dev/null @@ -1,78 +0,0 @@ -[Translation] -File=QtopiaDefaults -Context=Buttons -[Menu] -Rows=4 -Columns=3 -Map=123456789*0# -Default=5 -1=Applications/camera.desktop -2=Applications/datebook.desktop -3=Applications -4=Applications/qtmail.desktop -5=Applications/addressbook.desktop -6=Games -7=Settings/Beaming.desktop -8=Applications/simapp.desktop,Applications/calculator.desktop -9=Settings -*=Applications/mediarecorder.desktop -0=Applications/todolist.desktop -#=Documents -Animator=Bounce -AnimatorBackground=Radial -[SoftKeys] -Count=3 -Key0=Context1 -Key1=Select -Key2=Back -[SystemButtons] -Count=5 -Key0=Context1 -Key1=Select -Key2=Back -Key3=Call -Key4=Hangup -[TextButtons] -Buttons=0123456789*# -Hold0='0 -Hold1='1 -Hold2='2 -Hold3='3 -Hold4='4 -Hold5='5 -Hold6='6 -Hold7='7 -Hold8='8 -Hold9='9 -Hold*=symbol -Hold#=mode -Tap0=space -Tap1="\".,'?!-@:1" -Tap2="\"a\xe4\xe5\xe6\xe0\xe1\xe2\x62\x63\xe7\x32" -Tap3="\"de\xe8\xe9\xea\x66\x33" -Tap4="\"ghi\xec\xed\xee\x34" -Tap5="\"jkl5" -Tap6="\"mn\xf1o\xf6\xf8\xf2\xf3\x36" -Tap7="\"pqrs\xdf\x37" -Tap8="\"tu\xfc\xf9\xfav8" -Tap9="\"wxyz9" -Tap*=modify -Tap#=shift -[LocaleTextButtons] -Buttons=23456789 -Tap2[]='abc -Tap3[]='def -Tap4[]='ghi -Tap5[]='jkl -Tap6[]='mno -Tap7[]='pqrs -Tap8[]='tuv -Tap9[]='wxyz -[PhoneTextButtons] -Buttons=*# -Tap*='*+pw -Hold*=+ -Tap#='# -Hold#=mode -[Device] -PrimaryInput=Keypad diff --git a/tools/shared/deviceskin/skins/PDAPhone.qrc b/tools/shared/deviceskin/skins/PDAPhone.qrc deleted file mode 100644 index 1a1c35a582..0000000000 --- a/tools/shared/deviceskin/skins/PDAPhone.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource prefix="/skins"> - <file>PDAPhone.skin</file> -</qresource> -</RCC> diff --git a/tools/shared/deviceskin/skins/PDAPhone.skin/PDAPhone.skin b/tools/shared/deviceskin/skins/PDAPhone.skin/PDAPhone.skin deleted file mode 100644 index d6a1966594..0000000000 --- a/tools/shared/deviceskin/skins/PDAPhone.skin/PDAPhone.skin +++ /dev/null @@ -1,18 +0,0 @@ -[SkinFile] -Up=pda_up.png -Down=pda_down.png -Screen=42 59 176 220 -Cursor=finger.png 20 20 -Areas=10 -HasMouseHover=false - -"Power" 0x0100000a 117 21 141 42 -"Context1" 0x01100000 43 284 74 315 -"Call" 0x01100004 74 284 104 315 -"Hangup" 0x01100005 154 284 184 315 -"Back" 0x01000061 184 284 214 315 -"Left" 0x1000012 123 315 110 326 106 307 113 288 123 300 120 307 -"Down" 0x1000015 123 315 130 318 138 315 150 326 129 335 111 325 -"Right" 0x1000014 137 301 149 290 155 308 150 324 138 315 140 308 -"Up" 0x1000013 123 300 112 289 130 282 149 290 137 300 130 298 -"Select" 0x01010000 131 298 137 300 140 307 138 315 130 318 123 316 120 307 123 300 diff --git a/tools/shared/deviceskin/skins/PDAPhone.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/PDAPhone.skin/defaultbuttons.conf deleted file mode 100644 index e3ae813df2..0000000000 --- a/tools/shared/deviceskin/skins/PDAPhone.skin/defaultbuttons.conf +++ /dev/null @@ -1,36 +0,0 @@ -[Translation] -File=QtopiaDefaults -Context=Buttons -[Menu] -Rows=4 -Columns=3 -Map=123456789*0# -Default=5 -1=Applications/camera.desktop -2=Applications/datebook.desktop -3=Applications -4=Applications/qtmail.desktop -5=Applications/addressbook.desktop -6=Games -7=Settings/Beaming.desktop -8=Applications/simapp.desktop,Applications/calculator.desktop -9=Settings -*=Applications/mediarecorder.desktop -0=Applications/todolist.desktop -#=Documents -Animator=Bounce -AnimatorBackground=Radial -[SoftKeys] -Count=3 -Key0=Context1 -Key1=Select -Key2=Back -[SystemButtons] -Count=5 -Key0=Context1 -Key1=Back -Key2=Select -Key3=Call -Key4=Hangup -[Device] -PrimaryInput=Touchscreen diff --git a/tools/shared/deviceskin/skins/PDAPhone.skin/finger.png b/tools/shared/deviceskin/skins/PDAPhone.skin/finger.png Binary files differdeleted file mode 100644 index 24cf0cb2eb..0000000000 --- a/tools/shared/deviceskin/skins/PDAPhone.skin/finger.png +++ /dev/null diff --git a/tools/shared/deviceskin/skins/PDAPhone.skin/pda_down.png b/tools/shared/deviceskin/skins/PDAPhone.skin/pda_down.png Binary files differdeleted file mode 100644 index f65c059302..0000000000 --- a/tools/shared/deviceskin/skins/PDAPhone.skin/pda_down.png +++ /dev/null diff --git a/tools/shared/deviceskin/skins/PDAPhone.skin/pda_up.png b/tools/shared/deviceskin/skins/PDAPhone.skin/pda_up.png Binary files differdeleted file mode 100644 index 541e3c404f..0000000000 --- a/tools/shared/deviceskin/skins/PDAPhone.skin/pda_up.png +++ /dev/null diff --git a/tools/shared/deviceskin/skins/Trolltech-Keypad.qrc b/tools/shared/deviceskin/skins/Trolltech-Keypad.qrc deleted file mode 100644 index 4775068cff..0000000000 --- a/tools/shared/deviceskin/skins/Trolltech-Keypad.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource prefix="/skins"> - <file>Trolltech-Keypad.skin</file> -</qresource> -</RCC> diff --git a/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad-closed.png b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad-closed.png Binary files differdeleted file mode 100644 index 8dd5719341..0000000000 --- a/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad-closed.png +++ /dev/null diff --git a/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad-down.png b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad-down.png Binary files differdeleted file mode 100644 index 5e1e6beff8..0000000000 --- a/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad-down.png +++ /dev/null diff --git a/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad.png b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad.png Binary files differdeleted file mode 100644 index fb3d549759..0000000000 --- a/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad.png +++ /dev/null diff --git a/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad.skin b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad.skin deleted file mode 100644 index 4d90321f98..0000000000 --- a/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad.skin +++ /dev/null @@ -1,35 +0,0 @@ -[SkinFile] -Up=Trolltech-Keypad.png -Down=Trolltech-Keypad-down.png -Closed=Trolltech-Keypad-closed.png -ClosedAreas=F1 F2 F3 Flip -ClosedScreen=95 456 128 96 -Screen=75 85 176 220 -Areas=25 -HasMouseHover=false -"1" 0x0031 65 542 68 536 76 532 114 536 114 573 64 568 -"2" 0x0032 133 537 188 574 -"3" 0x0033 206 536 246 532 252 536 256 542 258 569 205 572 -"4" 0x0034 64 578 114 618 -"5" 0x0035 133 581 188 618 -"6" 0x0036 206 580 256 577 258 613 206 616 -"7" 0x0037 66 622 116 625 114 662 66 658 -"8" 0x0038 133 626 188 662 -"9" 0x0039 206 625 256 622 256 658 206 661 -"*" 0x002a 68 667 116 670 114 705 86 699 76 693 69 686 -"0" 0x0030 133 671 188 708 -"#" 0x0023 206 670 254 665 254 684 245 692 232 699 206 704 -"Context1" 0x01100000 69 420 75 410 85 404 101 404 102 458 69 458 -"Back" 0x01000061 218 404 234 404 240 408 248 418 248 456 218 457 -"Home" 0x1000010 140 494 180 514 -"Hangup" 0x01100005 218 457 248 456 248 496 243 507 230 514 194 514 194 494 206 492 213 486 218 478 -"Call" 0x01100004 68 458 102 460 102 479 108 487 118 492 126 494 126 514 86 514 77 507 72 496 -"Select" 0x01010000 138 426 182 458 -"Up" 0x1000013 118 406 201 402 184 423 134 422 -"Right" 0x1000014 184 424 201 402 202 476 184 460 -"Down" 0x1000015 135 462 184 461 199 477 118 477 -"Left" 0x1000012 118 406 134 424 134 461 117 476 -"F1" 0x1000030 0 408 45 456 -"F2" 0x1000031 0 456 45 509 -"F3" 0x1000032 0 545 45 582 -"Flip" 0x1100006 32 353 293 386 diff --git a/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/defaultbuttons.conf deleted file mode 100644 index 6a78e67c3e..0000000000 --- a/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/defaultbuttons.conf +++ /dev/null @@ -1,142 +0,0 @@ -[Translation] -File=QtopiaDefaults -Context=Buttons -[Button] -Count=8 -[Button7] -Name[]=Home Down Button -Key=Down -Context=HomeScreen -PressedActionMappable=0 -HeldActionService=Messaging -HeldActionMessage=raise() -[Button6] -Name[]=Home Up Button -Key=Up -Context=HomeScreen -PressedActionMappable=0 -HeldActionService=Contacts -HeldActionMessage=raise() -[Button5] -Name[]=Home Right Button -Key=Right -Context=HomeScreen -PressedActionMappable=0 -HeldActionService=mediaplayer -HeldActionMessage=raise() -[Button4] -Name[]=Calender Button -Key=Left -Context=HomeScreen -PressedActionMappable=0 -HeldActionService=Calendar -HeldActionMessage=raiseToday() -[Button3] -Name[]=Left Soft Key -Key=Context1 -HeldActionService=TaskManager -HeldActionMessage=showRunningTasks() -HeldActionMappable=0 -PressActionMappable=0 -[Button2] -Name[]=VoiceNotes Button -Key=F1 -PressedActionService=mediarecorder -PressedActionMessage=raise() -HeldActionService=mediarecorder -HeldActionMessage=newEvent() -[Button1] -Name[]=Camera Button -Key=F2 -PressedActionService=Camera -PressedActionMessage=raise() -HeldActionService=Tasks -HeldActionMessage=newTask() -[Button0] -Name[]=Home Button -Key=Home -PressedActionMappable=0 -PressedActionService=TaskManager -PressedActionMessage=multitask() -HeldActionMappable=0 -HeldActionService=TaskManager -HeldActionMessage=showRunningTasks() -[Menu] -Rows=4 -Columns=3 -Map=123456789*0# -Default=5 -1=Applications/camera.desktop -2=Applications/mediaplayer.desktop -3=Applications/simapp.desktop,Applications/calculator.desktop -4=Applications/qtmail.desktop -5=Applications/addressbook.desktop -6=Applications/datebook.desktop -7=Games -8=Settings/Beaming.desktop -9=Applications/todolist.desktop -*=Settings -0=Applications -#=Documents -Animator=Bounce -AnimatorBackground=Radial -[SoftKeys] -Count=3 -Key0=Context1 -Key1=Select -Key2=Back -[SystemButtons] -Count=6 -Key0=Context1 -Key1=Select -Key2=Back -Key3=Call -Key4=Hangup -Key5=Flip -[TextButtons] -Buttons=0123456789*# -Hold0='0 -Hold1='1 -Hold2='2 -Hold3='3 -Hold4='4 -Hold5='5 -Hold6='6 -Hold7='7 -Hold8='8 -Hold9='9 -Hold*=symbol -Hold#=mode -Tap0=space -Tap0=space -Tap1="\".,'?!-@:1" -Tap2="\"a\xe4\xe5\xe6\xe0\xe1\xe2\x62\x63\xe7\x32" -Tap3="\"de\xe8\xe9\xea\x66\x33" -Tap4="\"ghi\xec\xed\xee\x34" -Tap5="\"jkl5" -Tap6="\"mn\xf1o\xf6\xf8\xf2\xf3\x36" -Tap7="\"pqrs\xdf\x37" -Tap8="\"tu\xfc\xf9\xfav8" -Tap9="\"wxyz9" -Tap*=modify -Tap#=shift -[LocaleTextButtons] -Buttons=23456789 -Tap2[]='abc -Tap3[]='def -Tap4[]='ghi -Tap5[]='jkl -Tap6[]='mno -Tap7[]='pqrs -Tap8[]='tuv -Tap9[]='wxyz -[PhoneTextButtons] -Buttons=*# -Tap*='*+pw -Hold*=+ -Tap#='# -Hold#=mode -[Device] -PrimaryInput=Keypad -[Environment] -QWS_DISPLAY=Multi: LinuxFb:mmHeight57:0 LinuxFb:offset=0,320:1 :0 diff --git a/tools/shared/deviceskin/skins/Trolltech-Touchscreen.qrc b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.qrc deleted file mode 100644 index 40fafeb7ed..0000000000 --- a/tools/shared/deviceskin/skins/Trolltech-Touchscreen.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource prefix="/skins"> - <file>Trolltech-Touchscreen.skin</file> -</qresource> -</RCC> diff --git a/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen-down.png b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen-down.png Binary files differdeleted file mode 100644 index c1a422f4eb..0000000000 --- a/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen-down.png +++ /dev/null diff --git a/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.png b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.png Binary files differdeleted file mode 100644 index 544a425162..0000000000 --- a/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.png +++ /dev/null diff --git a/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.skin b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.skin deleted file mode 100644 index 5de882eed6..0000000000 --- a/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.skin +++ /dev/null @@ -1,17 +0,0 @@ -[SkinFile] -Up=Trolltech-Touchscreen.png -Down=Trolltech-Touchscreen-down.png -Screen=40 109 176 220 -Areas=10 -HasMouseHover=false - -"Context1" 0x01100000 38 420 44 408 52 404 68 403 68 458 40 458 -"Back" 0x01000061 185 42 202 398 211 410 216 418 219 456 186 456 -"Call" 0x01100004 38 458 70 458 71 478 75 486 83 492 94 494 94 516 56 516 45 507 38 498 -"Hangup" 0x01100005 186 458 220 458 220 496 214 508 200 516 162 516 161 494 172 492 180 486 185 478 -"Left" 0x1000012 86 405 106 426 106 461 85 478 -"Down" 0x1000015 106 460 151 460 170 480 85 480 -"Right" 0x1000014 151 424 170 404 170 480 151 460 -"Up" 0x1000013 85 403 168 403 150 424 106 424 -"Select" 0x01010000 106 426 150 456 -"Home" 0x1000010 105 493 145 512 diff --git a/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/defaultbuttons.conf deleted file mode 100644 index 6665125c90..0000000000 --- a/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/defaultbuttons.conf +++ /dev/null @@ -1,53 +0,0 @@ -[Translation] -File=QtopiaDefaults -Context=Buttons -[Menu] -Rows=4 -Columns=3 -Map=123456789*0# -Default=5 -1=Applications/camera.desktop -2=Applications/mediaplayer.desktop -3=Applications/simapp.desktop,Applications/calculator.desktop -4=Applications/qtmail.desktop -5=Applications/addressbook.desktop -6=Applications/datebook.desktop -7=Games -8=Settings/beaming.desktop -9=Applications/todolist.desktop -*=Settings -0=Applications -#=Documents -Animator=Bounce -AnimatorBackground=Radial -[SoftKeys] -Count=3 -Key0=Context1 -Key1=Select -Key2=Back -[SystemButtons] -Count=5 -Key0=Context1 -Key1=Back -Key2=Select -Key3=Call -Key4=Hangup -[Device] -PrimaryInput=Touchscreen -[Button] -Count=2 -[Button0] -Name[]=Home Button -Key=Home -PressedActionMappable=0 -PressedActionService=TaskManager -PressedActionMessage=multitask() -HeldActionMappable=0 -HeldActionService=TaskManager -HeldActionMessage=showRunningTasks() -[Button1] -Name=Power Button -Key=Hangup -HeldActionService=Launcher -HeldActionMessage=execute(QString) -HeldActionArgs=@ByteArray(\0\0\0\x1\0\0\0\n\0\0\0\0\x10\0s\0h\0u\0t\0\x64\0o\0w\0n) diff --git a/tools/shared/symbian/epocroot.cpp b/tools/shared/symbian/epocroot.cpp index 071477d43a..ae1dcb1ec0 100644 --- a/tools/shared/symbian/epocroot.cpp +++ b/tools/shared/symbian/epocroot.cpp @@ -105,10 +105,6 @@ static void fixEpocRoot(QString &path) { path.replace("\\", "/"); - if (path.size() > 1 && path[1] == QChar(':')) { - path = path.mid(2); - } - if (!path.size() || path[path.size()-1] != QChar('/')) { path += QChar('/'); } @@ -153,10 +149,13 @@ QString epocRoot() while (!(xml.isEndElement() && xml.name() == "devices") && !xml.atEnd()) { xml.readNext(); if (xml.isStartElement() && xml.name() == "device") { - const bool isDefault = xml.attributes().value("default") == "yes"; + const bool isDefault = xml.attributes().value("default") == "yes"; const QString id = xml.attributes().value("id").toString(); - const QString name = xml.attributes().value("name").toString(); - const bool epocDeviceMatch = (id + ":" + name) == epocDeviceValue; + const QString name = xml.attributes().value("name").toString(); + const QString alias = xml.attributes().value("alias").toString(); + bool epocDeviceMatch = (id + ":" + name) == epocDeviceValue; + if (!alias.isEmpty()) + epocDeviceMatch |= alias == epocDeviceValue; epocDeviceFound |= epocDeviceMatch; if((epocDeviceValue.isEmpty() && isDefault) || epocDeviceMatch) { |