analyzer: add a button to shorten names of function templates

Task-number: QTCREATORBUG-7746

Change-Id: I5ba6c5b63c319d7b65239c6b730c0da90ef20c4f
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
hjk
2012-08-22 23:35:02 +02:00
parent 40cbc6746c
commit 66bbb8b291
5 changed files with 88 additions and 29 deletions

View File

@@ -134,6 +134,7 @@ public slots:
void selectFunction(const Valgrind::Callgrind::Function *);
void setCostFormat(Valgrind::Internal::CostDelegate::CostFormat format);
void enableCycleDetection(bool enabled);
void shortenTemplates(bool enabled);
void setCostEvent(int index);
/// This function will add custom text marks to the editor
@@ -196,6 +197,7 @@ public:
QAction *m_costRelative;
QAction *m_costRelativeToParent;
QAction *m_cycleDetection;
QAction *m_shortenTemplates;
QComboBox *m_eventCombo;
QTimer *m_updateTimer;
@@ -370,6 +372,11 @@ void CallgrindToolPrivate::enableCycleDetection(bool enabled)
m_cycleDetection->setChecked(enabled);
}
void CallgrindToolPrivate::shortenTemplates(bool enabled)
{
m_shortenTemplates->setChecked(enabled);
}
// Following functions can be called with actions=0 or widgets=0
// depending on initialization sequence (whether callgrind was current).
CostDelegate::CostFormat CallgrindToolPrivate::costFormat() const
@@ -763,7 +770,6 @@ QWidget *CallgrindToolPrivate::createWidgets()
// show costs as absolute numbers
m_costAbsolute = new QAction(tr("Absolute Costs"), this);
///FIXME: icon
m_costAbsolute->setToolTip(tr("Show costs as absolute numbers."));
m_costAbsolute->setCheckable(true);
m_costAbsolute->setChecked(true);
@@ -773,7 +779,6 @@ QWidget *CallgrindToolPrivate::createWidgets()
// show costs in percentages
m_costRelative = new QAction(tr("Relative Costs"), this);
///FIXME: icon (percentage sign?)
m_costRelative->setToolTip(tr("Show costs relative to total inclusive cost."));
m_costRelative->setCheckable(true);
connect(m_costRelative, SIGNAL(toggled(bool)), SLOT(updateCostFormat()));
@@ -782,7 +787,6 @@ QWidget *CallgrindToolPrivate::createWidgets()
// show costs relative to parent
m_costRelativeToParent = new QAction(tr("Relative Costs to Parent"), this);
///FIXME: icon
m_costRelativeToParent->setToolTip(tr("Show costs relative to parent functions inclusive cost."));
m_costRelativeToParent->setCheckable(true);
connect(m_costRelativeToParent, SIGNAL(toggled(bool)), SLOT(updateCostFormat()));
@@ -792,12 +796,14 @@ QWidget *CallgrindToolPrivate::createWidgets()
QToolButton *button = new QToolButton;
button->setMenu(menu);
button->setPopupMode(QToolButton::InstantPopup);
button->setText(tr("Cost Format"));
button->setText(QLatin1String("$"));
button->setToolTip(tr("Cost Format"));
layout->addWidget(button);
}
// cycle detection
action = new QAction(tr("Cycle Detection"), this); ///FIXME: icon
//action = new QAction(QLatin1String("Cycle Detection"), this); ///FIXME: icon
action = new QAction(QLatin1String("O"), this); ///FIXME: icon
action->setToolTip(tr("Enable cycle detection to properly handle recursive or circular function calls."));
action->setCheckable(true);
connect(action, SIGNAL(toggled(bool)), m_dataModel, SLOT(enableCycleDetection(bool)));
@@ -805,6 +811,15 @@ QWidget *CallgrindToolPrivate::createWidgets()
layout->addWidget(createToolButton(action));
m_cycleDetection = action;
// shorter template signature
action = new QAction(QLatin1String("<>"), this);
action->setToolTip(tr("This removes template parameter lists when displaying function names."));
action->setCheckable(true);
connect(action, SIGNAL(toggled(bool)), m_dataModel, SLOT(setShortenTemplates(bool)));
connect(action, SIGNAL(toggled(bool)), m_settings, SLOT(setShortenTemplates(bool)));
layout->addWidget(createToolButton(action));
m_shortenTemplates = action;
// filtering
action = new QAction(tr("Show Project Costs Only"), this);
action->setIcon(QIcon(Core::Constants::ICON_FILTER));