2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2011-03-04 12:15:19 +01:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** Copyright (C) 2015 The Qt Company Ltd.
|
|
|
|
|
** Contact: http://www.qt.io/licensing
|
2011-03-04 12:15:19 +01:00
|
|
|
** Author: Andreas Hartmetz, KDAB (andreas.hartmetz@kdab.com)
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2011-03-04 12:15:19 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2015-01-14 18:07:15 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms and
|
|
|
|
|
** conditions see http://www.qt.io/terms-conditions. For further information
|
2014-10-01 13:21:18 +02:00
|
|
|
** use the contact form at http://www.qt.io/contact-us.
|
2011-03-04 12:15:19 +01:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
2014-10-01 13:21:18 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2011-03-04 12:15:19 +01:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
|
|
|
** rights. These rights are described in The Qt Company LGPL Exception
|
2011-03-04 12:15:19 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2011-03-04 12:15:19 +01:00
|
|
|
|
|
|
|
|
#include "memcheckerrorview.h"
|
|
|
|
|
|
|
|
|
|
#include "suppressiondialog.h"
|
2011-05-23 13:50:28 +02:00
|
|
|
#include "valgrindsettings.h"
|
2011-03-04 12:15:19 +01:00
|
|
|
|
2011-07-13 14:58:54 +02:00
|
|
|
#include "xmlprotocol/error.h"
|
|
|
|
|
#include "xmlprotocol/errorlistmodel.h"
|
|
|
|
|
#include "xmlprotocol/frame.h"
|
|
|
|
|
#include "xmlprotocol/stack.h"
|
|
|
|
|
#include "xmlprotocol/modelhelpers.h"
|
|
|
|
|
#include "xmlprotocol/suppression.h"
|
2011-03-04 12:15:19 +01:00
|
|
|
|
2013-05-30 17:26:51 +02:00
|
|
|
#include <coreplugin/editormanager/editormanager.h>
|
2011-03-04 12:15:19 +01:00
|
|
|
#include <projectexplorer/project.h>
|
2013-05-30 17:26:51 +02:00
|
|
|
#include <projectexplorer/projectexplorer.h>
|
2013-09-05 11:46:07 +02:00
|
|
|
#include <projectexplorer/session.h>
|
2011-03-04 12:15:19 +01:00
|
|
|
#include <utils/qtcassert.h>
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QAction>
|
2011-03-04 12:15:19 +01:00
|
|
|
|
|
|
|
|
using namespace Valgrind::XmlProtocol;
|
|
|
|
|
|
2011-05-23 13:50:28 +02:00
|
|
|
namespace Valgrind {
|
2011-05-18 17:05:49 +02:00
|
|
|
namespace Internal {
|
|
|
|
|
|
2011-03-04 12:15:19 +01:00
|
|
|
MemcheckErrorView::MemcheckErrorView(QWidget *parent)
|
2014-10-09 17:04:22 +02:00
|
|
|
: Analyzer::DetailedErrorView(parent),
|
2011-03-04 12:15:19 +01:00
|
|
|
m_settings(0)
|
|
|
|
|
{
|
2011-03-04 16:00:04 +01:00
|
|
|
m_suppressAction = new QAction(this);
|
|
|
|
|
m_suppressAction->setText(tr("Suppress Error"));
|
2015-02-16 15:34:28 +01:00
|
|
|
m_suppressAction->setIcon(QIcon(QLatin1String(":/valgrind/images/eye_crossed.png")));
|
2011-03-04 16:00:04 +01:00
|
|
|
m_suppressAction->setShortcut(QKeySequence(Qt::Key_Delete));
|
|
|
|
|
m_suppressAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
2014-10-09 17:04:22 +02:00
|
|
|
connect(m_suppressAction, &QAction::triggered, this, &MemcheckErrorView::suppressError);
|
2011-03-04 16:00:04 +01:00
|
|
|
addAction(m_suppressAction);
|
2011-03-04 12:15:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MemcheckErrorView::~MemcheckErrorView()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MemcheckErrorView::setDefaultSuppressionFile(const QString &suppFile)
|
|
|
|
|
{
|
|
|
|
|
m_defaultSuppFile = suppFile;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString MemcheckErrorView::defaultSuppressionFile() const
|
|
|
|
|
{
|
|
|
|
|
return m_defaultSuppFile;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// slot, can (for now) be invoked either when the settings were modified *or* when the active
|
|
|
|
|
// settings object has changed.
|
2013-08-08 17:37:37 +02:00
|
|
|
void MemcheckErrorView::settingsChanged(ValgrindBaseSettings *settings)
|
2011-03-04 12:15:19 +01:00
|
|
|
{
|
|
|
|
|
QTC_ASSERT(settings, return);
|
|
|
|
|
m_settings = settings;
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-11 16:12:58 +01:00
|
|
|
void MemcheckErrorView::suppressError()
|
|
|
|
|
{
|
|
|
|
|
SuppressionDialog::maybeShow(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QList<QAction *> MemcheckErrorView::customActions() const
|
2011-03-04 12:15:19 +01:00
|
|
|
{
|
2015-02-11 16:12:58 +01:00
|
|
|
QList<QAction *> actions;
|
2011-03-04 12:15:19 +01:00
|
|
|
const QModelIndexList indizes = selectionModel()->selectedRows();
|
2015-02-11 16:12:58 +01:00
|
|
|
QTC_ASSERT(!indizes.isEmpty(), return actions);
|
2011-03-04 16:00:04 +01:00
|
|
|
|
2015-02-11 16:12:58 +01:00
|
|
|
bool hasErrors = false;
|
2011-05-11 16:26:34 +02:00
|
|
|
foreach (const QModelIndex &index, indizes) {
|
2011-03-04 12:15:19 +01:00
|
|
|
Error error = model()->data(index, ErrorListModel::ErrorRole).value<Error>();
|
2015-02-11 16:12:58 +01:00
|
|
|
if (!error.suppression().isNull()) {
|
|
|
|
|
hasErrors = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2011-03-04 12:15:19 +01:00
|
|
|
}
|
2015-02-11 16:12:58 +01:00
|
|
|
m_suppressAction->setEnabled(hasErrors);
|
|
|
|
|
actions << m_suppressAction;
|
|
|
|
|
return actions;
|
2011-03-04 12:15:19 +01:00
|
|
|
}
|
2011-05-18 17:05:49 +02:00
|
|
|
|
|
|
|
|
} // namespace Internal
|
2011-05-23 13:50:28 +02:00
|
|
|
} // namespace Valgrind
|