From: Zack Rusin Date: Sat, 23 Apr 2011 21:16:34 +0000 (-0400) Subject: Show the call for which the surface we're displaying. X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=be547735502f66c86db27c5f5df851c20001d1e7;p=apitrace Show the call for which the surface we're displaying. --- diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 9a50510..54fe041 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -564,6 +564,16 @@ void MainWindow::showSelectedSurface() QVariant var = item->data(0, Qt::UserRole); QImage img = var.value(); 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(m_selectedEvent); + } + return NULL; +} + #include "mainwindow.moc" diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 0e9eaa7..f276f2e 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -77,6 +77,7 @@ private: void replayTrace(bool dumpState); void fillStateForFrame(); ApiTraceFrame *currentFrame() const; + ApiTraceCall *currentCall() const; private: Ui_MainWindow m_ui;