]> git.cworth.org Git - apitrace/commitdiff
Show the call for which the surface we're displaying.
authorZack Rusin <zack@kde.org>
Sat, 23 Apr 2011 21:16:34 +0000 (17:16 -0400)
committerZack Rusin <zack@kde.org>
Sat, 23 Apr 2011 21:16:34 +0000 (17:16 -0400)
gui/mainwindow.cpp
gui/mainwindow.h

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"
index 0e9eaa7f8b8bffd5c428a6fa1933e01c3a35d82a..f276f2e962674f7c69fa70ebdb84673149742d9e 100644 (file)
@@ -77,6 +77,7 @@ private:
     void replayTrace(bool dumpState);
     void fillStateForFrame();
     ApiTraceFrame *currentFrame() const;
+    ApiTraceCall *currentCall() const;
 
 private:
     Ui_MainWindow m_ui;