2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2011-03-04 12:15:19 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
2011-03-04 12:15:19 +01:00
|
|
|
** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
|
2016-01-15 14:57:40 +01:00
|
|
|
** Contact: https://www.qt.io/licensing/
|
2011-03-04 12:15:19 +01:00
|
|
|
**
|
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
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2011-03-04 12:15:19 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2011-03-04 12:15:19 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2011-03-04 12:15:19 +01:00
|
|
|
|
2011-05-23 13:50:28 +02:00
|
|
|
#include "valgrindplugin.h"
|
2011-07-04 10:50:44 +02:00
|
|
|
|
|
|
|
|
#include "callgrindtool.h"
|
|
|
|
|
#include "memchecktool.h"
|
2013-07-19 16:08:54 +02:00
|
|
|
#include "valgrindruncontrolfactory.h"
|
2013-08-08 11:55:54 +02:00
|
|
|
#include "valgrindsettings.h"
|
2013-08-12 17:04:10 +02:00
|
|
|
#include "valgrindconfigwidget.h"
|
2011-03-04 12:15:19 +01:00
|
|
|
|
2013-08-08 17:37:37 +02:00
|
|
|
#include <coreplugin/dialogs/ioptionspage.h>
|
2013-08-08 11:55:54 +02:00
|
|
|
#include <coreplugin/icontext.h>
|
|
|
|
|
#include <coreplugin/icore.h>
|
2013-08-08 17:37:37 +02:00
|
|
|
|
2015-06-18 09:35:41 +02:00
|
|
|
#include <projectexplorer/projectexplorer.h>
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QtPlugin>
|
2013-08-08 17:37:37 +02:00
|
|
|
#include <QCoreApplication>
|
2013-12-03 14:17:03 +01:00
|
|
|
#include <QPointer>
|
2011-03-04 12:15:19 +01:00
|
|
|
|
2015-06-17 17:12:36 +02:00
|
|
|
using namespace Core;
|
2015-06-18 09:35:41 +02:00
|
|
|
using namespace ProjectExplorer;
|
2011-07-04 10:50:44 +02:00
|
|
|
|
|
|
|
|
namespace Valgrind {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2013-08-08 17:37:37 +02:00
|
|
|
static ValgrindGlobalSettings *theGlobalSettings = 0;
|
|
|
|
|
|
2015-06-17 17:12:36 +02:00
|
|
|
class ValgrindOptionsPage : public IOptionsPage
|
2013-08-08 11:25:28 +02:00
|
|
|
{
|
2013-08-08 17:37:37 +02:00
|
|
|
public:
|
|
|
|
|
explicit ValgrindOptionsPage()
|
2013-08-08 11:25:28 +02:00
|
|
|
{
|
2013-08-08 17:37:37 +02:00
|
|
|
setId(ANALYZER_VALGRIND_SETTINGS);
|
2013-08-23 16:25:16 +02:00
|
|
|
setDisplayName(QCoreApplication::translate("Valgrind::Internal::ValgrindOptionsPage", "Valgrind"));
|
2013-08-08 17:37:37 +02:00
|
|
|
setCategory("T.Analyzer");
|
|
|
|
|
setDisplayCategory(QCoreApplication::translate("Analyzer", "Analyzer"));
|
|
|
|
|
setCategoryIcon(QLatin1String(":/images/analyzer_category.png"));
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-03 14:17:03 +01:00
|
|
|
QWidget *widget()
|
|
|
|
|
{
|
|
|
|
|
if (!m_widget)
|
|
|
|
|
m_widget = new ValgrindConfigWidget(theGlobalSettings, 0, true);
|
|
|
|
|
return m_widget;
|
2013-08-08 17:37:37 +02:00
|
|
|
}
|
|
|
|
|
|
2013-12-03 14:17:03 +01:00
|
|
|
void apply()
|
|
|
|
|
{
|
2013-08-08 17:37:37 +02:00
|
|
|
theGlobalSettings->writeSettings();
|
2013-08-08 11:25:28 +02:00
|
|
|
}
|
2013-12-03 14:17:03 +01:00
|
|
|
|
|
|
|
|
void finish()
|
|
|
|
|
{
|
|
|
|
|
delete m_widget;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QPointer<QWidget> m_widget;
|
2013-08-08 11:25:28 +02:00
|
|
|
};
|
|
|
|
|
|
2013-08-08 17:37:37 +02:00
|
|
|
ValgrindPlugin::~ValgrindPlugin()
|
|
|
|
|
{
|
|
|
|
|
delete theGlobalSettings;
|
|
|
|
|
theGlobalSettings = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-23 13:50:28 +02:00
|
|
|
bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
2011-03-04 12:15:19 +01:00
|
|
|
{
|
2016-03-02 12:05:30 +01:00
|
|
|
theGlobalSettings = new ValgrindGlobalSettings;
|
2013-08-08 17:37:37 +02:00
|
|
|
theGlobalSettings->readSettings();
|
|
|
|
|
|
2016-03-02 12:05:30 +01:00
|
|
|
addAutoReleasedObject(new ValgrindOptionsPage);
|
2013-08-05 18:00:36 +02:00
|
|
|
|
2015-06-17 17:12:36 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
2013-08-08 11:55:54 +02:00
|
|
|
|
2015-06-17 17:12:36 +02:00
|
|
|
void ValgrindPlugin::extensionsInitialized()
|
|
|
|
|
{
|
2016-03-07 17:33:58 +01:00
|
|
|
initMemcheckTool();
|
|
|
|
|
initCallgrindTool();
|
2016-03-02 12:05:30 +01:00
|
|
|
}
|
2013-08-07 19:47:30 +02:00
|
|
|
|
2016-03-02 12:05:30 +01:00
|
|
|
ExtensionSystem::IPlugin::ShutdownFlag ValgrindPlugin::aboutToShutdown()
|
|
|
|
|
{
|
|
|
|
|
destroyCallgrindTool();
|
|
|
|
|
destroyMemcheckTool();
|
|
|
|
|
return SynchronousShutdown;
|
2013-08-08 11:55:54 +02:00
|
|
|
}
|
|
|
|
|
|
2015-06-17 17:12:36 +02:00
|
|
|
ValgrindGlobalSettings *ValgrindPlugin::globalSettings()
|
|
|
|
|
{
|
2016-03-02 12:05:30 +01:00
|
|
|
return theGlobalSettings;
|
2015-06-17 17:12:36 +02:00
|
|
|
}
|
|
|
|
|
|
2011-07-04 10:50:44 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Valgrind
|