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