diff options
author | Tobias Koenig <tokoe@kde.org> | 2009-06-04 18:44:12 (GMT) |
---|---|---|
committer | Tobias Koenig <tokoe@kde.org> | 2009-06-04 18:44:12 (GMT) |
commit | 5d87f2542bbcb0877f4a9a9b5be4df80cd6aa4cd (patch) | |
tree | a1fc7824b38c3b712893794cfe55fa285cd3c760 /tools | |
parent | f7741b78c90abcb272345810d55e446a7f390032 (diff) | |
parent | b1b09172aee658e085423ddf6abfea291a072c74 (diff) | |
download | Qt-5d87f2542bbcb0877f4a9a9b5be4df80cd6aa4cd.zip Qt-5d87f2542bbcb0877f4a9a9b5be4df80cd6aa4cd.tar.gz Qt-5d87f2542bbcb0877f4a9a9b5be4df80cd6aa4cd.tar.bz2 |
Merge commit 'qt-mainline/master'
Diffstat (limited to 'tools')
134 files changed, 1456 insertions, 3132 deletions
diff --git a/tools/assistant/compat/mainwindow.cpp b/tools/assistant/compat/mainwindow.cpp index 9f91f9b..5de0d3c 100644 --- a/tools/assistant/compat/mainwindow.cpp +++ b/tools/assistant/compat/mainwindow.cpp @@ -312,21 +312,14 @@ void MainWindow::about() { QMessageBox box(this); - // TODO: Remove these variables for 4.6.0. Must keep this way for 4.5.x due to string freeze. - QString edition; - QString info; - QString moreInfo; - box.setText(QString::fromLatin1("<center><img src=\":/trolltech/assistant/images/assistant-128.png\">" "<h3>%1</h3>" - "<p>Version %2 %3</p></center>" - "<p>%4</p>" - "<p>%5</p>" + "<p>Version %2</p></center>" "<p>Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).</p>" "<p>The program is provided AS IS with NO WARRANTY OF ANY KIND," " INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A" " PARTICULAR PURPOSE.<p/>") - .arg(tr("Qt Assistant")).arg(QLatin1String(QT_VERSION_STR)).arg(edition).arg(info).arg(moreInfo)); + .arg(tr("Qt Assistant")).arg(QLatin1String(QT_VERSION_STR))); box.setWindowTitle(tr("Qt Assistant")); box.setIcon(QMessageBox::NoIcon); box.exec(); diff --git a/tools/assistant/lib/fulltextsearch/qclucene_global_p.h b/tools/assistant/lib/fulltextsearch/qclucene_global_p.h index 2a9d146..3dba45a 100644 --- a/tools/assistant/lib/fulltextsearch/qclucene_global_p.h +++ b/tools/assistant/lib/fulltextsearch/qclucene_global_p.h @@ -29,6 +29,14 @@ #include <QtCore/QChar> #include <QtCore/QString> +#if !defined(_MSC_VER) && defined(_CL_HAVE_WCHAR_H) && defined(_CL_HAVE_WCHAR_T) +# if !defined(TCHAR) +# define TCHAR wchar_t +# endif +#else +# include <windows.h> +#endif + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -87,14 +95,6 @@ QT_BEGIN_NAMESPACE # define CL_NS2(sub,sub2) #endif -#if !defined(_MSC_VER) && defined(_CL_HAVE_WCHAR_H) && defined(_CL_HAVE_WCHAR_T) -# if !defined(TCHAR) -# define TCHAR wchar_t -# endif -#else -# include <windows.h> -#endif - namespace { TCHAR* QStringToTChar(const QString &str) { diff --git a/tools/assistant/tools/assistant/assistant.qch b/tools/assistant/tools/assistant/assistant.qch Binary files differindex 64763f7..99687ed 100644 --- a/tools/assistant/tools/assistant/assistant.qch +++ b/tools/assistant/tools/assistant/assistant.qch diff --git a/tools/assistant/tools/assistant/bookmarkmanager.cpp b/tools/assistant/tools/assistant/bookmarkmanager.cpp index 6f5732f..66475a4 100644 --- a/tools/assistant/tools/assistant/bookmarkmanager.cpp +++ b/tools/assistant/tools/assistant/bookmarkmanager.cpp @@ -536,58 +536,57 @@ void BookmarkWidget::focusInEvent(QFocusEvent *e) bool BookmarkWidget::eventFilter(QObject *object, QEvent *e) { - if (object == this && e->type() == QEvent::KeyPress) { - QKeyEvent *ke = static_cast<QKeyEvent*>(e); + if ((object == this) || (object == treeView->viewport())) { QModelIndex index = treeView->currentIndex(); - switch (ke->key()) { + if (e->type() == QEvent::KeyPress) { + QKeyEvent *ke = static_cast<QKeyEvent*>(e); if (index.isValid() && searchField->text().isEmpty()) { - case Qt::Key_F2: { - const QModelIndex& source = filterBookmarkModel->mapToSource(index); - QStandardItem *item = - bookmarkManager->treeBookmarkModel()->itemFromIndex(source); + if (ke->key() == Qt::Key_F2) { + QStandardItem *item = bookmarkManager->treeBookmarkModel() + ->itemFromIndex(filterBookmarkModel->mapToSource(index)); if (item) { item->setEditable(true); treeView->edit(index); item->setEditable(false); } - } break; - - case Qt::Key_Delete: { + } else if (ke->key() == Qt::Key_Delete) { bookmarkManager->removeBookmarkItem(treeView, filterBookmarkModel->mapToSource(index)); - } break; + } } - case Qt::Key_Up: - case Qt::Key_Down: - treeView->subclassKeyPressEvent(ke); - break; - - case Qt::Key_Enter: { - case Qt::Key_Return: - index = treeView->selectionModel()->currentIndex(); - if (index.isValid()) { - QString data = index.data(Qt::UserRole + 10).toString(); - if (!data.isEmpty() && data != QLatin1String("Folder")) - emit requestShowLink(data); - } - } break; + switch (ke->key()) { + default: break; + case Qt::Key_Up: { + case Qt::Key_Down: + treeView->subclassKeyPressEvent(ke); + } break; - case Qt::Key_Escape: - emit escapePressed(); - break; + case Qt::Key_Enter: { + case Qt::Key_Return: + index = treeView->selectionModel()->currentIndex(); + if (index.isValid()) { + QString data = index.data(Qt::UserRole + 10).toString(); + if (!data.isEmpty() && data != QLatin1String("Folder")) + emit requestShowLink(data); + } + } break; - default: - break; - } - } - else if (object == treeView->viewport() && e->type() == QEvent::MouseButtonRelease) { - const QModelIndex& index = treeView->currentIndex(); - QMouseEvent *me = static_cast<QMouseEvent*>(e); - if (index.isValid() && (me->button() == Qt::MidButton)) { - QString data = index.data(Qt::UserRole + 10).toString(); - if (!data.isEmpty() && data != QLatin1String("Folder")) - CentralWidget::instance()->setSourceInNewTab(data); + case Qt::Key_Escape: { + emit escapePressed(); + } break; + } + } else if (e->type() == QEvent::MouseButtonRelease) { + if (index.isValid()) { + QMouseEvent *me = static_cast<QMouseEvent*>(e); + bool controlPressed = me->modifiers() & Qt::ControlModifier; + if(((me->button() == Qt::LeftButton) && controlPressed) + || (me->button() == Qt::MidButton)) { + QString data = index.data(Qt::UserRole + 10).toString(); + if (!data.isEmpty() && data != QLatin1String("Folder")) + CentralWidget::instance()->setSourceInNewTab(data); + } + } } } return QWidget::eventFilter(object, e); diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp index b78f346..52d48d5 100644 --- a/tools/assistant/tools/assistant/centralwidget.cpp +++ b/tools/assistant/tools/assistant/centralwidget.cpp @@ -87,6 +87,7 @@ namespace { FindWidget::FindWidget(QWidget *parent) : QWidget(parent) + , appPalette(qApp->palette()) { QHBoxLayout *hboxLayout = new QHBoxLayout(this); QString resourcePath = QLatin1String(":/trolltech/assistant/images/"); @@ -148,6 +149,34 @@ FindWidget::~FindWidget() { } +void FindWidget::hideEvent(QHideEvent* event) +{ +#if !defined(QT_NO_WEBKIT) + // TODO: remove this once webkit supports setting the palette + if (!event->spontaneous()) + qApp->setPalette(appPalette); +#else + Q_UNUSED(event); +#endif +} + +void FindWidget::showEvent(QShowEvent* event) +{ +#if !defined(QT_NO_WEBKIT) + // TODO: remove this once webkit supports setting the palette + if (!event->spontaneous()) { + QPalette p = appPalette; + p.setColor(QPalette::Inactive, QPalette::Highlight, + p.color(QPalette::Active, QPalette::Highlight)); + p.setColor(QPalette::Inactive, QPalette::HighlightedText, + p.color(QPalette::Active, QPalette::HighlightedText)); + qApp->setPalette(p); + } +#else + Q_UNUSED(event); +#endif +} + void FindWidget::updateButtons() { if (editFind->text().isEmpty()) { @@ -245,12 +274,14 @@ CentralWidget::CentralWidget(QHelpEngine *engine, MainWindow *parent) SLOT(showTabBarContextMenu(QPoint))); } - QPalette p = qApp->palette(); +#if defined(QT_NO_WEBKIT) + QPalette p = palette(); p.setColor(QPalette::Inactive, QPalette::Highlight, p.color(QPalette::Active, QPalette::Highlight)); p.setColor(QPalette::Inactive, QPalette::HighlightedText, p.color(QPalette::Active, QPalette::HighlightedText)); - qApp->setPalette(p); + setPalette(p); +#endif } CentralWidget::~CentralWidget() @@ -848,60 +879,64 @@ void CentralWidget::keyPressEvent(QKeyEvent *e) QWidget::keyPressEvent(e); } -void CentralWidget::find(QString ttf, bool forward, bool backward) +void CentralWidget::find(const QString &ttf, bool forward, bool backward) { - QTextCursor cursor; - QTextDocument *doc = 0; - QTextBrowser *browser = 0; - - HelpViewer *viewer = currentHelpViewer(); QPalette p = findWidget->editFind->palette(); p.setColor(QPalette::Active, QPalette::Base, Qt::white); -#if !defined(QT_NO_WEBKIT) - Q_UNUSED(forward) - Q_UNUSED(doc) - Q_UNUSED(browser) - - if (viewer) { - QWebPage::FindFlags options; - if (backward) - options |= QWebPage::FindBackward; + if (!ttf.isEmpty()) { + HelpViewer *viewer = currentHelpViewer(); - if (findWidget->checkCase->isChecked()) - options |= QWebPage::FindCaseSensitively; + bool found = false; +#if !defined(QT_NO_WEBKIT) + if (viewer) { + QWebPage::FindFlags options; + if (backward) + options |= QWebPage::FindBackward; - bool found = viewer->findText(ttf, options); - findWidget->labelWrapped->hide(); + if (findWidget->checkCase->isChecked()) + options |= QWebPage::FindCaseSensitively; - if (!found) { - options |= QWebPage::FindWrapsAroundDocument; found = viewer->findText(ttf, options); + findWidget->labelWrapped->hide(); if (!found) { - p.setColor(QPalette::Active, QPalette::Base, QColor(255, 102, 102)); - } else { - findWidget->labelWrapped->show(); + options |= QWebPage::FindWrapsAroundDocument; + found = viewer->findText(ttf, options); + if (found) + findWidget->labelWrapped->show(); } + } else if (tabWidget->currentWidget() == m_searchWidget) { + QTextBrowser *browser = qFindChild<QTextBrowser*>(m_searchWidget); + found = findInTextBrowser(browser, ttf, forward, backward); } - } #else - if (viewer) { - doc = viewer->document(); - cursor = viewer->textCursor(); - browser = qobject_cast<QTextBrowser*>(viewer); - } + QTextBrowser *browser = qobject_cast<QTextBrowser*>(viewer); + if (tabWidget->currentWidget() == m_searchWidget) + browser = qFindChild<QTextBrowser*>(m_searchWidget); + found = findInTextBrowser(browser, ttf, forward, backward); +#endif - if (tabWidget->currentWidget() == m_searchWidget) { - QTextBrowser *browser = qFindChild<QTextBrowser*>(m_searchWidget); - if (browser) { - doc = browser->document(); - cursor = browser->textCursor(); - } + if (!found) + p.setColor(QPalette::Active, QPalette::Base, QColor(255, 102, 102)); } - if (!browser || !doc || cursor.isNull()) - return; + if (!findWidget->isVisible()) + findWidget->show(); + findWidget->editFind->setPalette(p); +} + +bool CentralWidget::findInTextBrowser(QTextBrowser* browser, const QString &ttf, + bool forward, bool backward) +{ + if (!browser) + return false; + + QTextDocument *doc = browser->document(); + QTextCursor cursor = browser->textCursor(); + + if (!doc || cursor.isNull()) + return false; QTextDocument::FindFlags options; @@ -910,44 +945,33 @@ void CentralWidget::find(QString ttf, bool forward, bool backward) QTextCursor::MoveAnchor); } - QTextCursor newCursor = cursor; + if (backward) + options |= QTextDocument::FindBackward; - if (!ttf.isEmpty()) { - if (backward) - options |= QTextDocument::FindBackward; - - if (findWidget->checkCase->isChecked()) - options |= QTextDocument::FindCaseSensitively; + if (findWidget->checkCase->isChecked()) + options |= QTextDocument::FindCaseSensitively; - if (findWidget->checkWholeWords->isChecked()) - options |= QTextDocument::FindWholeWords; + if (findWidget->checkWholeWords->isChecked()) + options |= QTextDocument::FindWholeWords; - newCursor = doc->find(ttf, cursor, options); - findWidget->labelWrapped->hide(); + findWidget->labelWrapped->hide(); + bool found = true; + QTextCursor newCursor = doc->find(ttf, cursor, options); + if (newCursor.isNull()) { + QTextCursor ac(doc); + ac.movePosition(options & QTextDocument::FindBackward + ? QTextCursor::End : QTextCursor::Start); + newCursor = doc->find(ttf, ac, options); if (newCursor.isNull()) { - QTextCursor ac(doc); - ac.movePosition(options & QTextDocument::FindBackward - ? QTextCursor::End : QTextCursor::Start); - newCursor = doc->find(ttf, ac, options); - if (newCursor.isNull()) { - p.setColor(QPalette::Active, QPalette::Base, QColor(255, 102, 102)); - newCursor = cursor; - } else { - findWidget->labelWrapped->show(); - } + found = false; + newCursor = cursor; + } else { + findWidget->labelWrapped->show(); } } -#endif - - if (!findWidget->isVisible()) - findWidget->show(); - -#if defined(QT_NO_WEBKIT) - if (browser) - browser->setTextCursor(newCursor); -#endif - findWidget->editFind->setPalette(p); + browser->setTextCursor(newCursor); + return found; } void CentralWidget::updateBrowserFont() diff --git a/tools/assistant/tools/assistant/centralwidget.h b/tools/assistant/tools/assistant/centralwidget.h index e3ce200..d59dbe5 100644 --- a/tools/assistant/tools/assistant/centralwidget.h +++ b/tools/assistant/tools/assistant/centralwidget.h @@ -55,6 +55,7 @@ class QLabel; class QAction; class QCheckBox; class QLineEdit; +class QTextBrowser; class QToolButton; class HelpViewer; @@ -79,6 +80,10 @@ signals: void findNext(); void findPrevious(); +protected: + void hideEvent(QHideEvent* event); + void showEvent(QShowEvent * event); + private slots: void updateButtons(); @@ -94,6 +99,7 @@ private: QToolButton *toolPrevious; QCheckBox *checkWholeWords; + QPalette appPalette; friend class CentralWidget; }; @@ -176,7 +182,9 @@ private slots: private: void connectSignals(); bool eventFilter(QObject *object, QEvent *e); - void find(QString ttf, bool forward, bool backward); + void find(const QString &ttf, bool forward, bool backward); + bool findInTextBrowser(QTextBrowser* browser, const QString &ttf, + bool forward, bool backward); void initPrinter(); QString quoteTabTitle(const QString &title) const; void highlightSearchTerms(); diff --git a/tools/assistant/tools/assistant/contentwindow.cpp b/tools/assistant/tools/assistant/contentwindow.cpp index 89060bd..9f39de5 100644 --- a/tools/assistant/tools/assistant/contentwindow.cpp +++ b/tools/assistant/tools/assistant/contentwindow.cpp @@ -124,10 +124,10 @@ bool ContentWindow::eventFilter(QObject *o, QEvent *e) QModelIndex index = m_contentWidget->indexAt(me->pos()); QItemSelectionModel *sm = m_contentWidget->selectionModel(); + Qt::MouseButtons button = me->button(); if (index.isValid() && (sm && sm->isSelected(index))) { - if (me->button() == Qt::LeftButton) { - itemClicked(index); - } else if (me->button() == Qt::MidButton) { + if ((button == Qt::LeftButton && (me->modifiers() & Qt::ControlModifier)) + || (button == Qt::MidButton)) { QHelpContentModel *contentModel = qobject_cast<QHelpContentModel*>(m_contentWidget->model()); if (contentModel) { @@ -135,12 +135,15 @@ bool ContentWindow::eventFilter(QObject *o, QEvent *e) if (itm && !isPdfFile(itm)) CentralWidget::instance()->setSourceInNewTab(itm->url()); } + } else if (button == Qt::LeftButton) { + itemClicked(index); } } } return QWidget::eventFilter(o, e); } + void ContentWindow::showContextMenu(const QPoint &pos) { if (!m_contentWidget->indexAt(pos).isValid()) diff --git a/tools/assistant/tools/assistant/indexwindow.cpp b/tools/assistant/tools/assistant/indexwindow.cpp index a2c0950..1117ae0 100644 --- a/tools/assistant/tools/assistant/indexwindow.cpp +++ b/tools/assistant/tools/assistant/indexwindow.cpp @@ -146,8 +146,13 @@ bool IndexWindow::eventFilter(QObject *obj, QEvent *e) && e->type() == QEvent::MouseButtonRelease) { QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(e); QModelIndex idx = m_indexWidget->indexAt(mouseEvent->pos()); - if (idx.isValid() && mouseEvent->button()==Qt::MidButton) - open(m_indexWidget, idx); + if (idx.isValid()) { + Qt::MouseButtons button = mouseEvent->button(); + if (((button == Qt::LeftButton) && (mouseEvent->modifiers() & Qt::ControlModifier)) + || (button == Qt::MidButton)) { + open(m_indexWidget, idx); + } + } } #ifdef Q_OS_MAC else if (obj == m_indexWidget && e->type() == QEvent::KeyPress) { diff --git a/tools/assistant/tools/assistant/main.cpp b/tools/assistant/tools/assistant/main.cpp index 75955ec..f63cc65 100644 --- a/tools/assistant/tools/assistant/main.cpp +++ b/tools/assistant/tools/assistant/main.cpp @@ -230,7 +230,7 @@ int main(int argc, char *argv[]) if (file.isEmpty()) file = MainWindow::defaultHelpCollectionFileName(); QString path = QFileInfo(file).path(); - path += QLatin1String("/") + indexFilesFolder(file); + path += QLatin1Char('/') + indexFilesFolder(file); QLocalSocket localSocket; localSocket.connectToServer(QString(QLatin1String("QtAssistant%1")) diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp index cb10e3f..2b53f09 100644 --- a/tools/assistant/tools/assistant/mainwindow.cpp +++ b/tools/assistant/tools/assistant/mainwindow.cpp @@ -797,23 +797,16 @@ void MainWindow::showAboutDialog() aboutDia.setPixmap(pix); aboutDia.setWindowTitle(aboutDia.documentTitle()); } else { - // TODO: Remove these variables for 4.6.0. Must keep this way for 4.5.x due to string freeze. - QString edition; - QString info; - QString moreInfo; - QByteArray resources; aboutDia.setText(QString::fromLatin1("<center>" "<h3>%1</h3>" - "<p>Version %2 %3</p></center>" - "<p>%4</p>" - "<p>%5</p>" + "<p>Version %2</p></center>" "<p>Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)" ".</p><p>The program is provided AS IS with NO WARRANTY OF ANY KIND," " INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A" " PARTICULAR PURPOSE.<p/>") - .arg(tr("Qt Assistant")).arg(QLatin1String(QT_VERSION_STR)) - .arg(edition).arg(info).arg(moreInfo), resources); + .arg(tr("Qt Assistant")).arg(QLatin1String(QT_VERSION_STR)), + resources); QLatin1String path(":/trolltech/assistant/images/assistant-128.png"); aboutDia.setPixmap(QString(path)); } @@ -926,25 +919,27 @@ void MainWindow::expandTOC(int depth) void MainWindow::indexingStarted() { - m_progressWidget = new QWidget(); - QLayout* hlayout = new QHBoxLayout(m_progressWidget); + if (!m_progressWidget) { + m_progressWidget = new QWidget(); + QLayout* hlayout = new QHBoxLayout(m_progressWidget); - QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); + QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); - QLabel *label = new QLabel(tr("Updating search index")); - label->setSizePolicy(sizePolicy); - hlayout->addWidget(label); + QLabel *label = new QLabel(tr("Updating search index")); + label->setSizePolicy(sizePolicy); + hlayout->addWidget(label); - QProgressBar *progressBar = new QProgressBar(); - progressBar->setRange(0, 0); - progressBar->setTextVisible(false); - progressBar->setSizePolicy(sizePolicy); + QProgressBar *progressBar = new QProgressBar(); + progressBar->setRange(0, 0); + progressBar->setTextVisible(false); + progressBar->setSizePolicy(sizePolicy); - hlayout->setSpacing(6); - hlayout->setMargin(0); - hlayout->addWidget(progressBar); + hlayout->setSpacing(6); + hlayout->setMargin(0); + hlayout->addWidget(progressBar); - statusBar()->addPermanentWidget(m_progressWidget); + statusBar()->addPermanentWidget(m_progressWidget); + } } void MainWindow::indexingFinished() diff --git a/tools/assistant/translations/qt_help.pro b/tools/assistant/translations/qt_help.pro index efad6bf..e6208a6 100644 --- a/tools/assistant/translations/qt_help.pro +++ b/tools/assistant/translations/qt_help.pro @@ -44,5 +44,6 @@ TRANSLATIONS=$$[QT_INSTALL_TRANSLATIONS]/qt_help_de.ts \ $$[QT_INSTALL_TRANSLATIONS]/qt_help_pl.ts \ $$[QT_INSTALL_TRANSLATIONS]/qt_help_untranslated.ts \ $$[QT_INSTALL_TRANSLATIONS]/qt_help_zh_CN.ts \ - $$[QT_INSTALL_TRANSLATIONS]/qt_help_zh_TW.ts + $$[QT_INSTALL_TRANSLATIONS]/qt_help_zh_TW.ts \ + $$[QT_INSTALL_TRANSLATIONS]/qt_help_da.ts error("This is a dummy profile to be used for translations ONLY.") diff --git a/tools/assistant/translations/translations.pro b/tools/assistant/translations/translations.pro index 58de554..8572123 100644 --- a/tools/assistant/translations/translations.pro +++ b/tools/assistant/translations/translations.pro @@ -45,4 +45,5 @@ TRANSLATIONS=$$[QT_INSTALL_TRANSLATIONS]/assistant_de.ts \ $$[QT_INSTALL_TRANSLATIONS]/assistant_pl.ts \ $$[QT_INSTALL_TRANSLATIONS]/assistant_untranslated.ts \ $$[QT_INSTALL_TRANSLATIONS]/assistant_zh_CN.ts \ - $$[QT_INSTALL_TRANSLATIONS]/assistant_zh_TW.ts + $$[QT_INSTALL_TRANSLATIONS]/assistant_zh_TW.ts \ + $$[QT_INSTALL_TRANSLATIONS]/assistant_da.ts diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index b0e7b53..f131c16 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -350,6 +350,7 @@ Configure::Configure( int& argc, char** argv ) dictionary[ "QMAKESPEC" ] = tmp; dictionary[ "INCREDIBUILD_XGE" ] = "auto"; + dictionary[ "LTCG" ] = "no"; } Configure::~Configure() @@ -486,6 +487,12 @@ void Configure::parseCmdLine() else if( configCmdLine.at(i) == "-commercial" ) { dictionary[ "BUILDTYPE" ] = "commercial"; } + else if( configCmdLine.at(i) == "-ltcg" ) { + dictionary[ "LTCG" ] = "yes"; + } + else if( configCmdLine.at(i) == "-no-ltcg" ) { + dictionary[ "LTCG" ] = "no"; + } #endif else if( configCmdLine.at(i) == "-platform" ) { @@ -1313,6 +1320,7 @@ void Configure::applySpecSpecifics() dictionary[ "WEBKIT" ] = "no"; dictionary[ "PHONON" ] = "yes"; dictionary[ "DIRECTSHOW" ] = "no"; + dictionary[ "LTCG" ] = "yes"; // We only apply MMX/IWMMXT for mkspecs we know they work if (dictionary[ "XQMAKESPEC" ].startsWith("wincewm")) { dictionary[ "MMX" ] = "yes"; @@ -1459,6 +1467,9 @@ bool Configure::displayHelp() desc("SHARED", "yes", "-shared", "Create and use shared Qt libraries."); desc("SHARED", "no", "-static", "Create and use static Qt libraries.\n"); + desc("LTCG", "yes", "-ltcg", "Use Link Time Code Generation. (Release builds only)"); + desc("LTCG", "no", "-no-ltcg", "Do not use Link Time Code Generation.\n"); + desc("FAST", "no", "-no-fast", "Configure Qt normally by generating Makefiles for all project files."); desc("FAST", "yes", "-fast", "Configure Qt quickly by generating Makefiles only for library and " "subdirectory targets. All other Makefiles are created as wrappers " @@ -2441,6 +2452,8 @@ void Configure::generateCachefile() else configStream << " static"; + if( dictionary[ "LTCG" ] == "yes" ) + configStream << " ltcg"; if( dictionary[ "STL" ] == "yes" ) configStream << " stl"; if ( dictionary[ "EXCEPTIONS" ] == "yes" ) @@ -2862,6 +2875,7 @@ void Configure::displayConfig() cout << "Architecture................" << dictionary[ "ARCHITECTURE" ] << endl; cout << "Maketool...................." << dictionary[ "MAKE" ] << endl; cout << "Debug symbols..............." << (dictionary[ "BUILD" ] == "debug" ? "yes" : "no") << endl; + cout << "Link Time Code Generation..." << dictionary[ "LTCG" ] << endl; cout << "Accessibility support......." << dictionary[ "ACCESSIBILITY" ] << endl; cout << "STL support................." << dictionary[ "STL" ] << endl; cout << "Exception support..........." << dictionary[ "EXCEPTIONS" ] << endl; @@ -3414,12 +3428,15 @@ void Configure::readLicense() dictionary[ "PLATFORM NAME" ] = (QFile::exists(dictionary["QT_SOURCE_TREE"] + "/src/corelib/kernel/qfunctions_wince.h") && (dictionary.value("QMAKESPEC").startsWith("wince") || dictionary.value("XQMAKESPEC").startsWith("wince"))) ? "Qt for Windows CE" : "Qt for Windows"; + dictionary["LICENSE FILE"] = sourcePath; + bool openSource = false; + bool hasOpenSource = QFile::exists(dictionary["LICENSE FILE"] + "/LICENSE.GPL3") || QFile::exists(dictionary["LICENSE FILE"] + "/LICENSE.LGPL"); if (dictionary["BUILDNOKIA"] == "yes" || dictionary["BUILDTYPE"] == "commercial") { openSource = false; } else if (dictionary["BUILDTYPE"] == "opensource") { openSource = true; - } else { + } else if (hasOpenSource) { // No Open Source? Just display the commercial license right away forever { char accept = '?'; cout << "Which edition of Qt do you want to use ?" << endl; @@ -3437,28 +3454,23 @@ void Configure::readLicense() } } } - if (openSource) { - dictionary["LICENSE FILE"] = sourcePath; - if (QFile::exists(dictionary["LICENSE FILE"] + "/LICENSE.GPL3") || QFile::exists(dictionary["LICENSE FILE"] + "/LICENSE.LGPL")) { - cout << endl << "This is the " << dictionary["PLATFORM NAME"] << " Open Source Edition." << endl; - licenseInfo["LICENSEE"] = "Open Source"; - dictionary["EDITION"] = "OpenSource"; - dictionary["QT_EDITION"] = "QT_EDITION_OPENSOURCE"; - cout << endl; - if (!showLicense(dictionary["LICENSE FILE"])) { - cout << "Configuration aborted since license was not accepted"; - dictionary["DONE"] = "error"; - return; - } + if (hasOpenSource && openSource) { + cout << endl << "This is the " << dictionary["PLATFORM NAME"] << " Open Source Edition." << endl; + licenseInfo["LICENSEE"] = "Open Source"; + dictionary["EDITION"] = "OpenSource"; + dictionary["QT_EDITION"] = "QT_EDITION_OPENSOURCE"; + cout << endl; + if (!showLicense(dictionary["LICENSE FILE"])) { + cout << "Configuration aborted since license was not accepted"; + dictionary["DONE"] = "error"; return; } -#ifndef COMMERCIAL_VERSION - else { - cout << endl << "Cannot find the GPL license files!" << endl; + } else if (openSource) { + cout << endl << "Cannot find the GPL license files! Please download the Open Source version of the library." << endl; dictionary["DONE"] = "error"; } -#else - } else { +#ifdef COMMERCIAL_VERSION + else { Tools::checkLicense(dictionary, licenseInfo, firstLicensePath()); if (dictionary["DONE"] != "error" && dictionary["BUILDNOKIA"] != "yes") { // give the user some feedback, and prompt for license acceptance @@ -3470,7 +3482,12 @@ void Configure::readLicense() } } } -#endif // COMMERCIAL_VERSION +#else // !COMMERCIAL_VERSION + else { + cout << endl << "Cannot build commercial edition from the open source version of the library." << endl; + dictionary["DONE"] = "error"; + } +#endif } void Configure::reloadCmdLine() diff --git a/tools/designer/src/components/formeditor/formwindow.cpp b/tools/designer/src/components/formeditor/formwindow.cpp index 07d785a..66bab9b 100644 --- a/tools/designer/src/components/formeditor/formwindow.cpp +++ b/tools/designer/src/components/formeditor/formwindow.cpp @@ -2136,7 +2136,10 @@ void FormWindow::layoutContainer(QWidget *w, int type) bool FormWindow::hasInsertedChildren(QWidget *widget) const // ### move { if (QDesignerContainerExtension *container = qt_extension<QDesignerContainerExtension*>(core()->extensionManager(), widget)) { - widget = container->widget(container->currentIndex()); + const int index = container->currentIndex(); + if (index < 0) + return false; + widget = container->widget(index); } const QWidgetList l = widgets(widget); diff --git a/tools/designer/src/components/formeditor/formwindow_widgetstack.cpp b/tools/designer/src/components/formeditor/formwindow_widgetstack.cpp index 7270628..58127b0 100644 --- a/tools/designer/src/components/formeditor/formwindow_widgetstack.cpp +++ b/tools/designer/src/components/formeditor/formwindow_widgetstack.cpp @@ -57,16 +57,20 @@ using namespace qdesigner_internal; FormWindowWidgetStack::FormWindowWidgetStack(QObject *parent) : QObject(parent), m_formContainer(new QWidget), - m_formContainerLayout(new QVBoxLayout), + m_formContainerLayout(new QStackedLayout), m_layout(new QStackedLayout) { m_layout->setMargin(0); m_layout->setSpacing(0); m_layout->setStackingMode(QStackedLayout::StackAll); + // We choose a QStackedLayout as immediate layout for + // the form windows as it ignores the sizePolicy of + // its child (for example, Fixed would cause undesired side effects). m_formContainerLayout->setMargin(0); m_formContainer->setObjectName(QLatin1String("formContainer")); m_formContainer->setLayout(m_formContainerLayout); + m_formContainerLayout->setStackingMode(QStackedLayout::StackAll); // System settings might have different background colors, autofill them // (affects for example mainwindow status bars) m_formContainer->setAutoFillBackground(true); diff --git a/tools/designer/src/components/formeditor/formwindow_widgetstack.h b/tools/designer/src/components/formeditor/formwindow_widgetstack.h index 92323c5..f21c4f0 100644 --- a/tools/designer/src/components/formeditor/formwindow_widgetstack.h +++ b/tools/designer/src/components/formeditor/formwindow_widgetstack.h @@ -51,7 +51,6 @@ QT_BEGIN_NAMESPACE class QDesignerFormWindowToolInterface; class QStackedLayout; -class QVBoxLayout; class QWidget; namespace qdesigner_internal { @@ -92,7 +91,7 @@ protected: private: QList<QDesignerFormWindowToolInterface*> m_tools; QWidget *m_formContainer; - QVBoxLayout *m_formContainerLayout; + QStackedLayout *m_formContainerLayout; QStackedLayout *m_layout; }; diff --git a/tools/designer/src/components/formeditor/qdesigner_resource.cpp b/tools/designer/src/components/formeditor/qdesigner_resource.cpp index 75a53b7..f94fb5c 100644 --- a/tools/designer/src/components/formeditor/qdesigner_resource.cpp +++ b/tools/designer/src/components/formeditor/qdesigner_resource.cpp @@ -159,6 +159,7 @@ private: QDesignerFormEditorInterface *m_core; DesignerPixmapCache *m_pixmapCache; DesignerIconCache *m_iconCache; + const QDesignerLanguageExtension *m_lang; bool m_saveRelative; mutable QMap<QString, bool> m_usedQrcFiles; mutable QMap<QString, bool> m_loadedQrcFiles; @@ -168,13 +169,18 @@ QDesignerResourceBuilder::QDesignerResourceBuilder(QDesignerFormEditorInterface m_core(core), m_pixmapCache(pixmapCache), m_iconCache(iconCache), + m_lang(qt_extension<QDesignerLanguageExtension *>(core->extensionManager(), core)), m_saveRelative(true) { } -static inline void setIconPixmap(QIcon::Mode m, QIcon::State s, const QDir &workingDirectory, const QString &v, PropertySheetIconValue &icon) +static inline void setIconPixmap(QIcon::Mode m, QIcon::State s, const QDir &workingDirectory, + QString path, PropertySheetIconValue &icon, + const QDesignerLanguageExtension *lang = 0) { - icon.setPixmap(m, s, PropertySheetPixmapValue(QFileInfo(workingDirectory, v).absoluteFilePath())); + if (lang == 0 || !lang->isLanguageResource(path)) + path = QFileInfo(workingDirectory, path).absoluteFilePath(); + icon.setPixmap(m, s, PropertySheetPixmapValue(path)); } QVariant QDesignerResourceBuilder::loadResource(const QDir &workingDirectory, const DomProperty *property) const @@ -184,7 +190,11 @@ QVariant QDesignerResourceBuilder::loadResource(const QDir &workingDirectory, co PropertySheetPixmapValue pixmap; DomResourcePixmap *dp = property->elementPixmap(); if (!dp->text().isEmpty()) { - pixmap.setPath(QFileInfo(workingDirectory, dp->text()).absoluteFilePath()); + if (m_lang != 0 && m_lang->isLanguageResource(dp->text())) { + pixmap.setPath(dp->text()); + } else { + pixmap.setPath(QFileInfo(workingDirectory, dp->text()).absoluteFilePath()); + } #ifdef OLD_RESOURCE_FORMAT if (dp->hasAttributeResource()) m_loadedQrcFiles.insert(QFileInfo(workingDirectory, dp->attributeResource()).absoluteFilePath(), false); @@ -198,24 +208,24 @@ QVariant QDesignerResourceBuilder::loadResource(const QDir &workingDirectory, co DomResourceIcon *di = property->elementIconSet(); if (const int flags = iconStateFlags(di)) { // new, post 4.4 format if (flags & NormalOff) - setIconPixmap(QIcon::Normal, QIcon::Off, workingDirectory, di->elementNormalOff()->text(), icon); + setIconPixmap(QIcon::Normal, QIcon::Off, workingDirectory, di->elementNormalOff()->text(), icon, m_lang); if (flags & NormalOn) - setIconPixmap(QIcon::Normal, QIcon::On, workingDirectory, di->elementNormalOn()->text(), icon); + setIconPixmap(QIcon::Normal, QIcon::On, workingDirectory, di->elementNormalOn()->text(), icon, m_lang); if (flags & DisabledOff) - setIconPixmap(QIcon::Disabled, QIcon::Off, workingDirectory, di->elementDisabledOff()->text(), icon); + setIconPixmap(QIcon::Disabled, QIcon::Off, workingDirectory, di->elementDisabledOff()->text(), icon, m_lang); if (flags & DisabledOn) - setIconPixmap(QIcon::Disabled, QIcon::On, workingDirectory, di->elementDisabledOn()->text(), icon); + setIconPixmap(QIcon::Disabled, QIcon::On, workingDirectory, di->elementDisabledOn()->text(), icon, m_lang); if (flags & ActiveOff) - setIconPixmap(QIcon::Active, QIcon::Off, workingDirectory, di->elementActiveOff()->text(), icon); + setIconPixmap(QIcon::Active, QIcon::Off, workingDirectory, di->elementActiveOff()->text(), icon, m_lang); if (flags & ActiveOn) - setIconPixmap(QIcon::Active, QIcon::On, workingDirectory, di->elementActiveOn()->text(), icon); + setIconPixmap(QIcon::Active, QIcon::On, workingDirectory, di->elementActiveOn()->text(), icon, m_lang); if (flags & SelectedOff) - setIconPixmap(QIcon::Selected, QIcon::Off, workingDirectory, di->elementSelectedOff()->text(), icon); + setIconPixmap(QIcon::Selected, QIcon::Off, workingDirectory, di->elementSelectedOff()->text(), icon, m_lang); if (flags & SelectedOn) - setIconPixmap(QIcon::Selected, QIcon::On, workingDirectory, di->elementSelectedOn()->text(), icon); + setIconPixmap(QIcon::Selected, QIcon::On, workingDirectory, di->elementSelectedOn()->text(), icon, m_lang); } else { #ifdef OLD_RESOURCE_FORMAT - setIconPixmap(QIcon::Normal, QIcon::Off, workingDirectory, di->text(), icon); + setIconPixmap(QIcon::Normal, QIcon::Off, workingDirectory, di->text(), icon, m_lang); if (di->hasAttributeResource()) m_loadedQrcFiles.insert(QFileInfo(workingDirectory, di->attributeResource()).absoluteFilePath(), false); #endif @@ -743,26 +753,6 @@ void QDesignerResource::setSaveRelative(bool relative) m_resourceBuilder->setSaveRelative(relative); } -static bool addFakeMethods(const DomSlots *domSlots, QStringList &fakeSlots, QStringList &fakeSignals) -{ - if (!domSlots) - return false; - - bool rc = false; - foreach (const QString &fakeSlot, domSlots->elementSlot()) - if (fakeSlots.indexOf(fakeSlot) == -1) { - fakeSlots += fakeSlot; - rc = true; - } - - foreach (const QString &fakeSignal, domSlots->elementSignal()) - if (fakeSignals.indexOf(fakeSignal) == -1) { - fakeSignals += fakeSignal; - rc = true; - } - return rc; -} - QWidget *QDesignerResource::create(DomUI *ui, QWidget *parentWidget) { // Load extra info extension. This is used by Jambi for preventing @@ -1425,108 +1415,9 @@ DomLayoutItem *QDesignerResource::createDom(QLayoutItem *item, DomLayout *ui_lay return ui_item; } -static void addFakeMethodsToWidgetDataBase(const DomCustomWidget *domCustomWidget, WidgetDataBaseItem *item) -{ - const DomSlots *domSlots = domCustomWidget->elementSlots(); - if (!domSlots) - return; - - // Merge in new slots, signals - QStringList fakeSlots = item->fakeSlots(); - QStringList fakeSignals = item->fakeSignals(); - if (addFakeMethods(domSlots, fakeSlots, fakeSignals)) { - item->setFakeSlots(fakeSlots); - item->setFakeSignals(fakeSignals); - } -} - -void QDesignerResource::addCustomWidgetsToWidgetDatabase(DomCustomWidgetList& custom_widget_list) -{ - // Perform one iteration of adding the custom widgets to the database, - // looking up the base class and inheriting its data. - // Remove the succeeded custom widgets from the list. - // Classes whose base class could not be found are left in the list. - QDesignerWidgetDataBaseInterface *db = m_formWindow->core()->widgetDataBase(); - for (int i=0; i < custom_widget_list.size(); ) { - bool classInserted = false; - DomCustomWidget *custom_widget = custom_widget_list[i]; - const QString customClassName = custom_widget->elementClass(); - const QString base_class = custom_widget->elementExtends(); - QString includeFile; - IncludeType includeType = IncludeLocal; - if (const DomHeader *header = custom_widget->elementHeader()) { - includeFile = header->text(); - if (header->hasAttributeLocation() && header->attributeLocation() == QLatin1String("global")) - includeType = IncludeGlobal; - } - const bool domIsContainer = custom_widget->elementContainer(); - // Append a new item - if (base_class.isEmpty()) { - WidgetDataBaseItem *item = new WidgetDataBaseItem(customClassName); - item->setPromoted(false); - item->setGroup(QApplication::translate("Designer", "Custom Widgets")); - item->setIncludeFile(buildIncludeFile(includeFile, includeType)); - item->setContainer(domIsContainer); - item->setCustom(true); - addFakeMethodsToWidgetDataBase(custom_widget, item); - db->append(item); - custom_widget_list.removeAt(i); - classInserted = true; - } else { - // Create a new entry cloned from base class. Note that this will ignore existing - // classes, eg, plugin custom widgets. - QDesignerWidgetDataBaseItemInterface *item = - appendDerived(db, customClassName, QApplication::translate("Designer", "Promoted Widgets"), - base_class, - buildIncludeFile(includeFile, includeType), - true,true); - // Ok, base class found. - if (item) { - // Hack to accommodate for old UI-files in which "contains" is not set properly: - // Apply "contains" from DOM only if true (else, eg classes from QFrame might not accept - // dropping child widgets on them as container=false). This also allows for - // QWidget-derived stacked pages. - if (domIsContainer) - item->setContainer(domIsContainer); - - addFakeMethodsToWidgetDataBase(custom_widget, static_cast<WidgetDataBaseItem*>(item)); - custom_widget_list.removeAt(i); - classInserted = true; - } - } - // Skip failed item. - if (!classInserted) - i++; - } - -} void QDesignerResource::createCustomWidgets(DomCustomWidgets *dom_custom_widgets) { - if (dom_custom_widgets == 0) - return; - DomCustomWidgetList custom_widget_list = dom_custom_widgets->elementCustomWidget(); - // Attempt to insert each item derived from its base class. - // This should at most require two iterations in the event that the classes are out of order - // (derived first, max depth: promoted custom plugin = 2) - for (int iteration = 0; iteration < 2; iteration++) { - addCustomWidgetsToWidgetDatabase(custom_widget_list); - if (custom_widget_list.empty()) - return; - } - // Oops, there are classes left whose base class could not be found. - // Default them to QWidget with warnings. - const QString fallBackBaseClass = QLatin1String("QWidget"); - for (int i=0; i < custom_widget_list.size(); i++ ) { - DomCustomWidget *custom_widget = custom_widget_list[i]; - const QString customClassName = custom_widget->elementClass(); - const QString base_class = custom_widget->elementExtends(); - qDebug() << "** WARNING The base class " << base_class << " of the custom widget class " << customClassName - << " could not be found. Defaulting to " << fallBackBaseClass << '.'; - custom_widget->setElementExtends(fallBackBaseClass); - } - // One more pass. - addCustomWidgetsToWidgetDatabase(custom_widget_list); - Q_ASSERT(custom_widget_list.empty()); + QSimpleResource::handleDomCustomWidgets(core(), dom_custom_widgets); } DomTabStops *QDesignerResource::saveTabStops() diff --git a/tools/designer/src/designer/versiondialog.cpp b/tools/designer/src/designer/versiondialog.cpp index c21912b..97dc5a1 100644 --- a/tools/designer/src/designer/versiondialog.cpp +++ b/tools/designer/src/designer/versiondialog.cpp @@ -172,15 +172,11 @@ VersionDialog::VersionDialog(QWidget *parent) version = version.arg(tr("Qt Designer")).arg(QLatin1String(QT_VERSION_STR)); version.append(tr("<br/>Qt Designer is a graphical user interface designer for Qt applications.<br/>")); - // TODO: Remove this variable for 4.6.0. Must keep this way for 4.5.x due to string freeze - QString edition; - lbl->setText(tr("%1" - "<br/>%2" "<br/>Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)." "<br/><br/>The program is provided AS IS with NO WARRANTY OF ANY KIND," " INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A" - " PARTICULAR PURPOSE.<br/> ").arg(version).arg(edition)); + " PARTICULAR PURPOSE.<br/> ").arg(version)); lbl->setWordWrap(true); lbl->setOpenExternalLinks(true); diff --git a/tools/designer/src/lib/sdk/abstractformeditor.cpp b/tools/designer/src/lib/sdk/abstractformeditor.cpp index e6debd5..09d6976 100644 --- a/tools/designer/src/lib/sdk/abstractformeditor.cpp +++ b/tools/designer/src/lib/sdk/abstractformeditor.cpp @@ -72,7 +72,6 @@ static void initResources() Q_INIT_RESOURCE(shared); Q_INIT_RESOURCE(ClamshellPhone); Q_INIT_RESOURCE(PDAPhone); - Q_INIT_RESOURCE(pda); Q_INIT_RESOURCE(PortableMedia); Q_INIT_RESOURCE(S60_nHD_Touchscreen); Q_INIT_RESOURCE(S60_QVGA_Candybar); diff --git a/tools/designer/src/lib/shared/formwindowbase.cpp b/tools/designer/src/lib/shared/formwindowbase.cpp index 5be907b..377ae43 100644 --- a/tools/designer/src/lib/shared/formwindowbase.cpp +++ b/tools/designer/src/lib/shared/formwindowbase.cpp @@ -51,7 +51,7 @@ #include "deviceprofile_p.h" #include "qdesigner_utils_p.h" -#include <abstractformbuilder.h> +#include "qsimpleresource_p.h" #include <QtDesigner/QDesignerFormEditorInterface> #include <QtDesigner/QDesignerContainerExtension> @@ -478,6 +478,14 @@ void FormWindowBase::setupDefaultAction(QDesignerFormWindowInterface *fw) QObject::connect(fw, SIGNAL(activated(QWidget*)), fw, SLOT(triggerDefaultAction(QWidget*))); } +QString FormWindowBase::fileContents() const +{ + const bool oldValue = QSimpleResource::setWarningsEnabled(false); + const QString rc = contents(); + QSimpleResource::setWarningsEnabled(oldValue); + return rc; +} + } // namespace qdesigner_internal QT_END_NAMESPACE diff --git a/tools/designer/src/lib/shared/formwindowbase_p.h b/tools/designer/src/lib/shared/formwindowbase_p.h index 68e977e..0891f6e 100644 --- a/tools/designer/src/lib/shared/formwindowbase_p.h +++ b/tools/designer/src/lib/shared/formwindowbase_p.h @@ -90,6 +90,9 @@ public: QVariantMap formData(); void setFormData(const QVariantMap &vm); + // Return contents without warnings. Should be 'contents(bool quiet)' + QString fileContents() const; + // Return the widget containing the form. This is used to // apply embedded design settings to that are inherited (for example font). // These are meant to be applied to the form only and not to the other editors diff --git a/tools/designer/src/lib/shared/newformwidget.cpp b/tools/designer/src/lib/shared/newformwidget.cpp index d79d77a..503e597 100644 --- a/tools/designer/src/lib/shared/newformwidget.cpp +++ b/tools/designer/src/lib/shared/newformwidget.cpp @@ -310,9 +310,8 @@ QImage NewFormWidget::grabForm(QDesignerFormEditorInterface *core, const QString &workingDir, const qdesigner_internal::DeviceProfile &dp) { - qdesigner_internal::QDesignerFormBuilder formBuilder(core, - qdesigner_internal::QDesignerFormBuilder::DisableScripts, - dp); + qdesigner_internal::NewFormWidgetFormBuilder + formBuilder(core, qdesigner_internal::QDesignerFormBuilder::DisableScripts, dp); if (!workingDir.isEmpty()) formBuilder.setWorkingDirectory(workingDir); diff --git a/tools/designer/src/lib/shared/qdesigner_formbuilder.cpp b/tools/designer/src/lib/shared/qdesigner_formbuilder.cpp index 6394847..b92a48d 100644 --- a/tools/designer/src/lib/shared/qdesigner_formbuilder.cpp +++ b/tools/designer/src/lib/shared/qdesigner_formbuilder.cpp @@ -473,6 +473,20 @@ QPixmap QDesignerFormBuilder::createPreviewPixmap(const QDesignerFormWindowInter return rc; } +// ---------- NewFormWidgetFormBuilder + +NewFormWidgetFormBuilder::NewFormWidgetFormBuilder(QDesignerFormEditorInterface *core, + Mode mode, + const DeviceProfile &deviceProfile) : + QDesignerFormBuilder(core, mode, deviceProfile) +{ +} + +void NewFormWidgetFormBuilder::createCustomWidgets(DomCustomWidgets *dc) +{ + QSimpleResource::handleDomCustomWidgets(core(), dc); +} + } // namespace qdesigner_internal QT_END_NAMESPACE diff --git a/tools/designer/src/lib/shared/qdesigner_formbuilder_p.h b/tools/designer/src/lib/shared/qdesigner_formbuilder_p.h index b982e1c..ee40085 100644 --- a/tools/designer/src/lib/shared/qdesigner_formbuilder_p.h +++ b/tools/designer/src/lib/shared/qdesigner_formbuilder_p.h @@ -75,7 +75,7 @@ namespace qdesigner_internal { class DesignerPixmapCache; class DesignerIconCache; -/* Form builder used for previewing forms, widget box and new form dialog. +/* Form builder used for previewing forms and widget box. * It applies the system settings to its toplevel window. */ class QDESIGNER_SHARED_EXPORT QDesignerFormBuilder: public QFormBuilder @@ -159,6 +159,21 @@ private: bool m_mainWidget; }; +// Form builder for a new form widget (preview). To allow for promoted +// widgets in the template, it implements the handling of custom widgets +// (adding of them to the widget database). + +class QDESIGNER_SHARED_EXPORT NewFormWidgetFormBuilder: public QDesignerFormBuilder { +public: + NewFormWidgetFormBuilder(QDesignerFormEditorInterface *core, + Mode mode, + const DeviceProfile &deviceProfile = DeviceProfile()); + +protected: + virtual void createCustomWidgets(DomCustomWidgets *); +}; + + } // namespace qdesigner_internal QT_END_NAMESPACE diff --git a/tools/designer/src/lib/shared/qdesigner_propertycommand.cpp b/tools/designer/src/lib/shared/qdesigner_propertycommand.cpp index ff3b50b..94e8044 100644 --- a/tools/designer/src/lib/shared/qdesigner_propertycommand.cpp +++ b/tools/designer/src/lib/shared/qdesigner_propertycommand.cpp @@ -316,6 +316,10 @@ Qt::Alignment variantToAlignment(const QVariant & q) // find changed subproperties of a variant unsigned compareSubProperties(const QVariant & q1, const QVariant & q2, qdesigner_internal::SpecialProperty specialProperty) { + // Do not clobber new value in the comparison function in + // case someone sets a QString on a PropertySheetStringValue. + if (q1.type() != q2.type()) + return SubPropertyAll; switch (q1.type()) { case QVariant::Rect: return compareSubProperties(q1.toRect(), q2.toRect()); diff --git a/tools/designer/src/lib/shared/qdesigner_toolbar.cpp b/tools/designer/src/lib/shared/qdesigner_toolbar.cpp index 0bb91ee..898be1e 100644 --- a/tools/designer/src/lib/shared/qdesigner_toolbar.cpp +++ b/tools/designer/src/lib/shared/qdesigner_toolbar.cpp @@ -440,18 +440,14 @@ QAction *ToolBarEventFilter::actionAt(const QToolBar *tb, const QPoint &pos) return tb->actions().at(index); } +//that's a trick to get acces to the initStyleOption which is a protected member +class FriendlyToolBar : public QToolBar { +public: + friend class ToolBarEventFilter; +}; + QRect ToolBarEventFilter::handleArea(const QToolBar *tb) { - //that's a trick to get acces to the initStyleOption which is a protected member - class FriendlyToolBar : public QToolBar - { - public: -#ifdef Q_NO_USING_KEYWORD - void initStyleOption(QStyleOptionToolBar *option) { QToolBar::initStyleOption(option); } -#else - using QToolBar::initStyleOption; -#endif - }; QStyleOptionToolBar opt; static_cast<const FriendlyToolBar*>(tb)->initStyleOption(&opt); return tb->style()->subElementRect(QStyle::SE_ToolBarHandle, &opt, tb); diff --git a/tools/designer/src/lib/shared/qsimpleresource.cpp b/tools/designer/src/lib/shared/qsimpleresource.cpp index 8d29002..69d48fd 100644 --- a/tools/designer/src/lib/shared/qsimpleresource.cpp +++ b/tools/designer/src/lib/shared/qsimpleresource.cpp @@ -41,6 +41,7 @@ #include "qsimpleresource_p.h" #include "widgetfactory_p.h" +#include "widgetdatabase_p.h" #include <formscriptrunner_p.h> #include <properties_p.h> @@ -57,6 +58,8 @@ #include <QtGui/QWidget> #include <QtGui/QAction> #include <QtCore/QDebug> +#include <QtCore/QCoreApplication> + QT_BEGIN_NAMESPACE @@ -267,6 +270,136 @@ bool QSimpleResource::warningsEnabled() return m_warningsEnabled; } +// Custom widgets handling helpers + +// Add unique fake slots and signals to lists +bool QSimpleResource::addFakeMethods(const DomSlots *domSlots, QStringList &fakeSlots, QStringList &fakeSignals) +{ + if (!domSlots) + return false; + + bool rc = false; + foreach (const QString &fakeSlot, domSlots->elementSlot()) + if (fakeSlots.indexOf(fakeSlot) == -1) { + fakeSlots += fakeSlot; + rc = true; + } + + foreach (const QString &fakeSignal, domSlots->elementSignal()) + if (fakeSignals.indexOf(fakeSignal) == -1) { + fakeSignals += fakeSignal; + rc = true; + } + return rc; +} + +void QSimpleResource::addFakeMethodsToWidgetDataBase(const DomCustomWidget *domCustomWidget, WidgetDataBaseItem *item) +{ + const DomSlots *domSlots = domCustomWidget->elementSlots(); + if (!domSlots) + return; + + // Merge in new slots, signals + QStringList fakeSlots = item->fakeSlots(); + QStringList fakeSignals = item->fakeSignals(); + if (addFakeMethods(domSlots, fakeSlots, fakeSignals)) { + item->setFakeSlots(fakeSlots); + item->setFakeSignals(fakeSignals); + } +} + +// Perform one iteration of adding the custom widgets to the database, +// looking up the base class and inheriting its data. +// Remove the succeeded custom widgets from the list. +// Classes whose base class could not be found are left in the list. + +void QSimpleResource::addCustomWidgetsToWidgetDatabase(const QDesignerFormEditorInterface *core, + QList<DomCustomWidget*>& custom_widget_list) +{ + QDesignerWidgetDataBaseInterface *db = core->widgetDataBase(); + for (int i=0; i < custom_widget_list.size(); ) { + bool classInserted = false; + DomCustomWidget *custom_widget = custom_widget_list[i]; + const QString customClassName = custom_widget->elementClass(); + const QString base_class = custom_widget->elementExtends(); + QString includeFile; + IncludeType includeType = IncludeLocal; + if (const DomHeader *header = custom_widget->elementHeader()) { + includeFile = header->text(); + if (header->hasAttributeLocation() && header->attributeLocation() == QLatin1String("global")) + includeType = IncludeGlobal; + } + const bool domIsContainer = custom_widget->elementContainer(); + // Append a new item + if (base_class.isEmpty()) { + WidgetDataBaseItem *item = new WidgetDataBaseItem(customClassName); + item->setPromoted(false); + item->setGroup(QCoreApplication::translate("Designer", "Custom Widgets")); + item->setIncludeFile(buildIncludeFile(includeFile, includeType)); + item->setContainer(domIsContainer); + item->setCustom(true); + addFakeMethodsToWidgetDataBase(custom_widget, item); + db->append(item); + custom_widget_list.removeAt(i); + classInserted = true; + } else { + // Create a new entry cloned from base class. Note that this will ignore existing + // classes, eg, plugin custom widgets. + QDesignerWidgetDataBaseItemInterface *item = + appendDerived(db, customClassName, QCoreApplication::translate("Designer", "Promoted Widgets"), + base_class, + buildIncludeFile(includeFile, includeType), + true,true); + // Ok, base class found. + if (item) { + // Hack to accommodate for old UI-files in which "container" is not set properly: + // Apply "container" from DOM only if true (else, eg classes from QFrame might not accept + // dropping child widgets on them as container=false). This also allows for + // QWidget-derived stacked pages. + if (domIsContainer) + item->setContainer(domIsContainer); + + addFakeMethodsToWidgetDataBase(custom_widget, static_cast<WidgetDataBaseItem*>(item)); + custom_widget_list.removeAt(i); + classInserted = true; + } + } + // Skip failed item. + if (!classInserted) + i++; + } + +} + +void QSimpleResource::handleDomCustomWidgets(const QDesignerFormEditorInterface *core, + const DomCustomWidgets *dom_custom_widgets) +{ + if (dom_custom_widgets == 0) + return; + QList<DomCustomWidget*> custom_widget_list = dom_custom_widgets->elementCustomWidget(); + // Attempt to insert each item derived from its base class. + // This should at most require two iterations in the event that the classes are out of order + // (derived first, max depth: promoted custom plugin = 2) + for (int iteration = 0; iteration < 2; iteration++) { + addCustomWidgetsToWidgetDatabase(core, custom_widget_list); + if (custom_widget_list.empty()) + return; + } + // Oops, there are classes left whose base class could not be found. + // Default them to QWidget with warnings. + const QString fallBackBaseClass = QLatin1String("QWidget"); + for (int i=0; i < custom_widget_list.size(); i++ ) { + DomCustomWidget *custom_widget = custom_widget_list[i]; + const QString customClassName = custom_widget->elementClass(); + const QString base_class = custom_widget->elementExtends(); + qDebug() << "** WARNING The base class " << base_class << " of the custom widget class " << customClassName + << " could not be found. Defaulting to " << fallBackBaseClass << '.'; + custom_widget->setElementExtends(fallBackBaseClass); + } + // One more pass. + addCustomWidgetsToWidgetDatabase(core, custom_widget_list); +} + // ------------ FormBuilderClipboard FormBuilderClipboard::FormBuilderClipboard(QWidget *w) diff --git a/tools/designer/src/lib/shared/qsimpleresource_p.h b/tools/designer/src/lib/shared/qsimpleresource_p.h index 8d45c3c..a25cb88 100644 --- a/tools/designer/src/lib/shared/qsimpleresource_p.h +++ b/tools/designer/src/lib/shared/qsimpleresource_p.h @@ -55,15 +55,21 @@ #include "shared_global_p.h" #include "abstractformbuilder.h" +#include <QtCore/QStringList> QT_BEGIN_NAMESPACE class DomScript; +class DomCustomWidgets; +class DomCustomWidget; +class DomSlots; class QDesignerFormEditorInterface; namespace qdesigner_internal { +class WidgetDataBaseItem; + class QDESIGNER_SHARED_EXPORT QSimpleResource : public QAbstractFormBuilder { public: @@ -92,6 +98,11 @@ public: static QString customWidgetScript(QDesignerFormEditorInterface *core, const QString &className); static bool hasCustomWidgetScript(QDesignerFormEditorInterface *core, QObject *object); + // Implementation for FormBuilder::createDomCustomWidgets() that adds + // the custom widgets to the widget database + static void handleDomCustomWidgets(const QDesignerFormEditorInterface *core, + const DomCustomWidgets *dom_custom_widgets); + protected: virtual QIcon nameToIcon(const QString &filePath, const QString &qrcPath); virtual QString iconToFilePath(const QIcon &pm) const; @@ -105,7 +116,13 @@ protected: typedef QList<DomScript*> DomScripts; static void addScript(const QString &script, ScriptSource source, DomScripts &domScripts); + static bool addFakeMethods(const DomSlots *domSlots, QStringList &fakeSlots, QStringList &fakeSignals); + private: + static void addCustomWidgetsToWidgetDatabase(const QDesignerFormEditorInterface *core, + QList<DomCustomWidget*>& custom_widget_list); + static void addFakeMethodsToWidgetDataBase(const DomCustomWidget *domCustomWidget, WidgetDataBaseItem *item); + static bool m_warningsEnabled; QDesignerFormEditorInterface *m_core; }; diff --git a/tools/designer/src/lib/shared/shared.pri b/tools/designer/src/lib/shared/shared.pri index 0424a41..8ed051a 100644 --- a/tools/designer/src/lib/shared/shared.pri +++ b/tools/designer/src/lib/shared/shared.pri @@ -186,17 +186,4 @@ SOURCES += \ $$PWD/filterwidget.cpp \ $$PWD/plugindialog.cpp -RESOURCES += $$PWD/shared.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/ClamshellPhone.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/PDAPhone.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/pda.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/PortableMedia.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/qvfb.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/S60-nHD-Touchscreen.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/S60-QVGA-Candybar.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/SmartPhone2.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/SmartPhone.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/SmartPhoneWithButtons.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/TouchscreenPhone.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/Trolltech-Keypad.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/Trolltech-Touchscreen.qrc +RESOURCES += $$PWD/shared.qrc diff --git a/tools/designer/src/lib/uilib/abstractformbuilder.cpp b/tools/designer/src/lib/uilib/abstractformbuilder.cpp index 4dae28e..c5aefb1 100644 --- a/tools/designer/src/lib/uilib/abstractformbuilder.cpp +++ b/tools/designer/src/lib/uilib/abstractformbuilder.cpp @@ -403,6 +403,7 @@ QAction *QAbstractFormBuilder::create(DomAction *ui_action, QObject *parent) if (!a) return 0; + m_actions.insert(ui_action->attributeName(), a); applyProperties(a, ui_action->elementProperty()); return a; } @@ -415,7 +416,7 @@ QActionGroup *QAbstractFormBuilder::create(DomActionGroup *ui_action_group, QObj QActionGroup *a = createActionGroup(parent, ui_action_group->attributeName()); if (!a) return 0; - + m_actionGroups.insert(ui_action_group->attributeName(), a); applyProperties(a, ui_action_group->elementProperty()); foreach (DomAction *ui_action, ui_action_group->elementAction()) { @@ -1184,8 +1185,6 @@ QAction *QAbstractFormBuilder::createAction(QObject *parent, const QString &name { QAction *action = new QAction(parent); action->setObjectName(name); - m_actions.insert(name, action); - return action; } @@ -1196,8 +1195,6 @@ QActionGroup *QAbstractFormBuilder::createActionGroup(QObject *parent, const QSt { QActionGroup *g = new QActionGroup(parent); g->setObjectName(name); - m_actionGroups.insert(name, g); - return g; } diff --git a/tools/designer/src/lib/uilib/formbuilder.cpp b/tools/designer/src/lib/uilib/formbuilder.cpp index 414eb14..53d1e9d 100644 --- a/tools/designer/src/lib/uilib/formbuilder.cpp +++ b/tools/designer/src/lib/uilib/formbuilder.cpp @@ -120,7 +120,10 @@ QFormBuilder::~QFormBuilder() */ QWidget *QFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidget) { - QFormBuilderExtra::instance(this)->setProcessingLayoutWidget(false); + QFormBuilderExtra *fb = QFormBuilderExtra::instance(this); + if (!fb->parentWidgetIsSet()) + fb->setParentWidget(parentWidget); + fb->setProcessingLayoutWidget(false); if (ui_widget->attributeClass() == QFormBuilderStrings::instance().qWidgetClass && !ui_widget->hasAttributeNative() && parentWidget #ifndef QT_NO_MAINWINDOW @@ -145,7 +148,7 @@ QWidget *QFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidget) && !qobject_cast<QDockWidget *>(parentWidget) #endif ) - QFormBuilderExtra::instance(this)->setProcessingLayoutWidget(true); + fb->setProcessingLayoutWidget(true); return QAbstractFormBuilder::create(ui_widget, parentWidget); } @@ -228,9 +231,6 @@ QWidget *QFormBuilder::createWidget(const QString &widgetName, QWidget *parentWi if (qobject_cast<QDialog *>(w)) w->setParent(parentWidget); - if (!fb->rootWidget()) - fb->setRootWidget(w); - return w; } @@ -369,9 +369,10 @@ QWidget *QFormBuilder::create(DomUI *ui, QWidget *parentWidget) */ QLayout *QFormBuilder::create(DomLayout *ui_layout, QLayout *layout, QWidget *parentWidget) { + QFormBuilderExtra *fb = QFormBuilderExtra::instance(this); // Is this a temporary layout widget used to represent QLayout hierarchies in Designer? // Set its margins to 0. - bool layoutWidget = QFormBuilderExtra::instance(this)->processingLayoutWidget(); + bool layoutWidget = fb->processingLayoutWidget(); QLayout *l = QAbstractFormBuilder::create(ui_layout, layout, parentWidget); if (layoutWidget) { const QFormBuilderStrings &strings = QFormBuilderStrings::instance(); @@ -392,7 +393,7 @@ QLayout *QFormBuilder::create(DomLayout *ui_layout, QLayout *layout, QWidget *pa bottom = prop->elementNumber(); l->setContentsMargins(left, top, right, bottom); - QFormBuilderExtra::instance(this)->setProcessingLayoutWidget(false); + fb->setProcessingLayoutWidget(false); } return l; } @@ -525,6 +526,7 @@ QList<QDesignerCustomWidgetInterface*> QFormBuilder::customWidgets() const /*! \internal */ + void QFormBuilder::applyProperties(QObject *o, const QList<DomProperty*> &properties) { typedef QList<DomProperty*> DomPropertyList; @@ -542,11 +544,12 @@ void QFormBuilder::applyProperties(QObject *o, const QList<DomProperty*> &proper continue; const QString attributeName = (*it)->attributeName(); - if (o == fb->rootWidget() && attributeName == strings.geometryProperty) { - // apply only the size for the rootWidget - fb->rootWidget()->resize(qvariant_cast<QRect>(v).size()); + const bool isWidget = o->isWidgetType(); + if (isWidget && o->parent() == fb->parentWidget() && attributeName == strings.geometryProperty) { + // apply only the size part of a geometry for the root widget + static_cast<QWidget*>(o)->resize(qvariant_cast<QRect>(v).size()); } else if (fb->applyPropertyInternally(o, attributeName, v)) { - } else if (!qstrcmp("QFrame", o->metaObject()->className ()) && attributeName == strings.orientationProperty) { + } else if (isWidget && !qstrcmp("QFrame", o->metaObject()->className ()) && attributeName == strings.orientationProperty) { // ### special-casing for Line (QFrame) -- try to fix me o->setProperty("frameShape", v); // v is of QFrame::Shape enum } else { diff --git a/tools/designer/src/lib/uilib/formbuilderextra.cpp b/tools/designer/src/lib/uilib/formbuilderextra.cpp index cb82967..38fe2ae 100644 --- a/tools/designer/src/lib/uilib/formbuilderextra.cpp +++ b/tools/designer/src/lib/uilib/formbuilderextra.cpp @@ -81,7 +81,8 @@ QFormBuilderExtra::~QFormBuilderExtra() void QFormBuilderExtra::clear() { m_buddies.clear(); - m_rootWidget = 0; + m_parentWidget = 0; + m_parentWidgetIsSet = false; #ifndef QT_FORMBUILDER_NO_SCRIPT m_FormScriptRunner.clearErrors(); m_customWidgetScriptHash.clear(); @@ -136,14 +137,21 @@ bool QFormBuilderExtra::applyBuddy(const QString &buddyName, BuddyMode applyMode return false; } -const QPointer<QWidget> &QFormBuilderExtra::rootWidget() const +const QPointer<QWidget> &QFormBuilderExtra::parentWidget() const { - return m_rootWidget; + return m_parentWidget; } -void QFormBuilderExtra::setRootWidget(const QPointer<QWidget> &w) +bool QFormBuilderExtra::parentWidgetIsSet() const { - m_rootWidget = w; + return m_parentWidgetIsSet; +} + +void QFormBuilderExtra::setParentWidget(const QPointer<QWidget> &w) +{ + // Parent widget requires special handling of the geometry property. + m_parentWidget = w; + m_parentWidgetIsSet = true; } #ifndef QT_FORMBUILDER_NO_SCRIPT diff --git a/tools/designer/src/lib/uilib/formbuilderextra_p.h b/tools/designer/src/lib/uilib/formbuilderextra_p.h index f357239..9166c48 100644 --- a/tools/designer/src/lib/uilib/formbuilderextra_p.h +++ b/tools/designer/src/lib/uilib/formbuilderextra_p.h @@ -101,8 +101,9 @@ public: void applyInternalProperties() const; static bool applyBuddy(const QString &buddyName, BuddyMode applyMode, QLabel *label); - const QPointer<QWidget> &rootWidget() const; - void setRootWidget(const QPointer<QWidget> &w); + const QPointer<QWidget> &parentWidget() const; + bool parentWidgetIsSet() const; + void setParentWidget(const QPointer<QWidget> &w); #ifndef QT_FORMBUILDER_NO_SCRIPT QFormScriptRunner &formScriptRunner(); @@ -182,7 +183,8 @@ private: QResourceBuilder *m_resourceBuilder; QTextBuilder *m_textBuilder; - QPointer<QWidget> m_rootWidget; + QPointer<QWidget> m_parentWidget; + bool m_parentWidgetIsSet; }; void uiLibWarning(const QString &message); diff --git a/tools/designer/src/uitools/quiloader.cpp b/tools/designer/src/uitools/quiloader.cpp index 67bd29c..c6c2d80 100644 --- a/tools/designer/src/uitools/quiloader.cpp +++ b/tools/designer/src/uitools/quiloader.cpp @@ -572,53 +572,51 @@ void QUiLoaderPrivate::setupWidgetMap() const \class QUiLoader \inmodule QtUiTools - \brief The QUiLoader class allows standalone applications dynamically - create user interfaces at run-time using the information stored in - .ui files or specified plugin paths. + \brief The QUiLoader class enables standalone applications to + dynamically create user interfaces at run-time using the + information stored in .ui files or specified in plugin paths. - In addition, you can customize of creating an user interface by + In addition, you can customize or create your own user interface by deriving your own loader class. - If you have a custom component or an application that embeds Qt - Designer, you can also use the QFormBuilder class provided by the - QtDesigner module to create user interfaces from .ui files. + If you have a custom component or an application that embeds \QD, you can + also use the QFormBuilder class provided by the QtDesigner module to create + user interfaces from \c{.ui} files. - The QUiLoader class provides a collection of functions that allows - you to create widgets based on the information stored in \c .ui - files (created with Qt Designer) or available in the specified - plugin paths. The specified plugin paths can be retrieved using - the pluginPaths() function. You can retrieve the contents of an \c - .ui file using the load() function. For example: + The QUiLoader class provides a collection of functions allowing you to + create widgets based on the information stored in \c .ui files (created + with \QD) or available in the specified plugin paths. The specified plugin + paths can be retrieved using the pluginPaths() function. Similarly, the + contents of a \c{.ui} file can be retrieved using the load() function. For + example: \snippet doc/src/snippets/quiloader/mywidget.cpp 0 - By including the user interface in the form's resources (\c myform.qrc), - we ensure that it will be present at run-time: + By including the user interface in the form's resources (\c myform.qrc), we + ensure that it will be present at run-time: \quotefile doc/src/snippets/quiloader/mywidget.qrc - The availableWidgets() function returns a QStringList with the - class names of the widgets available in the specified plugin - paths. You can create any of these widgets using the - createWidget() function. For example: + The availableWidgets() function returns a QStringList with the class names + of the widgets available in the specified plugin paths. To create these + widgets, simply use the createWidget() function. For example: \snippet doc/src/snippets/quiloader/main.cpp 0 - You can make a custom widget available to the loader using the - addPluginPath() function, and you can remove all the available widgets - by calling the clearPluginPaths() function. + To make a custom widget available to the loader, you can use the + addPluginPath() function; to remove all available widgets, you can call + the clearPluginPaths() function. - The createAction(), createActionGroup(), createLayout() and - createWidget() functions are used internally by the QUiLoader class - whenever it has to create an action, action group, layout or - widget respectively. For that reason, you can subclass the QUiLoader - class and reimplement these functions to intervene the process of - constructing an user interface. For example, you might want to - create a list of the actions created when loading a form or - creating a custom widget. + The createAction(), createActionGroup(), createLayout(), and createWidget() + functions are used internally by the QUiLoader class whenever it has to + create an action, action group, layout, or widget respectively. For that + reason, you can subclass the QUiLoader class and reimplement these + functions to intervene the process of constructing a user interface. For + example, you might want to have a list of the actions created when loading + a form or creating a custom widget. - For a complete example using the QUiLoader class, see the \l - {designer/calculatorbuilder}{Calculator Builder} example. + For a complete example using the QUiLoader class, see the + \l{Calculator Builder Example}. \sa QtUiTools, QFormBuilder */ @@ -653,8 +651,8 @@ QUiLoader::~QUiLoader() } /*! - Loads a form from the given \a device and creates a new widget with the given - \a parentWidget to hold its contents. + Loads a form from the given \a device and creates a new widget with the + given \a parentWidget to hold its contents. \sa createWidget() */ @@ -668,8 +666,8 @@ QWidget *QUiLoader::load(QIODevice *device, QWidget *parentWidget) } /*! - Returns a list naming the paths the loader searches when locating - custom widget plugins. + Returns a list naming the paths in which the loader will search when + locating custom widget plugins. \sa addPluginPath(), clearPluginPaths() */ @@ -680,7 +678,7 @@ QStringList QUiLoader::pluginPaths() const } /*! - Clears the list of paths the loader searches when locating + Clears the list of paths in which the loader will search when locating plugins. \sa addPluginPath(), pluginPaths() @@ -692,7 +690,7 @@ void QUiLoader::clearPluginPaths() } /*! - Adds the given \a path to the list of paths the loader searches + Adds the given \a path to the list of paths in which the loader will search when locating plugins. \sa pluginPaths(), clearPluginPaths() @@ -704,17 +702,17 @@ void QUiLoader::addPluginPath(const QString &path) } /*! - Creates a new widget with the given \a parent and \a name - using the class specified by \a className. You can use this - function to create any of the widgets returned by the - availableWidgets() function. + Creates a new widget with the given \a parent and \a name using the class + specified by \a className. You can use this function to create any of the + widgets returned by the availableWidgets() function. - The function is also used internally by the QUiLoader class whenever - it has to create a widget. For that reason, you can subclass the - QUiLoader class and reimplement this function to intervene in the - process of constructing a user interface or widget. + The function is also used internally by the QUiLoader class whenever it + creates a widget. Hence, you can subclass QUiLoader and reimplement this + function to intervene process of constructing a user interface or widget. + However, in your implementation, ensure that you call QUiLoader's version + first. - \sa availableWidgets(), load() + \sa availableWidgets(), load() */ QWidget *QUiLoader::createWidget(const QString &className, QWidget *parent, const QString &name) { @@ -723,13 +721,14 @@ QWidget *QUiLoader::createWidget(const QString &className, QWidget *parent, cons } /*! - Creates a new layout with the given \a parent and \a name - using the class specified by \a className. + Creates a new layout with the given \a parent and \a name using the class + specified by \a className. - The function is used internally by the QUiLoader class whenever it - has to create a layout. For that reason, you can subclass the - QUiLoader class and reimplement this function to intervene the - process of constructing an user interface or widget. + The function is also used internally by the QUiLoader class whenever it + creates a widget. Hence, you can subclass QUiLoader and reimplement this + function to intervene process of constructing a user interface or widget. + However, in your implementation, ensure that you call QUiLoader's version + first. \sa createWidget(), load() */ @@ -742,10 +741,11 @@ QLayout *QUiLoader::createLayout(const QString &className, QObject *parent, cons /*! Creates a new action group with the given \a parent and \a name. - The function is used internally by the QUiLoader class whenever it - has to create an action group. For that reason, you can subclass - the QUiLoader class and reimplement this function to intervene the - process of constructing an user interface or widget. + The function is also used internally by the QUiLoader class whenever it + creates a widget. Hence, you can subclass QUiLoader and reimplement this + function to intervene process of constructing a user interface or widget. + However, in your implementation, ensure that you call QUiLoader's version + first. \sa createAction(), createWidget(), load() */ @@ -758,10 +758,11 @@ QActionGroup *QUiLoader::createActionGroup(QObject *parent, const QString &name) /*! Creates a new action with the given \a parent and \a name. - The function is used internally by the QUiLoader class whenever it - has to create an action. For that reason, you can subclass the - QUiLoader class and reimplement this function to intervene the - process of constructing an user interface or widget. + The function is also used internally by the QUiLoader class whenever it + creates a widget. Hence, you can subclass QUiLoader and reimplement this + function to intervene process of constructing a user interface or widget. + However, in your implementation, ensure that you call QUiLoader's version + first. \sa createActionGroup(), createWidget(), load() */ @@ -772,9 +773,9 @@ QAction *QUiLoader::createAction(QObject *parent, const QString &name) } /*! - Returns a list naming the available widgets that can be built - using the createWidget() function, i.e all the widgets specified - within the given plugin paths. + Returns a list naming all available widgets that can be built using the + createWidget() function, i.e all the widgets specified within the given + plugin paths. \sa pluginPaths(), createWidget() @@ -795,11 +796,11 @@ QStringList QUiLoader::availableWidgets() const /*! - Returns a list naming the available layouts that can be built - using the createLayout() function + \since 4.5 + Returns a list naming all available layouts that can be built using the + createLayout() function \sa createLayout() - \since 4.5 */ QStringList QUiLoader::availableLayouts() const @@ -816,9 +817,9 @@ QStringList QUiLoader::availableLayouts() const } /*! - Sets the working directory of the loader to \a dir. The loader - looks for other resources, such as icons and resource files, - in paths relative to this directory. + Sets the working directory of the loader to \a dir. The loader will look + for other resources, such as icons and resource files, in paths relative to + this directory. \sa workingDirectory() */ @@ -842,9 +843,13 @@ QDir QUiLoader::workingDirectory() const } /*! - Sets whether the execution of scripts is enabled to \a enabled. - \since 4.3 \internal + \since 4.3 + + If \a enabled is true, the loader will be able to execute scripts. + Otherwise, execution of scripts will be disabled. + + \sa isScriptingEnabled() */ void QUiLoader::setScriptingEnabled(bool enabled) @@ -854,10 +859,12 @@ void QUiLoader::setScriptingEnabled(bool enabled) } /*! - Returns whether the execution of scripts is enabled. - \sa setScriptingEnabled() - \since 4.3 - \internal + \internal + \since 4.3 + + Returns true if execution of scripts is enabled; returns false otherwise. + + \sa setScriptingEnabled() */ bool QUiLoader::isScriptingEnabled() const @@ -867,11 +874,13 @@ bool QUiLoader::isScriptingEnabled() const } /*! - Sets whether user interfaces loaded by this loader automatically - retranslate themselves upon receiving a language change event or not, - depending on \a enabled. - \since 4.5 + + If \a enabled is true, user interfaces loaded by this loader will + automatically retranslate themselves upon receiving a language change + event. Otherwise, the user interfaces will not be retranslated. + + \sa isLanguageChangeEnabled() */ void QUiLoader::setLanguageChangeEnabled(bool enabled) @@ -881,9 +890,12 @@ void QUiLoader::setLanguageChangeEnabled(bool enabled) } /*! - Returns whether dynamic retranslation on language change is enabled. - \sa setLanguageChangeEnabled() - \since 4.5 + \since 4.5 + + Returns true if dynamic retranslation on language change is enabled; + returns false otherwise. + + \sa setLanguageChangeEnabled() */ bool QUiLoader::isLanguageChangeEnabled() const @@ -894,11 +906,14 @@ bool QUiLoader::isLanguageChangeEnabled() const /*! \internal + \since 4.5 - Sets whether user interfaces loaded by this loader are translated - at all. Note that this is orthogonal to languageChangeEnabled. + If \a enabled is true, user interfaces loaded by this loader will be + translated. Otherwise, the user interfaces will not be translated. - \since 4.5 + \note This is orthogonal to languageChangeEnabled. + + \sa isLanguageChangeEnabled(), setLanguageChangeEnabled() */ void QUiLoader::setTranslationEnabled(bool enabled) @@ -909,11 +924,11 @@ void QUiLoader::setTranslationEnabled(bool enabled) /*! \internal + \since 4.5 - Returns whether translation is enabled. - \sa setTranslationEnabled() + Returns true if translation is enabled; returns false otherwise. - \since 4.5 + \sa setTranslationEnabled() */ bool QUiLoader::isTranslationEnabled() const diff --git a/tools/kmap2qmap/main.cpp b/tools/kmap2qmap/main.cpp index b518392..12d91c6 100644 --- a/tools/kmap2qmap/main.cpp +++ b/tools/kmap2qmap/main.cpp @@ -384,10 +384,12 @@ static const symbol_synonyms_t symbol_synonyms[] = { static const int symbol_synonyms_size = sizeof(symbol_synonyms)/sizeof(symbol_synonyms_t); // makes the generated array in --header mode a bit more human readable +QT_BEGIN_NAMESPACE static bool operator<(const QWSKeyboard::Mapping &m1, const QWSKeyboard::Mapping &m2) { return m1.keycode != m2.keycode ? m1.keycode < m2.keycode : m1.modifiers < m2.modifiers; } +QT_END_NAMESPACE class KeymapParser { public: diff --git a/tools/linguist/lconvert/main.cpp b/tools/linguist/lconvert/main.cpp index bdc6c9a..ce17b6f 100644 --- a/tools/linguist/lconvert/main.cpp +++ b/tools/linguist/lconvert/main.cpp @@ -97,6 +97,11 @@ static int usage(const QStringList &args) " Drop obsolete messages.\n\n" " --no-finished\n" " Drop finished messages.\n\n" + " --locations {absolute|relative|none}\n" + " Override how source code references are saved in ts files.\n" + " Default is absolute.\n}n" + " --no-ui-lines\n" + " Drop line numbers from references to .ui files.\n\n" " --verbose\n" " be a bit more verbose\n\n" "Long options can be specified with only one leading dash, too.\n\n" @@ -129,6 +134,8 @@ int main(int argc, char *argv[]) bool noObsolete = false; bool noFinished = false; bool verbose = false; + bool noUiLines = false; + Translator::LocationsType locations = Translator::DefaultLocations; ConversionData cd; Translator tr; @@ -180,6 +187,19 @@ int main(int argc, char *argv[]) noObsolete = true; } else if (args[i] == QLatin1String("-no-finished")) { noFinished = true; + } else if (args[i] == QLatin1String("-locations")) { + if (++i >= args.size()) + return usage(args); + if (args[i] == QLatin1String("none")) + locations = Translator::NoLocations; + else if (args[i] == QLatin1String("relative")) + locations = Translator::RelativeLocations; + else if (args[i] == QLatin1String("absolute")) + locations = Translator::AbsoluteLocations; + else + return usage(args); + } else if (args[i] == QLatin1String("-no-ui-lines")) { + noUiLines = true; } else if (args[i] == QLatin1String("-verbose")) { verbose = true; } else if (args[i].startsWith(QLatin1Char('-'))) { @@ -224,6 +244,10 @@ int main(int argc, char *argv[]) tr.stripFinishedMessages(); if (dropTranslations) tr.dropTranslations(); + if (noUiLines) + tr.dropUiLines(); + if (locations != Translator::DefaultLocations) + tr.setLocationsType(locations); if (!tr.save(outFileName, cd, outFormat)) { qWarning("%s", qPrintable(cd.error())); diff --git a/tools/linguist/linguist/mainwindow.cpp b/tools/linguist/linguist/mainwindow.cpp index 5157fbe..f91175d 100644 --- a/tools/linguist/linguist/mainwindow.cpp +++ b/tools/linguist/linguist/mainwindow.cpp @@ -127,7 +127,7 @@ static Ending ending(QString str, QLocale::Language lang) switch (ch) { case 0x002e: // full stop - if (str.endsWith(QString(QLatin1String("...")))) + if (str.endsWith(QLatin1String("..."))) return End_Ellipsis; else return End_FullStop; @@ -1342,17 +1342,13 @@ void MainWindow::about() QString version = tr("Version %1"); version = version.arg(QLatin1String(QT_VERSION_STR)); - // TODO: Remove this variable for 4.6.0. Must keep this way for 4.5.x due to string freeze. - QString edition; - box.setText(tr("<center><img src=\":/images/splash.png\"/></img><p>%1</p></center>" "<p>Qt Linguist is a tool for adding translations to Qt " "applications.</p>" - "<p>%2</p>" "<p>Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)." "</p><p>The program is provided AS IS with NO WARRANTY OF ANY KIND," " INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A" - " PARTICULAR PURPOSE.</p>").arg(version).arg(edition)); + " PARTICULAR PURPOSE.</p>").arg(version)); box.setWindowTitle(QApplication::translate("AboutDialog", "Qt Linguist")); box.setIcon(QMessageBox::NoIcon); diff --git a/tools/linguist/linguist/phrase.cpp b/tools/linguist/linguist/phrase.cpp index 300f6e8..b1f9818 100644 --- a/tools/linguist/linguist/phrase.cpp +++ b/tools/linguist/linguist/phrase.cpp @@ -152,10 +152,10 @@ bool QphHandler::startElement(const QString & /* namespaceURI */, const QString &qName, const QXmlAttributes &atts) { - if (qName == QString(QLatin1String("QPH"))) { + if (qName == QLatin1String("QPH")) { m_language = atts.value(QLatin1String("language")); m_sourceLanguage = atts.value(QLatin1String("sourcelanguage")); - } else if (qName == QString(QLatin1String("phrase"))) { + } else if (qName == QLatin1String("phrase")) { source.truncate(0); target.truncate(0); definition.truncate(0); @@ -168,13 +168,13 @@ bool QphHandler::endElement(const QString & /* namespaceURI */, const QString & /* localName */, const QString &qName) { - if (qName == QString(QLatin1String("source"))) + if (qName == QLatin1String("source")) source = accum; - else if (qName == QString(QLatin1String("target"))) + else if (qName == QLatin1String("target")) target = accum; - else if (qName == QString(QLatin1String("definition"))) + else if (qName == QLatin1String("definition")) definition = accum; - else if (qName == QString(QLatin1String("phrase"))) + else if (qName == QLatin1String("phrase")) pb->m_phrases.append(new Phrase(source, target, definition, pb)); return true; } diff --git a/tools/linguist/lupdate/java.cpp b/tools/linguist/lupdate/java.cpp index c8dbe5b..658aebf 100644 --- a/tools/linguist/lupdate/java.cpp +++ b/tools/linguist/lupdate/java.cpp @@ -60,7 +60,7 @@ enum { Tok_Eof, Tok_class, Tok_return, Tok_tr, Tok_Comment, Tok_String, Tok_Colon, Tok_Dot, Tok_LeftBrace, Tok_RightBrace, Tok_LeftParen, Tok_RightParen, Tok_Comma, Tok_Semicolon, - Tok_Integer, Tok_Plus, Tok_PlusPlus, Tok_PlusEq }; + Tok_Integer, Tok_Plus, Tok_PlusPlus, Tok_PlusEq, Tok_null }; class Scope { @@ -144,7 +144,11 @@ static int getToken() case 'c': if ( yyIdent == QLatin1String("class") ) return Tok_class; - break; + break; + case 'n': + if ( yyIdent == QLatin1String("null") ) + return Tok_null; + break; } } switch ( yyIdent.at(0).toLatin1() ) { @@ -371,22 +375,15 @@ static bool matchString( QString &s ) return true; } -static bool matchInteger( qlonglong *number) -{ - bool matches = (yyTok == Tok_Integer); - if (matches) { - yyTok = getToken(); - *number = yyInteger; - } - return matches; -} - static bool matchStringOrNull(QString &s) { bool matches = matchString(s); - qlonglong num = 0; - if (!matches) matches = matchInteger(&num); - return matches && num == 0; + if (!matches) { + matches = (yyTok == Tok_null); + if (matches) + yyTok = getToken(); + } + return matches; } /* diff --git a/tools/linguist/lupdate/merge.cpp b/tools/linguist/lupdate/merge.cpp index c4f4448..4849d6e 100644 --- a/tools/linguist/lupdate/merge.cpp +++ b/tools/linguist/lupdate/merge.cpp @@ -193,7 +193,7 @@ static QString translationAttempt(const QString &oldTranslation, */ for (k = 0; k < p; k++) { if (!met[k]) - attempt += QString(QLatin1String(" {")) + newNumbers[k] + QString(QLatin1String("?}")); + attempt += QLatin1String(" {") + newNumbers[k] + QLatin1String("?}"); } /* @@ -205,8 +205,8 @@ static QString translationAttempt(const QString &oldTranslation, for (ell = 0; ell < p; ell++) { if (k != ell && oldNumbers[k] == oldNumbers[ell] && newNumbers[k] < newNumbers[ell]) - attempt += QString(QLatin1String(" {")) + newNumbers[k] + QString(QLatin1String(" or ")) + - newNumbers[ell] + QString(QLatin1String("?}")); + attempt += QLatin1String(" {") + newNumbers[k] + QLatin1String(" or ") + + newNumbers[ell] + QLatin1String("?}"); } } return attempt; diff --git a/tools/linguist/shared/profileevaluator.cpp b/tools/linguist/shared/profileevaluator.cpp index 0be6bec..ae46ad8 100644 --- a/tools/linguist/shared/profileevaluator.cpp +++ b/tools/linguist/shared/profileevaluator.cpp @@ -894,7 +894,7 @@ QStringList ProFileEvaluator::Private::qmakeFeaturePaths() { QStringList concat; { - const QString base_concat = QDir::separator() + QString(QLatin1String("features")); + const QString base_concat = QDir::separator() + QLatin1String("features"); concat << base_concat + QDir::separator() + QLatin1String("mac"); concat << base_concat + QDir::separator() + QLatin1String("macx"); concat << base_concat + QDir::separator() + QLatin1String("unix"); @@ -903,7 +903,7 @@ QStringList ProFileEvaluator::Private::qmakeFeaturePaths() concat << base_concat + QDir::separator() + QLatin1String("qnx6"); concat << base_concat; } - const QString mkspecs_concat = QDir::separator() + QString(QLatin1String("mkspecs")); + const QString mkspecs_concat = QDir::separator() + QLatin1String("mkspecs"); QStringList feature_roots; QByteArray mkspec_path = qgetenv("QMAKEFEATURES"); if (!mkspec_path.isNull()) diff --git a/tools/linguist/shared/proparserutils.h b/tools/linguist/shared/proparserutils.h index c27c3c0..3eab43f 100644 --- a/tools/linguist/shared/proparserutils.h +++ b/tools/linguist/shared/proparserutils.h @@ -282,7 +282,7 @@ static QStringList split_value_list(const QString &vals, bool do_semicolon=false static QStringList qmake_mkspec_paths() { QStringList ret; - const QString concat = QDir::separator() + QString(QLatin1String("mkspecs")); + const QString concat = QDir::separator() + QLatin1String("mkspecs"); QByteArray qmakepath = qgetenv("QMAKEPATH"); if (!qmakepath.isEmpty()) { const QStringList lst = splitPathList(QString::fromLocal8Bit(qmakepath)); diff --git a/tools/linguist/shared/translator.cpp b/tools/linguist/shared/translator.cpp index 312bb71..c1f242d 100644 --- a/tools/linguist/shared/translator.cpp +++ b/tools/linguist/shared/translator.cpp @@ -416,6 +416,26 @@ void Translator::dropTranslations() } } +void Translator::dropUiLines() +{ + QString uiXt = QLatin1String(".ui"); + QString juiXt = QLatin1String(".jui"); + for (TMM::Iterator it = m_messages.begin(); it != m_messages.end(); ++it) { + QHash<QString, int> have; + QList<TranslatorMessage::Reference> refs; + foreach (const TranslatorMessage::Reference &itref, it->allReferences()) { + const QString &fn = itref.fileName(); + if (fn.endsWith(uiXt) || fn.endsWith(juiXt)) { + if (++have[fn] == 1) + refs.append(TranslatorMessage::Reference(fn, -1)); + } else { + refs.append(itref); + } + } + it->setReferences(refs); + } +} + QSet<TranslatorMessagePtr> Translator::resolveDuplicates() { QSet<TranslatorMessagePtr> dups; diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h index 4e97000..5d0549b 100644 --- a/tools/linguist/shared/translator.h +++ b/tools/linguist/shared/translator.h @@ -132,6 +132,7 @@ public: void stripNonPluralForms(); void stripIdenticalSourceTranslations(); void dropTranslations(); + void dropUiLines(); void makeFileNamesAbsolute(const QDir &originalPath); QSet<TranslatorMessagePtr> resolveDuplicates(); static void reportDuplicates(const QSet<TranslatorMessagePtr> &dupes, @@ -143,7 +144,7 @@ public: QString languageCode() const { return m_language; } QString sourceLanguageCode() const { return m_sourceLanguage; } - enum LocationsType { NoLocations, RelativeLocations, AbsoluteLocations }; + enum LocationsType { DefaultLocations, NoLocations, RelativeLocations, AbsoluteLocations }; void setLocationsType(LocationsType lt) { m_locationsType = lt; } LocationsType locationsType() const { return m_locationsType; } diff --git a/tools/macdeployqt/shared/shared.cpp b/tools/macdeployqt/shared/shared.cpp index a10e668..3b9ba73 100644 --- a/tools/macdeployqt/shared/shared.cpp +++ b/tools/macdeployqt/shared/shared.cpp @@ -357,7 +357,7 @@ DeploymentInfo deployQtFrameworks(QList<FrameworkInfo> frameworks, copiedFrameworks.append(framework.frameworkName); // Get the qt path from one of the Qt frameworks; - if (deploymenInfo.qtPath == QString() && framework.frameworkName.contains("Qt") + if (deploymenInfo.qtPath.isNull() && framework.frameworkName.contains("Qt") && framework.frameworkDirectory.contains("/lib")) { deploymenInfo.qtPath = framework.frameworkDirectory; @@ -375,7 +375,7 @@ DeploymentInfo deployQtFrameworks(QList<FrameworkInfo> frameworks, // Copy farmework to app bundle. const QString deployedBinaryPath = copyFramework(framework, bundlePath); // Skip the rest if already was deployed. - if (deployedBinaryPath == QString()) + if (deployedBinaryPath.isNull()) continue; runStrip(deployedBinaryPath); diff --git a/tools/pixeltool/qpixeltool.cpp b/tools/pixeltool/qpixeltool.cpp index 6de7741..c55cbd1 100644 --- a/tools/pixeltool/qpixeltool.cpp +++ b/tools/pixeltool/qpixeltool.cpp @@ -179,13 +179,13 @@ void QPixelTool::paintEvent(QPaintEvent *) if (m_displayZoom) { render_string(&p, w, h, - QString(QLatin1String("Zoom: x%1")).arg(m_zoom), + QString::fromLatin1("Zoom: x%1").arg(m_zoom), Qt::AlignTop | Qt::AlignRight); } if (m_displayGridSize) { render_string(&p, w, h, - QString(QLatin1String("Grid size: %1")).arg(m_gridSize), + QString::fromLatin1("Grid size: %1").arg(m_gridSize), Qt::AlignBottom | Qt::AlignLeft); } diff --git a/tools/porting/src/logger.cpp b/tools/porting/src/logger.cpp index fb44de7..bbeac9c 100644 --- a/tools/porting/src/logger.cpp +++ b/tools/porting/src/logger.cpp @@ -60,8 +60,8 @@ SourcePointLogEntry::SourcePointLogEntry(QString type, QString location, QString QString SourcePointLogEntry::description() const { return QLatin1String("In file ") + file + - QLatin1String(" at line ") + QString(QLatin1String("%1")).arg(line + 1) + //line count is zero based, adjust here. - QLatin1String(" column ") + QString(QLatin1String("%1")).arg(column) + + QLatin1String(" at line ") + QString::number(line + 1) + //line count is zero based, adjust here. + QLatin1String(" column ") + QString::number(column) + QLatin1String(": ") + text ; } @@ -127,7 +127,7 @@ QStringList Logger::fullReport() commitSection(); QStringList report; report << QLatin1String("Log for qt3to4 on ") + QDateTime::currentDateTime().toString() + - QLatin1String(". Number of log entries: ") + QString(QLatin1String("%1")).arg(logEntries.size()); + QLatin1String(". Number of log entries: ") + QString::number(logEntries.size()); foreach(LogEntry *logEntry, logEntries) { report << logEntry->description(); } diff --git a/tools/porting/src/portingrules.cpp b/tools/porting/src/portingrules.cpp index 4931064..cd29403 100644 --- a/tools/porting/src/portingrules.cpp +++ b/tools/porting/src/portingrules.cpp @@ -189,7 +189,7 @@ void PortingRules::parseXml(QString fileName) QString includeFile = xml[QLatin1String("Rules")][QLatin1String("Include")].text(); - if(includeFile != QString()) { + if(!includeFile.isNull()) { QString resolvedIncludeFile = resolveFileName(fileName, includeFile); if (!resolvedIncludeFile.isEmpty()) parseXml(resolvedIncludeFile); diff --git a/tools/qdbus/qdbusviewer/qdbusviewer.cpp b/tools/qdbus/qdbusviewer/qdbusviewer.cpp index 9c25a89..fcb63a8 100644 --- a/tools/qdbus/qdbusviewer/qdbusviewer.cpp +++ b/tools/qdbus/qdbusviewer/qdbusviewer.cpp @@ -441,21 +441,14 @@ void QDBusViewer::about() { QMessageBox box(this); - // TODO: Remove these variables for 4.6.0. Must keep this way for 4.5.x due to string freeze. - QString edition; - QString info; - QString moreInfo; - box.setText(QString::fromLatin1("<center><img src=\":/trolltech/qdbusviewer/images/qdbusviewer-128.png\">" "<h3>%1</h3>" - "<p>Version %2 %3</p></center>" - "<p>%4</p>" - "<p>%5</p>" + "<p>Version %2</p></center>" "<p>Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).</p>" "<p>The program is provided AS IS with NO WARRANTY OF ANY KIND," " INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A" " PARTICULAR PURPOSE.<p/>") - .arg(tr("D-Bus Viewer")).arg(QLatin1String(QT_VERSION_STR)).arg(edition).arg(info).arg(moreInfo)); + .arg(tr("D-Bus Viewer")).arg(QLatin1String(QT_VERSION_STR))); box.setWindowTitle(tr("D-Bus Viewer")); box.exec(); } diff --git a/tools/qdoc3/codeparser.cpp b/tools/qdoc3/codeparser.cpp index 9a58bc6..20b37a0 100644 --- a/tools/qdoc3/codeparser.cpp +++ b/tools/qdoc3/codeparser.cpp @@ -47,6 +47,7 @@ #include "codeparser.h" #include "node.h" #include "tree.h" +#include "config.h" QT_BEGIN_NAMESPACE @@ -67,6 +68,7 @@ QT_BEGIN_NAMESPACE #define COMMAND_TITLE Doc::alias(QLatin1String("title")) QList<CodeParser *> CodeParser::parsers; +bool CodeParser::showInternal = false; /*! The constructor adds this code parser to the static @@ -87,11 +89,11 @@ CodeParser::~CodeParser() } /*! - Initializing a code parser is trivial. + Initialize the code parser base class. */ -void CodeParser::initializeParser(const Config & /* config */) +void CodeParser::initializeParser(const Config& config) { - // nothing. + showInternal = config.getBool(QLatin1String(CONFIG_SHOWINTERNAL)); } /*! @@ -217,8 +219,10 @@ void CodeParser::processCommonMetaCommand(const Location &location, node->setStatus(Node::Preliminary); } else if (command == COMMAND_INTERNAL) { - node->setAccess(Node::Private); - node->setStatus(Node::Internal); + if (!showInternal) { + node->setAccess(Node::Private); + node->setStatus(Node::Internal); + } } else if (command == COMMAND_REENTRANT) { node->setThreadSafeness(Node::Reentrant); @@ -241,19 +245,6 @@ void CodeParser::processCommonMetaCommand(const Location &location, if (node->type() == Node::Fake) { FakeNode *fake = static_cast<FakeNode *>(node); fake->setTitle(arg); -#ifdef QDOC2DOX - /* qdoc -> doxygen. - I think this must be done here, because there can be multiple - "\externalpage" and "\title" metacommands in a single qdoc - comment, which means, among other things, that the "\title" - commands are not inserted into the metacommand map used by - the Doc class. I'm sure there4 is a better way to do this in - the DoxWriter class using the information in the FakeNode, - but I don't have time to figure it out right now. - */ - if (DoxWriter::isDoxPass(1)) - DoxWriter::insertTitle(fake,arg); -#endif } else location.warning(tr("Ignored '\\%1'").arg(COMMAND_TITLE)); diff --git a/tools/qdoc3/codeparser.h b/tools/qdoc3/codeparser.h index 019e806..0152b9c 100644 --- a/tools/qdoc3/codeparser.h +++ b/tools/qdoc3/codeparser.h @@ -87,6 +87,7 @@ class CodeParser private: static QList<CodeParser *> parsers; + static bool showInternal; }; QT_END_NAMESPACE diff --git a/tools/qdoc3/config.cpp b/tools/qdoc3/config.cpp index c8488f3..aa6b454 100644 --- a/tools/qdoc3/config.cpp +++ b/tools/qdoc3/config.cpp @@ -751,7 +751,7 @@ void Config::load(Location location, const QString& fileName) word += QChar(c.digitValue()); SKIP_CHAR(); } - else if ((metaCharPos = QString(QLatin1String("abfnrtv")).indexOf(c)) != -1) { + else if ((metaCharPos = QString::fromLatin1("abfnrtv").indexOf(c)) != -1) { word += "\a\b\f\n\r\t\v"[metaCharPos]; SKIP_CHAR(); } diff --git a/tools/qdoc3/config.h b/tools/qdoc3/config.h index 9443f0d..7eb7048 100644 --- a/tools/qdoc3/config.h +++ b/tools/qdoc3/config.h @@ -147,6 +147,7 @@ class Config #define CONFIG_QHP "qhp" #define CONFIG_QUOTINGINFORMATION "quotinginformation" #define CONFIG_SLOW "slow" +#define CONFIG_SHOWINTERNAL "showinternal" #define CONFIG_SOURCEDIRS "sourcedirs" #define CONFIG_SOURCES "sources" #define CONFIG_SPURIOUS "spurious" diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index 1ad5843..8baef0c 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -589,22 +589,6 @@ Node *CppCodeParser::processTopicCommand(const Doc& doc, // ### split(" ") hack is there to support header file syntax QStringList paths = arg.split(" "); QStringList path = paths[0].split("::"); - -#if QDOC2DOX - // qdoc -> doxygen. - if (Doc::isDoxPass(1)) { - if (command == COMMAND_PROPERTY) { - Doc::insertProperty(path); - } - else if (command == COMMAND_VARIABLE) { - Doc::insertVariable(path); - } - else if (command == COMMAND_ENUM) { - // zzz - } - } -#endif - Node *node = 0; if (!usedNamespaces.isEmpty()) { foreach (const QString &usedNamespace, usedNamespaces) { @@ -1753,12 +1737,6 @@ bool CppCodeParser::matchDocsAndStuff() readToken(); Doc::trimCStyleComment(start_loc,comment); - /* - qdoc --> doxygen - We must also remember the location of the end - of the comment, so we can construct a diff for - it. - */ Location end_loc(location()); /* diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 61d0ed6..f0a4c12 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -515,14 +515,7 @@ void DocParser::parse(const QString& source, break; case CMD_BADCODE: leavePara(); -#ifdef QDOC2DOX - if (DoxWriter::isDoxPass()) - append(Atom::CodeBad,getUnmarkedCode(CMD_BADCODE)); - else - append(Atom::CodeBad,getCode(CMD_BADCODE, marker)); -#else append(Atom::CodeBad,getCode(CMD_BADCODE, marker)); -#endif break; case CMD_BASENAME: leavePara(); @@ -538,17 +531,8 @@ void DocParser::parse(const QString& source, case CMD_C: enterPara(); x = untabifyEtc(getArgument(true)); -#ifdef QDOC2DOX - if (DoxWriter::isDoxPass()) - append(Atom::C, x); - else { - marker = CodeMarker::markerForCode(x); - append(Atom::C, marker->markedUpCode(x, 0, "")); - } -#else marker = CodeMarker::markerForCode(x); append(Atom::C, marker->markedUpCode(x, 0, "")); -#endif break; case CMD_CAPTION: leavePara(); @@ -559,14 +543,7 @@ void DocParser::parse(const QString& source, break; case CMD_CODE: leavePara(); -#ifdef QDOC2DOX - if (DoxWriter::isDoxPass()) - append(Atom::Code, getUnmarkedCode(CMD_CODE)); - else - append(Atom::Code, getCode(CMD_CODE, marker)); -#else append(Atom::Code, getCode(CMD_CODE, marker)); -#endif break; #ifdef QDOC_QML case CMD_QML: @@ -579,17 +556,6 @@ void DocParser::parse(const QString& source, #endif case CMD_CODELINE: { -#ifdef QDOC2DOX - if (!quoting && !DoxWriter::isDoxPass()) { - if (priv->text.lastAtom()->type() == Atom::Code - && priv->text.lastAtom()->string().endsWith("\n\n")) - priv->text.lastAtom()->chopString(); - appendToCode("\n"); - } lse { - append(Atom::CodeQuoteCommand, cmdStr); - append(Atom::CodeQuoteArgument, " "); - } -#else if (!quoting) { if (priv->text.lastAtom()->type() == Atom::Code && priv->text.lastAtom()->string().endsWith("\n\n")) @@ -600,37 +566,10 @@ void DocParser::parse(const QString& source, append(Atom::CodeQuoteCommand, cmdStr); append(Atom::CodeQuoteArgument, " "); } -#endif } break; case CMD_DOTS: { -#ifdef QDOC2DOX - if (DoxWriter::isDoxPass()) { - append(Atom::CodeQuoteCommand, cmdStr); - append(Atom::CodeQuoteArgument, " ..."); - } - else if (!quoting) { - if (priv->text.lastAtom()->type() == Atom::Code - && priv->text.lastAtom()->string().endsWith("\n\n")) - priv->text.lastAtom()->chopString(); - - QString arg = getOptionalArgument(); - int indent = 4; - if (!arg.isEmpty()) - indent = arg.toInt(); - for (int i = 0; i < indent; ++i) - appendToCode(" "); - appendToCode("...\n"); - } - else { - append(Atom::CodeQuoteCommand, cmdStr); - QString arg = getOptionalArgument(); - if (arg.isEmpty()) - arg = "4"; - append(Atom::CodeQuoteArgument, arg); - } -#else if (!quoting) { if (priv->text.lastAtom()->type() == Atom::Code && priv->text.lastAtom()->string().endsWith("\n\n")) @@ -651,7 +590,6 @@ void DocParser::parse(const QString& source, arg = "4"; append(Atom::CodeQuoteArgument, arg); } -#endif } break; case CMD_ELSE: @@ -953,19 +891,8 @@ void DocParser::parse(const QString& source, break; case CMD_OLDCODE: leavePara(); -#ifdef QDOC2DOX - if (DoxWriter::isDoxPass()) { - append(Atom::CodeOld, getUnmarkedCode(CMD_OLDCODE)); - append(Atom::CodeNew, getUnmarkedCode(CMD_NEWCODE)); - } - else { - append(Atom::CodeOld, getCode(CMD_OLDCODE, marker)); - append(Atom::CodeNew, getCode(CMD_NEWCODE, marker)); - } -#else append(Atom::CodeOld, getCode(CMD_OLDCODE, marker)); append(Atom::CodeNew, getCode(CMD_NEWCODE, marker)); -#endif break; case CMD_OMIT: getUntilEnd(cmd); @@ -1147,18 +1074,6 @@ void DocParser::parse(const QString& source, { QString snippet = getArgument(); QString identifier = getRestOfLine(); -#ifdef QDOC2DOX - if (quoting || DoxWriter::isDoxPass()) { - append(Atom::SnippetCommand, cmdStr); - append(Atom::SnippetLocation, snippet); - append(Atom::SnippetIdentifier, identifier); - } - else { - Doc::quoteFromFile(location(),quoter,snippet); - appendToCode(quoter.quoteSnippet(location(), - identifier)); - } -#else if (quoting) { append(Atom::SnippetCommand, cmdStr); append(Atom::SnippetLocation, snippet); @@ -1169,7 +1084,6 @@ void DocParser::parse(const QString& source, appendToCode(quoter.quoteSnippet(location(), identifier)); } -#endif } break; case CMD_SUB: @@ -1251,7 +1165,7 @@ void DocParser::parse(const QString& source, append(Atom::FormattingRight, ATOM_FORMATTING_BOLD); append(Atom::String, " "); break; - case CMD_OVERLOAD: // qdoc --> doxygen + case CMD_OVERLOAD: priv->metacommandsUsed.insert(cmdStr); x.clear(); if (!isBlankLine()) @@ -1265,9 +1179,7 @@ void DocParser::parse(const QString& source, } else { append(Atom::ParaLeft); - append(Atom::String, - "This is an overloaded member function, " - "provided for convenience."); + append(Atom::String,"This is an overloaded function."); append(Atom::ParaRight); x = getMetaCommandArgument(cmdStr); } @@ -2345,7 +2257,7 @@ QString DocParser::getCode(int cmd, CodeMarker *marker) } /*! - Used only for generating doxygen output. + Was used only for generating doxygen output. */ QString DocParser::getUnmarkedCode(int cmd) { @@ -2581,36 +2493,6 @@ QString DocParser::slashed(const QString& str) #define COMMAND_QMLBRIEF Doc::alias("qmlbrief") #endif -#ifdef QDOC2DOX -#define DOXYGEN_INDENT 2 -#define DOXYGEN_TAB_SIZE 4 -#define DOXYGEN_INDENT_STRING " " -#define DOXYGEN_TAB_STRING " " - -static QRegExp ws_rx("\\s"); -static QRegExp not_ws_rx("\\S"); - -int DoxWriter::doxPass = 0; -QString DoxWriter::currentClass; -QSet<QString> DoxWriter::anchors; -QStringMap DoxWriter::exampleTitles; -QStringMap DoxWriter::headerFileTitles; -QStringMap DoxWriter::fileTitles; -QStringMap DoxWriter::groupTitles; -QStringMap DoxWriter::moduleTitles; -QStringMap DoxWriter::pageTitles; -QStringMap DoxWriter::externalPageTitles; -QStringMap DoxWriter::exampleTitlesInverse; -QStringMap DoxWriter::headerFileTitlesInverse; -QStringMap DoxWriter::fileTitlesInverse; -QStringMap DoxWriter::groupTitlesInverse; -QStringMap DoxWriter::moduleTitlesInverse; -QStringMap DoxWriter::pageTitlesInverse; -QStringMap DoxWriter::externalPageTitlesInverse; -QStringMultiMap DoxWriter::variables; -QStringMultiMap DoxWriter::properties; -QStringMultiMap DoxWriter::enums; -#endif Doc::Doc(const Location& start_loc, const Location& end_loc, @@ -2620,15 +2502,6 @@ Doc::Doc(const Location& start_loc, priv = new DocPrivate(start_loc,end_loc,source); DocParser parser; parser.parse(source,priv,metaCommandSet); -#ifdef QDOC2DOX - if (DoxWriter::isDoxPass()) { - DoxWriter doxWriter(source,priv); - if (DoxWriter::isDoxPass(1)) - doxWriter.pass1(); - else - doxWriter.pass2(); - } -#endif } Doc::Doc(const Doc& doc) @@ -3182,1855 +3055,4 @@ void Doc::detach() priv = newPriv; } -#ifdef QDOC2DOX -/*! - Sets the doxygen writer pass to \a pass. You can use - isDoxPass(), with or without a parameter, to test if - you are in a doxygen writer run or in a specific pass - of a doxygen writer run. - - This function is only called from main() if either the - \e doxygen1 or \e doxygen2 flag is passed to qdoc3 on - the command line. - */ -void DoxWriter::setDoxPass(int pass) -{ - qDebug() << "SETTING doxygen pass to " << pass - << " in DoxWriter::setDoxPass()"; - doxPass = pass; -} - -/*! - Returns true if the doxygen pass is set to \a pass, - which means we are in the specified \a pass of a doxygen - writer run of qdoc3. - */ -bool DoxWriter::isDoxPass(int pass) { return (doxPass == pass); } - -/*! - Returns true if the doxygen pass is 1 or 2, which - means this is a doxygen writer run to transform qdoc - comments into doxygen comments. - */ -bool DoxWriter::isDoxPass() { return (doxPass > 0); } - -bool DoxWriter::conversionRequired() const -{ - /* - Loop through all the topic commands searching for - one that must be transformed to doxygen format. If - one is found, return true. - */ - QCommandMap::const_iterator i; - i = priv->metaCommandMap.constBegin(); - while (i != priv->metaCommandMap.constEnd()) { - QString s = i.key(); - if (s == "enum") - return true; - else if (s == "example") - return true; - else if (s == "externalpage") - return true; - else if (s == "group") - return true; - else if (s == "headerfile") - return true; - else if (s == "module") - return true; - else if (s == "page") - return true; - else if (s == "property") - return true; - else if (s == "typedef") - return true; - else if (s == "variable") - return true; - else if (s == "overload") - return true; - else if (s == "reimp") - return true; - else if (s == "relates") - return true; - else if (s == "macro") - return true; - else { -#if 0 - if (s == "class") - else if (s == "namespace") - else if (s == "service") - else if (s == "inheaderfile") - else if (s == "file") - else if (s == "fn") - else if (s == "contentspage") - else if (s == "nextpage") - else if (s == "previous") - else if (s == "indexpage") - else if (s == "startpage") -#endif - } - ++i; - } - - /* - Loop through all the qdoc atoms searching for one - that must be transformed to doxygen format. If one - is found, return true. - */ - const Atom* next = priv->text.firstAtom(); - while (next != 0) { - Atom::Type atomType = next->type(); - switch (atomType) { - case Atom::C: - case Atom::CaptionLeft: - case Atom::Code: - case Atom::CodeBad: - case Atom::CodeNew: - case Atom::CodeOld: - case Atom::CodeQuoteArgument: - case Atom::CodeQuoteCommand: - case Atom::FootnoteLeft: - case Atom::FormatElse: - case Atom::FormatEndif: - case Atom::FormatIf: - case Atom::GeneratedList: - case Atom::Image: - case Atom::ImageText: - case Atom::InlineImage: - case Atom::LegaleseLeft: - case Atom::LineBreak: - case Atom::Link: - case Atom::LinkNode: - case Atom::ListLeft: - case Atom::ListItemNumber: - case Atom::ListTagLeft: - case Atom::ListItemLeft: - case Atom::QuotationLeft: - case Atom::RawString: - case Atom::SectionLeft: - case Atom::SectionHeadingLeft: - case Atom::SidebarLeft: - case Atom::SnippetCommand: - case Atom::SnippetIdentifier: - case Atom::SnippetLocation: - case Atom::TableLeft: - case Atom::TableHeaderLeft: - case Atom::TableRowLeft: - case Atom::TableItemLeft: - case Atom::TableOfContents: - case Atom::Target: - return true; - case Atom::AbstractLeft: - case Atom::AbstractRight: - case Atom::AutoLink: - case Atom::BaseName: - case Atom::BriefLeft: - case Atom::BriefRight: - case Atom::CaptionRight: - case Atom::FormattingLeft: - case Atom::FormattingRight: - case Atom::Nop: - case Atom::ParaLeft: - case Atom::ParaRight: - case Atom::FootnoteRight: - case Atom::LegaleseRight: - case Atom::ListTagRight: - case Atom::ListItemRight: - case Atom::ListRight: - case Atom::QuotationRight: - case Atom::SectionRight: - case Atom::SectionHeadingRight: - case Atom::SidebarRight: - case Atom::String: - case Atom::TableRight: - case Atom::TableHeaderRight: - case Atom::TableRowRight: - case Atom::TableItemRight: - default: - break; - } - next = next->next(); - } - return false; -} - -/*! - A convenience function to write a qdoc metacommand as a - doxygen command, without conversion. i.e., some of the - qdoc metacommands don't require conversion for doxygen. - */ -void DoxWriter::writeCommand(QCommandMap::const_iterator cmd) -{ - concatenate("\\" + cmd.key() + " " + cmd.value()[0]); - newLine(); -} - -/*! - Convert the qdoc commands in the metacommand map to - doxygen format. This function is called only in pass2(). - The metacommand map contains all the metacommands that - were found in the qdoc comment that is being converted. - The metacommands are the ones that begin with the '\'. - These are not considered part of the text of the comment. - The text is converted by convertText(). - */ -void DoxWriter::convertMetaCommands() -{ - QCommandMap& metaCmdMap = priv->metaCommandMap; - QCommandMap::iterator cmd; - int c; - - currentPage.clear(); - currentFn.clear(); - currentTitle.clear(); - currentEnum.clear(); - currentProperty.clear(); - currentVariable.clear(); - currentClass.clear(); - currentExample.clear(); - currentGroup.clear(); - currentModule.clear(); - currentMacro.clear(); - currentService.clear(); - currentTypedef.clear(); - currentHeaderFile.clear(); - commentType = OtherComment; - - if ((cmd = metaCmdMap.find("class")) != metaCmdMap.end()) { - currentClass = cmd.value()[0]; - if ((c = currentClass.indexOf(' ')) > 0) - currentClass = currentClass.left(c); - writeCommand(cmd); - metaCmdMap.erase(cmd); - commentType = ClassComment; - } - else if ((cmd = metaCmdMap.find("fn")) != metaCmdMap.end()) { - currentFn = cmd.value()[0]; - writeCommand(cmd); - metaCmdMap.erase(cmd); - commentType = FnComment; - } - else if ((cmd = metaCmdMap.find("enum")) != metaCmdMap.end()) { - currentEnum = cmd.value()[0]; - if ((c = currentEnum.lastIndexOf("::")) > 0) { - currentClass = currentEnum.left(c); - currentEnum = currentEnum.right(currentEnum.size()-c-2); - qDebug() << "currentEnum =" << currentEnum; - qDebug() << "currentClass =" << currentClass; - } - writeCommand(cmd); - metaCmdMap.erase(cmd); - commentType = EnumComment; - } - else if ((cmd = metaCmdMap.find("property")) != metaCmdMap.end()) { - currentClass = cmd.value()[0]; - if ((c = currentClass.lastIndexOf("::")) > 0) { - currentProperty = currentClass.right(currentClass.size()-c-2); - currentClass = currentClass.left(c); - qDebug() << "currentProperty =" << currentProperty; - qDebug() << "currentClass =" << currentClass; - } - writeCommand(cmd); - metaCmdMap.erase(cmd); - commentType = PropertyComment; - } - else if ((cmd = metaCmdMap.find("variable")) != metaCmdMap.end()) { - currentClass = cmd.value()[0]; - if ((c = currentClass.lastIndexOf("::")) > 0) { - currentVariable = currentClass.right(currentClass.size()-c-2); - currentClass = currentClass.left(c); - qDebug() << "currentVariable =" << currentVariable; - qDebug() << "currentClass =" << currentClass; - } - concatenate("\\var " + cmd.value()[0]); - newLine(); - metaCmdMap.erase(cmd); - commentType = VariableComment; - } - - if ((cmd = metaCmdMap.find("page")) != metaCmdMap.end()) { - currentPage = cmd.value()[0]; - QString htmlFile = currentPage; - const QString* title = getPageTitle(htmlFile); - QStringList parts = htmlFile.split('.'); - metaCmdMap.erase(cmd); - if (title) { - concatenate("\\page " + parts[0] + " " + *title); - newLine(); - } - commentType = PageComment; - qDebug() << "currentPage =" << currentPage; - } - - if ((cmd = metaCmdMap.find("example")) != metaCmdMap.end()) { - currentExample = cmd.value()[0]; - metaCmdMap.erase(cmd); - commentType = ExampleComment; - qDebug() << "currentExample =" << currentExample; - } - - if ((cmd = metaCmdMap.find("macro")) != metaCmdMap.end()) { - currentMacro = cmd.value()[0]; - metaCmdMap.erase(cmd); - commentType = MacroComment; - qDebug() << "currentMacro =" << currentMacro; - } - - if ((cmd = metaCmdMap.find("group")) != metaCmdMap.end()) { - currentGroup = cmd.value()[0]; - metaCmdMap.erase(cmd); - commentType = GroupComment; - qDebug() << "currentGroup =" << currentGroup; - } - - if ((cmd = metaCmdMap.find("module")) != metaCmdMap.end()) { - currentModule = cmd.value()[0]; - metaCmdMap.erase(cmd); - commentType = ModuleComment; - qDebug() << "currentModule =" << currentModule; - } - - if ((cmd = metaCmdMap.find("headerfile")) != metaCmdMap.end()) { - currentHeaderFile = cmd.value()[0]; - metaCmdMap.erase(cmd); - commentType = HeaderFileComment; - qDebug() << "currentHeaderFile =" << currentHeaderFile; - } - - if ((cmd = metaCmdMap.find("typedef")) != metaCmdMap.end()) { - currentClass = cmd.value()[0]; - if ((c = currentClass.lastIndexOf("::")) > 0) { - currentTypedef = currentClass.right(currentClass.size()-c-2); - currentClass = currentClass.left(c); - } - metaCmdMap.erase(cmd); - commentType = TypedefComment; - qDebug() << "currentTypedef =" << currentTypedef; - qDebug() << "currentClass =" << currentClass; - } - - cmd = priv->metaCommandMap.begin(); - while (cmd != priv->metaCommandMap.end()) { - for (int i=0; i<cmd.value().size(); i++) { - concatenate("\\" + cmd.key() + " " + cmd.value()[i]); - newLine(); - } - //qDebug() << " " << cmd.key() << ": " << cmd.value(); - ++cmd; - } -} - -/*! - Convert the qdoc text to doxygen format. The metacommands - are converted by convertMetaCommands(). This function is - called in pass2(). - */ -void DoxWriter::convertText() -{ - const Atom* prev = 0; - const Atom* next = priv->text.firstAtom(); - while (next != 0) { - next->dump(); - Atom::Type atomType = next->type(); - switch (atomType) { - case Atom::AbstractLeft: - break; - case Atom::AbstractRight: - break; - case Atom::AutoLink: - concatenate(next->string()); - break; - case Atom::BaseName: - break; - case Atom::BriefLeft: - concatenate("\\brief "); - break; - case Atom::BriefRight: - newLine(); - break; - case Atom::C: - tt(next); - break; - case Atom::CaptionLeft: - unhandled(next); - break; - case Atom::CaptionRight: - unhandled(next); - break; - case Atom::Code: - code(next); - break; - case Atom::CodeBad: - code(next); - break; - case Atom::CodeNew: - newLine(); - concatenate("you can rewrite it as"); - code(next); - break; - case Atom::CodeOld: - newLine(); - concatenate("For example, if you have code like"); - code(next); - break; - case Atom::CodeQuoteArgument: - unhandled(next); - break; - case Atom::CodeQuoteCommand: - next = codeQuoteCommand(next); - break; - case Atom::FootnoteLeft: - break; - case Atom::FootnoteRight: - break; - case Atom::FormatElse: - formatElse(); - break; - case Atom::FormatEndif: - formatEndif(); - break; - case Atom::FormatIf: - formatIf(next); - break; - case Atom::FormattingLeft: - formattingLeft(next,next->next()); - break; - case Atom::FormattingRight: - formattingRight(next,prev); - break; - case Atom::GeneratedList: - break; - case Atom::Image: - break; - case Atom::ImageText: - break; - case Atom::InlineImage: - break; - case Atom::LegaleseLeft: - break; - case Atom::LegaleseRight: - break; - case Atom::LineBreak: - break; - case Atom::Link: - next = link(next); - break; - case Atom::LinkNode: - break; - case Atom::ListLeft: - { - bool nested = false; - if (structs.isEmpty()) { - const Atom* i = next->next(); - while (i->type() != Atom::ListRight) { - if ((i->type() == Atom::ListLeft) || - (i->type() == Atom::TableLeft)) { - nested = true; - break; - } - i = i->next(); - } - } - else - nested = true; - StructDesc d(BulletList,nested); - if (next->string() == "numeric") - d.structType = NumericList; - else if (next->string() == "value") { - d.structType = ValueList; - } - else if (next->string() != "bullet") - qDebug() << "UNKNOWN LIST TYPE" << next->string(); - structs.push(d); - if (nested || (d.structType != BulletList)) { - if (d.structType == BulletList) - concatenate("<ul>"); - else if (d.structType == NumericList) - concatenate("<ol>"); - else if (d.structType == ValueList) - concatenate("<dl>"); - newLine(); - } - } - break; - case Atom::ListItemNumber: - structs.top().count = next->string().toInt(); - break; - case Atom::ListTagLeft: - { - structs.top().count++; - concatenate("<dt>"); - const Atom* n = next->next(); - if (n->type() == Atom::String) { - qDebug() << "ENUM VALUE" << n->string(); - } - else - qDebug() << "NOT EN ENUM"; - } - break; - case Atom::ListTagRight: - concatenate("</dt>"); - break; - case Atom::ListItemLeft: - { - newLine(); - const StructDesc& d = structs.top(); - if (d.structType == BulletList) { - if (!d.nested) - concatenate("\\arg "); - else - concatenate("<li>"); - } - else if (d.structType == NumericList) - concatenate("<li>"); - else if (d.structType == ValueList) - concatenate("<dd>"); - } - break; - case Atom::ListItemRight: - { - const StructDesc& d = structs.top(); - if (d.structType == BulletList) { - if (d.nested) { - concatenate("</li>"); - newLine(); - } - } - else if (d.structType == NumericList) { - concatenate("</li>"); - newLine(); - } - else if (d.structType == ValueList) { - concatenate("</dd>"); - newLine(); - } - } - break; - case Atom::ListRight: - { - if (!structs.isEmpty()) { - const StructDesc& d = structs.top(); - if (d.nested || (d.structType != BulletList)) { - if (d.structType == BulletList) - concatenate("</ul>"); - else if (d.structType == NumericList) - concatenate("</ol>"); - else if (d.structType == ValueList) - concatenate("</dl>"); - newLine(); - } - structs.pop(); - } - } - break; - case Atom::Nop: - // nothing. - break; - case Atom::ParaLeft: - if (structs.isEmpty()) - newLine(); - break; - case Atom::ParaRight: - { - if (structs.isEmpty()) - newLine(); - else { - const StructDesc& d = structs.top(); - if (d.nested || (d.structType != BulletList)) { - Atom::Type t = next->next()->type(); - if ((t != Atom::ListItemRight) && - (t != Atom::TableItemRight)) - newLine(); - } - else - newLine(); - } - } - break; - case Atom::QuotationLeft: - break; - case Atom::QuotationRight: - break; - case Atom::RawString: - concatenate(next->string()); - break; - case Atom::SectionLeft: - // nothing. - break; - case Atom::SectionRight: - // nothing. - break; - case Atom::SectionHeadingLeft: - next = sectionHeading(next); - break; - case Atom::SectionHeadingRight: - newLine(); - break; - case Atom::SidebarLeft: - break; - case Atom::SidebarRight: - break; - case Atom::SnippetCommand: - newLine(); - concatenate("\\snippet "); - break; - case Atom::SnippetIdentifier: - newText += next->string(); - lineLength += next->string().size(); - newLine(); - break; - case Atom::SnippetLocation: - newText += next->string() + " "; - lineLength += next->string().size() + 1; - break; - case Atom::String: - wrap(next->string()); - break; - case Atom::TableLeft: - { - bool nested = false; - if (structs.isEmpty()) { - const Atom* i = next->next(); - while (i->type() != Atom::TableRight) { - if ((i->type() == Atom::ListLeft) || - (i->type() == Atom::TableLeft)) { - nested = true; - break; - } - i = i->next(); - } - } - else - nested = true; - StructDesc d(Table,nested); - structs.push(d); - if (next->string().isEmpty()) - concatenate("<table>"); - else { - QString attrs = "width=\"" + next->string() + "\""; - attrs += " align=\"center\""; - concatenate("<table " + attrs + ">"); - } - newLine(); - } - break; - case Atom::TableRight: - concatenate("</table>"); - if (!structs.isEmpty()) - structs.pop(); - newLine(); - break; - case Atom::TableHeaderLeft: - concatenate("<tr>"); - if (!structs.isEmpty()) - structs.top().inTableHeader = true; - newLine(); - break; - case Atom::TableHeaderRight: - concatenate("</tr>"); - if (!structs.isEmpty()) - structs.top().inTableHeader = false; - newLine(); - break; - case Atom::TableRowLeft: - if (!structs.isEmpty()) { - structs.top().inTableRow = true; - concatenate("<tr valign=\"top\" class=\""); - if (structs.top().odd) - concatenate("odd\">"); - else - concatenate("even\">"); - structs.top().odd = !structs.top().odd; - } - newLine(); - break; - case Atom::TableRowRight: - concatenate("</tr>"); - if (!structs.isEmpty()) - structs.top().inTableRow = false; - newLine(); - break; - case Atom::TableItemLeft: - if (!structs.isEmpty()) { - structs.top().inTableItem = true; - concatenate("<td>"); - if (structs.top().inTableHeader) - concatenate("<b> "); - } - break; - case Atom::TableItemRight: - if (!structs.isEmpty()) { - structs.top().inTableItem = false; - if (structs.top().inTableHeader) - concatenate(" </b>"); - concatenate("</td>"); - } - newLine(); - break; - case Atom::TableOfContents: - break; - case Atom::Target: - { - QString text = next->string(); - text.remove(ws_rx); - newLine(); - concatenate("\\anchor "); - newText += text; - lineLength += text.size(); - newLine(); - } - break; - case Atom::UnhandledFormat: - unhandled(next); - break; - case Atom::UnknownCommand: - unhandled(next); - break; - default: - //next->dump(); - break; - } - prev = next; - next = next->next(); - } -} - -/*! - - Pass one looks for topic commands and target and section - commands, and maybe other stuff. These are serialized to - text files, which are read back in by pass2(). - */ -void DoxWriter::pass1() -{ - QCommandMap& metaCmdMap = priv->metaCommandMap; - if (!metaCmdMap.isEmpty()) { - int c; - QCommandMap::iterator cmd; - if ((cmd = metaCmdMap.find("enum")) != metaCmdMap.end()) { - commentType = EnumComment; - currentEnum = cmd.value()[0]; - if ((c = currentEnum.lastIndexOf("::")) > 0) { - currentClass = currentEnum.left(c); - currentEnum = currentEnum.right(currentEnum.size()-c-2); - qDebug() << "currentEnum =" << currentEnum; - qDebug() << "currentClass =" << currentClass; - if (enums.contains(currentEnum,currentClass)) { - qWarning() << "DoxWriter::pass1():" - << "Duplicate enum:" - << currentClass << currentEnum; - } - else - enums.insert(currentEnum,currentClass); - } - } - else if ((cmd = metaCmdMap.find("property")) != metaCmdMap.end()) { - commentType = PropertyComment; - currentClass = cmd.value()[0]; - if ((c = currentClass.lastIndexOf("::")) > 0) { - currentProperty = currentClass.right(currentClass.size()-c-2); - currentClass = currentClass.left(c); - qDebug() << "currentProperty =" << currentProperty; - qDebug() << "currentClass =" << currentClass; - if (properties.contains(currentProperty,currentClass)) { - qWarning() << "DoxWriter::pass1():" - << "Duplicate property:" - << currentClass << currentProperty; - } - else - properties.insert(currentProperty,currentClass); - } - } - else if ((cmd = metaCmdMap.find("variable")) != metaCmdMap.end()) { - commentType = VariableComment; - currentClass = cmd.value()[0]; - if ((c = currentClass.lastIndexOf("::")) > 0) { - currentVariable = currentClass.right(currentClass.size()-c-2); - currentClass = currentClass.left(c); - qDebug() << "currentVariable =" << currentVariable; - qDebug() << "currentClass =" << currentClass; - if (variables.contains(currentVariable,currentClass)) { - qWarning() << "DoxWriter::pass1():" - << "Duplicate variable:" - << currentClass << currentVariable; - } - else - variables.insert(currentVariable,currentClass); - } - } - } - - /* - */ - const Atom* next = priv->text.firstAtom(); - while (next != 0) { - switch (next->type()) { - case Atom::SectionHeadingLeft: - { - QString text; - next = next->next(); - while (next) { - if (next->type() == Atom::SectionHeadingRight) - break; - else - text += next->string(); - next = next->next(); - } - //text.remove(ws_rx); - insertAnchor(text); - } - break; - case Atom::Target: - { - QString text = next->string(); - //text.remove(ws_rx); - insertAnchor(text); - } - default: - break; - } - next = next->next(); - } -} - -/*! - Output a parsed, tokenized qdoc comment as a doxygen - comment in diff format for input to the patch command. - */ -void DoxWriter::pass2() -{ - if (!conversionRequired()) { - qDebug() << "NO CONVERSION - FILE:" << priv->start_loc.fileName() - << "START:" << priv->start_loc.lineNo() - << "END:" << priv->end_loc.lineNo() - 1; - return; - } - - /* - Transformation to doxygen required... - */ - newText = "\n/*! \n"; - convertMetaCommands(); - convertText(); - if (newText[newText.size()-1] == ' ') - newText.remove(newText.size()-1,1); - newText += " */\n"; - qDebug() << "CONVERTED COMMENT - FILE:" << priv->start_loc.fileName() - << "START:" << priv->start_loc.lineNo() - << "END:" << priv->end_loc.lineNo() - 1; - qDebug() << newText; -} - -/*! - Unparse the second parameter of a "\l" command. - */ -const Atom* DoxWriter::link(const Atom* atom) -{ - QString first_text = atom->string(); - QString second_text; - const QString* value = 0; - - const Atom* next = atom->next(Atom::FormattingLeft,Atom::LINK_); - if (next) { - next->dump(); - while (1) { - next = next->next(); - next->dump(); - if (next->type() == Atom::FormattingRight) { - if (next->string() == Atom::LINK_) - break; - else { - // ignore it. - } - } - else - second_text += next->string(); - } - int i = first_text.indexOf('#'); - if (i >= 0) - first_text = first_text.right(first_text.size() - i - 1); - //newLine(); - if ((value = getExternalPage(first_text))) { - //qDebug() << "USED AN EXTERNAL PAGE TITLE" << first_text; - QString href = "<a href=\""+*value+"\">"+first_text+"</a>"; - concatenate(href); - } - else if (first_text.startsWith("http:",Qt::CaseInsensitive)) { - if (first_text == second_text) { - concatenate(first_text); - } - else { - QString href = "<a href=\""+first_text+"\">"+second_text+"</a>"; - concatenate(href); - } - } - else if ((value = getPageFile(first_text))) { - //qDebug() << "USED A PAGE TITLE" << first_text; - QStringList parts = (*value).split('.'); - QString ref = "\\ref " + parts[0] + " \"" + second_text + "\""; - concatenate(ref); - } - else if ((value = getGroup(first_text))) { - //qDebug() << "USED A GROUP TITLE" << first_text; - concatenate("\\ref " + *value + " \"" + second_text + "\""); - } - else if ((value = getModule(first_text))) { - //qDebug() << "USED A MODULE TITLE" << first_text; - concatenate("\\ref " + *value + " \"" + second_text + "\""); - } - else if ((value = getExamplePath(first_text))) { - //qDebug() << "USED AN EXAMPLE TITLE" << first_text; - first_text.remove(ws_rx); - QString ref = "\\ref " + first_text + " \"" + second_text + "\""; - concatenate(ref); - } - else if ((value = getFile(first_text))) { - //qDebug() << "USED A FILE TITLE" << first_text; - // I think this command is no longer available. - first_text.remove(ws_rx); - QString ref = "\\ref " + first_text + " \"" + second_text + "\""; - concatenate(ref); - } - else if ((value = getHeaderFile(first_text))) { - //qDebug() << "USED A HEADER FILE TITLE" << first_text; - first_text.remove(ws_rx); - QString ref = "\\ref " + first_text + " \"" + second_text + "\""; - concatenate(ref); - } - else if (isAnchor(first_text)) { - //qDebug() << "USED AN ANCHOR" << first_text; - first_text.remove(ws_rx); - QString ref = "\\ref " + first_text + " \"" + second_text + "\""; - concatenate(ref); - } - else if ((value = getPageTitle(first_text))) { - //qDebug() << "USED AN INVERSE PAGE TITLE" << first_text; - QStringList parts = first_text.split('.'); - QString ref = "\\ref " + parts[0] + " \"" + second_text + "\""; - concatenate(ref); - } - else if ((value = getExampleTitle(first_text))) { - //qDebug() << "USED AN INVERSE EXAMPLE TITLE" << first_text; - QString title = *value; - title.remove(ws_rx); - QString ref = "\\ref " + title + " \"" + second_text + "\""; - concatenate(ref); - } - else if ((value = getGroupTitle(first_text))) { - //qDebug() << "USED AN INVERSE GROUP TITLE" << first_text; - concatenate("\\ref " + first_text + " \"" + second_text + "\""); - } - else if ((value = getModuleTitle(first_text))) { - //qDebug() << "USED AN INVERSE MODULE TITLE" << first_text; - concatenate("\\ref " + first_text + " \"" + second_text + "\""); - } - else if ((value = getFileTitle(first_text))) { - qDebug() << "USED AN INVERSE FILE TITLE" << first_text; - } - else if ((value = getHeaderFileTitle(first_text))) { - qDebug() << "USED AN INVERSE HEADER FILE TITLE" << first_text; - } - else if ((first_text.indexOf("::") >= 0) || - (first_text.indexOf("()") >= 0) || - (first_text[0] == 'Q')) { - //qDebug() << "AUTO-LINKABLE" << first_text; - if (first_text == second_text) - concatenate(first_text); - else { - QString link = first_text + " " + second_text; - concatenate("\\link " + link + "\\endlink"); - } - } - else { - QString link; - QStringList propertyClasses; - QStringList variableClasses; - QStringList enumClasses; - bool p = isProperty(first_text,propertyClasses); - bool v = isVariable(first_text,variableClasses); - bool e = isEnum(first_text,enumClasses); - if (e) { - if (enumClasses.size() == 1) - link = enumClasses[0]; - else if (enumClasses.contains(currentClass)) - link = currentClass; - else { - QString msg = "Unqualified enum name: " + first_text; - QString details = "Classes: " + enumClasses.join(", "); - priv->start_loc.error(msg,details); - } - if (!link.isEmpty()) - qDebug() << "FOUND ENUM" << link << first_text; - } - else if (p && v) { - if (propertyClasses.size() == 1) { - if (variableClasses.size() == 1) { - if (propertyClasses[0] == variableClasses[0]) - link = propertyClasses[0]; - } - } - if (link.isEmpty()) { - if (propertyClasses.contains(currentClass) || - variableClasses.contains(currentClass)) - link = currentClass; - else { - propertyClasses += variableClasses; - QString msg = "Unqualified property or variable name: " - + first_text; - QString details = "Classes: " + - propertyClasses.join(", "); - priv->start_loc.error(msg,details); - } - } - } - else if (p) { - if (propertyClasses.size() == 1) - link = propertyClasses[0]; - else if (propertyClasses.contains(currentClass)) - link = currentClass; - else { - QString msg = "Unqualified property name: " + first_text; - QString details = "Classes: " + propertyClasses.join(", "); - priv->start_loc.error(msg,details); - } - } - else if (v) { - if (variableClasses.size() == 1) - link = variableClasses[0]; - else if (variableClasses.contains(currentClass)) - link = currentClass; - else { - QString msg = "Unqualified variable name: " + first_text; - QString details = "Classes: " + variableClasses.join(", "); - priv->start_loc.error(msg,details); - } - } - else { - qDebug() << "NOT AUTO-LINKABLE" << first_text; - QString s = first_text + " " + second_text; - concatenate("\\link " + s + "\\endlink"); - } - if (!link.isEmpty()) { - link += "::" + first_text + " " + second_text; - concatenate("\\link " + link + "\\endlink"); - } - } - } - else - qDebug() << "LINK with no second parameter!!!!"; - return next? next : atom; -} - -/*! - If the current line length is 0, the current line is - indented according to the context. - */ -void DoxWriter::indentLine() -{ - if (lineLength == 0) { - newText += DOXYGEN_INDENT_STRING; - lineLength = DOXYGEN_INDENT; - if (!structs.isEmpty()) { - for (int i=1; i<structs.size(); ++i) { - newText += DOXYGEN_TAB_STRING; - lineLength += DOXYGEN_TAB_SIZE; - } - } - } -} - -/*! - Concatenates a newline to the doxygen text, increments the - line count, and resets the line length to 0. - */ -void DoxWriter::newLine() -{ - newText += "\n"; - ++lineCount; - lineLength = 0; -} - -static const int maxLineLength = 70; - -/*! - Concatenate the \a text to the doxygen comment currently - under construction and increment the current line length - by the size of the \a text. - - If incrementing the current line length by the \a text size - would make the current line length longer than the maximum - line length, then call newLine() and indentLine() \e before - concatenating the \a text. - */ -void DoxWriter::concatenate(QString text) -{ - if ((lineLength + text.size()) > maxLineLength) - newLine(); - indentLine(); - newText += text; - lineLength += text.size(); -} - -static bool punctuation(QChar c) -{ - switch (c.toAscii()) { - case '.': - case ',': - case ':': - case ';': - case '/': - case '+': - case '-': - case '?': - case '!': - case '\"': - return true; - default: - break; - } - return false; -} - -/*! - Concatenate the \a text string to the doxygen text, doing - line wrapping where necessary. - */ -void DoxWriter::wrap(QString text) -{ - int from = 0; - int to = -1; - - if ((lineLength == 0) || (lineLength >= maxLineLength)) { - if (!text.isEmpty() && (text[0] == ' ')) - text = text.right(text.size() - 1); - } - - indentLine(); - while (text.size()) { - int avail = maxLineLength - lineLength; - from = text.indexOf(' ',from); - if (from >= 0) { - if (from < avail) - to = from++; - else if (from == 1 && punctuation(text[0])) - to = from++; - else { - if (to >= 0) { - newText += text.left(to+1); - lineLength += to + 1; - text = text.right(text.size() - to - 1); - } - else { - newLine(); - indentLine(); - newText += text.left(from+1); - lineLength += from + 1; - text = text.right(text.size() - from - 1); - } - from = 0; - to = -1; - if (text.size() && (lineLength > maxLineLength)) { - newLine(); - indentLine(); - } - } - } - else - break; - } - if (text.size()) { - if (lineLength >= maxLineLength) { - newLine(); - indentLine(); - } - newText += text; - lineLength += text.size(); - } -} - -/*! - This will output something, but it depends on what the - \a atom string and the \a next atom string are. - */ -void DoxWriter::formattingLeft(const Atom* atom, const Atom* next) -{ - if (atom->string() == "parameter") { - concatenate("\\a "); - return; - } - else if (atom->string() == "underline") { - concatenate("<u>"); - return; - } - else if (atom->string() == "superscript") { - concatenate("<sup>"); - return; - } - else if (atom->string() == "subscript") { - concatenate("<sub>"); - return; - } - int ws = -1; - if (next) - ws = next->string().indexOf(ws_rx); - if (atom->string() == "bold") { - if (ws < 0) - concatenate("\\b "); - else - concatenate("<b>"); - } - else if (atom->string() == "italic") { - if (ws < 0) - concatenate("\\e "); - else - concatenate("<i>"); - } - else if (atom->string() == "teletype") { - if (ws < 0) - concatenate("\\c "); - else - concatenate("<tt>"); - } - else - qDebug() << "UNHANDLED FormattingLeft: " << atom->string(); -} - -/*! - This will output something, but it depends on what the - \a atom string and the \a prev atom string are. - */ -void DoxWriter::formattingRight(const Atom* atom, const Atom* prev) -{ - if (atom->string() == "parameter") - return; - else if (atom->string() == "underline") { - concatenate("</u>"); - return; - } - else if (atom->string() == "superscript") { - concatenate("</sup>"); - return; - } - else if (atom->string() == "subscript") { - concatenate("</sub>"); - return; - } - int ws = -1; - if (prev) - ws = prev->string().indexOf(ws_rx); - if (ws < 0) - return; - if (atom->string() == "bold") - concatenate("</b>"); - else if (atom->string() == "italic") - concatenate("</i>"); - else if (atom->string() == "teletype") - concatenate("</tt>"); - else - qDebug() << "UNHANDLED FormattingRight: " << atom->string(); -} - -/*! - Output a \c or a <tt>...</tt>. - */ -void DoxWriter::tt(const Atom* atom) -{ - if (atom->string().indexOf(ws_rx) < 0) { - concatenate("\\c "); - concatenate(atom->string()); - } - else { - concatenate("<tt>"); - concatenate(atom->string()); - concatenate("</tt>"); - } -} - -/*! - */ -void DoxWriter::formatIf(const Atom* atom) -{ - if (atom->string() == "HTML") { - newLine(); - concatenate("\\htmlonly"); - newLine(); - } -} - -/*! - */ -void DoxWriter::formatEndif() -{ - newLine(); - concatenate("\\endhtmlonly"); - newLine(); -} - -/*! - */ -void DoxWriter::formatElse() -{ - // nothing. -} - -/*! - Pass 1: Construct a section identifier and insert it into - the anchor set. - - Pass 2: Convert section1, section2, and section3 commands - to section, subsection, and subsubsection respectively. - Warn if a section command higher than 3 is seen. - */ -const Atom* DoxWriter::sectionHeading(const Atom* atom) -{ - QString heading_level = atom->string(); - QString heading_text; - const Atom* next = atom->next(); - while (next) { - next->dump(); - if (next->type() == Atom::SectionHeadingRight) { - if (next->string() == heading_level) - break; - else { - qDebug() << "WRONG SectionHeading number!!!!"; - } - } - else - heading_text += next->string(); - next = next->next(); - } - - QString heading_identifier = heading_text; - heading_identifier.remove(ws_rx); - - newLine(); - if (heading_level == "1") - heading_level = "\\section "; - else if (heading_level == "2") - heading_level = "\\subsection "; - else if (heading_level == "3") - heading_level = "\\subsubsection "; - else if (heading_level == "4") { - heading_level = "\\subsubsection "; - qDebug() << "WARNING section4 converted to \\subsubsection"; - } - else { - heading_level = "\\subsubsection "; - qDebug() << "WARNING section5 converted to \\subsubsection"; - } - concatenate(heading_level); - newText += heading_identifier + " "; - lineLength += heading_identifier.size() + 1; - newText += heading_text; - lineLength += heading_text.size(); - newLine(); - return next? next : atom; -} - -/*! - Report an unhandled atom. - */ -void DoxWriter::unhandled(const Atom* atom) -{ - qDebug() << "UNHANDLED ATOM"; - atom->dump(); -} - -/*! - Output a code/endcode block. - */ -void DoxWriter::code(const Atom* atom) -{ - newLine(); - concatenate("\\code"); - writeCode(atom->string()); - concatenate("\\endcode"); - newLine(); -} - -/*! - Output a code/endcode block depending on the - CodeQuote Command and CodeQuoteArgument parameters. - */ -const Atom* DoxWriter::codeQuoteCommand(const Atom* atom) -{ - QString command = atom->string(); - atom = atom->next(); - concatenate("\\code"); - if (command == "codeline") { - newLine(); - concatenate(atom->string()); - newLine(); - } - else if (command == "dots") { - newLine(); - concatenate(atom->string()); - newLine(); - } - else { - writeCode(atom->string()); - } - concatenate("\\endcode"); - return atom; -} - -/*! - Appends a block of code to the comment. - */ -void DoxWriter::writeCode(QString text) -{ - int cr_count = text.count('\n') - 1; - if (cr_count >= 0) { - int last_cr = text.lastIndexOf('\n'); - newText += text.left(last_cr); - lineCount += cr_count; - } - else - newText += text; - newLine(); -} - -/*! - Inserts \a text into the anchor set. This function is called - during doxygen pass 1. - */ -void DoxWriter::insertAnchor(const QString& text) -{ - anchors.insert(text); -} - -/*! - Returns true if \a text identifies an anchor, section, - subsection, subsubsection, or page. - */ -bool DoxWriter::isAnchor(const QString& text) -{ - return anchors.contains(text); -} - -/*! - Write the set of anchors to a file, one per line. - */ -void DoxWriter::writeAnchors() -{ - QFile file("anchors.txt"); - if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { - qWarning("Unable to open anchors.txt for writing."); - return; - } - - QTextStream out(&file); - QSet<QString>::const_iterator i = anchors.constBegin(); - while (i != anchors.constEnd()) { - out << *i << "\n"; - ++i; - } - file.close(); -} - -/*! - Read the set of anchors from the anchors file, one per line, - and insert each one into the anchor set. - */ -void DoxWriter::readAnchors() -{ - QFile file("anchors.txt"); - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - qWarning("Unable to open anchors.txt for reading."); - return; - } - - QTextStream in(&file); - while (!in.atEnd()) { - QString line = in.readLine(); - anchors.insert(line); - } - file.close(); -#if 0 - QSet<QString>::const_iterator i = anchors.constBegin(); - while (i != anchors.constEnd()) { - qDebug() << *i; - ++i; - } -#endif -} - -/*! - Inserts \a title into one of the title maps. \a title is - mapped to the \a node name. This function is called during - doxygen pass 1. - */ -void DoxWriter::insertTitle(FakeNode* node, const QString& title) -{ - switch (node->subType()) { - case FakeNode::Example: - if (exampleTitles.contains(title)) { - qWarning() << "DoxWriter::insertTitle():" - << "Duplicate example title:" - << title; - } - else { - exampleTitles[title] = node->name(); - exampleTitlesInverse[node->name()] = title; - } - break; - case FakeNode::HeaderFile: - if (headerFileTitles.contains(title)) { - qWarning() << "DoxWriter::insertTitle():" - << "Duplicate header file title:" - << title; - } - else { - headerFileTitles[title] = node->name(); - headerFileTitlesInverse[node->name()] = title; - } - break; - case FakeNode::File: - if (fileTitles.contains(title)) { - qWarning() << "DoxWriter::insertTitle():" - << "Duplicate file title:" - << title; - } - else { - fileTitles[title] = node->name(); - fileTitlesInverse[node->name()] = title; - } - break; - case FakeNode::Group: - if (groupTitles.contains(title)) { - qWarning() << "DoxWriter::insertTitle():" - << "Duplicate group title:" - << title; - } - else { - groupTitles[title] = node->name(); - groupTitlesInverse[node->name()] = title; - } - break; - case FakeNode::Module: - if (moduleTitles.contains(title)) { - qWarning() << "DoxWriter::insertTitle():" - << "Duplicate module title:" - << title; - } - else { - moduleTitles[title] = node->name(); - moduleTitlesInverse[node->name()] = title; - } - break; - case FakeNode::Page: - if (pageTitles.contains(title)) { - qWarning() << "DoxWriter::insertTitle():" - << "Duplicate page title:" - << title; - } - else { - pageTitles[title] = node->name(); - pageTitlesInverse[node->name()] = title; - } - break; - case FakeNode::ExternalPage: - if (externalPageTitles.contains(title)) { - qWarning() << "DoxWriter::insertTitle():" - << "Duplicate external page title:" - << title; - } - else { - externalPageTitles[title] = node->name(); - externalPageTitlesInverse[node->name()] = title; - } - break; - default: - break; - } -} - -/*! - */ -const QString* DoxWriter::getPageFile(const QString& title) -{ - QStringMapEntry entry = pageTitles.find(title); - return (entry == pageTitles.end()) ? 0 : &entry.value(); -} - -/*! - */ -const QString* DoxWriter::getExamplePath(const QString& title) -{ - QStringMapEntry entry = exampleTitles.find(title); - return (entry == exampleTitles.end()) ? 0 : &entry.value(); -} - -/*! - */ -const QString* DoxWriter::getFile(const QString& title) -{ - QStringMapEntry entry = fileTitles.find(title); - return (entry == fileTitles.end()) ? 0 : &entry.value(); -} - -/*! - */ -const QString* DoxWriter::getHeaderFile(const QString& title) -{ - QStringMapEntry entry = headerFileTitles.find(title); - return (entry == headerFileTitles.end()) ? 0 : &entry.value(); -} - -/*! - */ -const QString* DoxWriter::getGroup(const QString& title) -{ - QStringMapEntry entry = groupTitles.find(title); - return (entry == groupTitles.end()) ? 0 : &entry.value(); -} - -/*! - */ -const QString* DoxWriter::getModule(const QString& title) -{ - QStringMapEntry entry = moduleTitles.find(title); - return (entry == moduleTitles.end()) ? 0 : &entry.value(); -} - -/*! - */ -const QString* DoxWriter::getExternalPage(const QString& title) -{ - QStringMapEntry entry = externalPageTitles.find(title); - return (entry == externalPageTitles.end()) ? 0 : &entry.value(); -} - -/*! - */ -const QString* DoxWriter::getPageTitle(const QString& text) -{ - QStringMapEntry entry = pageTitlesInverse.find(text); - return (entry == pageTitlesInverse.end()) ? 0 : &entry.value(); -} - -/*! - */ -const QString* DoxWriter::getExampleTitle(const QString& text) -{ - QStringMapEntry entry = exampleTitlesInverse.find(text); - return (entry == exampleTitlesInverse.end()) ? 0 : &entry.value(); -} - -/*! - */ -const QString* DoxWriter::getFileTitle(const QString& text) -{ - QStringMapEntry entry = fileTitlesInverse.find(text); - return (entry == fileTitlesInverse.end()) ? 0 : &entry.value(); -} - -/*! - */ -const QString* DoxWriter::getHeaderFileTitle(const QString& text) -{ - QStringMapEntry entry = headerFileTitlesInverse.find(text); - return (entry == headerFileTitlesInverse.end()) ? 0 : &entry.value(); -} - -/*! - */ -const QString* DoxWriter::getGroupTitle(const QString& text) -{ - QStringMapEntry entry = groupTitlesInverse.find(text); - return (entry == groupTitlesInverse.end()) ? 0 : &entry.value(); -} - -/*! - */ -const QString* DoxWriter::getModuleTitle(const QString& text) -{ - QStringMapEntry entry = moduleTitlesInverse.find(text); - return (entry == moduleTitlesInverse.end()) ? 0 : &entry.value(); -} - -/*! - */ -const QString* DoxWriter::getExternalPageTitle(const QString& text) -{ - QStringMapEntry entry = externalPageTitlesInverse.find(text); - return (entry == externalPageTitlesInverse.end()) ? 0 : &entry.value(); -} - -/*! - Serialize \a map to file \a name. - */ -void DoxWriter::writeMap(const QStringMap& map, const QString& name) -{ - - QFile file(name); - if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { - qWarning() << "Unable to open" << name << "for writing."; - return; - } - - QTextStream out(&file); - QStringMap::const_iterator i = map.constBegin(); - while (i != map.constEnd()) { - out << i.key() << "\n"; - out << i.value() << "\n"; - ++i; - } - file.close(); -} - -/*! - Read file \a name into the \a map. - */ -void DoxWriter::readMap(QStringMap& map, QStringMap& inverseMap, const QString& name) -{ - QFile file(name); - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - qWarning() << "Unable to open" << name << "for reading."; - return; - } - - QTextStream in(&file); - while (!in.atEnd()) { - QString title = in.readLine(); - QString value = in.readLine(); - map[title] = value; - inverseMap[value] = title; - } - file.close(); -} - -/*! - Write the sets of titles to text files, one per line. - */ -void DoxWriter::writeTitles() -{ - if (!pageTitles.isEmpty()) - writeMap(pageTitles,"pagetitles.txt"); - if (!fileTitles.isEmpty()) - writeMap(fileTitles,"filetitles.txt"); - if (!headerFileTitles.isEmpty()) - writeMap(headerFileTitles,"headerfiletitles.txt"); - if (!exampleTitles.isEmpty()) - writeMap(exampleTitles,"exampletitles.txt"); - if (!moduleTitles.isEmpty()) - writeMap(moduleTitles,"moduletitles.txt"); - if (!groupTitles.isEmpty()) - writeMap(groupTitles,"grouptitles.txt"); - if (!externalPageTitles.isEmpty()) - writeMap(externalPageTitles,"externalpagetitles.txt"); -} - -/*! - Read the sets of titles from the titles files, one per line, - and insert each one into the appropriate title set. - */ -void DoxWriter::readTitles() -{ - readMap(pageTitles,pageTitlesInverse,"pagetitles.txt"); - readMap(fileTitles,fileTitlesInverse,"filetitles.txt"); - readMap(headerFileTitles,headerFileTitlesInverse,"headerfiletitles.txt"); - readMap(exampleTitles,exampleTitlesInverse,"exampletitles.txt"); - readMap(moduleTitles,moduleTitlesInverse,"moduletitles.txt"); - readMap(groupTitles,groupTitlesInverse,"grouptitles.txt"); - readMap(externalPageTitles, - externalPageTitlesInverse, - "externalpagetitles.txt"); -} - -/*! - Serialize \a map to file \a name. - */ -void DoxWriter::writeMultiMap(const QStringMultiMap& map, const QString& name) -{ - - QFile file(name); - if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { - qWarning() << "Unable to open" << name << "for writing."; - return; - } - - QTextStream out(&file); - QStringMultiMap::const_iterator i = map.constBegin(); - while (i != map.constEnd()) { - out << i.key() << "\n"; - out << i.value() << "\n"; - ++i; - } - file.close(); -} - -/*! - Write the4 property names and variable names to text files. - */ -void DoxWriter::writeMembers() -{ - if (!variables.isEmpty()) - writeMultiMap(variables,"variables.txt"); - if (!properties.isEmpty()) - writeMultiMap(properties,"properties.txt"); - if (!enums.isEmpty()) - writeMultiMap(enums,"enums.txt"); -} - -/*! - Read file \a name into the \a map. - */ -void DoxWriter::readMultiMap(QStringMultiMap& map, const QString& name) -{ - QFile file(name); - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - qWarning() << "Unable to open" << name << "for reading."; - return; - } - - QTextStream in(&file); - while (!in.atEnd()) { - QString member = in.readLine(); - QString className = in.readLine(); - map.insert(member,className); - } - file.close(); -} - -/*! - Read the property names and variable names from the test files. - */ -void DoxWriter::readMembers() -{ - readMultiMap(variables,"variables.txt"); - readMultiMap(properties,"properties.txt"); - readMultiMap(enums,"enums.txt"); -} - -/*! - Return true if \a name is a property. Loads \a classes with - the names of all the classes in which \a name is a property. - */ -bool DoxWriter::isProperty(const QString& name, QStringList& classes) -{ - classes = properties.values(name); - return !classes.isEmpty(); -} - -/*! - Return true if \a name is a variable. Loads \a classes with - the names of all the classes in which \a name is a variable. - */ -bool DoxWriter::isVariable(const QString& name, QStringList& classes) -{ - classes = variables.values(name); - return !classes.isEmpty(); -} - -/*! - Return true if \a name is an enum type. Loads \a classes with - the names of all the classes in which \a name is an enum type. - */ -bool DoxWriter::isEnum(const QString& name, QStringList& classes) -{ - classes = enums.values(name); - return !classes.isEmpty(); -} -#endif - QT_END_NAMESPACE diff --git a/tools/qdoc3/doc.h b/tools/qdoc3/doc.h index 6cb6f0a..2c1d29e 100644 --- a/tools/qdoc3/doc.h +++ b/tools/qdoc3/doc.h @@ -133,183 +133,6 @@ class Doc DocPrivate *priv; }; -#ifdef QDOC2DOX - -class DoxWriter -{ - public: - DoxWriter(const QString& source, DocPrivate* docPrivate) - : commentType(OtherComment), - lineLength(0), - lineCount(0), - priv(docPrivate), - oldText(source) {} - ~DoxWriter() {} - - void pass1(); - void pass2(); - - static void setDoxPass(int pass); - static bool isDoxPass(int pass); - static bool isDoxPass(); - static void insertTitle(FakeNode* node, const QString& title); - static void writeTitles(); - static void readTitles(); - static void writeMembers(); - static void readMembers(); - static void writeAnchors(); - static void readAnchors(); - - private: - void indentLine(); - void newLine(); - void concatenate(QString text); - void wrap(QString text); - bool conversionRequired() const; - void convertMetaCommands(); - void convertText(); - const Atom* link(const Atom* atom); - void formattingLeft(const Atom* atom, const Atom* next); - void formattingRight(const Atom* atom, const Atom* prev); - void tt(const Atom* atom); - void formatIf(const Atom* atom); - void formatEndif(); - void formatElse(); - const Atom* sectionHeading(const Atom* atom); - void unhandled(const Atom* atom); - void code(const Atom* atom); - const Atom* codeQuoteCommand(const Atom* atom); - void writeCode(QString text); - void writeCommand(QCommandMap::const_iterator cmd); - - static void insertAnchor(const QString& text); - static bool isAnchor(const QString& text); - - static const QString* getPageFile(const QString& title); - static const QString* getFile(const QString& title); - static const QString* getExamplePath(const QString& title); - static const QString* getHeaderFile(const QString& title); - static const QString* getGroup(const QString& title); - static const QString* getModule(const QString& title); - static const QString* getExternalPage(const QString& title); - static const QString* getPageTitle(const QString& text); - static const QString* getFileTitle(const QString& text); - static const QString* getExampleTitle(const QString& text); - static const QString* getHeaderFileTitle(const QString& text); - static const QString* getGroupTitle(const QString& text); - static const QString* getModuleTitle(const QString& text); - static const QString* getExternalPageTitle(const QString& text); - - static bool isProperty(const QString& title, QStringList& classes); - static bool isVariable(const QString& title, QStringList& classes); - static bool isEnum(const QString& title, QStringList& classes); - - private: - static void writeMap(const QStringMap& map, const QString& name); - static void readMap(QStringMap& map, - QStringMap& inverseMap, - const QString& name); - static void writeMultiMap(const QStringMultiMap& map, const QString& name); - static void readMultiMap(QStringMultiMap& map, const QString& name); - - public: // VS 6, SunCC need this to be public - enum StructType { BulletList, NumericList, ValueList, Table }; - private: - struct StructDesc { - StructType structType; - int count; - bool nested; - bool inTableHeader; - bool inTableRow; - bool inTableItem; - bool odd; - - StructDesc() - : structType(BulletList), - count(0), - nested(false), - inTableHeader(false), - inTableRow(false), - inTableItem(false), - odd(true) { } - - StructDesc(StructType t, bool n) - : structType(t), - count(0), - nested(n), - inTableHeader(false), - inTableRow(false), - inTableItem(false), - odd(true) { } - }; - - typedef QStack<StructDesc> StructStack; - - enum CommentType { - ClassComment, - EnumComment, - ExampleComment, - FnComment, - GroupComment, - HeaderFileComment, - MacroComment, - ModuleComment, - PageComment, - PropertyComment, - ServiceComment, - TypedefComment, - VariableComment, - OtherComment - }; - - private: - CommentType commentType; - int lineLength; - int lineCount; - DocPrivate* priv; - QString oldText; - QString newText; - StructStack structs; - - QString currentPage; - QString currentFn; - QString currentTitle; - QString currentEnum; - QString currentProperty; - QString currentVariable; - QString currentExample; - QString currentGroup; - QString currentModule; - QString currentMacro; - QString currentService; - QString currentTypedef; - QString currentHeaderFile; - static QString currentClass; - - static int doxPass; - static QSet<QString> anchors; - static QStringMap exampleTitles; - static QStringMap headerFileTitles; - static QStringMap fileTitles; - static QStringMap groupTitles; - static QStringMap moduleTitles; - static QStringMap pageTitles; - static QStringMap externalPageTitles; - static QStringMap exampleTitlesInverse; - static QStringMap headerFileTitlesInverse; - static QStringMap fileTitlesInverse; - static QStringMap groupTitlesInverse; - static QStringMap moduleTitlesInverse; - static QStringMap pageTitlesInverse; - static QStringMap externalPageTitlesInverse; - - static QStringMultiMap variables; - static QStringMultiMap properties; - static QStringMultiMap enums; -}; - -#endif - QT_END_NAMESPACE #endif diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 13d52bf..422e956 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -61,6 +61,127 @@ QT_BEGIN_NAMESPACE static bool showBrokenLinks = false; +static QRegExp linkTag("(<@link node=\"([^\"]+)\">).*(</@link>)"); +static QRegExp funcTag("(<@func target=\"([^\"]*)\">)(.*)(</@func>)"); +static QRegExp typeTag("(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)(</@\\2>)"); +static QRegExp spanTag("</@(?:comment|preprocessor|string|char)>"); +static QRegExp unknownTag("</?@[^>]*>"); + +bool parseArg(const QString &src, + const QString &tag, + int *pos, + int n, + QStringRef *contents, + QStringRef *par1 = 0, + bool debug = false) +{ +#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 +} + +static void addLink(const QString &linkTarget, + const QStringRef &nestedStuff, + QString *res) +{ + if (!linkTarget.isEmpty()) { + *res += "<a href=\""; + *res += linkTarget; + *res += "\">"; + *res += nestedStuff; + *res += "</a>"; + } + else { + *res += nestedStuff; + } +} + + HtmlGenerator::HtmlGenerator() : helpProjectWriter(0), inLink(false), inContents(false), inSectionHeading(false), inTableHeader(false), numTableRows(0), @@ -997,29 +1118,34 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, 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) + if (func->metaness() == FunctionNode::Ctor || + func->metaness() == FunctionNode::Dtor || + func->overloadNumber() != 1) names.clear(); - } else if ((*m)->type() == Node::Property) { + } + else if ((*m)->type() == Node::Property) { const PropertyNode *prop = reinterpret_cast<const PropertyNode *>(*m); - if (!prop->getters().isEmpty() && !names.contains(prop->getters().first()->name())) + 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); + } + 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)); + enume->doc().enumItemNames().toSet() - + enume->doc().omitEnumItemNames().toSet()) + names << plainCode(marker->markedUpEnumValue(enumName, + enume)); } foreach (const QString &name, names) - classSection.keywords += qMakePair(name, linkForNode(*m, 0)); + classSection.keywords += qMakePair(name,linkForNode(*m,0)); } ++m; } @@ -1928,40 +2054,6 @@ void HtmlGenerator::generateLegaleseList(const Node *relative, CodeMarker *marke } } -void HtmlGenerator::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 = protect(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); -} - void HtmlGenerator::generateOverviewList(const Node *relative, CodeMarker * /* marker */) { QMap<const FakeNode *, QMap<QString, FakeNode *> > fakeNodeMap; @@ -2075,21 +2167,35 @@ void HtmlGenerator::generateOverviewList(const Node *relative, CodeMarker * /* m } } -void HtmlGenerator::generateSectionList(const Section& section, const Node *relative, - CodeMarker *marker, CodeMarker::SynopsisStyle style) +#ifdef QDOC_NAME_ALIGNMENT +void HtmlGenerator::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) { + } + else if (section.members.first()->type() == Node::Property) { twoColumn = (section.members.count() >= 5); + name_alignment = false; + } + if (name_alignment) { + out() << "<table border=\"0\" cellpadding=\"0\" " + << "cellspacing=\"0\" width=\"100%\">\n"; + } + else { + if (twoColumn) + out() << "<p><table width=\"100%\" " + << "border=\"0\" cellpadding=\"0\"" + << " cellspacing=\"0\">\n" + << "<tr><td width=\"45%\" valign=\"top\">"; + out() << "<ul>\n"; } - if (twoColumn) - out() << "<p><table width=\"100%\" border=\"0\" cellpadding=\"0\"" - " cellspacing=\"0\">\n" - << "<tr><td width=\"45%\" valign=\"top\">"; - out() << "<ul>\n"; int i = 0; NodeList::ConstIterator m = section.members.begin(); @@ -2099,41 +2205,56 @@ void HtmlGenerator::generateSectionList(const Section& section, const Node *rela continue; } - if (twoColumn && i == (int) (section.members.count() + 1) / 2) - out() << "</ul></td><td valign=\"top\"><ul>\n"; + if (name_alignment) { + out() << "<tr><td class=\"memItemLeft\" " + << "align=\"right\" valign=\"top\">"; + } + else { + if (twoColumn && i == (int) (section.members.count() + 1) / 2) + out() << "</ul></td><td valign=\"top\"><ul>\n"; + out() << "<li><div class=\"fn\">"; + } - out() << "<li><div class=\"fn\"></div>"; - if (style == CodeMarker::Accessors) - out() << "<b>"; - generateSynopsis(*m, relative, marker, style); - if (style == CodeMarker::Accessors) - out() << "</b>"; - out() << "</li>\n"; + generateSynopsis(*m, relative, marker, style, name_alignment); + if (name_alignment) + out() << "</td></tr>\n"; + else + out() << "</div></li>\n"; i++; ++m; } - out() << "</ul>\n"; - if (twoColumn) - out() << "</td></tr>\n</table></p>\n"; + if (name_alignment) + out() << "</table>\n"; + else { + out() << "</ul>\n"; + if (twoColumn) + out() << "</td></tr>\n</table></p>\n"; + } } if (style == CodeMarker::Summary && !section.inherited.isEmpty()) { out() << "<ul>\n"; - generateSectionInheritedList(section, relative, marker); + generateSectionInheritedList(section, relative, marker, name_alignment); out() << "</ul>\n"; } } -void HtmlGenerator::generateSectionInheritedList(const Section& section, const Node *relative, - CodeMarker *marker) +void HtmlGenerator::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()) { - out() << "<li><div class=\"fn\"></div>"; + if (nameAlignment) + out() << "<li><div bar=2 class=\"fn\"></div>"; + else + out() << "<li><div class=\"fn\"></div>"; out() << (*p).second << " "; if ((*p).second == 1) { out() << section.singularMember; - } else { + } + else { out() << section.pluralMember; } out() << " inherited from <a href=\"" << fileName((*p).first) @@ -2144,270 +2265,317 @@ void HtmlGenerator::generateSectionInheritedList(const Section& section, const N } } -void HtmlGenerator::generateLink(const Atom *atom, const Node * /* relative */, CodeMarker *marker) +void HtmlGenerator::generateSynopsis(const Node *node, + const Node *relative, + CodeMarker *marker, + CodeMarker::SynopsisStyle style, + bool nameAlignment) { - 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); - out() << protect(atom->string().left(k)); - if (link.isEmpty()) { - if (showBrokenLinks) - out() << "</i>"; - } else { - out() << "</a>"; - } - inLink = false; - out() << protect(atom->string().mid(k)); - } else if (marker->recognizeLanguage("Java")) { - // hack for Java: remove () and use <tt> when appropriate - bool func = atom->string().endsWith("()"); - bool tt = (func || atom->string().contains(camelCase)); - if (tt) - out() << "<tt>"; - if (func) { - out() << protect(atom->string().left(atom->string().length() - 2)); - } else { - out() << protect(atom->string()); - } - out() << "</tt>"; - } else { - out() << protect(atom->string()); + QString marked = marker->markedUpSynopsis(node, relative, style); + QRegExp templateTag("(<[^@>]*>)"); + if (marked.indexOf(templateTag) != -1) { + QString contents = protect(marked.mid(templateTag.pos(1), + templateTag.cap(1).length())); + marked.replace(templateTag.pos(1), templateTag.cap(1).length(), + contents); } -} - -QString HtmlGenerator::cleanRef(const QString& ref) -{ - QString clean; - - if (ref.isEmpty()) - return clean; + marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])</@param>"), + "<i>\\1<sub>\\2</sub></i>"); + marked.replace("<@param>", "<i>"); + marked.replace("</@param>", "</i>"); - clean.reserve(ref.size() + 20); - const QChar c = ref[0]; - const uint u = c.unicode(); + if (style == CodeMarker::Summary) { + marked.replace("<@name>", ""); // was "<b>" + marked.replace("</@name>", ""); // was "</b>" + } - 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."; + if (style == CodeMarker::SeparateList) { + QRegExp extraRegExp("<@extra>.*</@extra>"); + extraRegExp.setMinimal(true); + marked.replace(extraRegExp, ""); } else { - clean += "A"; + marked.replace("<@extra>", " <tt>"); + marked.replace("</@extra>", "</tt>"); } - 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); - } + if (style != CodeMarker::Detailed) { + marked.replace("<@type>", ""); + marked.replace("</@type>", ""); } - return clean; + out() << highlightedCode(marked, marker, relative, nameAlignment); } -QString HtmlGenerator::registerRef(const QString& ref) +QString HtmlGenerator::highlightedCode(const QString& markedCode, + CodeMarker *marker, + const Node *relative, + bool nameAlignment) { - QString clean = HtmlGenerator::cleanRef(ref); + QString src = markedCode; + QString html; + QStringRef arg; + QStringRef par1; - for (;;) { - QString& prevRef = refMap[clean.toLower()]; - if (prevRef.isEmpty()) { - prevRef = ref; - break; - } else if (prevRef == ref) { - break; + const QChar charLangle = '<'; + const QChar charAt = '@'; + + // replace all <@link> tags: "(<@link node=\"([^\"]+)\">).*(</@link>)" + static const QString linkTag("link"); + for (int i = 0, n = src.size(); i < n;) { + if (src.at(i) == charLangle && src.at(i + 1).unicode() == '@') { + if (nameAlignment) // && (i != 0)) Why was this here? + html += " </td><td class=\"memItemRight\" valign=\"bottom\">"; + i += 2; + if (parseArg(src, linkTag, &i, n, &arg, &par1)) { + QString link = linkForNode( + CodeMarker::nodeForString(par1.toString()), relative); + addLink(link, arg, &html); + } + else { + html += charLangle; + html += charAt; + } + } + else { + html += src.at(i++); } - clean += "x"; } - return clean; -} -QString HtmlGenerator::protect(const QString& string) -{ -#define APPEND(x) \ - if (html.isEmpty()) { \ - html = string; \ - html.truncate(i); \ - } \ - html += (x); - QString html; - int n = string.length(); - - for (int i = 0; i < n; ++i) { - QChar ch = string.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(), + tre, + relative), + relative); + addLink(link, arg, &html); + par1 = QStringRef(); + } + else { + html += charLangle; + html += charAt; + } + } + else { + html += src.at(i++); + } + } + } - if (ch == QLatin1Char('&')) { - APPEND("&"); - } else if (ch == QLatin1Char('<')) { - APPEND("<"); - } else if (ch == QLatin1Char('>')) { - APPEND(">"); - } else if (ch == QLatin1Char('"')) { - APPEND("""); - } else if (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"); - html += QString::number(ch.unicode(), 16); - html += QLatin1Char(';'); - } else { - if (!html.isEmpty()) - html += ch; + // 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(), tre, relative), + relative); + addLink(link, arg, &html); + handled = true; + break; + } + } + if (!handled) { + html += charLangle; + html += charAt; + } + } + else { + html += src.at(i++); } } - if (!html.isEmpty()) - return html; - return string; + // 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; + } + } -#undef APPEND + return html; } -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 parseArg(const QString &src, - const QString &tag, - int *pos, - int n, - QStringRef *contents, - QStringRef *par1 = 0, - bool debug = false) +#else +void HtmlGenerator::generateSectionList(const Section& section, + const Node *relative, + CodeMarker *marker, + CodeMarker::SynopsisStyle style) { -#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; + if (!section.members.isEmpty()) { + bool twoColumn = false; + if (style == CodeMarker::SeparateList) { + twoColumn = (section.members.count() >= 16); + } else if (section.members.first()->type() == Node::Property) { + twoColumn = (section.members.count() >= 5); + } + if (twoColumn) + out() << "<p><table width=\"100%\" border=\"0\" cellpadding=\"0\"" + " cellspacing=\"0\">\n" + << "<tr><td width=\"45%\" valign=\"top\">"; + out() << "<ul>\n"; - int i = *pos; - int j = i; + int i = 0; + NodeList::ConstIterator m = section.members.begin(); + while (m != section.members.end()) { + if ((*m)->access() == Node::Private) { + ++m; + continue; + } - // assume "<@" has been parsed outside - //SKIP_CHAR('<'); - //SKIP_CHAR('@'); + if (twoColumn && i == (int) (section.members.count() + 1) / 2) + out() << "</ul></td><td valign=\"top\"><ul>\n"; - if (tag != QStringRef(&src, i, tag.length())) { - if (0 && debug) - qDebug() << "tag " << tag << " not found at " << i; - return false; + out() << "<li><div class=\"fn\"></div>"; + if (style == CodeMarker::Accessors) + out() << "<b>"; + generateSynopsis(*m, relative, marker, style); + if (style == CodeMarker::Accessors) + out() << "</b>"; + out() << "</li>\n"; + i++; + ++m; + } + out() << "</ul>\n"; + if (twoColumn) + out() << "</td></tr>\n</table></p>\n"; } - if (debug) - qDebug() << "haystack:" << src << "needle:" << tag << "i:" <<i; - - // skip tag - i += tag.length(); + if (style == CodeMarker::Summary && !section.inherited.isEmpty()) { + out() << "<ul>\n"; + generateSectionInheritedList(section, relative, marker); + out() << "</ul>\n"; + } +} - // 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; +void HtmlGenerator::generateSectionInheritedList(const Section& section, + const Node *relative, + CodeMarker *marker) +{ + QList<QPair<ClassNode *, int> >::ConstIterator p = section.inherited.begin(); + while (p != section.inherited.end()) { + out() << "<li><div bar=2 class=\"fn\"></div>"; + out() << (*p).second << " "; + if ((*p).second == 1) { + out() << section.singularMember; } else { - if (debug) - qDebug() << "no optional parameter found"; + out() << section.pluralMember; } + out() << " inherited from <a href=\"" << fileName((*p).first) + << "#" << HtmlGenerator::cleanRef(section.name.toLower()) << "\">" + << protect(marker->plainFullName((*p).first, relative)) + << "</a></li>\n"; + ++p; } - 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; +void HtmlGenerator::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 = protect(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>"); - *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 -} + if (style == CodeMarker::Summary) + marked.replace("@name>", "b>"); -static void addLink(const QString &linkTarget, - const QStringRef &nestedStuff, - QString *res) -{ - if (!linkTarget.isEmpty()) { - *res += "<a href=\""; - *res += linkTarget; - *res += "\">"; - *res += nestedStuff; - *res += "</a>"; + if (style == CodeMarker::SeparateList) { + QRegExp extraRegExp("<@extra>.*</@extra>"); + extraRegExp.setMinimal(true); + marked.replace(extraRegExp, ""); + } else { + marked.replace("<@extra>", " <tt>"); + marked.replace("</@extra>", "</tt>"); } - else { - *res += nestedStuff; + + if (style != CodeMarker::Detailed) { + marked.replace("<@type>", ""); + marked.replace("</@type>", ""); } + out() << highlightedCode(marked, marker, relative); } QString HtmlGenerator::highlightedCode(const QString& markedCode, @@ -2570,6 +2738,153 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode, return html; } +#endif + +void HtmlGenerator::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); + out() << protect(atom->string().left(k)); + if (link.isEmpty()) { + if (showBrokenLinks) + out() << "</i>"; + } else { + out() << "</a>"; + } + inLink = false; + out() << protect(atom->string().mid(k)); + } else if (marker->recognizeLanguage("Java")) { + // hack for Java: remove () and use <tt> when appropriate + bool func = atom->string().endsWith("()"); + bool tt = (func || atom->string().contains(camelCase)); + if (tt) + out() << "<tt>"; + if (func) { + out() << protect(atom->string().left(atom->string().length() - 2)); + } else { + out() << protect(atom->string()); + } + out() << "</tt>"; + } else { + out() << protect(atom->string()); + } +} + +QString HtmlGenerator::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 HtmlGenerator::registerRef(const QString& ref) +{ + QString clean = HtmlGenerator::cleanRef(ref); + + for (;;) { + QString& prevRef = refMap[clean.toLower()]; + if (prevRef.isEmpty()) { + prevRef = ref; + break; + } else if (prevRef == ref) { + break; + } + clean += "x"; + } + return clean; +} + +QString HtmlGenerator::protect(const QString& string) +{ +#define APPEND(x) \ + if (html.isEmpty()) { \ + html = string; \ + html.truncate(i); \ + } \ + html += (x); + + QString html; + 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 (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"); + html += QString::number(ch.unicode(), 16); + html += QLatin1Char(';'); + } else { + if (!html.isEmpty()) + html += ch; + } + } + + if (!html.isEmpty()) + return html; + return string; + +#undef APPEND +} QString HtmlGenerator::fileBase(const Node *node) { @@ -2778,7 +3093,7 @@ void HtmlGenerator::generateDetailedMember(const Node *node, section.members += property->resetters(); if (!section.members.isEmpty()) { - out() << "<p>Access functions:</p>\n"; + out() << "<p><b>Access functions:</b></p>\n"; generateSectionList(section, node, marker, CodeMarker::Accessors); } } @@ -2789,7 +3104,8 @@ void HtmlGenerator::generateDetailedMember(const Node *node, << " type is a typedef for " << "<a href=\"qflags.html\">QFlags</a><" << protect(enume->name()) - << ">. It stores an OR combination of " << protect(enume->name()) + << ">. It stores an OR combination of " + << protect(enume->name()) << " values.</p>\n"; } } @@ -2803,7 +3119,8 @@ void HtmlGenerator::findAllClasses(const InnerNode *node) 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 && + if ((*c)->parent() && + (*c)->parent()->type() == Node::Namespace && !(*c)->parent()->name().isEmpty()) className = (*c)->parent()->name()+"::"+className; @@ -2851,7 +3168,7 @@ void HtmlGenerator::findAllFunctions(const InnerNode *node) 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((*c)->parent()->name(), *c); + funcIndex[(*c)->name()].insert(tre->fullDocumentName((*c)->parent()), *c); } } } diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index de64190..ec9532f 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -46,6 +46,8 @@ #ifndef HTMLGENERATOR_H #define HTMLGENERATOR_H +#define QDOC_NAME_ALIGNMENT + #include <qmap.h> #include <qregexp.h> @@ -139,17 +141,36 @@ class HtmlGenerator : public PageGenerator void generateFunctionIndex(const Node *relative, CodeMarker *marker); void generateLegaleseList(const Node *relative, CodeMarker *marker); void generateOverviewList(const Node *relative, CodeMarker *marker); - void generateSynopsis(const Node *node, - const Node *relative, - CodeMarker *marker, - CodeMarker::SynopsisStyle style); void generateSectionList(const Section& section, const Node *relative, CodeMarker *marker, CodeMarker::SynopsisStyle style); +#ifdef QDOC_NAME_ALIGNMENT + 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, + bool nameAlignment = false); +#else + void generateSynopsis(const Node *node, + const Node *relative, + CodeMarker *marker, + CodeMarker::SynopsisStyle style); void generateSectionInheritedList(const Section& section, const Node *relative, CodeMarker *marker); + QString highlightedCode(const QString& markedCode, + CodeMarker *marker, + const Node *relative); +#endif void generateFullName(const Node *apparentNode, const Node *relative, CodeMarker *marker, @@ -159,7 +180,6 @@ class HtmlGenerator : public PageGenerator void generateStatus(const Node *node, CodeMarker *marker); QString registerRef(const QString& ref); - QString highlightedCode(const QString& markedCode, CodeMarker *marker, const Node *relative); QString fileBase(const Node *node); #if 0 QString fileBase(const Node *node, const SectionIterator& section); diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp index 3e6f832..995d037 100644 --- a/tools/qdoc3/main.cpp +++ b/tools/qdoc3/main.cpp @@ -43,6 +43,7 @@ main.cpp */ +#include <qglobal.h> #include <QtCore> #include <stdlib.h> #include "apigenerator.h" @@ -94,11 +95,10 @@ static const struct { }; static bool slow = false; +static bool showInternal = false; static QStringList defines; static QHash<QString, Tree *> trees; -//static int doxygen = 0; - /*! Find the Tree for language \a lang and return a pointer to it. If there is no Tree for language \a lang in the Tree table, add @@ -121,14 +121,16 @@ static void printHelp() { Location::information(tr("Usage: qdoc [options] file1.qdocconf ...\n" "Options:\n" - " -help " + " -help " "Display this information and exit\n" - " -version " + " -version " "Display version of qdoc and exit\n" - " -D<name> " + " -D<name> " "Define <name> as a macro while parsing sources\n" - " -slow " - "Turn on features that slow down qdoc") ); + " -slow " + "Turn on features that slow down qdoc" + " -showinternal " + "Include stuff marked internal") ); } /*! @@ -136,7 +138,8 @@ static void printHelp() */ static void printVersion() { - Location::information(tr("qdoc version 4.4.1")); + QString s = QString(tr("qdoc version ")) + QString(QT_VERSION_STR); + Location::information(s); } /*! @@ -160,6 +163,8 @@ static void processQdocconfFile(const QString &fileName) ++i; } config.setStringList(CONFIG_SLOW, QStringList(slow ? "true" : "false")); + config.setStringList(CONFIG_SHOWINTERNAL, + QStringList(showInternal ? "true" : "false")); /* With the default configuration values in place, load @@ -222,18 +227,6 @@ static void processQdocconfFile(const QString &fileName) QString lang = config.getString(CONFIG_LANGUAGE); Location langLocation = config.lastLocation(); -#ifdef QDOC2DOX - // qdoc -> doxygen - if (doxygen == 2) { - qDebug() << "READING anchors.txt"; - DoxWriter::readAnchors(); - qDebug() << "READING title maps"; - DoxWriter::readTitles(); - qDebug() << "READING member multimaps"; - DoxWriter::readMembers(); - } -#endif - /* Initialize the tree where all the parsed sources will be stored. The tree gets built as the source files are parsed, and then the @@ -320,17 +313,6 @@ static void processQdocconfFile(const QString &fileName) tree->resolveGroups(); tree->resolveTargets(); -#ifdef QDOC2DOX - // qdoc -> doxygen - if (doxygen == 1) { - DoxWriter::writeAnchors(); - DoxWriter::writeTitles(); - DoxWriter::writeMembers(); - } - - if (doxygen == 0) { -#endif - /* Now the tree has been built, and all the stuff that needed resolving has been resolved. Now it is time to traverse @@ -349,17 +331,13 @@ static void processQdocconfFile(const QString &fileName) /* Generate the XML tag file, if it was requested. */ + QString tagFile = config.getString(CONFIG_TAGFILE); if (!tagFile.isEmpty()) tree->generateTagFile(tagFile); - + tree->setVersion(""); Generator::terminate(); - -#ifdef QDOC2DOX - } -#endif - CodeParser::terminate(); CodeMarker::terminate(); CppToQsConverter::terminate(); @@ -370,7 +348,6 @@ static void processQdocconfFile(const QString &fileName) foreach (QTranslator *translator, translators) delete translator; - delete tree; } @@ -454,26 +431,9 @@ int main(int argc, char **argv) else if (opt == "-slow") { slow = true; } - -#ifdef QDOC2DOX - else if (opt == "-doxygen1") { - // qdoc -> doxygen - // Don't use this; it isn't ready yet. - // Now it's a fossil. - qDebug() << "doxygen pass 1"; - doxygen = 1; - DoxWriter::setDoxPass(1); - } - else if (opt == "-doxygen2") { - // qdoc -> doxygen - // Don't use this; it isn't ready yet. - // Now it's a fossil. - qDebug() << "doxygen pass 2"; - doxygen = 2; - DoxWriter::setDoxPass(2); + else if (opt == "-showinternal") { + showInternal = true; } -#endif - else { qdocFiles.append(opt); } diff --git a/tools/qdoc3/test/classic.css b/tools/qdoc3/test/classic.css index 6cf7377..5239856 100644 --- a/tools/qdoc3/test/classic.css +++ b/tools/qdoc3/test/classic.css @@ -1,12 +1,31 @@ +BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV { + font-family: Arial, Geneva, Helvetica, sans-serif; +} +H1 { + text-align: center; + font-size: 160%; +} +H2 { + font-size: 120%; +} +H3 { + font-size: 100%; +} + h3.fn,span.fn { - margin-left: 1cm; - text-indent: -1cm; + background-color: #d5e1d5; + border-width: 1px; + border-style: solid; + border-color: #66bc29; + font-weight: bold; + -moz-border-radius: 8px 8px 8px 8px; + padding: 6px 0px 6px 10px; } a:link { - color: #004faf; + color: #0046ad; text-decoration: none } @@ -40,22 +59,51 @@ a.compat:visited text-decoration: none } -td.postheader -{ - font-family: sans-serif -} - -tr.address -{ - font-family: sans-serif -} - body { background: #ffffff; color: black } +table td.memItemLeft { + width: 100px; + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 100%; + white-space: nowrap +} +table td.memItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 100%; +} + table tr.odd { background: #f0f0f0; color: black; @@ -77,10 +125,10 @@ table.annotated td { table tr pre { - padding-top: none; - padding-bottom: none; - padding-left: none; - padding-right: none; + padding-top: 0px; + padding-bottom: 0px; + padding-left: 0px; + padding-right: 0px; border: none; background: none } diff --git a/tools/qtestlib/chart/benchmark_template.html b/tools/qtestlib/chart/benchmark_template.html index 11efd92..a7e48be 100644 --- a/tools/qtestlib/chart/benchmark_template.html +++ b/tools/qtestlib/chart/benchmark_template.html @@ -108,15 +108,25 @@ function checkform() this.createChart(); } +function createElement(nodeName, name) { + var node; + try { + node = document.createElement("<"+nodeName+" name="+name+">"); + } catch (e) { + node = document.createElement(nodeName); + node.name = name; + } + return node; +} + function createFormSelector(form, value, text, type) { - var selector = document.createElement('input'); - form.appendChild(selector); + var selector = createElement('input', 'list'); selector.type = type; - selector.name = 'list'; selector.defaultChecked = true; selector.value = value; + form.appendChild(selector); form.appendChild(document.createTextNode(text)); form.appendChild(document.createElement("BR")); } diff --git a/tools/qtestlib/chart/chart.pro b/tools/qtestlib/chart/chart.pro index 6f6e6d5..7328e5d 100644 --- a/tools/qtestlib/chart/chart.pro +++ b/tools/qtestlib/chart/chart.pro @@ -4,7 +4,7 @@ SOURCES += main.cpp RESOURCES = $$PWD/chart.qrc QT += sql xml -CONFIG += console release +CONFIG += console CONFIG -= app_bundle diff --git a/tools/qtestlib/chart/reportgenerator.cpp b/tools/qtestlib/chart/reportgenerator.cpp index bf5bf94..94661ba 100644 --- a/tools/qtestlib/chart/reportgenerator.cpp +++ b/tools/qtestlib/chart/reportgenerator.cpp @@ -253,7 +253,7 @@ QByteArray printSeriesLabels(const QString &tableName, const QString &seriesColu output += "["; foreach(const QString &serie, series) { - output += "\"" + serie.toLocal8Bit() + "\", "; + output += "\"" + serie.toLocal8Bit() + "\","; } output.chop(1); //remove last comma output += "]\n"; @@ -446,7 +446,6 @@ void ReportGenerator::writeReports() } */ writeReport("Results", "results.html", false); - qDebug() << "Supported browsers: Firefox, Safari, Opera, Qt Demo Browser (IE and KDE 3 Konqueror are not supported)"; } QString ReportGenerator::fileName() diff --git a/tools/qvfb/PDAPhone.skin/pda_up.png b/tools/qvfb/PDAPhone.skin/pda_up.png Binary files differdeleted file mode 100644 index 541e3c4..0000000 --- a/tools/qvfb/PDAPhone.skin/pda_up.png +++ /dev/null diff --git a/tools/qvfb/pda.qrc b/tools/qvfb/pda.qrc deleted file mode 100644 index b14e7b3..0000000 --- a/tools/qvfb/pda.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource prefix="/skins"> - <file>pda.skin</file> -</qresource> -</RCC> diff --git a/tools/qvfb/pda.skin b/tools/qvfb/pda.skin deleted file mode 100644 index 037f750..0000000 --- a/tools/qvfb/pda.skin +++ /dev/null @@ -1,14 +0,0 @@ -pda_up.png pda_down.png -57 81 -240 320 -11 -"Power" 0x0100000a 277 36 302 57 -"F1" 0x01000030 52 439 81 470 -"F2" 0x01000031 101 422 130 451 -"F3" 0x01000032 232 423 260 452 -"F4" 0x01000033 279 445 309 473 -"Left" 0x01000012 155 438 176 472 -"Down" 0x01000015 169 471 203 486 -"Right" 0x01000014 193 448 215 472 -"Up" 0x01000013 166 427 199 451 -"Enter" 0x01000005 177 448 193 468 diff --git a/tools/qvfb/pda_down.png b/tools/qvfb/pda_down.png Binary files differdeleted file mode 100644 index 0ea157d..0000000 --- a/tools/qvfb/pda_down.png +++ /dev/null diff --git a/tools/qvfb/qvfb.pro b/tools/qvfb/qvfb.pro index 85c4d96..247337a 100644 --- a/tools/qvfb/qvfb.pro +++ b/tools/qvfb/qvfb.pro @@ -60,15 +60,4 @@ unix:x11 { LIBS += -lXtst } -RESOURCES += qvfb.qrc \ - ClamshellPhone.qrc \ - PDAPhone.qrc \ - SmartPhone2.qrc \ - SmartPhone.qrc \ - SmartPhoneWithButtons.qrc \ - TouchscreenPhone.qrc \ - Trolltech-Keypad.qrc \ - Trolltech-Touchscreen.qrc \ - PortableMedia.qrc \ - S60-QVGA-Candybar.qrc \ - S60-nHD-Touchscreen.qrc +RESOURCES += qvfb.qrc diff --git a/tools/shared/deviceskin/deviceskin.pri b/tools/shared/deviceskin/deviceskin.pri index e4c9ef7..2552c92 100644 --- a/tools/shared/deviceskin/deviceskin.pri +++ b/tools/shared/deviceskin/deviceskin.pri @@ -1,3 +1,15 @@ 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/qvfb/ClamshellPhone.qrc b/tools/shared/deviceskin/skins/ClamshellPhone.qrc index 39cd422..39cd422 100644 --- a/tools/qvfb/ClamshellPhone.qrc +++ b/tools/shared/deviceskin/skins/ClamshellPhone.qrc diff --git a/tools/qvfb/ClamshellPhone.skin/ClamshellPhone.skin b/tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone.skin index cb24a8e..cb24a8e 100644 --- a/tools/qvfb/ClamshellPhone.skin/ClamshellPhone.skin +++ b/tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone.skin diff --git a/tools/qvfb/ClamshellPhone.skin/ClamshellPhone1-5-closed.png b/tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone1-5-closed.png Binary files differindex 88ba3a1..88ba3a1 100644 --- a/tools/qvfb/ClamshellPhone.skin/ClamshellPhone1-5-closed.png +++ b/tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone1-5-closed.png diff --git a/tools/qvfb/ClamshellPhone.skin/ClamshellPhone1-5-pressed.png b/tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone1-5-pressed.png Binary files differindex 971cdef..971cdef 100644 --- a/tools/qvfb/ClamshellPhone.skin/ClamshellPhone1-5-pressed.png +++ b/tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone1-5-pressed.png diff --git a/tools/qvfb/ClamshellPhone.skin/ClamshellPhone1-5.png b/tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone1-5.png Binary files differindex f3550ee..f3550ee 100644 --- a/tools/qvfb/ClamshellPhone.skin/ClamshellPhone1-5.png +++ b/tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone1-5.png diff --git a/tools/qvfb/S60-QVGA-Candybar.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/ClamshellPhone.skin/defaultbuttons.conf index e349dbc..e349dbc 100644 --- a/tools/qvfb/S60-QVGA-Candybar.skin/defaultbuttons.conf +++ b/tools/shared/deviceskin/skins/ClamshellPhone.skin/defaultbuttons.conf diff --git a/tools/qvfb/DualScreenPhone.skin/DualScreen-pressed.png b/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreen-pressed.png Binary files differindex d62ef4a..d62ef4a 100644 --- a/tools/qvfb/DualScreenPhone.skin/DualScreen-pressed.png +++ b/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreen-pressed.png diff --git a/tools/qvfb/DualScreenPhone.skin/DualScreen.png b/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreen.png Binary files differindex cb3d1a7..cb3d1a7 100644 --- a/tools/qvfb/DualScreenPhone.skin/DualScreen.png +++ b/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreen.png diff --git a/tools/qvfb/DualScreenPhone.skin/DualScreenPhone.skin b/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreenPhone.skin index a82ef23..a82ef23 100644 --- a/tools/qvfb/DualScreenPhone.skin/DualScreenPhone.skin +++ b/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreenPhone.skin diff --git a/tools/qvfb/SmartPhone.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/DualScreenPhone.skin/defaultbuttons.conf index 1103350..1103350 100644 --- a/tools/qvfb/SmartPhone.skin/defaultbuttons.conf +++ b/tools/shared/deviceskin/skins/DualScreenPhone.skin/defaultbuttons.conf diff --git a/tools/qvfb/PDAPhone.qrc b/tools/shared/deviceskin/skins/PDAPhone.qrc index 1a1c35a..1a1c35a 100644 --- a/tools/qvfb/PDAPhone.qrc +++ b/tools/shared/deviceskin/skins/PDAPhone.qrc diff --git a/tools/qvfb/PDAPhone.skin/PDAPhone.skin b/tools/shared/deviceskin/skins/PDAPhone.skin/PDAPhone.skin index d6a1966..d6a1966 100644 --- a/tools/qvfb/PDAPhone.skin/PDAPhone.skin +++ b/tools/shared/deviceskin/skins/PDAPhone.skin/PDAPhone.skin diff --git a/tools/qvfb/PDAPhone.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/PDAPhone.skin/defaultbuttons.conf index e3ae813..e3ae813 100644 --- a/tools/qvfb/PDAPhone.skin/defaultbuttons.conf +++ b/tools/shared/deviceskin/skins/PDAPhone.skin/defaultbuttons.conf diff --git a/tools/qvfb/PDAPhone.skin/finger.png b/tools/shared/deviceskin/skins/PDAPhone.skin/finger.png Binary files differindex 24cf0cb..24cf0cb 100644 --- a/tools/qvfb/PDAPhone.skin/finger.png +++ b/tools/shared/deviceskin/skins/PDAPhone.skin/finger.png diff --git a/tools/qvfb/PDAPhone.skin/pda_down.png b/tools/shared/deviceskin/skins/PDAPhone.skin/pda_down.png Binary files differindex f65c059..f65c059 100644 --- a/tools/qvfb/PDAPhone.skin/pda_down.png +++ b/tools/shared/deviceskin/skins/PDAPhone.skin/pda_down.png diff --git a/tools/qvfb/pda_up.png b/tools/shared/deviceskin/skins/PDAPhone.skin/pda_up.png Binary files differindex 541e3c4..541e3c4 100644 --- a/tools/qvfb/pda_up.png +++ b/tools/shared/deviceskin/skins/PDAPhone.skin/pda_up.png diff --git a/tools/qvfb/PortableMedia.qrc b/tools/shared/deviceskin/skins/PortableMedia.qrc index a902f1a..a902f1a 100644 --- a/tools/qvfb/PortableMedia.qrc +++ b/tools/shared/deviceskin/skins/PortableMedia.qrc diff --git a/tools/qvfb/PortableMedia.skin/PortableMedia.skin b/tools/shared/deviceskin/skins/PortableMedia.skin/PortableMedia.skin index b76e5cf..b76e5cf 100644 --- a/tools/qvfb/PortableMedia.skin/PortableMedia.skin +++ b/tools/shared/deviceskin/skins/PortableMedia.skin/PortableMedia.skin diff --git a/tools/qvfb/PortableMedia.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/PortableMedia.skin/defaultbuttons.conf index 514e881..514e881 100644 --- a/tools/qvfb/PortableMedia.skin/defaultbuttons.conf +++ b/tools/shared/deviceskin/skins/PortableMedia.skin/defaultbuttons.conf diff --git a/tools/qvfb/PortableMedia.skin/portablemedia-pressed.png b/tools/shared/deviceskin/skins/PortableMedia.skin/portablemedia-pressed.png Binary files differindex 730e762..730e762 100644 --- a/tools/qvfb/PortableMedia.skin/portablemedia-pressed.png +++ b/tools/shared/deviceskin/skins/PortableMedia.skin/portablemedia-pressed.png diff --git a/tools/qvfb/PortableMedia.skin/portablemedia.png b/tools/shared/deviceskin/skins/PortableMedia.skin/portablemedia.png Binary files differindex e44cbe1..e44cbe1 100644 --- a/tools/qvfb/PortableMedia.skin/portablemedia.png +++ b/tools/shared/deviceskin/skins/PortableMedia.skin/portablemedia.png diff --git a/tools/qvfb/PortableMedia.skin/portablemedia.xcf b/tools/shared/deviceskin/skins/PortableMedia.skin/portablemedia.xcf Binary files differindex 127e07c..127e07c 100644 --- a/tools/qvfb/PortableMedia.skin/portablemedia.xcf +++ b/tools/shared/deviceskin/skins/PortableMedia.skin/portablemedia.xcf diff --git a/tools/qvfb/S60-QVGA-Candybar.qrc b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.qrc index 8138484..8138484 100644 --- a/tools/qvfb/S60-QVGA-Candybar.qrc +++ b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.qrc diff --git a/tools/qvfb/S60-QVGA-Candybar.skin/S60-QVGA-Candybar-down.png b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/S60-QVGA-Candybar-down.png Binary files differindex 89d40cb..89d40cb 100644 --- a/tools/qvfb/S60-QVGA-Candybar.skin/S60-QVGA-Candybar-down.png +++ b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/S60-QVGA-Candybar-down.png diff --git a/tools/qvfb/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.png b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.png Binary files differindex 0d0e598..0d0e598 100644 --- a/tools/qvfb/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.png +++ b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.png diff --git a/tools/qvfb/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.skin b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.skin index 4f8fe5d..4f8fe5d 100644 --- a/tools/qvfb/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.skin +++ b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.skin diff --git a/tools/qvfb/ClamshellPhone.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/defaultbuttons.conf index e349dbc..e349dbc 100644 --- a/tools/qvfb/ClamshellPhone.skin/defaultbuttons.conf +++ b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/defaultbuttons.conf diff --git a/tools/qvfb/S60-nHD-Touchscreen.qrc b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.qrc index daf0cc3..daf0cc3 100644 --- a/tools/qvfb/S60-nHD-Touchscreen.qrc +++ b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.qrc diff --git a/tools/qvfb/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen-down.png b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen-down.png Binary files differindex 7253e38..7253e38 100644 --- a/tools/qvfb/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen-down.png +++ b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen-down.png diff --git a/tools/qvfb/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.png b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.png Binary files differindex 675563e..675563e 100644 --- a/tools/qvfb/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.png +++ b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.png diff --git a/tools/qvfb/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.skin b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.skin index ed25d0e..ed25d0e 100644 --- a/tools/qvfb/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.skin +++ b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.skin diff --git a/tools/qvfb/Trolltech-Touchscreen.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/defaultbuttons.conf index 6665125..6665125 100644 --- a/tools/qvfb/Trolltech-Touchscreen.skin/defaultbuttons.conf +++ b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/defaultbuttons.conf diff --git a/tools/qvfb/SmartPhone.qrc b/tools/shared/deviceskin/skins/SmartPhone.qrc index 8bb5325..8bb5325 100644 --- a/tools/qvfb/SmartPhone.qrc +++ b/tools/shared/deviceskin/skins/SmartPhone.qrc diff --git a/tools/qvfb/SmartPhone.skin/SmartPhone-pressed.png b/tools/shared/deviceskin/skins/SmartPhone.skin/SmartPhone-pressed.png Binary files differindex d0db2ed..d0db2ed 100644 --- a/tools/qvfb/SmartPhone.skin/SmartPhone-pressed.png +++ b/tools/shared/deviceskin/skins/SmartPhone.skin/SmartPhone-pressed.png diff --git a/tools/qvfb/SmartPhone.skin/SmartPhone.png b/tools/shared/deviceskin/skins/SmartPhone.skin/SmartPhone.png Binary files differindex e6ac5a0..e6ac5a0 100644 --- a/tools/qvfb/SmartPhone.skin/SmartPhone.png +++ b/tools/shared/deviceskin/skins/SmartPhone.skin/SmartPhone.png diff --git a/tools/qvfb/SmartPhone.skin/SmartPhone.skin b/tools/shared/deviceskin/skins/SmartPhone.skin/SmartPhone.skin index 2f44c5a..2f44c5a 100644 --- a/tools/qvfb/SmartPhone.skin/SmartPhone.skin +++ b/tools/shared/deviceskin/skins/SmartPhone.skin/SmartPhone.skin diff --git a/tools/qvfb/DualScreenPhone.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/SmartPhone.skin/defaultbuttons.conf index 1103350..1103350 100644 --- a/tools/qvfb/DualScreenPhone.skin/defaultbuttons.conf +++ b/tools/shared/deviceskin/skins/SmartPhone.skin/defaultbuttons.conf diff --git a/tools/qvfb/SmartPhone2.qrc b/tools/shared/deviceskin/skins/SmartPhone2.qrc index 751e985..751e985 100644 --- a/tools/qvfb/SmartPhone2.qrc +++ b/tools/shared/deviceskin/skins/SmartPhone2.qrc diff --git a/tools/qvfb/SmartPhone2.skin/SmartPhone2-pressed.png b/tools/shared/deviceskin/skins/SmartPhone2.skin/SmartPhone2-pressed.png Binary files differindex d4eb5b0..d4eb5b0 100644 --- a/tools/qvfb/SmartPhone2.skin/SmartPhone2-pressed.png +++ b/tools/shared/deviceskin/skins/SmartPhone2.skin/SmartPhone2-pressed.png diff --git a/tools/qvfb/SmartPhone2.skin/SmartPhone2.png b/tools/shared/deviceskin/skins/SmartPhone2.skin/SmartPhone2.png Binary files differindex 48ccc1c..48ccc1c 100644 --- a/tools/qvfb/SmartPhone2.skin/SmartPhone2.png +++ b/tools/shared/deviceskin/skins/SmartPhone2.skin/SmartPhone2.png diff --git a/tools/qvfb/SmartPhone2.skin/SmartPhone2.skin b/tools/shared/deviceskin/skins/SmartPhone2.skin/SmartPhone2.skin index 16884bf..16884bf 100644 --- a/tools/qvfb/SmartPhone2.skin/SmartPhone2.skin +++ b/tools/shared/deviceskin/skins/SmartPhone2.skin/SmartPhone2.skin diff --git a/tools/qvfb/SmartPhone2.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/SmartPhone2.skin/defaultbuttons.conf index b083203..b083203 100644 --- a/tools/qvfb/SmartPhone2.skin/defaultbuttons.conf +++ b/tools/shared/deviceskin/skins/SmartPhone2.skin/defaultbuttons.conf diff --git a/tools/qvfb/SmartPhoneWithButtons.qrc b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.qrc index f3393ba..f3393ba 100644 --- a/tools/qvfb/SmartPhoneWithButtons.qrc +++ b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.qrc diff --git a/tools/qvfb/SmartPhoneWithButtons.skin/SmartPhoneWithButtons-pressed.png b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/SmartPhoneWithButtons-pressed.png Binary files differindex 456a068..456a068 100644 --- a/tools/qvfb/SmartPhoneWithButtons.skin/SmartPhoneWithButtons-pressed.png +++ b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/SmartPhoneWithButtons-pressed.png diff --git a/tools/qvfb/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.png b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.png Binary files differindex 5ffbd6e..5ffbd6e 100644 --- a/tools/qvfb/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.png +++ b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.png diff --git a/tools/qvfb/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.skin b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.skin index 9afa67f..9afa67f 100644 --- a/tools/qvfb/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.skin +++ b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.skin diff --git a/tools/qvfb/SmartPhoneWithButtons.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/defaultbuttons.conf index ebd6926..ebd6926 100644 --- a/tools/qvfb/SmartPhoneWithButtons.skin/defaultbuttons.conf +++ b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/defaultbuttons.conf diff --git a/tools/qvfb/TouchscreenPhone.qrc b/tools/shared/deviceskin/skins/TouchscreenPhone.qrc index 023144d..023144d 100644 --- a/tools/qvfb/TouchscreenPhone.qrc +++ b/tools/shared/deviceskin/skins/TouchscreenPhone.qrc diff --git a/tools/qvfb/TouchscreenPhone.skin/TouchscreenPhone-pressed.png b/tools/shared/deviceskin/skins/TouchscreenPhone.skin/TouchscreenPhone-pressed.png Binary files differindex 01acb86..01acb86 100644 --- a/tools/qvfb/TouchscreenPhone.skin/TouchscreenPhone-pressed.png +++ b/tools/shared/deviceskin/skins/TouchscreenPhone.skin/TouchscreenPhone-pressed.png diff --git a/tools/qvfb/TouchscreenPhone.skin/TouchscreenPhone.png b/tools/shared/deviceskin/skins/TouchscreenPhone.skin/TouchscreenPhone.png Binary files differindex e90de0d..e90de0d 100644 --- a/tools/qvfb/TouchscreenPhone.skin/TouchscreenPhone.png +++ b/tools/shared/deviceskin/skins/TouchscreenPhone.skin/TouchscreenPhone.png diff --git a/tools/qvfb/TouchscreenPhone.skin/TouchscreenPhone.skin b/tools/shared/deviceskin/skins/TouchscreenPhone.skin/TouchscreenPhone.skin index 24316a1..24316a1 100644 --- a/tools/qvfb/TouchscreenPhone.skin/TouchscreenPhone.skin +++ b/tools/shared/deviceskin/skins/TouchscreenPhone.skin/TouchscreenPhone.skin diff --git a/tools/qvfb/TouchscreenPhone.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/TouchscreenPhone.skin/defaultbuttons.conf index a13dfdc..a13dfdc 100644 --- a/tools/qvfb/TouchscreenPhone.skin/defaultbuttons.conf +++ b/tools/shared/deviceskin/skins/TouchscreenPhone.skin/defaultbuttons.conf diff --git a/tools/qvfb/Trolltech-Keypad.qrc b/tools/shared/deviceskin/skins/Trolltech-Keypad.qrc index 4775068..4775068 100644 --- a/tools/qvfb/Trolltech-Keypad.qrc +++ b/tools/shared/deviceskin/skins/Trolltech-Keypad.qrc diff --git a/tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad-closed.png b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad-closed.png Binary files differindex 8dd5719..8dd5719 100644 --- a/tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad-closed.png +++ b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad-closed.png diff --git a/tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad-down.png b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad-down.png Binary files differindex 5e1e6be..5e1e6be 100644 --- a/tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad-down.png +++ b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad-down.png diff --git a/tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad.png b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad.png Binary files differindex fb3d549..fb3d549 100644 --- a/tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad.png +++ b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad.png diff --git a/tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad.skin b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad.skin index 4d90321..4d90321 100644 --- a/tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad.skin +++ b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad.skin diff --git a/tools/qvfb/Trolltech-Keypad.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/defaultbuttons.conf index 6a78e67..6a78e67 100644 --- a/tools/qvfb/Trolltech-Keypad.skin/defaultbuttons.conf +++ b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/defaultbuttons.conf diff --git a/tools/qvfb/Trolltech-Touchscreen.qrc b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.qrc index 40fafeb..40fafeb 100644 --- a/tools/qvfb/Trolltech-Touchscreen.qrc +++ b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.qrc diff --git a/tools/qvfb/Trolltech-Touchscreen.skin/Trolltech-Touchscreen-down.png b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen-down.png Binary files differindex c1a422f..c1a422f 100644 --- a/tools/qvfb/Trolltech-Touchscreen.skin/Trolltech-Touchscreen-down.png +++ b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen-down.png diff --git a/tools/qvfb/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.png b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.png Binary files differindex 544a425..544a425 100644 --- a/tools/qvfb/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.png +++ b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.png diff --git a/tools/qvfb/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.skin b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.skin index 5de882e..5de882e 100644 --- a/tools/qvfb/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.skin +++ b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.skin diff --git a/tools/qvfb/S60-nHD-Touchscreen.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/defaultbuttons.conf index 6665125..6665125 100644 --- a/tools/qvfb/S60-nHD-Touchscreen.skin/defaultbuttons.conf +++ b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/defaultbuttons.conf diff --git a/tools/shared/qttoolbardialog/qttoolbardialog.cpp b/tools/shared/qttoolbardialog/qttoolbardialog.cpp index f15c4bc..9c54e75 100644 --- a/tools/shared/qttoolbardialog/qttoolbardialog.cpp +++ b/tools/shared/qttoolbardialog/qttoolbardialog.cpp @@ -637,10 +637,10 @@ QToolBar *QtFullToolBarManager::createToolBar(const QString &toolBarName) return 0; QToolBar *toolBar = new QToolBar(toolBarName, mainWindow()); int i = 1; - const QString prefix = QLatin1String("_Custom_Toolbar_"); - QString name = QString(QLatin1String("%1%2")).arg(prefix).arg(i); + const QString prefix = QLatin1String("_Custom_Toolbar_%1"); + QString name = prefix.arg(i); while (d_ptr->toolBarByName(name)) - name = QString(QLatin1String("%1%2")).arg(prefix).arg(++i); + name = prefix.arg(++i); toolBar->setObjectName(name); mainWindow()->addToolBar(toolBar); d_ptr->customToolBars.append(toolBar); diff --git a/tools/tools.pro b/tools/tools.pro index e7f7b03..eab9d48 100644 --- a/tools/tools.pro +++ b/tools/tools.pro @@ -22,7 +22,7 @@ mac { SUBDIRS += macdeployqt } -SUBDIRS += kmap2qmap +embedded:SUBDIRS += kmap2qmap contains(QT_CONFIG, dbus):SUBDIRS += qdbus !wince*:contains(QT_CONFIG, xmlpatterns): SUBDIRS += xmlpatterns xmlpatternsvalidator |