From 91e6c14ff921b35aabeb87ce3bdddc356f795b4c Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 10 Dec 2010 10:01:29 +0100 Subject: debugger: find better separation between runcontrol and engine --- src/plugins/debugger/snapshothandler.cpp | 41 +++++++++----------------------- 1 file changed, 11 insertions(+), 30 deletions(-) (limited to 'src/plugins/debugger/snapshothandler.cpp') diff --git a/src/plugins/debugger/snapshothandler.cpp b/src/plugins/debugger/snapshothandler.cpp index 93d5b16e83..a270aa0a08 100644 --- a/src/plugins/debugger/snapshothandler.cpp +++ b/src/plugins/debugger/snapshothandler.cpp @@ -123,21 +123,14 @@ SnapshotHandler::SnapshotHandler() SnapshotHandler::~SnapshotHandler() { for (int i = m_snapshots.size(); --i >= 0; ) { - if (DebuggerEngine *engine = engineAt(i)) { - const DebuggerStartParameters & sp = engine->startParameters(); + if (DebuggerEngine *engine = at(i)) { + const DebuggerStartParameters &sp = engine->startParameters(); if (sp.isSnapshot && !sp.coreFile.isEmpty()) QFile::remove(sp.coreFile); } } } -DebuggerEngine *SnapshotHandler::engineAt(int i) const -{ - DebuggerEngine *engine = m_snapshots.at(i)->engine(); - QTC_ASSERT(engine, qDebug() << "ENGINE AT " << i << "DELETED"); - return engine; -} - int SnapshotHandler::rowCount(const QModelIndex &parent) const { // Since the stack is not a tree, row count is 0 for any valid parent @@ -154,7 +147,7 @@ QVariant SnapshotHandler::data(const QModelIndex &index, int role) const if (!index.isValid() || index.row() >= m_snapshots.size()) return QVariant(); - const DebuggerEngine *engine = engineAt(index.row()); + const DebuggerEngine *engine = at(index.row()); if (role == SnapshotCapabilityRole) return engine && (engine->debuggerCapabilities() & SnapshotCapability); @@ -213,20 +206,20 @@ void SnapshotHandler::activateSnapshot(int index) { m_currentIndex = index; //qDebug() << "ACTIVATING INDEX: " << m_currentIndex << " OF " << size(); - debuggerCore()->displayDebugger(engineAt(index), true); + debuggerCore()->displayDebugger(at(index), true); reset(); } void SnapshotHandler::createSnapshot(int index) { - DebuggerEngine *engine = engineAt(index); + DebuggerEngine *engine = at(index); QTC_ASSERT(engine, return); engine->createSnapshot(); } void SnapshotHandler::removeSnapshot(int index) { - DebuggerEngine *engine = engineAt(index); + DebuggerEngine *engine = at(index); //qDebug() << "REMOVING " << engine; QTC_ASSERT(engine, return); #if 0 @@ -254,17 +247,17 @@ void SnapshotHandler::removeAll() reset(); } -void SnapshotHandler::appendSnapshot(DebuggerRunControl *rc) +void SnapshotHandler::appendSnapshot(DebuggerEngine *engine) { - m_snapshots.append(rc); + m_snapshots.append(engine); m_currentIndex = size() - 1; reset(); } -void SnapshotHandler::removeSnapshot(DebuggerRunControl *rc) +void SnapshotHandler::removeSnapshot(DebuggerEngine *engine) { // Could be that the run controls died before it was appended. - int index = m_snapshots.indexOf(rc); + int index = m_snapshots.indexOf(engine); if (index != -1) removeSnapshot(index); } @@ -275,22 +268,10 @@ void SnapshotHandler::setCurrentIndex(int index) reset(); } -DebuggerRunControl *SnapshotHandler::at(int i) const +DebuggerEngine *SnapshotHandler::at(int i) const { return m_snapshots.at(i).data(); } -QList SnapshotHandler::runControls() const -{ - // Return unique list of run controls - QList rc; - rc.reserve(m_snapshots.size()); - foreach(const QPointer &runControlPtr, m_snapshots) - if (DebuggerRunControl *runControl = runControlPtr) - if (!rc.contains(runControl)) - rc.push_back(runControl); - return rc; -} - } // namespace Internal } // namespace Debugger -- cgit v1.2.1