2010-05-18 12:12:22 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
|
|
|
|
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
|
|
**
|
|
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
|
|
|
**
|
|
|
|
|
** Commercial Usage
|
|
|
|
|
**
|
|
|
|
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
|
|
|
** accordance with the Qt Commercial License Agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Nokia.
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
|
|
|
|
** If you are unsure which license is appropriate for your use, please
|
|
|
|
|
** contact the sales department at http://qt.nokia.com/contact.
|
|
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef THREADSHANDLER_H
|
|
|
|
|
#define THREADSHANDLER_H
|
|
|
|
|
|
|
|
|
|
#include <QtCore/QAbstractTableModel>
|
|
|
|
|
#include <QtCore/QList>
|
|
|
|
|
|
|
|
|
|
#include <QtGui/QIcon>
|
|
|
|
|
|
2010-10-15 10:56:39 +02:00
|
|
|
#include "threaddata.h"
|
2010-05-18 12:12:22 +02:00
|
|
|
|
|
|
|
|
namespace Debugger {
|
2010-06-16 11:08:54 +02:00
|
|
|
class DebuggerEngine;
|
|
|
|
|
|
2010-09-13 13:30:35 +02:00
|
|
|
namespace Internal {
|
|
|
|
|
|
2010-05-18 12:12:22 +02:00
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// ThreadsHandler
|
|
|
|
|
//
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
/*! A model to represent the running threads in a QTreeView or ComboBox */
|
|
|
|
|
class ThreadsHandler : public QAbstractTableModel
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2010-06-16 11:08:54 +02:00
|
|
|
explicit ThreadsHandler(DebuggerEngine *engine);
|
2010-05-18 12:12:22 +02:00
|
|
|
|
2010-07-21 13:11:03 +02:00
|
|
|
int currentThread() const { return m_currentIndex; }
|
|
|
|
|
void setCurrentThread(int index);
|
2010-05-18 12:12:22 +02:00
|
|
|
int currentThreadId() const;
|
2010-07-02 10:58:47 +02:00
|
|
|
void setCurrentThreadId(int id);
|
2010-10-15 10:56:39 +02:00
|
|
|
int indexOf(quint64 threadId) const;
|
2010-07-02 10:58:47 +02:00
|
|
|
|
2010-05-18 12:12:22 +02:00
|
|
|
void selectThread(int index);
|
2010-06-16 11:08:54 +02:00
|
|
|
void setThreads(const Threads &threads);
|
2010-05-18 12:12:22 +02:00
|
|
|
void removeAll();
|
2010-06-16 11:08:54 +02:00
|
|
|
Threads threads() const;
|
|
|
|
|
QAbstractItemModel *model() { return this; }
|
2010-05-18 12:12:22 +02:00
|
|
|
|
|
|
|
|
// 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;
|
2010-06-16 11:08:54 +02:00
|
|
|
bool setData(const QModelIndex &index, const QVariant &value, int role);
|
|
|
|
|
QVariant headerData(int section, Qt::Orientation orientation,
|
|
|
|
|
int role = Qt::DisplayRole) const;
|
2010-05-18 12:12:22 +02:00
|
|
|
|
|
|
|
|
private:
|
2010-06-16 11:08:54 +02:00
|
|
|
DebuggerEngine *m_engine;
|
|
|
|
|
Threads m_threads;
|
2010-05-18 12:12:22 +02:00
|
|
|
int m_currentIndex;
|
|
|
|
|
const QIcon m_positionIcon;
|
|
|
|
|
const QIcon m_emptyIcon;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Debugger
|
|
|
|
|
|
|
|
|
|
#endif // THREADSHANDLER_H
|