2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2010-05-18 12:12:22 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2010-05-18 12:12:22 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2010-05-18 12:12:22 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2010-05-18 12:12:22 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2010-05-18 12:12:22 +02:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2010-05-18 12:12:22 +02:00
|
|
|
|
2010-10-15 10:56:39 +02:00
|
|
|
#include "threaddata.h"
|
2010-05-18 12:12:22 +02:00
|
|
|
|
2015-06-12 11:55:57 +02:00
|
|
|
#include <utils/treemodel.h>
|
2011-10-13 10:17:06 +02:00
|
|
|
|
2018-08-31 18:30:14 +02:00
|
|
|
#include <QComboBox>
|
2018-08-15 17:28:00 +02:00
|
|
|
#include <QPointer>
|
|
|
|
|
|
2010-05-18 12:12:22 +02:00
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// ThreadsHandler
|
|
|
|
|
//
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2011-09-01 16:36:27 +02:00
|
|
|
namespace Debugger {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2016-07-18 12:36:31 +02:00
|
|
|
class DebuggerEngine;
|
2011-09-01 16:36:27 +02:00
|
|
|
class GdbMi;
|
2018-08-15 17:28:00 +02:00
|
|
|
class ThreadsHandler;
|
|
|
|
|
|
|
|
|
|
class ThreadItem : public QObject, public Utils::TreeItem
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2018-08-30 09:56:51 +02:00
|
|
|
ThreadItem(const ThreadData &data = ThreadData());
|
2018-08-15 17:28:00 +02:00
|
|
|
|
|
|
|
|
QVariant data(int column, int role) const override;
|
|
|
|
|
Qt::ItemFlags flags(int column) const override;
|
|
|
|
|
|
|
|
|
|
QString threadToolTip() const;
|
|
|
|
|
QVariant threadPart(int column) const;
|
|
|
|
|
|
|
|
|
|
void notifyRunning();
|
|
|
|
|
void notifyStopped();
|
|
|
|
|
|
|
|
|
|
void mergeThreadData(const ThreadData &other);
|
|
|
|
|
QString id() const { return threadData.id; }
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
ThreadData threadData;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
using Thread = QPointer<ThreadItem>;
|
2018-08-30 09:56:51 +02:00
|
|
|
using ThreadsHandlerModel = Utils::TreeModel<Utils::TypedTreeItem<ThreadItem>, ThreadItem>;
|
2011-09-01 16:36:27 +02:00
|
|
|
|
2018-08-30 09:56:51 +02:00
|
|
|
class ThreadsHandler : public ThreadsHandlerModel
|
2010-05-18 12:12:22 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2016-07-18 12:36:31 +02:00
|
|
|
explicit ThreadsHandler(DebuggerEngine *engine);
|
2018-11-07 09:23:16 +01:00
|
|
|
~ThreadsHandler();
|
2010-05-18 12:12:22 +02:00
|
|
|
|
2018-08-15 17:28:00 +02:00
|
|
|
Thread currentThread() const;
|
|
|
|
|
Thread threadForId(const QString &id) const;
|
|
|
|
|
void setCurrentThread(const Thread &thread);
|
2010-07-02 10:58:47 +02:00
|
|
|
|
2015-06-12 11:55:57 +02:00
|
|
|
void updateThread(const ThreadData &threadData);
|
2018-08-30 11:52:37 +02:00
|
|
|
void setThreads(const GdbMi &data);
|
2012-10-19 16:37:57 +02:00
|
|
|
|
2018-08-15 17:28:00 +02:00
|
|
|
void removeThread(const QString &id);
|
2010-05-18 12:12:22 +02:00
|
|
|
void removeAll();
|
2011-10-13 10:17:06 +02:00
|
|
|
QAbstractItemModel *model();
|
2010-05-18 12:12:22 +02:00
|
|
|
|
2016-06-07 17:04:53 +02:00
|
|
|
void notifyGroupCreated(const QString &groupId, const QString &pid);
|
|
|
|
|
bool notifyGroupExited(const QString &groupId); // Returns true when empty.
|
2015-06-12 15:17:14 +02:00
|
|
|
|
2018-08-15 17:28:00 +02:00
|
|
|
void notifyRunning(const QString &id);
|
|
|
|
|
void notifyStopped(const QString &id);
|
2010-11-08 17:15:33 +01:00
|
|
|
|
2018-11-07 09:23:16 +01:00
|
|
|
QPointer<QComboBox> threadSwitcher();
|
2018-08-31 18:30:14 +02:00
|
|
|
|
2010-05-18 12:12:22 +02:00
|
|
|
private:
|
2018-05-07 15:06:53 +02:00
|
|
|
void sort(int column, Qt::SortOrder order) override;
|
2018-08-30 09:56:51 +02:00
|
|
|
QVariant data(const QModelIndex &index, int role) const override;
|
2018-05-07 15:06:53 +02:00
|
|
|
bool setData(const QModelIndex &idx, const QVariant &data, int role) override;
|
2011-04-18 16:40:59 +02:00
|
|
|
|
2016-07-18 12:36:31 +02:00
|
|
|
DebuggerEngine *m_engine;
|
2018-08-15 17:28:00 +02:00
|
|
|
Thread m_currentThread;
|
2016-06-07 17:04:53 +02:00
|
|
|
QHash<QString, QString> m_pidForGroupId;
|
2018-11-07 09:23:16 +01:00
|
|
|
QPointer<QComboBox> m_comboBox;
|
2010-05-18 12:12:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Debugger
|