summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkh1 <qt-info@nokia.com>2010-06-02 10:16:18 (GMT)
committerkh1 <qt-info@nokia.com>2010-06-02 11:51:08 (GMT)
commit89f4deb6ae092c5d5fe91a169cb328288a87f146 (patch)
tree2509fda61aed1b0068884c6e5286fa42a3cc3fe6
parent43b67ba9d500af9de0594d7d2db3e3613dd00f22 (diff)
downloadQt-89f4deb6ae092c5d5fe91a169cb328288a87f146.zip
Qt-89f4deb6ae092c5d5fe91a169cb328288a87f146.tar.gz
Qt-89f4deb6ae092c5d5fe91a169cb328288a87f146.tar.bz2
Add missing trace, small cleanup.
Reviewed-by: ck
-rw-r--r--tools/assistant/tools/assistant/openpagesmanager.cpp8
-rw-r--r--tools/assistant/tools/assistant/openpagesmanager.h33
-rw-r--r--tools/assistant/tools/assistant/openpageswidget.cpp13
3 files changed, 34 insertions, 20 deletions
diff --git a/tools/assistant/tools/assistant/openpagesmanager.cpp b/tools/assistant/tools/assistant/openpagesmanager.cpp
index b6005e8..490fddd 100644
--- a/tools/assistant/tools/assistant/openpagesmanager.cpp
+++ b/tools/assistant/tools/assistant/openpagesmanager.cpp
@@ -181,11 +181,13 @@ HelpViewer *OpenPagesManager::createPage(const QUrl &url, bool fromSearch)
HelpViewer *OpenPagesManager::createNewPageFromSearch(const QUrl &url)
{
+ TRACE_OBJ
return createPage(url, true);
}
void OpenPagesManager::closePage(const QModelIndex &index)
{
+ TRACE_OBJ
if (index.isValid())
removePage(index.row());
}
@@ -282,23 +284,27 @@ void OpenPagesManager::closePagesExcept(const QModelIndex &index)
QAbstractItemView *OpenPagesManager::openPagesWidget() const
{
+ TRACE_OBJ
return m_openPagesWidget;
}
void OpenPagesManager::nextPage()
{
+ TRACE_OBJ
nextOrPreviousPage(1);
}
void OpenPagesManager::previousPage()
{
+ TRACE_OBJ
nextOrPreviousPage(-1);
}
void OpenPagesManager::nextOrPreviousPage(int offset)
{
+ TRACE_OBJ
setCurrentPage((CentralWidget::instance()->currentIndex() + offset
- + m_model->rowCount()) % m_model->rowCount());
+ + m_model->rowCount()) % m_model->rowCount());
}
OpenPagesManager *OpenPagesManager::m_instance = 0;
diff --git a/tools/assistant/tools/assistant/openpagesmanager.h b/tools/assistant/tools/assistant/openpagesmanager.h
index 5e7a9af..0ae3180 100644
--- a/tools/assistant/tools/assistant/openpagesmanager.h
+++ b/tools/assistant/tools/assistant/openpagesmanager.h
@@ -41,27 +41,27 @@
#ifndef OPENPAGESMANAGER_H
#define OPENPAGESMANAGER_H
-
+
#include <QtCore/QObject>
-
+
QT_BEGIN_NAMESPACE
class QAbstractItemView;
class QModelIndex;
class QUrl;
-
+
class HelpViewer;
class OpenPagesModel;
class OpenPagesWidget;
-
+
class OpenPagesManager : public QObject
- {
+{
Q_OBJECT
- public:
+public:
static OpenPagesManager *createInstance(QObject *parent,
- bool defaultCollection, const QUrl &cmdLineUrl);
+ bool defaultCollection, const QUrl &cmdLineUrl);
static OpenPagesManager *instance();
-
+
bool pagesOpenForNamespace(const QString &nameSpace) const;
void closePages(const QString &nameSpace);
void reloadPages(const QString &nameSpace);
@@ -71,7 +71,7 @@ class OpenPagesManager : public QObject
int pageCount() const;
void setCurrentPage(int index);
- public slots:
+public slots:
HelpViewer *createPage(const QUrl &url, bool fromSearch = false);
HelpViewer *createNewPageFromSearch(const QUrl &url);
HelpViewer *createPage();
@@ -86,19 +86,18 @@ private slots:
private:
OpenPagesManager(QObject *parent, bool defaultCollection,
- const QUrl &cmdLineUrl);
+ const QUrl &cmdLineUrl);
void setupInitialPages(bool defaultCollection, const QUrl &cmdLineUrl);
void closeOrReloadPages(const QString &nameSpace, bool tryReload);
void selectCurrentPage();
void removePage(int index);
void nextOrPreviousPage(int offset);
-
- OpenPagesModel *m_model;
- OpenPagesWidget *m_openPagesWidget;
+ OpenPagesModel *m_model;
+ OpenPagesWidget *m_openPagesWidget;
+
+ static OpenPagesManager *m_instance;
+};
- static OpenPagesManager *m_instance;
- };
-
QT_END_NAMESPACE
-
+
#endif // OPENPAGESMANAGER_H
diff --git a/tools/assistant/tools/assistant/openpageswidget.cpp b/tools/assistant/tools/assistant/openpageswidget.cpp
index d702c28..1a5c292 100644
--- a/tools/assistant/tools/assistant/openpageswidget.cpp
+++ b/tools/assistant/tools/assistant/openpageswidget.cpp
@@ -42,6 +42,7 @@
#include "openpageswidget.h"
#include "openpagesmodel.h"
+#include "tracer.h"
#include <QtGui/QApplication>
#include <QtGui/QHeaderView>
@@ -57,13 +58,15 @@
QT_BEGIN_NAMESPACE
OpenPagesDelegate::OpenPagesDelegate(QObject *parent)
- : QStyledItemDelegate(parent)
+ : QStyledItemDelegate(parent)
{
+ TRACE_OBJ
}
void OpenPagesDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
+ TRACE_OBJ
if (option.state & QStyle::State_MouseOver) {
if ((QApplication::mouseButtons() & Qt::LeftButton) == 0)
pressedIndex = QModelIndex();
@@ -90,6 +93,7 @@ void OpenPagesDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opt
OpenPagesWidget::OpenPagesWidget(OpenPagesModel *model)
{
+ TRACE_OBJ
setModel(model);
setIndentation(0);
setItemDelegate((m_delegate = new OpenPagesDelegate(this)));
@@ -122,10 +126,12 @@ OpenPagesWidget::OpenPagesWidget(OpenPagesModel *model)
OpenPagesWidget::~OpenPagesWidget()
{
+ TRACE_OBJ
}
void OpenPagesWidget::contextMenuRequested(QPoint pos)
{
+ TRACE_OBJ
QModelIndex index = indexAt(pos);
if (!index.isValid())
return;
@@ -152,6 +158,7 @@ void OpenPagesWidget::contextMenuRequested(QPoint pos)
void OpenPagesWidget::handlePressed(const QModelIndex &index)
{
+ TRACE_OBJ
if (index.column() == 0)
emit setCurrentPage(index);
@@ -161,7 +168,8 @@ void OpenPagesWidget::handlePressed(const QModelIndex &index)
void OpenPagesWidget::handleClicked(const QModelIndex &index)
{
- // implemented here to handle the funky close button and to work around a
+ TRACE_OBJ
+ // implemented here to handle the funky close button and to work around a
// bug in item views where the delegate wouldn't get the QStyle::State_MouseOver
if (index.column() == 1) {
if (model()->rowCount() > 1)
@@ -177,6 +185,7 @@ void OpenPagesWidget::handleClicked(const QModelIndex &index)
bool OpenPagesWidget::eventFilter(QObject *obj, QEvent *event)
{
+ TRACE_OBJ
if (obj == this && event->type() == QEvent::KeyPress) {
if (currentIndex().isValid()) {
QKeyEvent *ke = static_cast<QKeyEvent*>(event);