summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@nokia.com>2009-07-16 12:46:11 +0200
committerErik Verbruggen <erik.verbruggen@nokia.com>2009-07-16 12:46:11 +0200
commitbe69b8256ae4baec1feaa9a33f69d5cb0fb3839a (patch)
treeaabe7281c2f7e90d471421b53f0b41cd29bd146a
parentef58d082ea6498f3c2bafeb68d8bd2359ec241c1 (diff)
parent200b06581ab725c33c08e66062c7c56edb4c5ed3 (diff)
downloadqt-creator-be69b8256ae4baec1feaa9a33f69d5cb0fb3839a.tar.gz
Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline
-rw-r--r--share/qtcreator/gdbmacros/gdbmacros.cpp13
-rw-r--r--share/qtcreator/gdbmacros/test/main.cpp2
-rw-r--r--src/plugins/debugger/watchutils.cpp10
-rw-r--r--src/plugins/genericprojectmanager/genericprojectnodes.cpp2
-rw-r--r--src/plugins/projectexplorer/taskwindow.cpp126
-rw-r--r--src/plugins/projectexplorer/taskwindow.h4
6 files changed, 126 insertions, 31 deletions
diff --git a/share/qtcreator/gdbmacros/gdbmacros.cpp b/share/qtcreator/gdbmacros/gdbmacros.cpp
index b93bb69a4a..9a92062d24 100644
--- a/share/qtcreator/gdbmacros/gdbmacros.cpp
+++ b/share/qtcreator/gdbmacros/gdbmacros.cpp
@@ -2744,6 +2744,9 @@ static void qDumpQTextCodec(QDumper &d)
static void qDumpQVector(QDumper &d)
{
+ QVectorTypedData<int> *dummy = 0;
+ const unsigned typeddatasize = (char*)(&dummy->array) - (char*)dummy;
+
QVectorData *v = *reinterpret_cast<QVectorData *const*>(d.data);
// Try to provoke segfaults early to prevent the frontend
@@ -2756,8 +2759,7 @@ static void qDumpQVector(QDumper &d)
//qCheckAccess(&vec.back());
}
- unsigned innersize = d.extraInt[0];
- unsigned typeddatasize = d.extraInt[1];
+ const unsigned innersize = d.extraInt[0];
int n = nn;
d.putItemCount("value", n);
@@ -3348,7 +3350,8 @@ void *watchPoint(int x, int y)
}
#endif
-// Helper to write out common expression values for CDB:
+// Helpers to write out common expression values for CDB
+#ifdef Q_CC_MSVC
// Offsets of a map node value which looks like
// "(size_t)&(('QMapNode<QString,QString >'*)0)->value")" in gdb syntax
@@ -3394,6 +3397,8 @@ template <class Key, class Value>
return d;
}
+#endif // Q_CC_MSVC
+
extern "C" Q_DECL_EXPORT
void *qDumpObjectData440(
int protocolVersion,
@@ -3515,6 +3520,7 @@ void *qDumpObjectData440(
.put(NS"QMapNode<"NS"QString,"NS"QVariant>=\"").put(sizeof(QMapNode<QString, QVariant>))
.put("\"}");
// Write out common expression values for CDB
+#ifdef Q_CC_MSVC
d.put(",expressions={");
putQMapNodeOffsetExpression<int,int>("int", "int", d).put(',');
putQMapNodeOffsetExpression<int,QString>("int", NS"QString", d).put(',');
@@ -3534,6 +3540,7 @@ void *qDumpObjectData440(
putStdPairValueOffsetExpression<int,std::wstring>("int", stdWideStringTypeUShortC, d).put(',');
putStdPairValueOffsetExpression<std::wstring,int>(stdWideStringTypeUShortC, "int", d);
d.put('}');
+#endif // Q_CC_MSVC
d.disarm();
}
diff --git a/share/qtcreator/gdbmacros/test/main.cpp b/share/qtcreator/gdbmacros/test/main.cpp
index 8b24d55aca..22f68e1a3c 100644
--- a/share/qtcreator/gdbmacros/test/main.cpp
+++ b/share/qtcreator/gdbmacros/test/main.cpp
@@ -140,7 +140,7 @@ static int dumpQIntList()
static int dumpQIntVector()
{
- QVector<int> test = QVector<int>() << 1 << 2;
+ QVector<int> test = QVector<int>() << 42 << 43;
prepareInBuffer("QVector", "local.qintvector", "local.qintvector", "int");
qDumpObjectData440(2, 42, testAddress(&test), 1, sizeof(int), 0, 0, 0);
fputs(qDumpOutBuffer, stdout);
diff --git a/src/plugins/debugger/watchutils.cpp b/src/plugins/debugger/watchutils.cpp
index d6daad1551..490fd2a64a 100644
--- a/src/plugins/debugger/watchutils.cpp
+++ b/src/plugins/debugger/watchutils.cpp
@@ -798,7 +798,6 @@ QtDumperHelper::ExpressionRequirement QtDumperHelper::expressionRequirements(Typ
switch (t) {
case QAbstractItemType:
- case QVectorType:
return NeedsComplexExpression;
case QMapType:
case QMultiMapType:
@@ -1353,14 +1352,6 @@ void QtDumperHelper::evaluationParameters(const WatchData &data,
case QAbstractItemType:
inner = data.addr.mid(1);
break;
- case QVectorType:
- if (m_qtVersion >= 0x040600)
- extraArgs[1] = QString("(char*)&((%1).p->array)-(char*)((%2).p)")
- .arg(data.exp).arg(data.exp);
- else
- extraArgs[1] = QString("(char*)&((%1).d->array)-(char*)((%2).d)")
- .arg(data.exp).arg(data.exp);
- break;
case QObjectSlotType:
case QObjectSignalType: {
// we need the number out of something like
@@ -1453,6 +1444,7 @@ void QtDumperHelper::evaluationParameters(const WatchData &data,
qWarning("Unknown type encountered in %s.\n", Q_FUNC_INFO);
break;
case SupportedType:
+ case QVectorType:
case QObjectType:
case QWidgetType:
break;
diff --git a/src/plugins/genericprojectmanager/genericprojectnodes.cpp b/src/plugins/genericprojectmanager/genericprojectnodes.cpp
index d9e4d3155c..c40b8e42fc 100644
--- a/src/plugins/genericprojectmanager/genericprojectnodes.cpp
+++ b/src/plugins/genericprojectmanager/genericprojectnodes.cpp
@@ -95,7 +95,7 @@ void GenericProjectNode::refresh()
QFileInfo fileInfo(absoluteFileName);
const QString absoluteFilePath = fileInfo.path();
- QString baseDir(QFileInfo(path()).absolutePath());
+ QString baseDir = QFileInfo(path()).absolutePath();
if (! absoluteFilePath.startsWith(baseDir))
continue; // `file' is not part of the project.
diff --git a/src/plugins/projectexplorer/taskwindow.cpp b/src/plugins/projectexplorer/taskwindow.cpp
index 9f3780d9a9..3a8b84d4c5 100644
--- a/src/plugins/projectexplorer/taskwindow.cpp
+++ b/src/plugins/projectexplorer/taskwindow.cpp
@@ -46,6 +46,7 @@
#include <QtGui/QListView>
#include <QtGui/QPainter>
#include <QtCore/QAbstractItemModel>
+#include <QtGui/QSortFilterProxyModel>
#include <QtGui/QApplication>
#include <QtGui/QClipboard>
#include <QtGui/QFont>
@@ -93,6 +94,32 @@ private:
QIcon m_unspecifiedIcon;
};
+class ProjectExplorer::Internal::TaskFilterModel : public QSortFilterProxyModel
+{
+public:
+ TaskFilterModel(TaskModel *sourceModel, QObject *parent = 0);
+
+ TaskModel *taskModel() const;
+
+ bool filterIncludesUnknowns() const { return m_includeUnknowns; }
+ void setFilterIncludesUnknowns(bool b) { m_includeUnknowns = b; invalidateFilter(); }
+
+ bool filterIncludesWarnings() const { return m_includeWarnings; }
+ void setFilterIncludesWarnings(bool b) { m_includeWarnings = b; invalidateFilter(); }
+
+ bool filterIncludesErrors() const { return m_includeErrors; }
+ void setFilterIncludesErrors(bool b) { m_includeErrors = b; invalidateFilter(); }
+
+protected:
+ bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
+
+private:
+ // These correspond to ProjectExplorer::BuildParserInterface::PatternType.
+ bool m_includeUnknowns;
+ bool m_includeWarnings;
+ bool m_includeErrors;
+};
+
////
// TaskView
////
@@ -242,17 +269,70 @@ void TaskModel::setFileNotFound(const QModelIndex &idx, bool b)
}
/////
+// TaskFilterModel
+/////
+
+TaskFilterModel::TaskFilterModel(TaskModel *sourceModel, QObject *parent)
+ : QSortFilterProxyModel(parent)
+{
+ setSourceModel(sourceModel);
+ setDynamicSortFilter(true);
+ m_includeUnknowns = m_includeWarnings = m_includeErrors = true;
+}
+
+TaskModel *TaskFilterModel::taskModel() const
+{
+ return static_cast<TaskModel*>(sourceModel());
+}
+
+bool TaskFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
+{
+ QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
+ ProjectExplorer::BuildParserInterface::PatternType type = ProjectExplorer::BuildParserInterface::PatternType(index.data(TaskModel::Type).toInt());
+ switch (type) {
+ case ProjectExplorer::BuildParserInterface::Unknown:
+ return m_includeUnknowns;
+
+ case ProjectExplorer::BuildParserInterface::Warning:
+ return m_includeWarnings;
+
+ case ProjectExplorer::BuildParserInterface::Error:
+ return m_includeErrors;
+ }
+
+ // Not one of the three supported types -- shouldn't happen, but we'll let it slide.
+ return true;
+}
+
+/////
// TaskWindow
/////
+static QToolButton *createFilterButton(ProjectExplorer::BuildParserInterface::PatternType type,
+ const QString &toolTip, TaskModel *model,
+ QObject *receiver, const char *slot)
+{
+ QToolButton *button = new QToolButton;
+ button->setIcon(model->iconFor(type));
+ button->setProperty("type", "dockbutton");
+ button->setToolTip(toolTip);
+ button->setCheckable(true);
+ button->setChecked(true);
+ button->setAutoRaise(true);
+ button->setEnabled(true);
+ QObject::connect(button, SIGNAL(toggled(bool)), receiver, slot);
+ return button;
+}
+
TaskWindow::TaskWindow()
{
Core::ICore *core = Core::ICore::instance();
m_model = new TaskModel;
+ m_filter = new TaskFilterModel(m_model);
m_listview = new TaskView;
- m_listview->setModel(m_model);
+ m_listview->setModel(m_filter);
m_listview->setFrameStyle(QFrame::NoFrame);
m_listview->setWindowTitle(tr("Build Issues"));
m_listview->setSelectionMode(QAbstractItemView::SingleSelection);
@@ -280,6 +360,10 @@ TaskWindow::TaskWindow()
connect(m_copyAction, SIGNAL(triggered()), SLOT(copy()));
+ m_filterWarningsButton = createFilterButton(ProjectExplorer::BuildParserInterface::Warning,
+ tr("Show Warnings"), m_model,
+ this, SLOT(setShowWarnings(bool)));
+
m_errorCount = 0;
m_currentTask = -1;
}
@@ -287,13 +371,15 @@ TaskWindow::TaskWindow()
TaskWindow::~TaskWindow()
{
Core::ICore::instance()->removeContextObject(m_taskWindowContext);
+ delete m_filterWarningsButton;
delete m_listview;
+ delete m_filter;
delete m_model;
}
QList<QWidget*> TaskWindow::toolBarWidgets() const
{
- return QList<QWidget*>();
+ return QList<QWidget*>() << m_filterWarningsButton;
}
QWidget *TaskWindow::outputWidget(QWidget *)
@@ -366,6 +452,12 @@ void TaskWindow::copy()
QApplication::clipboard()->setText(file + ':' + line + ": " + type + description);
}
+void TaskWindow::setShowWarnings(bool show)
+{
+ m_filter->setFilterIncludesWarnings(show);
+ m_filter->setFilterIncludesUnknowns(show); // "Unknowns" are often associated with warnings
+}
+
int TaskWindow::numberOfTasks() const
{
return m_model->rowCount(QModelIndex());
@@ -388,41 +480,41 @@ bool TaskWindow::hasFocus()
bool TaskWindow::canFocus()
{
- return m_model->rowCount();
+ return m_filter->rowCount();
}
void TaskWindow::setFocus()
{
- if (m_model->rowCount()) {
+ if (m_filter->rowCount()) {
m_listview->setFocus();
if (m_listview->currentIndex() == QModelIndex()) {
- m_listview->setCurrentIndex(m_model->index(0,0, QModelIndex()));
+ m_listview->setCurrentIndex(m_filter->index(0,0, QModelIndex()));
}
}
}
bool TaskWindow::canNext()
{
- return m_model->rowCount();
+ return m_filter->rowCount();
}
bool TaskWindow::canPrevious()
{
- return m_model->rowCount();
+ return m_filter->rowCount();
}
void TaskWindow::goToNext()
{
- if (!m_model->rowCount())
+ if (!m_filter->rowCount())
return;
QModelIndex currentIndex = m_listview->currentIndex();
if (currentIndex.isValid()) {
int row = currentIndex.row() + 1;
- if (row == m_model->rowCount())
+ if (row == m_filter->rowCount())
row = 0;
- currentIndex = m_model->index(row, 0);
+ currentIndex = m_filter->index(row, 0);
} else {
- currentIndex = m_model->index(0, 0);
+ currentIndex = m_filter->index(0, 0);
}
m_listview->setCurrentIndex(currentIndex);
showTaskInFile(currentIndex);
@@ -430,16 +522,16 @@ void TaskWindow::goToNext()
void TaskWindow::goToPrev()
{
- if (!m_model->rowCount())
+ if (!m_filter->rowCount())
return;
QModelIndex currentIndex = m_listview->currentIndex();
if (currentIndex.isValid()) {
int row = currentIndex.row() -1;
if (row < 0)
- row = m_model->rowCount() - 1;
- currentIndex = m_model->index(row, 0);
+ row = m_filter->rowCount() - 1;
+ currentIndex = m_filter->index(row, 0);
} else {
- currentIndex = m_model->index(m_model->rowCount()-1, 0);
+ currentIndex = m_filter->index(m_filter->rowCount()-1, 0);
}
m_listview->setCurrentIndex(currentIndex);
showTaskInFile(currentIndex);
@@ -475,7 +567,7 @@ QSize TaskDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelInd
QSize s;
s.setWidth(option.rect.width());
const QAbstractItemView * view = qobject_cast<const QAbstractItemView *>(opt.widget);
- TaskModel *model = static_cast<TaskModel *>(view->model());
+ TaskModel *model = static_cast<TaskFilterModel *>(view->model())->taskModel();
int width = opt.rect.width() - model->sizeOfFile() - model->sizeOfLineNumber() - 12 - 22;
if (view->selectionModel()->currentIndex() == index) {
QString description = index.data(TaskModel::Description).toString();
@@ -544,7 +636,7 @@ void TaskDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
painter->setPen(textColor);
- TaskModel *model = static_cast<TaskModel *>(view->model());
+ TaskModel *model = static_cast<TaskFilterModel *>(view->model())->taskModel();
ProjectExplorer::BuildParserInterface::PatternType type = ProjectExplorer::BuildParserInterface::PatternType(index.data(TaskModel::Type).toInt());
QIcon icon = model->iconFor(type);
painter->drawPixmap(2, opt.rect.top() + 2, icon.pixmap(16, 16));
diff --git a/src/plugins/projectexplorer/taskwindow.h b/src/plugins/projectexplorer/taskwindow.h
index 7d45006776..809b7efe82 100644
--- a/src/plugins/projectexplorer/taskwindow.h
+++ b/src/plugins/projectexplorer/taskwindow.h
@@ -44,6 +44,7 @@ namespace ProjectExplorer {
namespace Internal {
class TaskModel;
+class TaskFilterModel;
class TaskView;
class TaskWindowContext;
@@ -85,6 +86,7 @@ signals:
private slots:
void showTaskInFile(const QModelIndex &index);
void copy();
+ void setShowWarnings(bool);
private:
int sizeHintForColumn(int column) const;
@@ -93,9 +95,11 @@ private:
int m_currentTask;
TaskModel *m_model;
+ TaskFilterModel *m_filter;
TaskView *m_listview;
TaskWindowContext *m_taskWindowContext;
QAction *m_copyAction;
+ QToolButton *m_filterWarningsButton;
};
class TaskView : public QListView