diff options
author | hjk <qtc-committer@nokia.com> | 2010-12-10 10:01:29 +0100 |
---|---|---|
committer | hjk <qtc-committer@nokia.com> | 2010-12-10 12:42:40 +0100 |
commit | 91e6c14ff921b35aabeb87ce3bdddc356f795b4c (patch) | |
tree | 071a6d11c2d0b12fde57477b89f8104c0795b958 /src/plugins/debugger/snapshothandler.cpp | |
parent | 18986b8ccb6458a6723f2ab884ff5cbbb44a3cde (diff) | |
download | qt-creator-91e6c14ff921b35aabeb87ce3bdddc356f795b4c.tar.gz |
debugger: find better separation between runcontrol and engine
Diffstat (limited to 'src/plugins/debugger/snapshothandler.cpp')
-rw-r--r-- | src/plugins/debugger/snapshothandler.cpp | 41 |
1 files changed, 11 insertions, 30 deletions
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<DebuggerRunControl*> SnapshotHandler::runControls() const -{ - // Return unique list of run controls - QList<DebuggerRunControl*> rc; - rc.reserve(m_snapshots.size()); - foreach(const QPointer<DebuggerRunControl> &runControlPtr, m_snapshots) - if (DebuggerRunControl *runControl = runControlPtr) - if (!rc.contains(runControl)) - rc.push_back(runControl); - return rc; -} - } // namespace Internal } // namespace Debugger |