Analyzer: String constant and include cleanup.

This commit is contained in:
Friedemann Kleint
2011-05-10 15:42:41 +02:00
parent ddf4b613f3
commit 86b50c579c
12 changed files with 79 additions and 79 deletions

View File

@@ -40,9 +40,9 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QPainter> #include <QtGui/QPainter>
#include <QDebug> #include <QtGui/QApplication>
#include <QApplication> #include <QtCore/QDebug>
using namespace Valgrind::Callgrind; using namespace Valgrind::Callgrind;

View File

@@ -34,8 +34,8 @@
#include "callgrindhelper.h" #include "callgrindhelper.h"
#include <QApplication> #include <QtGui/QApplication>
#include <QPainter> #include <QtGui/QPainter>
namespace Callgrind { namespace Callgrind {
namespace Internal { namespace Internal {

View File

@@ -37,8 +37,8 @@
#include <analyzerbase/analyzermanager.h> #include <analyzerbase/analyzermanager.h>
#include <QStringList> #include <QtCore/QStringList>
#include <QtPlugin> #include <QtCore/QtPlugin>
using namespace Analyzer; using namespace Analyzer;
using namespace Callgrind; using namespace Callgrind;

View File

@@ -34,20 +34,20 @@
#include "callgrindconfigwidget.h" #include "callgrindconfigwidget.h"
#include <QDebug> #include <QtCore/QDebug>
using namespace Analyzer; using namespace Analyzer;
using namespace Callgrind::Internal; using namespace Callgrind::Internal;
using namespace Callgrind; using namespace Callgrind;
static const QLatin1String callgrindEnableCacheSimC("Analyzer.Valgrind.Callgrind.EnableCacheSim"); static const char callgrindEnableCacheSimC[] = "Analyzer.Valgrind.Callgrind.EnableCacheSim";
static const QLatin1String callgrindEnableBranchSimC("Analyzer.Valgrind.Callgrind.EnableBranchSim"); static const char callgrindEnableBranchSimC[] = "Analyzer.Valgrind.Callgrind.EnableBranchSim";
static const QLatin1String callgrindCollectSystimeC("Analyzer.Valgrind.Callgrind.CollectSystime"); static const char callgrindCollectSystimeC[] = "Analyzer.Valgrind.Callgrind.CollectSystime";
static const QLatin1String callgrindCollectBusEventsC("Analyzer.Valgrind.Callgrind.CollectBusEvents"); static const char callgrindCollectBusEventsC[] = "Analyzer.Valgrind.Callgrind.CollectBusEvents";
static const QLatin1String callgrindCycleDetectionC("Analyzer.Valgrind.Callgrind.CycleDetection"); static const char callgrindCycleDetectionC[] = "Analyzer.Valgrind.Callgrind.CycleDetection";
static const QLatin1String callgrindCostFormatC("Analyzer.Valgrind.Callgrind.CostFormat"); static const char callgrindCostFormatC[] = "Analyzer.Valgrind.Callgrind.CostFormat";
static const QLatin1String callgrindMinimumCostRatioC("Analyzer.Valgrind.Callgrind.MinimumCostRatio"); static const char callgrindMinimumCostRatioC[] = "Analyzer.Valgrind.Callgrind.MinimumCostRatio";
AbstractCallgrindSettings::AbstractCallgrindSettings(QObject *parent) AbstractCallgrindSettings::AbstractCallgrindSettings(QObject *parent)
: AbstractAnalyzerSubConfig(parent) : AbstractAnalyzerSubConfig(parent)
@@ -99,36 +99,36 @@ void AbstractCallgrindSettings::setCollectBusEvents(bool collect)
QVariantMap AbstractCallgrindSettings::defaults() const QVariantMap AbstractCallgrindSettings::defaults() const
{ {
QVariantMap map; QVariantMap map;
map.insert(callgrindEnableCacheSimC, false); map.insert(QLatin1String(callgrindEnableCacheSimC), false);
map.insert(callgrindEnableBranchSimC, false); map.insert(QLatin1String(callgrindEnableBranchSimC), false);
map.insert(callgrindCollectSystimeC, false); map.insert(QLatin1String(callgrindCollectSystimeC), false);
map.insert(callgrindCollectBusEventsC, false); map.insert(QLatin1String(callgrindCollectBusEventsC), false);
return map; return map;
} }
bool AbstractCallgrindSettings::fromMap(const QVariantMap &map) bool AbstractCallgrindSettings::fromMap(const QVariantMap &map)
{ {
setIfPresent(map, callgrindEnableCacheSimC, &m_enableCacheSim); setIfPresent(map, QLatin1String(callgrindEnableCacheSimC), &m_enableCacheSim);
setIfPresent(map, callgrindEnableBranchSimC, &m_enableBranchSim); setIfPresent(map, QLatin1String(callgrindEnableBranchSimC), &m_enableBranchSim);
setIfPresent(map, callgrindCollectSystimeC, &m_collectSystime); setIfPresent(map, QLatin1String(callgrindCollectSystimeC), &m_collectSystime);
setIfPresent(map, callgrindCollectBusEventsC, &m_collectBusEvents); setIfPresent(map, QLatin1String(callgrindCollectBusEventsC), &m_collectBusEvents);
return true; return true;
} }
QVariantMap AbstractCallgrindSettings::toMap() const QVariantMap AbstractCallgrindSettings::toMap() const
{ {
QVariantMap map; QVariantMap map;
map.insert(callgrindEnableCacheSimC, m_enableCacheSim); map.insert(QLatin1String(callgrindEnableCacheSimC), m_enableCacheSim);
map.insert(callgrindEnableBranchSimC, m_enableBranchSim); map.insert(QLatin1String(callgrindEnableBranchSimC), m_enableBranchSim);
map.insert(callgrindCollectSystimeC, m_collectSystime); map.insert(QLatin1String(callgrindCollectSystimeC), m_collectSystime);
map.insert(callgrindCollectBusEventsC, m_collectBusEvents); map.insert(QLatin1String(callgrindCollectBusEventsC), m_collectBusEvents);
return map; return map;
} }
QString AbstractCallgrindSettings::id() const QString AbstractCallgrindSettings::id() const
{ {
return "Analyzer.Valgrind.Settings.Callgrind"; return QLatin1String("Analyzer.Valgrind.Settings.Callgrind");
} }
QString AbstractCallgrindSettings::displayName() const QString AbstractCallgrindSettings::displayName() const
@@ -156,9 +156,9 @@ CallgrindGlobalSettings::~CallgrindGlobalSettings()
QVariantMap CallgrindGlobalSettings::defaults() const QVariantMap CallgrindGlobalSettings::defaults() const
{ {
QVariantMap map = AbstractCallgrindSettings::defaults(); QVariantMap map = AbstractCallgrindSettings::defaults();
map.insert(callgrindCostFormatC, CostDelegate::FormatRelative); map.insert(QLatin1String(callgrindCostFormatC), CostDelegate::FormatRelative);
map.insert(callgrindCycleDetectionC, true); map.insert(QLatin1String(callgrindCycleDetectionC), true);
map.insert(callgrindMinimumCostRatioC, 0.0001); map.insert(QLatin1String(callgrindMinimumCostRatioC), 0.0001);
return map; return map;
} }
@@ -166,20 +166,20 @@ bool CallgrindGlobalSettings::fromMap(const QVariantMap &map)
{ {
AbstractCallgrindSettings::fromMap(map); AbstractCallgrindSettings::fromMap(map);
// special code as the default one does not cope with the enum properly // special code as the default one does not cope with the enum properly
if (map.contains(callgrindCostFormatC)) { if (map.contains(QLatin1String(callgrindCostFormatC))) {
m_costFormat = static_cast<CostDelegate::CostFormat>(map.value(callgrindCostFormatC).toInt()); m_costFormat = static_cast<CostDelegate::CostFormat>(map.value(QLatin1String(callgrindCostFormatC)).toInt());
} }
setIfPresent(map, callgrindCycleDetectionC, &m_detectCycles); setIfPresent(map, QLatin1String(callgrindCycleDetectionC), &m_detectCycles);
setIfPresent(map, callgrindMinimumCostRatioC, &m_minimumInclusiveCostRatio); setIfPresent(map, QLatin1String(callgrindMinimumCostRatioC), &m_minimumInclusiveCostRatio);
return true; return true;
} }
QVariantMap CallgrindGlobalSettings::toMap() const QVariantMap CallgrindGlobalSettings::toMap() const
{ {
QVariantMap map = AbstractCallgrindSettings::toMap(); QVariantMap map = AbstractCallgrindSettings::toMap();
map.insert(callgrindCostFormatC, m_costFormat); map.insert(QLatin1String(callgrindCostFormatC), m_costFormat);
map.insert(callgrindCycleDetectionC, m_detectCycles); map.insert(QLatin1String(callgrindCycleDetectionC), m_detectCycles);
map.insert(callgrindMinimumCostRatioC, m_minimumInclusiveCostRatio); map.insert(QLatin1String(callgrindMinimumCostRatioC), m_minimumInclusiveCostRatio);
return map; return map;
} }

View File

@@ -35,7 +35,7 @@
#include <analyzerbase/analyzersettings.h> #include <analyzerbase/analyzersettings.h>
#include <QString> #include <QtCore/QString>
#include "callgrindcostdelegate.h" #include "callgrindcostdelegate.h"
namespace Callgrind { namespace Callgrind {

View File

@@ -37,8 +37,8 @@
#include <valgrind/callgrind/callgrinddatamodel.h> #include <valgrind/callgrind/callgrinddatamodel.h>
#include <valgrind/callgrind/callgrindfunction.h> #include <valgrind/callgrind/callgrindfunction.h>
#include <QDebug> #include <QtCore/QDebug>
#include <QPainter> #include <QtGui/QPainter>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>

View File

@@ -35,7 +35,7 @@
#include <analyzerbase/ianalyzertool.h> #include <analyzerbase/ianalyzertool.h>
#include <QVector> #include <QtCore/QVector>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QCheckBox; class QCheckBox;

View File

@@ -40,17 +40,17 @@
#include <valgrind/callgrind/callgrindproxymodel.h> #include <valgrind/callgrind/callgrindproxymodel.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QAbstractItemModel> #include <QtGui/QGraphicsRectItem>
#include <QDebug> #include <QtGui/QGraphicsScene>
#include <QGraphicsRectItem> #include <QtGui/QGraphicsSimpleTextItem>
#include <QGraphicsScene> #include <QtGui/QMouseEvent>
#include <QGraphicsSimpleTextItem> #include <QtGui/QStaticText>
#include <QMouseEvent> #include <QtGui/QStyleOptionGraphicsItem>
#include <QStaticText> #include <QtCore/QPair>
#include <QStyleOptionGraphicsItem> #include <QtCore/QPersistentModelIndex>
#include <QPair> #include <QtCore/QLinkedList>
#include <QPersistentModelIndex> #include <QtCore/QAbstractItemModel>
#include <QLinkedList> #include <QtCore/QDebug>
#define VISUALISATION_DEBUG 0 #define VISUALISATION_DEBUG 0
// Margin from hardcoded value in: // Margin from hardcoded value in:

View File

@@ -33,7 +33,7 @@
#ifndef CALLGRINDVISUALISATION_H #ifndef CALLGRINDVISUALISATION_H
#define CALLGRINDVISUALISATION_H #define CALLGRINDVISUALISATION_H
#include <QGraphicsView> #include <QtGui/QGraphicsView>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QAbstractItemModel; class QAbstractItemModel;

View File

@@ -72,8 +72,8 @@
#include <QtGui/QVBoxLayout> #include <QtGui/QVBoxLayout>
#include <QtGui/QMenu> #include <QtGui/QMenu>
#include <QtGui/QActionGroup> #include <QtGui/QActionGroup>
#include <QSortFilterProxyModel> #include <QtGui/QSortFilterProxyModel>
#include <QComboBox> #include <QtGui/QComboBox>
using namespace Valgrind::Callgrind; using namespace Valgrind::Callgrind;

View File

@@ -33,7 +33,7 @@
#ifndef CALLGRINDWIDGETHANDLER_H #ifndef CALLGRINDWIDGETHANDLER_H
#define CALLGRINDWIDGETHANDLER_H #define CALLGRINDWIDGETHANDLER_H
#include <QObject> #include <QtCore/QObject>
#include "callgrindcostdelegate.h" #include "callgrindcostdelegate.h"

View File

@@ -44,16 +44,16 @@ using namespace Memcheck;
using namespace Memcheck::Internal; using namespace Memcheck::Internal;
static const QLatin1String numCallersC("Analyzer.Valgrind.NumCallers"); static const char numCallersC[] = "Analyzer.Valgrind.NumCallers";
static const QLatin1String trackOriginsC("Analyzer.Valgrind.TrackOrigins"); static const char trackOriginsC[] = "Analyzer.Valgrind.TrackOrigins";
static const QLatin1String suppressionFilesC("Analyzer.Valgrind.SupressionFiles"); static const char suppressionFilesC[] = "Analyzer.Valgrind.SupressionFiles";
static const QLatin1String removedSuppressionFilesC("Analyzer.Valgrind.RemovedSupressionFiles"); static const char removedSuppressionFilesC[] = "Analyzer.Valgrind.RemovedSuppressionFiles";
static const QLatin1String addedSuppressionFilesC("Analyzer.Valgrind.AddedSupressionFiles"); static const char addedSuppressionFilesC[] = "Analyzer.Valgrind.AddedSuppressionFiles";
static const QLatin1String filterExternalIssuesC("Analyzer.Valgrind.FilterExternalIssues"); static const char filterExternalIssuesC[] = "Analyzer.Valgrind.FilterExternalIssues";
static const QLatin1String visibleErrorKindsC("Analyzer.Valgrind.VisibleErrorKinds"); static const char visibleErrorKindsC[] = "Analyzer.Valgrind.VisibleErrorKinds";
static const QLatin1String lastSuppressionDirectoryC("Analyzer.Valgrind.LastSuppressionDirectory"); static const char lastSuppressionDirectoryC[] = "Analyzer.Valgrind.LastSuppressionDirectory";
static const QLatin1String lastSuppressionHistoryC("Analyzer.Valgrind.LastSuppressionHistory"); static const char lastSuppressionHistoryC[] = "Analyzer.Valgrind.LastSuppressionHistory";
AbstractMemcheckSettings::AbstractMemcheckSettings(QObject *parent) AbstractMemcheckSettings::AbstractMemcheckSettings(QObject *parent)
: AbstractAnalyzerSubConfig(parent) : AbstractAnalyzerSubConfig(parent)
@@ -68,28 +68,28 @@ AbstractMemcheckSettings::~AbstractMemcheckSettings()
QVariantMap AbstractMemcheckSettings::defaults() const QVariantMap AbstractMemcheckSettings::defaults() const
{ {
QVariantMap map; QVariantMap map;
map.insert(numCallersC, 25); map.insert(QLatin1String(numCallersC), 25);
map.insert(trackOriginsC, true); map.insert(QLatin1String(trackOriginsC), true);
map.insert(filterExternalIssuesC, true); map.insert(QLatin1String(filterExternalIssuesC), true);
QVariantList defaultErrorKinds; QVariantList defaultErrorKinds;
for(int i = 0; i < Valgrind::XmlProtocol::MemcheckErrorKindCount; ++i) for(int i = 0; i < Valgrind::XmlProtocol::MemcheckErrorKindCount; ++i)
defaultErrorKinds << i; defaultErrorKinds << i;
map.insert(visibleErrorKindsC, defaultErrorKinds); map.insert(QLatin1String(visibleErrorKindsC), defaultErrorKinds);
return map; return map;
} }
bool AbstractMemcheckSettings::fromMap(const QVariantMap &map) bool AbstractMemcheckSettings::fromMap(const QVariantMap &map)
{ {
setIfPresent(map, numCallersC, &m_numCallers); setIfPresent(map, QLatin1String(numCallersC), &m_numCallers);
setIfPresent(map, trackOriginsC, &m_trackOrigins); setIfPresent(map, QLatin1String(trackOriginsC), &m_trackOrigins);
setIfPresent(map, filterExternalIssuesC, &m_filterExternalIssues); setIfPresent(map, QLatin1String(filterExternalIssuesC), &m_filterExternalIssues);
// if we get more of these try a template specialization of setIfPresent for lists... // 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(); m_visibleErrorKinds.clear();
foreach(const QVariant &val, map.value(visibleErrorKindsC).toList()) foreach (const QVariant &val, map.value(QLatin1String(visibleErrorKindsC)).toList())
m_visibleErrorKinds << val.toInt(); m_visibleErrorKinds << val.toInt();
} }
@@ -99,14 +99,14 @@ bool AbstractMemcheckSettings::fromMap(const QVariantMap &map)
QVariantMap AbstractMemcheckSettings::toMap() const QVariantMap AbstractMemcheckSettings::toMap() const
{ {
QVariantMap map; QVariantMap map;
map.insert(numCallersC, m_numCallers); map.insert(QLatin1String(numCallersC), m_numCallers);
map.insert(trackOriginsC, m_trackOrigins); map.insert(QLatin1String(trackOriginsC), m_trackOrigins);
map.insert(filterExternalIssuesC, m_filterExternalIssues); map.insert(QLatin1String(filterExternalIssuesC), m_filterExternalIssues);
QVariantList errorKinds; QVariantList errorKinds;
foreach (int i, m_visibleErrorKinds) foreach (int i, m_visibleErrorKinds)
errorKinds << i; errorKinds << i;
map.insert(visibleErrorKindsC, errorKinds); map.insert(QLatin1String(visibleErrorKindsC), errorKinds);
return map; return map;
} }