]> git.cworth.org Git - apitrace/blobdiff - gui/mainwindow.cpp
Show the call for which the surface we're displaying.
[apitrace] / gui / mainwindow.cpp
index 9a50510ccbfaaeb5ac4bf0e6f6275001b33b795e..54fe041b2f7409a55c914e0487662f0ea56447ab 100644 (file)
@@ -564,6 +564,16 @@ void MainWindow::showSelectedSurface()
     QVariant var = item->data(0, Qt::UserRole);
     QImage img = var.value<QImage>();
     ImageViewer *viewer = new ImageViewer(this);
+
+    QString title;
+    if (currentCall()) {
+        title = tr("QApiTrace - Surface at %1 (%2)")
+                .arg(currentCall()->name())
+                .arg(currentCall()->index());
+    } else {
+        title = tr("QApiTrace - Surface Viewer");
+    }
+    viewer->setWindowTitle(title);
     viewer->setAttribute(Qt::WA_DeleteOnClose, true);
     viewer->setImage(img);
     QRect screenRect = QApplication::desktop()->availableGeometry();
@@ -1060,4 +1070,13 @@ void MainWindow::slotErrorSelected(QTreeWidgetItem *current)
     }
 }
 
+ApiTraceCall * MainWindow::currentCall() const
+{
+    if (m_selectedEvent &&
+        m_selectedEvent->type() == ApiTraceEvent::Call) {
+        return static_cast<ApiTraceCall*>(m_selectedEvent);
+    }
+    return NULL;
+}
+
 #include "mainwindow.moc"