Commit 1dacb9e5 authored by hjk's avatar hjk
Browse files

debugger: convert threads model

parent b7796bf3
......@@ -229,9 +229,6 @@ enum ModelRoles
RequestShowMemoryRole,
RequestShowDisassemblerRole,
// Threads
RequestSelectThreadRole,
// Modules
RequestReloadModulesRole,
RequestExamineModulesRole,
......
......@@ -228,7 +228,7 @@ public:
m_registerHandler(),
m_sourceFilesHandler(engine),
m_stackHandler(engine),
m_threadsHandler(engine),
m_threadsHandler(),
m_watchHandler(engine),
m_disassemblerViewAgent(engine),
m_isSlaveEngine(false)
......
......@@ -30,7 +30,6 @@
#include "threadshandler.h"
#include "debuggerconstants.h"
#include "debuggerengine.h"
#include <QtCore/QDebug>
#include <QtCore/QTextStream>
......@@ -43,7 +42,8 @@ namespace Internal {
// ThreadsHandler
//
///////////////////////////////////////////////////////////////////////
static inline QString threadToolTip(const ThreadData &thread)
static QString threadToolTip(const ThreadData &thread)
{
const char tableRowStartC[] = "<tr><td>";
const char tableRowSeparatorC[] = "</td><td>";
......@@ -87,9 +87,8 @@ static inline QString threadToolTip(const ThreadData &thread)
//
///////////////////////////////////////////////////////////////////////
ThreadsHandler::ThreadsHandler(DebuggerEngine *engine)
: m_engine(engine),
m_currentIndex(0),
ThreadsHandler::ThreadsHandler()
: m_currentIndex(0),
m_positionIcon(QLatin1String(":/debugger/images/location_16.png")),
m_emptyIcon(QLatin1String(":/debugger/images/debugger_empty_14.png"))
{
......@@ -179,16 +178,6 @@ QVariant ThreadsHandler::headerData
return QVariant();
}
bool ThreadsHandler::setData
(const QModelIndex &index, const QVariant &value, int role)
{
if (role == RequestSelectThreadRole) {
m_engine->selectThread(value.toInt());
return true;
}
return QAbstractTableModel::setData(index, value, role);
}
int ThreadsHandler::currentThreadId() const
{
if (m_currentIndex < 0 || m_currentIndex >= m_threads.size())
......
......@@ -38,8 +38,6 @@
#include "threaddata.h"
namespace Debugger {
class DebuggerEngine;
namespace Internal {
////////////////////////////////////////////////////////////////////////
......@@ -54,7 +52,7 @@ class ThreadsHandler : public QAbstractTableModel
Q_OBJECT
public:
explicit ThreadsHandler(DebuggerEngine *engine);
ThreadsHandler();
int currentThread() const { return m_currentIndex; }
void setCurrentThread(int index);
......@@ -75,12 +73,9 @@ 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;
bool setData(const QModelIndex &index, const QVariant &value, int role);
QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const;
private:
DebuggerEngine *m_engine;
Threads m_threads;
int m_currentIndex;
const QIcon m_positionIcon;
......
......@@ -29,8 +29,11 @@
#include "threadswindow.h"
#include "threadshandler.h"
#include "debuggeractions.h"
#include "debuggerconstants.h"
#include "debuggerengine.h"
#include "debuggerplugin.h"
#include <utils/savedaction.h>
......@@ -107,7 +110,8 @@ void ThreadsWindow::setAlwaysResizeColumnsToContents(bool on)
void ThreadsWindow::selectThread(int index)
{
model()->setData(QModelIndex(), index, RequestSelectThreadRole);
DebuggerPlugin::instance()->currentEngine()
->threadsHandler()->selectThread(index);
}
} // namespace Internal
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment