forked from qt-creator/qt-creator
debugger: refactor thread related class
This commit is contained in:
@@ -40,6 +40,12 @@
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// StackModel
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct StackCookie
|
||||
{
|
||||
StackCookie() : isFull(true), gotoLocation(false) {}
|
||||
@@ -92,64 +98,6 @@ private:
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ThreadsHandler
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct ThreadData
|
||||
{
|
||||
ThreadData(int threadId = 0);
|
||||
|
||||
// Permanent data.
|
||||
int id;
|
||||
QString targetId;
|
||||
QString core;
|
||||
|
||||
// State information when stopped
|
||||
void notifyRunning(); // Clear state information
|
||||
|
||||
int frameLevel;
|
||||
quint64 address;
|
||||
QString function;
|
||||
QString fileName;
|
||||
QString state;
|
||||
int lineNumber;
|
||||
};
|
||||
|
||||
/*! A model to represent the running threads in a QTreeView or ComboBox */
|
||||
class ThreadsHandler : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ThreadsHandler(QObject *parent = 0);
|
||||
|
||||
int currentThreadId() const;
|
||||
void setCurrentThread(int index);
|
||||
void selectThread(int index);
|
||||
void setThreads(const QList<ThreadData> &threads);
|
||||
void removeAll();
|
||||
QList<ThreadData> threads() const;
|
||||
QAbstractItemModel *threadsModel() { return this; }
|
||||
|
||||
// Clear out all frame information
|
||||
void notifyRunning();
|
||||
|
||||
private:
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
||||
|
||||
private:
|
||||
QList<ThreadData> m_threads;
|
||||
int m_currentIndex;
|
||||
const QIcon m_positionIcon;
|
||||
const QIcon m_emptyIcon;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Debugger
|
||||
|
||||
Reference in New Issue
Block a user