X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=gui%2Fmainwindow.cpp;h=fce9984a33c89fc8b34b8ecca08d597ab3af3c42;hb=97ac28e65ca20b5649552597afaeee1d67766f6a;hp=039889ca1aa5bd0a9987cb35d2cc38eb808654cc;hpb=561266b131b7a44cd80fca436462529a56393299;p=apitrace diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 039889c..fce9984 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -176,7 +176,7 @@ void MainWindow::replayStart() dlgUi.doubleBufferingCB->isChecked()); m_retracer->setBenchmarking( !dlgUi.errorCheckCB->isChecked()); - replayTrace(false); + replayTrace(false, true); } } @@ -186,6 +186,7 @@ void MainWindow::replayStop() m_ui.actionStop->setEnabled(false); m_ui.actionReplay->setEnabled(true); m_ui.actionLookupState->setEnabled(true); + m_ui.actionShowThumbnails->setEnabled(true); } void MainWindow::newTraceFile(const QString &fileName) @@ -198,11 +199,13 @@ void MainWindow::newTraceFile(const QString &fileName) if (fileName.isEmpty()) { m_ui.actionReplay->setEnabled(false); m_ui.actionLookupState->setEnabled(false); + m_ui.actionShowThumbnails->setEnabled(false); setWindowTitle(tr("QApiTrace")); } else { QFileInfo info(fileName); m_ui.actionReplay->setEnabled(true); m_ui.actionLookupState->setEnabled(true); + m_ui.actionShowThumbnails->setEnabled(true); setWindowTitle( tr("QApiTrace - %1").arg(info.fileName())); } @@ -213,6 +216,7 @@ void MainWindow::replayFinished(const QString &output) m_ui.actionStop->setEnabled(false); m_ui.actionReplay->setEnabled(true); m_ui.actionLookupState->setEnabled(true); + m_ui.actionShowThumbnails->setEnabled(true); m_progressBar->hide(); if (output.length() < 80) { @@ -234,6 +238,7 @@ void MainWindow::replayError(const QString &message) m_ui.actionStop->setEnabled(false); m_ui.actionReplay->setEnabled(true); m_ui.actionLookupState->setEnabled(true); + m_ui.actionShowThumbnails->setEnabled(true); m_stateEvent = 0; m_nonDefaultsLookupEvent = 0; @@ -268,7 +273,7 @@ void MainWindow::finishedLoadingTrace() } } -void MainWindow::replayTrace(bool dumpState) +void MainWindow::replayTrace(bool dumpState, bool dumpThumbnails) { if (m_trace->fileName().isEmpty()) { return; @@ -277,6 +282,7 @@ void MainWindow::replayTrace(bool dumpState) m_retracer->setFileName(m_trace->fileName()); m_retracer->setAPI(m_api); m_retracer->setCaptureState(dumpState); + m_retracer->setCaptureThumbnails(dumpThumbnails); if (m_retracer->captureState() && m_selectedEvent) { int index = 0; if (m_selectedEvent->type() == ApiTraceEvent::Call) { @@ -300,9 +306,17 @@ void MainWindow::replayTrace(bool dumpState) m_ui.actionStop->setEnabled(true); m_progressBar->show(); - if (dumpState) { - statusBar()->showMessage( - tr("Looking up the state...")); + if (dumpState || dumpThumbnails) { + if (dumpState && dumpThumbnails) { + statusBar()->showMessage( + tr("Looking up the state and capturing thumbnails...")); + } else if (dumpState) { + statusBar()->showMessage( + tr("Looking up the state...")); + } else if (dumpThumbnails) { + statusBar()->showMessage( + tr("Capturing thumbnails...")); + } } else { statusBar()->showMessage( tr("Replaying the trace file...")); @@ -326,7 +340,12 @@ void MainWindow::lookupState() return; } m_stateEvent = m_selectedEvent; - replayTrace(true); + replayTrace(true, false); +} + +void MainWindow::showThumbnails() +{ + replayTrace(false, true); } MainWindow::~MainWindow() @@ -724,8 +743,8 @@ void MainWindow::initConnections() this, SLOT(slotStartedSaving())); connect(m_trace, SIGNAL(saved()), this, SLOT(slotSaved())); - connect(m_trace, SIGNAL(changed(ApiTraceCall*)), - this, SLOT(slotTraceChanged(ApiTraceCall*))); + connect(m_trace, SIGNAL(changed(ApiTraceEvent*)), + this, SLOT(slotTraceChanged(ApiTraceEvent*))); connect(m_trace, SIGNAL(findResult(ApiTrace::SearchRequest,ApiTrace::SearchResult,ApiTraceCall*)), this, SLOT(slotSearchResult(ApiTrace::SearchRequest,ApiTrace::SearchResult,ApiTraceCall*))); connect(m_trace, SIGNAL(foundFrameStart(ApiTraceFrame*)), @@ -741,6 +760,8 @@ void MainWindow::initConnections() this, SLOT(replayError(const QString&))); connect(m_retracer, SIGNAL(foundState(ApiTraceState*)), this, SLOT(replayStateFound(ApiTraceState*))); + connect(m_retracer, SIGNAL(foundThumbnails(const QList&)), + this, SLOT(replayThumbnailsFound(const QList&))); connect(m_retracer, SIGNAL(retraceErrors(const QList&)), this, SLOT(slotRetraceErrors(const QList&))); @@ -778,6 +799,8 @@ void MainWindow::initConnections() this, SLOT(replayStop())); connect(m_ui.actionLookupState, SIGNAL(triggered()), this, SLOT(lookupState())); + connect(m_ui.actionShowThumbnails, SIGNAL(triggered()), + this, SLOT(showThumbnails())); connect(m_ui.actionOptions, SIGNAL(triggered()), this, SLOT(showSettings())); @@ -838,6 +861,11 @@ void MainWindow::replayStateFound(ApiTraceState *state) m_nonDefaultsLookupEvent = 0; } +void MainWindow::replayThumbnailsFound(const QList &thumbnails) +{ + m_trace->bindThumbnailsToFrames(thumbnails); +} + void MainWindow::slotGoTo() { m_searchWidget->hide(); @@ -1013,11 +1041,14 @@ ApiTraceFrame * MainWindow::selectedFrame() const return NULL; } -void MainWindow::slotTraceChanged(ApiTraceCall *call) +void MainWindow::slotTraceChanged(ApiTraceEvent *event) { - Q_ASSERT(call); - if (call == m_selectedEvent) { - m_ui.detailsWebView->setHtml(call->toHtml()); + Q_ASSERT(event); + if (event == m_selectedEvent) { + if (event->type() == ApiTraceEvent::Call) { + ApiTraceCall *call = static_cast(event); + m_ui.detailsWebView->setHtml(call->toHtml()); + } } }