Commit 86b50c57 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Analyzer: String constant and include cleanup.

parent ddf4b613
......@@ -40,9 +40,9 @@
#include <utils/qtcassert.h>
#include <QPainter>
#include <QDebug>
#include <QApplication>
#include <QtGui/QPainter>
#include <QtGui/QApplication>
#include <QtCore/QDebug>
using namespace Valgrind::Callgrind;
......
......@@ -34,8 +34,8 @@
#include "callgrindhelper.h"
#include <QApplication>
#include <QPainter>
#include <QtGui/QApplication>
#include <QtGui/QPainter>
namespace Callgrind {
namespace Internal {
......
......@@ -37,8 +37,8 @@
#include <analyzerbase/analyzermanager.h>
#include <QStringList>
#include <QtPlugin>
#include <QtCore/QStringList>
#include <QtCore/QtPlugin>
using namespace Analyzer;
using namespace Callgrind;
......
......@@ -34,20 +34,20 @@
#include "callgrindconfigwidget.h"
#include <QDebug>
#include <QtCore/QDebug>
using namespace Analyzer;
using namespace Callgrind::Internal;
using namespace Callgrind;
static const QLatin1String callgrindEnableCacheSimC("Analyzer.Valgrind.Callgrind.EnableCacheSim");
static const QLatin1String callgrindEnableBranchSimC("Analyzer.Valgrind.Callgrind.EnableBranchSim");
static const QLatin1String callgrindCollectSystimeC("Analyzer.Valgrind.Callgrind.CollectSystime");
static const QLatin1String callgrindCollectBusEventsC("Analyzer.Valgrind.Callgrind.CollectBusEvents");
static const char callgrindEnableCacheSimC[] = "Analyzer.Valgrind.Callgrind.EnableCacheSim";
static const char callgrindEnableBranchSimC[] = "Analyzer.Valgrind.Callgrind.EnableBranchSim";
static const char callgrindCollectSystimeC[] = "Analyzer.Valgrind.Callgrind.CollectSystime";
static const char callgrindCollectBusEventsC[] = "Analyzer.Valgrind.Callgrind.CollectBusEvents";
static const QLatin1String callgrindCycleDetectionC("Analyzer.Valgrind.Callgrind.CycleDetection");
static const QLatin1String callgrindCostFormatC("Analyzer.Valgrind.Callgrind.CostFormat");
static const QLatin1String callgrindMinimumCostRatioC("Analyzer.Valgrind.Callgrind.MinimumCostRatio");
static const char callgrindCycleDetectionC[] = "Analyzer.Valgrind.Callgrind.CycleDetection";
static const char callgrindCostFormatC[] = "Analyzer.Valgrind.Callgrind.CostFormat";
static const char callgrindMinimumCostRatioC[] = "Analyzer.Valgrind.Callgrind.MinimumCostRatio";
AbstractCallgrindSettings::AbstractCallgrindSettings(QObject *parent)
: AbstractAnalyzerSubConfig(parent)
......@@ -99,36 +99,36 @@ void AbstractCallgrindSettings::setCollectBusEvents(bool collect)
QVariantMap AbstractCallgrindSettings::defaults() const
{
QVariantMap map;
map.insert(callgrindEnableCacheSimC, false);
map.insert(callgrindEnableBranchSimC, false);
map.insert(callgrindCollectSystimeC, false);
map.insert(callgrindCollectBusEventsC, false);
map.insert(QLatin1String(callgrindEnableCacheSimC), false);
map.insert(QLatin1String(callgrindEnableBranchSimC), false);
map.insert(QLatin1String(callgrindCollectSystimeC), false);
map.insert(QLatin1String(callgrindCollectBusEventsC), false);
return map;
}
bool AbstractCallgrindSettings::fromMap(const QVariantMap &map)
{
setIfPresent(map, callgrindEnableCacheSimC, &m_enableCacheSim);
setIfPresent(map, callgrindEnableBranchSimC, &m_enableBranchSim);
setIfPresent(map, callgrindCollectSystimeC, &m_collectSystime);
setIfPresent(map, callgrindCollectBusEventsC, &m_collectBusEvents);
setIfPresent(map, QLatin1String(callgrindEnableCacheSimC), &m_enableCacheSim);
setIfPresent(map, QLatin1String(callgrindEnableBranchSimC), &m_enableBranchSim);
setIfPresent(map, QLatin1String(callgrindCollectSystimeC), &m_collectSystime);
setIfPresent(map, QLatin1String(callgrindCollectBusEventsC), &m_collectBusEvents);
return true;
}
QVariantMap AbstractCallgrindSettings::toMap() const
{
QVariantMap map;
map.insert(callgrindEnableCacheSimC, m_enableCacheSim);
map.insert(callgrindEnableBranchSimC, m_enableBranchSim);
map.insert(callgrindCollectSystimeC, m_collectSystime);
map.insert(callgrindCollectBusEventsC, m_collectBusEvents);
map.insert(QLatin1String(callgrindEnableCacheSimC), m_enableCacheSim);
map.insert(QLatin1String(callgrindEnableBranchSimC), m_enableBranchSim);
map.insert(QLatin1String(callgrindCollectSystimeC), m_collectSystime);
map.insert(QLatin1String(callgrindCollectBusEventsC), m_collectBusEvents);
return map;
}
QString AbstractCallgrindSettings::id() const
{
return "Analyzer.Valgrind.Settings.Callgrind";
return QLatin1String("Analyzer.Valgrind.Settings.Callgrind");
}
QString AbstractCallgrindSettings::displayName() const
......@@ -156,9 +156,9 @@ CallgrindGlobalSettings::~CallgrindGlobalSettings()
QVariantMap CallgrindGlobalSettings::defaults() const
{
QVariantMap map = AbstractCallgrindSettings::defaults();
map.insert(callgrindCostFormatC, CostDelegate::FormatRelative);
map.insert(callgrindCycleDetectionC, true);
map.insert(callgrindMinimumCostRatioC, 0.0001);
map.insert(QLatin1String(callgrindCostFormatC), CostDelegate::FormatRelative);
map.insert(QLatin1String(callgrindCycleDetectionC), true);
map.insert(QLatin1String(callgrindMinimumCostRatioC), 0.0001);
return map;
}
......@@ -166,20 +166,20 @@ bool CallgrindGlobalSettings::fromMap(const QVariantMap &map)
{
AbstractCallgrindSettings::fromMap(map);
// special code as the default one does not cope with the enum properly
if (map.contains(callgrindCostFormatC)) {
m_costFormat = static_cast<CostDelegate::CostFormat>(map.value(callgrindCostFormatC).toInt());
if (map.contains(QLatin1String(callgrindCostFormatC))) {
m_costFormat = static_cast<CostDelegate::CostFormat>(map.value(QLatin1String(callgrindCostFormatC)).toInt());
}
setIfPresent(map, callgrindCycleDetectionC, &m_detectCycles);
setIfPresent(map, callgrindMinimumCostRatioC, &m_minimumInclusiveCostRatio);
setIfPresent(map, QLatin1String(callgrindCycleDetectionC), &m_detectCycles);
setIfPresent(map, QLatin1String(callgrindMinimumCostRatioC), &m_minimumInclusiveCostRatio);
return true;
}
QVariantMap CallgrindGlobalSettings::toMap() const
{
QVariantMap map = AbstractCallgrindSettings::toMap();
map.insert(callgrindCostFormatC, m_costFormat);
map.insert(callgrindCycleDetectionC, m_detectCycles);
map.insert(callgrindMinimumCostRatioC, m_minimumInclusiveCostRatio);
map.insert(QLatin1String(callgrindCostFormatC), m_costFormat);
map.insert(QLatin1String(callgrindCycleDetectionC), m_detectCycles);
map.insert(QLatin1String(callgrindMinimumCostRatioC), m_minimumInclusiveCostRatio);
return map;
}
......
......@@ -35,7 +35,7 @@
#include <analyzerbase/analyzersettings.h>
#include <QString>
#include <QtCore/QString>
#include "callgrindcostdelegate.h"
namespace Callgrind {
......
......@@ -37,8 +37,8 @@
#include <valgrind/callgrind/callgrinddatamodel.h>
#include <valgrind/callgrind/callgrindfunction.h>
#include <QDebug>
#include <QPainter>
#include <QtCore/QDebug>
#include <QtGui/QPainter>
#include <utils/qtcassert.h>
......
......@@ -35,7 +35,7 @@
#include <analyzerbase/ianalyzertool.h>
#include <QVector>
#include <QtCore/QVector>
QT_BEGIN_NAMESPACE
class QCheckBox;
......
......@@ -40,17 +40,17 @@
#include <valgrind/callgrind/callgrindproxymodel.h>
#include <utils/qtcassert.h>
#include <QAbstractItemModel>
#include <QDebug>
#include <QGraphicsRectItem>
#include <QGraphicsScene>
#include <QGraphicsSimpleTextItem>
#include <QMouseEvent>
#include <QStaticText>
#include <QStyleOptionGraphicsItem>
#include <QPair>
#include <QPersistentModelIndex>
#include <QLinkedList>
#include <QtGui/QGraphicsRectItem>
#include <QtGui/QGraphicsScene>
#include <QtGui/QGraphicsSimpleTextItem>
#include <QtGui/QMouseEvent>
#include <QtGui/QStaticText>
#include <QtGui/QStyleOptionGraphicsItem>
#include <QtCore/QPair>
#include <QtCore/QPersistentModelIndex>
#include <QtCore/QLinkedList>
#include <QtCore/QAbstractItemModel>
#include <QtCore/QDebug>
#define VISUALISATION_DEBUG 0
// Margin from hardcoded value in:
......
......@@ -33,7 +33,7 @@
#ifndef CALLGRINDVISUALISATION_H
#define CALLGRINDVISUALISATION_H
#include <QGraphicsView>
#include <QtGui/QGraphicsView>
QT_BEGIN_NAMESPACE
class QAbstractItemModel;
......
......@@ -72,8 +72,8 @@
#include <QtGui/QVBoxLayout>
#include <QtGui/QMenu>
#include <QtGui/QActionGroup>
#include <QSortFilterProxyModel>
#include <QComboBox>
#include <QtGui/QSortFilterProxyModel>
#include <QtGui/QComboBox>
using namespace Valgrind::Callgrind;
......
......@@ -33,7 +33,7 @@
#ifndef CALLGRINDWIDGETHANDLER_H
#define CALLGRINDWIDGETHANDLER_H
#include <QObject>
#include <QtCore/QObject>
#include "callgrindcostdelegate.h"
......
......@@ -44,16 +44,16 @@ using namespace Memcheck;
using namespace Memcheck::Internal;
static const QLatin1String numCallersC("Analyzer.Valgrind.NumCallers");
static const QLatin1String trackOriginsC("Analyzer.Valgrind.TrackOrigins");
static const QLatin1String suppressionFilesC("Analyzer.Valgrind.SupressionFiles");
static const QLatin1String removedSuppressionFilesC("Analyzer.Valgrind.RemovedSupressionFiles");
static const QLatin1String addedSuppressionFilesC("Analyzer.Valgrind.AddedSupressionFiles");
static const QLatin1String filterExternalIssuesC("Analyzer.Valgrind.FilterExternalIssues");
static const QLatin1String visibleErrorKindsC("Analyzer.Valgrind.VisibleErrorKinds");
static const char numCallersC[] = "Analyzer.Valgrind.NumCallers";
static const char trackOriginsC[] = "Analyzer.Valgrind.TrackOrigins";
static const char suppressionFilesC[] = "Analyzer.Valgrind.SupressionFiles";
static const char removedSuppressionFilesC[] = "Analyzer.Valgrind.RemovedSuppressionFiles";
static const char addedSuppressionFilesC[] = "Analyzer.Valgrind.AddedSuppressionFiles";
static const char filterExternalIssuesC[] = "Analyzer.Valgrind.FilterExternalIssues";
static const char visibleErrorKindsC[] = "Analyzer.Valgrind.VisibleErrorKinds";
static const QLatin1String lastSuppressionDirectoryC("Analyzer.Valgrind.LastSuppressionDirectory");
static const QLatin1String lastSuppressionHistoryC("Analyzer.Valgrind.LastSuppressionHistory");
static const char lastSuppressionDirectoryC[] = "Analyzer.Valgrind.LastSuppressionDirectory";
static const char lastSuppressionHistoryC[] = "Analyzer.Valgrind.LastSuppressionHistory";
AbstractMemcheckSettings::AbstractMemcheckSettings(QObject *parent)
: AbstractAnalyzerSubConfig(parent)
......@@ -68,28 +68,28 @@ AbstractMemcheckSettings::~AbstractMemcheckSettings()
QVariantMap AbstractMemcheckSettings::defaults() const
{
QVariantMap map;
map.insert(numCallersC, 25);
map.insert(trackOriginsC, true);
map.insert(filterExternalIssuesC, true);
map.insert(QLatin1String(numCallersC), 25);
map.insert(QLatin1String(trackOriginsC), true);
map.insert(QLatin1String(filterExternalIssuesC), true);
QVariantList defaultErrorKinds;
for(int i = 0; i < Valgrind::XmlProtocol::MemcheckErrorKindCount; ++i)
defaultErrorKinds << i;
map.insert(visibleErrorKindsC, defaultErrorKinds);
map.insert(QLatin1String(visibleErrorKindsC), defaultErrorKinds);
return map;
}
bool AbstractMemcheckSettings::fromMap(const QVariantMap &map)
{
setIfPresent(map, numCallersC, &m_numCallers);
setIfPresent(map, trackOriginsC, &m_trackOrigins);
setIfPresent(map, filterExternalIssuesC, &m_filterExternalIssues);
setIfPresent(map, QLatin1String(numCallersC), &m_numCallers);
setIfPresent(map, QLatin1String(trackOriginsC), &m_trackOrigins);
setIfPresent(map, QLatin1String(filterExternalIssuesC), &m_filterExternalIssues);
// if we get more of these try a template specialization of setIfPresent for lists...
if (map.contains(visibleErrorKindsC)) {
if (map.contains(QLatin1String(visibleErrorKindsC))) {
m_visibleErrorKinds.clear();
foreach(const QVariant &val, map.value(visibleErrorKindsC).toList())
foreach (const QVariant &val, map.value(QLatin1String(visibleErrorKindsC)).toList())
m_visibleErrorKinds << val.toInt();
}
......@@ -99,14 +99,14 @@ bool AbstractMemcheckSettings::fromMap(const QVariantMap &map)
QVariantMap AbstractMemcheckSettings::toMap() const
{
QVariantMap map;
map.insert(numCallersC, m_numCallers);
map.insert(trackOriginsC, m_trackOrigins);
map.insert(filterExternalIssuesC, m_filterExternalIssues);
map.insert(QLatin1String(numCallersC), m_numCallers);
map.insert(QLatin1String(trackOriginsC), m_trackOrigins);
map.insert(QLatin1String(filterExternalIssuesC), m_filterExternalIssues);
QVariantList errorKinds;
foreach (int i, m_visibleErrorKinds)
errorKinds << i;
map.insert(visibleErrorKindsC, errorKinds);
map.insert(QLatin1String(visibleErrorKindsC), errorKinds);
return map;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment