debugger: move SnapshotHandler from DebuggerManager to DebuggerRunControl

This commit is contained in:
hjk
2010-06-15 12:15:25 +02:00
parent 7332f1e016
commit 25c11c4ce0
9 changed files with 74 additions and 69 deletions

View File

@@ -30,6 +30,9 @@
#include "snapshothandler.h"
#include "debuggeractions.h"
#include "debuggerconstants.h"
#include "debuggerrunner.h"
#include "idebuggerengine.h"
#include <utils/qtcassert.h>
#include <utils/savedaction.h>
@@ -109,8 +112,9 @@ QDebug operator<<(QDebug d, const SnapshotData &f)
//
////////////////////////////////////////////////////////////////////////
SnapshotHandler::SnapshotHandler(QObject *parent)
SnapshotHandler::SnapshotHandler(DebuggerRunControl *runControl, QObject *parent)
: QAbstractTableModel(parent),
m_runControl(runControl),
m_positionIcon(QIcon(":/debugger/images/location_16.png")),
m_emptyIcon(QIcon(":/debugger/images/debugger_empty_14.png"))
{
@@ -203,6 +207,24 @@ Qt::ItemFlags SnapshotHandler::flags(const QModelIndex &index) const
return true ? QAbstractTableModel::flags(index) : Qt::ItemFlags(0);
}
bool SnapshotHandler::setData
(const QModelIndex &index, const QVariant &value, int role)
{
if (role == RequestMakeSnapshotRole) {
m_runControl->engine()->makeSnapshot();
return true;
}
if (role == RequestActivateSnapshotRole) {
m_runControl->engine()->activateSnapshot(value.toInt());
return true;
}
if (role == RequestRemoveSnapshotRole) {
removeSnapshot(value.toInt());
return true;
}
return QAbstractTableModel::setData(index, value, role);
}
void SnapshotHandler::removeAll()
{
m_snapshots.clear();