+void MainWindow::replayTrace(bool dumpState)
+{
+ if (!m_replayProcess) {
+#ifdef Q_OS_WIN
+ QString format = QLatin1String("%1;");
+#else
+ QString format = QLatin1String("%1:");
+#endif
+ QString buildPath = format.arg(BUILD_DIR);
+ QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
+ env.insert("PATH", buildPath + env.value("PATH"));
+
+ qputenv("PATH", env.value("PATH").toLatin1());
+
+ m_replayProcess = new QProcess(this);
+ m_replayProcess->setProcessEnvironment(env);
+
+ connect(m_replayProcess, SIGNAL(finished(int, QProcess::ExitStatus)),
+ this, SLOT(replayFinished()));
+ connect(m_replayProcess, SIGNAL(error(QProcess::ProcessError)),
+ this, SLOT(replayError(QProcess::ProcessError)));
+ }
+
+ if (m_traceFileName.isEmpty())
+ return;
+
+ QStringList arguments;
+ if (dumpState &&
+ m_currentFrame && !m_currentFrame->calls.isEmpty()) {
+ arguments << QLatin1String("-D");
+ arguments << QString::number(m_currentFrame->calls.first()->index);
+ }
+ arguments << m_traceFileName;
+
+ m_replayProcess->start(QLatin1String("glretrace"),
+ arguments);
+
+ m_ui.actionStop->setEnabled(true);
+}
+
+void MainWindow::lookupState()
+{
+ if (!m_currentFrame) {
+ QMessageBox::warning(
+ this, tr("Unknown Frame"),
+ tr("To inspect the state select a frame in the trace."));
+ return;
+ }
+ m_findingState = true;
+ replayTrace(true);
+}
+