#include "shaderssourcewidget.h"
#include "tracedialog.h"
#include "traceprocess.h"
+#include "trimprocess.h"
#include "thumbnail.h"
#include "ui_retracerdialog.h"
#include "vertexdatainterpreter.h"
m_ui.actionReplay->setEnabled(true);
m_ui.actionLookupState->setEnabled(true);
m_ui.actionShowThumbnails->setEnabled(true);
+ m_ui.actionTrim->setEnabled(true);
setWindowTitle(
tr("QApiTrace - %1").arg(info.fileName()));
}
}
-void MainWindow::replayFinished(const QString &output)
+void MainWindow::replayFinished(const QString &message)
{
m_ui.actionStop->setEnabled(false);
m_ui.actionReplay->setEnabled(true);
m_ui.actionShowThumbnails->setEnabled(true);
m_progressBar->hide();
- if (output.length() < 80) {
- statusBar()->showMessage(output);
- }
+ statusBar()->showMessage(message, 2000);
m_stateEvent = 0;
m_ui.actionShowErrorsDock->setEnabled(m_trace->hasErrors());
m_ui.errorsDock->setVisible(m_trace->hasErrors());
if (!m_trace->hasErrors()) {
m_ui.errorsTreeWidget->clear();
}
-
- statusBar()->showMessage(
- tr("Replaying finished!"), 2000);
}
void MainWindow::replayError(const QString &message)
if (!m_trace) {
return;
}
+ m_api = m_trace->api();
QFileInfo info(m_trace->fileName());
statusBar()->showMessage(
tr("Loaded %1").arg(info.fileName()), 3000);
}
}
+void MainWindow::trimEvent()
+{
+
+ int trimIndex;
+ if (m_trimEvent->type() == ApiTraceEvent::Call) {
+ ApiTraceCall *call = static_cast<ApiTraceCall*>(m_trimEvent);
+ trimIndex = call->index();
+ } else if (m_trimEvent->type() == ApiTraceEvent::Frame) {
+ ApiTraceFrame *frame = static_cast<ApiTraceFrame*>(m_trimEvent);
+ const QList<ApiTraceFrame*> frames = m_trace->frames();
+ trimIndex = frame->lastCallIndex();
+ }
+
+ m_trimProcess->setTracePath(m_trace->fileName());
+ m_trimProcess->setTrimIndex(trimIndex);
+
+ m_trimProcess->start();
+}
+
void MainWindow::lookupState()
{
if (!m_selectedEvent) {
replayTrace(false, true);
}
+void MainWindow::trim()
+{
+ if (!m_selectedEvent) {
+ QMessageBox::warning(
+ this, tr("Unknown Event"),
+ tr("To trim select a frame or an event in the event list."));
+ return;
+ }
+ m_trimEvent = m_selectedEvent;
+ trimEvent();
+}
+
MainWindow::~MainWindow()
{
delete m_trace;
m_searchWidget->hide();
m_traceProcess = new TraceProcess(this);
+ m_trimProcess = new TrimProcess(this);
}
void MainWindow::initConnections()
this, SLOT(replayStop()));
connect(m_ui.actionLookupState, SIGNAL(triggered()),
this, SLOT(lookupState()));
+ connect(m_ui.actionTrim, SIGNAL(triggered()),
+ this, SLOT(trim()));
connect(m_ui.actionShowThumbnails, SIGNAL(triggered()),
this, SLOT(showThumbnails()));
connect(m_ui.actionOptions, SIGNAL(triggered()),
connect(m_traceProcess, SIGNAL(error(const QString&)),
SLOT(traceError(const QString&)));
+ connect(m_trimProcess, SIGNAL(trimmedFile(const QString&)),
+ SLOT(createdTrim(const QString&)));
+ connect(m_trimProcess, SIGNAL(error(const QString&)),
+ SLOT(trimError(const QString&)));
+
connect(m_ui.errorsDock, SIGNAL(visibilityChanged(bool)),
m_ui.actionShowErrorsDock, SLOT(setChecked(bool)));
connect(m_ui.actionShowErrorsDock, SIGNAL(triggered(bool)),
msg);
}
+void MainWindow::createdTrim(const QString &path)
+{
+ qDebug()<<"Done trimming "<<path;
+
+ newTraceFile(path);
+}
+
+void MainWindow::trimError(const QString &msg)
+{
+ QMessageBox::warning(
+ this,
+ tr("Trim Error"),
+ msg);
+}
+
void MainWindow::slotSearch()
{
m_jumpWidget->hide();