]> git.cworth.org Git - apitrace/commitdiff
Merge branch 'gui-thumbnails'
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Sat, 24 Mar 2012 09:30:51 +0000 (09:30 +0000)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Sat, 24 Mar 2012 09:30:51 +0000 (09:30 +0000)
1  2 
gui/mainwindow.cpp
gui/mainwindow.h

diff --combined gui/mainwindow.cpp
index 039889ca1aa5bd0a9987cb35d2cc38eb808654cc,023635197051bcf1023ad1727a53fe0c2821c504..fce9984a33c89fc8b34b8ecca08d597ab3af3c42
@@@ -148,10 -148,6 +148,10 @@@ void MainWindow::callItemSelected(cons
      }
  }
  
 +void MainWindow::callItemActivated(const QModelIndex &index) {
 +    lookupState();
 +}
 +
  void MainWindow::replayStart()
  {
      if (m_trace->isSaving()) {
              dlgUi.doubleBufferingCB->isChecked());
          m_retracer->setBenchmarking(
              !dlgUi.errorCheckCB->isChecked());
-         replayTrace(false);
+         replayTrace(false, true);
      }
  }
  
@@@ -186,6 -182,7 +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)
      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 -212,7 +216,7 @@@ void MainWindow::replayFinished(const Q
      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 -234,7 +238,7 @@@ void MainWindow::replayError(const QStr
      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 -269,7 +273,7 @@@ void MainWindow::finishedLoadingTrace(
      }
  }
  
- void MainWindow::replayTrace(bool dumpState)
+ void MainWindow::replayTrace(bool dumpState, bool dumpThumbnails)
  {
      if (m_trace->fileName().isEmpty()) {
          return;
      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) {
  
      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 -336,12 +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 -739,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*)),
              this, SLOT(replayError(const QString&)));
      connect(m_retracer, SIGNAL(foundState(ApiTraceState*)),
              this, SLOT(replayStateFound(ApiTraceState*)));
+     connect(m_retracer, SIGNAL(foundThumbnails(const QList<QImage>&)),
+             this, SLOT(replayThumbnailsFound(const QList<QImage>&)));
      connect(m_retracer, SIGNAL(retraceErrors(const QList<ApiTraceError>&)),
              this, SLOT(slotRetraceErrors(const QList<ApiTraceError>&)));
  
              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()));
  
      connect(m_ui.callView->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
              this, SLOT(callItemSelected(const QModelIndex &)));
 +    connect(m_ui.callView, SIGNAL(doubleClicked(const QModelIndex &)),
 +            this, SLOT(callItemActivated(const QModelIndex &)));
      connect(m_ui.callView, SIGNAL(customContextMenuRequested(QPoint)),
              this, SLOT(customContextMenuRequested(QPoint)));
  
@@@ -838,6 -855,11 +861,11 @@@ void MainWindow::replayStateFound(ApiTr
      m_nonDefaultsLookupEvent = 0;
  }
  
+ void MainWindow::replayThumbnailsFound(const QList<QImage> &thumbnails)
+ {
+     m_trace->bindThumbnailsToFrames(thumbnails);
+ }
  void MainWindow::slotGoTo()
  {
      m_searchWidget->hide();
@@@ -1013,11 -1035,14 +1041,14 @@@ ApiTraceFrame * MainWindow::selectedFra
      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<ApiTraceCall*>(event);
+             m_ui.detailsWebView->setHtml(call->toHtml());
+         }
      }
  }
  
diff --combined gui/mainwindow.h
index 66be2e20d88692802fe31c5952947077db237747,76ae5948e042232f884b70e1a14d4130851eb8c6..d65aa0e84749ea6df648d2b9f2a79ff628e0565a
@@@ -8,6 -8,8 +8,8 @@@
  
  #include <QMainWindow>
  #include <QProcess>
+ #include <QList>
+ #include <QImage>
  
  class ApiTrace;
  class ApiTraceCall;
@@@ -41,18 -43,19 +43,20 @@@ public slots
  
  private slots:
      void callItemSelected(const QModelIndex &index);
 +    void callItemActivated(const QModelIndex &index);
      void createTrace();
      void openTrace();
      void replayStart();
      void replayStop();
      void replayFinished(const QString &output);
      void replayStateFound(ApiTraceState *state);
+     void replayThumbnailsFound(const QList<QImage> &thumbnails);
      void replayError(const QString &msg);
      void startedLoadingTrace();
      void loadProgess(int percent);
      void finishedLoadingTrace();
      void lookupState();
+     void showThumbnails();
      void showSettings();
      void openHelp(const QUrl &url);
      void showSurfacesMenu(const QPoint &pos);
@@@ -72,7 -75,7 +76,7 @@@
      void slotSaved();
      void slotGoFrameStart();
      void slotGoFrameEnd();
-     void slotTraceChanged(ApiTraceCall *call);
+     void slotTraceChanged(ApiTraceEvent *event);
      void slotRetraceErrors(const QList<ApiTraceError> &errors);
      void slotErrorSelected(QTreeWidgetItem *current);
      void slotSearchResult(const ApiTrace::SearchRequest &request,
@@@ -86,7 -89,7 +90,7 @@@ private
      void initObjects();
      void initConnections();
      void newTraceFile(const QString &fileName);
-     void replayTrace(bool dumpState);
+     void replayTrace(bool dumpState, bool dumpThumbnails);
      void fillStateForFrame();
  
      /* there's a difference between selected frame/call and