5 Retracer::Retracer(QObject *parent)
8 m_doubleBuffered(true),
15 QString Retracer::fileName() const
20 void Retracer::setFileName(const QString &name)
25 bool Retracer::isBenchmarking() const
27 return m_benchmarking;
30 void Retracer::setBenchmarking(bool bench)
32 m_benchmarking = bench;
35 bool Retracer::isDoubleBuffered() const
37 return m_doubleBuffered;
40 void Retracer::setDoubleBuffered(bool db)
42 m_doubleBuffered = db;
45 void Retracer::start()
49 QString format = QLatin1String("%1;");
51 QString format = QLatin1String("%1:");
53 QString buildPath = format.arg(BUILD_DIR);
54 QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
55 env.insert("PATH", buildPath + env.value("PATH"));
57 qputenv("PATH", env.value("PATH").toLatin1());
59 m_process = new QProcess(this);
60 m_process->setProcessEnvironment(env);
62 connect(m_process, SIGNAL(finished(int, QProcess::ExitStatus)),
63 this, SLOT(replayFinished()));
64 connect(m_process, SIGNAL(error(QProcess::ProcessError)),
65 this, SLOT(replayError(QProcess::ProcessError)));
68 QStringList arguments;
71 arguments << QLatin1String("-D");
72 arguments << QString::number(m_captureCall);
75 arguments << QLatin1String("-b");
77 if (m_doubleBuffered) {
78 arguments << QLatin1String("-db");
82 arguments << m_fileName;
84 m_process->start(QLatin1String("glretrace"), arguments);
87 void Retracer::terminate()
90 m_process->terminate();
94 void Retracer::setCaptureAtCallNumber(qlonglong num)
99 qlonglong Retracer::captureAtCallNumber() const
101 return m_captureCall;
104 bool Retracer::captureState() const
106 return m_captureState;
109 void Retracer::setCaptureState(bool enable)
111 m_captureState = enable;
114 void Retracer::replayFinished()
116 QByteArray output = m_process->readAllStandardOutput();
119 qDebug()<<"Process finished = ";
120 qDebug()<<"\terr = "<<m_process->readAllStandardError();
121 qDebug()<<"\tout = "<<output;
123 emit finished(output);
126 void Retracer::replayError(QProcess::ProcessError err)
128 qDebug()<<"Process error = "<<err;
129 qDebug()<<"\terr = "<<m_process->readAllStandardError();
130 qDebug()<<"\tout = "<<m_process->readAllStandardOutput();
133 tr("Couldn't execute the replay file '%1'").arg(m_fileName));
136 #include "retracer.moc"