]> git.cworth.org Git - apitrace/blobdiff - gui/mainwindow.cpp
cli: Fix invalid option message.
[apitrace] / gui / mainwindow.cpp
index 23729cd6d274f7f7b920fb2278286b13dcc6a05c..3accf6e9489f0ecca39b8dc777f13292c3258c93 100644 (file)
@@ -370,8 +370,11 @@ void MainWindow::replayTrace(bool dumpState, bool dumpThumbnails)
 
 void MainWindow::trimEvent()
 {
+    int trimIndex = 0;
+
+    Q_ASSERT(m_trimEvent->type() == ApiTraceEvent::Call ||
+             m_trimEvent->type() == ApiTraceEvent::Frame);
 
-    int trimIndex;
     if (m_trimEvent->type() == ApiTraceEvent::Call) {
         ApiTraceCall *call = static_cast<ApiTraceCall*>(m_trimEvent);
         trimIndex = call->index();
@@ -572,7 +575,7 @@ static void addSurfaceItem(const ApiSurface &surface,
     l->setWordWrap(true);
     tree->setItemWidget(item, 1, l);
 
-    item->setData(0, Qt::UserRole, surface.image());
+    item->setData(0, Qt::UserRole, surface.base64Data());
 }
 
 void MainWindow::fillStateForFrame()
@@ -719,8 +722,8 @@ void MainWindow::showSelectedSurface()
     viewer->setAttribute(Qt::WA_DeleteOnClose, true);
 
     QVariant var = item->data(0, Qt::UserRole);
-    QImage img = var.value<QImage>();
-    viewer->setImage(img);
+    QByteArray base64Data = var.value<QByteArray>();
+    viewer->setBase64Data(base64Data);
 
     viewer->show();
     viewer->raise();
@@ -1262,7 +1265,8 @@ void MainWindow::saveSelectedSurface()
         imageIndex = tr("_call_%1")
                      .arg(selectedCall()->index());
     } else if (selectedFrame()) {
-        ApiTraceCall *firstCall = selectedFrame()->call(0);
+        ApiTraceCall *firstCall =
+            static_cast<ApiTraceCall *>(selectedFrame()->eventAtRow(0));
         if (firstCall) {
             imageIndex = tr("_frame_%1")
                          .arg(firstCall->index());