From aae95a24a253d57374da62e7176df7155ee30ec6 Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Thu, 22 Jul 2010 12:02:09 +0200 Subject: [PATCH] debugger: improve launch progress display --- src/plugins/debugger/debuggerengine.cpp | 32 +++++++++++++++---------- src/plugins/debugger/debuggerplugin.cpp | 2 +- src/plugins/debugger/gdb/gdbengine.cpp | 2 ++ 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index 90e31216b55..8d692a1f2aa 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -682,7 +682,7 @@ void DebuggerEngine::showMessage(const QString &msg, int channel, int timeout) c void DebuggerEngine::startDebugger(DebuggerRunControl *runControl) { if (!isSessionEngine()) { - d->m_progress.setProgressRange(0, 100); + d->m_progress.setProgressRange(0, 1000); Core::FutureProgress *fp = Core::ICore::instance()->progressManager() ->addTask(d->m_progress.future(), tr("Launching"), _("Debugger.Launcher")); @@ -718,7 +718,7 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl) qDebug() << state()); setState(EngineSetupRequested); - d->m_progress.setProgressValue(20); + d->m_progress.setProgressValue(200); setupEngine(); } @@ -890,9 +890,10 @@ void DebuggerEngine::addToWatchWindow() // Called from RunControl. void DebuggerEngine::handleStartFailed() { + showMessage("HANDLE RUNCONTROL START FAILED"); d->m_runControl = 0; - d->m_progress.setProgressValue(90); + d->m_progress.setProgressValue(900); d->m_progress.reportCanceled(); d->m_progress.reportFinished(); } @@ -900,6 +901,7 @@ void DebuggerEngine::handleStartFailed() // Called from RunControl. void DebuggerEngine::handleFinished() { + showMessage("HANDLE RUNCONTROL FINISHED"); d->m_runControl = 0; modulesHandler()->removeAll(); stackHandler()->removeAll(); @@ -911,7 +913,7 @@ void DebuggerEngine::handleFinished() breakHandler()->storeToTemplate(sessionTemplate->breakHandler()); watchHandler()->storeToTemplate(sessionTemplate->watchHandler()); - d->m_progress.setProgressValue(100); + d->m_progress.setProgressValue(1000); d->m_progress.reportFinished(); } @@ -1090,11 +1092,8 @@ void DebuggerEngine::notifyEngineSetupOk() QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state()); setState(EngineSetupOk); QTC_ASSERT(d->m_runControl, /**/); - if (d->m_runControl) { - d->m_progress.setProgressValue(100); - d->m_progress.reportFinished(); + if (d->m_runControl) d->m_runControl->startSuccessful(); - } showMessage(_("QUEUE: SETUP INFERIOR")); QTimer::singleShot(0, d, SLOT(doSetupInferior())); } @@ -1103,7 +1102,7 @@ void DebuggerEnginePrivate::doSetupInferior() { m_engine->showMessage(_("CALL: SETUP INFERIOR")); QTC_ASSERT(state() == EngineSetupOk, qDebug() << state()); - m_progress.setProgressValue(25); + m_progress.setProgressValue(250); m_engine->setState(InferiorSetupRequested); m_engine->setupInferior(); } @@ -1127,13 +1126,15 @@ void DebuggerEnginePrivate::doRunEngine() { m_engine->showMessage(_("CALL: RUN ENGINE")); QTC_ASSERT(state() == EngineRunRequested, qDebug() << state()); - m_progress.setProgressValue(30); + m_progress.setProgressValue(300); m_engine->runEngine(); } void DebuggerEngine::notifyInferiorUnrunnable() { showMessage(_("NOTE: INFERIOR UNRUNNABLE")); + d->m_progress.setProgressValue(1000); + d->m_progress.reportFinished(); QTC_ASSERT(state() == EngineRunRequested, qDebug() << state()); setState(InferiorUnrunnable); } @@ -1142,6 +1143,9 @@ void DebuggerEngine::notifyEngineRunFailed() { showMessage(_("NOTE: ENGINE RUN FAILED")); QTC_ASSERT(state() == EngineRunRequested, qDebug() << state()); + d->m_progress.setProgressValue(900); + d->m_progress.reportCanceled(); + d->m_progress.reportFinished(); setState(EngineRunFailed); d->queueShutdownInferior(); } @@ -1149,6 +1153,8 @@ void DebuggerEngine::notifyEngineRunFailed() void DebuggerEngine::notifyEngineRunAndInferiorRunOk() { showMessage(_("NOTE: ENGINE RUN AND INFERIOR RUN OK")); + d->m_progress.setProgressValue(1000); + d->m_progress.reportFinished(); QTC_ASSERT(state() == EngineRunRequested, qDebug() << state()); setState(InferiorRunRequested); notifyInferiorRunOk(); @@ -1157,6 +1163,8 @@ void DebuggerEngine::notifyEngineRunAndInferiorRunOk() void DebuggerEngine::notifyEngineRunAndInferiorStopOk() { showMessage(_("NOTE: ENGINE RUN AND INFERIOR STOP OK")); + d->m_progress.setProgressValue(1000); + d->m_progress.reportFinished(); QTC_ASSERT(state() == EngineRunRequested, qDebug() << state()); setState(InferiorStopRequested); notifyInferiorStopOk(); @@ -1471,8 +1479,8 @@ void DebuggerEngine::requestInterruptInferior() void DebuggerEngine::progressPing() { - int progress = d->m_progress.progressValue(); - d->m_progress.setProgressValue(qMin(70, progress + 1)); + int progress = qMin(d->m_progress.progressValue() + 2, 800); + d->m_progress.setProgressValue(progress); } QMessageBox *DebuggerEngine::showMessageBox(int icon, const QString &title, diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 7fe74462a54..d0eab4e00b3 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -2262,7 +2262,7 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine) // This is only needed when we insist on using Shift-F5 for Interrupt. // Removing the block makes F5 interrupt when running and continue when stopped. Core::ActionManager *am = core->actionManager(); - if (stopped) { + if (m_state == InferiorStopOk || m_state == InferiorUnrunnable) { am->command(Constants::STOP)->setKeySequence(QKeySequence(STOP_KEY)); am->command(PE::DEBUG)->setKeySequence(QKeySequence("F5")); } else { diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 06b81a2c003..2bd893c29ff 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -496,10 +496,12 @@ void GdbEngine::handleResponse(const QByteArray &buff) // Show some messages to give the impression something happens. if (data.startsWith("Reading symbols from ")) { showStatusMessage(tr("Reading %1...").arg(_(data.mid(21))), 1000); + progressPing(); invalidateSourcesList(); } else if (data.startsWith("[New ") || data.startsWith("[Thread ")) { if (data.endsWith('\n')) data.chop(1); + progressPing(); showStatusMessage(_(data), 1000); } break; -- GitLab