forked from qt-creator/qt-creator
debugger: The DebuggerEngine refactoring.
This replaces the (de facto) singleton engines and data handlers by classes that are instantiated per run. The DebuggerRunControl will now create an object of (a class derived from) DebuggerEngine that contains all the relevant "dynamic" data. DebuggerManager is no more. The "singleton" bits are merged into DebuggerPlugin, whereas the data bits went to DebuggerEngine. There is no formal notion of a "current" DebuggerEngine. However, as there's only one DebuggerEngine at a time that has its data models connected to the view, there's still some "de facto" notion of a "current" engine. Calling SomeModel::setData(int role, QVariant data) with custom role is used as the primary dispatch mechanism from the views to the "current" data models (and the engine, as all data models know their engine).
This commit is contained in:
@@ -37,9 +37,13 @@
|
||||
|
||||
#include <QtGui/QIcon>
|
||||
|
||||
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
|
||||
class DebuggerEngine;
|
||||
class DisassemblerViewAgent;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// StackModel
|
||||
@@ -54,6 +58,7 @@ struct StackCookie
|
||||
bool gotoLocation;
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// StackModel
|
||||
@@ -66,10 +71,11 @@ class StackHandler : public QAbstractTableModel
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
StackHandler(QObject *parent = 0);
|
||||
explicit StackHandler(DebuggerEngine *engine);
|
||||
~StackHandler();
|
||||
|
||||
void setFrames(const QList<StackFrame> &frames, bool canExpand = false);
|
||||
QList<StackFrame> frames() const;
|
||||
void setFrames(const StackFrames &frames, bool canExpand = false);
|
||||
StackFrames frames() const;
|
||||
void setCurrentIndex(int index);
|
||||
int currentIndex() const { return m_currentIndex; }
|
||||
StackFrame currentFrame() const;
|
||||
@@ -78,7 +84,7 @@ public:
|
||||
|
||||
// Called from StackHandler after a new stack list has been received
|
||||
void removeAll();
|
||||
QAbstractItemModel *stackModel() { return this; }
|
||||
QAbstractItemModel *model() { return this; }
|
||||
bool isDebuggingDebuggingHelpers() const;
|
||||
|
||||
private:
|
||||
@@ -86,19 +92,20 @@ private:
|
||||
int rowCount(const QModelIndex &parent) const;
|
||||
int columnCount(const QModelIndex &parent) const;
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
bool setData(const QModelIndex &index, const QVariant &, int role);
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
Q_SLOT void resetModel() { reset(); }
|
||||
|
||||
QList<StackFrame> m_stackFrames;
|
||||
DebuggerEngine *m_engine;
|
||||
DisassemblerViewAgent *m_disassemblerViewAgent;
|
||||
StackFrames m_stackFrames;
|
||||
int m_currentIndex;
|
||||
const QVariant m_positionIcon;
|
||||
const QVariant m_emptyIcon;
|
||||
bool m_canExpand;
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Debugger
|
||||
|
||||
|
||||
Reference in New Issue
Block a user