forked from qt-creator/qt-creator
valgrind: remove HistoryItem and FunctionHistoryItem
This commit is contained in:
@@ -31,42 +31,14 @@
|
||||
|
||||
using namespace Valgrind::Callgrind;
|
||||
|
||||
HistoryItem::HistoryItem(StackBrowser *stack)
|
||||
{
|
||||
if (stack)
|
||||
stack->select(this);
|
||||
}
|
||||
|
||||
HistoryItem::~HistoryItem()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
FunctionHistoryItem::FunctionHistoryItem(const Function *function, StackBrowser *stack)
|
||||
: HistoryItem(stack)
|
||||
, m_function(function)
|
||||
{
|
||||
}
|
||||
|
||||
FunctionHistoryItem::~FunctionHistoryItem()
|
||||
{
|
||||
}
|
||||
|
||||
StackBrowser::StackBrowser(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
StackBrowser::~StackBrowser()
|
||||
{
|
||||
qDeleteAll(m_stack);
|
||||
m_stack.clear();
|
||||
}
|
||||
|
||||
void StackBrowser::clear()
|
||||
{
|
||||
qDeleteAll(m_stack);
|
||||
m_stack.clear();
|
||||
emit currentChanged();
|
||||
}
|
||||
@@ -76,7 +48,7 @@ int StackBrowser::size() const
|
||||
return m_stack.size();
|
||||
}
|
||||
|
||||
void StackBrowser::select(HistoryItem *item)
|
||||
void StackBrowser::select(const Function *item)
|
||||
{
|
||||
if (!m_stack.isEmpty() && m_stack.top() == item)
|
||||
return;
|
||||
@@ -85,7 +57,7 @@ void StackBrowser::select(HistoryItem *item)
|
||||
emit currentChanged();
|
||||
}
|
||||
|
||||
HistoryItem *StackBrowser::current() const
|
||||
const Function *StackBrowser::current() const
|
||||
{
|
||||
return m_stack.isEmpty() ? 0 : m_stack.top();
|
||||
}
|
||||
@@ -95,7 +67,6 @@ void StackBrowser::goBack()
|
||||
if (m_stack.isEmpty())
|
||||
return;
|
||||
|
||||
HistoryItem *item = m_stack.pop();
|
||||
delete item;
|
||||
m_stack.pop();
|
||||
emit currentChanged();
|
||||
}
|
||||
|
||||
@@ -39,26 +39,6 @@ namespace Valgrind {
|
||||
namespace Callgrind {
|
||||
|
||||
class Function;
|
||||
class StackBrowser;
|
||||
|
||||
class VALGRINDSHARED_EXPORT HistoryItem
|
||||
{
|
||||
public:
|
||||
HistoryItem(StackBrowser *stack = 0);
|
||||
virtual ~HistoryItem();
|
||||
};
|
||||
|
||||
class VALGRINDSHARED_EXPORT FunctionHistoryItem : public HistoryItem
|
||||
{
|
||||
public:
|
||||
FunctionHistoryItem(const Function *function, StackBrowser *stack = 0);
|
||||
virtual ~FunctionHistoryItem();
|
||||
|
||||
const Function *function() const { return m_function; }
|
||||
|
||||
private:
|
||||
const Function *m_function;
|
||||
};
|
||||
|
||||
class VALGRINDSHARED_EXPORT StackBrowser : public QObject
|
||||
{
|
||||
@@ -66,10 +46,9 @@ class VALGRINDSHARED_EXPORT StackBrowser : public QObject
|
||||
|
||||
public:
|
||||
explicit StackBrowser(QObject *parent = 0);
|
||||
virtual ~StackBrowser();
|
||||
|
||||
void select(HistoryItem *item);
|
||||
HistoryItem *current() const;
|
||||
void select(const Function *item);
|
||||
const Function *current() const;
|
||||
|
||||
void clear();
|
||||
int size() const;
|
||||
@@ -81,7 +60,7 @@ Q_SIGNALS:
|
||||
void currentChanged();
|
||||
|
||||
private:
|
||||
QStack<HistoryItem *> m_stack;
|
||||
QStack<const Function *> m_stack;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -338,23 +338,18 @@ void CallgrindWidgetHandler::selectFunction(const Function *func)
|
||||
m_calleesModel->setCalls(func->outgoingCalls(), func);
|
||||
m_visualisation->setFunction(func);
|
||||
|
||||
FunctionHistoryItem *item = dynamic_cast<FunctionHistoryItem *>(m_stackBrowser->current());
|
||||
if (!item || item->function() != func)
|
||||
m_stackBrowser->select(new FunctionHistoryItem(func));
|
||||
const Function *item = m_stackBrowser->current();
|
||||
if (!item || item != func)
|
||||
m_stackBrowser->select(func);
|
||||
|
||||
emit functionSelected(func);
|
||||
}
|
||||
|
||||
void CallgrindWidgetHandler::stackBrowserChanged()
|
||||
{
|
||||
FunctionHistoryItem *item = dynamic_cast<FunctionHistoryItem *>(m_stackBrowser->current());
|
||||
|
||||
if (!item || item->function() == 0)
|
||||
m_goBack->setDisabled(true);
|
||||
else
|
||||
m_goBack->setEnabled(true);
|
||||
|
||||
selectFunction(item ? item->function() : 0);
|
||||
const Function *item = m_stackBrowser->current();
|
||||
m_goBack->setEnabled(item != 0);
|
||||
selectFunction(item);
|
||||
}
|
||||
|
||||
void CallgrindWidgetHandler::updateFilterString()
|
||||
|
||||
Reference in New Issue
Block a user