From 20d65deb30d3286481402880ff6f646579b687c2 Mon Sep 17 00:00:00 2001 From: ck Date: Mon, 7 Dec 2009 15:50:50 +0100 Subject: Assistant: Use tracing macro in all functions. Reviewed-by: kh1 --- tools/assistant/tools/assistant/aboutdialog.cpp | 11 +++ .../assistant/tools/assistant/bookmarkmanager.cpp | 46 +++++++++++ tools/assistant/tools/assistant/centralwidget.cpp | 68 ++++++++++++++++ tools/assistant/tools/assistant/cmdlineparser.cpp | 29 +++++++ tools/assistant/tools/assistant/contentwindow.cpp | 12 +++ .../assistant/tools/assistant/filternamedialog.cpp | 4 + .../tools/assistant/helpenginewrapper.cpp | 90 ++++++++++++++++++++++ tools/assistant/tools/assistant/helpviewer.cpp | 36 +++++++++ tools/assistant/tools/assistant/indexwindow.cpp | 10 +++ tools/assistant/tools/assistant/installdialog.cpp | 15 ++++ tools/assistant/tools/assistant/main.cpp | 14 ++++ tools/assistant/tools/assistant/mainwindow.cpp | 62 +++++++++++++++ .../tools/assistant/preferencesdialog.cpp | 21 +++++ tools/assistant/tools/assistant/qtdocinstaller.cpp | 6 ++ tools/assistant/tools/assistant/remotecontrol.cpp | 20 +++++ tools/assistant/tools/assistant/searchwidget.cpp | 14 ++++ tools/assistant/tools/assistant/topicchooser.cpp | 3 + tools/assistant/tools/assistant/xbelsupport.cpp | 11 +++ 18 files changed, 472 insertions(+) diff --git a/tools/assistant/tools/assistant/aboutdialog.cpp b/tools/assistant/tools/assistant/aboutdialog.cpp index d8fd37c..6afb375 100644 --- a/tools/assistant/tools/assistant/aboutdialog.cpp +++ b/tools/assistant/tools/assistant/aboutdialog.cpp @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include "tracer.h" #include @@ -56,6 +57,7 @@ QT_BEGIN_NAMESPACE AboutLabel::AboutLabel(QWidget *parent) : QTextBrowser(parent) { + TRACE_OBJ setFrameStyle(QFrame::NoFrame); QPalette p; p.setColor(QPalette::Base, p.color(QPalette::Background)); @@ -64,6 +66,7 @@ AboutLabel::AboutLabel(QWidget *parent) void AboutLabel::setText(const QString &text, const QByteArray &resources) { + TRACE_OBJ QDataStream in(resources); in >> m_resourceMap; @@ -72,6 +75,7 @@ void AboutLabel::setText(const QString &text, const QByteArray &resources) QSize AboutLabel::minimumSizeHint() const { + TRACE_OBJ QTextDocument *doc = document(); doc->adjustSize(); return QSize(int(doc->size().width()), int(doc->size().height())); @@ -79,6 +83,7 @@ QSize AboutLabel::minimumSizeHint() const QVariant AboutLabel::loadResource(int type, const QUrl &name) { + TRACE_OBJ if (type == 2 || type == 3) { if (m_resourceMap.contains(name.toString())) { return m_resourceMap.value(name.toString()); @@ -89,6 +94,7 @@ QVariant AboutLabel::loadResource(int type, const QUrl &name) void AboutLabel::setSource(const QUrl &url) { + TRACE_OBJ if (url.isValid() && (url.scheme() == QLatin1String("http") || url.scheme() == QLatin1String("ftp") || url.scheme() == QLatin1String("mailto") || url.path().endsWith(QLatin1String("pdf")))) { @@ -103,6 +109,7 @@ void AboutLabel::setSource(const QUrl &url) AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent, Qt::MSWindowsFixedSizeDialogHint|Qt::WindowTitleHint|Qt::WindowSystemMenuHint) { + TRACE_OBJ m_pixmapLabel = 0; m_aboutLabel = new AboutLabel(); @@ -121,12 +128,14 @@ AboutDialog::AboutDialog(QWidget *parent) void AboutDialog::setText(const QString &text, const QByteArray &resources) { + TRACE_OBJ m_aboutLabel->setText(text, resources); updateSize(); } void AboutDialog::setPixmap(const QPixmap &pixmap) { + TRACE_OBJ if (!m_pixmapLabel) { m_pixmapLabel = new QLabel(); m_layout->addWidget(m_pixmapLabel, 0, 0, 1, -1, Qt::AlignCenter); @@ -137,11 +146,13 @@ void AboutDialog::setPixmap(const QPixmap &pixmap) QString AboutDialog::documentTitle() const { + TRACE_OBJ return m_aboutLabel->documentTitle(); } void AboutDialog::updateSize() { + TRACE_OBJ QSize screenSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size(); int limit = qMin(screenSize.width()/2, 500); diff --git a/tools/assistant/tools/assistant/bookmarkmanager.cpp b/tools/assistant/tools/assistant/bookmarkmanager.cpp index f8cad4d..592c643 100644 --- a/tools/assistant/tools/assistant/bookmarkmanager.cpp +++ b/tools/assistant/tools/assistant/bookmarkmanager.cpp @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include "tracer.h" #include "bookmarkmanager.h" #include "centralwidget.h" @@ -69,6 +70,7 @@ BookmarkDialog::BookmarkDialog(BookmarkManager *manager, const QString &title, , m_title(title) , bookmarkManager(manager) { + TRACE_OBJ installEventFilter(this); ui.setupUi(this); @@ -114,10 +116,12 @@ BookmarkDialog::BookmarkDialog(BookmarkManager *manager, const QString &title, BookmarkDialog::~BookmarkDialog() { + TRACE_OBJ } void BookmarkDialog::addAccepted() { + TRACE_OBJ QItemSelectionModel *model = ui.treeView->selectionModel(); const QModelIndexList &list = model->selection().indexes(); @@ -131,6 +135,7 @@ void BookmarkDialog::addAccepted() void BookmarkDialog::addNewFolder() { + TRACE_OBJ QItemSelectionModel *model = ui.treeView->selectionModel(); const QModelIndexList &list = model->selection().indexes(); @@ -156,6 +161,7 @@ void BookmarkDialog::addNewFolder() void BookmarkDialog::toolButtonClicked() { + TRACE_OBJ bool visible = !ui.treeView->isVisible(); ui.treeView->setVisible(visible); ui.newFolderButton->setVisible(visible); @@ -171,6 +177,7 @@ void BookmarkDialog::toolButtonClicked() void BookmarkDialog::itemChanged(QStandardItem *item) { + TRACE_OBJ if (renameItem != item) { renameItem = item; oldText = item->text(); @@ -191,11 +198,13 @@ void BookmarkDialog::itemChanged(QStandardItem *item) void BookmarkDialog::textChanged(const QString &string) { + TRACE_OBJ ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!string.isEmpty()); } void BookmarkDialog::selectBookmarkFolder(const QString &folderName) { + TRACE_OBJ if (folderName.isEmpty()) return; @@ -219,6 +228,7 @@ void BookmarkDialog::selectBookmarkFolder(const QString &folderName) void BookmarkDialog::customContextMenuRequested(const QPoint &point) { + TRACE_OBJ QModelIndex index = ui.treeView->indexAt(point); if (!index.isValid()) return; @@ -251,6 +261,7 @@ void BookmarkDialog::customContextMenuRequested(const QPoint &point) void BookmarkDialog::renameFolder(const QModelIndex &index, const QModelIndex &proxyIndex) { + TRACE_OBJ const BookmarkModel * const model = bookmarkManager->treeBookmarkModel(); if (QStandardItem *item = model->itemFromIndex(proxyIndex)) { item->setEditable(true); @@ -261,6 +272,7 @@ void BookmarkDialog::renameFolder(const QModelIndex &index, void BookmarkDialog::currentChanged(const QModelIndex ¤t) { + TRACE_OBJ QString text = tr("Bookmarks"); if (current.isValid()) text = current.data().toString(); @@ -269,6 +281,7 @@ void BookmarkDialog::currentChanged(const QModelIndex ¤t) bool BookmarkDialog::eventFilter(QObject *object, QEvent *e) { + TRACE_OBJ if (object == this && e->type() == QEvent::KeyPress) { QKeyEvent *ke = static_cast(e); @@ -316,16 +329,19 @@ BookmarkWidget::BookmarkWidget(BookmarkManager *manager, QWidget *parent, , removeButton(0) , bookmarkManager(manager) { + TRACE_OBJ setup(showButtons); installEventFilter(this); } BookmarkWidget::~BookmarkWidget() { + TRACE_OBJ } void BookmarkWidget::removeClicked() { + TRACE_OBJ const QModelIndex &index = treeView->currentIndex(); if (searchField->text().isEmpty()) { bookmarkManager->removeBookmarkItem(treeView, @@ -335,6 +351,7 @@ void BookmarkWidget::removeClicked() void BookmarkWidget::filterChanged() { + TRACE_OBJ bool searchBookmarks = searchField->text().isEmpty(); if (!searchBookmarks) { regExp.setPattern(searchField->text()); @@ -362,6 +379,7 @@ void BookmarkWidget::filterChanged() void BookmarkWidget::expand(const QModelIndex &index) { + TRACE_OBJ const QModelIndex &source = filterBookmarkModel->mapToSource(index); QStandardItem *item = bookmarkManager->treeBookmarkModel()->itemFromIndex(source); @@ -371,6 +389,7 @@ void BookmarkWidget::expand(const QModelIndex &index) void BookmarkWidget::activated(const QModelIndex &index) { + TRACE_OBJ if (!index.isValid()) return; @@ -381,6 +400,7 @@ void BookmarkWidget::activated(const QModelIndex &index) void BookmarkWidget::customContextMenuRequested(const QPoint &point) { + TRACE_OBJ QModelIndex index = treeView->indexAt(point); if (!index.isValid()) return; @@ -433,6 +453,7 @@ void BookmarkWidget::customContextMenuRequested(const QPoint &point) void BookmarkWidget::setup(bool showButtons) { + TRACE_OBJ regExp.setPatternSyntax(QRegExp::FixedString); regExp.setCaseSensitivity(Qt::CaseInsensitive); @@ -510,6 +531,7 @@ void BookmarkWidget::setup(bool showButtons) void BookmarkWidget::expandItems() { + TRACE_OBJ QStandardItemModel *model = bookmarkManager->treeBookmarkModel(); QListlist = model->findItems(QLatin1String("*"), Qt::MatchWildcard | Qt::MatchRecursive, 0); @@ -522,6 +544,7 @@ void BookmarkWidget::expandItems() void BookmarkWidget::focusInEvent(QFocusEvent *e) { + TRACE_OBJ if (e->reason() != Qt::MouseFocusReason) { searchField->selectAll(); searchField->setFocus(); @@ -535,6 +558,7 @@ void BookmarkWidget::focusInEvent(QFocusEvent *e) bool BookmarkWidget::eventFilter(QObject *object, QEvent *e) { + TRACE_OBJ if ((object == this) || (object == treeView->viewport())) { QModelIndex index = treeView->currentIndex(); if (e->type() == QEvent::KeyPress) { @@ -598,19 +622,23 @@ bool BookmarkWidget::eventFilter(QObject *object, QEvent *e) BookmarkModel::BookmarkModel(int rows, int columns, QObject *parent) : QStandardItemModel(rows, columns, parent) { + TRACE_OBJ } BookmarkModel::~BookmarkModel() { + TRACE_OBJ } Qt::DropActions BookmarkModel::supportedDropActions() const { + TRACE_OBJ return Qt::MoveAction; } Qt::ItemFlags BookmarkModel::flags(const QModelIndex &index) const { + TRACE_OBJ Qt::ItemFlags defaultFlags = QStandardItemModel::flags(index); if ((!index.isValid()) // can only happen for the invisible root item || index.data(Qt::UserRole + 10).toString() == QLatin1String("Folder")) @@ -628,6 +656,7 @@ BookmarkManager::BookmarkManager() , listModel(new BookmarkModel(0, 1, this)) , renameItem(0) { + TRACE_OBJ folderIcon = QApplication::style()->standardIcon(QStyle::SP_DirClosedIcon); bookmarkIcon = QIcon(QLatin1String(":/trolltech/assistant/images/bookmark.png")); @@ -641,22 +670,26 @@ BookmarkManager::BookmarkManager() BookmarkManager::~BookmarkManager() { + TRACE_OBJ treeModel->clear(); listModel->clear(); } BookmarkModel* BookmarkManager::treeBookmarkModel() { + TRACE_OBJ return treeModel; } BookmarkModel* BookmarkManager::listBookmarkModel() { + TRACE_OBJ return listModel; } void BookmarkManager::saveBookmarks() { + TRACE_OBJ QByteArray bookmarks; QDataStream stream(&bookmarks, QIODevice::WriteOnly); @@ -666,6 +699,7 @@ void BookmarkManager::saveBookmarks() QStringList BookmarkManager::bookmarkFolders() const { + TRACE_OBJ QStringList folders(tr("Bookmarks")); QListlist = treeModel->findItems(QLatin1String("*"), @@ -682,6 +716,7 @@ QStringList BookmarkManager::bookmarkFolders() const QModelIndex BookmarkManager::addNewFolder(const QModelIndex &index) { + TRACE_OBJ QStandardItem *item = new QStandardItem(uniqueFolderName()); item->setEditable(false); item->setData(false, Qt::UserRole + 11); @@ -699,6 +734,7 @@ QModelIndex BookmarkManager::addNewFolder(const QModelIndex &index) void BookmarkManager::removeBookmarkItem(QTreeView *treeView, const QModelIndex &index) { + TRACE_OBJ QStandardItem *item = treeModel->itemFromIndex(index); if (item) { QString data = index.data(Qt::UserRole + 10).toString(); @@ -730,6 +766,7 @@ void BookmarkManager::removeBookmarkItem(QTreeView *treeView, void BookmarkManager::showBookmarkDialog(QWidget *parent, const QString &name, const QString &url) { + TRACE_OBJ BookmarkDialog dialog(this, name, url, parent); dialog.exec(); } @@ -737,6 +774,7 @@ void BookmarkManager::showBookmarkDialog(QWidget *parent, const QString &name, void BookmarkManager::addNewBookmark(const QModelIndex &index, const QString &name, const QString &url) { + TRACE_OBJ QStandardItem *item = new QStandardItem(name); item->setEditable(false); item->setIcon(bookmarkIcon); @@ -753,6 +791,7 @@ void BookmarkManager::addNewBookmark(const QModelIndex &index, void BookmarkManager::fillBookmarkMenu(QMenu *menu) { + TRACE_OBJ if (!menu || !treeModel) return; @@ -762,6 +801,7 @@ void BookmarkManager::fillBookmarkMenu(QMenu *menu) void BookmarkManager::fillBookmarkMenu(QMenu *menu, QStandardItem *root) { + TRACE_OBJ for (int i = 0; i < root->rowCount(); ++i) { QStandardItem *item = root->child(i); if (item && item->data(Qt::UserRole + 10) @@ -777,6 +817,7 @@ void BookmarkManager::fillBookmarkMenu(QMenu *menu, QStandardItem *root) QUrl BookmarkManager::urlForAction(QAction* action) const { + TRACE_OBJ if (map.contains(action)) { const QModelIndex &index = map.value(action); if (QStandardItem* item = treeModel->itemFromIndex(index)) @@ -787,6 +828,7 @@ QUrl BookmarkManager::urlForAction(QAction* action) const void BookmarkManager::itemChanged(QStandardItem *item) { + TRACE_OBJ if (renameItem != item) { renameItem = item; oldText = item->text(); @@ -804,6 +846,7 @@ void BookmarkManager::itemChanged(QStandardItem *item) void BookmarkManager::setupBookmarkModels() { + TRACE_OBJ treeModel->clear(); listModel->clear(); @@ -849,6 +892,7 @@ void BookmarkManager::setupBookmarkModels() QString BookmarkManager::uniqueFolderName() const { + TRACE_OBJ QString folderName = tr("New Folder"); QList list = treeModel->findItems(folderName, Qt::MatchContains | Qt::MatchRecursive, 0); @@ -868,6 +912,7 @@ QString BookmarkManager::uniqueFolderName() const void BookmarkManager::removeBookmarkFolderItems(QStandardItem *item) { + TRACE_OBJ for (int j = 0; j < item->rowCount(); ++j) { QStandardItem *child = item->child(j); if (child->rowCount() > 0) @@ -887,6 +932,7 @@ void BookmarkManager::removeBookmarkFolderItems(QStandardItem *item) void BookmarkManager::readBookmarksRecursive(const QStandardItem *item, QDataStream &stream, const qint32 depth) const { + TRACE_OBJ for (int j = 0; j < item->rowCount(); ++j) { const QStandardItem *child = item->child(j); stream << depth; diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp index 7117b76..8343ad1 100644 --- a/tools/assistant/tools/assistant/centralwidget.cpp +++ b/tools/assistant/tools/assistant/centralwidget.cpp @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include "tracer.h" #include "centralwidget.h" #include "helpenginewrapper.h" @@ -91,6 +92,7 @@ FindWidget::FindWidget(QWidget *parent) : QWidget(parent) , appPalette(qApp->palette()) { + TRACE_OBJ QHBoxLayout *hboxLayout = new QHBoxLayout(this); QString resourcePath = QLatin1String(":/trolltech/assistant/images/"); @@ -149,10 +151,12 @@ FindWidget::FindWidget(QWidget *parent) FindWidget::~FindWidget() { + TRACE_OBJ } void FindWidget::hideEvent(QHideEvent* event) { + TRACE_OBJ #if !defined(QT_NO_WEBKIT) // TODO: remove this once webkit supports setting the palette if (!event->spontaneous()) @@ -164,6 +168,7 @@ void FindWidget::hideEvent(QHideEvent* event) void FindWidget::showEvent(QShowEvent* event) { + TRACE_OBJ #if !defined(QT_NO_WEBKIT) // TODO: remove this once webkit supports setting the palette if (!event->spontaneous()) { @@ -181,6 +186,7 @@ void FindWidget::showEvent(QShowEvent* event) void FindWidget::updateButtons() { + TRACE_OBJ if (editFind->text().isEmpty()) { toolPrevious->setEnabled(false); toolNext->setEnabled(false); @@ -192,6 +198,7 @@ void FindWidget::updateButtons() QToolButton* FindWidget::setupToolButton(const QString &text, const QString &icon) { + TRACE_OBJ QToolButton *toolButton = new QToolButton(this); toolButton->setText(text); @@ -216,6 +223,7 @@ CentralWidget::CentralWidget(MainWindow *parent) , usesDefaultCollection(parent->usesDefaultCollection()) , m_searchWidget(0) { + TRACE_OBJ globalActionList.clear(); staticCentralWidget = this; QVBoxLayout *vboxLayout = new QVBoxLayout(this); @@ -287,6 +295,7 @@ CentralWidget::CentralWidget(MainWindow *parent) CentralWidget::~CentralWidget() { + TRACE_OBJ #ifndef QT_NO_PRINTER delete printer; #endif @@ -313,11 +322,13 @@ CentralWidget::~CentralWidget() CentralWidget *CentralWidget::instance() { + TRACE_OBJ return staticCentralWidget; } void CentralWidget::newTab() { + TRACE_OBJ HelpViewer *viewer = currentHelpViewer(); #if !defined(QT_NO_WEBKIT) if (viewer && viewer->hasLoadFinished()) @@ -329,6 +340,7 @@ void CentralWidget::newTab() void CentralWidget::zoomIn() { + TRACE_OBJ HelpViewer *viewer = currentHelpViewer(); if (viewer) viewer->zoomIn(); @@ -339,6 +351,7 @@ void CentralWidget::zoomIn() void CentralWidget::zoomOut() { + TRACE_OBJ HelpViewer *viewer = currentHelpViewer(); if (viewer) viewer->zoomOut(); @@ -349,11 +362,13 @@ void CentralWidget::zoomOut() void CentralWidget::findNext() { + TRACE_OBJ find(findWidget->editFind->text(), true, false); } void CentralWidget::nextPage() { + TRACE_OBJ int index = tabWidget->currentIndex() + 1; if (index >= tabWidget->count()) index = 0; @@ -362,6 +377,7 @@ void CentralWidget::nextPage() void CentralWidget::resetZoom() { + TRACE_OBJ HelpViewer *viewer = currentHelpViewer(); if (viewer) viewer->resetZoom(); @@ -372,6 +388,7 @@ void CentralWidget::resetZoom() void CentralWidget::previousPage() { + TRACE_OBJ int index = tabWidget->currentIndex() -1; if (index < 0) index = tabWidget->count() -1; @@ -380,11 +397,13 @@ void CentralWidget::previousPage() void CentralWidget::findPrevious() { + TRACE_OBJ find(findWidget->editFind->text(), false, true); } void CentralWidget::closeTab() { + TRACE_OBJ HelpViewer *viewer = currentHelpViewer(); if (!viewer|| tabWidget->count() == 1) return; @@ -395,6 +414,7 @@ void CentralWidget::closeTab() void CentralWidget::setSource(const QUrl &url) { + TRACE_OBJ HelpViewer *viewer = currentHelpViewer(); HelpViewer *lastViewer = qobject_cast(tabWidget->widget(lastTabPage)); @@ -418,6 +438,7 @@ void CentralWidget::setSource(const QUrl &url) void CentralWidget::setupWidget() { + TRACE_OBJ HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance(); int option = helpEngine.startOption(); if (option != ShowLastPages) { @@ -434,6 +455,7 @@ void CentralWidget::setupWidget() void CentralWidget::setLastShownPages() { + TRACE_OBJ HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance(); const QStringList lastShownPageList = helpEngine.lastShownPages(); const int pageCount = lastShownPageList.count(); @@ -467,12 +489,14 @@ void CentralWidget::setLastShownPages() bool CentralWidget::hasSelection() const { + TRACE_OBJ const HelpViewer *viewer = currentHelpViewer(); return viewer ? viewer->hasSelection() : false; } QUrl CentralWidget::currentSource() const { + TRACE_OBJ const HelpViewer *viewer = currentHelpViewer(); if (viewer) return viewer->source(); @@ -482,6 +506,7 @@ QUrl CentralWidget::currentSource() const QString CentralWidget::currentTitle() const { + TRACE_OBJ const HelpViewer *viewer = currentHelpViewer(); if (viewer) return viewer->documentTitle(); @@ -491,6 +516,7 @@ QString CentralWidget::currentTitle() const void CentralWidget::copySelection() { + TRACE_OBJ HelpViewer *viewer = currentHelpViewer(); if (viewer) viewer->copy(); @@ -498,6 +524,7 @@ void CentralWidget::copySelection() void CentralWidget::showTextSearch() { + TRACE_OBJ findBar->show(); findWidget->editFind->selectAll(); findWidget->editFind->setFocus(Qt::ShortcutFocusReason); @@ -505,6 +532,7 @@ void CentralWidget::showTextSearch() void CentralWidget::initPrinter() { + TRACE_OBJ #ifndef QT_NO_PRINTER if (!printer) printer = new QPrinter(QPrinter::HighResolution); @@ -513,6 +541,7 @@ void CentralWidget::initPrinter() void CentralWidget::print() { + TRACE_OBJ #ifndef QT_NO_PRINTER HelpViewer *viewer = currentHelpViewer(); if (!viewer) @@ -536,6 +565,7 @@ void CentralWidget::print() void CentralWidget::printPreview() { + TRACE_OBJ #ifndef QT_NO_PRINTER initPrinter(); QPrintPreviewDialog preview(printer, this); @@ -547,6 +577,7 @@ void CentralWidget::printPreview() void CentralWidget::printPreview(QPrinter *p) { + TRACE_OBJ #ifndef QT_NO_PRINTER HelpViewer *viewer = currentHelpViewer(); if (viewer) @@ -556,6 +587,7 @@ void CentralWidget::printPreview(QPrinter *p) void CentralWidget::pageSetup() { + TRACE_OBJ #ifndef QT_NO_PRINTER initPrinter(); QPageSetupDialog dlg(printer); @@ -565,11 +597,13 @@ void CentralWidget::pageSetup() bool CentralWidget::isHomeAvailable() const { + TRACE_OBJ return currentHelpViewer() ? true : false; } void CentralWidget::home() { + TRACE_OBJ HelpViewer *viewer = currentHelpViewer(); if (viewer) viewer->home(); @@ -577,6 +611,7 @@ void CentralWidget::home() bool CentralWidget::isForwardAvailable() const { + TRACE_OBJ const HelpViewer *viewer = currentHelpViewer(); if (viewer) return viewer->isForwardAvailable(); @@ -586,6 +621,7 @@ bool CentralWidget::isForwardAvailable() const void CentralWidget::forward() { + TRACE_OBJ HelpViewer *viewer = currentHelpViewer(); if (viewer) viewer->forward(); @@ -593,6 +629,7 @@ void CentralWidget::forward() bool CentralWidget::isBackwardAvailable() const { + TRACE_OBJ const HelpViewer *viewer = currentHelpViewer(); if (viewer) return viewer->isBackwardAvailable(); @@ -602,6 +639,7 @@ bool CentralWidget::isBackwardAvailable() const void CentralWidget::backward() { + TRACE_OBJ HelpViewer *viewer = currentHelpViewer(); if (viewer) viewer->backward(); @@ -610,16 +648,19 @@ void CentralWidget::backward() QList CentralWidget::globalActions() const { + TRACE_OBJ return globalActionList; } void CentralWidget::setGlobalActions(const QList &actions) { + TRACE_OBJ globalActionList = actions; } void CentralWidget::setSourceInNewTab(const QUrl &url, qreal zoom) { + TRACE_OBJ HelpViewer *viewer; #if defined(QT_NO_WEBKIT) @@ -652,6 +693,7 @@ void CentralWidget::setSourceInNewTab(const QUrl &url, qreal zoom) HelpViewer *CentralWidget::newEmptyTab() { + TRACE_OBJ HelpViewer *viewer = new HelpViewer(this); viewer->installEventFilter(this); viewer->setFocus(Qt::OtherFocusReason); @@ -666,11 +708,13 @@ HelpViewer *CentralWidget::newEmptyTab() void CentralWidget::findCurrentText(const QString &text) { + TRACE_OBJ find(text, false, false); } void CentralWidget::connectSignals() { + TRACE_OBJ const HelpViewer *viewer = currentHelpViewer(); if (viewer) { connect(viewer, SIGNAL(copyAvailable(bool)), this, @@ -690,11 +734,13 @@ void CentralWidget::connectSignals() HelpViewer *CentralWidget::currentHelpViewer() const { + TRACE_OBJ return qobject_cast(tabWidget->currentWidget()); } void CentralWidget::activateTab(bool onlyHelpViewer) { + TRACE_OBJ if (currentHelpViewer()) { currentHelpViewer()->setFocus(); } else { @@ -708,6 +754,7 @@ void CentralWidget::activateTab(bool onlyHelpViewer) void CentralWidget::setTabTitle(const QUrl &url) { + TRACE_OBJ Q_UNUSED(url) #if !defined(QT_NO_WEBKIT) QTabBar *tabBar = qFindChild(tabWidget); @@ -729,6 +776,7 @@ void CentralWidget::setTabTitle(const QUrl &url) void CentralWidget::currentPageChanged(int index) { + TRACE_OBJ const HelpViewer *viewer = currentHelpViewer(); if (viewer) lastTabPage = index; @@ -744,6 +792,7 @@ void CentralWidget::currentPageChanged(int index) void CentralWidget::showTabBarContextMenu(const QPoint &point) { + TRACE_OBJ HelpViewer *viewer = helpViewerFromTabPosition(tabWidget, point); if (!viewer) return; @@ -796,6 +845,7 @@ void CentralWidget::showTabBarContextMenu(const QPoint &point) bool CentralWidget::eventFilter(QObject *object, QEvent *e) { + TRACE_OBJ if (e->type() == QEvent::KeyPress) { QKeyEvent *ke = static_cast(e); switch (ke->key()) { @@ -851,6 +901,7 @@ bool CentralWidget::eventFilter(QObject *object, QEvent *e) void CentralWidget::keyPressEvent(QKeyEvent *e) { + TRACE_OBJ const QString &text = e->text(); if (text.startsWith(QLatin1Char('/'))) { if (!findBar->isVisible()) { @@ -867,6 +918,7 @@ void CentralWidget::keyPressEvent(QKeyEvent *e) void CentralWidget::find(const QString &ttf, bool forward, bool backward) { + TRACE_OBJ QPalette p = findWidget->editFind->palette(); p.setColor(QPalette::Active, QPalette::Base, Qt::white); @@ -915,6 +967,7 @@ void CentralWidget::find(const QString &ttf, bool forward, bool backward) bool CentralWidget::findInTextBrowser(QTextBrowser* browser, const QString &ttf, bool forward, bool backward) { + TRACE_OBJ if (!browser) return false; @@ -962,6 +1015,7 @@ bool CentralWidget::findInTextBrowser(QTextBrowser* browser, const QString &ttf, void CentralWidget::updateBrowserFont() { + TRACE_OBJ QFont font; bool searchAttached = searchWidgetAttached(); if (searchAttached) { @@ -977,6 +1031,7 @@ void CentralWidget::updateBrowserFont() void CentralWidget::createSearchWidget(QHelpSearchEngine *searchEngine) { + TRACE_OBJ if (m_searchWidget) return; @@ -993,6 +1048,7 @@ void CentralWidget::createSearchWidget(QHelpSearchEngine *searchEngine) void CentralWidget::activateSearchWidget(bool updateLastTabPage) { + TRACE_OBJ if (!m_searchWidget) createSearchWidget(HelpEngineWrapper::instance().searchEngine()); @@ -1010,6 +1066,7 @@ void CentralWidget::activateSearchWidget(bool updateLastTabPage) void CentralWidget::removeSearchWidget() { + TRACE_OBJ if (searchWidgetAttached()) { tabWidget->removeTab(0); m_searchWidget->setAttached(false); @@ -1018,6 +1075,7 @@ void CentralWidget::removeSearchWidget() int CentralWidget::availableHelpViewer() const { + TRACE_OBJ int count = tabWidget->count(); if (searchWidgetAttached()) count--; @@ -1026,6 +1084,7 @@ int CentralWidget::availableHelpViewer() const bool CentralWidget::enableTabCloseAction() const { + TRACE_OBJ int minTabCount = 1; if (searchWidgetAttached()) minTabCount = 2; @@ -1035,6 +1094,7 @@ bool CentralWidget::enableTabCloseAction() const QString CentralWidget::quoteTabTitle(const QString &title) const { + TRACE_OBJ QString s = title; return s.replace(QLatin1Char('&'), QLatin1String("&&")); } @@ -1042,6 +1102,7 @@ QString CentralWidget::quoteTabTitle(const QString &title) const void CentralWidget::setSourceFromSearch(const QUrl &url) { + TRACE_OBJ setSource(url); highlightSearchTerms(); } @@ -1049,6 +1110,7 @@ CentralWidget::setSourceFromSearch(const QUrl &url) void CentralWidget::setSourceFromSearchInNewTab(const QUrl &url) { + TRACE_OBJ setSourceInNewTab(url); highlightSearchTerms(); } @@ -1056,6 +1118,7 @@ CentralWidget::setSourceFromSearchInNewTab(const QUrl &url) void CentralWidget::highlightSearchTerms() { + TRACE_OBJ #if defined(QT_NO_WEBKIT) HelpViewer *viewer = currentHelpViewer(); if (!viewer) @@ -1116,6 +1179,7 @@ CentralWidget::highlightSearchTerms() void CentralWidget::closeTabs(const QList &indices) { + TRACE_OBJ QList sortedIndices = indices; qSort(sortedIndices); for (int i = sortedIndices.count(); --i >= 0;) @@ -1126,6 +1190,7 @@ void CentralWidget::closeTabs(const QList &indices) void CentralWidget::closeTabAt(int index) { + TRACE_OBJ HelpViewer *viewer = qobject_cast(tabWidget->widget(index)); tabWidget->removeTab(index); QTimer::singleShot(0, viewer, SLOT(deleteLater())); @@ -1133,6 +1198,7 @@ void CentralWidget::closeTabAt(int index) QMap CentralWidget::currentSourceFileList() const { + TRACE_OBJ QMap sourceList; for (int i = 1; i < tabWidget->count(); ++i) { HelpViewer *viewer = qobject_cast(tabWidget->widget(i)); @@ -1144,6 +1210,7 @@ QMap CentralWidget::currentSourceFileList() const void CentralWidget::getBrowserFontFor(QWidget *viewer, QFont *font) { + TRACE_OBJ HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance(); if (!helpEngine.usesBrowserFont()) { *font = qApp->font(); // case for QTextBrowser and SearchWidget @@ -1162,6 +1229,7 @@ void CentralWidget::getBrowserFontFor(QWidget *viewer, QFont *font) void CentralWidget::setBrowserFontFor(QWidget *widget, const QFont &font) { + TRACE_OBJ #if !defined(QT_NO_WEBKIT) QWebView *view = qobject_cast (widget); if (view) { diff --git a/tools/assistant/tools/assistant/cmdlineparser.cpp b/tools/assistant/tools/assistant/cmdlineparser.cpp index b17909c..733e2ff 100644 --- a/tools/assistant/tools/assistant/cmdlineparser.cpp +++ b/tools/assistant/tools/assistant/cmdlineparser.cpp @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include "tracer.h" #include #include @@ -88,6 +89,7 @@ CmdLineParser::CmdLineParser(const QStringList &arguments) m_removeSearchIndex(false), m_quiet(false) { + TRACE_OBJ for (int i = 1; i < arguments.count(); ++i) { const QString &arg = arguments.at(i); if (arg.toLower() == "-quiet") @@ -99,6 +101,7 @@ CmdLineParser::CmdLineParser(const QStringList &arguments) CmdLineParser::Result CmdLineParser::parse() { + TRACE_OBJ bool showHelp = false; while (m_error.isEmpty() && hasMoreArgs()) { @@ -141,17 +144,20 @@ CmdLineParser::Result CmdLineParser::parse() bool CmdLineParser::hasMoreArgs() const { + TRACE_OBJ return m_pos < m_arguments.count(); } const QString &CmdLineParser::nextArg() { + TRACE_OBJ Q_ASSERT(hasMoreArgs()); return m_arguments.at(m_pos++); } void CmdLineParser::handleCollectionFileOption() { + TRACE_OBJ if (hasMoreArgs()) { const QString &fileName = nextArg(); m_collectionFile = getFileName(fileName); @@ -165,6 +171,7 @@ void CmdLineParser::handleCollectionFileOption() void CmdLineParser::handleShowUrlOption() { + TRACE_OBJ if (hasMoreArgs()) { const QString &urlString = nextArg(); QUrl url(urlString); @@ -179,21 +186,25 @@ void CmdLineParser::handleShowUrlOption() void CmdLineParser::handleShowOption() { + TRACE_OBJ handleShowOrHideOrActivateOption(Show); } void CmdLineParser::handleHideOption() { + TRACE_OBJ handleShowOrHideOrActivateOption(Hide); } void CmdLineParser::handleActivateOption() { + TRACE_OBJ handleShowOrHideOrActivateOption(Activate); } void CmdLineParser::handleShowOrHideOrActivateOption(ShowState state) { + TRACE_OBJ if (hasMoreArgs()) { const QString &widget = nextArg().toLower(); if (widget == QLatin1String("contents")) @@ -213,16 +224,19 @@ void CmdLineParser::handleShowOrHideOrActivateOption(ShowState state) void CmdLineParser::handleRegisterOption() { + TRACE_OBJ handleRegisterOrUnregisterOption(Register); } void CmdLineParser::handleUnregisterOption() { + TRACE_OBJ handleRegisterOrUnregisterOption(Unregister); } void CmdLineParser::handleRegisterOrUnregisterOption(RegisterState state) { + TRACE_OBJ if (hasMoreArgs()) { const QString &fileName = nextArg(); m_helpFile = getFileName(fileName); @@ -237,6 +251,7 @@ void CmdLineParser::handleRegisterOrUnregisterOption(RegisterState state) void CmdLineParser::handleSetCurrentFilterOption() { + TRACE_OBJ if (hasMoreArgs()) m_currentFilter = nextArg(); else @@ -245,6 +260,7 @@ void CmdLineParser::handleSetCurrentFilterOption() QString CmdLineParser::getFileName(const QString &fileName) { + TRACE_OBJ QFileInfo fi(fileName); if (!fi.exists()) return QString(); @@ -253,6 +269,7 @@ QString CmdLineParser::getFileName(const QString &fileName) void CmdLineParser::showMessage(const QString &msg, bool error) { + TRACE_OBJ if (m_quiet) return; #ifdef Q_OS_WIN @@ -268,61 +285,73 @@ void CmdLineParser::showMessage(const QString &msg, bool error) void CmdLineParser::setCollectionFile(const QString &file) { + TRACE_OBJ m_collectionFile = file; } QString CmdLineParser::collectionFile() const { + TRACE_OBJ return m_collectionFile; } QUrl CmdLineParser::url() const { + TRACE_OBJ return m_url; } bool CmdLineParser::enableRemoteControl() const { + TRACE_OBJ return m_enableRemoteControl; } CmdLineParser::ShowState CmdLineParser::contents() const { + TRACE_OBJ return m_contents; } CmdLineParser::ShowState CmdLineParser::index() const { + TRACE_OBJ return m_index; } CmdLineParser::ShowState CmdLineParser::bookmarks() const { + TRACE_OBJ return m_bookmarks; } CmdLineParser::ShowState CmdLineParser::search() const { + TRACE_OBJ return m_search; } QString CmdLineParser::currentFilter() const { + TRACE_OBJ return m_currentFilter; } bool CmdLineParser::removeSearchIndex() const { + TRACE_OBJ return m_removeSearchIndex; } CmdLineParser::RegisterState CmdLineParser::registerRequest() const { + TRACE_OBJ return m_register; } QString CmdLineParser::helpFile() const { + TRACE_OBJ return m_helpFile; } diff --git a/tools/assistant/tools/assistant/contentwindow.cpp b/tools/assistant/tools/assistant/contentwindow.cpp index 17b19ba..d93040a 100644 --- a/tools/assistant/tools/assistant/contentwindow.cpp +++ b/tools/assistant/tools/assistant/contentwindow.cpp @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include "tracer.h" #include "contentwindow.h" #include "centralwidget.h" @@ -55,6 +56,7 @@ ContentWindow::ContentWindow() : m_contentWidget(HelpEngineWrapper::instance().contentWidget()) , m_expandDepth(-2) { + TRACE_OBJ m_contentWidget->viewport()->installEventFilter(this); m_contentWidget->setContextMenuPolicy(Qt::CustomContextMenu); @@ -74,10 +76,12 @@ ContentWindow::ContentWindow() ContentWindow::~ContentWindow() { + TRACE_OBJ } bool ContentWindow::syncToContent(const QUrl& url) { + TRACE_OBJ QModelIndex idx = m_contentWidget->indexOf(url); if (!idx.isValid()) return false; @@ -87,6 +91,7 @@ bool ContentWindow::syncToContent(const QUrl& url) void ContentWindow::expandTOC() { + TRACE_OBJ Q_ASSERT(m_expandDepth >= -2); if (m_expandDepth > -2) { expandToDepth(m_expandDepth); @@ -96,6 +101,7 @@ void ContentWindow::expandTOC() void ContentWindow::expandToDepth(int depth) { + TRACE_OBJ Q_ASSERT(depth >= -2); m_expandDepth = depth; if (depth == -1) @@ -108,18 +114,21 @@ void ContentWindow::expandToDepth(int depth) void ContentWindow::focusInEvent(QFocusEvent *e) { + TRACE_OBJ if (e->reason() != Qt::MouseFocusReason) m_contentWidget->setFocus(); } void ContentWindow::keyPressEvent(QKeyEvent *e) { + TRACE_OBJ if (e->key() == Qt::Key_Escape) emit escapePressed(); } bool ContentWindow::eventFilter(QObject *o, QEvent *e) { + TRACE_OBJ if (m_contentWidget && o == m_contentWidget->viewport() && e->type() == QEvent::MouseButtonRelease) { QMouseEvent *me = static_cast(e); @@ -148,6 +157,7 @@ bool ContentWindow::eventFilter(QObject *o, QEvent *e) void ContentWindow::showContextMenu(const QPoint &pos) { + TRACE_OBJ if (!m_contentWidget->indexAt(pos).isValid()) return; @@ -173,6 +183,7 @@ void ContentWindow::showContextMenu(const QPoint &pos) void ContentWindow::itemClicked(const QModelIndex &index) { + TRACE_OBJ QHelpContentModel *contentModel = qobject_cast(m_contentWidget->model()); @@ -185,6 +196,7 @@ void ContentWindow::itemClicked(const QModelIndex &index) bool ContentWindow::isPdfFile(QHelpContentItem *item) const { + TRACE_OBJ const QString &path = item->url().path(); return path.endsWith(QLatin1String(".pdf"), Qt::CaseInsensitive); } diff --git a/tools/assistant/tools/assistant/filternamedialog.cpp b/tools/assistant/tools/assistant/filternamedialog.cpp index 781171e..27b7baf 100644 --- a/tools/assistant/tools/assistant/filternamedialog.cpp +++ b/tools/assistant/tools/assistant/filternamedialog.cpp @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include "tracer.h" #include @@ -48,6 +49,7 @@ QT_BEGIN_NAMESPACE FilterNameDialog::FilterNameDialog(QWidget *parent) : QDialog(parent) { + TRACE_OBJ m_ui.setupUi(this); connect(m_ui.buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(accept())); @@ -61,11 +63,13 @@ FilterNameDialog::FilterNameDialog(QWidget *parent) QString FilterNameDialog::filterName() const { + TRACE_OBJ return m_ui.lineEdit->text(); } void FilterNameDialog::updateOkButton() { + TRACE_OBJ m_ui.buttonBox->button(QDialogButtonBox::Ok) ->setDisabled(m_ui.lineEdit->text().isEmpty()); } diff --git a/tools/assistant/tools/assistant/helpenginewrapper.cpp b/tools/assistant/tools/assistant/helpenginewrapper.cpp index 3835a63..899954c 100644 --- a/tools/assistant/tools/assistant/helpenginewrapper.cpp +++ b/tools/assistant/tools/assistant/helpenginewrapper.cpp @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include "tracer.h" #include "helpenginewrapper.h" #include "../shared/collectionconfiguration.h" @@ -73,6 +74,7 @@ HelpEngineWrapper *HelpEngineWrapper::helpEngineWrapper = 0; HelpEngineWrapper &HelpEngineWrapper::instance(const QString &collectionFile) { + TRACE_OBJ /* * Note that this Singleton cannot be static, because it has to be * deleted before the QApplication. @@ -84,6 +86,7 @@ HelpEngineWrapper &HelpEngineWrapper::instance(const QString &collectionFile) void HelpEngineWrapper::removeInstance() { + TRACE_OBJ delete helpEngineWrapper; helpEngineWrapper = 0; } @@ -92,6 +95,7 @@ HelpEngineWrapper::HelpEngineWrapper(const QString &collectionFile) : m_helpEngine(new QHelpEngine(collectionFile, this)), m_qchWatcher(new QFileSystemWatcher(this)) { + TRACE_OBJ connect(m_helpEngine, SIGNAL(currentFilterChanged(QString)), this, SIGNAL(currentFilterChanged(QString))); connect(m_helpEngine, SIGNAL(setupFinished()), @@ -101,6 +105,7 @@ HelpEngineWrapper::HelpEngineWrapper(const QString &collectionFile) void HelpEngineWrapper::initFileSystemWatchers() { + TRACE_OBJ foreach(const QString &ns, m_helpEngine->registeredDocumentations()) { const QString &docFile = m_helpEngine->documentationFileName(ns); m_qchWatcher->addPath(docFile); @@ -112,41 +117,49 @@ void HelpEngineWrapper::initFileSystemWatchers() QHelpSearchEngine *HelpEngineWrapper::searchEngine() const { + TRACE_OBJ return m_helpEngine->searchEngine(); } QHelpContentModel *HelpEngineWrapper::contentModel() const { + TRACE_OBJ return m_helpEngine->contentModel(); } QHelpIndexModel *HelpEngineWrapper::indexModel() const { + TRACE_OBJ return m_helpEngine->indexModel(); } QHelpContentWidget *HelpEngineWrapper::contentWidget() { + TRACE_OBJ return m_helpEngine->contentWidget(); } QHelpIndexWidget *HelpEngineWrapper::indexWidget() { + TRACE_OBJ return m_helpEngine->indexWidget(); } const QStringList HelpEngineWrapper::registeredDocumentations() const { + TRACE_OBJ return m_helpEngine->registeredDocumentations(); } const QString HelpEngineWrapper::collectionFile() const { + TRACE_OBJ return m_helpEngine->collectionFile(); } bool HelpEngineWrapper::registerDocumentation(const QString &docFile) { + TRACE_OBJ assertDocFilesWatched(); if (!m_helpEngine->registerDocumentation(docFile)) return false; @@ -157,6 +170,7 @@ bool HelpEngineWrapper::registerDocumentation(const QString &docFile) bool HelpEngineWrapper::unregisterDocumentation(const QString &namespaceName) { + TRACE_OBJ assertDocFilesWatched(); const QString &file = m_helpEngine->documentationFileName(namespaceName); if (!m_helpEngine->unregisterDocumentation(namespaceName)) @@ -168,77 +182,92 @@ bool HelpEngineWrapper::unregisterDocumentation(const QString &namespaceName) bool HelpEngineWrapper::setupData() { + TRACE_OBJ return m_helpEngine->setupData(); } bool HelpEngineWrapper::addCustomFilter(const QString &filterName, const QStringList &attributes) { + TRACE_OBJ return m_helpEngine->addCustomFilter(filterName, attributes); } bool HelpEngineWrapper::removeCustomFilter(const QString &filterName) { + TRACE_OBJ return m_helpEngine->removeCustomFilter(filterName); } void HelpEngineWrapper::setCurrentFilter(const QString ¤tFilter) { + TRACE_OBJ m_helpEngine->setCurrentFilter(currentFilter); } const QString HelpEngineWrapper::currentFilter() const { + TRACE_OBJ return m_helpEngine->currentFilter(); } const QStringList HelpEngineWrapper::customFilters() const { + TRACE_OBJ return m_helpEngine->customFilters(); } QUrl HelpEngineWrapper::findFile(const QUrl &url) const { + TRACE_OBJ return m_helpEngine->findFile(url); } QByteArray HelpEngineWrapper::fileData(const QUrl &url) const { + TRACE_OBJ return m_helpEngine->fileData(url); } QMap HelpEngineWrapper::linksForIdentifier(const QString &id) const { + TRACE_OBJ return m_helpEngine->linksForIdentifier(id); } const QStringList HelpEngineWrapper::filterAttributes() const { + TRACE_OBJ return m_helpEngine->filterAttributes(); } const QStringList HelpEngineWrapper::filterAttributes(const QString &filterName) const { + TRACE_OBJ return m_helpEngine->filterAttributes(filterName); } QString HelpEngineWrapper::error() const { + TRACE_OBJ return m_helpEngine->error(); } bool HelpEngineWrapper::unfilteredInserted() const { + TRACE_OBJ return m_helpEngine->customValue(UnfilteredInsertedKey).toInt() == 1; } void HelpEngineWrapper::setUnfilteredInserted() { + TRACE_OBJ m_helpEngine->setCustomValue(UnfilteredInsertedKey, 1); } const QStringList HelpEngineWrapper::qtDocInfo(const QString &component) const { + TRACE_OBJ return m_helpEngine->customValue(VersionKey.arg(component)).toString(). split(CollectionConfiguration::ListSeparator); } @@ -246,221 +275,264 @@ const QStringList HelpEngineWrapper::qtDocInfo(const QString &component) const void HelpEngineWrapper::setQtDocInfo(const QString &component, const QStringList &doc) { + TRACE_OBJ m_helpEngine->setCustomValue(VersionKey.arg(component), doc.join(CollectionConfiguration::ListSeparator)); } const QStringList HelpEngineWrapper::lastShownPages() const { + TRACE_OBJ return CollectionConfiguration::lastShownPages(*m_helpEngine); } void HelpEngineWrapper::setLastShownPages(const QStringList &lastShownPages) { + TRACE_OBJ CollectionConfiguration::setLastShownPages(*m_helpEngine, lastShownPages); } const QStringList HelpEngineWrapper::lastZoomFactors() const { + TRACE_OBJ return CollectionConfiguration::lastZoomFactors(*m_helpEngine); } void HelpEngineWrapper::setLastZoomFactors(const QStringList &lastZoomFactors) { + TRACE_OBJ CollectionConfiguration::setLastZoomFactors(*m_helpEngine, lastZoomFactors); } const QString HelpEngineWrapper::cacheDir() const { + TRACE_OBJ return CollectionConfiguration::cacheDir(*m_helpEngine); } bool HelpEngineWrapper::cacheDirIsRelativeToCollection() const { + TRACE_OBJ return CollectionConfiguration::cacheDirIsRelativeToCollection(*m_helpEngine); } void HelpEngineWrapper::setCacheDir(const QString &cacheDir, bool relativeToCollection) { + TRACE_OBJ CollectionConfiguration::setCacheDir(*m_helpEngine, cacheDir, relativeToCollection); } bool HelpEngineWrapper::filterFunctionalityEnabled() const { + TRACE_OBJ return CollectionConfiguration::filterFunctionalityEnabled(*m_helpEngine); } void HelpEngineWrapper::setFilterFunctionalityEnabled(bool enabled) { + TRACE_OBJ CollectionConfiguration::setFilterFunctionalityEnabled(*m_helpEngine, enabled); } bool HelpEngineWrapper::filterToolbarVisible() const { + TRACE_OBJ return CollectionConfiguration::filterToolbarVisible(*m_helpEngine); } void HelpEngineWrapper::setFilterToolbarVisible(bool visible) { + TRACE_OBJ CollectionConfiguration::setFilterToolbarVisible(*m_helpEngine, visible); } bool HelpEngineWrapper::addressBarEnabled() const { + TRACE_OBJ return CollectionConfiguration::addressBarEnabled(*m_helpEngine); } void HelpEngineWrapper::setAddressBarEnabled(bool enabled) { + TRACE_OBJ CollectionConfiguration::setAddressBarEnabled(*m_helpEngine, enabled); } bool HelpEngineWrapper::addressBarVisible() const { + TRACE_OBJ return CollectionConfiguration::addressBarVisible(*m_helpEngine); } void HelpEngineWrapper::setAddressBarVisible(bool visible) { + TRACE_OBJ CollectionConfiguration::setAddressBarVisible(*m_helpEngine, visible); } bool HelpEngineWrapper::documentationManagerEnabled() const { + TRACE_OBJ return CollectionConfiguration::documentationManagerEnabled(*m_helpEngine); } void HelpEngineWrapper::setDocumentationManagerEnabled(bool enabled) { + TRACE_OBJ CollectionConfiguration::setDocumentationManagerEnabled(*m_helpEngine, enabled); } const QByteArray HelpEngineWrapper::aboutMenuTexts() const { + TRACE_OBJ return CollectionConfiguration::aboutMenuTexts(*m_helpEngine); } void HelpEngineWrapper::setAboutMenuTexts(const QByteArray &texts) { + TRACE_OBJ CollectionConfiguration::setAboutMenuTexts(*m_helpEngine, texts); } const QByteArray HelpEngineWrapper::aboutIcon() const { + TRACE_OBJ return CollectionConfiguration::aboutIcon(*m_helpEngine); } void HelpEngineWrapper::setAboutIcon(const QByteArray &icon) { + TRACE_OBJ CollectionConfiguration::setAboutIcon(*m_helpEngine, icon); } const QByteArray HelpEngineWrapper::aboutImages() const { + TRACE_OBJ return CollectionConfiguration::aboutImages(*m_helpEngine); } void HelpEngineWrapper::setAboutImages(const QByteArray &images) { + TRACE_OBJ CollectionConfiguration::setAboutImages(*m_helpEngine, images); } const QByteArray HelpEngineWrapper::aboutTexts() const { + TRACE_OBJ return CollectionConfiguration::aboutTexts(*m_helpEngine); } void HelpEngineWrapper::setAboutTexts(const QByteArray &texts) { + TRACE_OBJ CollectionConfiguration::setAboutTexts(*m_helpEngine, texts); } const QString HelpEngineWrapper::windowTitle() const { + TRACE_OBJ return CollectionConfiguration::windowTitle(*m_helpEngine); } void HelpEngineWrapper::setWindowTitle(const QString &windowTitle) { + TRACE_OBJ CollectionConfiguration::setWindowTitle(*m_helpEngine, windowTitle); } const QByteArray HelpEngineWrapper::applicationIcon() const { + TRACE_OBJ return CollectionConfiguration::applicationIcon(*m_helpEngine); } void HelpEngineWrapper::setApplicationIcon(const QByteArray &icon) { + TRACE_OBJ CollectionConfiguration::setApplicationIcon(*m_helpEngine, icon); } const QByteArray HelpEngineWrapper::mainWindow() const { + TRACE_OBJ return m_helpEngine->customValue(MainWindowKey).toByteArray(); } void HelpEngineWrapper::setMainWindow(const QByteArray &mainWindow) { + TRACE_OBJ m_helpEngine->setCustomValue(MainWindowKey, mainWindow); } const QByteArray HelpEngineWrapper::mainWindowGeometry() const { + TRACE_OBJ return m_helpEngine->customValue(MainWindowGeometryKey).toByteArray(); } void HelpEngineWrapper::setMainWindowGeometry(const QByteArray &geometry) { + TRACE_OBJ m_helpEngine->setCustomValue(MainWindowGeometryKey, geometry); } const QByteArray HelpEngineWrapper::bookmarks() const { + TRACE_OBJ return m_helpEngine->customValue(BookmarksKey).toByteArray(); } void HelpEngineWrapper::setBookmarks(const QByteArray &bookmarks) { + TRACE_OBJ m_helpEngine->setCustomValue(BookmarksKey, bookmarks); } int HelpEngineWrapper::lastTabPage() const { + TRACE_OBJ return CollectionConfiguration::lastTabPage(*m_helpEngine); } void HelpEngineWrapper::setLastTabPage(int lastPage) { + TRACE_OBJ CollectionConfiguration::setLastTabPage(*m_helpEngine, lastPage); } bool HelpEngineWrapper::searchWasAttached() const { + TRACE_OBJ return m_helpEngine->customValue(SearchWasAttachedKey).toBool(); } void HelpEngineWrapper::setSearchWasAttached(bool attached) { + TRACE_OBJ m_helpEngine->setCustomValue(SearchWasAttachedKey, attached); } int HelpEngineWrapper::startOption() const { + TRACE_OBJ return m_helpEngine->customValue(StartOptionKey, ShowLastPages).toInt(); } void HelpEngineWrapper::setStartOption(int option) { + TRACE_OBJ m_helpEngine->setCustomValue(StartOptionKey, option); } const QString HelpEngineWrapper::homePage() const { + TRACE_OBJ const QString &homePage = m_helpEngine->customValue(HomePageKey).toString(); if (!homePage.isEmpty()) return homePage; @@ -469,96 +541,114 @@ const QString HelpEngineWrapper::homePage() const void HelpEngineWrapper::setHomePage(const QString &page) { + TRACE_OBJ m_helpEngine->setCustomValue(HomePageKey, page); } const QString HelpEngineWrapper::defaultHomePage() const { + TRACE_OBJ return CollectionConfiguration::defaultHomePage(*m_helpEngine); } void HelpEngineWrapper::setDefaultHomePage(const QString &page) { + TRACE_OBJ CollectionConfiguration::setDefaultHomePage(*m_helpEngine, page); } bool HelpEngineWrapper::hasFontSettings() const { + TRACE_OBJ return m_helpEngine->customValue(UseAppFontKey).isValid(); } bool HelpEngineWrapper::usesAppFont() const { + TRACE_OBJ return m_helpEngine->customValue(UseAppFontKey).toBool(); } void HelpEngineWrapper::setUseAppFont(bool useAppFont) { + TRACE_OBJ m_helpEngine->setCustomValue(UseAppFontKey, useAppFont); } bool HelpEngineWrapper::usesBrowserFont() const { + TRACE_OBJ return m_helpEngine->customValue(UseBrowserFontKey, false).toBool(); } void HelpEngineWrapper::setUseBrowserFont(bool useBrowserFont) { + TRACE_OBJ m_helpEngine->setCustomValue(UseBrowserFontKey, useBrowserFont); } const QFont HelpEngineWrapper::appFont() const { + TRACE_OBJ return qVariantValue(m_helpEngine->customValue(AppFontKey)); } void HelpEngineWrapper::setAppFont(const QFont &font) { + TRACE_OBJ m_helpEngine->setCustomValue(AppFontKey, font); } QFontDatabase::WritingSystem HelpEngineWrapper::appWritingSystem() const { + TRACE_OBJ return static_cast( m_helpEngine->customValue(AppWritingSystemKey).toInt()); } void HelpEngineWrapper::setAppWritingSystem(QFontDatabase::WritingSystem system) { + TRACE_OBJ m_helpEngine->setCustomValue(AppWritingSystemKey, system); } const QFont HelpEngineWrapper::browserFont() const { + TRACE_OBJ return qVariantValue(m_helpEngine->customValue(BrowserFontKey)); } void HelpEngineWrapper::setBrowserFont(const QFont &font) { + TRACE_OBJ m_helpEngine->setCustomValue(BrowserFontKey, font); } QFontDatabase::WritingSystem HelpEngineWrapper::browserWritingSystem() const { + TRACE_OBJ return static_cast( m_helpEngine->customValue(BrowserWritingSystemKey).toInt()); } void HelpEngineWrapper::setBrowserWritingSystem(QFontDatabase::WritingSystem system) { + TRACE_OBJ m_helpEngine->setCustomValue(BrowserWritingSystemKey, system); } void HelpEngineWrapper::assertDocFilesWatched() { + TRACE_OBJ Q_ASSERT(m_qchWatcher->files().count() == m_helpEngine->registeredDocumentations().count()); } void HelpEngineWrapper::qchFileChanged(const QString &fileName) { + TRACE_OBJ /* * We don't use QHelpEngineCore::namespaceName(fileName), because the file * may not exist anymore or contain a different namespace. diff --git a/tools/assistant/tools/assistant/helpviewer.cpp b/tools/assistant/tools/assistant/helpviewer.cpp index 5f2c02b..99c84c5 100644 --- a/tools/assistant/tools/assistant/helpviewer.cpp +++ b/tools/assistant/tools/assistant/helpviewer.cpp @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include "tracer.h" #include "helpviewer.h" #include "centralwidget.h" @@ -93,6 +94,7 @@ HelpNetworkReply::HelpNetworkReply(const QNetworkRequest &request, const QByteArray &fileData, const QString& mimeType) : data(fileData), origLen(fileData.length()) { + TRACE_OBJ setRequest(request); setOpenMode(QIODevice::ReadOnly); @@ -104,11 +106,13 @@ HelpNetworkReply::HelpNetworkReply(const QNetworkRequest &request, void HelpNetworkReply::abort() { + TRACE_OBJ // nothing to do } qint64 HelpNetworkReply::readData(char *buffer, qint64 maxlen) { + TRACE_OBJ qint64 len = qMin(qint64(data.length()), maxlen); if (len) { qMemCopy(buffer, data.constData(), len); @@ -132,11 +136,13 @@ protected: HelpNetworkAccessManager::HelpNetworkAccessManager(QObject *parent) : QNetworkAccessManager(parent) { + TRACE_OBJ } QNetworkReply *HelpNetworkAccessManager::createRequest(Operation /*op*/, const QNetworkRequest &request, QIODevice* /*outgoingData*/) { + TRACE_OBJ const QUrl& url = request.url(); QString mimeType = url.toString(); if (mimeType.endsWith(QLatin1String(".svg")) @@ -187,10 +193,12 @@ HelpPage::HelpPage(CentralWidget *central, QObject *parent) , m_pressedButtons(Qt::NoButton) , m_keyboardModifiers(Qt::NoModifier) { + TRACE_OBJ } QWebPage *HelpPage::createWindow(QWebPage::WebWindowType) { + TRACE_OBJ HelpPage* newPage = static_cast(centralWidget->newEmptyTab()->page()); if (newPage) newPage->closeNewTabIfNeeded = closeNewTabIfNeeded; @@ -200,6 +208,7 @@ QWebPage *HelpPage::createWindow(QWebPage::WebWindowType) static bool isLocalUrl(const QUrl &url) { + TRACE_OBJ const QString scheme = url.scheme(); if (scheme.isEmpty() || scheme == QLatin1String("file") @@ -213,6 +222,7 @@ static bool isLocalUrl(const QUrl &url) void HelpPage::triggerAction(WebAction action, bool checked) { + TRACE_OBJ switch (action) { case OpenLinkInNewWindow: closeNewTabIfNeeded = true; @@ -225,6 +235,7 @@ void HelpPage::triggerAction(WebAction action, bool checked) bool HelpPage::acceptNavigationRequest(QWebFrame *, const QNetworkRequest &request, QWebPage::NavigationType type) { + TRACE_OBJ const QUrl &url = request.url(); const bool closeNewTab = closeNewTabIfNeeded; closeNewTabIfNeeded = false; @@ -274,6 +285,7 @@ HelpViewer::HelpViewer(CentralWidget *parent) , loadFinished(false) , helpEngine(HelpEngineWrapper::instance()) { + TRACE_OBJ setAcceptDrops(false); setPage(new HelpPage(parent, this)); @@ -303,6 +315,7 @@ HelpViewer::HelpViewer(CentralWidget *parent) void HelpViewer::setSource(const QUrl &url) { + TRACE_OBJ loadFinished = false; if (url.toString() == QLatin1String("help")) { load(QUrl(QLatin1String("qthelp://com.trolltech.com." @@ -314,21 +327,25 @@ void HelpViewer::setSource(const QUrl &url) void HelpViewer::resetZoom() { + TRACE_OBJ setTextSizeMultiplier(1.0); } void HelpViewer::zoomIn(qreal range) { + TRACE_OBJ setTextSizeMultiplier(textSizeMultiplier() + range / 10.0); } void HelpViewer::zoomOut(qreal range) { + TRACE_OBJ setTextSizeMultiplier(qMax(0.0, textSizeMultiplier() - range / 10.0)); } void HelpViewer::wheelEvent(QWheelEvent *e) { + TRACE_OBJ if (e->modifiers() & Qt::ControlModifier) { const int delta = e->delta(); if (delta > 0) @@ -343,6 +360,7 @@ void HelpViewer::wheelEvent(QWheelEvent *e) void HelpViewer::mouseReleaseEvent(QMouseEvent *e) { + TRACE_OBJ if (e->button() == Qt::XButton1) { triggerPageAction(QWebPage::Back); return; @@ -358,6 +376,7 @@ void HelpViewer::mouseReleaseEvent(QMouseEvent *e) void HelpViewer::actionChanged() { + TRACE_OBJ QAction *a = qobject_cast(sender()); if (a == pageAction(QWebPage::Copy)) emit copyAvailable(a->isEnabled()); @@ -369,6 +388,7 @@ void HelpViewer::actionChanged() void HelpViewer::mousePressEvent(QMouseEvent *event) { + TRACE_OBJ HelpPage *currentPage = static_cast(page()); if (currentPage) { currentPage->m_pressedButtons = event->buttons(); @@ -379,6 +399,7 @@ void HelpViewer::mousePressEvent(QMouseEvent *event) void HelpViewer::setLoadFinished(bool ok) { + TRACE_OBJ loadFinished = ok; emit sourceChanged(url()); } @@ -393,11 +414,13 @@ HelpViewer::HelpViewer(CentralWidget *parent) , parentWidget(parent) , helpEngine(HelpEngineWrapper::instance()) { + TRACE_OBJ document()->setDocumentMargin(8); } void HelpViewer::setSource(const QUrl &url) { + TRACE_OBJ bool help = url.toString() == QLatin1String("help"); if (url.isValid() && !help) { if (launchedWithExternalApp(url)) @@ -422,6 +445,7 @@ void HelpViewer::setSource(const QUrl &url) void HelpViewer::resetZoom() { + TRACE_OBJ if (zoomCount == 0) return; @@ -431,6 +455,7 @@ void HelpViewer::resetZoom() void HelpViewer::zoomIn(int range) { + TRACE_OBJ if (zoomCount == 10) return; @@ -440,6 +465,7 @@ void HelpViewer::zoomIn(int range) void HelpViewer::zoomOut(int range) { + TRACE_OBJ if (zoomCount == -5) return; @@ -449,6 +475,7 @@ void HelpViewer::zoomOut(int range) bool HelpViewer::launchedWithExternalApp(const QUrl &url) { + TRACE_OBJ bool isPdf = url.path().endsWith(QLatin1String(".pdf")); if (url.scheme() == QLatin1String("http") || url.scheme() == QLatin1String("ftp") @@ -484,6 +511,7 @@ bool HelpViewer::launchedWithExternalApp(const QUrl &url) QVariant HelpViewer::loadResource(int type, const QUrl &name) { + TRACE_OBJ QByteArray ba; if (type < 4) { ba = helpEngine.fileData(name); @@ -499,6 +527,7 @@ QVariant HelpViewer::loadResource(int type, const QUrl &name) void HelpViewer::openLinkInNewTab() { + TRACE_OBJ if(lastAnchor.isEmpty()) return; @@ -508,12 +537,14 @@ void HelpViewer::openLinkInNewTab() void HelpViewer::openLinkInNewTab(const QString &link) { + TRACE_OBJ lastAnchor = link; openLinkInNewTab(); } bool HelpViewer::hasAnchorAt(const QPoint& pos) { + TRACE_OBJ lastAnchor = anchorAt(pos); if (lastAnchor.isEmpty()) return false; @@ -530,6 +561,7 @@ bool HelpViewer::hasAnchorAt(const QPoint& pos) void HelpViewer::contextMenuEvent(QContextMenuEvent *e) { + TRACE_OBJ QMenu menu(QLatin1String(""), 0); QUrl link; @@ -553,6 +585,7 @@ void HelpViewer::contextMenuEvent(QContextMenuEvent *e) void HelpViewer::mouseReleaseEvent(QMouseEvent *e) { + TRACE_OBJ if (e->button() == Qt::XButton1) { QTextBrowser::backward(); return; @@ -575,6 +608,7 @@ void HelpViewer::mouseReleaseEvent(QMouseEvent *e) void HelpViewer::keyPressEvent(QKeyEvent *e) { + TRACE_OBJ if ((e->key() == Qt::Key_Home && e->modifiers() != Qt::NoModifier) || (e->key() == Qt::Key_End && e->modifiers() != Qt::NoModifier)) { QKeyEvent* event = new QKeyEvent(e->type(), e->key(), Qt::NoModifier, @@ -586,6 +620,7 @@ void HelpViewer::keyPressEvent(QKeyEvent *e) void HelpViewer::wheelEvent(QWheelEvent *e) { + TRACE_OBJ if (e->modifiers() == Qt::CTRL) { e->accept(); (e->delta() > 0) ? zoomIn() : zoomOut(); @@ -599,6 +634,7 @@ void HelpViewer::wheelEvent(QWheelEvent *e) void HelpViewer::home() { + TRACE_OBJ setSource(helpEngine.homePage()); } diff --git a/tools/assistant/tools/assistant/indexwindow.cpp b/tools/assistant/tools/assistant/indexwindow.cpp index 78cc238..4b25846 100644 --- a/tools/assistant/tools/assistant/indexwindow.cpp +++ b/tools/assistant/tools/assistant/indexwindow.cpp @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include "tracer.h" #include "indexwindow.h" #include "centralwidget.h" @@ -61,6 +62,7 @@ IndexWindow::IndexWindow(QWidget *parent) , m_searchLineEdit(new QLineEdit) , m_indexWidget(HelpEngineWrapper::instance().indexWidget()) { + TRACE_OBJ QVBoxLayout *layout = new QVBoxLayout(this); QLabel *l = new QLabel(tr("&Look for:")); layout->addWidget(l); @@ -91,10 +93,12 @@ IndexWindow::IndexWindow(QWidget *parent) IndexWindow::~IndexWindow() { + TRACE_OBJ } void IndexWindow::filterIndices(const QString &filter) { + TRACE_OBJ if (filter.contains(QLatin1Char('*'))) m_indexWidget->filterIndices(filter, filter); else @@ -103,6 +107,7 @@ void IndexWindow::filterIndices(const QString &filter) bool IndexWindow::eventFilter(QObject *obj, QEvent *e) { + TRACE_OBJ if (obj == m_searchLineEdit && e->type() == QEvent::KeyPress) { QKeyEvent *ke = static_cast(e); QModelIndex idx = m_indexWidget->currentIndex(); @@ -168,22 +173,26 @@ bool IndexWindow::eventFilter(QObject *obj, QEvent *e) void IndexWindow::enableSearchLineEdit() { + TRACE_OBJ m_searchLineEdit->setDisabled(false); filterIndices(m_searchLineEdit->text()); } void IndexWindow::disableSearchLineEdit() { + TRACE_OBJ m_searchLineEdit->setDisabled(true); } void IndexWindow::setSearchLineEditText(const QString &text) { + TRACE_OBJ m_searchLineEdit->setText(text); } void IndexWindow::focusInEvent(QFocusEvent *e) { + TRACE_OBJ if (e->reason() != Qt::MouseFocusReason) { m_searchLineEdit->selectAll(); m_searchLineEdit->setFocus(); @@ -192,6 +201,7 @@ void IndexWindow::focusInEvent(QFocusEvent *e) void IndexWindow::open(QHelpIndexWidget* indexWidget, const QModelIndex &index) { + TRACE_OBJ QHelpIndexModel *model = qobject_cast(indexWidget->model()); if (model) { QString keyword = model->data(index, Qt::DisplayRole).toString(); diff --git a/tools/assistant/tools/assistant/installdialog.cpp b/tools/assistant/tools/assistant/installdialog.cpp index ea0bd29..4a3500f 100644 --- a/tools/assistant/tools/assistant/installdialog.cpp +++ b/tools/assistant/tools/assistant/installdialog.cpp @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include "tracer.h" #include "installdialog.h" @@ -66,6 +67,7 @@ InstallDialog::InstallDialog(QHelpEngineCore *helpEngine, QWidget *parent, const QString &host, int port) : QDialog(parent), m_helpEngine(helpEngine), m_host(host), m_port(port) { + TRACE_OBJ m_ui.setupUi(this); m_ui.installButton->setEnabled(false); @@ -94,15 +96,18 @@ InstallDialog::InstallDialog(QHelpEngineCore *helpEngine, QWidget *parent, InstallDialog::~InstallDialog() { + TRACE_OBJ } QStringList InstallDialog::installedDocumentations() const { + TRACE_OBJ return m_installedDocumentations; } void InstallDialog::init() { + TRACE_OBJ m_ui.statusLabel->setText(tr("Downloading documentation info...")); m_ui.progressBar->show(); @@ -122,6 +127,7 @@ void InstallDialog::init() void InstallDialog::updateInstallButton() { + TRACE_OBJ QListWidgetItem *item = 0; for (int i=0; icount(); ++i) { item = m_ui.listWidget->item(i); @@ -136,6 +142,7 @@ void InstallDialog::updateInstallButton() void InstallDialog::updateDocItemList() { + TRACE_OBJ QStringList registeredDocs = m_helpEngine->registeredDocumentations(); QListWidgetItem *item = 0; for (int i=0; icount(); ++i) { @@ -151,6 +158,7 @@ void InstallDialog::updateDocItemList() void InstallDialog::cancelDownload() { + TRACE_OBJ m_ui.statusLabel->setText(tr("Download canceled.")); m_httpAborted = true; m_itemsToInstall.clear(); @@ -162,6 +170,7 @@ void InstallDialog::cancelDownload() void InstallDialog::install() { + TRACE_OBJ QListWidgetItem *item = 0; for (int i=0; icount(); ++i) { item = m_ui.listWidget->item(i); @@ -174,6 +183,7 @@ void InstallDialog::install() void InstallDialog::downloadNextFile() { + TRACE_OBJ if (!m_itemsToInstall.count()) { m_ui.cancelButton->setEnabled(false); m_ui.closeButton->setEnabled(true); @@ -226,6 +236,7 @@ void InstallDialog::downloadNextFile() void InstallDialog::httpRequestFinished(int requestId, bool error) { + TRACE_OBJ if (requestId == m_docInfoId && m_buffer) { m_ui.progressBar->hide(); if (error) { @@ -296,6 +307,7 @@ void InstallDialog::httpRequestFinished(int requestId, bool error) void InstallDialog::installFile(const QString &fileName) { + TRACE_OBJ if (m_helpEngine->registerDocumentation(fileName)) { m_installedDocumentations .append(QHelpEngineCore::namespaceName(fileName)); @@ -308,6 +320,7 @@ void InstallDialog::installFile(const QString &fileName) void InstallDialog::readResponseHeader(const QHttpResponseHeader &responseHeader) { + TRACE_OBJ if (responseHeader.statusCode() != 200) { QMessageBox::information(this, m_windowTitle, tr("Download failed: %1.") @@ -321,6 +334,7 @@ void InstallDialog::readResponseHeader(const QHttpResponseHeader &responseHeader void InstallDialog::updateDataReadProgress(int bytesRead, int totalBytes) { + TRACE_OBJ if (m_httpAborted) return; @@ -330,6 +344,7 @@ void InstallDialog::updateDataReadProgress(int bytesRead, int totalBytes) void InstallDialog::browseDirectories() { + TRACE_OBJ QString dir = QFileDialog::getExistingDirectory(this, m_windowTitle, m_ui.pathLineEdit->text()); if (!dir.isEmpty()) diff --git a/tools/assistant/tools/assistant/main.cpp b/tools/assistant/tools/assistant/main.cpp index be13b0a..79ed2c8 100644 --- a/tools/assistant/tools/assistant/main.cpp +++ b/tools/assistant/tools/assistant/main.cpp @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include "tracer.h" #include #include @@ -76,6 +77,7 @@ namespace { void updateLastPagesOnUnregister(QHelpEngineCore& helpEngine, const QString& nsName) { + TRACE_OBJ int lastPage = CollectionConfiguration::lastTabPage(helpEngine); QStringList currentPages = CollectionConfiguration::lastShownPages(helpEngine); if (!currentPages.isEmpty()) { @@ -100,6 +102,7 @@ updateLastPagesOnUnregister(QHelpEngineCore& helpEngine, const QString& nsName) bool updateUserCollection(QHelpEngineCore& user, const QHelpEngineCore& caller) { + TRACE_OBJ if (!CollectionConfiguration::isNewer(caller, user)) return false; CollectionConfiguration::copyConfiguration(caller, user); @@ -108,6 +111,7 @@ updateUserCollection(QHelpEngineCore& user, const QHelpEngineCore& caller) void stripNonexistingDocs(QHelpEngineCore& collection) { + TRACE_OBJ const QStringList &namespaces = collection.registeredDocumentations(); foreach (const QString &ns, namespaces) { QFileInfo fi(collection.documentationFileName(ns)); @@ -118,6 +122,7 @@ void stripNonexistingDocs(QHelpEngineCore& collection) QString indexFilesFolder(const QString &collectionFile) { + TRACE_OBJ QString indexFilesFolder = QLatin1String(".fulltextsearch"); if (!collectionFile.isEmpty()) { QFileInfo fi(collectionFile); @@ -134,6 +139,7 @@ QString indexFilesFolder(const QString &collectionFile) */ QString constructCachedCollectionFilePath(const QHelpEngineCore &collection) { + TRACE_OBJ const QString &filePath = collection.collectionFile(); const QString &fileName = QFileInfo(filePath).fileName(); const QString &cacheDir = CollectionConfiguration::cacheDir(collection); @@ -149,6 +155,7 @@ bool synchronizeDocs(QHelpEngineCore &collection, QHelpEngineCore &cachedCollection, CmdLineParser &cmd) { + TRACE_OBJ const QDateTime &lastCollectionRegisterTime = CollectionConfiguration::lastRegisterTime(collection); if (!lastCollectionRegisterTime.isValid() || lastCollectionRegisterTime @@ -180,6 +187,7 @@ bool synchronizeDocs(QHelpEngineCore &collection, bool removeSearchIndex(const QString &collectionFile) { + TRACE_OBJ QString path = QFileInfo(collectionFile).path(); path += QLatin1Char('/') + indexFilesFolder(collectionFile); @@ -199,6 +207,7 @@ bool removeSearchIndex(const QString &collectionFile) bool checkForSqlite(CmdLineParser &cmd) { + TRACE_OBJ QSqlDatabase db; QStringList sqlDrivers(db.drivers()); if (!sqlDrivers.contains(QLatin1String("QSQLITE"))) { @@ -211,6 +220,7 @@ bool checkForSqlite(CmdLineParser &cmd) bool useGui(int argc, char *argv[]) { + TRACE_OBJ bool gui = true; #ifndef Q_OS_WIN // Look for arguments that imply command-line mode. @@ -232,6 +242,7 @@ bool useGui(int argc, char *argv[]) bool registerDocumentation(QHelpEngineCore &collection, CmdLineParser &cmd, bool printSuccess) { + TRACE_OBJ if (!collection.registerDocumentation(cmd.helpFile())) { cmd.showMessage( QObject::tr("Could not register documentation file\n%1\n\nReason:\n%2") @@ -248,6 +259,7 @@ bool registerDocumentation(QHelpEngineCore &collection, CmdLineParser &cmd, bool unregisterDocumentation(QHelpEngineCore &collection, const QString &namespaceName, CmdLineParser &cmd, bool printSuccess) { + TRACE_OBJ if (!collection.unregisterDocumentation(namespaceName)) { cmd.showMessage(QObject::tr("Could not unregister documentation" " file\n%1\n\nReason:\n%2"). @@ -263,6 +275,7 @@ bool unregisterDocumentation(QHelpEngineCore &collection, void setupTranslations(QApplication &app) { + TRACE_OBJ const QString& locale = QLocale::system().name(); QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath); @@ -283,6 +296,7 @@ void setupTranslations(QApplication &app) int main(int argc, char *argv[]) { + TRACE_OBJ QApplication a(argc, argv, useGui(argc, argv)); a.addLibraryPath(a.applicationDirPath() + QLatin1String("/plugins")); diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp index 9955c65..ce4ab7f 100644 --- a/tools/assistant/tools/assistant/mainwindow.cpp +++ b/tools/assistant/tools/assistant/mainwindow.cpp @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include "tracer.h" #include "mainwindow.h" #include "centralwidget.h" @@ -101,6 +102,7 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) , m_qtDocInstaller(0) , m_connectedInitSignals(false) { + TRACE_OBJ setToolButtonStyle(Qt::ToolButtonFollowStyle); @@ -254,17 +256,20 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) MainWindow::~MainWindow() { + TRACE_OBJ if (m_qtDocInstaller) delete m_qtDocInstaller; } bool MainWindow::usesDefaultCollection() const { + TRACE_OBJ return m_cmdLine->collectionFile().isEmpty(); } void MainWindow::closeEvent(QCloseEvent *e) { + TRACE_OBJ m_bookmarkManager->saveBookmarks(); HelpEngineWrapper::instance().setMainWindow(saveState()); HelpEngineWrapper::instance().setMainWindowGeometry(saveGeometry()); @@ -273,6 +278,7 @@ void MainWindow::closeEvent(QCloseEvent *e) bool MainWindow::initHelpDB() { + TRACE_OBJ HelpEngineWrapper &helpEngineWrapper = HelpEngineWrapper::instance(); if (!helpEngineWrapper.setupData()) return false; @@ -323,6 +329,7 @@ bool MainWindow::initHelpDB() void MainWindow::lookForNewQtDocumentation() { + TRACE_OBJ HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance(); QStringList docs; docs << QLatin1String("assistant") @@ -348,6 +355,7 @@ void MainWindow::lookForNewQtDocumentation() void MainWindow::qtDocumentationInstalled(bool newDocsInstalled) { + TRACE_OBJ if (newDocsInstalled) HelpEngineWrapper::instance().setupData(); statusBar()->clearMessage(); @@ -356,6 +364,7 @@ void MainWindow::qtDocumentationInstalled(bool newDocsInstalled) void MainWindow::checkInitState() { + TRACE_OBJ if (!m_cmdLine->enableRemoteControl()) return; @@ -380,6 +389,7 @@ void MainWindow::checkInitState() void MainWindow::updateBookmarkMenu() { + TRACE_OBJ if (m_bookmarkManager) { m_bookmarkMenu->removeAction(m_importBookmarkAction); m_bookmarkMenu->removeAction(m_exportBookmarkAction); @@ -398,6 +408,7 @@ void MainWindow::updateBookmarkMenu() void MainWindow::showBookmark(QAction *action) { + TRACE_OBJ if (m_bookmarkManager) { const QUrl &url = m_bookmarkManager->urlForAction(action); if (url.isValid()) @@ -407,6 +418,7 @@ void MainWindow::showBookmark(QAction *action) void MainWindow::insertLastPages() { + TRACE_OBJ if (m_cmdLine->url().isValid()) m_centralWidget->setSource(m_cmdLine->url()); else @@ -418,6 +430,7 @@ void MainWindow::insertLastPages() void MainWindow::setupActions() { + TRACE_OBJ QString resourcePath = QLatin1String(":/trolltech/assistant/images/"); #ifdef Q_OS_MAC setUnifiedTitleAndToolBarOnMac(true); @@ -643,6 +656,7 @@ void MainWindow::setupActions() QMenu *MainWindow::toolBarMenu() { + TRACE_OBJ if (!m_toolBarMenu) { m_viewMenu->addSeparator(); m_toolBarMenu = m_viewMenu->addMenu(tr("Toolbars")); @@ -652,6 +666,7 @@ QMenu *MainWindow::toolBarMenu() void MainWindow::setupFilterToolbar() { + TRACE_OBJ HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance(); if (!helpEngine.filterFunctionalityEnabled()) return; @@ -682,6 +697,7 @@ void MainWindow::setupFilterToolbar() void MainWindow::setupAddressToolbar() { + TRACE_OBJ HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance(); if (!helpEngine.addressBarEnabled()) return; @@ -710,6 +726,7 @@ void MainWindow::setupAddressToolbar() void MainWindow::updateAboutMenuText() { + TRACE_OBJ QByteArray ba = HelpEngineWrapper::instance().aboutMenuTexts(); if (ba.size() > 0) { QString lang; @@ -737,27 +754,32 @@ void MainWindow::updateAboutMenuText() void MainWindow::showNewAddress() { + TRACE_OBJ showNewAddress(m_centralWidget->currentSource()); } void MainWindow::showNewAddress(const QUrl &url) { + TRACE_OBJ m_addressLineEdit->setText(url.toString()); } void MainWindow::addBookmark() { + TRACE_OBJ addNewBookmark(m_centralWidget->currentTitle(), m_centralWidget->currentSource().toString()); } void MainWindow::gotoAddress() { + TRACE_OBJ m_centralWidget->setSource(m_addressLineEdit->text()); } void MainWindow::updateNavigationItems() { + TRACE_OBJ bool hasCurrentViewer = m_centralWidget->isHomeAvailable(); m_copyAction->setEnabled(m_centralWidget->hasSelection()); m_homeAction->setEnabled(hasCurrentViewer); @@ -771,12 +793,14 @@ void MainWindow::updateNavigationItems() void MainWindow::updateTabCloseAction() { + TRACE_OBJ m_closeTabAction->setEnabled(m_centralWidget->enableTabCloseAction()); } void MainWindow::showTopicChooser(const QMap &links, const QString &keyword) { + TRACE_OBJ TopicChooser tc(this, keyword, links); if (tc.exec() == QDialog::Accepted) { m_centralWidget->setSource(tc.link()); @@ -785,6 +809,7 @@ void MainWindow::showTopicChooser(const QMap &links, void MainWindow::showPreferences() { + TRACE_OBJ PreferencesDialog dia(this); connect(&dia, SIGNAL(updateApplicationFont()), this, @@ -797,6 +822,7 @@ void MainWindow::showPreferences() void MainWindow::syncContents() { + TRACE_OBJ qApp->setOverrideCursor(QCursor(Qt::WaitCursor)); const QUrl url = m_centralWidget->currentSource(); showContents(); @@ -808,11 +834,13 @@ void MainWindow::syncContents() void MainWindow::copyAvailable(bool yes) { + TRACE_OBJ m_copyAction->setEnabled(yes); } void MainWindow::addNewBookmark(const QString &title, const QString &url) { + TRACE_OBJ if (url.isEmpty() || url == QLatin1String("about:blank")) return; @@ -821,6 +849,7 @@ void MainWindow::addNewBookmark(const QString &title, const QString &url) void MainWindow::showAboutDialog() { + TRACE_OBJ HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance(); QByteArray contents; QByteArray ba = helpEngine.aboutTexts(); @@ -874,6 +903,7 @@ void MainWindow::showAboutDialog() void MainWindow::setContentsVisible(bool visible) { + TRACE_OBJ if (visible) showContents(); else @@ -882,16 +912,19 @@ void MainWindow::setContentsVisible(bool visible) void MainWindow::showContents() { + TRACE_OBJ activateDockWidget(m_contentWindow); } void MainWindow::hideContents() { + TRACE_OBJ m_contentWindow->parentWidget()->hide(); } void MainWindow::setIndexVisible(bool visible) { + TRACE_OBJ if (visible) showIndex(); else @@ -900,16 +933,19 @@ void MainWindow::setIndexVisible(bool visible) void MainWindow::showIndex() { + TRACE_OBJ activateDockWidget(m_indexWindow); } void MainWindow::hideIndex() { + TRACE_OBJ m_indexWindow->parentWidget()->hide(); } void MainWindow::setBookmarksVisible(bool visible) { + TRACE_OBJ if (visible) showBookmarks(); else @@ -919,16 +955,19 @@ void MainWindow::setBookmarksVisible(bool visible) void MainWindow::showBookmarks() { + TRACE_OBJ activateDockWidget(m_bookmarkWidget); } void MainWindow::hideBookmarks() { + TRACE_OBJ m_bookmarkWidget->parentWidget()->hide(); } void MainWindow::setSearchVisible(bool visible) { + TRACE_OBJ if (visible) showSearch(); else @@ -937,16 +976,19 @@ void MainWindow::setSearchVisible(bool visible) void MainWindow::showSearch() { + TRACE_OBJ m_centralWidget->activateSearchWidget(); } void MainWindow::hideSearch() { + TRACE_OBJ m_centralWidget->removeSearchWidget(); } void MainWindow::activateDockWidget(QWidget *w) { + TRACE_OBJ w->parentWidget()->show(); w->parentWidget()->raise(); w->setFocus(); @@ -954,11 +996,13 @@ void MainWindow::activateDockWidget(QWidget *w) void MainWindow::setIndexString(const QString &str) { + TRACE_OBJ m_indexWindow->setSearchLineEditText(str); } void MainWindow::activateCurrentBrowser() { + TRACE_OBJ CentralWidget *cw = CentralWidget::instance(); if (cw) { cw->activateTab(true); @@ -967,16 +1011,19 @@ void MainWindow::activateCurrentBrowser() void MainWindow::activateCurrentCentralWidgetTab() { + TRACE_OBJ m_centralWidget->activateTab(); } void MainWindow::showSearchWidget() { + TRACE_OBJ m_centralWidget->activateSearchWidget(true); } void MainWindow::updateApplicationFont() { + TRACE_OBJ HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance(); QFont font = qApp->font(); if (helpEngine.usesAppFont()) @@ -987,6 +1034,7 @@ void MainWindow::updateApplicationFont() void MainWindow::setupFilterCombo() { + TRACE_OBJ HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance(); QString curFilter = m_filterCombo->currentText(); if (curFilter.isEmpty()) @@ -1001,17 +1049,20 @@ void MainWindow::setupFilterCombo() void MainWindow::filterDocumentation(const QString &customFilter) { + TRACE_OBJ HelpEngineWrapper::instance().setCurrentFilter(customFilter); } void MainWindow::expandTOC(int depth) { + TRACE_OBJ Q_ASSERT(depth >= -1); m_contentWindow->expandToDepth(depth); } void MainWindow::indexingStarted() { + TRACE_OBJ if (!m_progressWidget) { m_progressWidget = new QWidget(); QLayout* hlayout = new QHBoxLayout(m_progressWidget); @@ -1037,6 +1088,7 @@ void MainWindow::indexingStarted() void MainWindow::indexingFinished() { + TRACE_OBJ statusBar()->removeWidget(m_progressWidget); delete m_progressWidget; m_progressWidget = 0; @@ -1044,6 +1096,7 @@ void MainWindow::indexingFinished() QWidget* MainWindow::setupBookmarkWidget() { + TRACE_OBJ m_bookmarkManager = new BookmarkManager; m_bookmarkWidget = new BookmarkWidget(m_bookmarkManager, this); connect(m_bookmarkWidget, SIGNAL(addBookmark()), this, SLOT(addBookmark())); @@ -1052,6 +1105,7 @@ QWidget* MainWindow::setupBookmarkWidget() QString MainWindow::collectionFileDirectory(bool createDir, const QString &cacheDir) { + TRACE_OBJ QString collectionPath = QDesktopServices::storageLocation(QDesktopServices::DataLocation); if (collectionPath.isEmpty()) { @@ -1077,6 +1131,7 @@ QString MainWindow::collectionFileDirectory(bool createDir, const QString &cache QString MainWindow::defaultHelpCollectionFileName() { + TRACE_OBJ return collectionFileDirectory() + QDir::separator() + QString(QLatin1String("qthelpcollection_%1.qhc")). arg(QLatin1String(QT_VERSION_STR)); @@ -1084,6 +1139,7 @@ QString MainWindow::defaultHelpCollectionFileName() void MainWindow::importBookmarks() { + TRACE_OBJ const QString &fileName = QFileDialog::getOpenFileName(0, tr("Open File"), QDir::currentPath(), tr("Files (*.xbel)")); @@ -1100,6 +1156,7 @@ void MainWindow::importBookmarks() void MainWindow::exportBookmarks() { + TRACE_OBJ QString fileName = QFileDialog::getSaveFileName(0, tr("Save File"), "untitled.xbel", tr("Files (*.xbel)")); @@ -1119,6 +1176,7 @@ void MainWindow::exportBookmarks() void MainWindow::currentFilterChanged(const QString &filter) { + TRACE_OBJ const int index = m_filterCombo->findText(filter); Q_ASSERT(index != -1); m_filterCombo->setCurrentIndex(index); @@ -1126,12 +1184,14 @@ void MainWindow::currentFilterChanged(const QString &filter) void MainWindow::documentationRemoved(const QString &namespaceName) { + TRACE_OBJ CentralWidget* widget = CentralWidget::instance(); widget->closeTabs(widget->currentSourceFileList().keys(namespaceName)); } void MainWindow::documentationUpdated(const QString &namespaceName) { + TRACE_OBJ // TODO: Check whether the documents still exists and if they do, reload. CentralWidget* widget = CentralWidget::instance(); widget->closeTabs(widget->currentSourceFileList().keys(namespaceName)); @@ -1139,6 +1199,7 @@ void MainWindow::documentationUpdated(const QString &namespaceName) void MainWindow::resetQtDocInfo(const QString &component) { + TRACE_OBJ HelpEngineWrapper::instance().setQtDocInfo(component, QStringList(QDateTime().toString(Qt::ISODate))); } @@ -1146,6 +1207,7 @@ void MainWindow::resetQtDocInfo(const QString &component) void MainWindow::registerDocumentation(const QString &component, const QString &absFileName) { + TRACE_OBJ QString ns = QHelpEngineCore::namespaceName(absFileName); if (ns.isEmpty()) return; diff --git a/tools/assistant/tools/assistant/preferencesdialog.cpp b/tools/assistant/tools/assistant/preferencesdialog.cpp index 2f282b1..aac26f1 100644 --- a/tools/assistant/tools/assistant/preferencesdialog.cpp +++ b/tools/assistant/tools/assistant/preferencesdialog.cpp @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include "tracer.h" #include "preferencesdialog.h" #include "filternamedialog.h" @@ -68,6 +69,7 @@ PreferencesDialog::PreferencesDialog(QWidget *parent) , m_browserFontChanged(false) , helpEngine(HelpEngineWrapper::instance()) { + TRACE_OBJ m_ui.setupUi(this); connect(m_ui.buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), @@ -117,6 +119,7 @@ PreferencesDialog::PreferencesDialog(QWidget *parent) PreferencesDialog::~PreferencesDialog() { + TRACE_OBJ if (m_appFontChanged) { helpEngine.setAppFont(m_appFontPanel->selectedFont()); helpEngine.setUseAppFont(m_appFontPanel->isChecked()); @@ -145,12 +148,14 @@ PreferencesDialog::~PreferencesDialog() void PreferencesDialog::showDialog() { + TRACE_OBJ if (exec() != Accepted) m_appFontChanged = m_browserFontChanged = false; } void PreferencesDialog::updateFilterPage() { + TRACE_OBJ m_ui.filterWidget->clear(); m_ui.attributeWidget->clear(); @@ -174,6 +179,7 @@ void PreferencesDialog::updateFilterPage() void PreferencesDialog::updateAttributes(QListWidgetItem *item) { + TRACE_OBJ QStringList checkedList; if (item) checkedList = m_filterMap.value(item->text()); @@ -189,6 +195,7 @@ void PreferencesDialog::updateAttributes(QListWidgetItem *item) void PreferencesDialog::updateFilterMap() { + TRACE_OBJ if (!m_ui.filterWidget->currentItem()) return; QString filter = m_ui.filterWidget->currentItem()->text(); @@ -207,6 +214,7 @@ void PreferencesDialog::updateFilterMap() void PreferencesDialog::addFilter() { + TRACE_OBJ FilterNameDialog dia(this); if (dia.exec() == QDialog::Rejected) return; @@ -224,6 +232,7 @@ void PreferencesDialog::addFilter() void PreferencesDialog::removeFilter() { + TRACE_OBJ QListWidgetItem *item = m_ui.filterWidget ->takeItem(m_ui.filterWidget->currentRow()); if (!item) @@ -238,6 +247,7 @@ void PreferencesDialog::removeFilter() void PreferencesDialog::addDocumentationLocal() { + TRACE_OBJ const QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Add Documentation"), QString(), tr("Qt Compressed Help Files (*.qch)")); if (fileNames.isEmpty()) @@ -291,6 +301,7 @@ void PreferencesDialog::addDocumentationLocal() void PreferencesDialog::removeDocumentation() { + TRACE_OBJ bool foundBefore = false; CentralWidget* widget = CentralWidget::instance(); QMap openedDocList = widget->currentSourceFileList(); @@ -322,6 +333,7 @@ void PreferencesDialog::removeDocumentation() void PreferencesDialog::applyChanges() { + TRACE_OBJ bool filtersWereChanged = false; if (!m_hideFiltersTab) { if (m_filterMap.count() != m_filterMapBackup.count()) { @@ -375,6 +387,7 @@ void PreferencesDialog::applyChanges() void PreferencesDialog::updateFontSettingsPage() { + TRACE_OBJ m_browserFontPanel = new FontPanel(this); m_browserFontPanel->setCheckable(true); m_ui.stackedWidget_2->insertWidget(0, m_browserFontPanel); @@ -426,30 +439,35 @@ void PreferencesDialog::updateFontSettingsPage() void PreferencesDialog::appFontSettingToggled(bool on) { + TRACE_OBJ Q_UNUSED(on) m_appFontChanged = true; } void PreferencesDialog::appFontSettingChanged(int index) { + TRACE_OBJ Q_UNUSED(index) m_appFontChanged = true; } void PreferencesDialog::browserFontSettingToggled(bool on) { + TRACE_OBJ Q_UNUSED(on) m_browserFontChanged = true; } void PreferencesDialog::browserFontSettingChanged(int index) { + TRACE_OBJ Q_UNUSED(index) m_browserFontChanged = true; } void PreferencesDialog::updateOptionsPage() { + TRACE_OBJ m_ui.homePageLineEdit->setText(helpEngine.homePage()); int option = helpEngine.startOption(); @@ -462,11 +480,13 @@ void PreferencesDialog::updateOptionsPage() void PreferencesDialog::setBlankPage() { + TRACE_OBJ m_ui.homePageLineEdit->setText(QLatin1String("about:blank")); } void PreferencesDialog::setCurrentPage() { + TRACE_OBJ QString homepage = CentralWidget::instance()->currentSource().toString(); if (homepage.isEmpty()) homepage = QLatin1String("help"); @@ -476,6 +496,7 @@ void PreferencesDialog::setCurrentPage() void PreferencesDialog::setDefaultPage() { + TRACE_OBJ m_ui.homePageLineEdit->setText(helpEngine.defaultHomePage()); } diff --git a/tools/assistant/tools/assistant/qtdocinstaller.cpp b/tools/assistant/tools/assistant/qtdocinstaller.cpp index 3675aec..44272a0 100644 --- a/tools/assistant/tools/assistant/qtdocinstaller.cpp +++ b/tools/assistant/tools/assistant/qtdocinstaller.cpp @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include "tracer.h" #include #include @@ -52,10 +53,12 @@ QT_BEGIN_NAMESPACE QtDocInstaller::QtDocInstaller(const QList &docInfos) : m_abort(false), m_docInfos(docInfos) { + TRACE_OBJ } QtDocInstaller::~QtDocInstaller() { + TRACE_OBJ if (!isRunning()) return; m_mutex.lock(); @@ -66,11 +69,13 @@ QtDocInstaller::~QtDocInstaller() void QtDocInstaller::installDocs() { + TRACE_OBJ start(LowPriority); } void QtDocInstaller::run() { + TRACE_OBJ m_qchDir = QLibraryInfo::location(QLibraryInfo::DocumentationPath) + QDir::separator() + QLatin1String("qch"); m_qchFiles = m_qchDir.entryList(QStringList() << QLatin1String("*.qch")); @@ -90,6 +95,7 @@ void QtDocInstaller::run() bool QtDocInstaller::installDoc(const DocInfo &docInfo) { + TRACE_OBJ const QString &component = docInfo.first; const QStringList &info = docInfo.second; QDateTime dt; diff --git a/tools/assistant/tools/assistant/remotecontrol.cpp b/tools/assistant/tools/assistant/remotecontrol.cpp index f4ae3b4..f8eef4c 100644 --- a/tools/assistant/tools/assistant/remotecontrol.cpp +++ b/tools/assistant/tools/assistant/remotecontrol.cpp @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include "tracer.h" #include "remotecontrol.h" #include "mainwindow.h" @@ -68,16 +69,19 @@ QT_BEGIN_NAMESPACE StdInListenerWin::StdInListenerWin(QObject *parent) : QThread(parent) { + TRACE_OBJ } StdInListenerWin::~StdInListenerWin() { + TRACE_OBJ terminate(); wait(); } void StdInListenerWin::run() { + TRACE_OBJ bool ok = true; char chBuf[4096]; DWORD dwRead; @@ -117,6 +121,7 @@ RemoteControl::RemoteControl(MainWindow *mainWindow) , helpEngine(HelpEngineWrapper::instance()) { + TRACE_OBJ connect(m_mainWindow, SIGNAL(initDone()), this, SLOT(applyCache())); #ifdef Q_OS_WIN StdInListenerWin *l = new StdInListenerWin(this); @@ -133,6 +138,7 @@ RemoteControl::RemoteControl(MainWindow *mainWindow) void RemoteControl::receivedData() { + TRACE_OBJ QByteArray ba; while (true) { char c = getc(stdin); @@ -148,6 +154,7 @@ void RemoteControl::receivedData() void RemoteControl::handleCommandString(const QString &cmdString) { + TRACE_OBJ QStringList cmds = cmdString.split(QLatin1Char(';')); QStringList::const_iterator it = cmds.constBegin(); while (it != cmds.constEnd()) { @@ -192,6 +199,7 @@ void RemoteControl::handleCommandString(const QString &cmdString) void RemoteControl::splitInputString(const QString &input, QString &cmd, QString &arg) { + TRACE_OBJ QString cmdLine = input.trimmed(); int i = cmdLine.indexOf(QLatin1Char(' ')); cmd = cmdLine.left(i); @@ -201,11 +209,13 @@ void RemoteControl::splitInputString(const QString &input, QString &cmd, void RemoteControl::handleDebugCommand(const QString &arg) { + TRACE_OBJ m_debug = arg == QLatin1String("on"); } void RemoteControl::handleShowOrHideCommand(const QString &arg, bool show) { + TRACE_OBJ if (arg.toLower() == QLatin1String("contents")) m_mainWindow->setContentsVisible(show); else if (arg.toLower() == QLatin1String("index")) @@ -218,6 +228,7 @@ void RemoteControl::handleShowOrHideCommand(const QString &arg, bool show) void RemoteControl::handleSetSourceCommand(const QString &arg) { + TRACE_OBJ QUrl url(arg); if (url.isValid()) { if (url.isRelative()) @@ -233,6 +244,7 @@ void RemoteControl::handleSetSourceCommand(const QString &arg) void RemoteControl::handleSyncContentsCommand() { + TRACE_OBJ if (m_caching) m_syncContents = true; else @@ -241,6 +253,7 @@ void RemoteControl::handleSyncContentsCommand() void RemoteControl::handleActivateKeywordCommand(const QString &arg) { + TRACE_OBJ if (m_caching) { clearCache(); m_activateKeyword = arg; @@ -253,6 +266,7 @@ void RemoteControl::handleActivateKeywordCommand(const QString &arg) void RemoteControl::handleActivateIdentifierCommand(const QString &arg) { + TRACE_OBJ if (m_caching) { clearCache(); m_activateIdentifier = arg; @@ -265,6 +279,7 @@ void RemoteControl::handleActivateIdentifierCommand(const QString &arg) void RemoteControl::handleExpandTocCommand(const QString &arg) { + TRACE_OBJ bool ok = false; int depth = -2; if (!arg.isEmpty()) @@ -280,6 +295,7 @@ void RemoteControl::handleExpandTocCommand(const QString &arg) void RemoteControl::handleSetCurrentFilterCommand(const QString &arg) { + TRACE_OBJ if (helpEngine.customFilters().contains(arg)) { if (m_caching) { clearCache(); @@ -292,6 +308,7 @@ void RemoteControl::handleSetCurrentFilterCommand(const QString &arg) void RemoteControl::handleRegisterCommand(const QString &arg) { + TRACE_OBJ const QString &absFileName = QFileInfo(arg).absoluteFilePath(); if (helpEngine.registeredDocumentations(). contains(QHelpEngineCore::namespaceName(absFileName))) @@ -302,6 +319,7 @@ void RemoteControl::handleRegisterCommand(const QString &arg) void RemoteControl::handleUnregisterCommand(const QString &arg) { + TRACE_OBJ const QString &absFileName = QFileInfo(arg).absoluteFilePath(); const QString &ns = QHelpEngineCore::namespaceName(absFileName); if (helpEngine.registeredDocumentations().contains(ns)) { @@ -314,6 +332,7 @@ void RemoteControl::handleUnregisterCommand(const QString &arg) void RemoteControl::applyCache() { + TRACE_OBJ if (m_setSource.isValid()) { CentralWidget::instance()->setSource(m_setSource); } else if (!m_activateKeyword.isEmpty()) { @@ -340,6 +359,7 @@ void RemoteControl::applyCache() void RemoteControl::clearCache() { + TRACE_OBJ m_currentFilter.clear(); m_setSource.clear(); m_syncContents = false; diff --git a/tools/assistant/tools/assistant/searchwidget.cpp b/tools/assistant/tools/assistant/searchwidget.cpp index 3b456a3..06cf4b0 100644 --- a/tools/assistant/tools/assistant/searchwidget.cpp +++ b/tools/assistant/tools/assistant/searchwidget.cpp @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include "tracer.h" #include "mainwindow.h" #include "searchwidget.h" @@ -65,6 +66,7 @@ SearchWidget::SearchWidget(QHelpSearchEngine *engine, QWidget *parent) , attached(false) , searchEngine(engine) { + TRACE_OBJ QVBoxLayout *vLayout = new QVBoxLayout(this); resultWidget = searchEngine->resultWidget(); @@ -91,11 +93,13 @@ SearchWidget::SearchWidget(QHelpSearchEngine *engine, QWidget *parent) SearchWidget::~SearchWidget() { + TRACE_OBJ // nothing todo } void SearchWidget::zoomIn() { + TRACE_OBJ QTextBrowser* browser = qFindChild(resultWidget); if (browser && zoomCount != 10) { zoomCount++; @@ -105,6 +109,7 @@ void SearchWidget::zoomIn() void SearchWidget::zoomOut() { + TRACE_OBJ QTextBrowser* browser = qFindChild(resultWidget); if (browser && zoomCount != -5) { zoomCount--; @@ -114,6 +119,7 @@ void SearchWidget::zoomOut() void SearchWidget::resetZoom() { + TRACE_OBJ if (zoomCount == 0) return; @@ -126,33 +132,39 @@ void SearchWidget::resetZoom() bool SearchWidget::isAttached() const { + TRACE_OBJ return attached; } void SearchWidget::setAttached(bool state) { + TRACE_OBJ attached = state; } void SearchWidget::search() const { + TRACE_OBJ QList query = searchEngine->queryWidget()->query(); searchEngine->search(query); } void SearchWidget::searchingStarted() { + TRACE_OBJ qApp->setOverrideCursor(QCursor(Qt::WaitCursor)); } void SearchWidget::searchingFinished(int hits) { + TRACE_OBJ Q_UNUSED(hits) qApp->restoreOverrideCursor(); } bool SearchWidget::eventFilter(QObject* o, QEvent *e) { + TRACE_OBJ QTextBrowser* browser = qFindChild(resultWidget); if (browser && o == browser->viewport() && e->type() == QEvent::MouseButtonRelease){ @@ -171,6 +183,7 @@ bool SearchWidget::eventFilter(QObject* o, QEvent *e) void SearchWidget::keyPressEvent(QKeyEvent *keyEvent) { + TRACE_OBJ if (keyEvent->key() == Qt::Key_Escape) MainWindow::activateCurrentBrowser(); else @@ -179,6 +192,7 @@ void SearchWidget::keyPressEvent(QKeyEvent *keyEvent) void SearchWidget::contextMenuEvent(QContextMenuEvent *contextMenuEvent) { + TRACE_OBJ QMenu menu; QPoint point = contextMenuEvent->globalPos(); diff --git a/tools/assistant/tools/assistant/topicchooser.cpp b/tools/assistant/tools/assistant/topicchooser.cpp index 0382fe2..803ea04 100644 --- a/tools/assistant/tools/assistant/topicchooser.cpp +++ b/tools/assistant/tools/assistant/topicchooser.cpp @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include "tracer.h" #include #include @@ -50,6 +51,7 @@ TopicChooser::TopicChooser(QWidget *parent, const QString &keyword, const QMap &links) : QDialog(parent) { + TRACE_OBJ ui.setupUi(this); ui.label->setText(tr("Choose a topic for %1:").arg(keyword)); @@ -72,6 +74,7 @@ TopicChooser::TopicChooser(QWidget *parent, const QString &keyword, QUrl TopicChooser::link() const { + TRACE_OBJ QListWidgetItem *item = ui.listWidget->currentItem(); if (!item) return QUrl(); diff --git a/tools/assistant/tools/assistant/xbelsupport.cpp b/tools/assistant/tools/assistant/xbelsupport.cpp index 3c545ac..f2c0bcb 100644 --- a/tools/assistant/tools/assistant/xbelsupport.cpp +++ b/tools/assistant/tools/assistant/xbelsupport.cpp @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include "tracer.h" #include "xbelsupport.h" #include "bookmarkmanager.h" @@ -56,11 +57,13 @@ XbelWriter::XbelWriter(BookmarkModel *model) : QXmlStreamWriter() , treeModel(model) { + TRACE_OBJ setAutoFormatting(true); } void XbelWriter::writeToFile(QIODevice *device) { + TRACE_OBJ setDevice(device); writeStartDocument(); @@ -77,6 +80,7 @@ void XbelWriter::writeToFile(QIODevice *device) void XbelWriter::writeData(QStandardItem *child) { + TRACE_OBJ Bookmark entry; entry.title = child->data(Qt::DisplayRole).toString(); entry.url = child->data(Qt::UserRole + 10).toString(); @@ -111,12 +115,14 @@ XbelReader::XbelReader(BookmarkModel *tree, BookmarkModel *list) , treeModel(tree) , listModel(list) { + TRACE_OBJ folderIcon = QApplication::style()->standardIcon(QStyle::SP_DirClosedIcon); bookmarkIcon = QIcon(QLatin1String(":/trolltech/assistant/images/bookmark.png")); } bool XbelReader::readFromFile(QIODevice *device) { + TRACE_OBJ setDevice(device); while (!atEnd()) { @@ -138,6 +144,7 @@ bool XbelReader::readFromFile(QIODevice *device) void XbelReader::readXBEL() { + TRACE_OBJ while (!atEnd()) { readNext(); @@ -157,6 +164,7 @@ void XbelReader::readXBEL() void XbelReader::readUnknownElement() { + TRACE_OBJ while (!atEnd()) { readNext(); @@ -170,6 +178,7 @@ void XbelReader::readUnknownElement() void XbelReader::readFolder(QStandardItem *item) { + TRACE_OBJ QStandardItem *folder = createChildItem(item); folder->setIcon(folderIcon); folder->setData(QLatin1String("Folder"), Qt::UserRole + 10); @@ -199,6 +208,7 @@ void XbelReader::readFolder(QStandardItem *item) void XbelReader::readBookmark(QStandardItem *item) { + TRACE_OBJ QStandardItem *bookmark = createChildItem(item); bookmark->setIcon(bookmarkIcon); bookmark->setText(QCoreApplication::tr("Unknown title")); @@ -224,6 +234,7 @@ void XbelReader::readBookmark(QStandardItem *item) QStandardItem *XbelReader::createChildItem(QStandardItem *item) { + TRACE_OBJ QStandardItem *childItem = new QStandardItem(); childItem->setEditable(false); -- cgit v0.12